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 draw a chain, roughly like:

crooked chain

The catch: I want to manually specify the vertical placement of node C, but I still want to use TikZ’s default horizontal placement. Currently, I can only work out how to have the placement of C either completely automatic, or completely manual.

MWE code for the above:

\documentclass{minimal}
\usepackage{tikz} \usetikzlibrary{chains,positioning,scopes}
\begin{document}

\begin{tikzpicture} [start chain=going right,
                     every on chain/.style=join,
                     every join/.style=->]
\node [on chain] {$A$};
\node [on chain] {$B$};
\node [on chain=going below right] {$C$};
\node [on chain] {$D$}; 
\end{tikzpicture}

\end{document}

(I also want to do the same thing with vertical and horizontal interchanged, but I guess the same solution should probably do this as well.)

share|improve this question
add comment

1 Answer

up vote 8 down vote accepted

You can adjust the vertical position by adding a yshift=<distance> key (the horizontal position is adjusted using xshift):

\documentclass{minimal}
\usepackage{tikz} \usetikzlibrary{chains,positioning,scopes}
\begin{document}

\begin{tikzpicture} [start chain=going right,
                     every on chain/.style=join,
                     every join/.style=->]
\node [on chain] {$A$};
\node [on chain] {$B$};
\node [on chain,yshift=-0.5cm] {$C$};
\node [on chain,yshift=1cm] {$D$}; 

\end{tikzpicture}
\end{document}

chain with manual vertical positioning

share|improve this answer
    
Thankyou — that’s exactly what I was looking for! –  Peter LeFanu Lumsdaine Mar 8 '11 at 18:32
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.