我不明白为什么下面的 latex 代码会出错。我觉得没什么不对。你能找出这个错误发生的原因吗?我添加了一个图像来显示错误消息。我在 TeXStudio 和 MiKTEX 中编写了此代码。
\documentclass[11pt,a4paper]{moderncv}
% moderncv themes
%\moderncvtheme[blue]{casual} % optional argument are 'blue' (default), 'orange', 'red', 'green', 'grey' and 'roman' (for roman fonts, instead of sans serif fonts)
\moderncvtheme[blue]{classic} % idem
% character encoding
\usepackage[applemac]{inputenc} % to print ä ö ü
% adjust the page margins
\usepackage[scale=0.85]{geometry}
\setlength{\hintscolumnwidth}{3cm} % if you want to change the width of the column with the dates
\AtBeginDocument{\setlength{\maketitlenamewidth}{9cm}} % only for the classic theme, if you want to change the width of your name placeholder (to leave more space for your address details
\AtBeginDocument{\recomputelengths} % required when changes are made to page layout lengths
% Define \cvdoublecolumn, which sets its arguments in two columns without any labels
\newcommand{\cvdoublecolumn}[2]{%
\cvitem[0.75em]{}{%
\begin{minipage}[t]{\listdoubleitemmaincolumnwidth}#1\end{minipage}%
\hfill%
\begin{minipage}[t]{\listdoubleitemmaincolumnwidth}#2\end{minipage}%
}%
}
% usage: \cvreference{name}{address line 1}{address line 2}{address line 3}{address line 4}{e-mail address}{phone number}
% Everything but the name is optional
% If \addresssymbol, \emailsymbol or \phonesymbol are specified, they will be used.
% (Per default, \addresssymbol isn't specified, the other two are specified.)
% If you don't like the symbols, remove them from the following code, including the tilde ~ (space).
\newcommand{\cvreference}[8]{%
\textbf{#1}\newline% Name
\ifthenelse{\equal{#2}{}}{}{\addresssymbol~#2\newline}%
\ifthenelse{\equal{#3}{}}{}{#3\newline}%
\ifthenelse{\equal{#4}{}}{}{#4\newline}%
\ifthenelse{\equal{#5}{}}{}{#5\newline}%
\ifthenelse{\equal{#6}{}}{}{\emailsymbol~\texttt{#6}\newline}%
\ifthenelse{\equal{#7}{}}{}{\phonesymbol~#7\newline}%
\ifthenelse{\equal{#8}{}}{}{\mobilephonesymbol~#8}
}
%---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
\makeatletter
\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}
\makeatother
% bibliography with mutiple entries
%\usepackage{multibib}
%\newcites{book,misc}{{Books},{Others}}
%\nopagenumbers{} % uncomment to suppress automatic page numbering for CVs longer than one page
%----------------------------------------------------------------------------------
% content
%----------------------------------------------------------------------------------
\begin{document}
\maketitle
%---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
\section{Personal Information}
\section{Personal Statement}
\section{Masters Thesis}
\section{Professional Experience}
%---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
\section{Project Experience}
%---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
\section{Technical Skills}
\section{Web Links}
%---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
\section{References}
\end{document}
答案1
您没有向我们展示哪个命令会引发“缺失数字”错误。
对我来说很明显你使用的是旧版本的类moderncv
。当前版本是moderncv 2015/07/28 v2.0.0 modern curriculum vitae and letter document class
。
通过以下更正并添加一些虚拟信息,我可以进行编译而不会出现任何错误。
平均能量损失
\documentclass[11pt,a4paper]{moderncv}
% moderncv themes
%\moderncvtheme[blue]{casual} % optional argument are 'blue' (default), 'orange', 'red', 'green', 'grey' and 'roman' (for roman fonts, instead of sans serif fonts)
\moderncvtheme[blue]{classic} % idem
% character encoding
\usepackage[utf8]{inputenc} % to print ä ö ü
% adjust the page margins
\usepackage[scale=0.85]{geometry}
\setlength{\hintscolumnwidth}{3cm} % if you want to change the width of the column with the dates
%\AtBeginDocument{\setlength{\maketitlenamewidth}{9cm}} % only for the classic theme, if you want to change the width of your name placeholder (to leave more space for your address details
\AtBeginDocument{\setlength{\makecvheadnamewidth}{9cm}}
\AtBeginDocument{\recomputelengths} % required when changes are made to page layout lengths
% Define \cvdoublecolumn, which sets its arguments in two columns without any labels
\newcommand{\cvdoublecolumn}[2]{%
\cvitem[0.75em]{}{%
\begin{minipage}[t]{\listdoubleitemmaincolumnwidth}#1\end{minipage}%
\hfill%
\begin{minipage}[t]{\listdoubleitemmaincolumnwidth}#2\end{minipage}%
}%
}
% usage: \cvreference{name}{address line 1}{address line 2}{address line 3}{address line 4}{e-mail address}{phone number}
% Everything but the name is optional
% If \addresssymbol, \emailsymbol or \phonesymbol are specified, they will be used.
% (Per default, \addresssymbol isn't specified, the other two are specified.)
% If you don't like the symbols, remove them from the following code, including the tilde ~ (space).
\newcommand{\cvreference}[8]{%
\textbf{#1}\newline% Name
\ifthenelse{\equal{#2}{}}{}{\addresssymbol~#2\newline}%
\ifthenelse{\equal{#3}{}}{}{#3\newline}%
\ifthenelse{\equal{#4}{}}{}{#4\newline}%
\ifthenelse{\equal{#5}{}}{}{#5\newline}%
\ifthenelse{\equal{#6}{}}{}{\emailsymbol~\texttt{#6}\newline}%
\ifthenelse{\equal{#7}{}}{}{\phonesymbol~#7\newline}%
\ifthenelse{\equal{#8}{}}{}{\mobilephonesymbol~#8}
}
%---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
\makeatletter
\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}
\makeatother
% bibliography with mutiple entries
%\usepackage{multibib}
%\newcites{book,misc}{{Books},{Others}}
%\nopagenumbers{} % uncomment to suppress automatic page numbering for CVs longer than one page
%----------------------------------------------------------------------------------
% content
%----------------------------------------------------------------------------------
\name{John}{Doe}
\title{CV}
\address{street and number}{postcode city}
\mobile{+1~(234)~567~890}
\phone{+2~(345)~678~901}
\fax{+3~(456)~789~012}
\email{[email protected]}
\homepage{www.johndoe.com}
\begin{document}
\maketitle
\section{Personal Information}
\section{Personal Statement}
\section{Masters Thesis}
\section{Professional Experience}
\section{Project Experience}
\section{Technical Skills}
\section{Web Links}
\section{References}
\end{document}
参见更改后的行\AtBeginDocument{\setlength{\makecvheadnamewidth}{9cm}}
。新版本maketitlenamewidth
必须按照所示进行更改。
参见之前添加的虚拟信息\begin{document}
。
结果: