1

I try to use " as a shortcut by using

\catcode`\"=13
\newcommand*{"}[1]{^{(#1)}}

I have to use babel[german] but the package destroys with my shortcut.

Is ther any way to prevent this or do I have to use another character?

Edit I just had to place the commands inside the document and not the preamble. now everything works fine.

3
  • 1
    If you do not use the babel part, disable it. It us explained in the babel manual (look for shorthands)
    – daleif
    Commented Jan 3, 2016 at 18:44
  • \shorthandoff{"}? Commented Jan 3, 2016 at 19:44
  • that doesn't change anything
    – meneken17
    Commented Jan 3, 2016 at 20:02

1 Answer 1

2

It's a timing problem: babel changes the meaning of " at begin document, so you should add your redefinition after that.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[german]{babel}

\shorthandoff{"}

\begingroup
\catcode`"=\active
\AtBeginDocument{%
  \newcommand{"}[1]{^{(#1)}}%
}
\endgroup

\begin{document}

$f"{2}$

\end{document}

My advice is not to do this and to keep the shorthands.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .