CERN Accelerating science

This website is no longer maintained. Its content may be obsolete. Please visit for current CERN information.

next up previous
Next: Font commands---an overview Up: LaTeXeAn Overview Previous: Manipulating Boxed Material

For hackers only: several optional arguments

What if we want to define a command or environment with, eg. two optional arguments? Suppose we want a list where we are able to specify not only the width of the label, but also whether the list should be ``dense'' or not, ie. we want a syntax like:


In this case we use a trick (and the packages calc and ifthen) and introduce a multiple-step definition. The example also shows how one can parameterize the various typographic parameters for the list so that they can be controlled more easily (eg. the alignment of the label, its font, and the width of the margin).

       \mbox{\Descriptionfont #1}\hfil}




[] #1 <1543>>

[normal] #} #1compact

Text before text before text before text before
  \item[First] This is the first item in the list.
  \item[Veryyy long] This is a veryyy long item.
  \item[] This is an empty item.

\begin{Description}[Veryyy long]

\begin{Description}[Veryyy long][compact] 

Janne Saarela
Wed May 17 14:38:58 METDST 1995