I have trouble in entering the following chemical reaction in LaTeX. I will be very grateful for every help.
-
1You're welcome to TeX.SE. Could you add a minimal working example, please? You can visit the link http://wiki.contextgarden.net/Chemistry. – Sebastiano Jan 23 '17 at 15:35
-
Thank you Sebastiano. I used \chemfig as below but it does not exactly what I need: \chemfig{n(CH_2(=[:0]CHCOOH))} – Reza Jan 23 '17 at 15:52
-
@Reza search the chemfig manual for polymers – cgnieder Jan 23 '17 at 16:06
-
Reza, yet I have not undestood your picture because I have not your source. Add your source and a figure with your hand. I'm not an expert of chemical structures, sorry. – Sebastiano Jan 23 '17 at 16:06
-
See for example also http://tex.stackexchange.com/questions/96633/ and http://tex.stackexchange.com/questions/188615/ – cgnieder Jan 23 '17 at 16:08
1 Answers
As I mentioned already in the comments: the chemfig manual has a section about those kind of schemes. In an example in the manual there are the macro \makebraces and \setpolymerdelims defined which can be used here. A remark for the first formula: parentheses have a special meaning inside chemfig's formulas (branching). In order to have them printed they have to be enclosed with braces.
\documentclass{article}
\usepackage{chemfig}
\newcommand\delimleft{}
\newcommand\delimright{}
\newcommand\makebraces{}
\newcommand\delimhalfdim{}
\newcommand\delimvshift{}
\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{document}
\schemestart
$n$ \chemfig{{(}CH_2=CHCOOH{)}}
\arrow(--.-165)
\chemfig{-[@{b1}]CH_2-CH(-[2]COOH)-[@{b2}]}
\schemestop
\makebraces[5pt,5pt]{n}{b1}{b2}
\end{document}
Further references/examples:
Remarks:
The chemmacros package has a module polymers which defines a \makepolymerdelims. Using it one doesn't need to add definitions to the preamble. However, using it may only make sense if chemmacros is used anyway. The code then becomes:
\documentclass{article}
\usepackage{chemfig,chemmacros}
\chemsetup{
modules = {polymers} ,
polymers/delimiters = ()
}
\begin{document}
\schemestart
$n$ \chemfig{{(}CH_2=CHCOOH{)}}
\arrow(--.-165)
\chemfig{-[@{b1}]CH_2-CH(-[2]COOH)-[@{b2}]}
\schemestop
\makepolymerdelims{5pt}{b1}{b2}
\end{document}

