Is there a way to swallow one space (or more spaces) before a command? E.g.:
xxx \mycommand{}yyy
which results in
xxxyyy
Is there a way to swallow one space (or more spaces) before a command? E.g.:
xxx \mycommand{}yyy
which results in
xxxyyy
I think you're looking for \unskip.
LaTeX version:
\documentclass{article}
\begin{document}
xxx \unskip{}yyy
\end{document}
Plain-TeX version:
xxx \unskip{}yyy
\bye
The output of both documents is "xxxyyy".
\unskipworks on "glue" in both "horizontal mode" and "vertical mode". However,\unskipdoes not work on items (including vertical-mode glue) once they're added to the "main vertical list" on a page. (Warning: Some serious TeX jargon is being thrown about right now!) See this answer for more information. – Mico Jul 31 '20 at 15:03