4

I'm currently using MiKTeX 2.9 on Windows 7 and can't get to compile a French document correctly. Here is a very minimal example:

\documentclass[francais]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{hyperref}

\begin{document}
Voir \autoref{test}.
\begin{figure}
  \caption{Test}
  \label{test}
\end{figure}
\end{document}

pdflatex compiles this without any errors or warnings. htlatex will only produce the correct results if I specify another language, like ngerman. For francais, however, I get the following warning:

l.7 --- TeX4ht warning --- \Link{x1-21}? ---
! Missing \endcsname inserted.
<to be read again>
                   \special
l.7 Voir \autoref{test}
                       .

and this output in HTML if I ignore the warning:

Voir <a
href="#x1-21"><span class="frenchb-nbsp">&nbsp;</span>:autoreffigure1</a>.

It seems that the activation of the colon character by babel conflicts with the internal command names used by TeX4ht. So I tried to use \shorthandoff{:} immediately after loading babel, as is suggested here, to no effect.
I also installed the newest version of frenchb.ldf from http://daniel.flipo.free.fr/frenchb/ (mentioned in babel documentation) and used the documentation there to alleviate some other problems. But the command \noextrasfrench, again issued right after loading babel, did not help either.
Then I resorted to directly editing frenchb.ldf -- I commented out any occurence of \initiate@active@char and \declare@shorthand containing colons. This produces the correct results, but throws warnings like this one:

! Missing control sequence inserted.
<inserted text>
                \inaccessible
l.6 \begin{document}

Besides, it's hardly a permanent solution. Any help would be appreciated.

Thanks in advance.

PS. Just specifying a language without babel apparently translates expressions like "figure" in the above example -- does anyone now how that works and to what extent it is capable of internationalization/localization?

1 Answer 1

2

When I was searching for the babel source code (in order to find the definitions of the commands used in frenchb.ldf), I stumbled upon the package babeltools, which seems to be made for my specific problem (and more). Adding \usepackage[shorthands=;!?]{babeltools} before loading babel successfully avoids activating the colon character (the others are also standard with francais and still work). htlatex returns a cryptic error message, which doesn't show up in batchmode and can apparently be ignored. On a side note, when searching for "babel deactivate colon", the second link that shows up points to babeltools -- for whatever reason I didn't come up with that exact combination of keywords before...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .