4

I've been trying a simple reaction with chemformula but it doesnt display the arrows. There is a similar problem here but the solution doesn't work for me (I'm not using dvips).

Here is a MWE

\documentclass[a4paper,12pt]{article}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage{chemmacros}
\chemsetup{modules=all}
\chemsetup{formula=chemformula}


\begin{document}

\ch{glucosa_{(s)} <=> glucosa_{(aq)}}


\end{document}

The reported error is:

*************************************************
* chemmacros warning: "no-greek"
* 
* You haven't loaded any package for upright Greek letters or no unique choice
* was possible. Either load one of packages specified in the manual or select
* a chemgreek mapping manually.
*************************************************

(/usr/local/texlive/2018/texmf-dist/tex/latex/elements/elements_names_spanish.d
ef)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! chemformula error: "unknown-arrow"
! 
! The arrow type <=> doesn't exist on line 26.
! 
! See the chemformula documentation for further information.
! 
! Type <return> to continue.
!...............................................  

l.26 \ch{glucosa_{(s)} <=> glucosa_{(aq)}}
  • 5
    spanish babel makes > and < characters active. you could try passing es-noquoting when loading babel. – Troy Sep 18 '18 at 14:03
  • 1
    Feel free to accept @TeXnician’s answer, he goes into more detail than I could. – Troy Sep 18 '18 at 22:10
3

You have to remove babel's modifications (making > and < active).

chemformula

\documentclass[a4paper,12pt]{article}
\usepackage[spanish]{babel}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage{chemmacros}
\chemsetup{modules=all}
\chemsetup{formula=chemformula}

\let\chold\ch
\renewcommand\ch[1]{%
    \catcode`<=12
    \catcode`>=12
    \chold{#1}%
    \catcode`<=\active
    \catcode`>=\active
}

\begin{document}
<<Test>>

\ch{glucosa_{(s)} <=> glucosa_{(aq)}}

<<Test>>
\end{document}

Alternative (mentioned by Troy in the comments):

\documentclass[a4paper,12pt]{article}
\usepackage[spanish,es-noquoting]{babel}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage{chemmacros}
\chemsetup{modules=all}
\chemsetup{formula=chemformula}

\begin{document}
<<Test>>

\ch{glucosa_{(s)} <=> glucosa_{(aq)}}

<<Test>>
\end{document}
  • I'm sorry, the solution work, but what is the issue? I couldn't understand it...< and > are active in Spanish language? I can't guess why... – santimirandarp Sep 18 '18 at 16:58
  • @santimirandarp Do you see the quotes in the screenshot? That's not simply <<, but a quote glyph. Therefore, it has to be active. Babel activates many characters in many different languages, so it's always wise to read the documentation. – TeXnician Sep 18 '18 at 17:18

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.