这是moderncv 的银行风格无法识别“\makecvheadnamewidth”来适应长名称并如何混合/组合 moderncv 风格?。
现在我想将命令的定义添加\photo
到banking
我已经阅读的样式中ModernCV 银行照片标题和这个如何以银行风格添加图片并使其位置准确但由于我的风格各异,事情变得混乱,我不知道如何让它发挥作用。
- 我希望我的照片出现在标题旁边,而不是标题上方,
- 一个优点是可以选择将其放在标题的左侧还是右侧。
梅威瑟:
\documentclass{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
\moderncvhead{3}
\usepackage[scale=0.85]{geometry}
\usepackage{xpatch}
\makeatletter %to fix the issue of the long name in banking style
\xpatchcmd{\makehead}{%
\titlestyle{~|~\@title}%
}{%
\\\vspace*{10pt}\titlestyle{\@title}\vspace*{10pt}%
}{}{false}
\makeatother
\makeatletter
\let\oldmakecvtitle\makecvtitle
\renewcommand*{\makecvtitle}{%
{\framebox{\includegraphics[width=\@photowidth]{\@photo}}\par\vspace{10pt}}%
\oldmakecvtitle%
}%
\makeatother
%%%%%%%%%%%%%%%%
\nopagenumbers{}
\title{Curriculum Vitae}
\firstname{my long name}
\familyname{familyname}
\address{address comes here}{10000}
\phone[mobile]{00~00~00~00~00}
\email{[email protected]}
\extrainfo{xx ans Permis B}
\photo[64pt][40pt]{example-image.png}
\begin{document}
\makecvtitle
\end{document}
答案1
您需要查看类的源代码moderncv
。然后您会发现,样式的标题代码classic
与标题的代码不同banking
。对于您的情况,您需要更改标题的代码banking
。
这就是您必须使用的原因:
\patchcmd{\makehead}
{\setlength{\makeheaddetailswidth}{0.8\textwidth}}
{\setlength{\makeheaddetailswidth}{0.67\textwidth}}
{}
{false2}
\patchcmd{\makehead}% version 2.0.0, style banking, head3
{\\[2.5em]}
{\hfil\raisebox{-1.6cm}{\framebox{\includegraphics[width=\@photowidth]{\@photo}}}\\[2.5em]}
{}
{failure}
而是改变
\let\oldmakecvtitle\makecvtitle
\renewcommand*{\makecvtitle}{%
{\framebox{\includegraphics[width=\@photowidth]{\@photo}}\par\vspace{10pt}}%
\oldmakecvtitle%
}%
你试过了。
根据所使用的图像,您必须\raisebox
根据需要更改命令中的值。
使用以下完整的 MWE
\documentclass{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
\moderncvhead{3} % uses header from style banking!
\usepackage[scale=0.85]{geometry}
\usepackage{xpatch}
\makeatletter %to fix the issue of the long name in banking style
\patchcmd{\makehead}{%
\titlestyle{~|~\@title}%
}{%
\\\vspace*{10pt}\titlestyle{\@title}\vspace*{10pt}%
}{}{false}
\patchcmd{\makehead}
{\setlength{\makeheaddetailswidth}{0.8\textwidth}}
{\setlength{\makeheaddetailswidth}{0.67\textwidth}}
{}
{false2}
\patchcmd{\makehead}% version 2.0.0, style banking, head3
{\\[2.5em]}
{\hfil\raisebox{-1.6cm}{\framebox{\includegraphics[width=\@photowidth]{\@photo}}}\\[2.5em]}
{}
{failure}
\makeatother
%%%%%%%%%%%%%%%%
\nopagenumbers{}
\title{Curriculum Vitae}
\firstname{my long name}
\familyname{familyname}
\address{address comes here}{10000}
\phone[mobile]{00~00~00~00~00}
\email{[email protected]}
\extrainfo{xx ans Permis B}
\photo[64pt][40pt]{example-image-10x16} % --> change \raisebox{-1.6cm}{} to your needs ...
\begin{document}
\makecvtitle
\end{document}
您将照片放在纸张的右侧,看到以下结果:
要将照片移到左侧,需要使用tabular
环境完全重建标题。我认为最好在全新标题中完成此操作...