# Why does qrcode not work with [ngerman] babel?

Consider the following MWE:

\documentclass{scrartcl}
\usepackage{qrcode}

\usepackage[english]{babel}

\begin{document}
\pagestyle{empty}
\qrcode[height=5cm,level="M"]{BCD\?001\?1\?SCT\?ABCDATWW\?Creditor\?AT611904300234573201\?EUR100\?\?\?My\ Subject}
\end{document}


This works. If I switch to language ngerman however, LaTeX returns an error:

... loadhyph-de-1996.tex:8: Argument of \language@active@arg" has an extra }.
... loadhyph-de-1996.tex:8: Paragraph ended before \language@active@arg" was complete.


What gives?

• german uses " as a shorthand so that for example "o is the accented letter. You can locally turn off shorthands. Dec 14 '20 at 22:29
• Thank you. \usepackage[shorthands=off,ngerman]{babel} works a charm. Care to make it an answer? Dec 14 '20 at 22:33
• I thought it was a duplicate but I can't see it so OK I'll answer Dec 14 '20 at 22:35

## 2 Answers

german babel uses " as a shorthand so that for example "o is the accented letter. You can locally turn off shorthands or globally turn them off with

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


If you just want to print a QRcode, there is no problem: just don't load babel.

If your document has parts where German is needed, the also " as a shorthand is needed (to break ligatures at morpheme boundaries, for instance, or for getting appropriate hyphenation of composed words).

I suggest to patch \qrcode to disable the shorthand.

\documentclass{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{qrcode}
\usepackage{xpatch}

\makeatletter
\xpretocmd{\qrcode}{\begingroup\shorthandoff{"}}{}{}
\xapptocmd{\qrcode@in}{\endgroup}{}{}

\begin{document}

\qrcode[height=5cm,level="M"]{BCD\?001\?1\?SCT\?ABCDATWW\?Creditor\?AT611904300234573201\?EUR100\?\?\?My\ Subject}

\bigskip

Auf"|lage, nicht Auflage

\end{document}


• This is a German letter, so of course I would like babel to work. That said, I can easily do without the shortcuts and disable them routinely: I input umlauts via the keyboard, don't need the fancy conditional-hyphen-handling and selnolig takes care of my ligature-related needs. Thanks for the code, though, I'm sure it comes in handy for some (or me in the future, for that matter.) Dec 16 '20 at 6:22