我正在用 moderncv 经典风格创建简历。我的标题目前看起来像这样:
:
我想实现这个目标
- 名称和标题不是在框的下端对齐,而是在框的上端对齐。
- 该名称与地址框“重叠”,因为我必须将名称缩小以避免换行。
我想我必须改变moderncvstyleclassic.sty。不幸的是,我不太熟悉语法,所以我不知道该改变什么。
这是我的代码:
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{grey}
\renewcommand*{\namefont}{\fontsize{25}{36}\mdseries\upshape}
\usepackage[ansinew]{inputenc}
\usepackage[scale=0.75]{geometry}
% personal data
\firstname{Dr. Marcus}
\familyname{Surname}
\title{Biochemist}
\address{Street abc}{D-80331 Munich}
\mobile{+49 xxx / xx xx xx xx}
\email{[email protected]}
\photo[90pt][0.4pt]{dummy}
\begin{document}
\makecvtitle
\end{document}
非常感谢!
答案1
您可以修改\makecvtitle
(无论多么笨重):
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{grey}
\renewcommand*{\namefont}{\fontsize{25}{36}\mdseries\upshape}
\usepackage[scale=0.75]{geometry}
\makeatletter
\renewcommand*{\makecvtitle}{%
% recompute lengths (in case we are switching from letter to resume, or vice versa)
\recomputecvlengths%
% optional detailed information (pre-rendering)
\def\phonesdetails{}%
\collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
\protected@edef\phonesdetails{\phonesdetails\protect\makenewline\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
\def\socialsdetails{}%
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
\protected@edef\socialsdetails{\socialsdetails\protect\makenewline\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}%
% optional photo (pre-rendering)
\newbox{\makecvtitlepicturebox}%
\savebox{\makecvtitlepicturebox}{%
\ifthenelse{\isundefined{\@photo}}%
{}%
{%
\hspace*{\separatorcolumnwidth}%
\color{color1}%
\setlength{\fboxrule}{\@photoframewidth}%
\ifdim\@photoframewidth=0pt%
\setlength{\fboxsep}{0pt}\fi%
\framebox{\includegraphics[width=\@photowidth]{\@photo}}}}%
\newbox{\makecvtitledetailsbox}%
\savebox{\makecvtitledetailsbox}{%
\addressfont\color{color2}%
\begin{tabular}[b]{@{}r@{}}%
\ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
\ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}% if \addresstreet is defined, \addresscity and addresscountry will always be defined but could be empty
\ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}%
\phonesdetails% needs to be pre-rendered as loops and tabulars seem to conflict
\ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}%
\ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}%
\socialsdetails% needs to be pre-rendered as loops and tabulars seem to conflict
\ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%
\end{tabular}
}%
% name and title
\newlength{\makecvtitledetailswidth}\settowidth{\makecvtitledetailswidth}{\usebox{\makecvtitledetailsbox}}%
\newlength{\makecvtitlepicturewidth}\settowidth{\makecvtitlepicturewidth}{\usebox{\makecvtitlepicturebox}}%
\ifthenelse{\lengthtest{\makecvtitlenamewidth=0pt}}% check for dummy value (equivalent to \ifdim\makecvtitlenamewidth=0pt)
{\setlength{\makecvtitlenamewidth}{\textwidth-\makecvtitledetailswidth-\makecvtitlepicturewidth}}%
{}%
\begin{minipage}[b][\ht\makecvtitlepicturebox][t]{\makecvtitlenamewidth}%
\namestyle{\@firstname\ \@lastname}%
\ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}%
\end{minipage}%
\hfill%
% optional detailed information (rendering)
\llap{\usebox{\makecvtitledetailsbox}}% \llap is used to suppress the width of the box, allowing overlap if the value of makecvtitlenamewidth is forced
% optional photo (rendering)
\usebox{\makecvtitlepicturebox}\\[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 \makecvtitle
\makeatother
% personal data
\firstname{Dr. Marcus}
\familyname{\rlap{Surname that is long}}
\title{Biochemist}
\address{Street abc}{D-80331 Munich}
\mobile{+49 xxx / xx xx xx xx}
\email{[email protected]}
\photo[90pt][0.4pt]{example-image-golden-upright}
\begin{document}
\makecvtitle
\end{document}
这一切都是为了调整组成标题的框。最简单的方法是仍然提供\familyname
一个额外的\rlap
。名称的调整使用了一些细节minipage
- 具体指定固定高度。