2

I'm attempting to left-align a centered list of elements.

\begin{center}
\begin{align}
\begin{description}
\item[] lorem
\item[] ipsum
\item[] lorem
\item[] ipsum
\end{description}
\end{align}
\end{center}

"align" can only be used in a math environment, however, which isn't appropriate for my usage. This seems like a simple problem, but I continue to trip over it.

1 Answer 1

3

Please always post complete documents it makes answering the question easier.

It's not clear if it is just an artifact of the cut down example but description with empty labels doesn't really work as there is nothing to describe.

To just get a centered column left aligned on the longest line, the simplest is to use a tabular environment. If you do really need the layout of a display list such as description, then one way is to use the varwidth package as also shown. enter image description here

\documentclass{article}

\usepackage{varwidth}

\begin{document}

\noindent X\dotfill X

\noindent X\dotfill X

\begin{center}
\begin{tabular}{l}
lorem\\
ipsum\\
lorem\\
ipsum
\end{tabular}
\end{center}

\noindent X\dotfill X

\begin{center}
\begin{varwidth}{\textwidth}
\begin{description}
\item[abc] lorem
\item[xyz] ipsum
\item[abc] lorem
\item[123] ipsum
\end{description}
\end{varwidth}
\end{center}



\noindent X\dotfill X

\end{document}
4
  • Why varwidth requires the width as a second parameter and then ignores it?
    – JLDiaz
    Commented Jul 30, 2012 at 15:20
  • 2
    It's the maximum width: lines longer than that are wrapped to that width (like minipage) but if no lines are that long the whole box is reduced to the width of the longest entry (unlike minipage) Commented Jul 30, 2012 at 15:22
  • Thank you very much! The tabular environment worked perfectly. Commented Jul 30, 2012 at 15:47
  • @MylesBarros Then, please remember to accept David Carlisle answer.
    – Sveinung
    Commented Jul 31, 2012 at 9:35

You must log in to answer this question.

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