如何在 chemmacros 中重現耦合常數的排版

如何在 chemmacros 中重現耦合常數的排版

我將字體libertine與 newtxmath 一起使用,並beramonochammacros套件一起排版實驗數據。這非常有效,我得到了想要的結果。這個包設法以一種其規定非常接近字母 J 的方式排版耦合常數 當我嘗試獲得相同的結果文本時,我失敗了,即使我使用像mathtoolsof 這樣的包leftidx,但它們不符合我的要求需要它的標準版本。

這是一個 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}

我相信chemmacros是在內部使用mathtools我從文件中記得的內容,但顯然比我更聰明。

答案1

chemmacros 為此使用普通數學模式:$^{1}J$.您有一個修改後的版本,它減少了一點空間:$^{1\!}J$

在此輸入影像描述

下面我使用 v4.4,chemmacros其中還使用\!並添加了決定如何排版不同數字的可能性(請參閱下面範例中的擴充選項),因此不再需要重新定義。

\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}

相關內容