paralist^{∗} Extended List Environments

Bernd Schandl

                          schandl@gmx.net

Printed on March 31, 2002

Abstract

This package provides some new list environments. Itemized and enumerated lists can be typeset within paragraphs, as paragraphs and in a compact version. Most environments have optional arguments to format the labels. Additionally, the L^{A}TEX environments itemize and enumerate can be extended to use a similar optional argument.

1 Introduction

In a posting to comp.text.tex in May 1998, someone asked about the possibility of an enumerated environment that (a) can be used within paragraphs, (b) takes care of enumeration and (c) has items that can be referenced. Another posting mentioned the package theapa as a possible solution. Now that I was looking for that kind of environment and found those old postings, I had a look at theapa and decided to take out the part about list environments and rewrite it a little bit.

Over time, compact versions of enumerate, itemize and description have been added and optional arguments for most environments make it possible to define a special way of formatting the labels.

2 Package Options

Certain parts of the package are only executed if appropriate options are specified. newitem/olditem With newitem (set by default), the L^{A}TEX environment

itemize will be redefined to have an optional argument to specify the format of the label. See Section 3. Specifying olditem will leave

     itemize as it is.

∗Package version v2.3b of 2002/03/18.

newenum/oldenum With newenum (set by default), the L^{A}TEX environment enumerate will be redefined to have an optional argument to specify the format of the label. See Section 3. Specifying oldenum will leave

enumerate as it is.

alwaysadjust The width of the labels of the environments compactenum, enumerate, compactitem and itemize is always adjusted to the actual label. For the default labels, this means that the label width is usually decreased.

neveradjust The width of the labels is never adjusted, not even for environments where you defined the labels manually using the optional argument. This option is ignored if option alwaysadjust is used as well.

neverdecrease If the width of the labels is adjusted, this option avoids the decrease of the width. Here is an example why this might make sense. If no … adjust option is specified, then the indentation of

the \item in \begin{enumerate} and \begin{enumerate}[1.] is

different although they have the same labels. defblank The two environments inparablank and asparablank will be de-

fined. See Section 5.4. pointlessenum The items in the enumerated environments are labeled and

referenced as in “1”, “1.1”, “1.1.1” and “1.1.1.1”. See also Section 3. pointedenum The items in the enumerated environments are labeled as in

“1.”, “1.1.”, “1.1.1.” and “1.1.1.1.” and referenced without the trailing point. See also Section 3. This option is ignored if pointlessenum is used.

flushright The labels in the four lists mentioned above are set flush right.

As this is the L^{A}TEX default, this is also the default for this package. flushleft The labels in the four lists mentioned above are set flush left. cfg The configuration file paralist.cfg is loaded if it exists. (default) nocfg The configuration file is not loaded. The option increaseonly is deprecated; use neverdecrease instead.

3 Formatting the Labels

All the itemized and enumerated environments have optional arguments to specify the format of the labels. The following examples will only work if you have loaded paralist without the options olditem and oldenum.

Using the L^{A}TEX standard classes, itemize uses the following symbols for the labels of the four list levels: • – ∗ ·. If you want to change this for a particular environment, just say something like

\begin{itemize}[$\star$]

and ⋆ will be used instead of the default symbol.

The optional argument of the enumerated environment is a little more complicated, but whoever has worked with David Carlisle’s enumerate package can skip the rest of the section since exactly the same mechanism (and almost the same code) is used.

The tokens A, a, I, i, and 1 can be used in the optional argument to produce the counter with one of the styles \Alph, \alph, \Roman, \roman and \arabic.^{1} These letters may be surrounded by any other string involving any other TEX expression. However, the tokens A a I i 1 must be inside a { } group if they should not be taken as special. A few examples follow.

   \begin{enumerate}[(i)]

produces the labels (i), (ii), (iii) …

   \begin{enumerate}[{example} a)]

produces example a), example b), example c) …

   \begin{enumerate}[{A}-1]

produces A-1, A-2, A-3 …

   \begin{enumerate}[\bfseries {Item} I]

produces Item I, Item II, Item III …

Note that in the last example [\textbf{Item I}] does not work because the special token I is inside a group.

The \ref command produces only the counter without the surrounding text, so in the examples above you would get i, a, 1 and I respectively if you referenced the first item.

\pointedenum There are also two package options and two corresponding macros to \pointlessenum format the labels and references of enumerated environments. The option

pointedenum and the macro \pointedenum format the labels as in “1.”, “1.1.”, “1.1.1.” and “1.1.1.1.” and the references without the trailing point. The option pointlessenum and the macro \pointlessenum do not use the trailing point in the labels either.

