4

I am using moderncv with the casual style and would like to add content to the left column of a \cvitem (or \cvline, I can't spot the difference), which is wider than the predefined width of the column (the \hintscolumnwidth). Here I have two problems:

  1. All topics that I found so far suggest to simply adapt the \hintscolumnwidth accordingly, which I do not want to do. Instead, I want that the long text stays right-aligned and goes over the left side border of the column and thus the document. I need this, as I am not willing to adapt the whole width of the column because of one or two long entries.

  2. Another problem is that the page break of such content in the left column with \newline causes that the two lines of the content have a much wider gap than the text on the right column.

It should look like this: How it should look like MWE:

\documentclass[11pt,a4paper,roman]{moderncv}  
% moderncv themes
\moderncvstyle{casual}                             
\moderncvcolor{blue}                              
\usepackage[scale=0.78, top=12mm, bottom = 25mm]{geometry}
% Change width of gap between date column and data column
\setlength{\separatorcolumnwidth}{0.04\textwidth}
% Change width of column with the dates
\setlength{\hintscolumnwidth}{3,2cm}                
\name{John}{Something}
\title{my cv}   
% document                         
\begin{document}
\makecvtitle
\section{IT -- knowledge}
\cvitem{\textbf{short entry}}{normal}
\cvitem{\textbf{looooooooooongEntry}}{This is a long entry that shall fit in one line (right aligned)}
\cvitem{\textbf{looooooooooong-\newline Entry}}{Same entry as above, but split up. But the gap between lines is too wide (should be same distance as text in this right column).}
\cvitem{\textbf{evenLoooooooooooonger-\newline entry}}{This is an even longer entry that shall fit in two lines (right aligned, and with smaller gap between lines)}             
\end{document}    

I hope you can help me out, thank you!

  • 1
    I added a graphic, to make the issue more clear – Ronin100 Mar 27 '15 at 20:07
  • If you like my answer and it was helpful, please consider upvoting (by clicking on the arrows next to the score) and/or marking it as the accepted answer (by clicking on the checkmark ✓). That is the way here to say "Thank you for the help!" – Mensch Aug 16 at 0:46
1

Why do you not use the hyphenation?

I can't imagine that english words could be so long that you need them to go over the left side border.

With adding \- to mark the hyphenation points it works very well for me. Ommitting the \newline in your code I'm rid of the gap you got. (BTW: the command \newline makes the big gap only if the \newline is near the line break. Just leave it out!)

So the relevant line looks like:

\cvitem{\textbf{even\-Looooooo\-ooooon\-ger\-Entry}}{This is an even longer entry that shall fit in two lines (right aligned, and with smaller gap between lines)} 

Complete MWE:

\documentclass[11pt,a4paper,roman]{moderncv}  
% moderncv themes
\moderncvstyle{casual}                             
\moderncvcolor{blue}                              
\usepackage[scale=0.78, top=12mm, bottom = 25mm]{geometry}
% Change width of gap between date column and data column
\setlength{\separatorcolumnwidth}{0.04\textwidth}
% Change width of column with the dates
\setlength{\hintscolumnwidth}{3.2cm}  % 3,2              
\name{John}{Something}
\title{my cv}   
% document                         

\begin{document}
\makecvtitle
\section{IT~-- knowledge}
\cvitem{\textbf{short entry}}{normal}
\cvitem{\textbf{looooooooooongEntry}}{This is a long entry that shall fit in one line (right aligned)}
\cvitem{\textbf{looooooooooongEntry}}{This is a long entry that shall fit in one line (right aligned). This is a long entry that shall fit in one line (right aligned)}
\cvitem{\textbf{looooooooooong\-Entry}}{Same entry as above, but split up. But the gap between lines is too wide (should be same distance as text in this right column).}
\cvitem{\textbf{even\-Looooooo\-ooooon\-ger\-Entry}}{This is an even longer entry that shall fit in two lines (right aligned, and with smaller gap between lines)}
\end{document}

Result:

enter image description here

0

Your desired layout can be achieved with some \llap commands. That way the long entries in the left column are right aligned and can extend all the way to the left.

As in this answer pointed out, the big gaps between the lines on the left are caused by your \newline commands near the natural linebreak. If you use \llaps you need to issue a linebreaking command. \newline does not work here, so I use \\.

MWE:

\documentclass[11pt,a4paper,roman]{moderncv}  
% moderncv themes
\moderncvstyle{casual}                             
\moderncvcolor{blue}                              
\usepackage[scale=0.78, top=12mm, bottom = 25mm]{geometry}
% Change width of gap between date column and data column
\setlength{\separatorcolumnwidth}{0.04\textwidth}
% Change width of column with the dates
\setlength{\hintscolumnwidth}{3,2cm}                
\name{John}{Something}
\title{my cv}   
% document                         
\begin{document}
\makecvtitle
\section{IT -- knowledge}
\cvitem{\textbf{short entry}}{normal}
\cvitem{\textbf{\llap{looooooooooongEntry}}}{This is a long entry that shall fit in one line (right aligned)}
\cvitem{\textbf{\llap{looooooooooong-}\\Entry}}{Same entry as above, but split up. But the gap between lines is too wide (should be same distance as text in this right column).}
\cvitem{\textbf{\llap{evenLoooooooooooonger-}\\entry}}{This is an even longer entry that shall fit in two lines (right aligned, and with smaller gap between lines)}             
\end{document} 

Which results in that output:

moderncv long left columns aligned with llap commands

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.