如何刪除 Moderncv 中 `itemize` 之後的多餘空格?

如何刪除 Moderncv 中 `itemize` 之後的多餘空格?

在文件中,在 a 中moderncv使用 an會在逐項清單之後產生額外的間距。itemizecvitem

這是一個最小的工作範例:

\documentclass{moderncv}

\moderncvstyle{casual}
\moderncvcolor{green}

\name{John}{Smith}

\begin{document}
\makecvtitle

\section{List section}
\cvitem{Some category}{
    \begin{itemize}
        \item the first
        \item the second
        \item the third
    \end{itemize}
}
\cvitem{Another category}{
    \begin{itemize}
        \item number one
        \item number two
        \item number three
    \end{itemize}
}
\cvitem{text}{with a description}

More text.

\end{document}

我可以\vspace{-1em}在每個後面添加一個itemize來刪除空格,但這似乎是與 LaTeX 作鬥爭而不是擁抱它。我可以更改設定以刪除此處的額外間距嗎?

答案1

cvitem該類別已經提供了設定 a 間距的選項moderncv

\documentclass{moderncv}
\moderncvstyle{casual}
\moderncvcolor{green}

\name{John}{Smith}

\begin{document}
\makecvtitle

\section{List section}
\cvitem[-1.2em]{Some category}{           %new code
    \begin{itemize}
        \item the first
        \item the second
        \item the third
    \end{itemize}
}
\cvitem[-1.2em]{Another category}{       %new code  
    \begin{itemize}
        \item number one
        \item number two
        \item number three
    \end{itemize}
}
\cvitem{text}{with a description}

More text.
\end{document}

在此輸入影像描述

查看moderncv.cls文件:

% 建立一個帶有標題和相應文字的簡歷行

% 使用:\cvitem[間距]{標題}{文字}

答案2

用一個minipage

\documentclass{moderncv}

\moderncvstyle{casual}
\moderncvcolor{green}

\name{John}{Smith}

\begin{document}
\makecvtitle

\section{List section}
\cvitem{Some category}{%
   \begin{minipage}{\linewidth}
    \begin{itemize}
        \item the first
        \item the second
        \item the third
    \end{itemize}
    \end{minipage}
}
\cvitem{Another category}{%
   \begin{minipage}{\linewidth}
    \begin{itemize}
        \item number one
        \item number two
        \item number three
    \end{itemize}
    \end{minipage}
}
\cvitem{text}{with a description}

More text.

\end{document}

在此輸入影像描述

您也可以更喜歡使用[t]位置說明符minipage

\documentclass{moderncv}

\moderncvstyle{casual}
\moderncvcolor{green}

\name{John}{Smith}

\begin{document}
\makecvtitle

\section{List section}
\cvitem{Some category}{%
   \begin{minipage}[t]{\linewidth}
    \begin{itemize}
        \item the first
        \item the second
        \item the third
    \end{itemize}
    \end{minipage}
}
\cvitem{Another category}{%
   \begin{minipage}[t]{\linewidth}
    \begin{itemize}
        \item number one
        \item number two
        \item number three
    \end{itemize}
    \end{minipage}
}
\cvitem{text}{with a description}

More text.

\end{document}

在此輸入影像描述

相關內容