[Tex/LaTex] ModernCV: get rid of italic in `\cventry

italicmoderncv

in this document i'd like to deactivate the italics in \cventry.

%% start of file `template.tex'.
%% Copyright 2006-2015 Xavier Danaux (xdanaux@gmail.com).
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version 1.3c,
% available at http://www.latex-project.org/lppl/.


\documentclass[11pt,a4paper,sans]{moderncv}        % possible options include font size ('10pt', '11pt' and '12pt'), paper size ('a4paper', 'letterpaper', 'a5paper', 'legalpaper', 'executivepaper' and 'landscape') and font family ('sans' and 'roman')

% moderncv themes
\moderncvstyle{casual}                             % style options are 'casual' (default), 'classic', 'banking', 'oldstyle' and 'fancy'
\moderncvcolor{blue}                               % color options 'black', 'blue' (default), 'burgundy', 'green', 'grey', 'orange', 'purple' and 'red'
%\renewcommand{\familydefault}{\sfdefault}         % to set the default font; use '\sfdefault' for the default sans serif font, '\rmdefault' for the default roman one, or any tex font name
%\nopagenumbers{}                                  % uncomment to suppress automatic page numbering for CVs longer than one page

% character encoding
%\usepackage[utf8]{inputenc}                       % if you are not using xelatex ou lualatex, replace by the encoding you are using
%\usepackage{CJKutf8}                              % if you need to use CJK to typeset your resume in Chinese, Japanese or Korean

% adjust the page margins
\usepackage[scale=0.75]{geometry}
%\setlength{\hintscolumnwidth}{3cm}                % if you want to change the width of the column with the dates
%\setlength{\makecvheadnamewidth}{10cm}            % for the 'classic' style, if you want to force the width allocated to your name and avoid line breaks. be careful though, the length is normally calculated to avoid any overlap with your personal info; use this at your own typographical risks...

% personal data
\name{John}{Doe}
\title{Resumé title}                               % optional, remove / comment the line if not wanted
\address{street and number}{postcode city}{country}% optional, remove / comment the line if not wanted; the "postcode city" and "country" arguments can be omitted or provided empty
\phone[mobile]{+1~(234)~567~890}                   % optional, remove / comment the line if not wanted; the optional "type" of the phone can be "mobile" (default), "fixed" or "fax"
\phone[fixed]{+2~(345)~678~901}
\phone[fax]{+3~(456)~789~012}
\email{john@doe.org}                               % optional, remove / comment the line if not wanted
\homepage{www.johndoe.com}                         % optional, remove / comment the line if not wanted
\social[linkedin]{john.doe}                        % optional, remove / comment the line if not wanted
\social[xing]{john\_doe}                           % optional, remove / comment the line if not wanted
\social[twitter]{jdoe}                             % optional, remove / comment the line if not wanted
\social[github]{jdoe}                              % optional, remove / comment the line if not wanted
\social[gitlab]{jdoe}                              % optional, remove / comment the line if not wanted
\social[skype]{jdoe}                               % optional, remove / comment the line if not wanted
\extrainfo{additional information}                 % optional, remove / comment the line if not wanted
%\photo[64pt][0.4pt]{picture}                       % optional, remove / comment the line if not wanted; '64pt' is the height the picture must be resized to, 0.4pt is the thickness of the frame around it (put it to 0pt for no frame) and 'picture' is the name of the picture file
\quote{Some quote}                                 % optional, remove / comment the line if not wanted

% bibliography adjustements (only useful if you make citations in your resume, or print a list of publications using BibTeX)
%   to show numerical labels in the bibliography (default is to show no labels)
%\makeatletter\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}\makeatother
\renewcommand*{\bibliographyitemlabel}{[\arabic{enumiv}]}
%   to redefine the bibliography heading string ("Publications")
%\renewcommand{\refname}{Articles}

% bibliography with mutiple entries
%\usepackage{multibib}
%\newcites{book,misc}{{Books},{Others}}
%----------------------------------------------------------------------------------
%            content
%----------------------------------------------------------------------------------
\begin{document}
%\begin{CJK*}{UTF8}{gbsn}                          % to typeset your resume in Chinese using CJK
%-----       resume       ---------------------------------------------------------
\makecvtitle


\section{Experience}
\subsection{Vocational}
\cventry{year--year}{Job title}{Employer}{City}{}{General description no longer than 1--2 lines.\newline{}%
Detailed achievements:}



