Combining calc and perpendicular coordinates in tikz

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Combining calc and perpendicular coordinates in tikz



As it is described there, the following does not compile:


documentclassreport

usepackagetikz
usetikzlibrarycalc

begindocument
begintikzpicture
node at (0, 0) (node1) Hello;
node at (0, -2) (node2) World;

% working:
draw ($ (node1.south) + (1,0) $) to ( node1.south |- node2.north);

% not working:
draw ($ (node1.south) + (1,0) $) to ( ($ (node1.south) + (1,0) $) |- node2.north);

endtikzpicture
enddocument



Why? How to make it work?




1 Answer
1



The syntax of the line to operation given in the manual is to place |- between two coordinates:


line to


|-



path ... -| < coordinate or cycle> ...;



path ... |- < coordinate or cycle> ...;



You just have to write in your code:


draw ($ (node1.south) + (1,0) $) to ($ (node1.south) + (1,0) $) |- (node2.north);



instead of


draw ($ (node1.south) + (1,0) $) to ( ( ( $ (node1.south) + (1,0) $) |- node2.north);`



Your code becomes like this:


documentclassreport

usepackagetikz
usetikzlibrarycalc

begindocument
begintikzpicture
node at (0, 0) (node1) Hello;
node at (0, -2) (node2) World;

% working:
%draw ($ (node1.south) + (1,0) $) to ( node1.south |- node2.north);

% now working too:
draw ($ (node1.south) + (1,0) $) to ($ (node1.south) + (1,0) $) |- (node2.north);
endtikzpicture
enddocument





Great, cheers :)
– iago-lito
37 mins ago







By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

make 2 or more post in bootsrap

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3

Firebase Auth - with Email and Password - Check user already registered