moderncv 中 cventry 页面外的文本

moderncv 中 cventry 页面外的文本

我正在重做我的简历现代简历模板,而且大部分情况下运行良好(尽管我承认我为了符合学术要求而随意修改了某些字段的预期用途)。但是,我的教学部分存在格式问题,因为某些课程的名称很长:

在此处输入图片描述

如您所见,日期字段只能开始课程标题字段位于上方一行,这会将其推入页边距。如何修复此问题,以便日期与右边距正确对齐?

这里(我希望)是一个 MWE:

\documentclass[11pt,a4paper]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{black}      
\usepackage[utf8]{inputenc}
\usepackage[scale=0.75,top=2.5cm,bottom=2.5cm]{geometry}

\name{Firstname}{Lastname}

\usepackage{fontspec}
\setmainfont{Baskerville}

\begin{document}
\makecvtitle

\cventry{Autumn 2015}{Postgraduate Tutor (History Department, University of York)}{The Hundred Years War}{}{}{}

\cventry{Spring--Summer 2015}{Postgraduate Tutor (History Department, University of York)}{From Rome to the Renaissance: The Transformation of Traditional Societies, c. 400--1650}{}{}{}

\end{document}

答案1

我将过长的文本放在左对齐([l])且无边框的位置宽度为 0 毫米的盒子\makebox[0mm][l]{From Rome...}不占用水平空间。

\documentclass[11pt,a4paper]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{black}      
\usepackage[utf8]{inputenc}
\usepackage[scale=0.75,top=2.5cm,bottom=2.5cm]{geometry}

% Added
\usepackage{showframe}

\name{Firstname}{Lastname}

% Removed
%\usepackage{fontspec}
%\setmainfont{Baskerville}

\begin{document}
\makecvtitle

\cventry{Autumn 2015}{Postgraduate Tutor (History Department, University of York)}{The Hundred Years War}{}{}{}

\cventry{Spring--Summer 2015}{Postgraduate Tutor (History Department, University of York)}{From Rome to the Renaissance: The Transformation of Traditional Societies, c. 400--1650}{}{}{}

\cventry{Spring--Summer 2015}{Postgraduate Tutor (History Department, University of York)}{\makebox[0mm][l]{From Rome to the Renaissance: The Transformation of Traditional Societies, c. 400--1650}}{}{}{}

\end{document}

在此处输入图片描述

答案2

moderncv具有命令的固定定义\cventry,例如对于样式banking

\renewcommand*{\cventry}[7][.25em]{
  \begin{tabular*}{\maincolumnwidth}{l@{\extracolsep{\fill}}r}% <============
    {\bfseries #4} & {\bfseries #5}\\%
    {\itshape #3\ifthenelse{\equal{#6}{}}{}{, #6}} & {\itshape #2}\\%
  \end{tabular*}%
  \ifx&#7&%
  \else{\\%
    \begin{minipage}{\maincolumnwidth}%
      \small#7%
    \end{minipage}}\fi%
  \par\addvspace{#1}}

使用 cv 中的结果命令:

\cventry[length--1]{year--year--2}{Degree--3}{Institution--4}{City--5}{\textit{Grade}--6}{Description--7}  % arguments 4 to 7 can be left empty

命令的主要部分以表格形式设置,只有最后一部分是小页面,可以包含多行而不会出现问题。

因此您可以将命令更改为:

\cventry{Spring--Summer 2015}%
  {Postgraduate Tutor (History Department, University of York)}%
  {}%
  {}{}%
  {From Rome to the Renaissance: The Transformation of Traditional Societies, c. 400--1650}

具有以下 MWE:

\documentclass[11pt,a4paper]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{black}      
\usepackage[utf8]{inputenc}
\usepackage[scale=0.75,top=2.5cm,bottom=2.5cm]{geometry}

\name{Firstname}{Lastname}

%\usepackage{fontspec}
%\setmainfont{Baskerville}

\begin{document}
\makecvtitle

\cventry{Autumn 2015}%
  {Postgraduate Tutor (History Department, University of York)}%
  {The Hundred Years War}%
  {}{}{}

\cventry{Spring--Summer 2015}%
  {Postgraduate Tutor (History Department, University of York)}%
  {From Rome to the Renaissance: The Transformation of Traditional Societies, c. 400--1650}%
  {}{}{}

\cventry{2}%
  {3}%
  {4}%
  {5}{6}{7}

\cventry{Spring--Summer 2015}%
  {Postgraduate Tutor (History Department, University of York)}%
  {}%
  {}{}%
  {From Rome to the Renaissance: The Transformation of Traditional Societies, c. 400--1650}

\end{document}

得到结果:

在此处输入图片描述

只添加\makebox[0mm][l]是行不通的,因为应该有一个不能添加的换行符。请看下面稍长一点的文本:

\cventry{Spring--Summer 2015}%
  {Postgraduate Tutor (History Department, University of York)}%
  {\makebox[0mm][l]{From Rome to the Renaissance: The Transformation of 
    Traditional Societies, c. 400--1650, some text, to make this sentence 
    a little bit longer}}%
  {}{}{}

然后你得到结果:

在此处输入图片描述

正如您所见,粗体较短的文本已经太长了,没有更多空间容纳论点 5 ...

相关内容