你好,答案如下这里适用于 moderncv 的经典风格,但一旦我切换到银行风格,Latex 就无法识别它Undefined control sequence.\makecvheadnamewidth
(旧语法也\makecvtitlenamewidth
不起作用)。
附言:我不想要一个复杂的替代方案,\makecvheadnamewidth
只是为了让长名称合适。我也想让它适合银行风格。
\documentclass[10pt,a4paper,roman]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.85]{geometry}
\nopagenumbers{}
%\setlength{\makecvheadnamewidth}{15cm}
%\renewcommand*{\namefont}{\fontsize{30}{29}\mdseries\upshape}
\title{here comes the title here comes the title}
\firstname{My Name Is very}
\familyname{VeryLong}
\address{address comes here}{14000}
\phone[mobile]{00~00~00~00~00}
\email{[email protected]}
\extrainfo{0 ans Permis B}
\begin{document}
\maketitle
\end{document}
顺便说一句:我正在使用最新版本的 MiKTeX moderncv
。
答案1
好吧,从当前版本开始,moderncv
您可以在编译后查看日志文件。在那里,您可以找到banking
用于...headiii
创建此样式的头部的样式。classic
或者casual
干脆使用另一个文件...head?
。这就是您第一次使用的命令无法识别的原因,因为它根本没有在头部 3 中使用。
使用包xpatch
你可以更改此文件的相关部分:
\usepackage{xpatch} % to patch the command ...
\xpatchcmd{\makehead}{%
\setlength{\makeheaddetailswidth}{0.8\textwidth}%
}{%
\setlength{\makeheaddetailswidth}{0.95\textwidth}%
}{}{}
如图所示,您可以使用 之前的数字\textwidth
。标准数字是0.8
。这意味着使用文本宽度的 80%。
将此代码添加到您的 MWE 中可得到:
\documentclass[10pt,a4paper,roman]{moderncv}
\moderncvstyle{banking} % head3 body3
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.85]{geometry}
\nopagenumbers{}
%\setlength{\makecvheadnamewidth}{15cm}
%\renewcommand*{\namefont}{\fontsize{30}{29}\mdseries\upshape}
\title{here comes the title here comes the title}
\firstname{My Name Is very}
\familyname{VeryLong}
\address{address comes here}{14000}
\phone[mobile]{00~00~00~00~00}
\email{[email protected]}
\extrainfo{0 ans Permis B}
\usepackage{showframe} % to visualize the typing area ...
\usepackage{xpatch} % to patch the command ...
\xpatchcmd{\makehead}{%
\setlength{\makeheaddetailswidth}{0.8\textwidth}%
}{%
\setlength{\makeheaddetailswidth}{0.95\textwidth}%
}{}{}
\begin{document}
\maketitle
\end{document}
结果如下:
获取此信息所使用的软件包和版本号是(将其\listfiles
作为第一行添加到代码中以获取文件末尾的列表log
):
*File List*
moderncv.cls 2015/07/28 v2.0.0 modern curriculum vitae and letter document class
size10.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 2016/05/11 v2.12 LaTeX color extensions (UK)
color.cfg 2016/01/02 v1.6 sample color configuration
pdftex.def 2016/06/17 v0.06h Graphics/color for pdfTeX
infwarerr.sty 2016/05/16 v1.4 Providing info/warning/error messages (HO)
ltxcmds.sty 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
colortbl.sty 2012/02/13 v1.0a Color table columns (DPC)
array.sty 2014/10/28 v2.4c Tabular extension package (FMi)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
ifluatex.sty 2016/05/16 v1.4 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 2016/06/02 v1.0s Standard LaTeX Graphics (DPC,SPQR)
trig.sty 2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg 2016/06/04 v1.11 sample graphics configuration
fancyhdr.sty
tweaklist.sty
calc.sty 2014/10/28 v4.3 Infix arithmetic (KKT,FJ)
xparse.sty 2016/05/18 v6512 L3 Experimental document command parser
expl3.sty 2016/05/18 v6512 L3 programming layer (loader)
expl3-code.tex 2016/05/18 v6512 L3 programming layer
l3pdfmode.def 2016/03/26 v6465 L3 Experimental driver: PDF mode
microtype.sty 2016/05/14 v2.6a Micro-typographical refinements (RS)
microtype-pdftex.def 2016/05/14 v2.6a Definitions specific to pdftex (RS)
microtype.cfg 2016/05/14 v2.6a microtype main configuration file (RS)
moderncvcollection.sty 2015/07/28 v2.0.0 moderncv collections
moderncvcompatibility.sty 2015/07/28 v2.0.0 modern curriculum vitae and letter compatibility patches
moderncvstylebanking.sty 2015/07/28 v2.0.0 modern curriculum vitae and letter style scheme: banking
tgpagella.sty 2009/09/27 v1.2 TeX Gyre Pagella as default roman family
kvoptions.sty 2016/05/16 v3.12 Key value format for package options (HO)
kvsetkeys.sty 2016/05/16 v1.17 Key value parser (HO)
etexcmds.sty 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
moderncviconsawesome.sty 2015/07/28 v2.0.0 modern curriculum vitae and letter icons: awesome
fontawesome.sty 2016/05/15 v4.6.3.1 font awesome icons
fontawesomesymbols-generic.tex
fontawesomesymbols-pdftex.tex
moderncvheadiii.sty 2015/07/28 v2.0.0 modern curriculum vitae and letter header variant: 3
moderncvbodyiii.sty 2015/07/28 v2.0.0 modern curriculum vitae and letter body variant: 3
t1qpl.fd 2009/09/25 v1.2 font definition file for T1/qpl
ufontawesometwo.fd 2016/05/22 Font definitions for U/fontawesometwo.
moderncvcolorblue.sty 2015/07/28 v2.0.0 modern curriculum vitae and letter color scheme: blue
inputenc.sty 2015/03/17 v1.2c Input encoding file
utf8.def 2016/02/28 v1.1s UTF-8 support for inputenc
t1enc.dfu 2016/02/28 v1.1s UTF-8 support for inputenc
ot1enc.dfu 2016/02/28 v1.1s UTF-8 support for inputenc
omsenc.dfu 2016/02/28 v1.1s UTF-8 support for inputenc
geometry.sty 2010/09/12 v5.6 Page Geometry
ifpdf.sty 2016/05/14 v3.1 Provides the ifpdf switch
ifvtex.sty 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
geometry.cfg
showframe.sty 2011/02/24 v0.1i showframe (new impl., RN)
eso-pic.sty 2015/07/21 v2.0g eso-pic (RN)
atbegshi.sty 2016/06/09 v1.18 At begin shipout hook (HO)
xpatch.sty 2012/10/02 v0.3 Extending etoolbox patching commands
hyperref.sty 2016/05/21 v6.83p Hypertext links for LaTeX
hobsub-hyperref.sty 2016/05/16 v1.14 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty 2016/05/16 v1.14 Bundle oberdiek, subset generic (HO)
hobsub.sty 2016/05/16 v1.14 Construct package bundles (HO)
intcalc.sty 2016/05/16 v1.2 Expandable calculations with integers (HO)
kvdefinekeys.sty 2016/05/16 v1.4 Define keys (HO)
pdftexcmds.sty 2016/05/21 v0.22 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty 2016/05/16 v1.14 Implements pdfTeX's escape features (HO)
bigintcalc.sty 2016/05/16 v1.4 Expandable calculations on big integers (HO)
bitset.sty 2016/05/16 v1.2 Handle bit-vector datatype (HO)
uniquecounter.sty 2016/05/16 v1.3 Provide unlimited unique counter (HO)
letltxmacro.sty 2016/05/16 v1.5 Let assignment for LaTeX macros (HO)
hopatch.sty 2016/05/16 v1.3 Wrapper for package hooks (HO)
xcolor-patch.sty 2016/05/16 xcolor patch
atveryend.sty 2016/05/16 v1.9 Hooks at the very end of document (HO)
refcount.sty 2016/05/16 v3.5 Data extraction from label references (HO)
hycolor.sty 2016/05/16 v1.8 Color options for hyperref/bookmark (HO)
auxhook.sty 2016/05/16 v1.4 Hooks for auxiliary files (HO)
pd1enc.def 2016/05/21 v6.83p Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
puenc.def 2016/05/21 v6.83p Hyperref: PDF Unicode definition (HO)
hpdftex.def 2016/05/21 v6.83p Hyperref driver for pdfTeX
rerunfilecheck.sty 2016/05/16 v1.8 Rerun checks for auxiliary files (HO)
supp-pdf.mkii
epstopdf-base.sty 2016/05/15 v2.6 Base part for package epstopdf
grfext.sty 2016/05/16 v1.2 Manage graphics extensions (HO)
mt-ppl.cfg 2005/11/16 v1.6 microtype config. file: Palatino (RS)
nameref.sty 2016/05/21 v2.44 Cross-referencing by name of section
gettitlestring.sty 2016/05/16 v1.5 Cleanup title references (HO)
更新:
要将名称和标题并排,就需要对标题的构建进行大量的重新设计,因为这只有使用tabular
环境或类似环境才有可能......
因为你想要一种简单的方法,为什么不把名字放在第一行,标题放在第二行而不加分隔符呢?使用以下补丁可以轻松完成(\makeatletter
现在需要这些补丁,因为在那部分代码中\makeatother
使用了):@
\makeatletter
\xpatchcmd{\makehead}{%
\titlestyle{~|~\@title}%
}{%
\\\vspace*{10pt}\titlestyle{\@title}\vspace*{10pt}%
}{}{false}
\makeatother
拥有完整的 MWE
\listfiles
\documentclass[10pt,a4paper,roman]{moderncv}
\moderncvstyle{banking} % head3 body3
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.85]{geometry}
\nopagenumbers{}
%\setlength{\makecvheadnamewidth}{15cm}
%\renewcommand*{\namefont}{\fontsize{30}{29}\mdseries\upshape}
\title{here comes the title here comes the title}
\firstname{My Name Is very}
\familyname{VeryLong}
\address{address comes here}{14000}
\phone[mobile]{00~00~00~00~00}
\email{[email protected]}
\extrainfo{0 ans Permis B}
\usepackage{showframe} % to visualize the typing area ...
\usepackage{xpatch} % to patch the command ...
\xpatchcmd{\makehead}{%
\setlength{\makeheaddetailswidth}{0.8\textwidth}%
}{%
\setlength{\makeheaddetailswidth}{0.95\textwidth}%
}{}{}
\makeatletter
\xpatchcmd{\makehead}{%
\titlestyle{~|~\@title}%
}{%
\\\titlestyle{\@title}%
}{}{}
\makeatother
\begin{document}
\maketitle
\end{document}
您将获得最终的 pdf:
这有帮助吗?