Skip to content

Commit

Permalink
\let skips more spaces than documented (#2231)
Browse files Browse the repository at this point in the history
* \let skips more spaces than documented

* shorthanddef also has an implied skip of multiple spaces

* \font also has an implied space skip

* more space skips before an optional equal sign delimiter
  • Loading branch information
dginev authored Oct 13, 2023
1 parent f9080ec commit 91b5a4f
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions lib/LaTeXML/Package/TeX.pool.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@ sub lookupFontinfo {

# This should eventually actually load the font metrics,
# and tie-in to the FontMetrics data used by Font.
DefPrimitive('\font Token SkipMatch:= SkipSpaces TeXFileName', sub {
DefPrimitive('\font SkipSpaces Token SkipSpaces SkipMatch:= SkipSpaces TeXFileName', sub {
my ($stomach, $cs, $name) = @_;
my $gullet = $stomach->getGullet;
$name = ToString($name);
Expand Down Expand Up @@ -1400,7 +1400,7 @@ DefPrimitive('\divide Variable SkipKeyword:by Number', sub {

# <let assignment> = \futurelet <control sequence><token><token>
# | \let<control sequence><equals><one optional space><token>
DefPrimitive('\let Token SkipMatch:= Skip1Space Token', sub {
DefPrimitive('\let SkipSpaces Token SkipSpaces SkipMatch:= Skip1Space Token', sub {
my ($stomach, $token1, $token2) = @_;
Let($token1, $token2);
return; });
Expand Down Expand Up @@ -1430,19 +1430,19 @@ sub shorthandDef {
AfterAssignment();
return; }

DefPrimitive('\countdef Token SkipMatch:=', sub {
DefPrimitive('\countdef SkipSpaces Token SkipSpaces SkipMatch:=', sub {
shorthandDef($_[0], $_[1], '\count', Number(0)); });

DefPrimitive('\dimendef Token SkipMatch:=', sub {
DefPrimitive('\dimendef SkipSpaces Token SkipSpaces SkipMatch:=', sub {
shorthandDef($_[0], $_[1], '\dimen', Dimension(0)); });

DefPrimitive('\skipdef Token SkipMatch:=', sub {
DefPrimitive('\skipdef SkipSpaces Token SkipSpaces SkipMatch:=', sub {
shorthandDef($_[0], $_[1], '\skip', Glue(0)); });

DefPrimitive('\muskipdef Token SkipMatch:=', sub {
DefPrimitive('\muskipdef SkipSpaces Token SkipSpaces SkipMatch:=', sub {
shorthandDef($_[0], $_[1], '\muskip', MuGlue(0)); });

DefPrimitive('\toksdef Token SkipMatch:=', sub {
DefPrimitive('\toksdef SkipSpaces Token SkipSpaces SkipMatch:=', sub {
shorthandDef($_[0], $_[1], '\toks', Tokens()); });

# NOTE: Get all these handled as registers
Expand All @@ -1454,7 +1454,7 @@ DefPrimitive('\toksdef Token SkipMatch:=', sub {
DefRegister('\lastpenalty', Number(0), readonly => 1);

# \parshape !?!??
DefPrimitive('\parshape SkipMatch:= Number', sub {
DefPrimitive('\parshape SkipSpaces SkipMatch:= Number', sub {
my ($stomach, $n) = @_;
$n = $n->valueOf;
my $gullet = $stomach->getGullet;
Expand Down Expand Up @@ -1847,7 +1847,7 @@ DefPrimitive('\char Number', sub {

# Almost like a register (and \countdef), but different...
# (including the preassignment to \relax!)
DefPrimitive('\chardef Token SkipMatch:=', sub {
DefPrimitive('\chardef Token SkipSpaces SkipMatch:=', sub {
my ($stomach, $newcs) = @_;
$STATE->assignMeaning($newcs, $STATE->lookupMeaning(T_CS('\relax'))); # Let w/o AfterAssignment
my $value = $stomach->getGullet->readNumber();
Expand Down Expand Up @@ -1895,7 +1895,7 @@ DefConstructor('\delimiter Number',
return; });

# Almost like a register, but different...
DefPrimitive('\mathchardef Token SkipMatch:=', sub {
DefPrimitive('\mathchardef Token SkipSpaces SkipMatch:=', sub {
my ($stomach, $newcs) = @_;
$STATE->assignMeaning($newcs, $STATE->lookupMeaning(T_CS('\relax'))); # Let w/o AfterAssignment
my $value = $stomach->getGullet->readNumber();
Expand Down Expand Up @@ -1927,7 +1927,7 @@ DefConstructor('\mathaccent Number Digested',
DefPrimitive('\lastbox', sub { # Hopefully, the correct box got seen!
return pop(@LaTeXML::LIST); });

DefPrimitive('\setbox Number SkipMatch:=', sub {
DefPrimitive('\setbox Number SkipSpaces SkipMatch:=', sub {
my ($stomach) = @_;
no warnings 'recursion';
my $box = 'box' . $_[1]->valueOf;
Expand Down Expand Up @@ -2554,7 +2554,7 @@ DefPrimitive('\errmessage{}', sub {
return; });

# TeX I/O primitives
DefPrimitive('\openin Number SkipMatch:= SkipSpaces TeXFileName', sub {
DefPrimitive('\openin Number SkipSpaces SkipMatch:= SkipSpaces TeXFileName', sub {
my ($stomach, $port, $filename) = @_;
# possibly should close $port if it's already been opened?
$port = ToString($port);
Expand Down Expand Up @@ -2608,7 +2608,7 @@ DefConditional('\ifeof Number', sub {

# For output files, we'll write the data to a cached internal copy
# rather than to the actual file system.
DefPrimitive('\openout Number SkipMatch:= SkipSpaces TeXFileName', sub {
DefPrimitive('\openout Number SkipSpaces SkipMatch:= SkipSpaces TeXFileName', sub {
my ($stomach, $port, $filename) = @_;
$port = ToString($port);
$filename = ToString($filename);
Expand Down

0 comments on commit 91b5a4f

Please sign in to comment.