Moderncv 无法编译

Moderncv 无法编译

我只是想尝试一下 moderncv 类,当我尝试编译任何示例时,出现以下错误:

! Undefined control sequence.
l.16 \@initializecommand
                        {\moderncvstyleheadoptions}{}

! Undefined control sequence.
l.16 \@initializecommand{\moderncvstyleheadoptions
                                                  }{}

! Undefined control sequence.
\ds@left ...eadoptions {\moderncvstyleheadoptions 
                                                  ,left}
l.21 \ExecuteOptions{left}

我已经安装了 moderncv,我也尝试将它放在与项目相同的文件夹中(实际上,我被提示代码行

\@initializecommand{\moderncvstyleheadoptions}{}

对于第一个错误,如果我单击编辑器 (TeXnicCenter) 中的错误。有什么想法吗?

编辑:使用 MikTex 2.9、Windows 7、moderncv 版本 2.0.0(2015 年 7 月 28 日)

对于 .tex 代码,只需复制一个标准示例。删除几行后,它看起来像这样:

\documentclass[11pt,a4paper]{moderncv}
\moderncvtheme[blue]{classic}  

\firstname {name}    % Your name
\lastname {Last name} % Your last name
\title {Title}              % Your title (optional)
\address{street and number}{post code and city} % Your current address
\mobile {number}    % Your mobile phone number
\phone {number}    % Your phone number
\email {email}          % Your email address
\homepage {link}    % Your website
\extrainfo {information} % Possible extra information e.g. website
\photo[64pt][0.4pt]{picture}  % Your photo (optional)
\quote {quote} % Life motto or something like that (optional)

\begin{document}
\maketitle

\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}
\cvlanguage{Language 1}{Skill level}{Comment}
\cvcomputer{category 1}{XXX, YYY, ZZZ}{category 4}{XXX, YYY, ZZZ}
\cvline{hobby 1}{\small Description}
\end{document}

编辑 II:请求的列表文件

 *File List*
moderncv.cls    2013/04/29 v1.5.1 modern curriculum vitae and letter document class
  size11.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
etoolbox.sty    2015/08/02 v2.2a e-TeX tools for LaTeX (JAW)
  ifthen.sty    2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
  xcolor.sty    2007/01/21 v2.11 LaTeX color extensions (UK)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
  pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
 fontenc.sty
   t1enc.def    2005/09/27 v1.99g Standard LaTeX file
 lmodern.sty    2009/10/30 v1.6 Latin Modern Fonts
     url.sty    2013/09/16  ver 3.4  Verb mode for urls, etc.
graphicx.sty    2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
graphics.sty    2014/10/28 v1.0p Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2007/01/18 v1.5 graphics configuration of teTeX/TeXLive
fancyhdr.sty    
tweaklist.sty    
    calc.sty    2014/10/28 v4.3 Infix arithmetic (KKT,FJ)
  xparse.sty    2016/01/19 v6377 L3 Experimental document command parser
   expl3.sty    2016/01/19 v6377 L3 programming layer (loader) 
expl3-code.tex    2016/01/19 v6377 L3 programming layer 
l3pdfmode.def    2015/11/11 v6250 L3 Experimental driver: PDF mode
microtype.sty    2013/05/23 v2.5a Micro-typographical refinements (RS)
microtype-pdftex.def    2013/05/23 v2.5a Definitions specific to pdftex (RS)
microtype.cfg    2013/05/23 v2.5a microtype main configuration file (RS)
moderncvcollection.sty    2015/07/28 v2.0.0 moderncv collections
moderncvcompatibility.sty    2013/04/29 v1.5.1 modern curriculum vitae and letter compatibility patches
moderncvcolorblue.sty    2015/07/28 v2.0.0 modern curriculum vitae and letter color scheme: blue
moderncvstyleclassic.sty    2015/07/28 v2.0.0 modern curriculum vitae and letter style scheme: classic
moderncviconsmarvosym.sty    2015/07/28 v2.0.0 modern curriculum vitae and letter icons: marvosym
    tikz.sty    2015/08/07 v3.0.1a (rcs-revision 1.151)
     pgf.sty    2015/08/07 v3.0.1a (rcs-revision 1.15)
  pgfrcs.sty    2015/08/07 v3.0.1a (rcs-revision 1.31)
everyshi.sty    2001/05/15 v3.00 EveryShipout Package (MS)
  pgfrcs.code.tex
 pgfcore.sty    2010/04/11 v3.0.1a (rcs-revision 1.7)
  pgfsys.sty    2014/07/09 v3.0.1a (rcs-revision 1.48)
  pgfsys.code.tex
pgfsyssoftpath.code.tex    2013/09/09  (rcs-revision 1.9)
pgfsysprotocol.code.tex    2006/10/16  (rcs-revision 1.4)
 pgfcore.code.tex
