修改 moderncv 标头(风格:经典)

修改 moderncv 标头(风格:经典)

你好,我想对 moderncv 的 CV 头进行一些修改,经典风格,如下图所示:

在此处输入图片描述

这是我用来制作该图形的代码(显然没有红色标记!),但我遇到了困难。你能帮帮我吗?

\documentclass[11pt,a4paper,sans]{moderncv}   
\moderncvstyle{casual}   
\moderncvcolor{blue}   
\usepackage[utf8]{inputenc}
\usepackage[scale=0.75]{geometry}


% personal data
\name{John}{Doe}
\title{Resumé title}
\address{street, number}{postcode, city}{country}
\phone[mobile]{+1~(234)~567~890}
% \phone[fixed]{+2~(345)~678~901}
\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 long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, }


% https://tex.stackexchange.com/questions/353579/patchcmd-not-showing
\makeatletter
% phone definition (a bit messy... anything easier?)
\def\phonesdetails{}
\collectionloop{phones}
{
\protected@edef\phonesdetails
{\phonesdetails\protect\makenewline\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem
}}
% social definition (a bit messy... anything easier?)
\def\socialsdetails{}
\collectionloop{socials}{
\protected@edef\socialsdetails{\socialsdetails\protect\makenewline\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem
}}
\patchcmd{\makecvhead}% <cmd> instead \makecvtitle
  {\framebox{\includegraphics[width=\@photowidth]{\@photo}}}% <search> 
  {\begin{tabular}[t]{@{}p{4cm}p{2cm}@{}}
      & 
      \raisebox{-\totalheight}{\includegraphics[width=\@photowidth]{\@photo}}
      \\
      \namefont{\color{color1}\@firstname{\color{color1}\@lastname}} & \\
      \namefont{\color{color2}\@title} &  \\
      \addresssymbol\@addressstreet & \phonesdetails \\ 
      \@addresscity & \emailsymbol\emaillink{\@email} \\
      \@addresscountry & \socialsdetails \\
  \end{tabular}%
  }% <replace>
  {}{}% <success><failure>
\makeatother


\begin{document}
\makecvtitle
\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}  
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}
\end{document}

答案1

也许这段代码能让你走上正确的道路。

X

% !TeX TS-program = pdflatex


\documentclass[11pt,a4paper,sans]{moderncv}   
\moderncvstyle{casual}   
\moderncvcolor{blue}   

\usepackage[scale=0.75]{geometry}
\usepackage{ragged2e} 
\setlength{\footskip}{60pt}  % added <<<<<<<<<<<<<<<

\makeatletter

\newlength{\leftside}
\renewcommand*{\makecvhead}{% changed <<<<<<<<<<<<<<<<<<<<<<
    \recomputecvlengths
    \def\phonesdetails{}
    \collectionloop{phones}{
        \protected@edef\phonesdetails{\phonesdetails\protect\makenewline\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}
      \def\socialsdetails{}%
    \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
        \protected@edef\socialsdetails{\socialsdetails\protect\makenewline\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}%
\setlength{\leftside}{0.95\textwidth-\@photowidth}
\begin{minipage}[b]{\leftside}{%
        \raggedright\namefont{\color{color2!50}\@firstname} {\color{color2}\@lastname}}
        \vspace{2em}\\
        \titlestyle{\@title}
        \vspace{2em}\\ 
        \addressfont\color{color2}
        \begin{tabular}{p{0.4\leftside}p{0.45\leftside}}
        \ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet
            & 
            \phonesdetails 
            \\
            \ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}
            &   
            \ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}
            \\
            \ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}
            &\ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}
            \\
            \ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo} & \socialsdetails
        \end{tabular}           
    \end{minipage}\hfill
    \begin{minipage}[c]{\@photowidth}{%
            \vfill          
            \includegraphics[width=\@photowidth]{\@photo}}
    \end{minipage}
    \vspace*{2em}\\
    \ifthenelse{\isundefined{\@quote}}%
    {}%
    {\begin{minipage}{%
            \quotewidth}\centering\quotestyle{\@quote}
    \end{minipage}\vspace*{2em}\\
    }%
    }% end makecvhead
\makeatother

\renewcommand*{\recomputecvheadlengths}{%
\setlength{\quotewidth}{\textwidth}}
\renewcommand*{\quotefont}{\large\slshape\justifying}
\renewcommand{\quotestyle}[1]{\quotefont\color{color1}#1}


% personal data
\name{John}{Doe}
\title{Resumé title}
\address{street, number}{postcode, city}{country}
\phone[mobile]{+1~(234)~567~890}
% \phone[fixed]{+2~(345)~678~901}
\email{[email protected]}
\homepage{www.johndoe.com}
\social[linkedin]{john.doe}
% \social[twitter]{jdoe}
% \social[github]{jdoe}
\extrainfo{additional information}
\photo[60pt][0.4pt]{example-image-a}
\quote{Some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, some long quote, }

\begin{document}
    \makecvtitle
    \section{Education}
    \cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}  
    \cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}    

\end{document}

相关内容