Re: counters in list environments
- From: "Arthur Buchsbaum" <arthurbu@xxxxxxxxx>
- Date: 15 Nov 2005 20:45:48 -0800
%Paralists
%paralist package doesn't work well with great numbered lists using
roman labels. alwaysadjust option works well for numbered lists with
roman labels having at most seven items. neveradjust option either
doesn't work well with such lists, and generates itemized lists with
too wide left margins. So I am trying to solve this problem adjusting
the left margin for each generated list. As it is not possible to do it
with alwaysadjust option, it is necessary to call paralist package with
neveradjust option. As neveradjust option generates itemized list with
too wide margins, I had also to redefine itemize and compactitem
environments.
\usepackage{ifthen}
\usepackage[flushleft,neveradjust]{paralist}
\newlength{\lmargin}
\newsavebox{\itlabel}
\newsavebox{\nlabel}
\newcommand{\setleftmargin}[2]
{\ifthenelse{\equal{#1}{1}}{\setdefaultleftmargin{#2}{}{}{}{}{}}{}
\ifthenelse{\equal{#1}{2}}{\setdefaultleftmargin{}{#2}{}{}{}{}}{}
\ifthenelse{\equal{#1}{3}}{\setdefaultleftmargin{}{}{#2}{}{}{}}{}
\ifthenelse{\equal{#1}{4}}{\setdefaultleftmargin{}{}{}{#2}{}{}}{}
\ifthenelse{\equal{#1}{5}}{\setdefaultleftmargin{}{}{}{}{#2}{}}{}
\ifthenelse{\equal{#1}{6}}{\setdefaultleftmargin{}{}{}{}{}{#2}}{}}
\newcommand{\setitlabel}
{\ifthenelse{\equal{\@itemdepth}{1}}{\sbox{\itlabel}{\textbullet}}{}
\ifthenelse{\equal{\@itemdepth}{2}}{\sbox{\itlabel}{\textasteriskcentered}}{}
\ifthenelse{\equal{\@itemdepth}{3}}{\sbox{\itlabel}{\normalfont\bfseries\textendash}}{}
\ifthenelse{\equal{\@itemdepth}{4}}{\sbox{\itlabel}{\textperiodcentered}}{}}
\newcommand{\setnlabel}
{\ifthenelse{\equal{\@enumdepth}{1}}{\sbox{\nlabel}{(i)}}{}
\ifthenelse{\equal{\@enumdepth}{2}}{\sbox{\nlabel}{(a)}}{}
\ifthenelse{\equal{\@enumdepth}{3}}{\sbox{\nlabel}{I.}}{}
\ifthenelse{\equal{\@enumdepth}{4}}{\sbox{\nlabel}{A.}}{}}
%pitemize environment was defined instead of old itemize environment of
paralist, in order to obtain the correct margin under neveradjust
option of paralist. "pitemize" means "personalized itemize". It has
only one optional argument, which informs the kind of the label.
\newenvironment{pitemize}[1][]
{\ifthenelse{\equal{#1}{}}{\setitlabel}{\sbox{\itlabel}{#1}}
\settowidth{\lmargin}{\itlabel}
\addtolength{\lmargin}{\labelsep}
\setleftmargin{\@listdepth}{\lmargin}
\begin{itemize}[\itlabel]}
{\end{itemize}}
%pcompactitem environment was defined instead of old compact
environment of paralist, in order to obtain the correct margin under
neveradjust option of paralist. "pcompactitem" means "personalized
compactitem". It has only one optional argument, which informs the kind
of the label.
\newenvironment{pcompactitem}[1][]
{\ifthenelse{\equal{#1}{}}{\setitlabel}{\sbox{\itlabel}{#1}}
\settowidth{\lmargin}{\itlabel}
\addtolength{\lmargin}{\labelsep}
\setleftmargin{\@listdepth}{\lmargin}
\begin{compactitem}[\itlabel]}
{\end{compactitem}}
%penumerate environment was defined instead of old enumerate
environment of paralist. It has two arguments, the first one optional.
The first one informs the kind of the label, whereas the second one is
a string whose width informs the width of the greatest label of the
list to be generated. The left margin is the sum of the width of the
greatest label plus \labelsep. "pcompactitem" means "personalized
compactitem".
\newenvironment{penumerate}[2][]
{\ifthenelse{\equal{#1}{}}{\setnlabel}{\sbox{\nlabel}{#1}}
\settowidth{\lmargin}{#2}
\addtolength{\lmargin}{\labelsep}
\setleftmargin{\@listdepth}{\lmargin}
\begin{enumerate}[\nlabel]}
{\end{enumerate}}
%Finally, pcompactenum environment was defined instead of old
compactenum environment of paralist. It has two arguments, the first
one optional. The first one informs the kind of the label, whereas the
second one is a string whose width informs the width of the greatest
label of the list to be generated. The left margin is the sum of the
width of the greatest label plus \labelsep. "pcompactenum" means
"personalized compactenum".
\newenvironment{pcompactenum}[2][]
{\ifthenelse{\equal{#1}{}}{\setnlabel}{\sbox{\nlabel}{#1}}
\settowidth{\lmargin}{#2}
\addtolength{\lmargin}{\labelsep}
\setleftmargin{\@listdepth}{\lmargin}
\begin{compactenum}[\nlabel]}
{\end{compactenum}}
.
- Follow-Ups:
- Re: counters in list environments
- From: Arthur Buchsbaum
- Re: counters in list environments
- References:
- counters in list environments
- From: Arthur Buchsbaum
- Re: counters in list environments
- From: Gabriel Guernik
- Re: counters in list environments
- From: Arthur Buchsbaum
- Re: counters in list environments
- From: Dan
- Re: counters in list environments
- From: Arthur Buchsbaum
- Re: counters in list environments
- From: Arthur Buchsbaum
- counters in list environments
- Prev by Date: Re: counters in list environments
- Next by Date: Re: counters in list environments
- Previous by thread: Re: counters in list environments
- Next by thread: Re: counters in list environments
- Index(es):
Relevant Pages
|