\flushmaketitle 未定义

\flushmaketitle 未定义

我真的很抱歉问这个问题,但我发现自己无法回答,也不知道哪里出了问题:

我使用 LaTeX 创建了一个简历模板,一年来它一直运行良好,但我 2 个月没动过它。最近我不得不升级我的 Linux 发行版,并在此过程中丢失了许多库(我提到它,但不知道它是否相关)。故事的结局是,现在,我无法编译我的.tex代码。

在各种警告中,我看到了错误:

!LaTeX 错误:\flushmaketitle 未定义。

请参阅 LaTeX 手册或 LaTeX Companion 了解解释。输入 H 可立即获得帮助。...

                                               l.24               

\renewcommand*{\flushmaketitle}

另一个可能相关的警告是

LaTeX 警告:您已请求包moderncvheadiii', but the package providesmoderncvheadiii'。

LaTeX 警告:您已请求包moderncvbodyiii', but the package providesmoderncvbodyiii'。

以下是该文件的清除版本.tex

\documentclass[11pt,a4paper]{moderncv}
    \moderncvstyle{banking}
    \moderncvcolor{black}                 
\usepackage[utf8]{inputenc} 
\usepackage[hscale=0.8, vscale=1, top=2.5cm]{geometry}
%\usepackage{libertine}
%\usepackage[sfdefault, light]{roboto}  %% Option 'sfdefault' only if the base font of the document is to be sans serif
\usepackage[T1]{fontenc}
\usepackage[skins]{tcolorbox}
\renewcommand{\sfdefault}{phv}
\renewcommand{\seriesdefault}{l}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
\usetikzlibrary{patterns}
\usepackage{booktabs}

