diff --git a/lib/LaTeXML/Engine/TeX_Glue.pool.ltxml b/lib/LaTeXML/Engine/TeX_Glue.pool.ltxml index 002e2940a..7e8223c06 100644 --- a/lib/LaTeXML/Engine/TeX_Glue.pool.ltxml +++ b/lib/LaTeXML/Engine/TeX_Glue.pool.ltxml @@ -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); }); diff --git a/lib/LaTeXML/Engine/TeX_Kern.pool.ltxml b/lib/LaTeXML/Engine/TeX_Kern.pool.ltxml index 296f27811..99428eab8 100644 --- a/lib/LaTeXML/Engine/TeX_Kern.pool.ltxml +++ b/lib/LaTeXML/Engine/TeX_Kern.pool.ltxml @@ -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); });