
Este hilo del foroes exactamente lo que estoy buscando. Quiero que mi entorno de descripción produzca esto:
Label is long text
lab2 blalballalaa
label3 possible second rule
label four hello world
Alguien ofreció esto:
\newenvironment{mydescription}[1]
{\begin{list}{}%
{\renewcommand\makelabel[1]{##1:\hfill}%
\settowidth\labelwidth{\makelabel{#1}}%
\setlength\leftmargin{\labelwidth}
\addtolength\leftmargin{\labelsep}}}
{\end{list}}
Lo cual funciona muy bien (el parámetro es la etiqueta más larga), excepto que creo que enumitem
debería poder hacer esto. Desafortunadamente, la documentación me resulta extremadamente confusa. ¿Alguien podría mostrarme cómo lograr el mismo resultado enumitem
?
Respuesta1
Esta es una posibilidad:
\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}
Respuesta2
Una solución utilizando elscrextend
paquete (tomado deWikiLibros):
\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}