% Publications from a BibTeX file without multibib
%  for numerical labels: \renewcommand{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}% CONSIDER MERGING WITH PREAMBLE PART
%  to redefine the heading string ("Publications"): \renewcommand{\refname}{Articles}
\nocite{*}
\bibliographystyle{plain}
\bibliography{publications}                        % 'publications' is the name of a BibTeX file

% Publications from a BibTeX file using the multibib package
%\section{Publications}
%\nocitebook{book1,book2}
%\bibliographystylebook{plain}
%\bibliographybook{publications}                   % 'publications' is the name of a BibTeX file
%\nocitemisc{misc1,misc2,misc3}
%\bibliographystylemisc{plain}
%\bibliographymisc{publications}                   % 'publications' is the name of a BibTeX file

\clearpage
\end{document}



    % Publications from a BibTeX file without multibib
    %  for numerical labels: \renewcommand{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}% CONSIDER MERGING WITH PREAMBLE PART
    %  to redefine the heading string ("Publications"): \renewcommand{\refname}{Articles}
    \nocite{*}
    \bibliographystyle{plain}
    \bibliography{publications}                        % 'publications' is the name of a BibTeX file

    % Publications from a BibTeX file using the multibib package
    %\section{Publications}
    %\nocitebook{book1,book2}
    %\bibliographystylebook{plain}
    %\bibliographybook{publications}                   % 'publications' is the name of a BibTeX file
    %\nocitemisc{misc1,misc2,misc3}
    %\bibliographystylemisc{plain}
    %\bibliographymisc{publications}                   % 'publications' is the name of a BibTeX file

    \clearpage
    \end{document}

enter image description here

The second item (in this case Employer) is always written in italic.

i tried to use

\xpatchcmd{\cventry}{\itshape#2}{#2}{}{}

but it didn't work in this case. (credits to egreg's answer in this thread)

Also i would like to put linebreaks after each part of the \cventry.
e.g.:

Job Title
Employer
City

instead of

Job Title, Employer, City

Best Answer

With an current version 2.0.0 (you seems to use it) the definition of command \cventry is:

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

Therefore you need to change the command xpatchcmd to

