3

Until I use the \chemname command for molecular descriptions, I can vertically align them. But when I use it, happens this:

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

enter image description here

The best I can do is this:

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

There's a more efficent, and elegant, way?

2

2 Answers 2

1

The easiest solution is to start each molecule with an atom that is supposed to sit on the baseline:

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

enter image description here

0

It is a problem using \+ sign, try this code:

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

Place de before code inside figure environment and look the result.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .