3

I am using the fonts libertine with newtxmath and beramono together with the chammacros package to typeset experimental data. This works very well and I get the desired results. This package manages to typeset the coupling constant in a way that its prescript is very close to the letter J. When I try to achieve the same result text, I fail, even though I am using packages like mathtools of leftidxbut they don't meet my needs it their standard version.

Here is a MWE

\documentclass[a4paper,10pt,bibliography=totoc,listof=totoc]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{libertine}
\usepackage[scaled=.83]{beramono}
\usepackage[libertine]{newtxmath}

\usepackage{chemmacros}
\chemsetup[nmr]{
  delta = (ppm) ,
  pos-number = side ,
  use-equal,
  format = \bfseries,
  list=true
}
\usepackage{siunitx}
\sisetup{
  separate-uncertainty ,
  per-mode = symbol ,
  range-phrase = -- ,
  detect-mode = false ,
  detect-weight = true ,
  mode = text ,
  text-rm = \libertineLF % use libertine with lining figures
}

\ExplSyntaxOn
\cs_set_protected:Npn \__chemmacros_nmr_coupling:w (#1;#2)
  {
    \tl_set:Nn \l__chemmacros_nmr_coupling_bonds_tl { #1 \! }
    \tl_set:Nn \l__chemmacros_nmr_coupling_nuclei_tl
      {
        \c_math_subscript_token
          { \chemmacros_chemformula:n { #2 } }
      }
    \__chemmacros_nmr_coupling_aux_i:w
  }
\cs_set_protected:Npn \chemmacros_nmr_number:n #1
  {
    $ #1 $ \, % put the number in math-mode for lining figures
    \chemmacros_atom:V \g__chemmacros_nmr_element_tl
  }
\ExplSyntaxOff

\begin{document}
Good way:
\begin{experimental}
  \NMR(400)[C6D6] \val{2.01} (d, \J(1;CH)[Hz]{25.0}, \#{24}, \pos{5})
\end{experimental}
Not so good way:
$\prescript{1}{}{J}$ coupling

\end{document}

I believe chemmacros is using mathtools internally from what I remember from the documentation, but appparently in a smarter way than I do.

3

chemmacros uses normal math mode for this: $^{1}J$. You have a modified version which reduces the space a bit: $^{1\!}J$.

enter image description here

Below I use v4.4 of chemmacros which also uses \! and adds a possibility to decide how the different numbers are typeset (see the extended options in the example below) so the redefinitions are not needed anymore.

\documentclass[a4paper,10pt,bibliography=totoc,listof=totoc]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{libertine}
\usepackage[scaled=.83]{beramono}
\usepackage[libertine]{newtxmath}

\usepackage{chemmacros}[2014/01/29] % use version 4
\chemsetup[nmr]{
  delta = (ppm) ,
  pos-number = side ,
  use-equal,
  format = \bfseries,
  list=true ,
  coupling-pos-cs = \ensuremath , % <<< added
  atom-number-cs = \ensuremath    % <<< added
}
\usepackage{siunitx}
\sisetup{
  separate-uncertainty ,
  per-mode = symbol ,
  range-phrase = -- ,
  detect-mode = false ,
  detect-weight = true ,
  mode = text ,
  text-rm = \libertineLF % use libertine with lining figures
}

\begin{document}

Good way:
\begin{experimental}
  \NMR(400)[C6D6] \val{2.01} (d, \J(1;CH)[Hz]{25.0}, \#{24}, \pos{5})
\end{experimental}
Same way:
$^{1\!}J$ coupling

\end{document}

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.