Hi there
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.
Document Classes ⇒ xspace problem
NEW: TikZ book now 40% off at Amazon.com for a short time.
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
xspace problem
Hi Jacob,
when I tested your macro the result is as expected. I used this minimal example:
When you compile this code, does the problem occur again? If not then the cause should be somewhere else in your document. Perhaps you could give a minimal working example too to test and examine.
Stefan
when I tested your macro the result is as expected. I used this minimal example:
Code: Select all
Code, edit and compile here:
\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
LaTeX.org admin