3

Let's say I have the following:

\documentclass[12pt,a4paper]{article}
\usepackage{currvita}
\begin{document}
\begin{cv}{Hello}
\begin{cvlist}{Something}

\item[item name]                         %%% make this...
    Lorem ipsum dolor
\item[slightly longer item]              %%% ...align with this.
    sit amet, consectetur adipiscing

\end{cvlist}
\end{cv}
\end{document}

How can I make item and slightly longer item align to the the right?

1

1 Answer 1

2

What I did was to create a new macro \myitem that takes both an optional and mandatory argument. The optional argument is the width of the item header (default 1in), while the second item is that which you wish to right-align in that width. As you can see in my MWE, the first thing I did was to set the \defaultitemlength equal to my widest item's width.

\documentclass[12pt,a4paper]{article}
\usepackage{currvita}
\usepackage{calc}
\newlength\defaultitemlength
\setlength\defaultitemlength{1in}
\newsavebox{\itembox}
\newcommand\myitem[2][\defaultitemlength]{%
\sbox{\itembox}{\makebox[#1][r]{#2}}\item[\usebox{\itembox}]}
\begin{document}
\setlength\defaultitemlength{\widthof{slightly longer item}}
\begin{cv}{Hello}
\begin{cvlist}{Something}
\myitem{item name}                         %%% make this...
    Lorem ipsum dolor
\myitem{slightly longer item}              %%% ...align with this.
    sit amet, consectetur adipiscing
\end{cvlist}
\end{cv}
\end{document}

enter image description here

The alternate usage of this macro would be to specify the item width manually, but in this case, the items will likely end up with a net indent, since it is tough to match the manual specification to the actual maximum item width.

\myitem[1.5in]{item name}                         %%% make this...
    Lorem ipsum dolor
\myitem[1.5in]{slightly longer item}              %%% ...align with this.
    sit amet, consectetur adipiscing
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .