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

\AtBeginDocument documentation #1604

Open
jlaurens opened this issue Jan 2, 2025 · 2 comments
Open

\AtBeginDocument documentation #1604

jlaurens opened this issue Jan 2, 2025 · 2 comments
Assignees
Labels
bug (improve documentation) nothing really wrong but documentation could be better category base (latex) enhancement fixed in dev Fixed in development branch, not in stable release

Comments

@jlaurens
Copy link
Contributor

jlaurens commented Jan 2, 2025

Brief outline of the bug

The documentation of \AtBeginDocument is inaccurate. In particular, using \AtBeginDocument after \begin{document} is not allowed, contrary to \AddToHook{begindocument}.

Minimal example showing the bug

\RequirePackage{latexbug}       % <--should be always the first line (see CONTRIBUTING)!
\documentclass{article}
\begin{document}
\AtBeginDocument{FOO}
\AddToHook{begindocument}{BAR}
\end{document}

Log file (required) and possibly PDF file

This is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./trashme.tex
LaTeX2e <2024-06-01> patch level 1
L3 programming layer <2024-05-27>
(/usr/local/texlive/2024/texmf-dist/tex/latex/latexbug/latexbug.sty)
(/usr/local/texlive/2024/texmf-dist/tex/latex/base/article.cls
Document Class: article 2024/02/08 v1.4n Standard LaTeX document class
(/usr/local/texlive/2024/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def)
(./trashme.aux)

! LaTeX Error: Can be used only in preamble.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.6 \AtBeginDocument
                    {FOO}
? 

[1{/usr/local/texlive/2024/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./trashme.aux) )</usr/local/texlive/2024/texmf-dist/fonts/type1/public/amsfont
s/cm/cmr10.pfb>
Output written on trashme.pdf (1 page, 11980 bytes).
SyncTeX written on trashme.synctex.gz.
Transcript written on trashme.log.
@FrankMittelbach
Copy link
Member

Which documentation are you referring to?

@jlaurens
Copy link
Contributor Author

jlaurens commented Jan 2, 2025

lthooks-doc.pdf from texdoc lthooks

@FrankMittelbach FrankMittelbach self-assigned this Jan 2, 2025
@FrankMittelbach FrankMittelbach added enhancement category base (latex) bug (improve documentation) nothing really wrong but documentation could be better labels Jan 2, 2025
@github-project-automation github-project-automation bot moved this to Pool (unscheduled issues) in upcoming LaTeX2e releases Jan 2, 2025
FrankMittelbach added a commit that referenced this issue Jan 2, 2025
@FrankMittelbach FrankMittelbach moved this from Pool (unscheduled issues) to Done in dev in upcoming LaTeX2e releases Jan 3, 2025
@FrankMittelbach FrankMittelbach added this to the Release 2025 Spring milestone Jan 3, 2025
FrankMittelbach added a commit that referenced this issue Jan 3, 2025
* fix for #1604

* fix a test

* typo
@FrankMittelbach FrankMittelbach added fixed in dev Fixed in development branch, not in stable release and removed fixed in branch labels Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug (improve documentation) nothing really wrong but documentation could be better category base (latex) enhancement fixed in dev Fixed in development branch, not in stable release
Projects
Status: Done in dev
Development

No branches or pull requests

2 participants