2

How can I vertical align this scheme to the same bottom line?

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage[
  a4paper,
  margin=15mm,
  bindingoffset=2mm,
  heightrounded,
]{geometry}
\usepackage{chemfig}
\usepackage{chemformula}
\usepackage{xcolor}
\usepackage[version=4]{mhchem}
\newcommand{\br}{\\ \vspace{5pt}}

\begin{document}
\begin{flushleft}
\begin{figure}[htbp]
\schemestart
\chemfig{R-C(-[2]O^{\oplus}(-[2]R')(-[4]H))(-[6]H)-C(-[2]H)(-[6]H)(-[0]H)}
\arrow(.-1--){->[{-}\chemfig{H^+}]}[,1.5]
\chemname{\chemfig{R-C(-[2]{\color{red}O}|{\color{red}R'})(-[6]H)-C(-[2]H)(-[6]H)(-[0]H)}}{Etere}
\schemestop
\chemnameinit{}
\end{figure}

\end{flushleft}
\end{document}

enter image description here

4
  • Maybe related: tex.stackexchange.com/a/330375/124842
    – Bobyandbob
    Commented Jun 22, 2017 at 18:51
  • Putting a figure inside a flushleft environment is just wrong. \begin{figure} \raggedright ... \end{figure} would be the right thing instead…
    – cgnieder
    Commented Jun 23, 2017 at 6:32
  • I'm also wondering why you're loading both chemformula and mhchem? Using both \ch{...} and \ce{...} will only produce visually inconsistent results…
    – cgnieder
    Commented Jun 23, 2017 at 6:33
  • \newcommand{\br}{\\ \vspace{5pt}} doesn't look right, either: you'll either want \newcommand{\br}{\\[5pt]} or \newcommand{\br}{\par\vspace{5pt}}
    – cgnieder
    Commented Jun 23, 2017 at 6:35

1 Answer 1

2

As indicated by @Bobyandbob, this is a duplicate of tex.stackexchange.com/a/330375/124842.

The baseline of each molecule is the first atom, in this case R. The arrow needs to be anchored to that baseline to get a suitable vertical alignment. This is done using \arrow{base east --.base west). Since the arrow then sits directly on the baseline, it is more pleasing to apply a small vertical shift [3pt] to move the arrow slightly upwards, without affecting the baseline alignment of the molecules.

This is the result: enter image description here

This is the MWE:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{chemmacros}
\usepackage[italian]{babel}
\usepackage[
  a4paper,
  margin=15mm,
  bindingoffset=2mm,
  heightrounded,
]{geometry}
\usepackage{chemfig}
\usepackage{chemformula}
\usepackage{xcolor}
\usepackage[version=4]{mhchem}
\newcommand{\br}{\\ \vspace{5pt}}

\begin{document}

\schemestart
\chemfig{R-C(-[2]O^{\oplus}(-[2]R')(-[4]H))(-[6]H)-C(-[2]H)(-[6]H)(-[0]H)}
\arrow(.base east--.base west){->[$-\chemfig{H^+}$][][3pt]}
\chemname{\chemfig{R-C(-[2]{\color{red}O}|{\color{red}R'})(-[6]H)-C(-[2]H)(-[6]H)(-[0]H)}}{Etere}
\schemestop
\chemnameinit{}

\end{document}
2
  • 1
    Would you mind removing the flushleft environment? Putting a figure inside is just wrong. \begin{figure} \raggedright ... \end{figure} would be the right thing instead
    – cgnieder
    Commented Jun 23, 2017 at 6:31
  • 1
    Instead of ->[{-}\chemfig{H^+}] it should probably be ->[$-\chemfig{H^+}$]
    – cgnieder
    Commented Jun 23, 2017 at 6:36

You must log in to answer this question.

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