[Tex/LaTex] Updating Friggeri’s CV – Making it work with texlive 2015 and up – Too many errors

biblatexcvfriggeri-cv

I am updating my old CV based on Friggeri's template, and now that I am using texlive 2015 instead of texlive 2013, I am finding maaaaany errors…

I compile it with LuaLaTeX and Biber for the bibliography.

I think most of the errors have to deal with the bibliography, which format all of a sudden is not understood…

Let me include a MWE below, where I think most of the errors are:

This is a MWE tex file:

\documentclass{MWE}
\addbibresource{MWE.bib}

\begin{document}
\section{Publications}
\printbibsection{article}
\clearpage
\end{document}

This is a MWE cls file:

\ProvidesClass{MWE}[2016/08/31 CV class]
\NeedsTeXFormat{LaTeX2e}
\DeclareOption{print}{\def\@cv@print{}}
\DeclareOption*{%
    \PassOptionsToClass{\CurrentOption}{article}%
}
\ProcessOptions\relax
\LoadClass{article}
\usepackage{hyperref}

%%%%%%%%%%%%%
% Structure %
%%%%%%%%%%%%%

\RequirePackage{parskip}
\newcounter{colorCounter}

\def\@sectioncolor#1#2#3#4#5{%
  {%
    \color{%
      \ifcase\value{colorCounter}%
        green\or%
        blue\or%
        magenta\or%
        yellow\or%
        brown\or%
        turquoise\fi%
    } #1#2#3#4#5%
  }%
  \stepcounter{colorCounter}%
}
\renewcommand{\section}[1]{
  \par\vspace{\parskip}
  {%
    \LARGE\headingfont\color{headercolor}%
    \@sectioncolor #1%
  }
  \par\vspace{\parskip}
}
\renewcommand{\subsection}[2]{
  \par\vspace{.5\parskip}%
  \Large\headingfont\color{headercolor} #2%
  \par\vspace{.25\parskip}%
}
\pagestyle{empty}

%%%%%%%%%%%%%%%%%%%%
% List environment %
%%%%%%%%%%%%%%%%%%%%

\setlength{\tabcolsep}{0pt}
\newenvironment{entrylist}{%
  \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}ll}
}{%
  \end{tabular*}
}
\renewcommand{\bfseries}{\headingfont\color{headercolor}}
\newcommand{\entry}[4]{%
  #1&\parbox[t]{11.8cm}{%
    \textbf{#2}%
    \hfill%
    {\footnotesize\addfontfeature{Color=lightgray} #3}%

    #4\vspace{\parsep}%
  }\\}

\makeatletter
\renewenvironment{entrylist}{%
  \par\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}ll}
}{%
  \end{tabular*}\par
}
\makeatother

%%%%%%%%%%%%%%%%
% Bibliography %
%%%%%%%%%%%%%%%%

\RequirePackage[style=verbose, maxnames=99, sorting=ydnt, backend=biber, dateabbrev=true]{biblatex}

