Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an autowidest key #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

IsaacOscar
Copy link

@IsaacOscar IsaacOscar commented Nov 7, 2023

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant