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.

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...

share|improve this question

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

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
@egreg: Indeed, and thanks. –  DevSolar Jan 10 '13 at 14:43
2  
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

1 Answer 1

up vote 5 down vote accepted

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}
share|improve this answer

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