4

I want to use the German language shorthands provided by babel with other languages; the main language of the document is German.

In following MWE the shorthands "= and /"" don't work when the English language is selected; uncommenting \useshorthands{"} doesn't have any effect.

I tried this with pdflatex of TeXLive 2014 and 2016.

(Reversing the order of the languages in the option list of babel has the desired effect, but I want to have German as the main language)

\documentclass{scrartcl}
\usepackage[english,ngerman]{babel}
%\useshorthands{"}
\addto\extrasenglish{\languageshorthands{ngerman}}

\begin{document}
erster/""zweiter Teil \\
Bindestrich"=Wort

\selectlanguage{english}

first/""second part\\
Hyphen"=Word

\selectlanguage{ngerman}
erster/""zweiter Teil\\
Bindestrich"=Wort
\end{document}

output of MWE

FredFisch
  • 883

2 Answers2

9

You can use the star version of \useshorthands to keep it active in all languages:

\documentclass{scrartcl}
\usepackage[english,ngerman]{babel}

\useshorthands*{"}
\addto\extrasenglish{\languageshorthands{ngerman}}

\begin{document}
erster/""zweiter Teil \\
Bindestrich"=Wort

\selectlanguage{english}

first/""second part\\
Hyphen"=Word

\selectlanguage{ngerman}
erster/""zweiter Teil\\
Bindestrich"=Wort
\end{document}

enter image description here

Ulrike Fischer
  • 327,261
6

It works for me with

\addto\extrasenglish{\languageshorthands{ngerman}\useshorthands{"}}

enter image description here

Code:

\documentclass{scrartcl}
\usepackage[english,ngerman]{babel}
\addto\extrasenglish{\languageshorthands{ngerman}\useshorthands{"}}

\begin{document}
erster/""zweiter Teil \\
Bindestrich"=Wort

\selectlanguage{english}

first/""second part\\
Hyphen"=Word

\selectlanguage{ngerman}
erster/""zweiter Teil\\
Bindestrich"=Wort
\end{document}
esdd
  • 85,675
  • Thanks, this drove me crazy as other posts indicate that my MWE indeed should work: https://tex.stackexchange.com/questions/27198 – FredFisch Jul 26 '16 at 15:45