¶\ignorespaces in LaTeX
2023-07-13
TIL more about \ignorespaces and \ignorespacesafterend in LaTeX. The former is useful when defining new commands to ensure that any whitespace that appears after each command invocation is ingored. The latter does the same thing for environments. This came up while working on my Strange Loop slides, when trying to switch from a custom environment to a custom command to render the evaluation of a simple example stack language. I had been using \ignorespacesafterend to get around some weird spacing issues with Beamer's \only command/environment, and was confused why that stopped working (bringing the weird spacing issues back) when I changed to using a custom command.
\ignorespaces & \ignorespacesafterend [Unoffical LaTeX2e reference manual]