moderncv の \cventry からカンマを削除します

moderncv の \cventry からカンマを削除します

この画像は、履歴書ドキュメントクラスで生成されますmoderncv:

太字のテキストの後にコンマがあることに注目してください。これは自動的に生成されるようです。これを停止するにはどうすればよいでしょうか?

答え1

表示されているエントリは produce with\cventryなので、このマクロの定義を変更する必要があります。これは で定義されていますmoderncvstyleclassic.sty。私が行ったのは、それをそのままプリアンブルにコピーし、不要なコンマを削除することだけです。(MWE では、実際に行をコピーして元の行をコメント アウトし、変更が認識できるようにしました。

\documentclass{moderncv}
\moderncvstyle{casual}
%%%
% the following definition is from the file moderncvstyleclassic.sty
\renewcommand*{\cventry}[7][.25em]{%
  \cvitem[#1]{#2}{%
    {\bfseries#3}%
%   \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}% I changed this line (with comma) ...
    \ifthenelse{\equal{#4}{}}{}{ {\slshape#4}}% ... into this one (without comma).
    \ifthenelse{\equal{#5}{}}{}{, #5}%
    \ifthenelse{\equal{#6}{}}{}{, #6}%
    .\strut%
    \ifx&#7&%
      \else{\newline{}\begin{minipage}[t]{\linewidth}\small#7\end{minipage}}\fi}}
%%%
\firstname{John}
\familyname{Doe}
\begin{document}
\section{Education}
\cventry{December 2012}{Master of Science in Chocolatology}{University of Candyland}{Sugartown}{A+ with Golden Gummy Bear}{I am the chocolate-man.} 
\end{document}

出力

答え2

コマンド全体を自分で再定義する代わりに、以下を使用することも検討してくださいxpatch:

\usepackage{xpatch}

\xpatchcmd\cventry{,}{}{}{}

この行は、マクロ テキスト内の最初の出現を,空の文字列に置き換えます (つまり、削除します)。

こちらもコマンドがどのように動作するかを説明した優れたドキュメント

答え3

明らかなコメントですが、コンマの有無を切り替えられるようにしたい場合は、\cventrynocomma次のような新しいコマンドを定義できます。

\newcommand*{\cventrynocomma}[7][.25em]{%
  \cvitem[#1]{#2}{%
    {\bfseries#3}%
    \ifthenelse{\equal{#4}{}}{}{ {\slshape#4}}%
    \ifthenelse{\equal{#5}{}}{}{ #5}%
    \ifthenelse{\equal{#6}{}}{}{ #6}%
    \strut%
    \ifx&#7&%
      \else{\newline{}\begin{minipage}[t]{\linewidth}\small#7\end{minipage}}\fi}}

答え4

ファイル moderncvstyleclassic.sty から、次のようにカンマとドットを削除します。

\renewcommand*{\cventry}[7][.25em]{%
  \cvitem[#1]{#2}{%
    {\bfseries#3}%
    \ifthenelse{\equal{#4}{}}{}{ {\slshape#4}}%
    \ifthenelse{\equal{#5}{}}{}{ #5}%
    \ifthenelse{\equal{#6}{}}{}{ #6}%
    \strut%
    \ifx&#7&%
      \else{\newline{}\begin{minipage}[t]{\linewidth}\small#7\end{minipage}}\fi}}

\cventry から自動生成されたカンマとドットが削除されます。

関連情報