Document Classesxspace problem

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
jbor7755
Posts: 1
Joined: Mon Jun 25, 2007 7:57 am

xspace problem

Post by jbor7755 »

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.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

xspace problem

Post by Stefan Kottwitz »

Hi Jacob,

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}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
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
LaTeX.org admin
Post Reply