2

I'm trying to write out a formula, and I'm having trouble getting it to work in chemmacros

What I want is 2,2'-bpy, with a prime and a hyphen. What I get is 2.2"-"bpy, with a period and quotes around the hyphen (hyphen is used, somewhat annoyingly as I've never seen a time I'd want that, as a bond instead of a hyphen in formulas. So you have to put it in quotes. You have to add a space after the second 2, so that they don't go subscript.)

MWE, with an example of what should happen below what is happening.

\documentclass{article}
\usepackage{chemmacros}
\chemsetup{formula=chemformula, %use chemformula instead of say, mhchem
    } 

\begin{document}
\ch{(UO2)2( 2, 2 \chemprime "-" bpy)(CH3CO2)(O)(OH)}


\ch{UO2 "-" H2O2 "-" K2CO3}
\end{document}
0

1 Answer 1

4

After macros spaces are ignored. This is why in

\ch{(UO2)2( 2, 2 \chemprime "-" bpy)(CH3CO2)(O)(OH)}

chemformula sees the following pieces of input (in the order of appearance):

  • (UO2)2( interpreted as formula
  • 2, interpreted as stoichiometric factor
  • 2 interpreted as stoichiometric factor
  • \chemprime "-" interpreted as formula
  • bpy)(CH3CO2)(O)(OH) interpreted as formula

In stoichiometric factors decimals can be input with comma or point but the output (option decimal-marker) is always a point. A stoichiometric factor is followed by a space in the output (option stoich-space). Inside a compound " is not removed.

Since 2,2'-bpy logically is more a chemical name than a formula I'd escape the whole thing – this prevents the number being typeset as subscripts, prevents the conversions of the comma and the dash:

\ch{(UO2)2( "2,2\chemprime-bpy" )(CH3CO2)(O)(OH)}

or even

\ch{(UO2)2( "\iupac{2,2'-bpy}" )(CH3CO2)(O)(OH)}

Complete example:

\documentclass{article}

\usepackage{chemmacros}
\chemsetup{
  formula=chemformula, %use chemformula instead of say, mhchem
} 

\begin{document}

\ch{(UO2)2( 2, 2 \chemprime "-" bpy)(CH3CO2)(O)(OH)} \par
\ch{(UO2)2( "2,2\chemprime-bpy" )(CH3CO2)(O)(OH)} \par
\ch{(UO2)2( "\iupac{2,2'-bpy}" )(CH3CO2)(O)(OH)}

\end{document}

enter image description here

You must log in to answer this question.

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