Skip to content

Commit

Permalink
Simplify \lastskip,\lastkern (suggested by D.Ginev)
Browse files Browse the repository at this point in the history
  • Loading branch information
brucemiller committed Oct 8, 2024
1 parent 2233d87 commit 780e57d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 2 additions & 6 deletions lib/LaTeXML/Engine/TeX_Glue.pool.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,8 @@ 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');
return $box->getProperty('width'); }
return Dimension(0); });
my $box = $LaTeXML::LIST[-1];
return ($box && $box->getProperty('isSkip') ? $box->getProperty('width') : Dimension(0)); });

#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1;
8 changes: 2 additions & 6 deletions lib/LaTeXML/Engine/TeX_Kern.pool.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,8 @@ 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');
return $box->getProperty('width'); }
return Dimension(0); });
my $box = $LaTeXML::LIST[-1];
return ($box && $box->getProperty('isKern') ? $box->getProperty('width') : Dimension(0)); });

#======================================================================
# Moving Vertically
Expand Down

0 comments on commit 780e57d

Please sign in to comment.