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.

So I want to show the ionic interaction between a molecule and a charged element. But when I use color to highlight a part of the molecule, the bond alignment is no longer correct. The first example is ok, the other two shows the problem. I've tried two different ways to draw lines between the calcium and the electeric charge (\ominus), with strange results. I'm using texlive and chemfig v1.0h Nov 28 2013.

enter image description here

\documentclass{article}
\usepackage{chemfig,amsmath}
\newcommand{\gammach}{$\gamma$}
\begin{document}

\schemedebug{false}
\definesubmol{Glu}{
    [:0,0.75]\phantom{X}-[:30]HN-
     ([:60]
      --[:0]
       (-[:60]COO^{\ominus}
       )
     )
    (-[::-60]CO-[:0,0.5]\vphantom{X})
}
\schemestart
 \chemname{  \chemfig{ !{Glu} }}{glutamic acid}
\arrow{->[\gammach-carboxylase]}
\chemname{\chemfig{
    [:0,0.75]\phantom{X}-[:30]HN-
     ([:60]
      --[:0]
       (-[:60]COO^{\ominus}
        (-[:-40,0.975,,,dotted]Ca^{2+}?[Cahook])
       )
       (-[:-60]COO^{\ominus}-[,0.2,,,draw=none]?[Cahook,1,dotted,red])
     )
    (-[:-60]CO-[:0,0.5]\phantom{X})
}}{\gammach-carboxylated glutamic acid}
\schemestop

\schemestart
\chemname{\chemfig{ !{Glu} }}{glutamic acid}
\arrow{->[\gammach-carboxylase][\+ \color{red}CO$_2$]}
\chemname{\chemfig{
    [:0,0.75]\phantom{X}-[:30]HN-
     ([:60]
      --[:0]
       (-[:60]COO^{\ominus}
        (-[:-40,0.975,,,dotted]Ca^{2+}?[Cahook])
       )
   (-[:-60]{\color{red}COO^{\ominus}}-[,0.2,,,draw=none]?[Cahook,1,dotted,red])
     )
    (-[:-60]CO-[:0,0.5]\phantom{X})
 }}{\gammach-carboxylated glutamic acid}
\schemestop

\qquad

\schemestart
\chemname{\chemfig{ !{Glu} }}{glutamic acid}
\arrow{->[\gammach-carboxylase][\+ \color{red}CO$_2$]}
\chemname{\chemfig{
    [:0,0.75]\phantom{X}-[:30]HN-
     ([:60]
      --[:00]
       (-[:60]COO^{\ominus{}}@{higherCOO}
        (-[:-30,0.975,,,dotted,red]Ca^{2+}@{ca})
       )
       (-[:-60,,,,blue]{\color{red}COO^{\scriptstyle\ominus{}}
               }@{lowerCOO}-[:30,0.975,,,green,dotted]
       )
     )
    (-[:-60]CO-[:0,0.55])
 }}{\gammach-carboxylated glutamic acid}
\schemestop

\chemmove{ \draw[red,dotted] (ca)--(lowerCOO); }

\end{document}
share|improve this question
    
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. –  Martin Schröder Jan 26 at 13:49

1 Answer 1

up vote 3 down vote accepted

Here is my try:

\documentclass{article}
\usepackage{chemfig}
\newcommand\gammach{$\gamma$}
\begin{document}
\setbondstyle{thick}
\schemedebug{false}
\definesubmol{Glu}{[:0,0.75]-[:30]HN-([:60]--[:0](-[:60]COO^\ominus))(-[::-60]CO-[:0,0.5])}
\schemestart
    \chemname{\chemfig{!{Glu}}}{glutamic acid}
    \arrow{->[\gammach-carboxylase]}
    \chemname{%
        \chemfig{ [,0.75]%
        -[:30]HN-([:60]--[:0](-[:60]COO|^\ominus(-[:-40,1,,,dotted]Ca?|^{2+}))%
        (-[:-60]COO^\ominus?[,,dotted,red]))(-[:-60]CO-[:0,0.5])}}%
        {\gammach-carboxylated glutamic acid}%
\schemestop
\bigbreak

\schemestart
    \chemname{\chemfig{!{Glu}}}{glutamic acid}
    \arrow{->[\gammach-carboxylase][\+ \color{red}CO$_2$]}
    \chemname{%
        \chemfig{ [,0.75]%
        -[:30]HN-([:60]--[:0](-[:60]COO|^\ominus(-[:-40,1,,,dotted]Ca?|^{2+}))%
        (-[:-60]{\color{red}C}|{\color{red}O}|{\color{red}O^\ominus}?[,,dotted,red]))(-[:-60]CO-[:0,0.5])}}%
        {\gammach-carboxylated glutamic acid}%
\schemestop
\bigbreak

\schemestart
    \chemname{\chemfig{!{Glu}}}{glutamic acid}
    \arrow{->[\gammach-carboxylase][\+ \color{red}CO$_2$]}
    \chemname{%
        \chemfig{ [,0.75]%
        -[:30]HN-([:60]--[:0](-[:60]COO|^\ominus(-[:-40,1,,,dotted]Ca?|^{2+}))%
        (-[:-60,,,,blue]{\color{red}C}|{\color{red}O}|{\color{red}O^\ominus}?[,,dotted,green]))(-[:-60]CO-[:0,0.5])}}%
        {\gammach-carboxylated glutamic acid}%
\schemestop
\end{document}

enter image description here

share|improve this answer
    
Spot-on! Thank you very much. Ahh... so I see the delimiters '|' could be placed after each colored atoms and not in front of them. I'm surprised that the delimiter was used in the hooks as well. Much appreciated. –  Erik Jan 25 at 23:05

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.