Document Classes ⇒ xspace problem
xspace problem
I need to typeset the mark "Geant4" many times in a document. It is usually done in small caps so I made a newcommand shortcut:
\newcommand{\gf}{\textsc{Geant4}\xspace}
I use \xspace to allow a normal space behind the "Geant4". Without it I must use "{}"
However, xspace is giving problems. Geant4 is typeset correctly and is followed by a space but the first letter of the next word is removed. I have also tried
\newcommand{\gf}{\textsc{Geant}4\xspace}
but with the same problem in the output (using PdfLaTeX and mathpazo font).
I guess this problem is something to do with the use of a number at the end of the string since I have applied \xspace in other shortcuts (which don't use numbers) without this problem. Is there a way to avoid this?
Thanks
Jacob.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- Stefan Kottwitz
- Site Admin
- Posts: 10397
- Joined: Mon Mar 10, 2008 9:44 pm
xspace problem
when I tested your macro the result is as expected. I used this minimal example:
Code: Select all
\documentclass[a4paper,10pt]{article}
\usepackage{mathpazo}
\usepackage{xspace}
\newcommand{\gf}{\textsc{Geant4}\xspace}
%\newcommand{\gf}{\textsc{Geant}4\xspace} % works too
\begin{document}
text \gf text
\end{document}Stefan