6

I want to write chemical formulae in a predominant german Text with a small number of russian words. For that I use babel and chemformula, but they produce a heavy conflict. My MWE:

\documentclass{report}
\usepackage[T2A,T1]{fontenc}
\usepackage[russian,ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{chemformula}
\begin{document}
Deutscher Text
\selectlanguage{russian}{русский текст}
\ch{H2O}
\end{document}

I get the following error message:

[path]/chemformula.sty.1168:"xparse/command-already-defined"! See the LaTeX3 documentation for further information. { \chemformula_ch:nn { #1 } { #2 } }

Lines 1167-8 of chemformula.sty contain the following:

\NewDocumentCommand \ch { O{}m }
  { \chemformula_ch:nn { #1 } { #2 } }

Is there any way to combine these packages?

  • Commenting the chemformula package and using \ch shows a “ch” (I don't know if that have a meaning in a different language). So, if you don't need that, just adding \let\ch\relax before loading chemformula should be enough. – Manuel Jun 30 '14 at 15:28
6

The Russian module for babel defines \ch for the “hyperbolic cosine” operator.

\documentclass{report}
\usepackage[T2A,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian,ngerman]{babel}

%%% save the command for the hyperbolic cosine
\let\Ch\ch
%%% undefine \ch
\let\ch\relax
%%%

\usepackage{chemformula}

\begin{document}

Deutscher Text

\selectlanguage{russian}{русский текст}
\ch{H2O}

\end{document}

If you need “ch” for the hyperbolic cosine, type \Ch

enter image description here

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.