1

I want to create numbered chemical formula via chemfig environment.
MWE:

\documentclass[a4paper,fleqn,leqno]{article}
\usepackage{polyglossia}
\usepackage{tikz,tikz-3dplot,graphicx}
\usepackage{mathtools,breqn,xparse}
\usepackage[fontsize=12]{scrextend}
\usepackage{array,multirow}
\usepackage{chemfig,circuitikz}
\usepackage{pgfplots}
\DeclareMathSizes{12}{12}{12}{7}
\newcolumntype{C}[3]{@{\hspace*{#1}}>{\centering\arraybackslash}p{#2}@{\hspace*{#3}}}
\newcolumntype{R}[2]{>{\raggedleft\arraybackslash}p{#1}@{\hspace*{#2}}}
\newcolumntype{L}[2]{@{\hspace*{#1}}>{\raggedright\arraybackslash}p{#2}}
\newcolumntype{"}[1]{@{\vrule width #1}}
\makeatletter\newcommand{\ohline}[1]{\noalign {\ifnum 0=`}\fi\hrule height #1\futurelet\reserved@a\@xhline}\makeatletter
\newlength\savedwidth
\newcommand{\ocline}[2]{\noalign{\global\savedwidth\arrayrulewidth\global\arrayrulewidth #1}\cline{#2}\noalign{\vskip\arrayrulewidth}\noalign{\global\arrayrulewidth\savedwidth}}
\begin{document}
{\renewcommand\arraystretch{1.3}
\begin{tabular}{L{0pt}{420pt}@{}C{0pt}{50pt}{0pt}}
\schemestart\setatomsep{2em}\chemfig[line width=0.75pt]{[:18]*5((-[:230]HO)=(-[:307]OH)-(=[:20]O)-O-(-[:150](-[:90]OH)-[:205]-[:150]HO)-)}\chemsign+\chemfig{I_{\scriptscriptstyle 2}}\chemrel[]{-{Stealth[scale=1.5,width=3pt]},line width=0.75pt}\chemfig[line width=0.75pt]{[:18]*5((=[:230]O)-(=[:307]O)-(=[:20]O)-O-(-[:150](-[:90]OH)-[:205]-[:150]HO)-)}\chemsign+\chemfig{2HI}\schemestop & (4)
\end{tabular}}
\end{document}

enter image description here
I2, HF, (4) are not vertically centered though. They are located more on the bottom side.
I want them to be vertically centered. I tried '\arrow{0}[,0]' trick in chemfig formula with no success. I would also need help with tabular vertical alignment.

  • 1
    I get \chemsign and \chemrel undefined. – egreg Nov 26 '15 at 21:35
2

Why not use an equation for numbered reactions? BTW \chemsign and \chemrel are deprecated macros and have been removed in v1.3 of chemfig.

\documentclass{article}
\usepackage{chemfig}
\setbondstyle{line width=.75pt}

% \usepackage{showframe}

\newcounter{reaction}

\begin{document}

\begin{center}
\begin{tabular}{cc}
  \setatomsep{1.5em}
  \schemestart[][184]
    \chemfig{
      [:18]*5(
        (-[:230]HO)
        =(-[:307]OH)
        -(=[:20]O)
        -O-(-[:150](-[:90]OH)-[:205]-[:150]HO)
        -
      )
    }
    \arrow{0}[,0]\+
    \chemfig{I_2}
    \arrow
    \chemfig{
      [:18]*5(
        (=[:230]O)
        -(=[:307]O)
        -(=[:20]O)
        -O-(-[:150](-[:90]OH)-[:205]-[:150]HO)
        -
      )
    }
    \arrow{0}[,0]\+
    2\,HI
  \schemestop &
  \refstepcounter{reaction}(\thereaction)
\end{tabular}
\end{center}

% or:
% \begin{equation}
% \schemestart
%   ...    
% \schemestop
% \end{equation}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.