I use \textdegree C quite often, so I defined a new command like this
\newcommand{\tc}{\textdegree C}
The problem is that no space is printed, no matter how many spaces i
give after \tc. However, adding a space after 'C' means that a space is
printed at the end of a sentence before the point, which is no option
either.
Does anybody know how i can make a command that adds a space, depending
on whether it is followed by a point or not.
Thanks a lot,
Greetings, Jacco
Sent via Deja.com http://www.deja.com/
Before you buy.
Yes, you can.
\usepackage[xspace]
\newcommand{\tc}{\textdegree C\xspace}
HTH,
--
ben . de . rydt at pandora . be ------------------ your comments
http://users.pandora.be/bdr/ ------- inl. IPv6, Linux en Pandora
> I use \textdegree C quite often, so I defined a new command like this
>
> \newcommand{\tc}{\textdegree C}
>
> The problem is that no space is printed, no matter how many spaces i
> give after \tc.
Have you read the TeXbook or the LaTeX book? This is discussed there.
Most of the time, spaces are ignored after command tokens (you can set
up funny conditions by changing the default \catcode's where this
isn't true, but don't worry about that now).
To get a space after \foo, typing \foo\ gives you a space.
Alternatively, load the "xspace" package and use
\newcommand{\tc}{\texdegree C\xspace}
The \xspace macro attempts to "guess" whether you want a space or not
based on the following token. From what I remember, it works in many,
but not all, cases.
Jason
xspace package, in the standard latex distribution.
David
> \newcommand{\tc}{\textdegree C}
[wondering why nobody pointed this out]
\textcelsius % or \textcentigrade in older versions of textcomp.sty.
Happy TeXing!
--
Axel Reichert -- http://www.axel-reichert.de