moderncv:在不丢失格式的情况下更改名称顺序

moderncv:在不丢失格式的情况下更改名称顺序

我想交换姓氏和名字的顺序,但不丢失深灰色格式。谢谢! 更改 John 和 Doe 的顺序

答案1

从图片中我可以看到你正在使用风格casual

在样式上,casual标题名称的定义是

{\color{color2!50}\@firstname} {\color{color2}\@lastname}

要将 firstname 和 lastname 的顺序更改为 lastname 和 firstline,您必须使用该行

{\color{color2}\@lastname} {\color{color2!50}\@firstname}

您必须\makecvhead像这样修补命令:

\makeatletter
\patchcmd{\makecvhead}%
  {
    {\color{color2!50}\@firstname} {\color{color2}\@lastname}\fi%
  }%search
  {
    {\color{color2}\@lastname} {\color{color2!50}\@firstname}\fi%
  }%replace
  {}%success
  {fehler}%failure
\makeatother

使用以下完整的 MWE

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

% moderncv themes
\moderncvstyle{casual} % casual, classic, banking, oldstyle and fancy
\moderncvcolor{blue} 

\usepackage[utf8]{inputenc}

\usepackage[scale=0.75]{geometry}

% 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-golden-upright}%
\quote{Some quote}

\setlength{\footskip}{66pt}

\makeatletter % <=======================================================
\patchcmd{\makecvhead}%
  {
    {\color{color2!50}\@firstname} {\color{color2}\@lastname}\fi%
  }%search
  {
    {\color{color2}\@lastname} {\color{color2!50}\@firstname}\fi% <=====
  }%replace
  {}%success
  {fehler}%failure
\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}

\end{document}

您将获得以下第一页:

生成第一页

相关内容