[Tex/LaTex] How to write polymeric reaction in latex

chemfig

Is it possible write this reaction in latex ?

enter image description here

I used this code, but the "image" of raction is very big. How I can reduce it ?

    \documentclass[12pt,twoside,a4paper,openright]{report}
    \usepackage[portuguese]{babel}
    \usepackage[utf8]{inputenc}
    \usepackage[inner=3cm,outer=2cm,tmargin=2.0cm,bmargin=2.0cm, includefoot, includehead]{geometry}
    \usepackage{chemfig}
    \usepackage{chemmacros}
    \usepackage{enumitem}


    \begin{document}
    \newcommand\setpolymerdelim[2]{\def\delimleft{#1}\def\delimright{#2}}
    \def\makebraces[#1,#2]#3#4#5{%
    \edef\delimhalfdim{\the\dimexpr(#1+#2)/2}%
    \edef\delimvshift{\the\dimexpr(#1-#2)/2}%
    \chemmove{%
    \node[at=(#4),yshift=(\delimvshift)]
    {$\left\delimleft\vrule height\delimhalfdim depth\delimhalfdim
    width0pt\right.$};%
    \node[at=(#5),yshift=(\delimvshift)]
    {$\left.\vrule height\delimhalfdim depth\delimhalfdim
    width0pt\right\delimright_{\rlap{$\scriptstyle#3$}}$};}}
    \setpolymerdelim()

    \begin{enumerate}[label=(\arabic*)]
\setcounter{enumi}{3}
 \item\setatomsep{1.8em}
\chemfig{R-O-Si(-[2]OR)(-[6]OR)-[@{downleft,0.9},2]O-Si(-[2]OH)(-[6]OR)-[@{downright,0.4},2]OH}

%\schemestart
%\arrow(.mid east--.mid west){->[\parbox{5cm}{\centering -m \si{H_2O}\\-k ROH}]}[,1.8]
%\schemestop
%\arrow(.mid east--.mid west){->[\parbox{5cm}{\centering -m \si{H_2O}\\-k ROH}]}[,1.8]
%\setchemrel{1pt}{}{6em}
\chemrel[-m {\si{H_2O}//-k ROH}]{->}
%\chemrel[$-\mathrm{m\,H_2O}$]{->}
%\arrow{->[\parbox{5cm}{\centering -m \si{H_2O}\\-k ROH}]}
 \chemfig{-O-Si(-[2]O-[2]Si([2]-)([4]-)-)(-[6]O-[4]R)-O-Si(-[2]O-[8]H)(-[6]O-[6]Si([6]-)([4]-)-)-O-Si(-[2]O-[2]Si([2]-)([4]-)-)(-[6]O-[8]H)-O-Si([2]-)([6]-)([8]-)}

\makebraces[40pt,40pt]{n}{downleft}{downright}
\end{enumerate}

    \end{document}

enter image description here

Best Answer

I propose the following solution. I've made a number of changes:

  • First of all I find your use of enumerate a bit strange. It looks like you want equation numbers for your reactions. If that's it then I'd use an equation environment. With the class option leqno its numbers will be placed on the left.
  • I'd still use chemfig's \schemestart ... \schemestop mechanism. In it the \arrow command can be used to have the reaction downwards instead to left. This can be done by using the optional <angle> argument:

    \arrow{<arrow spec>}[<angle>,<length>]
    

    I use an angle of -90 below. In order for the label not to rotate you can use the * syntax of \arrow labels:

    \arrow{->[*{<angle>}<label>]}[-90]
    

    Using *{0} will give the label a horizontal orientation.

  • This one is more a cosmetic thing: I use a lot more indentation inside \chemfig{} which makes the formulae much more readable.

  • For placing several lines on the arrow I use a tabular. This is more comfortable than a \parbox because there's no need to specify a width.
  • I use math mode for the stoichiometric factors.
  • Last I changed the syntax of \makebraces a bit into a more LaTeX-like syntax and renamed it into \makepolymerbraces. This is only my personal taste...

The complete example gives:

enter image description here

Here's the code:

\documentclass[12pt,leqno]{article}
\usepackage[utf8]{inputenc}

\usepackage{chemfig}
\usepackage{chemformula}

% polymer delimiters:
\makeatletter
\newcommand*\setpolymerdelim[2]{\def\polymer@delimleft{#1}\def\polymer@delimright{#2}}

\newcommand*\makepolymerbraces[5]{%
  \edef\polymer@delimhalfdim{\the\dimexpr(#1+#2)/2}%
  \edef\polymer@delimvshift{\the\dimexpr(#1-#2)/2}%
  \chemmove{
    \node[at=(#4),yshift=(\polymer@delimvshift)]
      {$
       \left\polymer@delimleft
         \vrule height\polymer@delimhalfdim depth\polymer@delimhalfdim width0pt
       \right.
      $};
    \node[at=(#5),yshift=(\polymer@delimvshift)]
      {$
        \left.
          \vrule height\polymer@delimhalfdim depth\polymer@delimhalfdim width0pt
        \right\polymer@delimright_{\rlap{#3}}
      $};
  }%
}
\makeatother

\usepackage{lipsum}% dummy text

\begin{document}

\lipsum[2]

\begin{equation}
  \setpolymerdelim[]\setatomsep{2em}
  \schemestart
    $x$
    \chemfig{
      R-O-Si
        (-[2]OR)
        (-[6]OR)
      -[@{b1,.6},1.5]
      O-Si
        (-[2]OH)
        (-[6]OR)
      -[@{b2},2]
      OH
    }
    \arrow{%
      ->[*{0}%
      \begin{tabular}{c}
        \ch{$-m$ H2O} \\
        \ch{$-k$ ROH}
      \end{tabular}%
      ]%
    }[-90,1.5]
    $z$
    \chemfig{
      -O-Si
        (-[2]O-[2]Si([2]-)([4]-)-)
        (-[6]O-[4]R)
      -O-Si
        (-[2]O-[8]H)
        (-[6]O-[6]Si([6]-)([4]-)-)
      -O-Si
        (-[2]O-[2]Si([2]-)([4]-)-)
        (-[6]O-[8]H)
      -O-Si
        ([2]-)
        ([6]-)
      -
    }
  \schemestop
  \makepolymerbraces{30pt}{30pt}{$n$}{b1}{b2}
\end{equation}

\lipsum[2]

\end{document}
Related Question