I want the output of the code below to be like this image. How to do this?
Please keep in mind that the width of [Foo Bar Foo]'s is variable. So it should be calculated automatically.
\documentclass{book}
\begin{document}
\noindent Just enough text to make the line break so we get to see a second line.
\begin{itemize}
\item[Foo] An item
\item[Foo Bar Foo] An item An item An item An item An item An item An item An item An item An item An item An item An item An item
\item[Bar Bar] An item
\end{itemize}
Just enough text to make the line break so we get to see a second line.
\end{document}
Edit: I don't want to use tabular or similar environment, because there are many items which should span some pages.
Best Answer
If you don't have dangerous things like labels or counter settings (numbered equations, for instance) in the body of the
itemize
, you can locally redefine\item
to do the measurement:If you need a single item, as you seem to from your comments, it's easier because just one label needs to be measured; here's the idea, integrated in the previous code.