[Tex/LaTex] Writing Chemical Reaction

chemfigchemistry

I want to show the reaction between Sodium benzoate and soda lime to give benzene and na2co3

Here is my code

\documentclass[11pt]{article}

\usepackage{fullpage}

\usepackage{chemfig,chemmacros}

\def\benzene{\chemfig{**6(------)}}
\def\upsidebenzene{\chemfig{[2]**6(------)}}
\def\sodiumbenzoate{\chemfig{[2]**6(-(-COONa)-----)}}
\def\NaOH{\chemfig{NaOH}}
\def\CaO{\chemfig{CaO}}

\begin{document}
\schemestart
       \sodiumbenzoate 
       + 
       \NaOH
       \arrow{->[\footnotesize\chemfig{CaO}][$\Delta$]}
       \benzene +  \CaO
    \schemestop
\end{document}

the main problem is there is no space between + and CaO (at reactant side)
and i couldn't find any idea to write names below the symbol . I mean i don't know how to write sodium benzoate below its structure . And CaO and Na2C03 don't align in center with respect to benzene ring

Can someone please give me code to fix it
Thank you

Best Answer

A name can be put below a molecule with \chemname{<molecule>}{<name>}.

In a scheme everything between different \arrows is consideres as one compound and the arrow is centered to the whole structure. This can be made visible with \schemedebug{true}:

enter image description here

So one possibility is to put invisible arrows of zero length (\arrow{0}[,0]) in between:

\schemedebug{true}
\schemestart
  \sodiumbenzoate \arrow{0}[,0]
  + 
  \NaOH
  \arrow{->[\footnotesize\chemfig{CaO}][$\Delta$]}
  \benzene \arrow{0}[,0] + \CaO
\schemestop

enter image description here

In combination this would give (note that I use a different possibility to draw sodium benzoate in order to give it a different baseline (page 4 of the chemfig manual: »ChemFig always places the first atom of the molecule on the baseline of the preceding code.«)):

\schemedebug{true}
\schemestart
  \chemname{\chemfig{COONa-[4]**6(------)}}{sodium benzoate}
  \+
  NaOH
  \arrow{->[\footnotesize\chemfig{CaO}][$\Delta$]}
  \chemfig{**6(------)}
  \arrow{0}[,0]
  \+
  CaO
\schemestop

enter image description here

The name disturbs alignment again. Now you can either not use \chemname but put the name below with more invisible arrows or you can adjust the anchor where the \arrow starts (have a look at the (.{4.85}--) argument of \arrow and study section »Anchoring« in part »reaction schemes« of the chemfig manual):

\schemedebug{true}
\schemestart
  \chemname{\chemfig{COONa-[4]**6(------)}}{sodium benzoate}
  \+
  NaOH
  \arrow(.{4.85}--){->[\footnotesize\chemfig{CaO}][$\Delta$]}
  \chemfig{**6(------)}
  \arrow{0}[,0]
  \+
  CaO
\schemestop

There may be other solutions, too. I always tend to forget one or more ways…

enter image description here

Related Question