Beschreibungsliste mit ausgerichteten Beschreibungen

Beschreibungsliste mit ausgerichteten Beschreibungen

Dieser Forenthreadist genau das, was ich suche. Ich möchte, dass meine Beschreibungsumgebung Folgendes erzeugt:

Label is long   text 
lab2            blalballalaa
label3          possible second rule
label four      hello world

Jemand hat Folgendes angeboten:

\newenvironment{mydescription}[1]                                                
  {\begin{list}{}%
   {\renewcommand\makelabel[1]{##1:\hfill}%
   \settowidth\labelwidth{\makelabel{#1}}%
   \setlength\leftmargin{\labelwidth}
   \addtolength\leftmargin{\labelsep}}}
  {\end{list}}

Das funktioniert großartig (der Parameter ist das längste Label), aber ich denke, das enumitemsollte möglich sein. Leider ist die Dokumentation dazu für mich äußerst verwirrend. Könnte mir jemand zeigen, wie ich mit dasselbe Ergebnis erreiche enumitem?

Antwort1

Dies ist eine Möglichkeit:

\documentclass{article}  
\usepackage{calc}  
\usepackage{enumitem}  

\begin{document}

\begin{description}[leftmargin=!,labelwidth=\widthof{\bfseries The longest label}]
  \item[The longest label] text
  \item[Short]  long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long text
\end{description}

\end{document}

Bildbeschreibung hier eingeben

Antwort2

Eine Lösung mit demscrextendPaket (entnommen ausWikiBooks):

\documentclass[twocolumn]{article}
\usepackage{scrextend}
\begin{document}
\begin{labeling}{alligator}  % alligator is the longest label
    \item [\textbf{ant}]really busy all the time
    \item [chimp] likes bananas
    \item [alligator] very dangerous animal, sharp teeth, long
     muscular tail and a bit of text that is longer than one
     line and shows the alignment of text quite nicely
\end{labeling}
\end{document}

Bildbeschreibung hier eingeben

verwandte Informationen