# Using “German” quotation marks inside \newcommand [duplicate]

Possible Duplicate:
babel shorthand "| doesn’t work in macros

I know there is a deeper non-understanding of LaTeX mechanics at work here, but I have no idea how to phrase my question to cover the general case, sorry.

\documentclass{scrbook}
\usepackage[ngerman]{babel}

% Trivial case, the "real" macro is a *bit* more involved
\newcommand{\mymacro}[1]{"#1"'}

\begin{document}

"Foo"'
\mymacro{Bar}

\end{document}


"Foo" gets typeset as expected, with the correct "German" quotation marks. But "Bar" gets typeset verbatim:

"Bar"'


Apparently, the quotation marks "transformation" doesn't work inside \newcommand.

Since I never really understood what the more "magic" LaTeX commands (like \relax, \detokenize or \makeatletter) really were about, or how the underlying TeX really works, I'm stuck and cannot figure out what I need to make the quotation marks inside the macro work properly...

-
@egreg: Indeed, and thanks. –  DevSolar Jan 10 '13 at 14:43
You can also use the macros \glqq and \grqq: \newcommand{\mymacro}[1]{\glqq #1\grqq}. g stands for German, l and rfor left and right, qq for the double quotes; the same system is used to provide macros for single quotes (\??q) and the French Guillemets (\f???). –  Qrrbrbirlbel Jan 10 '13 at 14:58

## marked as duplicate by lockstep, DevSolar, Qrrbrbirlbel, egreg, Paul GaboritJan 10 '13 at 15:41

The solution here is easier than in the "duplicate" question, because you do want quotation marks, instead of other effects of the " character.

For this you can use the alternate commands \glqq and \grqq defined by babel[ngerman] for the quotation marks.

\documentclass{scrbook}
\usepackage[ngerman]{babel}

% Trivial case, the "real" macro is a *bit* more involved
\newcommand{\mymacro}[1]{\glqq #1\grqq}

\begin{document}

"Foo"'
\mymacro{Bar}

\end{document}

-