Does LaTeX contain a supported construct for ignoring whitespace during macro definitions?
The default situation
By default, whitespace inside macro definitions is preserved just like everywhere else. As a consequence, any whitespace used for code structuring (primarily line breaks) must be commented out. An exception are lines ending with a \commandToken, as whitespace after these is ignored.
E.g. in example_a.tex below, in the macro definition without comments I obtain an output
[[ world. ComQuo.everyone! ]] while with comments the desired output
[[world.ComQuo.everyone!]] is obtained, at the cost of increased editing effort and reduced readability.
exampla_a.tex
\documentclass{article} \usepackage[a6paper,landscape,scale=0.9]{geometry} \begin{document} \newcommand\hello[1]{#1} \newcommand\CommandsQuoteSubsequentWhitespace{ComQuo.} \newcommand\MyMacroSpaces{ \hello{world}. \CommandsQuoteSubsequentWhitespace \hello{everyone}! } \newcommand\MyMacroComments{% \hello{world}.% \CommandsQuoteSubsequentWhitespace% \hello{everyone}!% } \ttfamily SPC[[\MyMacroSpaces]] (space wanted before) CMT[[\MyMacroComments]] (space wanted before) \end{document} 