[Tex/LaTex] moderncv: cventry without job title

moderncv

My current cventry looks like this:

\item{\cventry{year}{}{company}{location}{} ... }

I don't need the second line, but it still takes the space which looks pretty bad, because the headline isn't vertically centered (compared to the bullet on the left):

enter image description here

Any ideas how to change this to look better? Thank you in advance.

UPDATE:
I have used this template: https://www.overleaf.com/articles/physics/vnrpxccpnqkw#.WH-HWhsrLmE

MWE:

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.75]{geometry}

\usepackage{import}
\name{Isaiah}{Becker-Mayer}
\title{Physics}
\begin{document}
\section{Previous Employment}
\vspace{6pt}
\begin{itemize}

\item{\cventry{Date}{}{Company}{Location}{}{\vspace{3pt} ... }}

\end{itemize}
\end{document}

MWE 2:

After adding a cover letter to the solution provided by @Martin it seems to break.

enter image description here

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.75]{geometry}

\renewcommand*{\cventry}[7][.25em]{
  \begin{tabular*}{\maincolumnwidth}{l@{\extracolsep{\fill}}r}%
    {\bfseries #4, #5} & {\itshape #2}\\%
  \end{tabular*}%
  \ifx&#7&%
  \else{\\%
    \begin{minipage}{\maincolumnwidth}%
      \small#7%
    \end{minipage}}\fi%
  \par\addvspace{#1}}

\usepackage{import}

\recipient{HR Departmnet}{Corporation\\123 Pleasant Lane\\12345 City, State} % Letter recipient
\date{\today} % Letter date
\opening{Dear Sir or Madam,} % Opening greeting
\closing{Sincerely yours,} % Closing phrase
\enclosure[Anhang]{Lebenslauf} % List of enclosed documents

\name{Isaiah}{Becker-Mayer}
\title{Physics}
\begin{document}

\makelettertitle % Print letter title

\section{Previous Employment}
\vspace{6pt}
\begin{itemize}

\item{\cventry{Date}{}{Company}{Location}{}{\vspace{3pt} ... }}

\end{itemize}
\end{document}

Best Answer

You can just take a look to the definition of your cventry in that style:

\renewcommand*{\cventry}[7][.25em]{
  \begin{tabular*}{\maincolumnwidth}{l@{\extracolsep{\fill}}r}%
    {\bfseries #4} & {\bfseries #5}\\%
    {\itshape #3\ifthenelse{\equal{#6}{}}{}{, #6}} & {\itshape #2}\\%
  \end{tabular*}%
  \ifx&#7&%
  \else{\\%
    \begin{minipage}{\maincolumnwidth}%
      \small#7%
    \end{minipage}}\fi%
  \par\addvspace{#1}}

As you see the first two lines are set as a table. You can redefine the style to omit the table and rearrange field output. If you never need that second line (arguments #3 and #6), you can remove them entirely, for example:

\renewcommand*{\cventry}[7][.25em]{
  \begin{tabular*}{\maincolumnwidth}{l@{\extracolsep{\fill}}r}%
    {\bfseries #4, #5} & {\itshape #2}\\%
  \end{tabular*}%
  \ifx&#7&%
  \else{\\%
    \begin{minipage}{\maincolumnwidth}%
      \small#7%
    \end{minipage}}\fi%
  \par\addvspace{#1}}

adapted banking style

If you need that entry type sometimes with and sometimes without that line, you can add a command for the latter purpose and use the standard cventry otherwise. However, your layout will then be somewhat inconsistent. It depends on you, if you feel disturbed by things like that.

You could also switch to another style where that line can be more easily omitted. For example, I use the classic style and have redefined cventry to the following (which removes some hard coded punctuation):

\renewcommand*{\cventry}[7][.25em]{%
  \cvitem[#1]{#2}{%
    {\bfseries#3}%
    \ifthenelse{\equal{#4}{}}{}{\newline{\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}}

adapted classicstyle cventry


Edit: I added all letter commands and moved the cv to page two. Also, the cv gets a header which I call in the MWE below. Apparently something is set when calling the letterhead that tells the itemize to insert a linebreak directly behind the \item. Not putting the cventries in an itemize environment solves the issue.

moderncv should actually revert all (letter) settings for header and bodies when swithcing to the cv pat by \makecvtitle. Obviously it does not.

As you want the itemize environment, here is another solution: I changed the \makeletterhead command (which is called by \makelettertitle) to solve the problem with the items (the rest is what the banking style loads). Commenting the \raggedright before the opening does what you want. See the full example below.


Update on raggedright: It struck me later yesterday what raggedright (1) is supposed to do and also what the problem with the linebreaks after \item is (2).

  1. The letter is now justified. In some places letters are typeset raggedright, however. If you want that behavior, you can either leave the raggedright in there (see 2. for a solution on the itemize items) or you can manually set the lettertext in a flushleft environment. Not that one cannot change from raggedright mode back to justified paragraph layout.

  2. The linebreak occurs because the tabular is too wide. It is set to \linewidth which neither takes the indentation nor the bullet point of the itemize into account. What you can do is to decrease the with of the table (see below where the new width was determined manually and not from the itemize indent). Personally, I think a letter should be justified but with this approach you can decide on that as you like.

I have changed the above edit note to refer to the following example. Below is an updated example using all the discussed changes. For simpler use of \cventry, I changed it to use an itemize by itself.

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.75]{geometry}
\usepackage{blindtext}

\makeatletter
\renewcommand*{\makeletterhead}{%
  % recompute lengths (in case we are switching from letter to resume, or vice versa)
  \recomputeletterlengths%
  % sender block
  \makehead%
  \par%
   % recipient block
  \begin{minipage}[t]{.5\textwidth}
    \raggedright%
    \addressfont%
    {\bfseries\upshape\@recipientname}\\%
    \@recipientaddress%
  \end{minipage}
  % date
  \hfill% US style
%  \\[1em]% UK style
  \@date\\[2em]% US informal style: "January 1, 1900"; UK formal style: "01/01/1900"
  % opening
%   \raggedright% COMMENTED FOR JUSTIFIED LETTER BODY AND FULL WIDTH CVENTRY
  \@opening\\[1.5em]%
  % ensure no extra spacing after \makelettertitle due to a possible blank line
%  \ignorespacesafterend% not working
  \hspace{0pt}\par\vspace{-\baselineskip}\vspace{-\parskip}%
  }
\makeatother

\renewcommand*{\cventry}[7][.25em]{
    \begin{itemize}
        \item \begin{tabular*}{0.975\maincolumnwidth}{l@{\extracolsep{\fill}}r}%
        {\bfseries #4, #5} & {\itshape #2}\\%
      \end{tabular*}%
      \ifx&#7&%
      \else{\\%
        \begin{minipage}{\maincolumnwidth}%
          \small#7%
        \end{minipage}}\fi%
      \par\addvspace{#1}%
    \end{itemize}%
}

\recipient{HR Departmnet}{Corporation\\123 Pleasant Lane\\12345 City, State} % Letter recipient
\date{\today} % Letter date
\opening{Dear Sir or Madam,} % Opening greeting
\closing{Sincerely yours,} % Closing phrase
\enclosure[Anhang]{Lebenslauf} % List of enclosed documents

\name{Isaiah}{Becker-Mayer}
\title{Physics}
\begin{document}

\makelettertitle % Print letter title

\blindtext[1]

\makeletterclosing
\clearpage

\makecvtitle

\section{Previous Employment}
% \vspace{6pt}
\cventry{Date}{}{Company}{Location}{}{I did stuff there\newline and more stuff\newline and more stuff}
\cventry{Date}{}{Company}{Location}{}{I did stuff there}
\end{document}