moderncv で `itemize` の後の余分なスペースを削除するにはどうすればよいですか?

moderncv で `itemize` の後の余分なスペースを削除するにはどうすればよいですか?

文書内で をmoderncv使用すると、項目別リストの後に余分なスペースが生成されます。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 を受け入れるというよりは LaTeX と戦うことのように思えます。ここで余分なスペースを削除するために変更できる設定はありますか?

答え1

間隔を設定するオプションは、クラスcvitemによってすでに提供されています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}

ここに画像の説明を入力してください

関連情報