[tex-k] In TeX: The Program, section 88, interactively deleting outer macros can cause confusing errors

tttex at mailbox.org tttex at mailbox.org
Mon Mar 4 22:33:54 CET 2024


Hi,

Interactively deleting a control sequence token corresponding to an outer macro
while in a state that forbids outer macros, such as the replacement text of a
macro definition, can cause a confusing error message.

See for example the following run:

  This is TeX, Version 3.141592653
  **\outer\def\someoutermacro{}
  
  *\edef\a{\undefinedmacro\someoutermacro}
  ! Undefined control sequence.
  <*> \edef\a{\undefinedmacro
                             \someoutermacro}
  ? 1
  Runaway definition?
  ->
  ! Forbidden control sequence found while scanning definition of \a.
  <inserted text> 
                  }
  <to be read again> 
                     \someoutermacro 
  <*> \edef\a{\undefinedmacro\someoutermacro
                                            }
  ?

While it is of course correct that an outer macro is not allowed to appear
here, it is surprising that attempting to correct this mistake by deleting the
corresponding token before it is even read still causes an error message. Even
worse, the offending token is left on the input stack against the user's
intention.

A possible fix would be to temporarily set `scanner_status` to `normal` in
section 88 before deleting tokens and restoring it afterwards as is similarly
done for `align_state`.

Best regards,
Tyge


More information about the tex-k mailing list.