我喜欢这个moderncv
casual
主题,但我想改变照片的顺序和名称/标题。
我尝试了这个问题中描述的解决方案:
! Undefined control sequence.
\maketitle ->{{\firstnamestyle
{\@firstname}~\familynamestyle {\@familyname}...
l.33 \maketitle
示例代码:
\documentclass[11pt,a4paper]{moderncv}
% moderncv themes
\moderncvtheme[blue]{casual}
\AtBeginDocument
{
% reverse the name and photo
\makeatletter
% maketitle
\renewcommand*{\maketitle}{%
{%
{\firstnamestyle{\@firstname}~\familynamestyle{\@familyname}}}%
\hfill%
\ifthenelse{\isundefined{\@photo}}%
{}%
{{\color{firstnamecolor}\framebox{\includegraphics[width=\@photowidth]{\@photo}}}\\[-.35em]}%
{\color{firstnamecolor}\rule{\textwidth}{.25ex}\\[2.5em]}%
% optional quote
\ifthenelse{\isundefined{\@quote}}%
{}%
{{\centering{}\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\\[2.5em]}}%
\par}% to avoid weird spacing bug at the first section if no blank line is left after \maketitle
\makeatother
}
\firstname{John}
\familyname{Doe}
\title{Curriculum Vitae}
\address{Example Street}{12345 Exampe Town}
\photo{picture}
\begin{document}
\maketitle
\end{document}
答案1
解决该类moderncv
已更改问题的一种方法可能是以下 MWE。后面的部分\AtBeginDocument
重写了 中的原始定义moderncv
。
请记住:如果班级moderncv
再次更改,您可能需要再次更改您的更正。也许要求的作者moderncv
集成一个更改姓名和图片位置的选项是一个好主意。
改变后的 MWE:
\documentclass[11pt,a4paper]{moderncv}
\moderncvstyle{casual}
\moderncvcolor{blue}
\firstname{John}
\familyname{Doe}
\title{Resumé title}
\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}
\extrainfo{additional information}
\photo[64pt][0.4pt]{picture}
\quote{Some quote}
\makeatletter
%\AtBeginDocument
%{
% reverse the name and photo
\renewcommand*{\makecvtitle}{%
\recomputecvlengths%
\makecvfooter%
% define optional picture
\newbox{\makecvtitlepicturebox}%
\savebox{\makecvtitlepicturebox}{%
\ifthenelse{\isundefined{\@photo}}%
{
\@initializelength{\makecvtitlepicturewidth}% Damit Länge bekannt bei Name
\settowidth{\makecvtitlepicturewidth}{0pt}%
}%
{%
\setlength\fboxrule{\@photoframewidth}%
\ifdim\@photoframewidth=0pt%
\setlength{\fboxsep}{0pt}\fi%
{\color{color1}\framebox{\includegraphics[width=\@photowidth]{\@photo}}}}
\@initializelength{\makecvtitlepicturewidth}% Damit Länge bekannt bei Name
\settowidth{\makecvtitlepicturewidth}{\usebox{\makecvtitlepicturebox}}%
}%
% end define optional picture
% name
% \parbox[b]{\textwidth-\makecvtitlepicturewidth}{%
{ \raggedright\namefont{\color{color2!50}\@firstname} {\color{color2}\@familyname}}%\lastname -> error
\hfill\usebox{\makecvtitlepicturebox}%
% \parbox[b]{\textwidth-\makecvtitlepicturewidth}{%
% \raggedleft\namefont{\color{color2!50}\@firstname} {\color{color2}\@lastname}}%\familyname
\\[-.35em]%
{\color{color2!50}\rule{\textwidth}{.25ex}}%
% optional title
\ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\null\hfill\titlestyle{\@title}}\\[2.5em]%
% optional quote
\ifthenelse{\isundefined{\@quote}}%
{}%
{{\null\hfill\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\hfill\null\\[2.5em]}}%
\par}%
%}% AtBeginDocument ende
\makeatother
\begin{document}
\makecvtitle
\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{ \textit{Grade} }{Description} % arguments 3 to 6 can be left empty
\cvitem{title}{ \emph{Title} }
\cvitemwithcomment{Language 1}{Skill level}{Comment}
\cvdoubleitem{category X}{XXX, YYY, ZZZ}{category Y}{XXX, YYY, ZZZ}
\cvlistitem{Item 1}
\cvlistdoubleitem{Item 2}{Item 3}
\end{document}
结果是:
更新至moderncv
2.0.0:
正如上面提到的,类moderncv
已经改变,因此您需要使用类版本的以下代码2.0.0
。
使用当前版本,moderncv 2015/07/28 v2.0.0 modern curriculum vitae and letter document class
您可以定义样式casual
并使用附加选项,[left]
以便将名称打印在左侧,将图像打印在简历标题的右侧,正如本问题所希望的那样。
请注意,有新的命令可用于定义电话号码等,以及添加新的信息,如linkedin
或github
...
请参阅以下 MWE(新代码以 标记<======
):
\documentclass[11pt,a4paper]{moderncv}
\moderncvstyle[left]{casual} % <========================================
\moderncvcolor{blue}
\name{John}{Doe} % <====================================================
\title{Resumé title}
\address{street and number}{postcode city}{country}
\phone[mobile]{+1~(234)~567~890} % <====================================
\phone[fixed]{+2~(345)~678~901} % <=====================================
\phone[fax]{+3~(456)~789~012} % <=======================================
\email{[email protected]}
\homepage{www.johndoe.com}
\social[linkedin]{john.doe} % <=========================================
\social[twitter]{jdoe} % <==============================================
\social[github]{jdoe} % <===============================================
\extrainfo{additional information}
\photo[64pt][0.4pt]{picture}
\quote{Some quote}
\setlength{\footskip}{84pt} % <=========================================
\begin{document}
\makecvtitle
\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{ \textit{Grade} }{Description} % arguments 3 to 6 can be left empty
\cvitem{title}{ \emph{Title} }
\cvitemwithcomment{Language 1}{Skill level}{Comment}
\cvdoubleitem{category X}{XXX, YYY, ZZZ}{category Y}{XXX, YYY, ZZZ}
\cvlistitem{Item 1}
\cvlistdoubleitem{Item 2}{Item 3}
\end{document}
请注意,这一行\setlength{\footskip}{84pt}
只是因为我在页脚中添加了更多个人信息才需要的。对于您的简历,请不要添加此行,编译并检查文件*.log
是否有警告,footskip is too small.
该警告中给出的四舍五入值用于您的简历...
答案2
moderncv 的更新版本使这种情况已过时 - 包中包含一个选项可以更改这种情况。当您加载 \moderncvstyle 时,请包含选项 [left],如下所示:
\moderncvstyle[left]{casual}