如何更改 ModernCV 模板中“个人数据”的顺序?

如何更改 ModernCV 模板中“个人数据”的顺序?

我目前正在使用该moderncv模板撰写求职信。模板中有一个注释部分%personal data。这会在信件的右上角生成一个标题,其中列出了我的个人数据(正如预期的那样)。

默认情况下,信息按以下顺序列出:

  • 全名
  • 地址
  • 手机号码
  • 电子邮件地址
  • 个人网站。

我想将其更改为以下顺序:

  • 全名
  • 个人网站
  • 地址
  • 手机号码
  • 电子邮件地址。

我尝试将文本按照我想要的顺序放置在 LaTeX 文档中,但没有任何效果。我该怎么做?

答案1

使用样式banking类来构建 cv 显示的标题moderncvmoderncvheadiii字母。要更改那里的顺序,您必须更改类中的硬编码顺序。为此,我从类中复制了代码并进行了更改。

\makeatletter请参阅以下 MWE(检查和之间添加的代码\makeatother并查看标有的主要更改<========

\documentclass[11pt,a4paper,sans]{moderncv}

% moderncv themes
\moderncvstyle{banking} % casual, classic, banking, oldstyle and fancy
\moderncvcolor{blue} 
%\renewcommand{\familydefault}{\sfdefault} % \rmdefault
%\nopagenumbers{} 

\usepackage[utf8]{inputenc}

\usepackage[scale=0.75]{geometry}
%\setlength{\hintscolumnwidth}{3cm} 
%\settowidth{\hintscolumnwidth}{Jun-Sep, 2011} 
%\setlength{\makecvtitlenamewidth}{10cm} % for the 'classic' style

% personal data
\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]{example-image-a}
\quote{Some quote}

%\makeatletter\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}\makeatother
%\renewcommand{\refname}{Articles}

\setlength{\footskip}{66pt}

