enumitem icon indicating copy to clipboard operation
enumitem copied to clipboard

Added an autowidest key

Open IsaacOscar opened this issue 2 years ago • 0 comments

This adds the feature request by #3 . I based my code of the answer here https://tex.stackexchange.com/a/547398.

Bassically the idea is that you use a new autowidest key instead of widest=<string>, and it works out the <string> for you by using two LaTeX runs. Unfortunately this adds the eqparbox package as a dependency.

Here's a stupid example showing that unlike the stackexchange code above, my code will handle user suplied align and format keys, it also works with the usual =* option, instead of neading you change it to =! option.

\newcommand{\myformat}[1]{(#1)} % Put the label in parantheses
\SetLabelAlign{testy}{\hfil#1:} % A right aligned label with a : after it
\setlist[description]{labelsep = 0.5em, labelindent = 1em, leftmargin = *, align=testy, format=\myformat, autowidest}

\begin{description}
	\item[a label] some text\\
	more text
	\item[realy long label] some test\\
	more text
	\item[another label] some test\\
	more text
\end{description}

The above will roughly come out as:

         (a label): some text
                    more text
(realy long label): some test
                    more text
   (another label): some test
                    more text

Note: I delete an example use case in the manual for \EnumitemId since it is now redundant (autowidest is much better as it doesn't assume the last label is the widest).

IsaacOscar avatar Nov 07 '23 12:11 IsaacOscar