10

I've got a command defined like this:

\newcommand{\abc}[1]{
 \ifthenelse{\equal{#1}{a}}{abca}{}
 \ifthenelse{\equal{#1}{b}}{abcb}{}
}

And later in my document I use it like this:

\abc{a}, following text

How can I reduce the space after the result of that command:

abca , following text

Thanks in advance for any piece of advice.

  • 2
    Side note: ifthen package is obsoleted, so in new code is better to use etoolbox's \ifstrequal or other nice commands defined there. – przemoc Jul 12 '11 at 0:50
12

Each end of line counts as a space (if not following a command name)

\newcommand{\abc}[1]{%
 \ifthenelse{\equal{#1}{a}}{abca}{}%
 \ifthenelse{\equal{#1}{b}}{abcb}{}%
}

One has always to be careful for spaces in definitions that typeset text.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.