I was trying to write a simple class and have the following issue: I need to write some text containg German quotation marks that is staic and thus should be typeset by the class by default.

You can see in the MWE below that inside the document environment I can use "` and "' to achieve the correct markings. In the class file it does not work. I can only use \glqq and \grqq to get ir right.

Is there a way to get it up correctly or is it simply impossible without the explicit macros in class files?

Here comes the myclass.cls file:

\newcommand{\abc}{"`abc"' \glqq abc \grqq}

And here comes the main tex file:

"`abc"' \glqq abc \grqq

  • This has already appeared: tex.stackexchange.com/questions/34670/… – egreg Aug 1 '14 at 9:04
  • In a class you should use the non shorthand based form; and, in my opinion, no class should load babel. – egreg Aug 1 '14 at 9:07
  • I agree, but this is some sort of form to be typeset that I just manually copied from a Word document. Thus it's clear that it has to be written in German. OK, I see what I would had to do to get it working. For now I used a repacement with the non-shorthand form. This works for sure. – Christian Wolf Aug 1 '14 at 9:15

The latest version of babel allows the option KeepShorthandsActive, so you could say


but this opens the way to several problems, because packages loaded in the preamble will be affected by the active ".

You could use


as suggested in babel shorthand "| doesn't work in macros but you can exploit the fact of being in a class file and so of being able to use @-commands. The list of shorthands is found in ngermanb.ldf

\declare@shorthand{ngerman}{"a}{\textormath{\"{a}\allowhyphens}{\ddot a}}
\declare@shorthand{ngerman}{"o}{\textormath{\"{o}\allowhyphens}{\ddot o}}
\declare@shorthand{ngerman}{"u}{\textormath{\"{u}\allowhyphens}{\ddot u}}
\declare@shorthand{ngerman}{"A}{\textormath{\"{A}\allowhyphens}{\ddot A}}
\declare@shorthand{ngerman}{"O}{\textormath{\"{O}\allowhyphens}{\ddot O}}
\declare@shorthand{ngerman}{"U}{\textormath{\"{U}\allowhyphens}{\ddot U}}
\declare@shorthand{ngerman}{"e}{\textormath{\"{e}}{\ddot e}}
\declare@shorthand{ngerman}{"E}{\textormath{\"{E}}{\ddot E}}
\declare@shorthand{ngerman}{"I}{\textormath{\"{I}}{\ddot I}}

so, for instance, instead of "a in a class macro, you can say \"{a}\allowhyphens and, instead of "- you can use


Note that the \textormath alternative is useless in a class macro wanting to use "a.

Probably babel should use an indirect method (there are much less memory problems nowadays). In my opinion it should say


and then


For "a it should have

\def\bbl@ngerman@quotea@math{\ddot a}



This would allow class writers to access more easily and clearly the nonshorthand version.

  • Actually, KeepShorthandsActive has been there for ages. – Javier Bezos Aug 2 '14 at 11:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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