# Disable babel's shorthands

I want to disable babel's shorthands in my own sty file.

But since I can use \shorthands{off} only inside the document environment, I struggle with this.

Is there a way to disable babel's shorthands in the preamble already?

-
the shorthands are already not active in the preamble. They are activated by babel with \AtBeginDocument{...} –  Herbert Sep 15 '11 at 10:08
I know that they're not active in the preamble. I want to disable them in the preamble so that they are inactive in the document environment. –  Sebastian Sep 15 '11 at 10:09

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\let\LanguageShortHands\languageshorthands
\def\languageshorthands#1{}
\begin{document}

"foo"'

\LanguageShortHands{ngerman}
"foo"'
\end{document}

-
Cheers, thank you! –  Sebastian Sep 15 '11 at 12:01
In the babel.sty the shorthands are loaded if \pdfstringdefDisableCommands is not defined. Is it another way to define it to switch off shorthands initially? –  Sebastian Sep 15 '11 at 12:19
that is related to hyperref –  Herbert Sep 15 '11 at 12:33

Babel 3.9 now provides a package option to deactive shorthands at once:

\usepackage[shorthands=off,ngerman]{babel}


Their functionality are still available with \babelshorthand.

-
There is a beta package babeltools, to be loaded before babel, that plans to allow this, with the addition of selectively enabling some shorthands.
Others have looked at a babel-only way in the past without complete success (e.g. http://uucode.com/blog/2005/10/04/avoiding-babel-shorthands/, coming from a CTT discussion http://groups.google.com/group/comp.text.tex/browse_thread/thread/5fbd187d7807f‌​d3d/6456d8adaa925a94?pli=1) but I don't know if that has been looked at more recently. Given the recent writing of babeltools and its inclusion in TeX Live, perhaps not? –  mas Sep 15 '11 at 10:46