Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
1  
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
add comment

3 Answers

up vote 8 down vote accepted
\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}
share|improve this answer
    
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
add comment

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.

share|improve this answer
add comment

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

share|improve this answer
    
Useful hint, but there is no »babel only way« for this? –  Sebastian Sep 15 '11 at 10:37
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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