[Tex/LaTex] Moderncv: content of \cvitem or \cvline shall be allowed to exceed the \hintscolumnwidth borders

moderncv

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!

Best Answer

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

Related Question