1

I'm trying to make my resume shorter by adding a multicolumn environment multicol. I'm using the class moderncv and package multicol to lay out a list of items in a special two column section (in the middle of my otherwise one-column resume). It works fine, except that the whole thing is shifted too far to the left, so I'm trying to hack together a solution by putting horizontal spacing on every item to shift it all to the right.

Here's an example of the chunk of source that's giving me problems.

\hspace{1cm} \textit{Special heading}
\begin{multicols}{2}

  \hspace{1cm}
  Foo
  \newline
  \hspace{1cm}
  Bar
  \newline
  \hspace{1cm}
  Bat
  \newline
  \end{multicols}

When this compiles, the header line is indented by a centimeter, as is the first item in the list ("Foo"), however, none of the other items are indented.

I've tried several other spacing commands from the list in this question, and they all lead to the same problem.

Edit: Here's a full compile-able document, by request. This complies with pdflatex filename.tex with TeX Live installed on osx, and shows the error.

\documentclass[letterpaper]{moderncv}
\usepackage{textcomp}
\usepackage{multicol}
\moderncvstyle{classic}
\moderncvcolor{green}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.75]{geometry}
\setlength{\hintscolumnwidth}{2cm}
\name{Name}{}
\address{Last update: September 22, 2017} %% total hack to get last rev date instead of
                                %% address in here.
\phone[office]{Number (office)}
\email{email}
\homepage{page}
    \begin{document}
\makecvtitle

\lfoot{\thepage}

\section{Here's a normal section}
\cventry
{09/12-Present}
{The thing}
{The other thing}
{That thing}
{}
{\begin{itemize}%
    \item here's a bit of a thing.
    \item and another.
    \end{itemize}}


\section{Stuff}
\subsection{More Stuff}
\cvitem
{2019}
{Stuff.}
\vspace{1mm}
\cvitem
{2017-9}
{Stuff.}

\subsection{Problematic Section}
\hspace{1cm} \textit{Special Header}
\begin{multicols}{2}

  \hspace{1cm}
  Foo
  \newline
  \hspace{1cm}
  Bar
  \newline
  \hspace{1cm}
  Bat
  \newline
  \hspace{1cm}
  Baz
  \newline
  \hspace{1cm}
  One more for good measure
  \newline
\end{multicols}
\vspace{1mm}
\subsection{Another section that works}
\cvitem
{2016-9}
{Stuff.}
\vspace{1mm}
\cvitem
{2016}
{Thingy.}
\end{document}

And here's a shot of the problematic output:

problematic output

as you can see, only the italicized sub-header and the first item are indented, when all the items in the multicolumn list ought to be indented.

2 Answers2

2

Nothing to do with multicol or the moderncv, it is just that \\ drops spaces before and after it because normally you don't want them creeping in. And \hspace{xxx} is just like an ordinary word space only to a specific width so that gets dropped too. What you want is a \hspace*{xxx} if you really want to do that level of explicit formatting.

1

Class moderncv in current version 2.0.0 has several commands to typeset closer text, for example \cvlistdoubleitem, \cvdoubleitem or \cvcolumn.

Because you gave no information about the real content (bla is not really helpful in this case ;-)) I have a little bit to guess. Command \cvlistdoubleitem adds an textbullet in front of the added information you seem not to want. So you can define a new command \mycvlistdoubleitem like:

\newcommand*{\mycvlistdoubleitem}[3][.25em]{%
  \cvitem[#1]{}{\begin{minipage}[t]{\listdoubleitemcolumnwidth}#2\end{minipage}%
  \hfill% fill of \separatorcolumnwidth
  \ifthenelse{\equal{#3}{}}%
    {}%
    {\begin{minipage}[t]{\listdoubleitemcolumnwidth}#3\end{minipage}}}} 

and the usage

\mycvlistdoubleitem{Item 1}{Item 4}
\mycvlistdoubleitem{Item 2}{Item 5}

With the following complete code

\documentclass[letterpaper]{moderncv}

\moderncvstyle{classic}
\moderncvcolor{green}

\usepackage[utf8]{inputenc}
\usepackage[scale=0.75]{geometry}

\usepackage{textcomp}
\usepackage{multicol}

\newcommand*{\mycvlistdoubleitem}[3][.25em]{% <=========================
  \cvitem[#1]{}{\begin{minipage}[t]{\listdoubleitemcolumnwidth}#2\end{minipage}%
  \hfill% fill of \separatorcolumnwidth
  \ifthenelse{\equal{#3}{}}%
    {}%
    {\begin{minipage}[t]{\listdoubleitemcolumnwidth}#3\end{minipage}}}}

\setlength{\hintscolumnwidth}{2cm}
\name{Joe}{Doe}
\address{Last update: September 22, 2017} %% total hack to get last rev date instead of address in here.
\phone[office]{Number (office)}
\email{email}
\homepage{page}


\begin{document}
\makecvtitle

\lfoot{\thepage}

\section{Stuff}
\subsection{More Stuff}
\cvitem{2019}{Stuff.}
\vspace{1mm}
\cvitem{2017-9}{Stuff.}

\subsection{Problematic Section}
\hspace*{1cm} \textit{Special Header}
\begin{multicols}{2}
  \hspace*{1cm}
  Foo
  \newline
  \hspace*{1cm}
  Bar
  \newline
  \hspace*{1cm}
  Bat
  \newline
  \hspace*{1cm}
  Baz
  \newline
  \hspace*{1cm}
  One more for good measure
  \newline
\end{multicols}
\vspace{1mm}

\section{Extra 2}
\mycvlistdoubleitem{Item 1}{Item 4} % <=================================
\mycvlistdoubleitem{Item 2}{Item 5}
\mycvlistdoubleitem{Item 3}{Item 6. Like item 3 in the single column list before, this item is particularly long to wrap over several lines.}

\section{Extra 2}
\cvlistdoubleitem{Item 1}{Item 4}
\cvlistdoubleitem{Item 2}{Item 5}
\cvlistdoubleitem{Item 3}{Item 6. Like item 3 in the single column list before, this item is particularly long to wrap over several lines.}

\section{Computer skills}
\cvdoubleitem{category 1}{XXX, YYY, ZZZ}{category 4}{XXX, YYY, ZZZ}
\cvdoubleitem{category 2}{XXX, YYY, ZZZ}{category 5}{XXX, YYY, ZZZ}
\cvdoubleitem{category 3}{XXX, YYY, ZZZ}{category 6}{XXX, YYY, ZZZ}

\end{document}

you get the following result:

resulting cv

As you can see your solution with corrected command \hspace*{1cm} starts in the column reserverd for dates. In my marked section 1 in red circle you see the result of the new command \mycvlistdoubleitem, below you can see the result of the original command \cvlistdoubleitem, the marked 2 in red circle shows the result of command \cvdoubleitem also reaching in the first column for the dates.

I think possibility 1 fits best to the layout of style classic of class moderncv in your case ...

Mensch
  • 65,388
  • Finally got a chance to try this. The bullet point version with the built in \cvlistdoubleitem works, but with your custom code I'm getting:

    *\mycvlistdoubleitem{data for col 1.}{data for col 2.} ! Undefined control sequence. <argument> \listdoubleitemcolumnwidth

    Per this previous SO, I'm upgraded modern cv, but no difference.

    – Paul Gowder May 08 '19 at 23:50
  • Actually, your reply comment gave me the hint I needed: there was something wrong with the build process. I'm using this as part of a node-based build pipeline with templating and node-latex---but it works fine when I just generated a tex file with my template and used ordinary pdflatex to build. So, thanks! – Paul Gowder May 09 '19 at 01:40