[OS X TeX] Question: adjusting spacing in the enumerate environment

Bruno Voisin bvoisin at mac.com
Sun Mar 20 04:23:43 EST 2005


Le 20 mars 05, à 05:16, Richard Seguin a écrit :

> I'm using this technique to adjust the item spacing in the enumerate 
> environment within the article class:
>
> \newcommand{\tighten}{\addtolength{\itemsep}{-9pt}}
>
> ....
>
> \begin{enumerate}\tighten
>
> ...
>
> \end{enumerate}
>
> No matter what I've tried though, I haven't been able to shrink the 
> space between the top list element and what precedes it so that it 
> looks like the enumerate environment in the amsart class. In the 
> amsart class, that spacing is identical to the spacing between the 
> list items.
>
> Has anyone else been able to do this successfully, and how did you do 
> it? Furthermore, is it better to approach this matter using a 
> renewenvironment?

Your approach is doomed, as the list parameters such as \itemsep must 
arise in the second argument of the list environment which the 
enumerate environment invokes internally. The enumerate environment is 
defined in latex.ltx, in macho TeX programming style mixing LaTeX and 
plain TeX (for example, \enumerate = \begin{enumerate} and 
\endenumerate = \end{enumerate}) and avoiding braces when not strictly 
necessary:

	\def\enumerate{%
	  \ifnum \@enumdepth >\thr@@\@toodeep\else
	    \advance\@enumdepth\@ne
	    \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
	      \expandafter
	      \list
	        \csname label\@enumctr\endcsname
	        {\usecounter\@enumctr\def\makelabel##1{\hss\llap{##1}}}%
	  \fi}
	\let\endenumerate =\endlist

I can't be of much help being at home with no (La)TeX manuals at hand, 
but I'll try to give some hints based on the files on my computer (not 
that I remember exactly what these files did!).

The list parameters can be changed for all lists, or on a per-list 
basis. For all lists, they are initialized by commands \@listi, 
\@listii, \@listiii, etc., where \@listi is for first level lists, 
\@listii for second-level lists (= lists within lists), etc.. These 
commands are defined in size*.clo files, such as size12.clo read when 
the [12pt] option is used:

	\def\@listi{\leftmargin\leftmargini
	            \parsep 5\p@  \@plus2.5\p@ \@minus\p@
	            \topsep 10\p@ \@plus4\p@   \@minus6\p@
	            \itemsep5\p@  \@plus2.5\p@ \@minus\p@}

They are initialized at \begin{document}, and also when some 
size-changing commands are called (still from size12.clo):

	\newcommand\small{%
	   \@setfontsize\small\@xipt{13.6}%
	   \abovedisplayskip 11\p@ \@plus3\p@ \@minus6\p@
	   \abovedisplayshortskip \z@ \@plus3\p@
	   \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@
	   \def\@listi{\leftmargin\leftmargini
	               \topsep 9\p@ \@plus3\p@ \@minus5\p@
	               \parsep 4.5\p@ \@plus2\p@ \@minus\p@
	               \itemsep \parsep}%
	   \belowdisplayskip \abovedisplayskip
	}

They are executed each time a list environment is called.

For example, \begin{document} initializes \@listi; this \@listi is 
executed each time \begin{enumerate} is used, initializing then \parsep 
etc. Once within a list, ie after \begin{enumerate}, the parameters 
such as \parsep can't be changed any longer.

Hence, one way to change the lists parameters for all lists is to 
redefine the the relevant list parameters in \@listi etc. You may 
either put the redefinition in your document's preamble, wrapped inside 
\AtBeginDocument, or at any point inside your LaTeX's document, for 
example after a size-changing command. For example, one document I 
wrote contains in the preamble:

	\makeatletter
	\AtBeginDocument{%
	  \renewcommand{\@listi}
	    {\setlength{\leftmargin}{\leftmargini}
	     \setlength{\topsep} {0pt}
	     \setlength{\parsep} {\parskip}
	     \setlength{\itemsep}{0pt}}
	  \renewcommand{\@listii}
	    {\setlength{\leftmargin}{\leftmarginii}
	     \setlength{\labelwidth}{\leftmarginii}
	     \addtolength{\labelwidth}{-\labelsep}}
	  \renewcommand{\@listiii}
	    {\setlength{\leftmargin}{\leftmarginiii}
	     \setlength{\labelwidth}{\leftmarginiii}
	     \addtolength{\labelwidth}{-\labelsep}}}
	\makeatother

