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

Cannot set leftmargin via \SetTemplateKeys{block}{display} #755

Open
mbertucci47 opened this issue Nov 3, 2024 · 5 comments
Open

Cannot set leftmargin via \SetTemplateKeys{block}{display} #755

mbertucci47 opened this issue Nov 3, 2024 · 5 comments
Labels
area: block environments documentation Improvements or additions to documentation

Comments

@mbertucci47
Copy link
Contributor

I am trying to implement margin setting for keytheorems with tagging enabled and ran into trouble overriding the block settings locally with \SetTemplateKeys. The following MWE shows the issue:

\DocumentMetadata
  {
    lang=en-US,
    pdfversion=2.0,
    pdfstandard=ua-2,
    testphase={phase-III,math,table,title,firstaid}
  }
\documentclass{article} 

\usepackage{kantlipsum}

\SetTemplateKeys{block}{display}{
  leftmargin=2cm, % does nothing
  rightmargin=2cm, % this works
  }

\begin{document}

\kant[1][1-2]
\kant[2][1-2]
\begin{enumerate}%[leftmargin=2cm] % this works
\item abc
\item \kant[1][1-2]
\kant[2][1-2]
\end{enumerate}
    
\end{document}

If leftmargin or rightmargin is set in the optional argument of enumerate then it works as expected. The same is true for rightmargin if set with \SetTemplateKeys{block}{display}. But leftmargin set in \SetTemplateKeys has no effect. It doesn't matter if this is executed in the preamble or right before the environment.

Am I trying to use this the wrong way? Or is this a bug in the block code? Even in the first case, it's odd that rightmargin does something while leftmargin does not.

@u-fischer
Copy link
Member

The block still calls the legacy commands, in this case \@listi and that contains
\leftmargin\leftmargini.

@mbertucci47
Copy link
Contributor Author

@u-fischer I see, thanks. I understand these interfaces are a work in progress. So is there any way to change the settings besides either passing the key directly to enumerate or redefining \@listi? I guess setting \leftmargini but that assumes I know the current listdepth is 1.

@FrankMittelbach
Copy link
Member

I think we have conflicting goals here. I think that the block implementation has to make use of the legacy list environments because they are all over the place in existing document classes and as long as those aren't updated (and many will not) this means that either we keep it (which allows for tagging even of those classes) or drop it (which means we rule out those as being usable going forward) without a full replacement of their code.

So my tendency is to just document this as a restriction.

@FrankMittelbach FrankMittelbach added area: block environments documentation Improvements or additions to documentation labels Nov 14, 2024
@mbertucci47
Copy link
Contributor Author

@FrankMittelbach I'm a little confused. Isn't the point of separating the block and list templates to remove any connection between them? At least for kernel commands where you have full control, shouldn't there be a trueblock or something that uses its own parameters completely separate from the list parameters?

@FrankMittelbach
Copy link
Member

@FrankMittelbach I'm a little confused. Isn't the point of separating the block and list templates to remove any connection between them? At least for kernel commands where you have full control, shouldn't there be a trueblock or something that uses its own parameters completely separate from the list parameters?

@mbertucci47 yes the idea is to separate both and for new classes that do not also implement \@listi and friends that would be the case (and the intention is to offer such classes eventually). However, the goal also is to make existing classes work evne if they do not get updated and that means honoring their \@listi settings somehow. That means you can't overwrite their settings as cleanly is you could otherwise but if we don't do that then their settings would be ignored which means tagging or no tagging would result in possibly severe layout differences.

Some of that behavior might eventually be controlled with something like compatibility={...} in \DocumentMetadata but we are not quite there yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: block environments documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants