💾 Archived View for dcreager.net › 2023 › 07 › 13-latex-ignorespaces.gmi captured on 2024-08-25 at 00:22:55. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-05-10)
-=-=-=-=-=-=-
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]