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 inserted a "cross" (\ding{55}) from package pifont in a text but I can't insert a space after it, Latex ignores the space from the source code. Does anyone have a suggestion?

Edit:

There was some missing information. I'm using \newcommand. Here is a * not * working example ;)

\documentclass{article}
\usepackage{pifont}
\newcommand{\cross}{\ding{55}}
\begin{document}
\cross a

\cross. a

\cross . a
\end{document}
share|improve this question
1  
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. –  Joseph Wright Sep 22 '11 at 19:04
3  
This has nothing to do with pifont, but rather with the general problem of spaces after commands. –  egreg Sep 22 '11 at 20:28
add comment

2 Answers

up vote 5 down vote accepted

EDIT

In relation to your edit use xspace

\documentclass{article}
\usepackage{pifont,xspace}
\newcommand{\cross}{\ding{55}\xspace}
\begin{document}
\cross a

\cross. a

\cross . a
\end{document}

Why don't you get any space?

This works well:

\documentclass{article}
\usepackage{pifont}
\begin{document}
\ding{55} a

\ding{55}. a

\ding{55} . a
\end{document}

enter image description here

share|improve this answer
    
You're right. The space should be there! I'll delete my answer while the OP answers your question. –  Gonzalo Medina Sep 22 '11 at 18:58
    
@GonzaloMedina: xspace was also my first try (see my revision) ;-) –  Marco Daniel Sep 22 '11 at 18:58
    
Unfortunately there was some important missing information. Please, see the edit. –  freitass Sep 22 '11 at 20:18
    
Great! Worked with \xspace. Thanks! –  freitass Sep 22 '11 at 20:29
add comment

The "problem" that you encountered with the space has nothing to do with pifont or any other package. In general, with any command, you have to tell TeX/LaTeX where the command has ended. If you have a character that cannot be part of a command (like the brackets, the numbers etc, unless you change their default \catcode), occurence of such a character would automatically tell TeX/LaTeX that the command has ended before this character. This happens in the example

\cross.A

But if you write

\cross A

then TeX/LaTeX does not know that the command has ended after you wrote "\cross". It goes forward, and sees a blank space, and then it knows that the command has ended. After that, there is no space, so it does not separate the cross and the letter A. If you write

{\cross} A

you will obtain a space. Or if you write

\cross{} A

that will also do. There is no need to use packages for such simple things.

share|improve this answer
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.