while another contains in the main text:

	{
	\raggedright\footnotesize
	\setlength{\parskip}{0pt}
	\setlength{\partopsep}{0pt}
	\setlength{\topsep}{\smallskipamount}
	\setlength{\leftmargini}{1.5em}
	\setlength{\leftmarginii}{1.5em}
	\setlength{\labelsep}{.3em}
	\makeatletter
	\@setfontsize{\footnotesize}{10.98}{12}
	\renewcommand{\@listi}
	  {\setlength{\leftmargin}{\leftmargini}
	   \setlength{\parsep}{0pt}
	   \setlength{\topsep}{\smallskipamount}
	   \setlength{\itemsep}{\smallskipamount}}
	\renewcommand{\@listii}
	  {\setlength{\leftmargin}{\leftmarginii}
	   \setlength{\labelwidth}{\leftmarginii}
	   \addtolength{\labelwidth}{-\labelsep}
	   \setlength{\topsep}{\smallskipamount}
	   \setlength{\parsep}{0pt}
	   \setlength{\itemsep}{\smallskipamount}}
	\makeatother

The second way to proceed is to redefine the list-calling environment, 
in your case enumerate. The list environment has the syntax:

	\begin{list}{<1st argument>}{<2nd argument>}
	\item ...
	\end{list}

The first argument defines the label in front of each item, and the 
second argument contains formatting information such as \itemsep, as 
well as selection of the counter used. Hence, you may want to paste the 
above definition of \enumerate, preceded by \makeatletter and followed 
by \makeatother, inside your document's preamble, and insert inside the 
second argument:

	{\usecounter\@enumctr\def\makelabel##1{\hss\llap{##1}}}%
       ^

the redefinition of the list metrics parameters. For example, I once 
used a custom thebibliography environment in author-year style (with 
hanging indentation), taking the bibliography title as its argument, 
defined as:

	\renewenvironment{thebibliography}[1]
	  {\subsection*{\centering\normalfont\footnotesize\MakeUppercase{#1}}
	   \footnotesize
	   \begin{list}{}{\setlength{\leftmargin}{\bibindent}
	                  \setlength{\itemindent}{-\leftmargin}
	                  \setlength{\itemsep}{0pt}
	                  \setlength{\parsep}{\smallskipamount}
	                  \usecounter{enumiv}\renewcommand{\theenumiv}{}}
	   \sloppy\clubpenalty4000\widowpenalty4000\frenchspacing}
	  {\end{list}}

And I used a custom CV-style list defined as

	\newcommand{\cvlabel}[1]{\mbox{#1}\hfill}
	\newenvironment{cvlist}[1]
	  {\begin{list}{}%
	     {\renewcommand{\makelabel}{\cvlabel}
	      \setlength{\leftmargin}{#1}\setlength{\labelsep}{0pt}
	      \setlength{\labelwidth}{#1}\setlength{\parsep}{0pt}}}
	  {\end{list}}
	\newenvironment{cvsublist}
	  {\setlength{\leftmarginii}{1.5em}\setlength{\labelsep}{.3em}
	   \begin{itemize}}
	  {\end{itemize}}

and used as:

	\begin{cvlist}{21mm}
	  \item[1981--1983]
	    \emph{Lycée Chaptal (Paris)}
	  \begin{cvsublist}
	    \item Mathématiques supérieures (1982)

	    \item Mathématiques spéciales (1983)
	  \end{cvsublist}
	\end{cvlist}

Sorry to not being able to be more helpful regarding your specific 
problem. Ideally, the LaTeX Companion is the place where such questions 
are answered.

Bruno Voisin
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the MacOSX-TeX mailing list