Re: counters in list environments



%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}}

.



Relevant Pages

  • Re: counters in list environments
    ... %paralist package doesn't work well with great numbered lists using ... %pitemize environment was defined instead of old itemize environment of ... which informs the kind of the label. ...
    (comp.text.tex)
  • Re: counters in list environments
    ... %paralist package doesn't work well with great numbered lists using ... %pitemize environment was defined instead of old itemize environment of ... which informs the kind of the label. ...
    (comp.text.tex)
  • Re: parameters of itemized or numbered lists
    ... > and numbered lists. ... > of parameters, optional or mandatory, of the new itemize and enumerate ... The sample label must include *everything*, ... > environment. ...
    (comp.text.tex)
  • Re: Lists of Figures are consecutively numbered
    ... the format requires that the label not be printed next to the ... If you want three kinds of captions to number independently, ... you will get three separate lists. ... If all your SEQ fields have the same label, or you have not used SEQ fields ...
    (microsoft.public.mac.office.word)