# (Commutative) diagram with long labels on vertices

I am trying to draw a diagram that looks something similar to the following:

##############  ---------> ##############
\                       /
\                   /
#########################


The important thing to notice is that the labels on all of the vertices are fairly long and the lower vertex should overlap with the upper two.

It's easy to draw something like this in XYpic:

####  ------->  ####
\          /
\      /
####


with the following code:

$\xymatrix { longtexthere \ar[rr] \ar@{-}[dr] & & longtexthere \ar@{-}[dl] \\ & longtexthere & }$


ie where the vertices don't overlap. Unfortunately, in my case this would mean that the upper two vertices would be "pushed" over the edge of the paper, which is obviously bad.

Any ideas how to draw something like this? Preferrably with XYpic, but as it seems beyond it's capabilities -- apparently you can't do cells that span multiple colums -- then maybe even TikZ.

• Maybe you could post the xy-pic code you already have. That way, it will be clearer to see what result you desire.
– Jake
May 27, 2011 at 15:00
• Done. Doesn't help that much, though. May 27, 2011 at 15:07

You can specify the size you want the bottom label to take up:

\documentclass{article}
\usepackage{xypic}

\begin{document}

$\xymatrix { longtexthere \ar[rr] \ar@{-}[dr] & & longtexthere \ar@{-}[dl] \\ &*=<1cm,1cm>{reallyreallylongtexthere} & }$

\end{document}


Although you have asked for a XYpic solution, and have obtained one, here's an approach in TiKZ. The main virtue of this (aside from the simplicity of syntax) is that you don't have to specify any node lengths by hand.

\documentclass[10pt]{article}
\usepackage{tikz}
\usetikzlibrary{calc,positioning}
\begin{document}

\begin{tikzpicture}
\node (a) [draw, rounded corners] {%
this is a very long label for a node};
\node (b) [draw, rounded corners, right=of a] {%
this node has a very long label as well};
\node (c) [draw, rounded corners] at ($(a)!0.5!(b) + (0,-10ex)$) {%
this node has an especially long label which overlaps the other two};

\draw [-stealth] (a) -- (b);
\draw (a) -- (c);
\draw (b) -- (c);
\end{tikzpicture}
\end{document}

• You should mentioned that this requires the calc and positioning libraries. Please always post complete, compliable solutions. May 27, 2011 at 17:20
• @Martin: good point about calc and positioning, I forgot to mention these as I use them all the time in conjunction with TiKZ. Edited. — However: is it really the case that one is supposed to only post complete and compilable solutions, i.e. in principle complete source for a document? Certainly, answers should ideally include enough information to create a compilable document (my answer did not before the edit because of my oversight), but beyond this, it isn't obvious that providing a 'compilable' solution is the common practice here (even most obviously-useful-and-correct answers). May 27, 2011 at 18:02
• Thanks for the edit. Ok, not every answer has to be fully compilable, but it is the ideal case. It avoids a lot of hassle. Different people have different default preambles and it is often not easy to see with package or libraries are required. There are of course types of answers which do not require full documents or sometimes even no code, but in cases like your answer it is best to add see few lines needed. May 27, 2011 at 18:07

Here's another Xy-pic solution: When beginning an \xymatrix you can specify the column and/or row spacing. Setting the column spacing to a negative value does what you need. We do that by adding @C=-2em between the \xymatrix command and the opening brace:

\documentclass[12pt]{article}
\usepackage[all,cmtip]{xy}
\begin{document}
\thispagestyle{empty}

$\xymatrix@C=-2em { longtexthere \ar[rr] \ar@{-}[dr] && longtexthere \ar@{-}[dl] \\ & longtexthere & }$

\end{document}


That produces:

Here is one with eplain's gridcommdiag:

\input eplain
$$\hgrid=1.3cm \vgrid=1.3cm \gridcommdiag{ \llap{long text here} & \mapright & \rlap{long text here} \cr \sline(-1,1) & & \sline(1,1) \cr & \hbox{really really long text here} \cr }$$
\bye