
我喜歡這個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}