pgfcomp-version-0-65.sty    2007/07/03 v3.0.1a (rcs-revision 1.7)
pgfcomp-version-1-18.sty    2007/07/23 v3.0.1a (rcs-revision 1.1)
  pgffor.sty    2013/12/13 v3.0.1a (rcs-revision 1.25)
 pgfkeys.sty    
 pgfkeys.code.tex
 pgfmath.sty    
 pgfmath.code.tex
  pgffor.code.tex
    tikz.code.tex
hyperref.sty    2012/11/06 v6.83m Hypertext links for LaTeX
hobsub-hyperref.sty    2012/04/25 v1.12 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty    2012/04/25 v1.12 Bundle oberdiek, subset generic (HO)
  hobsub.sty    2012/04/25 v1.12 Construct package bundles (HO)
  ifvtex.sty    2010/03/01 v1.5 Detect VTeX and its facilities (HO)
 intcalc.sty    2007/09/27 v1.1 Expandable calculations with integers (HO)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty    2011/11/25 v1.13 Implements pdfTeX's escape features (HO)
bigintcalc.sty    2012/04/08 v1.3 Expandable calculations on big integers (HO)
  bitset.sty    2011/01/30 v1.1 Handle bit-vector datatype (HO)
uniquecounter.sty    2011/01/30 v1.2 Provide unlimited unique counter (HO)
letltxmacro.sty    2010/09/02 v1.4 Let assignment for LaTeX macros (HO)
 hopatch.sty    2011/06/24 v1.1 Wrapper for package hooks (HO)
xcolor-patch.sty    2011/01/30 xcolor patch
atveryend.sty    2011/06/30 v1.8 Hooks at the very end of document (HO)
atbegshi.sty    2011/10/05 v1.16 At begin shipout hook (HO)
refcount.sty    2011/10/16 v3.4 Data extraction from label references (HO)
 hycolor.sty    2011/01/30 v1.7 Color options for hyperref/bookmark (HO)
 auxhook.sty    2011/03/04 v1.3 Hooks for auxiliary files (HO)
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
  pd1enc.def    2012/11/06 v6.83m Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg    2002/06/06 v1.2 hyperref configuration of TeXLive
   puenc.def    2012/11/06 v6.83m Hyperref: PDF Unicode definition (HO)
 hpdftex.def    2012/11/06 v6.83m Hyperref driver for pdfTeX
rerunfilecheck.sty    2011/04/15 v1.7 Rerun checks for auxiliary files (HO)
   t1lmr.fd    2009/10/30 v1.6 Font defs for Latin Modern
supp-pdf.mkii
  mt-cmr.cfg    2013/05/19 v2.2 microtype config. file: Computer Modern Roman (RS)
 nameref.sty    2012/10/27 v2.43 Cross-referencing by name of section
gettitlestring.sty    2010/12/03 v1.4 Cleanup title references (HO)
ModernCV.out
ModernCV.out
 ***********

答案1

您的计算机上的 TeX 发行版安装似乎存在问题,或者您尝试moderncv在计算机上安装两个不同的版本(1.5.1 和 2.0.0)。请检查这一点。最好的方法是更新您的 TeX 发行版,然后检查所有软件包(moderncv也)是否是最新的。如何执行此操作取决于您的操作系统和使用的 TeX 发行版(请在本页搜索与更新相关的问题)。

您将命令命名为\@initializecommand{\moderncvstyleheadoptions}{}。此命令仅在 2.0.0 版本中使用,但您的日志文件告诉我们,您使用的是 1.5.1 版本moderncv。因此似乎使用了不同版本的部分内容。由于某些命令从 1.5.1 版本更改为 2.0.0 版本,因此您遇到了问题。

由于某些命令已更改,我建议您使用以下 MWE(请查看我更改代码的注释)。修复版本问题后,它应该可以在您的计算机上运行。

例如,您的命令 cvline已过时。

梅威瑟:

\documentclass[11pt,a4paper]{moderncv} % version 1.5.1

%\moderncvtheme[blue]{classic}  % used in version <= 0.15
\moderncvstyle{classic}
\moderncvcolor{blue}

\firstname{firstname}     % Your name
\lastname{Lastname}       % Your last name
\title{Title}             % Your title (optional)
\address{street and number}{post code and city}   % Your current address
\mobile{number}           % Your mobile phone number
\phone{number}            % Your phone number
\email{email}             % Your email address
\homepage{link}           % Your website
\extrainfo{information}   % Possible extra information e.g. website
\photo[64pt][0.4pt]{example-image-a}             % Your photo (optional)
\quote{quote}             % Life motto or something like that (optional)

\setlength{\footskip}{52pt} % to avoid warning


\begin{document}
\maketitle

\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}
\cvlanguage{Language 1}{Skill level}{Comment}
\cvcomputer{category 1}{XXX, YYY, ZZZ}{category 4}{XXX, YYY, ZZZ}
%\cvline{hobby 1}{\small Description} % cvline used in version <= 0.15
\cvitem{hobby 1}{Description}
\end{document}

我无法使用 1.5.1 版本进行测试,因为我正在使用 2.0.0 版本,但它应该可以编译。

相关内容