# I need a List environment with other indent and hang

I would like to make for formulas a listing, in which I can explain the meaning of the letters.
The following code shows how should it look like:

{\renewcommand{\arraystretch}{1.3}\tabcolsep0pt
\begin{tabularx}{\textwidth}{p{8mm} r p{4mm} X}
& ${{L_{{\text{10m}}}}}$ &&  die erweiterte Lebensdauer bei
90\% Erlebenswahrscheinlichkeit (in~Millionen Umdrehungen)   \\

& $L_\mathrm{10m1}$, $L_\mathrm{10m2}$, \dots &&  die anteilige erweiterte
Lebensdauer bei 90\% Erlebenswahrscheinlichkeit während der Betriebsbedingungen
\mbox{1, 2, \dots} (in~Millionen Umdrehungen) \\

& $U_1$, $U_2$, \ldots && Anteil am Gesamtlebenszyklus während der
Betriebsbedingungen \mbox{1, 2, \dots} (${U_1+U_2+ \ldots+U_n=1}$)
\end{tabularx}}


The characteristics of this contruct are the following:
1. there is an empty 8mm wide column at first. This is actually my mathindent (I use left aligned equations)
2. In the second column ist the formula in raggedright style
3. 4mm space, because \tabcolsep would set to zero. I set it, because I want the description text to run to the page border.
4. and at last the description

My only problem with this tabular, that it is unbreakable...
A listing environment like

    \begin{mydescription}
\item[$the formula$]  The explnaiton lorem ipsum
\end{mydescription}


doesn't seem to be complex, but I don't have the knowledge to create it.

So this is, where I need help (and it should work with memoir class (maybe it's important))

-
There are tabular-like environments which are breakable over pages, e.g. longtable and supertabular. Also a newer one is tabu. IIRC at least one of them is able to use tabularx's X column. –  Martin Scharrer May 25 '11 at 12:51

Here is a standard list that does the right thing

\documentclass[german]{article}
\usepackage{babel}
\usepackage{amsmath}
\usepackage{calc}

\newenvironment{mylist}[1]
{\begin{list}{}{%
\renewcommand\makelabel[1]{\hfil##1}%
\settowidth\labelwidth{\makelabel{#1}}%
\setlength\itemindent{0pt}%
\setlength\labelsep{4mm}%
\setlength\leftmargin{\labelwidth+\labelsep+8mm}}}%
{\end{list}}

\begin{document}
\noindent\hrulefill\par
\begin{mylist}{$L_\mathrm{10m1}$, $L_\mathrm{10m2}$, \dots}%% Widest element
\item[$L_{\text{10m}}$]
die erweiterte Lebensdauer bei 90\%
Erlebenswahrscheinlichkeit (in~Millionen Umdrehungen)

\item[$L_\mathrm{10m1}$, $L_\mathrm{10m2}$, \dots]
die anteilige erweiterte Lebensdauer bei 90\%
Erlebenswahrscheinlichkeit während der Betriebsbedingungen
\mbox{1, 2, \dots} (in~Millionen Umdrehungen)

\item[$U_1$, $U_2$, \ldots]
Anteil am Gesamtlebenszyklus während der Betriebsbedingungen
\mbox{1, 2, \dots} (${U_1+U_2+ \ldots+U_n=1}$)
\end{mylist}
\end{document}


Resulting in

-
I prefer the solution of Danie Els, because it allows linebreak till the tabular-like solutions allows them only at the end of the description. Thank's for the answer, Danie! –  Daniel Aug 1 '11 at 16:41

Martin suggests tabu, which might be an answer.

\usepackage{environ}

\makeatletter
\newdimen\desclen
\newcommand\@mylist[1]{\setbox0=\vbox{\tabskip=0pt
\let\\\cr
\halign{&##\cr#1\crcr}
\setbox2=\lastbox
\setbox2=\hbox{\unhbox2 \unskip
\setbox4=\lastbox
\unskip\global\setbox1=\lastbox}
\expandafter}\expandafter\desclen\the\wd\@ne
\begingroup\everycr={\noalign{\kern.3\baselineskip}}\def\\{\unskip\cr}
\kern-.3\baselineskip % one too much!
\halign{\kern8mm##\hfil&
\kern4mm\vtop{
\sloppy\hsize=\dimexpr\hsize-\desclen\relax
\noindent##}\cr
#1\crcr}
\kern-.3\baselineskip % one too much!
\endgroup
}
\newenvironment{mylist}
{\Collect@Body\@mylist\ignorespaces}{\ignorespacesafterend}
\makeatother


You'll input the list as

\begin{mylist}
$formula$ & description \\
$formula$ & description
\end{mylist}


# Tabu version

The version with tabu should be

\usepackage{longtable,tabu}
\newenvironment{mylist2}
{\renewcommand{\arraystretch}{1.3}%
\begin{longtabu} to\textwidth{@{}>{\kern8mm}l<{\kern4mm}@{}X@{}}}
{\end{longtabu}}


with input as before

\begin{mylist2}
$formula$ & description \\
$formula$ & description
\end{mylist2}


What to prefer? Of course the second one, but I like the "hand-made" one, as it shows how to compute a column width in an alignment with \halign; set the \halign in a \vbox and slice off its last row (it's important that it's complete, so one phantom row is added). This box contains, in this case, two \hbox's and glue; discard the second box and set a global box register to this box, so we can measure it. Then do a second \halign, this time knowing how wide must be the second column.