8

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?

4
  • I think leftmargin=* is smaller than the default. Also, why would you not want the rightmargin to be 0 (that is, to be flush with the right margin of the surrounding text)?
    – Seamus
    Jun 23 '11 at 13:41
  • 1: hm, what then is the default? 2: I want to see how it looks because I sometimes gets crazy about symmetry. If it is indented to the left I want to see if what happens if I do the same on the right. (Yea I know the eye follows the left margin easily when skimming but when looking at the whole page I like symmetry)
    – jonalv
    Jun 23 '11 at 13:45
  • 1: by experimenting, I've narrowed it down to about 2.5em or thereabouts. 2: I'm not sure symmetry is always a good idea. Do you set all your section headings centred as well?
    – Seamus
    Jun 23 '11 at 13:57
  • @Seamus: Actually no I don't set section headings centered. It's just that I have kep looking at those lists and thought that I wanted to try making them more symmetrical and see how it looks -- then of course sleep on it before going with it :)
    – jonalv
    Jun 23 '11 at 19:36
6

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!

2
  • 3
    Doing some tests, it seems that leftmargin* uses \widthof{0.} instead of \widthof{0} for labelwidth. I don't have much time now to verify this in the implementation of enumitem. Jun 23 '11 at 14:15
  • 3
    Right -- it uses the width of the whole label, not only the counter. Jun 24 '11 at 17:34
9

The default is kinda labelindent=*. In version 3.0 (to be released next week) it is labelindent=*. With the key before you can execute code just before the list begins, ie, after all keys have been processed. So, just write:

\setlist{leftmargin=*,before=\setlength{\rightmargin}{\leftmargin}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.