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 have the following tikz code:

\schemestart
  \chemname{\chemfig[][scale=0.6]{
    *6(-=(-\lewis{6,O}-[:30]*6(-(=\lewis{57,O})(-[90,0.25,,,draw=none]@{a1}S)-\lewis{26,O}*6(--)))-=-*6(-(=\lewis{13,O})-(*6(-=-=-=)))=)
  }}{
    2-(4-benzoylphenoxy)essigsäure Ethylesther
  }
  \chemfig{
    \chemsign{+}
@{a0}\vphantom{K}\chemabove{K}{\hspace{5mm}\scriptstyle\oplus}
\hspace{4mm}
\chemabove{OH}{\hspace{-7mm}\scriptstyle\ominus}
  }
  \chemmove[-stealth,red,shorten <=3pt]{
    \draw(a0)..controls+(up:10mm)and+(north west:10mm)..(a1.north);}
  \arrow
  \arrow(@c1--){0}[-90,0.333] % Line break!
  \chemname{\chemfig[][scale=0.6]{
    *6(-=(-O-[:30]*6(-(-[:330]\Lewis{15,O}-[:330]-[:30]O)(-[:210]\Lewis{357,O})-OH))-=-*6(-(=O)-(*6(-=-=-=)))=)
  }}{
    2-(4-benzoylphenoxy)essigsäure
  }
  \chemfig{
    \chemsign{+}
\chemabove{K}{\hspace{5mm}\scriptstyle\oplus}\hspace{4mm}
\chemsign{+}
H_2O
  }
  \arrow
\schemestop

This gives this image:

enter image description here

It is easy to see that the added K^(+) and (+)^OH are not aligned correctly. I tried it with \vphantom{K} but it doesn't seem to work.

One strang thing is also the red arrow. In my original document he isn't pointing at the right location, but using standalone for producing this image resulted in the correct arrow position. What can be the reason for that?

enter image description here

share|improve this question
    
The red arrow will point to the right location provided you used the right node names. It will need two compilations, though, as \chemdraw is a wrapper for a tikz picture with option remember picture, overlay. By “not aligned correctly” you mean with respect to the +? –  cgnieder Feb 2 '13 at 13:39
    
Also after repeated compilation the arrow is lost somewhere. I used the exactly same file for the standalone figure, and there it is displayed correctly. I solved the alignment problem by using K^\ominus, this aligned the bottom line of K with the bottom line of H_2O. –  Reza Feb 2 '13 at 13:50
    
If the arrow doesn't point where it is supposed to there must be something different in the code. Have you additional nodes with the names a0 and a1 somewhere else? –  cgnieder Feb 2 '13 at 14:41
add comment

1 Answer 1

up vote 3 down vote accepted

I usually don't use \chemname and \chemsign within the \schemestart \schemestop “environment”. (But that may be personal preferences). Instead I often use invisible arrows with length zero for dividing compounds. Also, I'd choose more meaningful node names than the default c1, c2,... This way it's easier to see when you refer to a compound which one you actually mean and it doesn't matter if the automatic names change due to changes to the whole scheme.

Since I also don't like \oplus and \ominus for formal charges I'd use (my own) chemmacros which provides macros for them, e.g. \fplus and \fminus. Its \ch macro also allows for much easier syntax when you try to input ions, especially ones with formal charges.

All in all I'd do something like this (while playing with the code I changed details in the skeleton formulas and was too lazy to undo them again...):

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{chemfig}
% formal charges and other stuff like the \ch{} macro:
\usepackage{chemmacros}

\begin{document}

% turn all of chemmacros' charges into formal ones,
% i.e. also the ones set with \ch{}:
\chemsetup{option/circled=all}

% the scheme:
\schemestart
  \setatomsep{1.8em}
  \chemfig{
    *6(
      -=(
        -\lewis{26,O}-[:30]*6(
          -(=\lewis{57,O})-[@{a1,0}]\lewis{26,O}*6(--)
        )
      )-=-*6(-(=\lewis{13,O})-(*6(-=-=-=)))=
    )
  }
    %
  \arrow(ester.-5--){0}[,0]
  \ch{+ K+}%
  \chemfig{
    @{a0}{\ch{^-OH}}
  }
  \chemmove[-stealth,red,shorten <=1pt, shorten >=3pt]{
    \draw(a0)..controls+(up:10mm)and+(up:10mm)..(a1.north);}
  \arrow
  \arrow(@ester--estername){0}[-90,.2] longuncomprehensiveiupacname
  \arrow(@estername--saeure){0}[-90,0.333] % Line break!
  \setatomsep{1.8em}
  \chemfig{
    *6(
      -=(
        -O-[:30]*6(
          -(-[:330]\lewis{15,O}-[:330]-[:30])(-[:210]\chembelow[1.5ex]{\lewis{357,O}}{\fscrm})-OH
        )
      )-=-*6(-(=O)-(*6(-=-=-=)))=
    )
  }   
  \arrow(.-6--){0}[,0]
  \ch{+ K+}
  \arrow
  \arrow(@saeure--){0}[-90,.2] longuncomprehensiveiupacname
\schemestop

\end{document}

enter image description here

share|improve this answer
    
Thanks a lot. I'll accept your answer, but I have still issues with the arrow. Could it be some artefact from a previous image in my document? –  Reza Feb 2 '13 at 15:01
    
You'll need to create a minimal working example (MWE) that reproduces the wrong error. You could then modify your question or probably rather ask a new one. Without MWE that shows the erroneous behaviour it's impossible to tell –  cgnieder Feb 2 '13 at 15:04
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.