12

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?

  • 1
    the shorthands are already not active in the preamble. They are activated by babel with \AtBeginDocument{...} – user2478 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
9
\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}
  • 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 – user2478 Sep 15 '11 at 12:33
10

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.

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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.