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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I use the abbrevs package and define a \newabbrev using the following code

\newabbrev\gb{Great Britain}

and use it in the following example (taken from the xspace package documentation):

\gb, a small island off the coast of France

I get "Great Britain , a small island off the coast of France", which has a superfluous space inserted before the comma

In the xspace package documentation, they also defines an abbreviation for "Great Britain", but using \newcommand instead of \newabbrev, and they are also having the problem with the superfluous space before the comma. They solve it by putting the macro \xspace after the full name, i.e. Great Britain\xspace. When I follow their example and redefine the abbreviation as

\newabbrev\gb{Great Britain\xspace}

it has the opposite effect, i.e., an extra superfluous space is added before the comma (which I can't illustrate here). I have also tried to insert \@ before xspace (which I found out you could do in this quite similar question), but that has no effect.

Any idéa of how to prevent an abbreviation defined with \newabbrev to insert a space after the abbreviation has been used? The reason I'm using the abbrevs package is because it provides a way of using one expansion of the abbreviation the first time it is used, and another expansion the resting times. I could just as well change to some other package that allowed me to do the same thing.

share|improve this question
Said simply, none of the example in the documentation of abbrevs works as advertised. :( – egreg Jun 14 '12 at 13:00
up vote 5 down vote accepted

This seems to be a bug in the abbrevs package. It's supposed to test the following token of the abbreviation against the tokens in \nospacelist and insert \space if it is not part of \nospacelist. However, the macro responsible for the test has a wrong if:

  \expandafter   \@tfor
    \expandafter \reserved@a
    \expandafter :%
    \expandafter =%
                 \do \t@st@ic

It tests if \@tempswa is true but the macro \t@st@ic (which is defined in latex.ltx and does the actual testing here) sets \maybe@ic to false:

\def \t@st@ic {%

So a redefinition of \maybe@space@ solves the issue:

\newabbrev\gb{Great Britain}

  % \@tempswatrue % <= this is in the original
  \maybe@ictrue % <= this is new
  \expandafter   \@tfor
    \expandafter \reserved@a
    \expandafter :%
    \expandafter =%
                 \do \t@st@ic
  % \if@tempswa % <= this is in the original
  \ifmaybe@ic % <= this is new

\gb, a small island \\
\gb is an island


enter image description here

share|improve this answer
Isn't it easier to use xspace? Maybe something like \let\maybe@space@\xspace – Marco Daniel Jun 14 '12 at 17:55
@Marco Sure, that works just as fine, at least for the abbreviations (I haven't done much testing and never used abbrevs before...). It's still a bug in the package, though. – clemens Jun 14 '12 at 17:59
Of course. I wanted to provide an alternative approach ;-). – Marco Daniel Jun 14 '12 at 18:06
@Marco your's is without doubt the user-friendlier one :) I filed a bug report, BTW. – clemens Jun 14 '12 at 18:27
@cgnieder: Thanks, that seems to do the trick. – StrawberryFieldsForever Jun 15 '12 at 9:50

Your Answer


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.