4

I'm using achemso, chemmacros, and chemformula to format a paper. I've written the whole document using the coord-use-hyphen = true option from chemmacros. However, now I hit a paper that that doesn't work for, and I'm wondering if I have to redo all my other .bib entries.

The easiest way would seem to be to make a \haptonohypen{} command that works like \hapto{} but does not generate a hypen, no matter what coord-use-hyphen is set to?

The other way would be if I could set \iupac to take an option for one entry (something like \iupac[coord-use-hyphen=true]{stuff here}, but I don't know if that is possible (I tried just specifying the above already}.

Here is the paper, note that it has a \hapto with no hypen after it.

Here is a MWE with the options I've used for my other 79 .bib entries:

\documentclass[journal=cgdefu]{achemso}
    \AtBeginDocument{\let\latin\relax} %So chemarcos works woth achemso

\usepackage{chemmacros}
    \chemsetup{
        formula=chemformula, %use chemformula instead of say, mhchem
        nomenclature/coord-use-hyphen=true, %Puts hypens after bridging and hapto
} 


\begin{filecontents}{MWE.bib}
@article{Masci2005,
author = {Masci, Bernardo and Thu\'{e}ry, Pierre},
doi = {10.1016/j.poly.2004.11.002},
journal = {Polyhedron},
number = {2},
pages = {229--237},
title = {{Uranyl complexes with the pyridine-2,6-dicarboxylato ligand: new dinuclear species with \iupac{\bridge{}\hapto{2},\hapto{2}peroxide}, \iupac{\bridge{2}hydroxide} or \iupac{\bridge{2}methoxide bridges}}},
volume = {24},
year = {2005}
}
\end{filecontents}

\title{MWE}
\author{Canageek}
\affiliation{TeX.SX}
\email{Canageek}
\date{}


\begin{document}

This is a test text.\cite{Masci2005}

\bibliography{MWE}

\end{document}
2

Starting with v5.7 (2016/06/07) (or rather with v5.7a due to some typos) chemmacros uses the function

\chemmacros_coordination_symbol:nnnn

for defining the coordination symbols. With this it is easy to define a suiting macro which never outputs the following dash.

Also starting with v5.7 \iupac has an optional argument for setting options which in this case may even be the better choice:

\documentclass{article}
\usepackage{chemmacros}[2016/06/08] % v5.7a

\chemsetup{
  formula = chemformula
}

\ExplSyntaxOn
\cs_new_protected:Npn \chemmacros_hapto_nohyp:n #1
  {
    \chemmacros_coordination_symbol:nnnn
      { \c_false_bool } % boolean: use hyphen or don't
      { \c_false_bool } % boolean: use superscript (true) or subscript (false)
      { \chemeta }      % symbol
      {#1}              % sub-/superscript
  }

\NewChemIUPAC \haptoNH { \chemmacros_hapto_nohyp:n }
\ExplSyntaxOff

\begin{document}

\hapto{2} \par
Option one: \haptoNH{2} \par
Option two: \iupac[coord-use-hyphen=false]{\hapto{2}}

\end{document}

enter image description here

3

You can define a \haptonohyphen command:

\documentclass[journal=cgdefu]{achemso}
    \AtBeginDocument{\let\latin\relax} %So chemarcos works woth achemso

\usepackage{chemmacros}
    \chemsetup{
        formula=chemformula, %use chemformula instead of say, mhchem
        nomenclature/coord-use-hyphen=true, %Puts hypens after bridging and hapto
}

\ExplSyntaxOn
\NewChemIUPAC \haptonohyphen  { \chemformula_hapto_nohyphen:n }
\cs_new_protected:Npn \chemformula_hapto_nohyphen:n #1
  {
    \chemeta \chemformula_superscript:n { #1 }
  }
\ExplSyntaxOff


\begin{filecontents}{\jobname.bib}
@article{Masci2005,
author = {Masci, Bernardo and Thu\'{e}ry, Pierre},
doi = {10.1016/j.poly.2004.11.002},
journal = {Polyhedron},
number = {2},
pages = {229--237},
title = {{Uranyl complexes with the pyridine-2,6-dicarboxylato ligand: 
         new dinuclear species with \iupac{\bridge{}\haptonohyphen{2},\hapto{2}peroxide},
         \iupac{\bridge{2}hydroxide} or \iupac{\bridge{2}methoxide bridges}}},
volume = {24},
year = {2005}
}
\end{filecontents}

\title{MWE}
\author{Canageek}
\affiliation{TeX.SX}
\email{Canageek}
\date{}


\begin{document}

This is a test text.\cite{Masci2005}

Uranyl complexes with the pyridine-2,6-dicarboxylato 
ligand: new dinuclear species with \iupac{\bridge{}\haptonohyphen{2},\hapto{2}peroxide}, 
\iupac{\bridge{2}hydroxide} or \iupac{\bridge{2}methoxide bridges},

\bibliography{\jobname}

\end{document}

enter image description here

  • Sorry, I used your answer, but figure I should put the new, official interface at the top. – Canageek Jun 13 '16 at 18:19

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.