\definecolor{color0}{rgb}{0.,0.,0.}       
\definecolor{color1}{rgb}{0., 0.6, 0.8}  

            \makeatletter
                \renewcommand{\familydefault}{\sfdefault}

                \renewcommand*{\flushmaketitle}{%
                  \strut\usebox{\maketitlebox}%
                  \savebox{\maketitlebox}{}%
                  \savebox{\maketitletempbox}{}%
                  \setlength{\maketitleboxwidth}{0pt}}

                \renewcommand*{\maketitle}{
                  \setlength{\maketitlewidth}{0.7\textwidth}
                  \parbox{\maketitlewidth}{
                    \raggedright

                    \namestyle{\@firstname~\@lastname}\\
                    \vspace{0.2cm}
                    \addressfont\color{color2}%
                    \vspace{0.1cm}
                    \ifthenelse{\isundefined{\@addressstreet}}{}{\addtomaketitle{\addresssymbol\@addressstreet}%
                      \ifthenelse{\equal{\@addresscity}{}}{}{\addtomaketitle[~--~]{\@addresscity}
                     %
                     \flushmaketitle 
                     \@firstmaketitleelementtrue}
                     }
                     %}
                    \addtomaketitle{\emaillink{\@email}}

                    \collectionloop{phones}{\addtomaketitle{\@mobile}}
                    \vspace{0.1cm}

                    \ifthenelse{\isundefined{\@extrainfo}}{}{\addtomaketitle{\@extrainfo}}%
                    \ifthenelse{\isundefined{\@title}}{}{\addtomaketitle{\@title}}%
                    %\ifthenelse{\isundefined{\@fax}}{}{\addtomaketitle{\@fax}}%
                                    \vspace{0.1cm}
                    \flushmaketitle}\\[2.5em]}

                \newcommand{\cfbox}[2]{%
                    \colorlet{currentcolor}{.}%
                    {\color{#1}%
                        \fbox{\color{currentcolor}#2}}%
                }

            %   \patchcmd{\maketitle}{\\[2.5em]}{\hfill\raisebox{-1.5cm}{\cfbox{color1}{\includegraphics[width=80pt]{/home/pierre/Documents/Personnel/CVFR/moi1}}}\\[2.5em]}
            \makeatother

\firstname{Pierre}
\familyname{Doe}
\address{Street}{Lane}
\mobile{+60669412}
\email{[email protected]}
\extrainfo{age\hspace{7pt}} 
\title{\hspace{1pt}} 
\fax{} 

\begin{document}  
    \makecvtitle
\nopagenumbers{}

% this puts a dashed thing on the header
%   \begin{tikzpicture}
%   \fill[pattern=dots, pattern color=color1, overlay] (-0.2,0.2) rectangle (17,4.4);
%   \end{tikzpicture}

    \begin{tikzpicture}[radius=1cm,delta angle=180, overlay]
    \node[circle,draw=color1,inner sep=1.3cm,fill overzoom image=/home/pierre/Documents/.jpg] (A) at (15cm,2.8cm) {};
    \end{tikzpicture}


\vspace{0pt}\section{Formation}\vspace{4pt}
    \cventry{something}{something}{}{}{}{}\vspace{-12pt}

\end{document}

答案1

嗯,在新版本 2.0 中,moderncv旧版本被重命名flushmaketitleflushmakeheaddetails

这意味着您可以尝试将导致错误的命令更改\renewcommand\newcommand(因为现在必须定义以下命令)如下

% <=====================================================================
\newcommand*{\flushmaketitle}{%  new version 2.0 flushmaketitle -> flushmakeheaddetails

这对我来说是编译成功的,但我不知道您期望什么,现在可能还有其他错误。请使用以下 MWE 检查:

\documentclass[11pt,a4paper]{moderncv}

\moderncvstyle{banking}
\moderncvcolor{black} 

\usepackage[utf8]{inputenc} 
\usepackage[hscale=0.8, vscale=1, top=2.5cm]{geometry}
%\usepackage{libertine}
%\usepackage[sfdefault, light]{roboto}  %% Option 'sfdefault' only if the base font of the document is to be sans serif
\usepackage[T1]{fontenc}
\usepackage[skins]{tcolorbox}
\renewcommand{\sfdefault}{phv}
\renewcommand{\seriesdefault}{l}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
\usetikzlibrary{patterns}
\usepackage{booktabs}

\definecolor{color0}{rgb}{0.,0.,0.}       
\definecolor{color1}{rgb}{0., 0.6, 0.8}  

\makeatletter
\renewcommand{\familydefault}{\sfdefault}

% <=====================================================================
\newcommand*{\flushmaketitle}{%  new version 2.0 flushmaketitle -> flushmakeheaddetails
  \strut\usebox{\maketitlebox}%
  \savebox{\maketitlebox}{}%
  \savebox{\maketitletempbox}{}%
  \setlength{\maketitleboxwidth}{0pt}%
}

\renewcommand*{\maketitle}{
  \setlength{\maketitlewidth}{0.7\textwidth}
  \parbox{\maketitlewidth}{
    \raggedright

  \namestyle{\@firstname~\@lastname}\\
  \vspace{0.2cm}
  \addressfont\color{color2}%
  \vspace{0.1cm}
  \ifthenelse{\isundefined{\@addressstreet}}{}{%
    \addtomaketitle{\addresssymbol\@addressstreet}%
    \ifthenelse{\equal{\@addresscity}{}}{}{\addtomaketitle[~--~]{\@addresscity}
    %
    \flushmaketitle 
    \@firstmaketitleelementtrue}
  }
                     %}
                    \addtomaketitle{\emaillink{\@email}}

                    \collectionloop{phones}{\addtomaketitle{\@mobile}}
                    \vspace{0.1cm}

                    \ifthenelse{\isundefined{\@extrainfo}}{}{\addtomaketitle{\@extrainfo}}%
                    \ifthenelse{\isundefined{\@title}}{}{\addtomaketitle{\@title}}%
                    %\ifthenelse{\isundefined{\@fax}}{}{\addtomaketitle{\@fax}}%
                                    \vspace{0.1cm}
                    \flushmaketitle}\\[2.5em]}

\newcommand{\cfbox}[2]{%
  \colorlet{currentcolor}{.}%
  {\color{#1}%
  \fbox{\color{currentcolor}#2}}%
}

%\patchcmd{\maketitle}{\\[2.5em]}{\hfill\raisebox{-1.5cm}{\cfbox{color1}{\includegraphics[width=80pt]{/home/pierre/Documents/Personnel/CVFR/moi1}}}\\[2.5em]}
\makeatother

\firstname{Pierre}
\familyname{Doe}
\address{Street}{Lane}
\mobile{+60669412}
\email{[email protected]}
\extrainfo{age\hspace{7pt}} 
\title{\hspace{1pt}} 
\fax{} 


\begin{document}  
\makecvtitle
\nopagenumbers{}

% this puts a dashed thing on the header
%   \begin{tikzpicture}
%   \fill[pattern=dots, pattern color=color1, overlay] (-0.2,0.2) rectangle (17,4.4);
%   \end{tikzpicture}

    \begin{tikzpicture}[radius=1cm,delta angle=180, overlay]
    \node[circle,draw=color1,inner sep=1.3cm,fill overzoom image=example-image-a.jpg] (A) at (15cm,2.8cm) {}; % image=/home/pierre/Documents/.jpg
    \end{tikzpicture}


\vspace{0pt}\section{Formation}\vspace{4pt}
    \cventry{something}{something}{}{}{}{}\vspace{-12pt}

\end{document}

我也更改了图像文件名并得到结果:

在此处输入图片描述

这接近您需要的吗?如果不是,唯一的机会就是安装旧版本moderncv或更改代码以便能够使用版本 2.0(在我看来这会更好...)

相关内容