\newminted defines its environment, and minted stays emulated - #227
Merged
Conversation
minted's \newminted{lang}{opts} is how a paper gets a code environment of its own —
\newminted{jl}{…} defines jlcode — and the engine had no such command. A paper that
ships minted.sty got the REAL package instead, whose environments are built through
fancyvrb's capture: their bodies then reached the page as TOKENS with the ordinary
category codes, so a lone $ in a code line opened maths and the scan ran past the
environment's own \end, eating the rest of the document.
Measured on 2405.10478, which writes \newminted{jl}{…} and then 28 jlcode blocks —
exactly one of them holding "path = \"$write_dir/therm_comp_MPI/\"":
before 15 pages, 36152 glyphs (0.48 of the reference's characters)
after 24 pages, 69606 glyphs (0.93)
tectonic 27 pages, 75018 characters
So minted joins the packages the engine does not load for real, next to listings:
its own implementation IS minted's draft-mode behaviour (verbatim, no Pygments, no
shell escape), and now covers \newminted, \newmintinline and \newmint — the derived
environment takes the language's name plus "code", or the optional argument when the
paper names it.
Over the 157 arXiv papers with a tectonic reference: page error 516 → 493, exact
24 → 26, within 1 page 66 → 68, within 2 pages 103 → 105.
Closes #225.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
minted's
\newminted{lang}{opts}is how a paper gets a code environment of its own —\newminted{jl}{…}definesjlcode— and the engine had no such command. A paperthat ships
minted.stytherefore got the real package, whose environments arebuilt through fancyvrb's capture: their bodies reached the page as tokens with
the ordinary category codes, so a lone
$in a code line opened maths and the scanran past the environment's own
\end, eating the rest of the document.That is #225, and this closes it.
2405.10478writes\newminted{jl}{…}and then 28jlcodeblocks, exactly one of which holdsWhat changed
mintedjoins the packages the engine does not load for real, besidelistings.Its own implementation is minted's draft-mode behaviour — verbatim, no Pygments,
no shell escape — and it now covers
\newminted,\newmintinlineand\newmint.The derived environment takes the language's name plus
code, or the optionalargument when the paper names it (
\newminted[julia]{jl}{…}).Measured over the 157 arXiv papers with a tectonic reference
Three tests: the derived environment and its lone
$, the optional name, and theinline sibling.
Closes #225.
🤖 Generated with Claude Code