@@ -110,26 +110,26 @@ sub readingFromMouth {
110110 my $mouth ;
111111 my $intokens ;
112112 my $sourcetype = ref $source ;
113- if (! $sourcetype ) { # for a string, create Mouth to read its content
113+ if (!$sourcetype ) { # for a string, create Mouth to read its content
114114 $mouth = LaTeXML::Core::Mouth-> new($source ); }
115- elsif ($sourcetype =~ / ^LaTeXML::Core::Tokens?$ / ) { # Tokens will be unread into Mouth
116- $mouth = LaTeXML::Core::Mouth-> new();
115+ elsif ($sourcetype =~ / ^LaTeXML::Core::Tokens?$ / ) { # Tokens will be unread into Mouth
116+ $mouth = LaTeXML::Core::Mouth-> new();
117117 $intokens = $source ; }
118- elsif (! $source -> isa(' LaTeXML::Core::Mouth' )) {
119- Error(' expected' ,' Mouth' , $self ,
118+ elsif (!$source -> isa(' LaTeXML::Core::Mouth' )) {
119+ Error(' expected' , ' Mouth' , $self ,
120120 " Input source was not a string, Tokens or Mouth: $source ; ignoring it." );
121121 $mouth = LaTeXML::Core::Mouth-> new(); }
122122 else {
123123 $mouth = $source ; }
124- openMouth($self , $mouth , 1); # only allow mouth to be explicitly closed here.
125- $self -> unread($intokens ) if $intokens ; # Preload the mouth
124+ openMouth($self , $mouth , 1); # only allow mouth to be explicitly closed here.
125+ $self -> unread($intokens ) if $intokens ; # Preload the mouth
126126 my ($result , @result );
127127 if (wantarray ) {
128128 @result = &$closure ($self ); }
129129 else {
130130 $result = &$closure ($self ); }
131- $self -> skipSpaces; # Skip any remaining spaces on input.
132- # $mouth must still be open, with (at worst) empty autoclosable mouths in front of it
131+ $self -> skipSpaces; # Skip any remaining spaces on input.
132+ # $mouth must still be open, with (at worst) empty autoclosable mouths in front of it
133133 while (1) {
134134 if ($$self {mouth } eq $mouth ) {
135135 closeMouth($self , 1); last ; }
@@ -186,10 +186,10 @@ sub showUnexpected {
186186 my ($self ) = @_ ;
187187 my $message = " Input is empty" ;
188188 if (my $token = peekToken($self )) {
189- my @pb = @{ $$self {pushback } }[1.. -1];
189+ my @pb = @{ $$self {pushback } }[1 .. -1];
190190 $message = " Next token is " . Stringify($token )
191191 . " ( == " . Stringify($STATE -> lookupMeaning($token )) . " )"
192- . (@pb ? " more: " . ToString(TokensI(@pb )) : ' ' ); }
192+ . (@pb ? " more: " . ToString(TokensI(@pb )) : ' ' ); }
193193 return $message ; }
194194
195195sub show_pushback {
@@ -311,8 +311,10 @@ sub readToken {
311311 && (($atoken , $atype , $ahidden ) = isColumnEnd($self , $token ))) {
312312 handleTemplate($self , $LaTeXML::READING_ALIGNMENT , $token , $atype , $ahidden ); }
313313 elsif ((defined $token ) && ($$token [1] == CC_CS) && ($$token [0] eq ' \dont_expand' )) {
314- my $unexpanded = readToken($self ); # Replace next token with a special \relax
315- return T_CS(' \special_relax' ); }
314+ my $unexpanded = readToken($self ); # Replace next token with a special \relax
315+ my $special_relax = T_CS(' \special_relax' );
316+ $$special_relax [2] = $unexpanded ; # Smuggle the unexpanded token in the "meaning" slot of \special_relax
317+ return $special_relax ; }
316318 else {
317319 last ; } }
318320 if ($token ) {
@@ -328,7 +330,7 @@ sub readToken {
328330# This might be needed in more places?
329331sub peekToken {
330332 my ($self ) = @_ ;
331- local $LaTeXML::ALIGN_STATE = 1000000; # Inhibit readToken from processing {}!!!
333+ local $LaTeXML::ALIGN_STATE = 1000000; # Inhibit readToken from processing {}!!!
332334 if (my $token = readToken($self )) {
333335 unshift (@{ $$self {pushback } }, $token );
334336 return $token ; }
@@ -656,6 +658,8 @@ sub readUntil {
656658 push (@tokens , $token );
657659 $nbraces ++;
658660 push (@tokens , readBalanced($self )-> unlist, T_END); }
661+ elsif ($$token [2] && ($$token [0] eq ' \special_relax' ) && $$token [2]-> equals($want )) { # if it was a special relax,
662+ last ; }
659663 else {
660664 push (@tokens , $token ); } } }
661665 else {
@@ -734,7 +738,7 @@ sub readArg {
734738 else {
735739 if ($expanded ) {
736740 return $self -> readingFromMouth(Tokens(T_BEGIN, $token , T_END), sub {
737- readBalanced($self , $expanded , 0, 1); } ); }
741+ readBalanced($self , $expanded , 0, 1); }); }
738742 else {
739743 return Tokens($token ); } } }
740744
0 commit comments