如何使用此代码添加照片

如何使用此代码添加照片

我正在努力实现以下目标:

  • 在 的右侧添加一张照片\personaltitle。(右对齐)
  • 使 的显示位于\title页面顶部的中心。

这是我的 MWE:

\documentclass[11pt,a4paper,francais]{moderncv}
\moderncvtheme[blue]{classic}                
\usepackage[utf8]{inputenc}
\usepackage[top=1.1cm, bottom=1.1cm, left=2cm, right=2cm]{geometry}
\setlength{\hintscolumnwidth}{2.5cm}
\usepackage{babel}

\firstname{XX}
\familyname{X}
\title{XXXX}              
\address{XXX}    
\email{[email protected]}  
\mobile{xxxx}
\extrainfo{xxxx}

\makeatletter
\newcommand\personaltitle{%
  \def\phonesdetails{}%
  \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
    \protected@edef\phonesdetails{\phonesdetails\protect\makenewline\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
 \par\noindent\begin{tabular}{@{}l@{}}
     {\LARGE\textbf{\@lastname\ \@firstname}} \\
     \@addressstreet \\
     \@addresscity  \\
     \@extrainfo \\
     \mobilephonesymbol:\ \collection@phones@item  \\
     \emailsymbol:\ \emaillink{\@email} \\
 \end{tabular}\par%\noindent\rule{\linewidth}{1pt}\par%
}

\begin{document}
\personaltitle
\section{Intro}
\cventry{PPP OOO \newline{} U UUUU}{DDDDDD}{IIIIII}{AAAA}{BBBBB}{CC}
\end{document}

请问有什么出色的建议吗?

多谢!!

答案1

您的遗嘱将做以下修改\personaltitle

\documentclass[11pt,a4paper,francais]{moderncv}
\moderncvtheme[blue]{classic}                
\usepackage[utf8]{inputenc}
\usepackage[top=1.1cm, bottom=1.1cm, left=2cm, right=2cm]{geometry}
\setlength{\hintscolumnwidth}{2.5cm}
\usepackage{babel}

\firstname{XX}
\familyname{X}
\title{The title}              
\address{XXX}    
\email{[email protected]}  
\mobile{xxxx}
\extrainfo{xxxx}
\photo{ctanlion}

\makeatletter
\newcommand\personaltitle{%
  \ifthenelse{\equal{\@title}{}}{}{%
  \begin{minipage}{\linewidth}
  \centering
  \titlestyle{\@title}
  \end{minipage}\vskip3ex}
  \def\phonesdetails{}%
  \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
    \protected@edef\phonesdetails{\phonesdetails\protect\makenewline\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
 \par\noindent\begin{tabular}[b]{@{}l@{}}
     {\LARGE\textbf{\@lastname\ \@firstname}} \\
     \@addressstreet \\
     \@addresscity  \\
     \@extrainfo \\
     \mobilephonesymbol:\ \collection@phones@item  \\
     \emailsymbol:\ \emaillink{\@email} \\
 \end{tabular}\hfill
 \begin{tabular}[b]{@{}c@{}}
 \color{color1}\framebox{\includegraphics[width=\@photowidth]{\@photo}}
 \end{tabular}\par%\noindent\rule{\linewidth}{1pt}\par%
}

\begin{document}
\personaltitle
\section{Intro}
\cventry{PPP OOO \newline{} U UUUU}{DDDDDD}{IIIIII}{AAAA}{BBBBB}{CC}
\end{document}

结果:

在此处输入图片描述

相关内容