1

I am writing my own cv using moderncv. In the section "education" I have an entry that does not suit the inputs required by \cventry. Generally, \cventry requires 6 fields, but I only need 4. My problem is that if I insert text only where I need, and leave the curvy brakets I do not need empty, what I get is:

01.2001-02-2002: Name, City, .
Text that briefly describes it.

As you can see, after the label "City" there is a ", " that I don't want. How can I get rid of it? My current \cventry is like this:

 \cventry{Date1-Date2}{Name}{}{City}{\textit{}}{Some text}

I tried to switch "City" to the empty bracket on its right, I get rid of the ", " but my city name turns into italics. On the other hand, if I shift my "City" label to the left, I still get the ", " sign and the city name becomes italics.

5
  • Go to the .cls file and change the code there – user95439 May 28 '16 at 16:30
  • I created a new class immediatelly below \cventryspecial that requires less inputs therefore should be fine, but when I run it the code tell me \cventryspecial not defined. I already Refreshed FNDB and Updated Formats with MikTex options, so what is the problem? – Patapunfate May 28 '16 at 17:46
  • Please check the license of the clas file before you make any changes to it. This is common sense. – Johannes_B May 29 '16 at 5:06
  • Get rid of the useless \textit{} in the next pair of braces? – Johannes_B May 29 '16 at 5:13
  • Thank you everybody, since the error was much more trivial, I stopped and simply removed the \texit{} from the code to solve my problem. Thank you anyway for your suggestion @Johannes_B, as I also wrote below, I was not aware that was the issue because, being new to LaTeX, I was not aware where to look for an solution. – Patapunfate May 29 '16 at 16:00
1

Moderncv should account for this, the following is the extract which defines \cventry in the package (moderncvbodyi.sty in http://ctan.org/tex-archive/macros/latex/contrib/moderncv).

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

\ifthenelse checks whether the fourth, fifth, or sixth elements are empty or not, so as to avoid commas between blank spaces. If there is nothing in a pair of braces it will not insert the comma but if the pair of braces is not empty, it adds the comma and inserts the contents of the braces. Note that this works in your example as no blank comma appears for the {} you use between Name and City.

I believe the problem is that {\textit{}} is not equal to {}, while no print text is defined in the argument the test finds that \textit{} is distinct from nothing. Removing this and using \cventry{Date1-Date2}{Name}{}{City}{}{Some text} should then resolve problems.

To define a short entry (assuming you never use the optional argument), the following should suffice but is probably not worth the hassle

\newcommand{\cventryshort}[4]{\cventry{#1}{#2}{#3}{}{}{#4}}
1
  • Thank you a lot, as I said I am new to LaTeX and I did not know where to look for a solution to my problem. Indeed, I removed the `\textit{} and now it works. Thank you a lot again, I will be more careful and look directly in the .sty file for an explanation next time – Patapunfate May 29 '16 at 15:59

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.