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'm trying to recreate a rather complicated reaction scheme with chemfig and TikZ. For that, I'd like to position several amino acid side chains at specific positions.

What I'd like to do is to use the "origins" of those side chains as anchors for positioning the molecules:

MWE

I cannot use normal anchors, however, as the origins' coordinates change depending on the molecules' bounding boxes. Additionally, the chemfig manual states that the origins' coordinates are only calculated when the molecule is actually placed with \chemfig.

So I thought about using chemfig's @ syntax to place a node (called ori) at the origin and moving the chemfig molecule to it, using the ori1/ori2 nodes as anchors:

\documentclass{article}
\usepackage{chemfig}
\begin{document}
  Cysteine side chain

  \begin{tikzpicture}
    \node[draw,anchor=south west] (cys) at (0,0) {\chemfig{-[@{ori1,0}2]S-H}};
    % ??? movement code ???
  \end{tikzpicture}

  Cysteine side chain, deprotonated

  \begin{tikzpicture}
    \node[draw, anchor=south west] (cys_deprot) at (0, 0) {\chemfig{-[@{ori2,0}2]S|^{-}}};
    % ??? movement code ???
  \end{tikzpicture}
\end{document}

However, as far as I've understood from reading through the TikZ manual, there is no way to use other nodes as anchors. Is there some way to achieve this?

Edit for clarification:

Let's talk about the first structure only, the other one is just for comparision. I'd like to use the bullet in the picture (node ori1) as the anchor of the rectangle (node cys). However, ori1's coordinates are not known until cys is actually placed, which is why I believe I have to do the following dance:

  1. Place the cys node, so that the ori1 node gets defined:

    \node (cys) at (0,0) {\chemfig{-[@{ori1,0}2]S-H}};
    
  2. Move cys to its new (fixed) position, anchored at ori1's coordinates (this is the step I don't know).

Is this clear enough? If not, then I'll try and add a picture tonight.

share|improve this question

closed as unclear what you're asking by egreg, Mico, Torbjørn T., Papiro, Adam Liter Oct 4 at 21:51

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Yes you can use nodes and their anchors in the process of positioning something else … can you translate your question for non-chemist? What is your goal, graphically? –  Qrrbrbirlbel Jul 30 '13 at 16:04
1  
You can’t position a node containing something else (in this case a TikZ picture itself) on a reference point of “something else” (however, you can affect the vertical placement with the baseline option). And you can’t move the parent node later. You can however use the coordinate ori1 to place something else there. It is still unclear what you actually want to achieve? Remember that the result of \chemfig is in its own a TikZ picture. In the manual of chemfig, take a look at the \chemmove macro where you can reference the named coordinates and nodes with the @ syntax. –  Qrrbrbirlbel Jul 30 '13 at 16:50
    
The complete scheme of the picture you've linked can be set without too much trouble with chemfig's scheming commands. I just played a bit and already set half the scheme... if you like I can post this as an answer although strictly speaking it may not be an answer... –  cgnieder Jul 30 '13 at 17:20
2  
@runiq here it is, in case you're interested: writelatex.com/read/sjfshknptmnq –  cgnieder Jul 31 '13 at 15:43
    
BTW: do you know this question: tex.stackexchange.com/questions/40695/… –  cgnieder Jul 31 '13 at 20:01