Can anyone explain how to get rid of spaces that are automatically added around arguments provided in curly braces in the main part of a text? Here's a minimal example:
\documentclass{article}
\usepackage[normalem]{ulem}
\newcommand{\oldtext}[1]{}
% \newcommand{\oldtext}[1]{\sout{#1}}
\begin{document}
There is absolute no doubt {} {} {} {} that the difference between $x=3$ and $x=4$ shall
not be ignored. After all, $3$ and $4$ are different numbers.
So why in the world would \oldtext{anybody} \oldtext{somebody} anyone argue for that?
\end{document}
The result is:
As it can be seen, the repeated occurrences of "{}" add spaces. The "\oldtext" macro shows why this can be problematic in practice. It is used here to denote old text for which it should be possible to be made visible when needed later (by exchanging the definition of the oldtext macro). Of course, the last line of the main part of the text could be written as:
So why in the world would\oldtext{anybody}\oldtext{somebody} anyone argue for that?
but this is hard to read in the code, confuses the version control software, and would require to add a space inside the macro oldtext to avoid the old texts being stitched together, which is kind-of-ugly. Also, spaces before or after \oldtext can easily be overlooked during proof-reading of a document.
Ideally, I would like to replace the command "\newcommand{\oldtext}[1]{}" by some expression that behaves like "\relax" rather than "{\relax}".
{}
should provide for extra space, if not prevented by{\ignorespaces}
or as in Bordaigorl's answer with\@bsphack\@esphack
way.{}
does not add any space. The spaces are the explicit spaces in your source file.doubt {} that
has two spaces in the output for exactly the same reason thatdoubt ? that
has two spaces. The extra space is nothing to do with{}
two adjacent space characters produce a single space token in tex's scanner, and in neither case are there any adjacent spaces, while indoubt that
there are two adjacent space characters which are tokenised to a single space token.{}
as an (empty) word, so LaTeX processes it as needing separation from the surrounding words. Does this help? In factbla{}bla
does not insert any space between the twobla
s