## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Controlling lines in tikz

Information and discussion about graphics, figures & tables in LaTeX documents.
Kotoschow
Posts: 28
Joined: Mon Apr 09, 2012 3:13 pm

### Controlling lines in tikz

Hi all,

I am trying to draw a tikz diagram with nodes and lines. I would like to control the point where lines meet nodes. That is, for some node whose coordinates are (x,y), I want to be able to draw lines that start at (x,y+0.2) and terminates at (x,y-0.2). That is, I want a shortcut for the following commands:

`\node(a) at (0,0);\node(b) at (1,1);\draw(0,.2) -- (1,.8); `

Is there any command which gives me the coordinates of a node? Or an optional argument for the \node command which tells the node where lines should meet it?

Thanks!

Stefan Kottwitz
Posts: 9604
Joined: Mon Mar 10, 2008 9:44 pm
The easiest:

`\draw (a.north) -- (b.south);`

With shifts:

`\draw ([yshift=0.2ex]a.north) -- ([yshift=-0.1ex]b.south);`

Adding arbitrary x and y coordinates:

`\usetikzlibrary{calc}% in the preamble...\draw (\$(a) + (0,.2)\$) -- (\$(b) - (0,0.2)\$);`

Stefan