更新 Friggeri 的 CV - 使其与 texlive 2015 及更高版本兼容 - 错误太多

更新 Friggeri 的 CV - 使其与 texlive 2015 及更高版本兼容 - 错误太多

我正在根据 Friggeri 的模板更新我的旧简历,现在我使用的是 texlive 2015 而不是 texlive 2013,我发现了很多错误……

我使用 LuaLaTeX 和 Biber 编译了它作为参考书目。

我认为大多数错误都与参考书目有关,这种格式突然变得无法理解……

让我在下面包含一个 MWE,我认为其中大多数错误是:

这是一个 MWE tex 文件:

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

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

这是一个 MWE cls 文件:

\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
}

这是一个 MWE bib 文件:

@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}
}

我发现的一些错误如下(我可以使用 MWE 重现的错误):

未定义的控制序列。\section{Publications}

未定义控制序列。\printbibsection{article}

您不能在水平模式下使用“宏参数字符#”。 \printbibsection{article}

缺少插入的 $。\printbibsection{article}

您不能在数学模式下使用“\spacefactor”。 \printbibsection{article}

以及警告(我可以使用 MWE 重现的警告):

\printbibliography 的排序选项不再受支持,请使用 \newrefcontext 的“排序”选项。

命令 \small 在数学模式下无效

有人能帮我更新 Friggeri 的简历模板吗?我不知道这些错误/警告是什么意思,也不知道该如何解决。我认为更新这个简历模板对很多人来说真的很有用……

多谢!

答案1

一些书目代码可能需要简化,但这个答案将重点放在使事情再次正常运转上。

主要问题是名称格式(见biblatex3.3 名称格式)可以修复

\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}}

而不是当前的\DeclareNameFormat{author}。也许有比这更好的解决方案,但这将恢复正常功能。

另一个问题是该sorting选项不再作为参数有效\printbibliography,它需要传递给refcontext

所以我们想要

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

为了\printbibsection

\printbibsection中的手动重演也存在类似情况cv_10.tex

答案2

bibheading按照@moewe的建议进行替换,subbibliography一切都解决了。谢谢,我真的不想从头开始创建新的简历……

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

相关内容