![moderncv:在不丢失格式的情况下更改名称顺序](https://linux22.com/image/412956/moderncv%EF%BC%9A%E5%9C%A8%E4%B8%8D%E4%B8%A2%E5%A4%B1%E6%A0%BC%E5%BC%8F%E7%9A%84%E6%83%85%E5%86%B5%E4%B8%8B%E6%9B%B4%E6%94%B9%E5%90%8D%E7%A7%B0%E9%A1%BA%E5%BA%8F.png)
答案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}
您将获得以下第一页: