![moderncv 银行风格:如何将标题栏一直移动到左侧?](https://linux22.com/image/289042/moderncv%20%E9%93%B6%E8%A1%8C%E9%A3%8E%E6%A0%BC%EF%BC%9A%E5%A6%82%E4%BD%95%E5%B0%86%E6%A0%87%E9%A2%98%E6%A0%8F%E4%B8%80%E7%9B%B4%E7%A7%BB%E5%8A%A8%E5%88%B0%E5%B7%A6%E4%BE%A7%EF%BC%9F.png)
banking
我在类中使用了moderncv
样式。我做了一些修改。代码非常庞大和混乱,我不可能提供 MWE。在文件中moderncvstylebanking.sty
,大约第 88 行到第 92 行,我做了一些更改,使其变成如下内容:
我如何将它完全移到左边(消除间隙)。代码的修改部分是:
\raggedright
\parbox{\maketitlewidth}{%
% name and title
\namestyle{\@firstname~\@familyname}%
\ifthenelse{\isundefined{\@title}}{}{\titlestyle{\@title}}\\%
% detailed information
\addressfont\color{color2}%
\ifthenelse{\isundefined{\@addressstreet}}
第 88-95 行。
答案1
您需要更改原始定义中的三行(在下面的示例中,使用和\flushmaketitle
标记了更改):% ORIGINAL
% NEW
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}
\usepackage[scale=0.75]{geometry}
\makeatletter
\renewcommand*{\flushmaketitle}{%
\strut\usebox{\maketitlebox}%
\savebox{\maketitlebox}{}%
\savebox{\maketitletempbox}{}%
\setlength{\maketitleboxwidth}{0pt}}
\renewcommand*{\maketitle}{%
% \setlength{\maketitlewidth}{0.8\textwidth}% ORIGINAL
\setlength{\maketitlewidth}{\textwidth}% NEW
%\hfil% ORIGINAL
\parbox{\maketitlewidth}{%
% \centering% ORIGINAL
\raggedright% NEW
% 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
\name{John}{Doe}
\title{Resume 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}
\quote{Some quote}
\begin{document}
\makecvtitle
\section{A test section}
Some test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text
\end{document}
如果你还想刷新引号,你还需要重新定义\makecvtitle
;类似
\renewcommand*{\makecvtitle}{%
% recompute lengths (in case we are switching from letter to resume, or vice versa)
\recomputecvlengths%
\maketitle%
% optional quote
\ifthenelse{\isundefined{\@quote}}%
{}%
{{\begin{minipage}{\quotewidth}\quotestyle{\@quote}\end{minipage}\\[2.5em]}}%
\par}% to avoid weird spacing bug at the first section if no blank line is left after \maketitle}