\makeatletter % <===========================================================
\@initializecommand{\makehead}{%
  \setlength{\makeheaddetailswidth}{0.8\textwidth}%
  \hfil%
  \parbox{\makeheaddetailswidth}{%
    \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) 
    % optional detailed information
    \if@details{%
      \addressfont\color{color2}%
      \ifthenelse{\isundefined{\@homepage}}{}{\addtomakeheaddetails{\homepagesymbol\httplink{\@homepage}}}% <========================== moved
      \ifthenelse{\isundefined{\@addressstreet}}{}{\addtomakeheaddetails{\addresssymbol\@addressstreet}%
        \ifthenelse{\equal{\@addresscity}{}}{}{\addtomakeheaddetails[~--~]{\@addresscity}}% if \addresstreet is defined, \addresscity and \addresscountry will always be defined but could be empty
        \ifthenelse{\equal{\@addresscountry}{}}{}{\addtomakeheaddetails[~--~]{\@addresscountry}}%
        \flushmakeheaddetails\@firstmakeheaddetailselementtrue\\\null}%
      \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
        \addtomakeheaddetails{\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
      \ifthenelse{\isundefined{\@email}}{}{\addtomakeheaddetails{\emailsymbol\emaillink{\@email}}}%
%     \ifthenelse{\isundefined{\@homepage}}{}{\addtomakeheaddetails{\homepagesymbol\httplink{\@homepage}}}% <=============================================== original place
      \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
        \addtomakeheaddetails{\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}%
      \ifthenelse{\isundefined{\@extrainfo}}{}{\addtomakeheaddetails{\@extrainfo}}%
    \flushmakeheaddetails}\fi}\\[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 \makehead
\makeatother % <============================================================


\begin{document}

\makecvtitle

\section{Education}
\cventry{year--year}{Degree}{Institution--3}{City--4}{\textit{Grade}--5}{Description--6}  % arguments 3 to 6 can be left empty
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\section{Master thesis}
\cvitem{title}{\emph{Title}}
\cvitem{supervisors}{Supervisors}
\cvitem{description}{Short thesis abstract}

\section{Experience}
\subsection{Vocational}
\cventry{year--year}{Job title}{Employer}{City}{}{General description no longer than 1--2 lines.\newline{}%
Detailed achievements:%
\begin{itemize}%
\item Achievement 1;
\item Achievement 2, with sub-achievements:
  \begin{itemize}%
  \item Sub-achievement (a);
  \item Sub-achievement (b), with sub-sub-achievements (don't do this!);
    \begin{itemize}
    \item Sub-sub-achievement i;
    \item Sub-sub-achievement ii;
    \item Sub-sub-achievement iii;
    \end{itemize}
  \item Sub-achievement (c);
  \end{itemize}
\item Achievement 3.
\end{itemize}}
\cventry{year--year}{Job title}{Employer}{City}{}{Description line 1\newline{}Description line 2}
\subsection{Miscellaneous}
\cventry{year--year}{Job title}{Employer}{City}{}{Description}

\section{Languages}
\cvitemwithcomment{Language 1}{Skill level}{Comment}
\cvitemwithcomment{\textbf{Language} 2}{\textbf{Skill} level}{Comment}
\cvitemwithcomment{Language 3}{Skill level}{Comment}

\section{Computer skills}
\cvdoubleitem{category 1}{XXX, YYY, ZZZ}{category 4}{XXX, YYY, ZZZ}
\cvdoubleitem{category 2}{XXX, YYY, ZZZ}{category 5}{XXX, YYY, ZZZ}
\cvdoubleitem{category 3}{XXX, YYY, ZZZ}{category 6}{XXX, YYY, ZZZ}

\section{Interests}
\cvitem{hobby 1}{Description}
\cvitem{hobby 2}{Description}
\cvitem{hobby 3}{Description}

\section{Extra 1}
\cvlistitem{Item 1}
\cvlistitem{Item 2}
\cvlistitem{Item 3. This item is particularly long and therefore normally spans over several lines. Did you notice the indentation when the line wraps?}

\section{Extra 2}
\cvlistdoubleitem{Item 1}{Item 4}
\cvlistdoubleitem{Item 2}{Item 5}
\cvlistdoubleitem{Item 3}{Item 6. Like item 3 in the single column list before, this item is particularly long to wrap over several lines.}

\section{References}
\begin{cvcolumns}
  \cvcolumn{Category 1}{\begin{itemize}\item Person 1\item Person 2\item Person 3\end{itemize}}
  \cvcolumn{Category 2}{Amongst others:\begin{itemize}\item Person 1, and\item Person 2\end{itemize}(more upon request)}
  \cvcolumn[0.5]{All the rest \& some more}{\textit{That} person, and \textbf{those} also (all available upon request).}
\end{cvcolumns}

%\nocite{*}
%\bibliographystyle{plain}
%\bibliography{publications}                        % 'publications' is the name of a BibTeX file


\clearpage
%-----       letter       ---------------------------------------------------------
% recipient data
\recipient{Company Recruitment team}{Company, Inc.\\123 somestreet\\some city}
\date{January 01, 1984}
\opening{Dear Sir or Madam,}
\closing{Yours faithfully,}
\enclosure[Attached]{curriculum vit\ae{}}          % use an optional argument to use a string other than "Enclosure", or redefine \enclname
\makelettertitle

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis ullamcorper 
neque sit amet lectus facilisis sed luctus nisl iaculis. Vivamus at neque 
arcu, sed tempor quam. Curabitur pharetra tincidunt tincidunt. Morbi 
volutpat feugiat mauris, quis tempor neque vehicula volutpat. Duis 
tristique justo vel massa fermentum accumsan. Mauris ante elit, feugiat 
vestibulum tempor eget, eleifend ac ipsum. Donec scelerisque lobortis 
ipsum eu vestibulum. Pellentesque vel massa at felis accumsan rhoncus.

Suspendisse commodo, massa eu congue tincidunt, elit mauris pellentesque 
orci, cursus tempor odio nisl euismod augue. Aliquam adipiscing nibh ut 
odio sodales et pulvinar tortor laoreet. Mauris a accumsan ligula. 
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per 
inceptos himenaeos. Suspendisse vulputate sem vehicula ipsum varius nec 
tempus dui dapibus. Phasellus et est urna, ut auctor erat. Sed tincidunt 
odio id odio aliquam mattis. Donec sapien nulla, feugiat eget adipiscing 
sit amet, lacinia ut dolor. Phasellus tincidunt, leo a fringilla 
consectetur, felis diam aliquam urna, vitae aliquet lectus orci nec 
velit. Vivamus dapibus varius blandit.

Duis sit amet magna ante, at sodales diam. Aenean consectetur porta risus et sagittis. Ut interdum, enim varius pellentesque tincidunt, magna libero sodales tortor, ut fermentum nunc metus a ante. Vivamus odio leo, tincidunt eu luctus ut, sollicitudin sit amet metus. Nunc sed orci lectus. Ut sodales magna sed velit volutpat sit amet pulvinar diam venenatis.

Albert Einstein discovered that $e=mc^2$ in 1905.

\[ e=\lim_{n \to \infty} \left(1+\frac{1}{n}\right)^n \]

\makeletterclosing

\end{document}

以及生成的pdf:

pdf 中生成的标题

请注意,如果您将样式从 更改bankingclassic或...,moderncvhead???则会调用另一个文件,因此您必须更改该代码...

相关内容