Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I wish to have a reaction in \chemfig and write some details under each molecule so am using the \chemname command. It puts the text under the molecule. However, as I have arrows in the reaction scheme, the whole system is misaligned. I have tried to use the \chemnameinit command to set the depth of the deepest molecule (commented out in lines 6-10 of the MWE below), but to no avail. Am I missing something simple?!

I tried putting the \arrow(){} command within the \chemname{} but that spits out errors. Having the \chemname{\chemfig{structure}{line 1\\ line2\\ line3\\ line4}} keeps the molecules aligned (without the \\ no alignment of molecules!)

\documentclass{standalone}
\usepackage{chemfig,chemmacros}
\usepackage{graphicx}
\begin{document}
\schemestart
%\chemnameinit{\chemfig{CH_3-C(-[:90]CH_3)(-[:-90]CH_3)-{\color{blue}\lewis{0:2:6:,Cl}}}}
%\chemnameinit{\chemfig{AlCl_3}}
%\chemnameinit{\chemfig{CH_3-C(-[:90]CH_3)(-[:-90]CH_3)-\chemabove{{\color{red}\lewis{0:2:6:,Cl}}}{\pch}-Al(-[:90]Cl_3)(-[:-90]Cl_3)-Cl_3}}
%\chemnameinit{\chemfig{CH_3-\chemabove{C}{\pch}(-[:60]CH_3)(-[:-60]CH_3) }}
%\chemnameinit{\chemfig{Cl-\chemabove{Al}{\qquad\mch}(-[:90]Cl)(-[:-90]Cl)-Cl}}
\chemname{\chemfig{CH_3-C(-[:90]CH_3)(-[:-90]CH_3)-{\color{blue}\lewis{0:2:6:,Cl}}}}{Lewis Base\\ Lone pair of e$^-$\\ on Cl\\ can donate}
\+
\chemname{\chemfig{AlCl_3}}{Lewis Acid\\ unfilled orbitals\\ on Al\\ Can accept e$^-$}
\arrow(--){<=>[][]}
\chemname{\chemfig{CH_3-C(-[:90]CH_3)(-[:-90]CH_3)-\chemabove{{\color{red}\lewis{0:2:6:,Cl}}}{\pch}-Al(-[:90]Cl_3)(-[:-90]Cl_3)-Cl_3}}{charged complex\\ \\ \\ }
\arrow(--){<=>[][]}
\chemname{\chemfig{CH_3-\chemabove{C}{\pch}(-[:60]CH_3)(-[:-60]CH_3) }}{Lewis Acid\\ \\ \\ }
\+
\chemname{\chemfig{Cl-\chemabove{Al}{\qquad\mch}(-[:90]Cl)(-[:-90]Cl)-Cl}}{Lewis Base\\ \\ \\ }
\schemestop

\end{document}

misaligned_arrows

share|improve this question
    
Everything between two \arrow commands is the contents of a TikZ \node. The arrows align to the center of those IIRC. But you can tell them where to align by giving TikZ anchors: \arrow(.<from anchor>--.<to anchor>). Alternatively you could leave all the \chemnames away and after drawing the scheme you could put names/descriptions under each molecule with an invisible arrow. –  cgnieder Sep 9 '13 at 11:33
add comment

1 Answer

up vote 2 down vote accepted

chemfig's \arrow has the optional argument (<node1>.<anchor1>--<node2>.<anchor2>) where both node names and anchors can be left out. In your case it is sufficient to add suitable anchor names since the baseline of the molecules all are on the same line the way you defined them. I only added (besides some indentation for readability) the anchors base east and base west and removed the superfluous \\:

\documentclass{standalone}
\usepackage{chemfig,chemmacros}
\usepackage{graphicx}

\begin{document}

\schemestart
  \chemname
    {\chemfig{CH_3-C(-[:90]CH_3)(-[:-90]CH_3)-{\color{blue}\lewis{0:2:6:,Cl}}}}
    {Lewis Base\\ Lone pair of e$^-$\\ on Cl\\ can donate}
  \+
  \chemname
    {\chemfig{AlCl_3}}
    {Lewis Acid\\ unfilled orbitals\\ on Al\\ Can accept e$^-$}
  \arrow(.base east--.base west){<=>}
  \chemname
    {%
      \chemfig{
        CH_3-C(-[:90]CH_3)(-[:-90]CH_3)
        -\chemabove{{\color{red}\lewis{0:2:6:,Cl}}}{\pch}
        -Al(-[:90]Cl_3)(-[:-90]Cl_3)-Cl_3}%
    }
    {charged complex}
  \arrow(.base east--.base west){<=>}
  \chemname
    {\chemfig{CH_3-\chemabove{C}{\pch}(-[:60]CH_3)(-[:-60]CH_3) }}
    {Lewis Acid}
  \+
  \chemname
    {\chemfig{Cl-\chemabove{Al}{\qquad\mch}(-[:90]Cl)(-[:-90]Cl)-Cl}}
    {Lewis Base}
\schemestop

\end{document}

enter image description here

chemfig's arrows also have an optional argument where you can specify a vertical shift:

\arrow(.base east--.base west){<=>[][][4pt]}

If I add this to the MWE above I get:

enter image description here

share|improve this answer
    
I had tried the anchor used .east--.west and didn't seem to work, I only saw the .base east anchor now on proper reading of manual. My bad... –  Leeser Sep 10 '13 at 15:01
    
The chemfig manual probably doesn't mention all anchors (I haven't checked) but they're all explained in the pgfmanual. –  cgnieder Sep 10 '13 at 15:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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