# xy diagram: set height of a specific row

I'm using the xy package. In the diagram

$$\xymatrix@R=8mm@C=8mm{ & 1\ar@{-}[ddl]\ar@{-}[dr] & \\ & & c\ar@{-}[dd]\\ a & & \\ & & b\\ & 0\ar@{-}[uul]\ar@{-}[ur] & \\}$$


,

how can I set the row height between c and a and between a and b to be smaller. I want to create this diagram:

\$2mm] doesn't make any change, and \xymatrix@R=8mm@C=8mm{... only makes global changes. - Is tikz or pstricks an option for you? – Marco Daniel Oct 11 '11 at 18:21 @Marco: If my problem can't be solved via xy, then \usepackage{tikz} is certainly an option :) – Leon Lampret Oct 11 '11 at 18:24 ## 5 Answers I've never used xymatrix, and couldn't find anything useful in the manual, after a little searching, but I can provide a TikZ-solution. \documentclass{article} \usepackage{tikz} \usetikzlibrary{matrix} \begin{document} \begin{tikzpicture} \matrix (thing) [matrix of math nodes,row sep=15pt] { &[1cm] 1 &[0.5cm] \\ & & c \\[-15pt] a & & \\[-15pt] & & b \\ & 0 & \\ }; \draw (thing-1-2) -- (thing-2-3) -- (thing-4-3) -- (thing-5-2); \draw (thing-1-2) -- (thing-3-1) -- (thing-5-2); \end{tikzpicture} \end{document}  - Ok, perhaps an unecessary answer. One difference between me and the answer of @Marco is that I defined different column separations, as that seemed to be the case in the reference screenshot. – Torbjørn T. Oct 11 '11 at 18:51 This is the best that I could do with Xy-pic. The idea is to make the c and b special (off-matrix) targets à la Section 3.3 of xyguide.pdf. \documentclass{article} \usepackage[matrix,arrow]{xy} \begin{document} \[\xymatrix @R=12mm @C=8mm { & 1\ar@{-}[dl] & \save[]+<0mm,-8mm>*{c} \ar@{-}[l] \restore \\ a & & \save[]+<0mm,-8mm>*{d} \ar@{-}[ld] \ar@{-}+<0mm,12mm> \restore \\ & 0\ar@{-}[ul] & \\}$
\end{document}


The fact that you got two good TikZ answers in the time that it took to get one bad Xy-pic answer indicates the ease of crafting TikZ code. If you're still persuadable I would encourage you to learn TikZ.

-
"I would encourage you to learn TikZ" - agreed, thank you –  Leon Lampret Oct 11 '11 at 23:00

Just add rows and close up them:

\xymatrix@R=2mm@C=8mm{
& 1 \ar@{-}[dddl] \ar@{-}[ddr] \\
\\
&& c \ar@{-}[dd] \\
a \ar@{-}[dddr] \\
&& b \ar@{-}[ddl] \\
\\
& 0
}


-
ah, a good trick, thanks –  Leon Lampret Oct 11 '11 at 23:00

In the relation to the comment of of Leon:

{tikz} is certainly an option

I would suggest something like this:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{calc,matrix}
\usepackage[all]{xy}
\begin{document}
$\xymatrix@R=8mm@C=8mm{ & 1\ar@{-}[ddl]\ar@{-}[dr] & \\ & & c\ar@{-}[dd]\\ a & & \\ & & b\\ & 0\ar@{-}[uul]\ar@{-}[ur] & \\}$

$\begin{tikzpicture}[baseline,remember picture,] \matrix (n) [matrix of math nodes,% column sep=8mm, row sep=8mm,nodes={anchor=center},] { & 1 & \\ & & c\\ a & & \\[-4mm] & & b\\[-4mm] & 0 & \\ }; \draw (n-1-2) -- (n-3-1); \draw (n-1-2) -- (n-2-3); \draw (n-3-1) -- (n-5-2); \draw (n-4-3) -- (n-5-2); \draw (n-4-3) -- (n-2-3); \end{tikzpicture}$

\end{document}


-

Here is a pstricks solution to drawing this diagram. It uses pst-node to identify node locations/connections and multido to iterate over the nodes, arranged in a circle of radius 2cm:

\documentclass{article}
\usepackage{pst-node}% http://ctan.org/pkg/pst-node
\usepackage{multido}% http://ctan.org/pkg/multido
\begin{document}
\begin{pspicture}(10,10)
\SpecialCoor% Enable polar coordinates (r;t)
\psset{linestyle=solid,linewidth=0.5pt,linecolor=black,nodesep=10pt}% Edge parameters
\rput{180}{%
\degrees[5]% 5 angles per revolution (each angle is 360/5=72 degrees)
\multido{\iA=0+1,\iB=1+1}{5}{%
\pcline(node-\iA)(node-\iB)% Edge
}
}

% Labels
\rput{0}(node-0){$a$}%
\rput{0}(node-1){$0$}%
\rput{0}(node-2){$b$}%
\rput{0}(node-3){$c$}%
\rput{0}(node-4){$1$}%
\end{pspicture}
\end{document}


-
You can use psmatrix. –  Marco Daniel Oct 12 '11 at 5:53
Thanks - I draw it as to be more circular rather than rectangular which is not that easy with psmatrix. –  Werner Oct 12 '11 at 6:13