14

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?

2
  • 1
    the shorthands are already not active in the preamble. They are activated by babel with \AtBeginDocument{...}
    – user2478
    Sep 15, 2011 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, 2011 at 10:09

4 Answers 4

11
\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}
2
  • 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, 2011 at 12:19
  • that is related to hyperref
    – user2478
    Sep 15, 2011 at 12:33
13

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.

2

There is a beta package babeltools, to be loaded before babel, that plans to allow this, with the addition of selectively enabling some shorthands.

2
0

Yes, just use PassOptionsToPackage before documentclass like this:

\PassOptionsToPackage{shorthands=off}{babel}
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\begin{document}

"`foo"'

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

You must log in to answer this question.

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