1

I am using the banking style for moderncv. Is there a way I can modify the \cventry command so that the Employer, Job Title, City, and Year fields all appear on the same line? Something looking like this:

Employer, Job Title ... City Year

instead of this:

Employer ... City

Job Title ... Year

Here's a MWE:

\documentclass{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}
\nopagenumbers{}

\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry}

\begin{document}
\cventry{Date}{Job Title}{Employer}{City}{}{Description}
\end{document}
  • You could always just make a new command like \mycventry: \newcommand{\mycventry}[6]{<formatting stuff>}.... – jon Jan 10 '16 at 22:47
  • @jon Yes I was wondering if there is a simpler way to do his as I am not a latex master ;) – carloabelli Jan 12 '16 at 4:33
  • You mean: \newcommand{\mycventry}[6]{\textbf{#3}, \emph{#2} ... \textbf{#4} \emph{#1}}, and then writing \mycventry{Date}{Job Title}{Employer}{City}{}{Description}..? Hard to suggest more based on your currently stated desired output. – jon Jan 13 '16 at 5:41
  • @jon The ... here is not an ellipsis but rather indicates that the second half is right-aligned (arbitrary space in the middle). Ideally this would also have exactly the same functionality as \cventry just with this new and more compact format. Not knowing the complexities behind this I wouldn't know exactly what that entails but I assume it's more complicated than \textbf and \emph, though perhaps I am wrong. – carloabelli Jan 13 '16 at 5:46
  • 1
    To push things to the right-hand margin, a simple \hfill is often enough. However, things get complicated when the total line text is longer than the length of the line. (I.e., put \hfill where I had written ....) – jon Jan 13 '16 at 6:10
1

Using the suggestions in the comments I eventually ended up creating this command:

\newcommand{\myentry}[5]{\textbf{#3}\ifthenelse{\isempty{#2}}{}{: \textit{#2}}%
  \hfill\textit{\ifthenelse{\isempty{#4}}{}{#4 | }#1}%
  \ifthenelse{\isempty{#5}}{\par\vspace{1ex}}{\\#5\par\vspace{1ex}}%
}

Which results in a slightly modified version of the original question (I think it looks better than what I originally wished to do).

For a command that exactly mimics my original question this can be used:

\newcommand{\myentry}[5]{\textbf{#3}\ifthenelse{\isempty{#2}}{}{, \textit{#2}}%
  \hfill\ifthenelse{\isempty{#4}}{}{\textbf{#4} }\textit{#1}%
  \ifthenelse{\isempty{#5}}{\par\vspace{1ex}}{\\#5\par\vspace{1ex}}%
}

Note that this requires the xifthen package and for simplification purposes I got rid of a field so this only takes 5 parameters.

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.