\usepackage{xpatch}
\xpatchcmd{\cventry}{\slshape#4}{#4}{}{}

With the following MWE

\documentclass[11pt,a4paper,sans]{moderncv}
% moderncv themes
\moderncvstyle{casual} % head[left,right] 2 body 1 foot 1
\moderncvcolor{blue} 
%\renewcommand{\familydefault}{\sfdefault} 
%\nopagenumbers{}

% adjust the page margins
\usepackage[scale=0.75]{geometry}
%\setlength{\hintscolumnwidth}{3cm} 
%\setlength{\makecvheadnamewidth}{10cm}

\usepackage{xpatch}
\xpatchcmd{\cventry}{\slshape#4}{#4}{}{}


% personal data
\name{John}{Doe}
\title{Resumé title}
\address{street and number}{postcode city}{country}
\phone[mobile]{+1~(234)~567~890}
\phone[fixed]{+2~(345)~678~901}
\phone[fax]{+3~(456)~789~012}
\email{john@doe.org}
\homepage{www.johndoe.com}
\social[linkedin]{john.doe}
\social[xing]{john\_doe}
\social[twitter]{jdoe}
\social[github]{jdoe}
\social[gitlab]{jdoe}
\social[skype]{jdoe}
\extrainfo{additional information}
%\photo[64pt][0.4pt]{picture}
\quote{Some quote}

% bibliography adjustements (only useful if you make citations in your resume, or print a list of publications using BibTeX)
%   to show numerical labels in the bibliography (default is to show no labels)
%\makeatletter\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}\makeatother
\renewcommand*{\bibliographyitemlabel}{[\arabic{enumiv}]}
%   to redefine the bibliography heading string ("Publications")
%\renewcommand{\refname}{Articles}

% bibliography with mutiple entries
%\usepackage{multibib}
%\newcites{book,misc}{{Books},{Others}}
%----------------------------------------------------------------------------------
%            content
%----------------------------------------------------------------------------------
\begin{document}
%\begin{CJK*}{UTF8}{gbsn}                          % to typeset your resume in Chinese using CJK
%-----       resume       ---------------------------------------------------------
\makecvtitle


\section{Experience}
\subsection{Vocational}
\cventry{year--year}{Job title}{Employer}{City}{}{General description no longer than 1--2 lines.\newline{}%
Detailed achievements:}



% Publications from a BibTeX file without multibib
%  for numerical labels: \renewcommand{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}% CONSIDER MERGING WITH PREAMBLE PART
%  to redefine the heading string ("Publications"): \renewcommand{\refname}{Articles}
\nocite{*}
\bibliographystyle{plain}
\bibliography{publications}                        % 'publications' is the name of a BibTeX file

% Publications from a BibTeX file using the multibib package
%\section{Publications}
%\nocitebook{book1,book2}
%\bibliographystylebook{plain}
%\bibliographybook{publications}                   % 'publications' is the name of a BibTeX file
%\nocitemisc{misc1,misc2,misc3}
%\bibliographystylemisc{plain}
%\bibliographymisc{publications}                   % 'publications' is the name of a BibTeX file

\clearpage
\end{document}

you get the result:

enter image description here

EDIT:

For example can you define a new command \mycventry (I think that is better than changing \cventry so hard):

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

Here I changed the comma to \newline and deleted the slanted printing.

With the following MWE

\documentclass[11pt,a4paper,sans]{moderncv}
% moderncv themes
\moderncvstyle{casual} % head[left,right] 2 body 1 foot 1
\moderncvcolor{blue} 
%\renewcommand{\familydefault}{\sfdefault} 
%\nopagenumbers{}

% adjust the page margins
\usepackage[scale=0.75]{geometry}
%\setlength{\hintscolumnwidth}{3cm} 
%\setlength{\makecvheadnamewidth}{10cm}

\usepackage{xpatch}
\xpatchcmd{\cventry}{\slshape#4}{#4}{}{}

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


% personal data
\name{John}{Doe}
\title{Resumé title}
\address{street and number}{postcode city}{country}
\phone[mobile]{+1~(234)~567~890}
\phone[fixed]{+2~(345)~678~901}
\phone[fax]{+3~(456)~789~012}
\email{john@doe.org}
\homepage{www.johndoe.com}
\social[linkedin]{john.doe}
\social[xing]{john\_doe}
\social[twitter]{jdoe}
\social[github]{jdoe}
\social[gitlab]{jdoe}
\social[skype]{jdoe}
\extrainfo{additional information}
%\photo[64pt][0.4pt]{picture}
\quote{Some quote}

% bibliography adjustements (only useful if you make citations in your resume, or print a list of publications using BibTeX)
%   to show numerical labels in the bibliography (default is to show no labels)
%\makeatletter\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}\makeatother
\renewcommand*{\bibliographyitemlabel}{[\arabic{enumiv}]}
%   to redefine the bibliography heading string ("Publications")
%\renewcommand{\refname}{Articles}

% bibliography with mutiple entries
%\usepackage{multibib}
%\newcites{book,misc}{{Books},{Others}}
%----------------------------------------------------------------------------------
%            content
%----------------------------------------------------------------------------------
\begin{document}
%\begin{CJK*}{UTF8}{gbsn}                          % to typeset your resume in Chinese using CJK
%-----       resume       ---------------------------------------------------------
\makecvtitle


\section{Experience}
\subsection{Vocational}
\cventry{year--year-2}{Job title-3}{Employer-4}{City-5}{-6}{General description no longer than 1--2 lines-7}
\mycventry{year--year-2}{Job title-3}{Employer-4}{City-5}{-6}{General description no longer than 1--2 lines-7}


% Publications from a BibTeX file without multibib
%  for numerical labels: \renewcommand{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}% CONSIDER MERGING WITH PREAMBLE PART
%  to redefine the heading string ("Publications"): \renewcommand{\refname}{Articles}
\nocite{*}
\bibliographystyle{plain}
\bibliography{publications}                        % 'publications' is the name of a BibTeX file

% Publications from a BibTeX file using the multibib package
%\section{Publications}
%\nocitebook{book1,book2}
%\bibliographystylebook{plain}
%\bibliographybook{publications}                   % 'publications' is the name of a BibTeX file
%\nocitemisc{misc1,misc2,misc3}
%\bibliographystylemisc{plain}
%\bibliographymisc{publications}                   % 'publications' is the name of a BibTeX file

\clearpage
\end{document}

you will get:

second result