[tex-live] Babel: You can't use `spacefactor' in vertical mode. (Maybe related to glossaries package.)

Dr Nicola L C Talbot n.talbot at uea.ac.uk
Tue May 21 16:35:17 CEST 2013


On 21/05/13 10:27, Denis Bitouzé wrote:
> Le mardi 21/05/13 à 10h09,
> Zdenek Wagner <zdenek.wagner at gmail.com> a écrit :
>
>> Yes, there was one complaint
>
> Indeed, here:
>
>    http://tug.org/pipermail/tex-live/2013-May/033531.html
>
>> and it seems to me that the source of the
>> bug is not in babel itself. Line 54 is the first occurence of a macro
>> with a "protected" name, namely \@ifpackawith. This is correct and
>> LaTeX should understand it because at the time of processing
>> \usepackage the catcode of @ is set to 11. I have seen just the log
>> file, not the sources, and the log file clearly revealed that babel
>> was successfully loaded by usepackage but then loaded again by \input
>> in the middle of a document. The author claims he does not do it but
>> as my experience says, improper use of a fragile macro can force LaTeX
>> to read a file although the user does not wish it. I therefore suspect
>> a weird clash between packages. If you can send me the document, I
>> will try to find the source of the problem.
>
> Here is a MCE that shows that the error is probably related to
> glossaries, hence Nicola in Cc: Nicola, the complete thread can be read
> here:
>
>    http://tug.org/pipermail/tex-live/2013-May/033603.html
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> \documentclass[english]{article}
> \usepackage[T1]{fontenc}
> \usepackage[utf8]{inputenc}
> \usepackage{babel}
> \usepackage[xindy]{glossaries}
> %
> \makeglossaries
> \newacronym{ar}  {AR}  {anti-reflection}
> %
> \begin{document}
> \gls{ar}
> \newpage
> \printglossary
> \end{document}
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> Note that:
>
> 1. The error is:
>
> ! You can't use `spacefactor' in vertical mode.
> @->spacefactor
>                 @m
> l.54 \@
>         ifpackagewith{babel}{debug}
> ?
> ! Missing $ inserted.
> <inserted text>
>                  $
> l.54 \@
>         ifpackagewith{babel}{debug}
> ?
> Runaway argument?
> switch.defrelax fi def bbl @for##1##2##3{@for##1:=##2do {ifx
> ##1 at emptETC. ! Paragraph ended before stripldf was complete.
> <to be read again>
>                     par
> l.160
>
> [...]
>
> 2. It appears with (an up to date) 2013 TL but not with TL 2012.
>
> 3. If \newpage is removed, the "spacefactor" error is dropped and only
> the subsequent one appears:
>
> (/usr/local/texlive/2013/texmf-dist/tex/generic/babel/babel.sty
> Runaway argument?
> switch.defrelax fi def bbl @for##1##2##3{@for##1:=##2do {ifx
> ##1 at emptETC. !
> Paragraph ended before stripldf was complete.
> <to be read again>
>                     par
>
> 4. If "xindy" glossaries option is removed, there are no more errors
> from second run (reinserting "xindy" option make the errors reappear
> from second run).
>
> Cheers.
>

The \findrootlanguage code was designed to parse babel.sty to detect the 
root language (rather than the dialect) that is currently in use. This 
is so that makeglossaries can pass the correct language setting to 
xindy, as xindy doesn't recognise dialects. The babel.sty code used to 
be easy to parse, but the recent babel update means the 
\findrootlanguage code no longer works. To remove the error message, you 
can just do:

\def\findrootlanguage{%
   \def\rootlanguagename{\languagename}%
}

or, if you're using a dialect and want to use makeglossaries, you can 
explicitly set the root language name:

\def\findrootlanguage{%
   \def\rootlanguagename{english}%
}

I'll fix glossaries so that it just uses \languagename, and I'll add a 
dialect mapping to makeglossaries.

Regards
Nicola Talbot

-- 
Dr Nicola Talbot
http://theoval.cmp.uea.ac.uk/~nlct/
http://www.dickimaw-books.com/


More information about the tex-live mailing list