# Multiline description-like environment

I'm trying to create following list(description)-like environment (unfortunately, I don't have any MWE yet...):

    'left' part        'counter'  'right' part

Some label textA   1.1.    Description of label textA
Some longer label textA           Description of longer label textA
Some label textB   1.2.    Description of label textB
Some longer label textB           Description of longer label textB


'Counter' is enumerate-like counter, left/right parts are multi-line texts (right/left aligned), where width of 'left' part is fixed. All texts are different and this environment are used many time in document.

I tryied to define such environment using enumitem package, but without much success ;(

Thank you very much in advance for any help or idea!

Best regards,

Lubos

• This is more like of a table with wrapping content of the cell than a description list, in my point of view – user31729 Mar 29 '17 at 13:24

You can do something along the following lines. The definitions below define an environment descenum and a command \descenumitem to be used like this:

\begin{descenum}
\descenumitem{...label1...}{...description1...}
\descenumitem{...label2...}{...description2...}
...
\end{descenum}


\newcounter{descenum}
\renewcommand\thedescenum{\arabic{section}.\arabic{descenum}}
\newlength\descenumwidth
\newenvironment{descenum}[1][0.3\linewidth]%
{\setcounter{descenum}{0}%
\setlength\descenumwidth{#1}%
\parindent0mm%
\medskip
}%
{}
\newcommand\descenumitem[2]%
{\refstepcounter{descenum}%
\par
\parbox[t]{\descenumwidth}{\raggedleft#1}%
\makebox[3em]{\thedescenum}%
\parbox[t]{\dimexpr\linewidth-\descenumwidth-3em}{#2}%
\bigskip
\par
}


The environment descenum has an optional argument that specifies the width of the left column. The default is 0.3\linewidth. You can also use \label to refer to the items in symbolic form.

\documentclass{article}
\newcounter{descenum}
\renewcommand\thedescenum{\arabic{section}.\arabic{descenum}}
\newlength\descenumwidth
\newenvironment{descenum}[1][0.3\linewidth]%
{\setcounter{descenum}{0}%
\setlength\descenumwidth{#1}%
\parindent0mm%
\medskip
}%
{}
\newcommand\descenumitem[2]%
{\refstepcounter{descenum}%
\par
\parbox[t]{\descenumwidth}{\raggedleft#1}%
\makebox[3em]{\thedescenum}%
\parbox[t]{\dimexpr\linewidth-\descenumwidth-3em}{#2}%
\bigskip
\par
}
\usepackage{lipsum}
\begin{document}
\section{First section}
\lipsum[2]
\begin{descenum}
\descenumitem
{Some label textA\\Some longer label textA%
\label{xxx}%
}%
{Description of label textA\\Description of longer label textA}
\descenumitem
{Some label textB\\Some longer label textB%
\label{yyy}%
}%
{Description of label textB\\Description of longer label textB}
\end{descenum}
\lipsum[2]
See items \ref{xxx} and \ref{yyy}.

\section{Second section}
\lipsum[2]
\begin{descenum}[0.4\linewidth]
\descenumitem
{Some label textA\\Some longer label textA}%
{Description of label textA\\Description of longer label textA}
\descenumitem
{Some label textB\\Some longer label textB}%
{Description of label textB\\Description of longer label textB}
\end{descenum}
\end{document}

• Many thanks for excellent reply. That's exactly what I'm looking for! – Luboš Kejzlar Mar 30 '17 at 7:51