带有顶部文本的不平等平衡箭头

带有顶部文本的不平等平衡箭头
\documentclass[12pt]{article}
\usepackage[version=3]{mhchem}
\begin{document}
   \ce{CH2OH + ATP <=>>[\text{Hexokinase}] + \text{glucose 6-phosphate} + ADP + H+} \\
   \ce{CH2OH + ATP <=>> + \text{glucose 6-phosphate} + ADP + H+}
\end{document}

查看生成的 Latex 输出,并进行比较。在 [1] 中,不等平衡符号的两个箭头之间的差异变得不那么明显,因为该符号已被文本拉伸。与没有文本的相同符号 [2] 进行比较。我希望上箭头和下箭头之间的差异更加明显。如何在 LaTEX 中实现这一点?

答案1

另一个答案,因为我误解了你的问题。在源代码中挖掘发现有几个宏会影响箭头的长度。

mhchem.sty我们有

\newcommand*\mhchem@xlongrightshortleftharpoons[2][]{\mathrel{%
  \sbox{\mhchem@arrows@box}%
    {$\mkern9mu\ext@arrow 3399\mhchem@leftharpoondownfill@%
     {#1}{\hphantom{#2}\mkern-6mu\mkern-12mu}$}%
  \rlap{\protect\raisebox{-.22ex}{\usebox{\mhchem@arrows@box}}}%     
  \protect\raisebox{.22ex}{$\ext@arrow 3399\mhchem@rightharpoonupfill@%
    {\hphantom{\usebox{\mhchem@arrows@box}}\mkern-6mu}{#2}$}%
  }}

amsmath它基本上是宏的前端\ext@arrow

\def\ext@arrow#1#2#3#4#5#6#7{%
  \mathrel{\mathop{%
    \setbox\z@\hbox{#5\displaystyle}%
    \setbox\tw@\vbox{\m@th
      \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}%
      \hbox{$\scriptstyle\mkern#3mu{#7}\mkern#4mu$}%
      \copy\z@
    }%
    \hbox to\wd\tw@{\unhbox\z@}}%
  \limits
    \@ifnotempty{#7}{^{\if0#1\else\mkern#1mu\fi
                       #7\if0#2\else\mkern#2mu\fi}}%
    \@ifnotempty{#6}{_{\if0#1\else\mkern#1mu\fi
                       #6\if0#2\else\mkern#2mu\fi}}}%
}

因此,对第 3-4 行中的参数进行调整\ext@arrow将会影响下箭头的长度。我无法\ext@arrow充分理解代码以弄清楚原因。

相反,我尝试使用 来绘制箭头pgf。你必须把

\usepackage{tikz}
\mhchemoptions{arrows=pgf}

在序言中。那么相关的宏是:

\newcommand*\mhchem@longrightshortleftharpoons@pgf[1]{%
  \begin{tikzpicture}[baseline]%
    \draw[use as bounding box] (0,0) (#1,1ex);
    \draw[cap=round, join=round, line width=0.09ex]
        (0.0cm,0.575ex+0.22ex) -- ++(#1,0cm) arc (250:198:0.9ex);  
    \draw[cap=round, join=round, line width=0.09ex]
        (#1+0.5em-1em,0.575ex-0.22ex) -- (0.5em,0.575ex-0.22ex) arc (70:18:0.9ex);
  \end{tikzpicture}%
}% 

从中可以看出,底部箭头比顶部箭头短 1em。为了使其更短,请将最后一行更改为以下内容:

(#1-0.75em,0.575ex-0.22ex) -- (0.75em,0.575ex-0.22ex) arc (70:18:0.9ex);

这将使底部箭头缩短 1.5em。

为了使其可配置,请定义一个键并调用它。以下是完整的示例:

\documentclass[12pt]{minimal}
\usepackage[version=3]{mhchem}
\usepackage{tikz}
\mhchemoptions{arrows=pgf}

\makeatletter
\newlength{\mhchem@shortarrow@reduction}
\define@key{mhchem}{shortarrowreduction}{\setlength{\mhchem@shortarrow@reduction}{#1}}
\renewcommand*\mhchem@longrightshortleftharpoons@pgf[1]{%
  \begin{tikzpicture}[baseline]%
    \draw[use as bounding box] (0,0) (#1,1ex);
    \draw[cap=round, join=round, line width=0.09ex]
        (0.0cm,0.575ex+0.22ex) -- ++(#1,0cm) arc (250:198:0.9ex);  
    \draw[cap=round, join=round, line width=0.09ex]
       % was: (#1+0.5em-1em,0.575ex-0.22ex) -- (0.5em,0.575ex-0.22ex) arc (70:18:0.9ex);
        (#1-\the\mhchem@shortarrow@reduction,0.575ex-0.22ex) 
        -- (\the\mhchem@shortarrow@reduction,0.575ex-0.22ex) arc (70:18:0.9ex);
  \end{tikzpicture}%
}
\AtBeginDocument{\mhchemoptions{shortarrowreduction=0.5em}}
\makeatother


\begin{document}

\noindent%
   \ce{CH2OH + ATP <=>>[\text{Hexokinase}] + \text{glucose 6-phosphate} + ADP + H+} \\
   {\mhchemoptions{shortarrowreduction=2em}
   \ce{CH2OH + ATP <=>>[\text{Hexokinase}] + \text{glucose 6-phosphate} + ADP + H+}} \\
\end{document}

示例代码输出

答案2

这是一个使用(我自己的)的解决方案chemformula。它提供了选项,arrow-ratio=<num>其中应该是和<num>之间的值:01

\documentclass{article}
\usepackage{chemformula}

\begin{document}

\ch{CH2OH + ATP <=>>[Hexokinase] "glucose~6-phosphate" + ADP + H+}

\ch[arrow-ratio=.2]{CH2OH + ATP <=>>[Hexokinase] "glucose~6-phosphate" + ADP + H+}

\end{document}

在此处输入图片描述

注意:周围的引号"glucose~6-phosphate"使其不能被视为公式。

答案3

一个很好的技巧是使用\phantom命令将内容排版成不可见的形式:

\documentclass[12pt]{article}
\usepackage[version=3]{mhchem}
\begin{document}
   \ce{CH2OH + ATP <=>>[\text{Hexokinase}] + \text{glucose 6-phosphate} + ADP + H+} \\
   \ce{CH2OH + ATP <=>>[\phantom{\text{Hexokinase}}] + \text{glucose 6-phosphate} + ADP + H+}
\end{document}

在此处输入图片描述

相关内容