Chemfig:\chemname 和垂直对齐

Chemfig:\chemname 和垂直对齐

在我使用\chemname分子描述命令之前,我可以垂直对齐它们。但是当我使用它时,发生了以下情况:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage[
  a4paper,
  margin=15mm,
  bindingoffset=2mm,
  heightrounded,
]{geometry}

\usepackage{amsmath}
\usepackage{chemfig}
\usepackage{chemformula}
\usepackage{xcolor}
\usepackage[version=4]{mhchem}
\definecolor{emerald}{HTML}{006000}
\newcommand{\br}{\\[5pt]}

\begin{document}
\begin{flushleft}
\textcolor{blue}{Without chemname}\br
\begin{figure}[htbp]
\raggedright 
  \schemestart
    \chemfig{R-[:-60]C(-[:-120]H)=C(-[:-60]H)-[:60]H}
    \arrow{0}[,0]\+
    \chemfig{R'-C(=[:60]O)(-[:-60]{\color{red}O}(-[0]OH))}
    \arrow
   \chemfig{R-[:-60]C(-[:-120]H)(-[:60]{\color{red}O}?)-C?(-[:-60]H)-[:60]H}
   \arrow{0}[,0]\+
   \chemfig{R'-C(=[:60]O)(-[:-60]OH)}
  \schemestop
\end{figure}
\vspace{34pt}
\textcolor{blue}{With chemname}
\begin{figure}[htbp]
\raggedright 
  \schemestart
    \chemfig{R-[:-60]C(-[:-120]H)=C(-[:-60]H)-[:60]H}
    \arrow(.base east--.base west){0[][][1pt]}[,0]\+
    \chemname{\chemfig{R'-C(=[:60]O)(-[:-60]{\color{red}O}(-[0]OH))}}{Perossiacido}
    \arrow(.base east--.base west){->[][][4pt]}
   \chemname{\chemfig{R-[:-60]C(-[:-120]H)(-[:60]{\color{red}O}?)-C?(-[:-60]H)-[:60]H}}{Epossido}
   \arrow(.base east--.base west){0[][][5pt]}[,0]\+
   \chemfig{R'-C(=[:60]O)(-[:-60]OH)}
  \schemestop
  \chemnameinit{}  
\end{figure}
\end{flushleft}
\end{document}

在此处输入图片描述

我能做的最好的就是:

\begin{figure}[htbp]
  \raggedright
  \schemestart
    \chemfig[yshift=2.6em]{R-[:-60]C(-[:-120]H)=C(-[:-60]H)-[:60]H}
    \arrow(.base east--.base west){0[][][1pt]}[,0]\+
    \chemname{\chemfig{R'-C(=[:60]O)(-[:-60]{\color{red}O}(-[0]OH))}}{Perossiacido}
    \arrow(.base east--.base west){->[][][4pt]}
   \chemname{\chemfig[yshift=2.6em]{R-[:-60]C(-[:-120]H)(-[:60]{\color{red}O}?)-C?(-[:-60]H)-[:60]H}}{Epossido}
   \arrow(.base east--.base west){0[][][5pt]}[,0]\+
   \chemfig{R'-C(=[:60]O)(-[:-60]OH)}
  \schemestop
  \chemnameinit{}  
\end{figure}

有没有更高效、更优雅的方法?

答案1

最简单的解决方案是让每个分子都以一个应该位于基线上的原子作为起点:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{chemfig}

\begin{document}

\begin{center}
  \small
  \setchemfig{atom sep=2.4em}
  \schemestart
    \chemfig{C(-[:120]R)(-[:-120]H)=C(-[:-60]H)-[:60]H}
    \+
    \chemname
      {\chemfig{R'-C(=[:60]O)-[:-60]{\color{red}O}(-[0]OH)}}
      {Perossiacido}
    \arrow(.base east--.base west){->[][][3pt]}
    \chemname
      {\chemfig{C(-[:120]R)(-[:-120]H)(-[:60]{\color{red}O}?)-C?(-[:-60]H)-[:60]H}}
      {Epossido}
    \+
    \chemfig{R'-C(=[:60]O)-[:-60]OH}
  \schemestop
\end{center}

\end{document}

在此处输入图片描述

答案2

使用符号有问题\+,请尝试以下代码:

$\raggedright
\schemestart
\chemfig{R-[:-60]C(-[:-120]H)=C(-[:-60]H)-[:60]H}
\arrow{0}[,0]\+
\chemname{\chemfig{R'-C(=[:60]O)(-[:-60]{\color{red}O}(-[0]OH))}}{Peroxiacid}
\arrow(east--west){->[][][4pt]}
\chemname{\chemfig{R-[:-60]C(-[:-120]H)(-[:60]{\color{red}O}?)-C?(-[:-60]H)-[:60]H}}{Epoxide}
\arrow{0}[,0]\+
\chemfig{R'-C(=[:60]O)(-[:-60]OH)}
\schemestop
\chemnameinit{}$

将 de 放在图形环境中的代码之前并查看结果。

相关内容