12

This image shows the excerpt of a CV produced with the moderncv document class:

Notice that after the bold text there is a comma. This seems to be produced automatically. How can I stop this?

  • 3
    Welcome to TeX.SE. It would be helpful if you composed a fully compilable MWE including \documentclass and the appropriate packages that sets up the problem. While solving problems is fun, setting them up is not. Then those trying to help can simply cut and paste your MWE and get started on solving problem. – Peter Grill Dec 12 '12 at 4:12
18

The entry you're showing is produce with \cventry, so we want to change the definition of this macro. It is defined in moderncvstyleclassic.sty. All I did is copy it into my preamble verbatim and remove the undesired comma. (In the MWE, I actually copied the line and commented out the original, to make the change recognizable.

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

output

9

instead of redefining the whole command yourself also consider using xpatch:

\usepackage{xpatch}

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

this line replaces the first occurence in the macro text of , by the empty string - i.e. removes it.

Here is also a nice documentation of how the command works.

1

Obvious comment, but in case you want to be able to switch between having and not having the comma, you can define a new command \cventrynocomma like this:

\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}}
0

From the file moderncvstyleclassic.sty, remove the comma and dot like following:

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

It will remove the auto generated commas and dot from the \cventry.

  • You should not change files you don't own. – Johannes_B Sep 29 '17 at 11:17
  • Can I say it "customization"? Otherwise, how can I use it? Most of the files we use are written by someone else. @Johannes-b – mumu Sep 29 '17 at 14:34
  • Copy rge relevant code to your preamble. – Johannes_B Sep 29 '17 at 15:00
  • Just to clarify for future readers, the reason "You should not change files you don't own" is that, with the next update to the package, your changes would be overwritten. By copying the relevant code to your preamble and editing it there, your document will look the same before and after the package update. – thymaro Nov 11 '18 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.