The parameter labelsep
gives the distance between the label and the following text.
\documentclass{article}
\usepackage{showframe}
\usepackage{enumitem}
\usepackage{lipsum}
\pagestyle{empty}
\begin{document}
\begin{description}[labelsep=1em]
\item[first matter] \lipsum[1]
\item[some other matter] \lipsum[1]
\end{description}
\end{document}
Note how I use square brackets around the label content for description
. I think it is pretty standard that \quad
has a length of 1em
, but that may depend on the document class your using.
If you want to change how the labels and for each label are positioned you can use the parameters labelwidth
and labelindent
.
\chapter*{Lista de Simbolos}
\begin{description}[labelsep=4em, align=left, labelwidth=1in,labelindent=1cm]
\item[$b$] Taxa agregada de bits alcançável para o sistema
\item[$H(f)$] Espectro do canal
\item[$H_k$] Ganho do $k$-ésimo subcanal
\item[$P_x$] Potência total de transmissão
\item[$s_k$] Densidade espectral de potência do sinal no $k$-ésimo subcanal
\item[$Sx(f)$] Densidade espectral de potência do sinal na frequência contínua
\item[$Sn(f)$] Densidade espectral de potência do AWGN na frequência contínua
\item[$\text{SNR}_k$] Razão sinal-ruído no subcanal $k$
\item[$\mathbf{X}$] Vetor correspondente ao símbolo DMT
\item[$\mathbf{X}_+$] Vetor de subsímbolos dos tons positivos do símbolo DMT.
\item[$X_k$] Subsímbolo no $k$-ésimo tom do símbolo DMT
\item[$\Gamma$] \textsl{Gap} de SNR a capacidade
\item[$\Delta f$] Largura de banda do subcanal (espaçamento tonal).
\item[$\sigma_k$] Densidade espectral de potência do AWGN no $k$-ésimo subcanal
\end{description}
Here, the values I chose are rather dramatic. I'm sure you'll want something more conservative.
Some other points
Instead of writing \textsl[Gap]
you want to write \textsl{Gap}
. This is different from how \item
handles things. Basically, \textsl
has a mandatory argument that you pass to it through curly brackets. \item
, on the other hand, has an optional argument for overriding the label contents (which is what you want to do in a description
environment).
Also, I'm not sure how you're handling your font encoding, but you might want to put something like \usepackage[utf8]{inputenc}
in the preamble. However, I'm not really much of an authority on fonts, and don't necessarily know the best approach to take here.
Solution
Here is a solution that uses the eqparbox
package to measure item label widths.
It avoids some of the limitations of the solution described in Gonzalo Medina's answer (see the bottom of this post) because it doesn't typeset the entire list twice.
The trade-off is that it requires an additional compilation run because widths measured during one run will only become available for the next one.
You can declare a version of the description environment that does what you want by adding the following lines to your preamble.
(Only works for enumitem v3.7+, see below.)
%% Requires enumitem v3.7+
\newlist{mydescription}{description}{1} %% <- pick a larger number if you want to nest these
\setlist[mydescription]{
labelwidth=\eqboxwidth{listlabel@\EnumitemId},
leftmargin=!,
format=\mydescriptionlabel,
}
\newcommand\mydescriptionlabel[2][l]{\eqmakebox[listlabel@\EnumitemId][#1]{#2}}
What this does is put the description item labels in in \eqmakebox
es so that their widths are written to the aux file.
From the second run onwards, all such boxes in the same list will be given the same width (largest among them) and this width will be used as the list's labelwidth
.
If you're using a version of enumitem
that is older than v3.7 (which was released on 2019-01-04), you can still make this work by adding the following lines:
%% Only required for enumitem v3.6-
\usepackage{etoolbox} %% <- for \AtBeginEnvironment
\newcounter{mydescription}
\AtBeginEnvironment{mydescription}{%
\stepcounter{mydescription}%
\edef\EnumitemId{\arabic{mydescription}}%
}
(N.B. Using the before
key for this wouldn't work because the code would be run too late.)
Application to your MWE
Here is my solution applied to your MWE (version for enumitem
v3.7+).
\documentclass{article}
\usepackage{eqparbox}
\usepackage{enumitem}
\usepackage[margin=1em,papersize={4in,2.2in}]{geometry}
\newlist{mydescription}{description}{1} %% <- pick a larger number if you want to nest these
\setlist[mydescription]{
labelwidth=\eqboxwidth{listlabel@\EnumitemId},
leftmargin=!,
format=\mydescriptionlabel,
}
\newcommand\mydescriptionlabel[2][l]{\eqmakebox[listlabel@\EnumitemId][#1]{#2}}
\newcommand{\text}{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}
\begin{document}
\begin{mydescription}
\item[The longest label] text
\item[Short] \text
\end{mydescription}
\hrule
\begin{mydescription}
\item[Medium label] text
\item[Short] \text
\end{mydescription}
\end{document}
How this works
- I used
\newlist
instead of \newenvironment
to define the mydescription
environment and \setlist
to customise it.
You could of course also forego the \newlist
and modify the normal description
environment instead.
enumitem
s format
key is used to put every item label in your mydescription
environment in an \eqmakebox
.
All \eqmakebox
es with the same tag will be given the same dimensions (after the second run). They're centred by default, but I provided [l]
as an option to make them left-aligned.
- The tag used by this
\eqmakebox
includes \EnumitemId
, which is a unique identifier for the current list environment and is provided by enumitem
.
- The width of the widest such box for a given list is retrieved using
\eqboxwidth
and used as the labelwidth
for that list.
- The calculated horizontal length is
leftmargin
, as in your MWE.
The documentation for enumitem
and eqparbox
can be found here and here respectively
Notes
- If you want all such list environments in your document to use the same
labelwidth
you can simply remove both instances of \EnumitemId
in my code snippet.
- These can be nested safely if declared using
\newlist{mydescription}{description}{n}
for with n
greater than 1.
- To right-align, centre or stretch (multi-word only) your the labels,
\mydescriptionlabel
can be replaced by \mydescriptionlabel[r]
, \mydescriptionlabel[c]
or \mydescriptionlabel[s]
respectively.
- You can combine
\mydescriptionlabel
with other text formatting commands, but they should precede \mydescriptionlabel
and none of them should take an argument (so \itshape
is okay, but \textit
is not).
The item labels themselves are still typeset twice and assignments made within them will thus still be performed twice, which I feel is unlikely to be a problem.
This could be avoided, but not without making the preamble significantly longer.
The labels themselves are still typeset twice, and definitions in the labels will thus still be applied twice as well. This can be avoided but this is less likely to be a problem than typesetting the entire list twice.
- The labels are not allowed to contain anything you wouldn't be allowed to put in a
tabular
environment, but I don't think that's much of a restriction since I can't think anything not allowed in a tabular
that is allowed in an item label.
Comparison to the other solution
Gonzalo Medina's answer will work well in most circumstances, but it's a bit heavy-handed and has a few limitations:
\NewEnviron
has a few subtle problems and restrictions;
- display equations don't work inside lists defined this way;
- counters incremented from anywhere in the list will be incremented twice and the same goes for other global assignments made within the list environment;
- it won't work if the labels don't use boldface formatting;
- multiple such environments can't be nested.
Downsides of my answer:
- My solution requires an additional compilation run because the label widths measured during the first run are only available during the second.
Best Answer
If enumitem version 3 is not available, it's possible to use a solution provided in the LaTeX Companion: