2

I'm trying to create a diagram for the countable direct limit in algebra. The following code

$$\vspace{-1mm}\xymatrix{
&&& A\ar@{-->}[dd]^{\exists!\alpha}\\
A_1\ar[r]^{\!\!\!\alpha_{1,2}} \ar@/^12pt/[urrr]|-{\alpha_{1}} \ar@/_12pt/[drrr]|-{\alpha'_{1}}&
A_2\ar[r]^{\!\!\!\alpha_{2,3}} \ar[urr ]|-{\alpha_{2}} \ar[drr ]|-{\alpha'_{2}}&
A_3\ar[r]^{\!\!\!\alpha_{3,4}} \ar[ur  ]|-{\alpha_{3}} \ar[dr  ]|-{\alpha'_{3}}&
\ldots\\
&&& A'\\}$$

produces the diagram below:

enter image description here

Questions:

  1. How can I make the arrows \alpha_1,\alpha_2,\alpha_3 arrive at their destination A?

  2. How to put labels \alpha_{1,2} lower (closer to their arrow)?

  3. How to move objects A and A' a bit to the right (along with \alpha_i,\alpha'_i) so that the arrow \alpha doesn't intersect \ldots and remains straight?

  4. When I bend arrows (using PDFtex) I a get rasterized arrow. How can I bend arrows and still have vector graphics?

  5. What is wrong with \alpha'_3?

David Carlisle
  • 757,742
Leo
  • 3,499

3 Answers3

8

The TikZ-CD package (cd library) might provide a nicer interface for CDs.

Here, I'm using the end arrows key from another answer so that it will be easier to create arrows in a loop (and also have them out of the way of the content of internal matrix that's used). This doesn't stop you from using the normal \ar/\arrow macro however as it is used for the dashed arrow.

In the first diagram, I'm bending the arrows in such a way that the shortest one is actually straight. The labels use the tight key so that they don't have so much white space around them

For the second diagram, I'm just shifting A and A'a bit to the right, a new column could have been used, too, possibly with no actual space between it and the previous one.

Here' I'm using slanted rounded orthogonal arrows whose end point is slightly shifted vertically. The labels are placed on the arrow by using the description style.

Code

\documentclass[tikz]{standalone}
\usetikzlibrary{cd}
\tikzset{
  XY To/.tip={To[length=+3pt +3.5, width=+2pt +2.5]},
  XY To Tight/.tip={XY To[width=+2pt +1.5]},
  |-/.style={to path={|-(\tikztotarget)\tikztonodes}}}
\tikzcdset{
  tight/.style={inner sep=+.1em},
  tight desc/.style={tight, description}}
\makeatletter
\NewDocumentCommand{\tikzcd@arrowlate}{O{}}{%
  \path[{/tikz/commutative diagrams/.cd,every arrow,#1}]
    (\tikzcd@ar@start\tikzcd@startanchor)to(\tikzcd@ar@target\tikzcd@endanchor);}
\tikzcdset{
  end arrows/.style={
    /tikz/commutative diagrams/every matrix/.append style={
      append after command=
        \pgfextra{\pgfutil@g@addto@macro\tikzcd@savedpaths
          {\let\arrow\tikzcd@arrowlate#1}}}}}
\makeatother
\begin{document}
\begin{tikzcd}[
  arrows=-XY To,
  end arrows={
    \foreach[count=\j from 2] \i in {1, 2, 3}{
      \arrow[from=2-\i, to=1-4, bend left=-(\i-3)*7, "\alpha _\i"  tight, near start]
      \arrow[from=2-\i, to=3-4, bend left= (\i-3)*7, "\alpha'_\i"' tight, near start]
      \arrow[from=2-\i, to=2-\j, "\alpha_{\i, \j}" tight]
    }
  }
]
      &     &     & A  \ar[dd, bend left, dashed, "\exists!\alpha"] \\
  A_1 & A_2 & A_3 & \cdots                                          \\
      &     &     & A'
\end{tikzcd}
\begin{tikzcd}[
  arrows=-XY To Tight,
  end arrows={
    \foreach[count=\j from 2] \i in {1, 2, 3}{
      \arrow[from=2-\i, to=1-4, |-, xslant= .5, rounded corners, near start,
             "\alpha_\i" tight desc, end anchor={[yshift=-(\i-2)*1mm]}]
      \arrow[from=2-\i, to=2-\j, "\alpha_{\i, \j}" tight]
      \arrow[from=2-\i, to=3-4, |-, xslant=-.5, rounded corners, near start,
             "\alpha'_\i" tight desc, end anchor={[yshift=(\i-2)*1mm]}]
    }
  }
]
      &     &     & |[xshift=1.5em]| A  \ar[dd, dashed, "\exists!\alpha"] \\
  A_1 & A_2 & A_3 & \cdots                                                \\
      &     &     & |[xshift=1.5em]| A'
\end{tikzcd}
\end{document}

Output

enter image description here enter image description here

Qrrbrbirlbel
  • 119,821
6

I would bend also the dashed arrow and also, slightly, the second diagonal arrows:

\[
\xymatrix{
&&& A\ar@/^12pt/@{-->}[dd]^{\exists!\alpha}\\
A_1\ar[r]^-{\alpha_{1,2}}
\ar@/^12pt/[urrr]|-{\alpha_{1}}
\ar@/_12pt/[drrr]|-{\alpha'_{1}}&
A_2\ar[r]^-{\alpha_{2,3}}
\ar@/^4pt/[urr]|-{\alpha_{2}} \ar@/_4pt/[drr]|-{\alpha'_{2}}&
A_3\ar[r]^-{\alpha_{3,4}} \ar[ur]|-{\alpha_{3}} \ar[dr]|-{\alpha'_{3}}&
\ldots\\
&&& A'
}
\]

Note that \ar[r]^-{f} puts the label in the middle of the actual arrow.

enter image description here

A solution adding a column for the dots is not as good.

David Carlisle
  • 757,742
egreg
  • 1,121,712
  • Yeah, I've tried the option of bending the dashed arrow, but would still prefer moving A,A' to the right slightly. How about lowering \alpha_{n,n+1}? – Leo Sep 27 '11 at 19:41
  • This kind of things can surely be done, but it is always a pain to find something in the manual. :( Putting those labels under the arrow may avoid clashing in the middle. – egreg Sep 27 '11 at 20:24
2

Remove the spaces in the sqare brackets for \ar. This solves problems 1 and 5.

\documentclass{article}
\usepackage[all]{xy}
\begin{document}
\[ 
\vspace{-1mm}\xymatrix{
&&& A\ar@{-->}[dd]^{\exists!\alpha}\\
A_1\ar[r]^{\!\!\!\alpha_{1,2}} \ar@/^12pt/[urrr]|-{\alpha_{1}} \ar@/_12pt/[drrr]|-{\alpha'_{1}}&
A_2\ar[r]^{\!\!\!\alpha_{2,3}} \ar[urr]|-{\alpha_{2}} \ar[drr]|-{\alpha'_{2}}&
A_3\ar[r]^{\!\!\!\alpha_{3,4}} \ar[ur]|-{\alpha_{3}} \ar[dr]|-{\alpha'_{3}}&
\ldots\\
&&& A'\\}
\]
\end{document}

xy diagram

Moriambar
  • 11,466
Stefan Kottwitz
  • 231,401
  • Ah, silly me, I forgot the space [... ] means something. That takes care of question 1), 5), thanks. What about the others? – Leo Sep 27 '11 at 18:32