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

Feature request: greater transparency in LaTeX hooks such as begindocument/end #33

Open
cfr42 opened this issue Nov 29, 2024 · 0 comments

Comments

@cfr42
Copy link
Contributor

cfr42 commented Nov 29, 2024

It would be very nice if memoize et al could cooperate a little better with LaTeX in crucial places. I appreciate that LaTeX is only one of the formats supported, but in some cases the code already has to do something different for different formats.

For example,

-> The hook 'begindocument/end':
> Code chunks:
>     memoize -> \mmzset {begindocument/end}
>     csquotes -> \begingroup \makeatletter \endlinechar \m@ne \edef \csq@tempa
 {\noexpand \scantokens {\gdef \noexpand \csq@autopunct {\csq@autopunct }\gdef
\noexpand \csq@allpunct {\csq@allpunct }}}\csq@tempa \endgroup
>     biblatex -> \begingroup \makeatletter \endlinechar \m@ne \scantokens \exp
andafter {\expandafter \gdef \expandafter \blx@autopunct \expandafter {\blx@aut
opunct }}\endgroup
> Document-level (top-level) code (executed last):
>     ---
> Extra code for next invocation:
>     ---
> Rules:
>     ---
> Execution order:
>     memoize, csquotes, biblatex.
<recently read> }

l.127 \ShowHook{begindocument/end}

?

Obviously, memoize does something 'special' to utilise lthooks at all, so I'm wondering how easy it might or might not be to do something 'more special' and put the meaning of \mmzset{begindocument/end} into begindocument/end rather than \mmzset{begindocument/end} itself.

Note that memoize already does this for begindocument/before, for example. (So maybe there's something special about begindocument/end?)

-> The hook 'begindocument/before':
> Code chunks:
>     memoize -> \@ifclassloaded {beamer}{\mmzset {per overlay/.style={ /mmz/co
ntext={overlay=\csname beamer@overlaynumber\endcsname , pauses=\ifmemoizing \mm
zBeamerPauses \else \expandafter \the \csname c@beamerpauses\endcsname \fi }, /
mmz/at begin memoization={\xdef \mmzBeamerPauses {\the \c@beamerpauses }\xtoksa
pp \mmzCMemo {\noexpand \mmzSetBeamerOverlays {\mmzBeamerPauses }{\beamer@overl
aynumber }}\gtoksapp \mmzCCMemo {\only <\mmzBeamerOverlays >{}}}, /mmz/at end m
emoization={\xtoksapp \mmzCCMemo {\noexpand \setcounter {beamerpauses}{\the \c@
beamerpauses }}}, /mmz/per overlay/.code={}, }} \def \mmzSetBeamerOverlays ##1#
#2{\ifnum \c@beamerpauses =##1\relax \gdef \mmzBeamerOverlays {##2}\ifnum \beam
er@overlaynumber <##2\relax \mmz@temptrue \else \mmz@tempfalse \fi \else \mmz@t
emptrue \fi \ifmmz@temp \appto \mmzAtBeginMemoization {\gtoksapp \mmzCMemo {\mm
zSetBeamerOverlays {##1}{##2}}}\fi }}{}\mmzset {begindocument/before}
>     prooftrees -> \@ifpackageloaded {memoize}{\__prooftrees_memoize:V \prooft
rees@enw }{}
...
> Document-level (top-level) code (executed last):
>     -> \cs_if_exist:NT \tag_stop:n {\cs_set:Npn \SuspendTagging ##1{\tag_stop
:n {##1}}\cs_set:Npn \ResumeTagging ##1{\tag_start:n {##1}}}
> Extra code for next invocation:
>     ---
> Rules:
>     ---
> Execution order:
>     memoize, prooftrees, babel, csquotes, nfssext-cfr, biblatex.
<recently read> }

l.127 \ShowHook{begindocument/before}

?
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

No branches or pull requests

1 participant