I have a command that returns a different word according to a predefined value.
\def\isPaper{0}
...
\newcommand{\paper}{
\begingroup
\def\True{1}
\ifx\True\isPaper
paper
\else
thesis
\fi
\endgroup
}
But when I use it, I get an extra white spaces in the text:
throughout this \paper.
When I remove all formatting and indices and write the whole thing in one line, then the white spaces disappear.
\newcommand{\paper}{\begingroup\def\True{1}\ifx\True{\isPaper}paper{\else}thesis\fi\endgroup}
Is there a way to keep this command readable and not have the white spaces?
(this happens both when isPaper is 0 and 1)

%to hide the ends of lines, eg{%not{which is{SPACE– David Carlisle Oct 27 '23 at 21:32%at the ends of (at least) line 1, 3, 4, 5, and 7 of the definition. (But that will also mean that you will need to add an explicit space after the macro, i.e.\paper\since spaces are gobbled after a macro.) There are also much simpler ways to implement what you're doing here. – Alan Munn Oct 27 '23 at 21:34\newif\ifpaper,\papertrueor\paperfalse, and then\ifpaper paper\else thesis\fi. – Teepeemm Oct 27 '23 at 22:29\paperin the body or at most{\body}because of the space issue. – SIMEL Oct 28 '23 at 00:58\paperto be that conditional and use it the same way you're currently using it. Similarly with etoolbox. You can keep using\paper, but these give you much simpler implementations of your command. – Teepeemm Oct 28 '23 at 01:32\paperto be the conditional still leaves me with the space problem, which is the biggest flaw I see in my implementation. Thank you for your effort nonetheless. – SIMEL Oct 28 '23 at 01:42