Closed tobiasBora closed 10 months ago
\labelsep
is initially .5em in standard document classes.
Example below uses
\expanded{\noexpand\setlist[itemize]{labelsep=\the\labelsep}}
to give labelsep
a default value.
Note this is different from setting labelsep=.5em
, since em is a relative unit, but here we just need the exact length of .5em at the time of loading document class.
```tex \documentclass{article} \usepackage{enumitem} \setlist{nosep} % for tighter output \setlist[itemize]{label={\texttt{+}}} % pass curent value of \labelsep to "labelsep" key \expanded{\noexpand\setlist[itemize]{labelsep=\the\labelsep}} \begin{document} \begin{itemize} \item A \item A \begin{enumerate} \item default \texttt{labelsep} \item K \begin{itemize} \item Z \item P \end{itemize} \end{enumerate} \item A \begin{enumerate}[labelsep=0pt] \item local, zero \texttt{labelsep} \item K \begin{itemize} \item Z \item P \end{itemize} \end{enumerate} \end{itemize} \end{document} ```
Thanks a lot. But I guess there are many other properties one might want to preserve no? (like nosep
would certainly modify other lengths) Is there a way to reset them all to their default value?
enumitem
v3.9 (2019/06/20) doesn't have such feature.
Below is an attempt that caches values of all but \leftmargin
list parameters used by LaTeX2e kernel as default value sets, by typesetting three list envs with all nesting levels supported by LaTeX2e kernel in hook begindocument
(affected by \setlist
used in preamble), and restore default values at beginning of such list envs, after \@list<roman-nesting-level>
but before enumitem
global (set by \setlist
) and local (passed as env opt-arg) settings are applied.
Currently the restoration is unconditional. To provide a new option as trigger, enumitem
needs to support selective key setting in some sort.
```tex
\documentclass[twocolumn]{article}
\usepackage{enumitem}
\usepackage{xpatch}
\makeatletter
% store defaults in \cs{enit@
Thanks a lot! Would be great to have a key to enable this reset!
You could try it yourself first.
The behavior of labelsep
is explained in the manual. I have no plans to add new features in this regard, sorry.
If I have a nested list (enumitem-based) like:
the nested list will take the value of the parent, giving weird results like:
(see how Z/P are close to the label)
Is it possible to "isolate" the setting to a single list? I guess I could manually write all parameters, in the definition of
itemize
, but I don't know what are the default values, nor what is the list of all values to set (and it seems a bit dirty).MWE