# Spanish babel and chemformula package

I need to write a chemical reaction. I use to make this with mhchem, but I discover chemformula. All it is right but no the arrows when I use the package babel in spanish.

There are a problem with spanish babel, because these two codes demonstrate there is a conflict. I need to use spanish babel and chemformula at the same time.

These are the codes:

The first one:

\documentclass[11pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{chemformula}
\begin{document}
\ch {C6H12O6 (s)  +  6 O2 (g) <-> 6 CO2 (g)  +  6 H2O(l)}
\end{document}


and the second:

\documentclass[11pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{chemformula}
\begin{document}
\ch {C6H12O6 (s)  +  6 O2 (g) <-> 6 CO2 (g)  +  6 H2O(l)}
\end{document}


Can somebody help me?

-
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. –  Harish Kumar Feb 2 '14 at 0:36
Usually, we don't put a greeting or a “thank you” in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say “thank you” to users who helped you. And a suggestion: Do us a favour and change your username to something more telling than "user1234". In your user profile you can also add your settings. –  Speravir Feb 2 '14 at 3:08
I'll add something to chemformula in order to handle this automatically –  clemens Feb 2 '14 at 12:22

The problem is that the spanish module for babel changes the behaviour of < and > to implement some special quotation mechanism.

If you are not using the special quotation mechanism offered by the spanish module, add the es-noquoting option, so < and > recover their standard meaning:

\documentclass[11pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[spanish,es-noquoting]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{chemformula}
\begin{document}
\ch {C6H12O6 (s)  +  6 O2 (g) <-> 6 CO2 (g)  +  6 H2O(l)}
\end{document}


Another option, still allowing you to use the quoting features implemented by the spanish module would be to deactivate the feature before the formula and then activate it again:

\documentclass[11pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{chemformula}
\begin{document}
\deactivatequoting
\ch {C6H12O6 (s)  +  6 O2 (g) <-> 6 CO2 (g)  +  6 H2O(l)}
\activatequoting
\end{document}


-
Thank you, Gonzalo. It is a good solution. –  user45241 Feb 2 '14 at 1:12

This is fixed in v4.5 (2014/04/08) of chemmacros/chemfomula:

\documentclass[11pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}

\usepackage{chemmacros}[2014/04/08]

\newcommand*\cs[1]{\texttt{\textbackslash#1}}

\begin{document}

before: <<foo>>

\ch{C6H12O6\sld{} + 6 O2\gas{} <-> 6 CO2\gas{} + 6 H2O\lqd}

after: <<foo>>

Also inside \cs{ch}'s escaped text:
\ch{"<<foo>>" <<=> "<<bar>>"}

\end{document}


-