While the package options make a global change, the macros can be used for a local change or to define a special environment, for example

   \newenvironment{myenum}%
     {\pointedenum\begin{enumerate}}%
     {\end{enumerate}}

Note that \begin{enumerate} is used after \pointedenum, otherwise the optional argument of enumerate would not work (in case you want to use them within the same environment which doesn’t really make sense).

\paradescriptionlabel In the document classes, the label format for the description environ-

ment is defined as

   \newcommand*\descriptionlabel[1]{%
     \hspace\labelsep\normalfont\bfseries #1}.

This is also used by compactdesc. For the environments inparadesc and

asparadesc, there is a separate macro called \paradescriptionlabel de-

1The set of tokens can be extended. Look for \pl@hook in the code section.

fined (almost) like this:

   \newcommand*\paradescriptionlabel[1]{%
     \normalfont\bfseries #1}.

4 Defaults for Labels and Margins

If you want your lists labeled differently than the L^{A}TEX default throughout your document, it is a bit awkward to use the optional argument of the environments all the time. Therefore three macros are provided to define the labels and the left margins of the list environments.

Note that the macros defining the labels do not adapt the left margins of the list environments because this may have unexpected side effects. If you want that change, you have to explicitly use \setdefaultleftmargin.

If in any of the following three macros an argument is empty, then the according label or margin is left unchanged.

\setdefaultitem The default labels of itemized environments can be set by using the macro \setdefaultitem which needs four arguments. To get the L^{A}TEX default labels say

   \setdefaultitem{\textbullet}%
     {\normalfont\bfseries \textendash}%
     {\textasteriskcentered}{\textperiodcentered}

(which is of course silly because you don’t need to do anything if you want to stick with the default labels). If you want a triangle ( ▷) instead of the endash for level two just say

   \setdefaultitem{}{$\triangleright$}{}{}.

\setdefaultenum The labels of enumerated lists are formatted with \setdefaultenum using the mechanism described in Section 3. The L^{A}TEX default labels could be defined by

   \setdefaultenum{1.}{(a)}{i.}{A.}.

If you want capital Roman letters for level three, just say

   \setdefaultenum{}{}{I.}{}.
\setdefaultleftmargin  To change the left margin of the lists, use \setdefaultleftmargin.

The length \leftmargin n specifies the indentation of a list of level n with respect to the list of level n−1 or the surrounding text (if n = 1). The envi-

ronments that use \leftmargin n are (at least) enumerate, compactenum,

itemize and compactitem (maybe a few more that I am not aware of). The L^{A}TEX settings could be defined by

   \setdefaultleftmargin{2.5em}{2.2em}{1.87em}{1.7em}{1em}{1em}.

In twocolumn mode L^{A}TEX uses a smaller margin for the first, fifth and sixth level which could be defined by

   \setdefaultleftmargin{2em}{}{}{}{.5em}{.5em}.
   The macros \defaultitem, \defaultenum and \defaultleftmargin

should not be used anymore. They are only kept for backward compatibility with package versions < 2.1.

If some of your changes should appear in every document that uses paralist, put them in a file paralist.cfg which is read at the end of the package in case it exists (unless you specified the option nocfg).

5 New Environments

5.1 Enumerated Environments

asparaenum The environment asparaenum is an enumerated environment in which the

items are formatted as separate paragraphs.

As an example, we use asparaenum within this paragraph.

1. Every \item is basically set as a separate paragraph. The second line is not indented (this is a feature, not a bug).

2. The next \item looks like this and is labeled. The example was produced by the following piece of code:

   \begin{asparaenum}
     \item Every ...
     \item The next ... \label{pl1}
   \end{asparaenum}

By saying \ref{pl1} we get 2.

inparaenum The inparaenum environment formats an enumerated list within a para-

graph, just like the one in the introduction.

The example in the introduction was set by the following commands:

   ... of an enumerated environment that
   \begin{inparaenum}[(a)]
     \item can be used within paragraphs,
     \item takes care of enumeration and
     \item has items that can be referenced. \label{pl2}
   \end{inparaenum}
   Another posting mentioned ...

By saying \ref{pl2} we get c.

compactenum The compactenum environment is just a compact version of the standard enumerate environment. All the vertical skips are set to zero (actually they are adjustable, see Section 7).

5.2 Itemized Environments

asparaitem The asparaitem environment is very similar to asparaenum. It just uses symbols instead of enumerating the items. The environment has an optional argument which specifies the symbol. For an example see Section 6.

inparaitem Similar to inparaenum I added an environment inparaitem which also has an optional argument. I don’t really know why anybody would use it, but I added it because of symmetry.

compactitem The compactitem environment is again just a compact version of the standard itemize environment with all the vertical skips set to zero. So by using this environment

∘ you can save some space and

∘ specify the symbol.

∘ Let me add a longer item so that you can see that we have a different

indentation than in the asparaitem environment. The code of the example above is

   \begin{compactitem}[$\circ$]
     \item you can save some space and
     \item specify the symbol.
     \item Let me add ...
   \end{compactitem}

5.3 Descriptive Environments

asparadesc The asparadesc environment is again very similar to asparaenum. It just

uses the optional arument of \item as the “intro” for the paragraph.

inparaitem Again similar to inparaenum, I added an environment inparadesc.

Probably nobody would use it but I added it because of symmetry.

compactdesc The compactdesc environment is copied from the L^{A}TEX standard classes with all the vertical skips set to zero. By the way, does anybody know why description has to be defined by the document class and is not

defined in ltlists.dtx?

5.4 Blank Environments

Someone requested list environments that print their items as if there was no list. It seems that this makes entering structured data a little easier in LyX. Since not everybody needs these (odd) environments they are only defined if the package is loaded with the option defblank. The following two environments do not have optional arguments because there is no label to format.

asparablank Every item is formatted just as if it was a regular paragraph. If you want to use the optional argument of \item, you have to add some white space at the end because \labelsep is set to zero. Use something like

   \item[\textbullet\hspace{.5em}]

inparablank The items are set just as regular text. The “white space problem” mentioned in the last paragraph is handled automatically. If I didn’t tell you, you wouldn’t know that this paragraph is set using the following construction:

   ... are set

   \begin{inparablank}
     \item just as ...
     \item The ...
     \item is handled ...
   \end{inparablank}
   If I didn't ...

6 Nesting Environments

All the environments can be nested just as the standard list environments although the results might sometimes not be as expected. For example, it’s probably not a good idea to call another list environment within a inpara... environment, but why should anyone want to do this? The maximal nesting level is six (four of the same kind), just as for the L^{A}TEX environments.

This paragraph is

⋆ an example for the usage of asparaitem and its optional argument, ⋆ and a demonstration that (i) you can use inparaenum within

asparaitem and (ii) you can still reference it. The reference was in subitem (ii). The code of the last example is

   \begin{asparaitem}[$\star$]
     \item an example ...
     \item and a demonstration that
       \begin{inparaenum}[(i)]
         \item you can use ...
         \item can still ... \label{pl3}
       \end{inparaenum}
   \end{asparaitem}
   The reference was in subitem (\ref{pl3}).

7 Fine-Tuning

Ok, I already hear someone saying “Your compact lists are a nice idea, but I’d like to have it a little less compact.” Here is a solution. The following skips can be adjusted using \setlength and affect the spacing of the compact... environments. The names are chosen similar to the L^{A}TEX names, so I just copy the explanation from ltlists.dtx. \pltopsep: Space between first item and preceding paragraph. \plpartopsep: Extra space added to \topsep when environment starts a

new paragraph (is called in vmode). \plitemsep: Space between successive items. \plparsep: Space between paragraphs within an item – the \parskip for

this environment.

Actually, the two ...topsep skips are added before and after the list.

The default value for all of them is 0 pt. It is probably a good idea to define them depending on the font size if they are non-zero, i. e. using units such as ex or em.

8 Bugs and Wishes

No bugs … that I know of.

Well, there is actually one issue if you use the babel package with one of the options acadian, canadien, francais, frenchb or french (which all do essentially the same). Since it redefines the itemize environment at the \start{document}, the definition of itemize made by paralist is lost. There are three possible fixes:

1. Accept the itemize environment without optional argument. :( 2. Use \FrenchItemizeSpacingfalse after loading babel which will

avoid the redefinition of itemize by babel. :/

3. Figure out a way to combine the code in babel and paralist and send the solution to me. :)

Feel free to let me know about any problems, suggestions and wishes you have concerning this package and its documentation. Praise is welcome, too ;-) The most recent version of this package can always be found on

CTAN or at http://schandl.gmxhome.de/paralist/.

9 Acknowledgments

I want to thank all the users who helped me with their comments finding bugs and extending the package. A big “Thank you” goes to David Carlisle, because there wouldn’t be any optional arguments for the enumerated environments without the code from his enumerate package. Some pieces of code of the inpara... environments are inspired by Mogens Lemvig Hansen’s shortlst package.