avoiding babel shorthands

Babel allows LaTeX to speak multiple languages. It also introduces shorthands, one- or two-character sequences, which help non-English authors to type language-specific letters easily. Unfortunately, this feature leads to problems when generating LaTeX-files automatically.

A simple example:

\documentclass{article}
\usepackage[english,german]{babel}
\begin{document}
Variant "111de000" System\par
Variant "111de000"~System\par
\chaptername
\end{document}

Do you see an error here? No, unless you have experience typesetting German documents. Problem is here:

" S
"~S

Quote has a special meaning when German babel is activated. In the example above, it produces “SS” and “-S”. There are more such shorthands, and there is a lot of languages. I can’t add all of them to my script.

For automatic generation, it’s better to switch shorthands off. But there is no such option. I haven’t found it in documentation and asked in comp.text.tex. It seems that there is no nice way, the only thing I can do is to hook babel internals. There is a proposal from Morten Hogholm (see the thread), but I like my solution better:

File “lessbabel.sty”:

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{lessbabel}[2005/10/04 Babel without shorthands]

\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{babel}}
\ProcessOptions\relax
\RequirePackage{babel}

\def\bbl@activate#1{}

My generated documents now use

\usepackage[english,german]{lessbabel}

instead of

\usepackage[english,german]{babel}

Leave a Reply