4

Using moderncv, does anyone know how I change the command \cvlanguage{}{B}{} such that the column containing B gets wider? As it is now it linebreaks after 15 characters.

I also don't want the changes to affect any other commands

9

\cvlanguage is defined as:

\newcommand*{\cvlanguage}[3]{%
  \cvline{#1}{\begin{minipage}[t]{0.625\maincolumnwidth}\textbf{#2}\end{minipage}\hfill\begin{minipage}[t]{0.325\maincolumnwidth}\raggedleft\footnotesize\itshape #3\end{minipage}}}

What you have to do is redefine the command in your document changing the number 0.625 for something bigger (but smaller than one). Don't forget to change the 0.325 to something smaller (ideally the sum should stay the same). For example:

\renewcommand*{\cvlanguage}[3]{%
  \cvline{#1}{\begin{minipage}[t]{0.7\maincolumnwidth}\textbf{#2}\end{minipage}\hfill\begin{minipage}[t]{0.25\maincolumnwidth}\raggedleft\footnotesize\itshape #3\end{minipage}}}

EDIT:

In newer versions, \cvlanguage has been changed to be

\newcommand*{\cvlanguage}[3]{\cvitemwithcomment{#1}{#2}{#3}}

This can be found in the style file moderncvcompatibility.sty.

The definition of \cvitemwithcomment are in the files moderncvbody{i-v}.sty, and is slightly more complicated, as it depends on the settings for that style of cv. It now calculates box sizes for placing the content.

4
  • Where do you find the defining code of \cvlanguage – Karlo May 16 '17 at 0:11
  • 1
    This has changed since older versions. I've edited my answer to reflect the new code. – fabikw May 16 '17 at 0:18
  • OK. But as a general question: if you need code like this, do you always look in the package.sty file? – Karlo May 16 '17 at 10:47
  • 1
    Yes. Sometimes finding the right file in packages (or classes) with multiple files can be hard. The best things to do are look at the texdoc (some of them have commented code) or just search for the package directory in your distribution or in ctan. – fabikw May 16 '17 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy