Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
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
add comment

1 Answer

up vote 8 down vote accepted

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.

share|improve this answer
    
Thank you very much :) –  Paulina R Jul 11 '11 at 22:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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