Skip to content

Fragments before document and expectations? #2227

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

Open
Omikhleia opened this issue Feb 14, 2025 · 1 comment
Open

Fragments before document and expectations? #2227

Omikhleia opened this issue Feb 14, 2025 · 1 comment
Labels
question Ask for advice or investigate solutions

Comments

@Omikhleia
Copy link
Member

Omikhleia commented Feb 14, 2025

A new user here had its \use and \begin{document} inverted.

In that case, it turns out that the packages don't even seem to be instantiated. (Just quickly checked, with a print in one of the packages init methods, which didn't show up)

The error message is not too helpful. Well, the fix is obvious...

... yet I think that the weird behavior comes from accepting "fragments" (i.e. documents not starting with a \begin{document}), but it's not clear to me if the resulting behavior was really expected 🐱 -- and it's at best confusing. I understand why accepting fragments (i.e. documents not starting with a "document" or "sile" tag) may have an interest in some workflows, but I'd then question what the intended behavior is, when this occur on the very first input fragment. Packages not being loaded at any point without warning is certainly unexpected.

@Omikhleia Omikhleia added the question Ask for advice or investigate solutions label Feb 14, 2025
@alerque
Copy link
Member

alerque commented Mar 22, 2025

Expected input:

\use[module=packages.color]
\begin{document}
\color[color=red]{Red}
\end{document}

Unexpected input, does not work, should probably give a helpful error:

\use[module=packages.color]
\begin{document}
\color[color=red]{Red}
\end{document}

Unexpected input, works, maybe should not:

\use[module=packages.color]
\color[color=red]{Red}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Ask for advice or investigate solutions
Projects
None yet
Development

No branches or pull requests

3 participants
@alerque @Omikhleia and others