ModernCV:\cvitemwithcomment 的“评论”部分已超出页面范围

ModernCV:\cvitemwithcomment 的“评论”部分已超出页面范围
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{oldstyle}                           % style options are 'casual' (default), 'classic', 'oldstyle' and 'banking'
\moderncvcolor{grey}                               % color options 'blue' (default), 'orange', 'green', 'red', 'purple', 'grey' and 'black'
\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}

\begin{document}

\makecvtitle

\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}  % 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{References}
    \cvitemwithcomment{Prof. Xxxxxx Xxxxxxx}{\newline BE project advisor and coauthor}{\hfill \newline [email protected]}
    \cvitemwithcomment{Assoc. Prof. Xxxx Xxxx}{\newline Examiner of BE thesis defence and lecturer}{\hfill \newline [email protected]}
    \cvitemwithcomment{Prof. Xxxxxx Xxx}{\newline Summer research supervisor and lecturer}{\hfill \newline [email protected]}

\end{document}

副教授的电子邮件已超出页面

使用 ShareLaTeX 中的 ModernCV Oldstyle 模板,您可以看到我的参考文献中副教授的电子邮件地址超出了页面范围。我怎样才能让它与其他两个电子邮件正确对齐?没有足够的空间将它们全部放在一行中,因此使用 s,\newline所以我宁愿像第一个和第三个参考文献那样将它们分开。欢迎提出任何建议,即使它们以完全不同的方式解决根本问题。

答案1

嗯,我认为最好的方法是创建一个新命令,例如\mycvitemwithcomment。然后您可以定义主要部分(名称和描述)和注释部分(电子邮件)的长度。

在下面的代码中,您可以根据需要更改值(以厘米为单位)(参见带有 标记的行<=====):

\newcommand*{\mycvitemwithcomment}[4][.25em]{%
  \setlength{\cvitemwithcommentmainlength}{8cm} % <=====================
  \setlength{\cvitemwithcommentcommentlength}{3.5cm} % <================
  \begin{minipage}[t]{\cvitemwithcommentmainlength}\hintstyle{#2}: #3\end{minipage}%
  \hfill% fill of \separatorcolumnwidth
  \begin{minipage}[t]{\cvitemwithcommentcommentlength}\raggedleft\small\itshape#4\end{minipage}%
  \par\addvspace{#1}}

完整的 MWE

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

\moderncvstyle{oldstyle}
\moderncvcolor{grey}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.75,showframe]{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}

\begin{document}

\makecvtitle

\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}  % 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}

\newcommand*{\mycvitemwithcomment}[4][.25em]{%
  \setlength{\cvitemwithcommentmainlength}{8cm} % <=====================
  \setlength{\cvitemwithcommentcommentlength}{3.5cm} % <================
  \begin{minipage}[t]{\cvitemwithcommentmainlength}\hintstyle{#2}: #3\end{minipage}%
  \hfill% fill of \separatorcolumnwidth
  \begin{minipage}[t]{\cvitemwithcommentcommentlength}\raggedleft\small\itshape#4\end{minipage}%
  \par\addvspace{#1}}

\section{References}
  \mycvitemwithcomment{Prof. Xxxxxx Xxxxxxx}{%
    \newline BE project advisor and coauthor}{[email protected]}
  \mycvitemwithcomment{Assoc. Prof. Xxxx Xxxx}{%
    \newline Examiner of BE thesis defence and lecturer}{[email protected]}
  \mycvitemwithcomment{Prof. Xxxxxx Xxx}{%
    \newline Summer research supervisor and lecturer}{\hfill \newline [email protected]}

\end{document}

给出以下结果:

生成的 pdf

相关内容