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 was wondering if it was possible nicely display a long label when using the itemize environment? e.g.:

\begin{itemize}
  \item[long ugly displaying label] Stuff
    \subitem more stuff
    ...
\end{itemize}

The label always goes over on the left of the picture. What I thinking is to split the labels on multiple lines? Or having a limit on how far to the left of the page the label is displayed and move the "Stuff" on the next line.

Any good idea (or nice way to deal with long labels) would be nice.

share|improve this question
2  
The itemize syntax is \item[<optional bullet character>] <item text>, the square brackets aren't meant to contain the label, but merely the bullet (which is a circle by default, but you could use something like $\rightarrow$ if you felt like it). In fact, the itemize environment doesn't cater for labels. Could you describe in a bit more detail what you're trying to achieve? Maybe the description environment is suited better for your task, as it typesets the label differently from the <item text>. –  Jake Apr 13 '12 at 5:41
    
You might be interested in the description environment. –  Werner Apr 13 '12 at 5:45
    
If you want to split the label over a few lines you could have use \item[\begin{minipage}{2cm} long ugly displaying label \end{minipage}] stuff. It doesn't look good, though... –  Vivi Apr 13 '12 at 7:13
    
@Jake description is really nice! Always more things in LaTeX to discover. There is only one thing missing, if there is not Stuff after item, how can I make the subitem start in a new line (under the label)? And it would make a good answer I think :). –  Zenon Apr 13 '12 at 15:57
    
@Zenon: Do you want the subitem to have a leading bullet, or a bold label, or just the text? –  Jake Apr 13 '12 at 16:06
show 2 more comments

1 Answer 1

up vote 4 down vote accepted

You can make it as ugly as you want by redefining the itemize lists. The labels are defined in a series of commands \labelitemi...\labelitemiv, which you can redefine.

\documentclass{article}
\begin{document}
\renewcommand\labelitemi{\textbullet\textbullet \bfseries and other ugly stuff}
\renewcommand\labelitemii{\normalfont\bfseries \textendash more ugly stuff}
\renewcommand\labelitemiii{\textasteriskcentered}
\renewcommand\labelitemiv{\textperiodcentered}
\begin{itemize}
\item First
\item second
      \begin{itemize}
        \item Ugly stuff.
      \end{itemize}
\end{itemize}
\end{document}

This will produce:

enter image description here

More fancy styling is possible via redefining the makelabel command and a suitable list environment as shown in the MWE below.

\documentclass{article}
\usepackage{lipsum}
\begin{document}
\renewcommand\labelitemi{\textbullet\textbullet \bfseries and other ugly stuff}
\renewcommand\labelitemii{\normalfont\bfseries \textendash more ugly stuff}
\renewcommand\labelitemiii{\textasteriskcentered}
\renewcommand\labelitemiv{\textperiodcentered}
\lipsum[1]
\makeatletter
\def\newitemizedenvironment#1#2{
\expandafter\def\csname#1\endcsname{%
 \ifnum \@itemdepth >\thr@@\@toodeep\else
 \advance\@itemdepth\@ne
 \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
 \expandafter
 \list
 \csname\@itemitem\endcsname
 {\def\makelabel####1{\hspace*{150pt}\hss\llap{####1}}}%
 \fi}
 \expandafter\let\csname end#1\endcsname=\endlist
}
\makeatother

\newitemizedenvironment{ugly}{}

\begin{ugly}
\item First
\item second
\end{ugly}

\end{document}

enter image description here

share|improve this answer
    
@Jake Thanks! Please see update. –  Yiannis Lazarides Apr 13 '12 at 6:39
    
Yup, much better. But wouldn't it be easier to just use \begin{itemize} \item[and other ugly stuff] First \end{itemize}, which will align the labels on the left out of the box? –  Jake Apr 13 '12 at 6:42
    
@Jake I have assumed that the OP wants some permanent text printed as a label. –  Yiannis Lazarides Apr 13 '12 at 7:42
    
Ah yeah, that could be. –  Jake Apr 13 '12 at 7:44
    
@YiannisLazarides this is great! But I don't want permanent labels ;). –  Zenon Apr 13 '12 at 15:59
add 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.