moderncv 标题名称过长的问题

moderncv 标题名称过长的问题

有没有办法将整个“jesse jaanila | 简历”标题与银行样式放在同一行上。我的简化代码显示,使用我喜欢的字体 fouriernc,它似乎不适合放在一行上。

\documentclass[12pt,a4paper,finnish]{moderncv} 
\moderncvstyle{banking}
\moderncvcolor{blue}
 \usepackage{babel}
 \usepackage[latin1]{inputenc}
  \usepackage[T1]{fontenc}
 \usepackage{fouriernc}
 \usepackage[scale=0.75]{geometry}

 \firstname{XXX}
 \familyname{XXX}

 \title{Curriculum Vit\ae{}}

\mobile{+358 45 2580 777}


\begin{document}
\thispagestyle{empty}
\pagestyle{empty}
 \makecvtitle
 \end{document}

答案1

这有效:

\documentclass[12pt,a4paper,finnish]{moderncv} 
\moderncvstyle{banking}
\moderncvcolor{blue}
 \usepackage{babel}
 \usepackage[latin1]{inputenc}
  \usepackage[T1]{fontenc}
 \usepackage{fouriernc}
 \usepackage[scale=0.75]{geometry}

 \makeatletter
\renewcommand*{\maketitle}{%
  \setlength{\maketitlewidth}{\textwidth}%
  \hfil%
  \parbox{\maketitlewidth}{%
    \centering%
    % name and title
    \namestyle{\@firstname~\@lastname}%
    \ifthenelse{\equal{\@title}{}}{}{\titlestyle{~|~\@title}}\\% \isundefined doesn't work on \@title, as LaTeX itself defines \@title (before it possibly gets redefined by \title) 
    % detailed information
    \addressfont\color{color2}%
    \ifthenelse{\isundefined{\@addressstreet}}{}{\addtomaketitle{\addresssymbol\@addressstreet}%
      \ifthenelse{\equal{\@addresscity}{}}{}{\addtomaketitle[~--~]{\@addresscity}}% if \addresstreet is defined, \addresscity and \addresscountry will always be defined but could be empty
      \ifthenelse{\equal{\@addresscountry}{}}{}{\addtomaketitle[~--~]{\@addresscountry}}%
      \flushmaketitle\@firstmaketitleelementtrue\\}%
    \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
      \addtomaketitle{\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
    \ifthenelse{\isundefined{\@email}}{}{\addtomaketitle{\emailsymbol\emaillink{\@email}}}%
    \ifthenelse{\isundefined{\@homepage}}{}{\addtomaketitle{\homepagesymbol\httplink{\@homepage}}}%
    \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
      \addtomaketitle{\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}%
    \ifthenelse{\isundefined{\@extrainfo}}{}{\addtomaketitle{\@extrainfo}}%
    \flushmaketitle}\\[2.5em]}% need to force a \par after this to avoid weird spacing bug at the first section if no blank line is left after \maketitle

 \makeatother

 \firstname{Jesse}
 \familyname{Jaanila}

 \title{Curriculum Vit\ae{}}
\address{Mannerheimintie 21--23 C 38}{00250 \textsc{HELSINKI}}
\mobile{+358 45 2580 777}
\email{[email protected]}

\begin{document}
\thispagestyle{empty}
\pagestyle{empty}
 \makecvtitle
 \end{document}

问题在于,\maketitle银行样式中的定义任意将长度重新定义\maketitlewidth为 的 80%,\textwidth因此您无法从宏定义之外更改它。这里的快速而肮脏的破解方法是从 复制原始定义moderncvstylebanking.sty并修改第一行,以便\maketitlewidth将其设置为完整的\textwidth。更好的补丁是将该行从定义中完全删除,以便您可以\maketitlewidth在序言中设置 以根据您的偏好进行调整。

答案2

更新(moderncvv2.0)

使用moderncvv2.0,需要修补的命令不再是\maketitle,并且\makehead需要更改的长度现在是\makeheaddetailswidth,因此此版本的正确修补程序是

\patchcmd{\makehead}
  {\setlength{\makeheaddetailswidth}{0.8\textwidth}}
  {\setlength{\makeheaddetailswidth}{\textwidth}}
  {}
  {}

原始答案(适用于旧版本moderncv

为了使其更简单一些,您可以\maketitle通过(由 加载)\patchcmd命令进行修补,以便将长度设置为。etoolboxmoderncv\maketitlewidth\textwidth

也就是说,将以下几行添加到你的序言中:

\patchcmd{\maketitle}
  {\setlength{\maketitlewidth}{0.8\textwidth}}
  {\setlength{\maketitlewidth}{\textwidth}}
  {}
  {}

梅威瑟:

\documentclass[12pt,a4paper,finnish]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}
\usepackage{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fouriernc}
\usepackage[scale=0.75]{geometry}

\firstname{Jesse}
\familyname{Jaanila}

\title{Curriculum Vit\ae{}}
\address{Mannerheimintie 21--23 C 38}{00250 \textsc{HELSINKI}}
\mobile{+358 45 2580 777}
\email{[email protected]}

\patchcmd{\maketitle}
  {\setlength{\maketitlewidth}{0.8\textwidth}}
  {\setlength{\maketitlewidth}{\textwidth}}
  {}
  {}

\begin{document}
\thispagestyle{empty}
\pagestyle{empty}
 \makecvtitle
 \end{document} 

在此处输入图片描述

相关内容