2

I want to draw a curved line and define the coordinates relative to previous nodes I have used (instead of absolute coordinates which works fine). This is what I have so far but it gives the following error:

Package PGF Math Error: Unknown function 'r1' (in 'r1.west')

why can I not use the name of the node here? And more importantly how can I solve it? I have added a picture of what I am trying to achieve in case it is not clear with my description

enter image description here

code so far (error at last line):

\documentclass[crop,tikz]{standalone}
\usetikzlibrary{plotmarks,shapes,shapes.symbols,arrows,chains,positioning,decorations.pathreplacing}

\begin{document}

% Start the picture
\begin{tikzpicture}%
[%
    >=stealth',                   %Define standard arrow tip
    start chain=going below,    % General flow is top-to-bottom
    node distance=1cm and 1cm, % Global setup of box spacing
    every join/.style={-, draw},   % Default linetype for connecting boxes
]

\tikzset{
  reservoir/.style={draw, rectangle,on chain, on grid, align=center, minimum height=4ex},
  % coord node style is used for placing corners of connecting lines
  coord/.style={coordinate, on chain, on grid},
}

\tikzstyle{myarrows}=[line width=1mm,draw,-triangle 45,postaction={draw, line width=3mm, shorten >=4mm, -}]

% Start by placing the nodes
\node [reservoir,rotate=45, text width=2.5cm] (r1) {1};
\node [reservoir,rotate=20, text width= 1cm,right=0.5cm of r1.east] (r2) {2};
\draw [decorate,decoration={brace,amplitude=12pt}]([xshift=0.2cm,yshift=-0.2cm]r2.east)--([xshift=0.2cm,yshift=-0.2cm]r1.west);

\node [reservoir,rotate=-30, text width= 2cm,right=0.5cm of r2.east] (r3) {3};
\node [reservoir,rotate=15, text width= 3.5cm,right=0.5cm of r3.east] (r4) {4};
\draw [decorate,decoration={brace,amplitude=12pt}]([yshift=-1.3cm]r4.east)--([yshift=-1.3cm]r3.west) node [midway, anchor=north,yshift=-1cm]{Rainfall-runoff link 2};

% add connection lines
\draw (r1.east) -- (r2.west);
\draw (r2.east) -- (r3.west);
\draw (r3.east) -- (r4.west);

% add river curved line
\node [coord, above=1cm of r1.west] (b1)  {};
\node [coord, above=1cm of r3.west] (b2)  {};
\node [coord, above=1cm of r4.west] (b3)  {};
\node [coord, above=1cm of r4.east] (b4)  {};
\draw ([yshift=1cm]r1.west,[yshift=1cm]r1.west) .. controls ([yshift=1cm]r3.west,[yshift=1cm]r3.west) and ([yshift=1cm]r4.west,[yshift=1cm]r4.west) .. ([yshift=1cm]r4.east,[yshift=1cm]r4.east);

\end{tikzpicture}
\end{document}

closed as off-topic by ChrisS, Stefan Pinnow, TeXnician, Andrew Swann, Troy Jan 15 '18 at 8:20

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    r1.west is not just an x-coordinate or y-coordinate. It has both an x and y coordinate. So remove the duplication. Instead of ([yshift=1cm]r1.west,[yshift=1cm]r1.west), just use ([yshift=1cm]r1.west). Similarly for the others. – Peter Grill Apr 5 '16 at 8:00
  • great, thanks! no error anymore although it does not give the expected curvature at least I can start working on it further. Cannot believe how simple it was considering how much time I have lost on this. Still have a lot to learn! Which I knew latex sooner (not one month before my dissertation has to be submitted) – Ingrid Apr 5 '16 at 8:12
  • 3
    I'm voting to close this question because it was solved in the comments. – Stefan Pinnow Jan 15 '18 at 5:05

Browse other questions tagged or ask your own question.