\DeclareFieldFormat[article]{title}{#1\par}

\DeclareBibliographyDriver{article}{%
  \printfield{title}%
  \par\vspace{0.1\baselineskip}%
  \newblock%
  \printnames{author}%
  \par\vspace{0.1\baselineskip}%
  \newblock%
  {%
    \footnotesize \addfontfeature{Color=lightgray} \itshape%
    \usebibmacro{journal+issuetitle}%
    \setunit{\space}%
    \printfield{pages}%
    \newunit%
    \printlist{publisher}%
    %\setunit*{\addcomma\space}%
    %\printfield{year}%included in issuetitle
    \newunit%
  }
  \par\vspace{0.1\baselineskip}%
}

\DeclareFieldFormat[misc]{title}{#1\\}
\DeclareFieldFormat[misc]{type}{#1}

\newbibmacro*{bib:svtitle}{%
  \savefield{title}{\lasttitle}}

\newbibmacro*{bib:svauthor}{%
  \savename{author}{\lastauthor}}

\newbibmacro*{verifytitle}{%
    \iffieldequals{title}{\lasttitle}{\hspace{\bibhang}}{%
        \printfield{title}%
        \undef\lastauthor}%
    \usebibmacro{bib:svtitle}%
}

\renewbibmacro*{finentry}{\adddot\finentry}

\newbibmacro*{verifyauthor}{%
    \ifnameequals{author}{\lastauthor}
        {}
        {\printnames{author}\\}%
    \usebibmacro{bib:svauthor}}

\newbibmacro*{newtitle}{%
    \usebibmacro{verifytitle}}

\newbibmacro*{newauthor}{%
    \usebibmacro{verifyauthor}}

\DeclareBibliographyDriver{misc}{%
  \usebibmacro{newtitle}%
  \usebibmacro{newauthor}%
  {%
    \scriptsize \textcolor{lightgray}{\faCaretRight}%
  }
  {%
    \footnotesize \addfontfeature{Color=lightgray} \itshape%
    \hspace{5px}%
    \printfield{type} (\printfield{month} \printfield{year})%
    \setunit{\addperiod\space}%
    \printfield{note}%
    \setunit*{\addcomma\space}%
    \printlist{location}%
  }
  \usebibmacro{finentry}%
}

\DeclareFieldFormat[thesis]{title}{#1\par}

\DeclareBibliographyDriver{thesis}{%
  \printfield{title}%
  \par\vspace{0.1\baselineskip}%
  \newblock%
  \printnames{author}%
  \par\vspace{0.1\baselineskip}%
  \newblock%
  {%
    \footnotesize \addfontfeature{Color=lightgray} \itshape%
    \printfield{type}%
    \setunit{\addperiod\space}%
    \usebibmacro{institution+location+date}%
    \setunit{\addperiod\space}%
    \printfield{url}%
    \newunit%
  }
  \par\vspace{0.1\baselineskip}
}

\DeclareNameFormat{author}{%
  \small\addfontfeature{Color=lightgray}%
  \ifblank{#3}{}{#3\space}#1%
  \ifthenelse{\value{listcount}<\value{liststop}}
    {\addcomma\space}
    {}%
}

\newcommand{\printbibsection}[1]{
  \begin{refsection}
    \nocite{*}
    \printbibliography[sorting=chronological, type={#1}, heading=none]
  \end{refsection}
}

\DeclareSortingScheme{chronological}{
  \sort[direction=descending]{\field{year}}
  \sort[direction=descending]{\field{month}}
  \sort{\field{title}}
  \sort[direction=descending]{\field{day}} %I include the day in entries in the same month and year
}

This is a MWE bib file:

@article{Levine1991,
author = {Levine, A J and Momand, J and Finlay, C A},
journal = {Nature},
pages = {453--456},
title = {{The p53 tumor suppressor gene}},
volume = {351},
year = {1991}
}
@article{Scully2000,
author = {Scully, R and Livingston, D M},
journal = {Nature},
pages = {429--432},
title = {{In search of the tumour-suppressor functions of BRCA1 and BRCA2.}},
volume = {408},
year = {2000}
}

Some of the errors that I find are the following (the ones I can reproduce with the MWE):

Undefined control sequence. \section{Publications}

Undefined control sequence. \printbibsection{article}

You can't use `macro parameter character #' in horizontal mode.
\printbibsection{article}

Missing $ inserted. \printbibsection{article}

You can't use `\spacefactor' in math mode. \printbibsection{article}

And warnings (the ones I can reproduce with the MWE):

sorting option to \printbibliography is no longer supported, use
'sorting' option to \newrefcontext.

Command \small invalid in math mode

Could anyone help me update the Friggeri's CV template? I have no idea what these errors/warnings mean and how to solve them. I think updating this CV template could be really useful for many people…

Thanks a lot!

Best Answer

Some of the bibliography code could probably be streamlined, but this answer shall focus on making things work again.

The main problem is the name format (see biblatex 3.3 name formatting) which can be fixed with

\DeclareNameFormat{author}{%
  \small\addfontfeature{Color=lightgray}%
  \ifgiveninits
    {\usebibmacro{name:given-family}
      {\namepartfamily}
      {\namepartgiveni}
      {\namepartprefix}
      {\namepartsuffix}}
    {\usebibmacro{name:given-family}
      {\namepartfamily}
      {\namepartgiven}
      {\namepartprefix}
      {\namepartsuffix}}%
  \usebibmacro{name:andothers}}

instead of the current \DeclareNameFormat{author}. Maybe there is a better solution than that, but this will restore proper functionality.

Another issue is that the sorting option is not valid as an argument to \printbibliography any more, it needs to be passed to a refcontext.

So we want

\newcommand{\printbibsection}[2]{%
  \begin{refsection}%
    \newrefcontext[sorting=chronological]%
    \nocite{*}%
    \printbibliography[type={#1}, title={#2}, heading=subbibliography]%
  \end{refsection}}

for \printbibsection.

Something similar goes for the manual re-enactment of \printbibsection in cv_10.tex.

Related Question