Skip to content

Commit

Permalink
Simplify \lastskip,\lastkern (suggested by D.Ginev) (brucemiller#2424)
Browse files Browse the repository at this point in the history
* Simplify \lastskip,\lastkern (suggested by D.Ginev)

* Fix \lastskip,\lastkern by also skipping over any trailing Comment boxes
  • Loading branch information
brucemiller authored Oct 9, 2024
1 parent 2233d87 commit aba805b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/LaTeXML/Engine/TeX_Glue.pool.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,11 @@ DefPrimitiveI('\vfilneg', undef, undef);
#----------------------------------------------------------------------
# \lastskip iq is 0.0 pt or the last glue or muglue on the current list.
DefRegister('\lastskip' => Dimension(0), readonly => 1, getter => sub {
my $box;
for (my $i = $#LaTeXML::LIST ; $i > 0 ; $i--) {
my $box = $LaTeXML::LIST[$i];
last if !$box || !$box->getProperty('isSkip');
last if !$box;
next if ref $box eq 'LaTeXML::Core::Comment';
last if !$box->getProperty('isSkip');
return $box->getProperty('width'); }
return Dimension(0); });

Expand Down
5 changes: 3 additions & 2 deletions lib/LaTeXML/Engine/TeX_Kern.pool.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ DefPrimitiveI('\unkern', undef, sub {

# Get kern, if last on LIST
DefRegister('\lastkern' => Dimension(0), readonly => 1, getter => sub {
my $box;
for (my $i = $#LaTeXML::LIST ; $i > 0 ; $i--) {
my $box = $LaTeXML::LIST[$i];
last if !$box || !$box->getProperty('isKern');
last if !$box;
next if ref $box eq 'LaTeXML::Core::Comment';
last if !$box->getProperty('isKern');
return $box->getProperty('width'); }
return Dimension(0); });

Expand Down

0 comments on commit aba805b

Please sign in to comment.