[Tex/LaTex] Setting rightmargin = leftmargin with enumitem package

enumitemindentationlists

The default leftmargin when using the enumitem package seems to be leftmargin=*, is there a way I can get the rightmargin to be the same width? The most obvious way would be rightmargin=* but that does not work, neither does rightmargin=leftmargin so I am beginning to expect I need to use the same value which enumitem uses internally. The text Customizing lists with the enumitem package says that when using arabic numbers the default is 0 which I have taken to understand as the width of glyph 0. If that is so maybe it is possible to get that length somehow and use it or how can this be accomplished?

Best Answer

If the value of the rightmargin key is another length, this length must be specified including an escape character, i.e. rightmargin=\leftmargin.

EDIT: For whatever reason, this doesnt work with leftmargin=* added. It works, however, by emulating the calculations of leftmargin=* -- I used the calc package to do so conveniently.

\documentclass{article}

\usepackage[english]{babel}
\usepackage{blindtext}

\usepackage{calc}

\usepackage{enumitem}

% Variant A doesn't work
% \setlist{leftmargin=*,rightmargin=\leftmargin}

% Variant B works
\setlist{labelwidth=\widthof{0.},leftmargin={\labelwidth+\labelsep},rightmargin=\leftmargin}

\begin{document}

\blindtext

\begin{itemize}
\item\blindtext
\end{itemize}

\end{document}

EDIT: Corrected emulation of \leftmargin=*. Thanks to Gonzalo and Javier!