Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have an enumerated list that uses roman numbers.

\documentclass{article}
\usepackage{enumitem}

\begin{document}
\begin{enumerate}[label=\roman*]
\item first entry
\item second entry
\end{enumerate}
\end{document}

Unfortunately the 'i' and the 'ii' are now left-aligned. Is it possible to centre the enumerating column?

share|improve this question
3  
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. The normal enumerate environment doesn't take an optional argument. –  Martin Scharrer Oct 30 '11 at 19:07
    
Yes, I forgot. I'm using the enumitem package; added it to the example. –  D.Roepo Oct 30 '11 at 19:15
add comment

1 Answer 1

up vote 13 down vote accepted

The enumitem package comes with a left and right alignment built in. The currently released version, (v3.0) allows you to define a custom alignment via SetLabelAlign:

enter image description here

Here are two versions, one without the () and another with the (). Since you desired to have the parenthesis aligned as well, \makebox[1.0em] is used to ensure that the label is centered in a box of the specified width, so that the parenthesis will be just outside of this box and hence be aligned. If your list is very long, you might need to increase the size via using \makebox[1.5em] instead:

\documentclass{article}
\usepackage{enumitem}

\SetLabelAlign{Center}{\hfil#1\hfil}
\SetLabelAlign{CenterWithParen}{\hfil(\makebox[1.0em]{#1})\hfil}

\begin{document}
\begin{enumerate}[label=\roman*,align=Center]
\item first entry
\item second entry
\item third entry
\end{enumerate}

\hrule

\begin{enumerate}[label=\roman*,align=CenterWithParen]
\item first entry
\item second entry
\item third entry
\end{enumerate}
\end{document}
share|improve this answer
7  
For this you need at least version 3.0 of enumitem. –  Werner Oct 30 '11 at 19:20
    
@Werner: Thanks for pointing that out. I did not think of mentioning that as it is part of the current released code as part of TeXLive2011. –  Peter Grill Oct 30 '11 at 19:31
    
Thanks, that seems to be the solution. As a follow-up on this: Suppose I use \begin{enumerate}[label=(\roman*),align=Center], is it possible to make the parenthesis equally wide? '(i)', and '(iii)' on top of one another do not look very nice... –  D.Roepo Oct 31 '11 at 8:45
1  
@user7091: If I understand correctly what you want, you can use something like \SetLabelAlign{Center}{(\makebox[1em]{\hfil#1\hfil})} and then \begin{enumerate}[label=\roman*,align=Center]\item...\end{enumerate}. –  Gonzalo Medina Oct 31 '11 at 13:53
    
@GonzaloMedina: Thanks. I updated the solution. but modified the parameter of the \makebox slightly as that made more sense to me. Please correct me if I am mistaken. –  Peter Grill Oct 31 '11 at 16:04
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.