# Edit the commands in the moderncv class so as to add another 'column'

I'm making a CV using the moderncv class. For most of the commands, the text is aligned such that it looks to be divided into two columns; one which takes the header, years etc. argument of the commands, and is left-aligned (the text is right-aligned within it), and the other which takes up the remaining width of the page and has the main information in the cvitem, cventry etc. as in the following:

I want to compress the right column from the right and add in an extra column to the right of that (right-aligned, the text would be left-aligned in the column) something like the following: (obviously without cutting off the text as in the image).

I couldn't think of a way to do this myself so I tried looking in the moderncv class file to see how it creates the left column (so to speak), and use the same idea to create the right column, but couldn't see where it creates the left column. So I have no idea how to do this!

So I'm wondering is there an easy way to edit the cventry, cvitem etc. commands such that they take an extra argument which is left-aligned in a sort of column which is flushright, and compresses the middle column. I realise I may have made this sound ridiculously complicated but hopefully the images convey what I'm trying to do.

• Have you had a look at the definition of \cvitem in moderncvstyleclassic.sty? It typesets its arguments in a tabular with two columns. Adding a third amounts to adding a third column to the tabular. – Bordaigorl Jan 3 '14 at 22:30

The macros offered by moderncv are designed for a two column layout since \cvitem can distinguish between two arguments (the one for the side column and the one for the main content area). So you need to design your own macros that take three arguments for the contents of the three columns.

It is fairly easy to take the definition of \cvitem in moderncvstyleclassic.sty and adapt it to take 3 arguments and typeset three columns instead of just two: the columns are created using a tabular which can be used to add the third column. In this solution I also create some lengths to allow customisation without changing the definition of the new macro \cvitemthree:

\newlength{\rightcolumnwidth}
\newlength{\leftcolumnwidth}
\setlength{\rightcolumnwidth}{10em}
\setlength{\leftcolumnwidth}{\maincolumnwidth}

\newcommand*{\cvitemthree}[4][.25em]{%
\begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\leftcolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\rightcolumnwidth}@{}}%
\raggedleft\hintstyle{#2} &{#3} &{#4}%
\end{tabular}%

Then \cvitemthree{item}{This is the main text, ...}{date perhaps} would replicate your example image.
• Ok, I've almost got it to work, you forgot the \textwidth in \addtolength, which is why it was all bunched together, I think the line should be \addtolength{\leftcolumnwidth}{\textwidth-\rightcolumnwidth-\separatorcolumnwidth}. However, the right column is going into the margin, rather than going onto the next line. – davly Jan 4 '14 at 0:24
• Got \cvitem to work now, it was going into the margin because the leftcolumnwidth was off, I used \setlength{\leftcolumnwidth}{\maincolumnwidth-\hintscolumnwidth-\separatorcolumnwidth}. Thanks for the help! Now just to apply it to the other commands! – davly Jan 4 '14 at 0:35
• That's weird, it worked fine for me, maybe we are using different versions of moderncv? If you like my solution please consider accepting it as an answer. – Bordaigorl Jan 4 '14 at 0:48
• 2013/04/29 v1.5.1? I got it to work anyway, including \cventry. – davly Jan 4 '14 at 0:52