2

I am using cfr-lm as the font in my thesis, as I really like the look of the old style numbers in body text, and I have a LOT of numbers in my thesis. I'm also using the chemmacros/chemformula combination.

However, I find they (or at least typceface's this implementation of them), don't work very well in chemical formulas or names. Now there are two easy fixes for this with chemformula, however I can't find an equivalent for chemmacros nomenclature module.

It looks like all I'd have to do is add a \plstyle to the start of every \iupac{ command, but I'm not sure how to do that, or if that is possible without breaking other things.

\documentclass{article}
\usepackage{cfr-lm}
\usepackage{chemmacros}

\begin{document}
\iupac{(1\textit{R},2\textit{R})-\trans-1,2-Cyclohexanedicarboxylate} Old style

\iupac{\plstyle(1\textit{R},2\textit{R})-\trans-1,2-Cyclohexanedicarboxylate} Lining

\iupac{2,2':6',2''-terpyridine} Old style

\iupac{\plstyle 2,2':6',2''-terpyridine} Lining


\end{document}

Now, I could do something like \newcommand\iupacl[1]{\iupac{\plstyle #1}} but then I'm going to be forever hunting down instances of \iupac and having to change them as I copy in text from older papers, so I'm keeping that as a backup if there isn't an easy way to change the font within the \iupac environment.

2 Answers 2

2

Starting with v6.1 (2022/02/13) there is the option nomenclature/iupac-format. Also note the use of \cip:

\documentclass{article}
\usepackage{cfr-lm}
\usepackage{chemmacros}
\chemsetup{
  nomenclature/iupac-format=\plstyle
}
\begin{document}

\iupac{\cip{1R,2R}-\trans-1,2-Cyclohexanedicarboxylate}

\iupac{2,2':6',2''-terpyridine}

\end{document}

enter image description here

1

I don't see an official interface---you could make a feature request---but something like this should work:

\documentclass{article}
\usepackage{cfr-lm,color}
\usepackage{chemmacros}
\ExplSyntaxOn
\chemmacros_define_keys:nn {nomenclature}
  {
    iupac-format .code:n  = 
      {
         #1
      } ,
  }
\RenewDocumentCommand \iupac {O{iupac-format=\plstyle}m} { \chemmacros_iupac:nn {#1} {#2} }  
\ExplSyntaxOff

\begin{document}


\iupac{(1\textit{R},2\textit{R})-\trans-1,2-Cyclohexanedicarboxylate} Old style

\iupac{\plstyle(1\textit{R},2\textit{R})-\trans-1,2-Cyclohexanedicarboxylate} Lining

\iupac{2,2':6',2''-terpyridine} Old style

\iupac{\plstyle 2,2':6',2''-terpyridine} Lining

1234567
\end{document}

Instead of using the default of the optional argument, you could also put the option before the #1, then it would be always executed.

enter image description here

1
  • Can you clarify that last bit? Is it not always being executed now?
    – Canageek
    Nov 13, 2020 at 2:29

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.