[Tugindia] numbered description environment
S. venkataraman
svenkat at ignou.ac.in
Wed Dec 17 05:49:14 CET 2003
> > Duvvuri> The above produces like this :
> >
> > Duvvuri> Text 1 : xyz dabbc
> > Duvvuri> Text 2 : abcdefgh
> > Duvvuri> Text 3 : some more text
> >
> > Duvvuri> I suppose it is not what required by Mr.
> Sivaram. He may
> > Duvvuri> want like this :
> >
> > Duvvuri> 1. ABCD some matter
> > Duvvuri> 2. EFGH some other matter
> > Duvvuri> 3. IJKL some more matter
>
> That's right. Normal numbering, "ABCD" in bold text,
> followed by normal text for description. Like I said
> earlier, instead of \textbf{} over the first phrase/word
> every item in the enumerate env. , a piece of letex code for
> a new env. which does that...
Hi,
This may be of help. I use my own version of description. Here is a
modified
version of it.
%Define a counter for numbering.
\newcounter{cmdescription}
%I use this part for modifying the list parameters
\newlength{\lmdescriptionlabelsep}
\setlength{\lmdescriptionlabelsep}{5pt}
\newlength{\lmdescriptiontopsep}
\setlength{\lmdescriptiontopsep}{0pt}
\newlength{\lmdescriptionlabelskip}
\setlength{\lmdescriptionlabelskip}{0pt}
\newcommand{\setmdescriptiontopsep}[1][0pt]{\setlength{\lmdescriptiontop
sep}{#1}}
\newcommand{\setmdescriptionlabelskip}[1][0pt]{\setlength{\lmdescription
labelskip}{#1}}
\newcommand{\setmdescriptionlabelsep}[1][5pt]{\setlength{\lmdescriptionl
abelsep}{#1}}
%end of the part for list parameter modification.
\newenvironment{mdescription}[1]{%
\begin{list}{\setcounter{cmdescription}{0}}{%
\settowidth{\labelwidth}{\textbf{#1}}
\setlength{\leftmargin}{\labelwidth}
\addtolength{\labelsep}{\lmdescriptionlabelsep}
\addtolength{\leftmargin}{\labelsep}
\setlength{\topsep}{\lmdescriptiontopsep}
\setlength{\parsep}{0.5ex plus0.2ex minus0.2ex}
\setlength{\itemsep}{0.3ex}
%the next line produces the list label
\renewcommand{\makelabel}[1]{\stepcounter{cmdescription}\arabic{cmdescri
ption}. \textbf{##1\hfill}}}}
{\end{list}}
The usage is
\begin{mdescription}{longest label}
\item{text1} blah blah blah
\item{text2}blah blah blah
\end{mdescription}
This is based on an example given in Kopka and Daley's latex manual in
the
section on customisation. Take a look at this manual.
Best of luck.
S. Venkataraman
More information about the tugindia
mailing list