Repository navigation
\resizebox* printed its arguments, and \rule's lift had both signs backwards - #409
Merged
Merged
Conversation
The star is the whole difference between the two forms, and it is one word of
graphics.sty:539-541:
\protected\def\resizebox{%
\leavevmode
\@ifstar{\Gscale@@box\totalheight}{\Gscale@@box\height}}
\resizebox sizes the box by its HEIGHT above the baseline, \resizebox* by its
TOTAL height, depth included. Everything else is shared.
The star was never consumed, so neither dimension parsed and the source reached
the page as text. `Y\resizebox*{30mm}{!}{CONTENU}Y` set
Y*30mm!CONTENUY
with the content unscaled. One corpus paper wraps every one of its four figures
this way and printed "*45mm!", "*100mm!" and "*65mm!" into them, each around a
tikzpicture that then went unscaled.
20 of the 154 corpus papers use \resizebox, 111 times, 4 of them starred.
Co-Authored-By: Claude Opus 5 <[email protected]>
The lift of \rule[lift]{width}{height} moves the rule ACROSS the baseline; it does
not make it taller. latex.ltx:11900-11907 says which dimension takes it:
\def\@rule[#1]#2#3{%
\leavevmode
\hbox{%
\setlength\@tempdima{#1}% lift
\setlength\@tempdimb{#2}% width
\setlength\@tempdimc{#3}% height
\advance\@tempdimc\@tempdima
\vrule\@width\@tempdimb\@height\@tempdimc\@Depth-\@tempdima}}
so height = #3 + lift and depth = -lift. Both signs were the wrong way round here.
Asked directly, tectonic answers:
\rule[2pt]{3pt}{6pt} ht=8.0pt dp=0.0pt
\rule[-2pt]{3pt}{6pt} ht=4.0pt dp=2.0pt
\rule{3pt}{6pt} ht=6.0pt dp=0.0pt
and this engine now answers the same three. Before, a negative lift — the only
kind that does anything visible — was ADDED to the height and asked for a negative
depth the packer clamped to zero: \rule[-2mm]{3mm}{6mm} packed 8mm tall and 0mm
deep. One corpus paper writes \rule[-\textheight/2]{1ex}{\textheight}, meant to
straddle the baseline by half a page each way; it packed one and a half pages
above it. 4 of the 154 papers use a non-zero lift, 21 times.
A lift of zero, which is what \rule{w}{h} supplies, is unaffected either way, so
nothing else in the corpus moves.
TestRuleLift demanded the inversion outright — height 4pt and depth 2pt for a
+2pt lift — and so pinned it in place. It now asks tectonic's answer, and checks
the enclosing hbox clamps the negative depth the way TeX's hpack does (tex.web
§649).
Co-Authored-By: Claude Opus 5 <[email protected]>
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.
Two box defects, both found by reading the package source and both settled by
asking tectonic.
1.
\resizebox*printed its own arguments onto the pageThe star is the whole difference between the two forms, and it is one word of
graphics.sty:539-541:\resizeboxsizes the box by its height above the baseline;\resizebox*byits total height, depth included. Everything else is shared.
The star was never consumed, so neither dimension parsed and the source reached
the page as text:
with the content unscaled. One corpus paper wraps every one of its four figures
this way and printed
*45mm!and*65mm!into them, each around atikzpicturethat then went unscaled.20 of the 154 corpus papers use
\resizebox, 111 times, 4 of them starred.2.
\rule's lift was added to its height instead of crossing the baselineThe lift moves the rule across the baseline; it does not make it taller.
latex.ltx:11900-11907:so height =
#3 + liftand depth =-lift. Both signs were the wrong wayround. Asked directly, tectonic answers — and this engine now answers the same
three:
\ht\dp\rule[2pt]{3pt}{6pt}\rule[-2pt]{3pt}{6pt}\rule{3pt}{6pt}Before, a negative lift — the only kind that does anything visible — was added
to the height and asked for a negative depth the packer clamped to zero:
\rule[-2mm]{3mm}{6mm}packed 8mm tall and 0mm deep. One corpus paper writes\rule[-\textheight/2]{1ex}{\textheight}, meant to straddle the baseline by halfa page each way; it packed one and a half pages above it. 4 papers use a
non-zero lift, 21 times.
A lift of zero — what
\rule{w}{h}supplies — is unaffected either way, sonothing else moves.
A test was pinning the inversion
TestRuleLiftdemanded height 4pt and depth 2pt for a +2pt lift, which is theinversion stated as a requirement. It now asks tectonic's answer, and additionally
checks that the enclosing hbox clamps the negative depth the way TeX's
hpackdoes (tex.web §649).
Measured, 154-paper corpus
The −12 is not content: it is exactly
*45mm!(6) +*65mm!(6), the leakedsource no longer printed. Checked character by character on the paper concerned.
🤖 Generated with Claude Code