6

I want to modify the first field of

\cventry{Aug 2014 - Present}{WiMi}{LMU}{}{}{}

in a way that it is ragged right. This might be equally interesting for:

\cvitem
\cvitemwithcomment

Is this possible in the .tex file, or do I have to modify moderncv.cls and moderncvstyleclassic.sty?

Here a minimal example:

% "ModernCV" CV and Cover Letter
% LaTeX Template
% Version 1.11 (19/6/14)
% Original author:
% Xavier Danaux ([email protected])

\documentclass[11pt,a4paper,sans]{moderncv}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fixltx2e}
\usepackage{eurosym}
\usepackage{etoolbox} 
\moderncvstyle{classic} 
\moderncvcolor{grey}
\usepackage[scale=0.75]{geometry} 

\firstname{Thomas}
\familyname{Mueller} 
\title{Curriculum Vitae}


\begin{document}

\makecvtitle

\section{Experience}
\cventry{Aug 2014 - Present}{WiMi}{LMU}{}{}{
\begin{itemize}
\item Development of stuff,
\item Misc analysis.
\end{itemize}}

\section{Phd thesis}
\cvitem{Title:}{\emph{The ball and You}}
\cvitem{Supervisors:}{Adam\&  Eva}
\cvitem{Description:}{Random Text.}

\section{Languages}
\cvitemwithcomment{Mothertongue:}{German}{}
\cvitemwithcomment{Intermediate:}{English}{Conversationally fluent}

\end{document}

Which leads to the following graphic. Just to be clear, I want the dates to be ragged right (Aug 2014 - present) enter image description here

1
  • Rather than editing the title, you should upvote the answer and accept it clicking the green tick.
    – Manuel
    Sep 25, 2014 at 13:24

1 Answer 1

7

\noexpand

Add these to your preamble:

\usepackage{xpatch}% http://ctan.org/pkg/xpatch
% \xpatchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\xpatchcmd{\cvitem}{\raggedleft\hintstyle{#2}}{\raggedright\hintstyle{#2}}{}{}

enter image description here

\expand

The \cventry uses \cvitem and the \cvitem is defined as

\renewcommand*{\cvitem}[3][.25em]{%
  \begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
    \raggedleft\hintstyle{#2} &{#3}%
  \end{tabular}%
  \par\addvspace{#1}}

You can see a \raggedleft above which has to be replaced by \raggedright. Since \cvitem uses an optional argument, patching is better done with \xpatchcmd from xpatch package.

Full code:

% "ModernCV" CV and Cover Letter

% LaTeX Template
% Version 1.11 (19/6/14)
% Original author:
% Xavier Danaux ([email protected])

\documentclass[11pt,a4paper,sans]{moderncv}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fixltx2e}
\usepackage{eurosym}
\usepackage{etoolbox}
\moderncvstyle{classic}
\moderncvcolor{grey}
\usepackage[scale=0.75]{geometry}

\firstname{Thomas}
\familyname{Mueller}
\title{Curriculum Vitae}


\usepackage{xpatch}% http://ctan.org/pkg/xpatch
% \xpatchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\xpatchcmd{\cvitem}{\raggedleft\hintstyle{#2}}{\raggedright\hintstyle{#2}}{}{}

\begin{document}

\makecvtitle

\section{Experience}
\cventry{Aug 2014 - Present}{WiMi}{LMU}{}{}{
\begin{itemize}
\item Development of stuff,
\item Misc analysis.
\end{itemize}}

\section{Phd thesis}
\cvitem{Title:}{\emph{The ball and You}}
\cvitem{Supervisors:}{Adam\&  Eva}
\cvitem{Description:}{Random Text.}

\section{Languages}
\cvitemwithcomment{Mothertongue:}{German}{}
\cvitemwithcomment{Intermediate:}{English}{Conversationally fluent}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .