删除 /cvitem 上的自动对齐

删除 /cvitem 上的自动对齐

在文档开头的“我的关于我”部分,我希望有几个 \cvitem 元素,但没有第一个“日期”参数,如下图所示。现在,第一行没有正确对齐,因为单词之间有几个空格,而我希望只有正常的间距:

\cvitem{}{Long experience in eating Pizza and sweety donuts, matress tester ,\underline{ \href{https://example.org//}{Best Dad of the alcoholic anonymous circle}}. Never Hungry. Never foolish.}

这是我得到的:

在此处输入图片描述

当然,文本是虚拟的,但字数和结构与实际插入的文本相同,并且如您所见,第一行的间距不太好。

我该如何解决这个问题?

答案1

你至少有三种可能的方法可以消除大片空白:

  1. 忘记下划线!然后你的链接是可断开的,你会得到一个正确的布局:

    \cvitem{}{Long experience in eating Pizza and sweety donuts, matress tester, 
      \href{https://example.org//}{Best Dad of the alcoholic anonymous circle}. 
      Never Hungry. Never foolish.}
    
  2. 忘记下划线,改用其他颜色。这样你的链接就可以断开,并且布局也正确:

    \cvitem{}{Long experience in eating Pizza and sweety donuts, matress tester, 
      \textcolor{red}{\href{https://example.org//}{Best Dad of the alcoholic anonymous circle}}. 
      Never Hungry. Never foolish.}
    
  3. 如果你坚持要加下划线(这会使你的链接成为牢不可破!) 例如,您可以使用包ragged2e来使用\RaggedRight带有连字符的命令,例如:

    \usepackage{ragged2e} % <===============================================
    ...
    \cvitem{}{\RaggedRight Long experience in eating Pizza and sweety donuts, matress tester, 
      \underline{\href{https://example.org//}{Best Dad of the alcoholic anonymous circle}}. 
      Never Hungry. Never foolish.}
    

在以下 MWE 中查看所有这些可能性:

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

% moderncv themes
\moderncvstyle{classic} % casual, classic, banking, oldstyle and fancy
\moderncvcolor{blue} 

\usepackage[utf8]{inputenc}

\usepackage[scale=0.75]{geometry}
\usepackage{ragged2e} % <===============================================

% 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}


\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}
\cvitem{}{Long experience in eating Pizza and sweety donuts, matress tester, 
  \href{https://example.org//}{Best Dad of the alcoholic anonymous circle}. 
  Never Hungry. Never foolish.}
\cvitem{}{Long experience in eating Pizza and sweety donuts, matress tester, 
  \textcolor{red}{\href{https://example.org//}{Best Dad of the alcoholic anonymous circle}}. 
  Never Hungry. Never foolish.}
\cvitem{}{\RaggedRight Long experience in eating Pizza and sweety donuts, matress tester, 
  \underline{\href{https://example.org//}{Best Dad of the alcoholic anonymous circle}}. 
  Never Hungry. Never foolish.}
\end{document}

及其生成的pdf:

生成的 pdf

在我看来,最好看的可能性是 2。您可以看到链接,因为它是彩色的,并且您得到了适当的布局。

下划线迫使您仅在左侧使用文本对齐,并且这种带有左对齐文本的单个段落会破坏基于左右对齐的简历的完整布局...

相关内容