8

I would like to reproduce the diagram in 2.1 of https://www3.nd.edu/~wgd/Dvi/CalculatingSimplicialLocalizations.pdf

enter image description here

So far I have this piece of code but I don't know how to fill cells with horizontal lines as in the link above:

\begin{tikzpicture}
\matrix[matrix of math nodes]{

  & C_{0,1} & C_{0,2} &    &  \cdots       &        & C_{0,n-1} &   \\

  &         &         &    &               &        &           &   \\

X &         &         &    &               &        &           & Y \\

  &         &         &    &               &        &           &   \\

  &         &         &    &               &          &         &   \\

};
\end{tikzpicture}
percusse
  • 157,807

4 Answers4

6

This can be done by tikz-cd, xy or pure pstricks and tikz.

I introduced some dimensions (e.g. [-2\jot]). You may want to modify or delete them until the diagram fits your desired style.

Here you are:

% arara: pdflatex

\documentclass{article}
\usepackage{mathtools}
\usepackage{tikz-cd}
\makeatletter
\DeclareRobustCommand{\rvdots}{%
    \vbox{
        \baselineskip4\p@\lineskiplimit\z@
        \kern-\p@
        \hbox{.}\hbox{.}\hbox{.}
    }}
    \makeatother

\begin{document}
\[
\begin{tikzcd}
& C_{0,1}\arrow[dash]{r}\arrow{d} & C_{0,2}\arrow[dash]{r}\arrow{d} &[-2\jot] \cdots\arrow[dash]{r} &[-2\jot] C_{0,n-1}\arrow{d} & \\
& C_{1,1}\arrow[dash]{r}\arrow{dd} & C_{1,2}\arrow[dash]{r}\arrow{dd} & \cdots\arrow[dash]{r} & C_{1,n-1}\arrow{dd} & \\
X \arrow[dash]{uur}\arrow[dash]{ur}\arrow[dash]{ddr} &&&&& Y\arrow[dash]{uul}\arrow[dash]{ul}\arrow[dash]{ddl} \\[-7.2\jot]
& \rvdots \arrow{d} & \rvdots \arrow{d} && \rvdots \arrow{d} & \\
& C_{k,1}\arrow[dash]{r} & C_{k,2}\arrow[dash]{r} & \cdots\arrow[dash]{r} & C_{k,n-1} &
\end{tikzcd}
\tag{*}\]
\end{document}

enter image description here

LaRiFaRi
  • 43,807
  • Hello, thanks a lot! Unfortunetely I have the following error : ! Package pgfkeys Error: I do not know the key '/tikz/dash' and I am going to i gnore it. Perhaps you misspelled it. I use the class scrbook. –  May 19 '15 at 13:05
  • I don't know why but instead of your horizontal bars I have horizontal arrows. Any idea ? –  May 19 '15 at 13:08
  • Where I have to write \listfiles ? –  May 19 '15 at 13:18
  • I have Package: tikz-cd 2012/03/18 v0.2b Commutative diagrams with tikz. –  May 19 '15 at 13:23
  • What is the line of command I have to write in the terminal please ? –  May 19 '15 at 14:00
  • @Asymptotik I do not know, what system you are having. Please read the several posts on how to update packages on this site. I will delete my comments here, as it is getting too long without any information for others. – LaRiFaRi May 19 '15 at 14:04
  • linux ubuntu 3.2.0 –  May 19 '15 at 14:15
  • @Asymptotik http://tex.stackexchange.com/q/2044 and http://tex.stackexchange.com/q/31727 – LaRiFaRi May 19 '15 at 14:27
  • I don't understand, nothing works. –  May 19 '15 at 15:05
  • @Asymptotik You have to update your packages or you have to take another approach. Or you leave the dashs away from my example if you can live with some arrow heads. See here: http://tex.stackexchange.com/a/55459 I can't help you to update your TeX distribution here in comments. Please read the multiple help pages for that stuff or ask a new question if you fail to do so. – LaRiFaRi May 19 '15 at 15:14
4

Similar to LaRiFaRi, but with less dramatic length for the vertical arrows to the dots. The trick is to use mock rows and shortening row sep.

\documentclass{article}
\usepackage{tikz-cd}

\newcommand{\cvdots}{\raisebox{-.4ex}[0pt][0pt]{$\vdots$}\mathstrut}

\begin{document}

\[
\begin{tikzcd}[row sep=1em]
 & C_{0,1} \arrow[dddl,dash] \arrow[r,dash] \arrow[dd]
 & C_{0,2} \arrow[r,dash] \arrow[dd]
 & \cdots \arrow[r,dash]
 & C_{0,n-1} \arrow[dddr,dash] \arrow[dd]
\\ \\
 & C_{1,1} \arrow[dl,dash] \arrow[r,dash] \arrow[dd]
 & C_{1,2} \arrow[r,dash] \arrow[dd]
 & \cdots \arrow[r,dash]
 & C_{1,n-1} \arrow[dr,dash] \arrow[dd]
\\
X \arrow[dddr,dash] & & & & & Y \arrow[dddl,dash]
\\
& \cvdots \arrow[dd] & \cvdots \arrow[dd] & & \cvdots \arrow[dd]
\\ \\
 & C_{k,1} \arrow[r,dash]
 & C_{k,2} \arrow[r,dash]
 & \cdots \arrow[r,dash]
 & C_{k,n-1}
\end{tikzcd}
\]

\end{document}

enter image description here

egreg
  • 1,121,712
  • much easier would be to use \\[-7.2\jot] in the third row (resulting in arrow heads on base-line of X. Same procedure could be done for each column. &[-2\jot] for the third and fourth separator for example. Just discovered that short time ago, that's why I share it here. – LaRiFaRi May 19 '15 at 11:31
  • 1
    @LaRiFaRi Interesting! Why don't you add it to your answer? – egreg May 19 '15 at 12:03
  • fits more into yours as it is more about spacing the cells relative to each other. But well, I will do so. – LaRiFaRi May 19 '15 at 12:22
  • Hello, thanks a lot for the beautiful diagram. Unfortunetely I have the following error: ! Arrow direction argument must contain only the characters l, r, u or d. I use the class scrbook. –  May 19 '15 at 12:58
2

To make lines with a matrix as base you will need to name the matrix and use \path. I removed your empty columns and used this example as reference: http://www.texample.net/tikz/examples/commutative-diagram-tikz/

To make the vertical dots I create named nodes in the middle of the edges that go from the second row to the last row. I fill each node with white to hide the edge and add another edge from the second row to the node to get the arrow.

Unfortunately \vdots has extra space on top, so instead I used the alternative presented here: How to vertically center the \vdots in this node?

The forth row is empty and has no height. To make sure X and Y appear centered you need to add some phantom content to the row, like \phantom{C}.

% vertical dots without extra space on top
\makeatletter
\DeclareRobustCommand{\rvdots}{%
  \vbox{
    \baselineskip4\p@\lineskiplimit\z@
    \kern-\p@
    \hbox{.}\hbox{.}\hbox{.}
  }}
\makeatother

\begin{tikzpicture}
\matrix (m) [matrix of math nodes,row sep=2em,column sep=2em]{
  & C_{0,1} & C_{0,2} & \cdots & C_{0,n-1}   &   \\
  & C_{1,1} & C_{1,2} & \cdots & C_{1,n-1}   &   \\
X &         &         &        &             & Y \\
  &         &         &        & \phantom{C} &   \\
  & C_{k,1} & C_{k,2} & \cdots & C_{k,n-1}   &   \\
};
\path[-stealth]
    % X
    (m-3-1) edge [-] (m-1-2)
            edge [-] (m-2-2)
            edge [-] (m-5-2)
    % first row
    (m-1-2) edge [-] (m-1-3)
            edge (m-2-2)
    (m-1-3) edge [-] (m-1-4)
            edge (m-2-3)
    (m-1-4) edge [-] (m-1-5)
    (m-1-5) edge [-] (m-3-6)
            edge (m-2-5)
    % second row
    (m-2-2) edge [-] (m-2-3)
            edge node(vdots-2) [fill=white] {$\rvdots$} (m-5-2)
            edge (vdots-2)
    (m-2-3) edge [-] (m-2-4)
            edge node(vdots-3) [fill=white] {$\rvdots$} (m-5-3)
            edge (vdots-3)
    (m-2-4) edge [-] (m-2-5)
    (m-2-5) edge [-] (m-3-6)
            edge node(vdots-5) [fill=white] {$\rvdots$} (m-5-5)
            edge (vdots-5)
    % last row
    (m-5-2) edge [-] (m-5-3)
    (m-5-3) edge [-] (m-5-4)
    (m-5-4) edge [-] (m-5-5)
    (m-5-5) edge [-] (m-3-6)
    % Y is (m-3-6)
;
\end{tikzpicture}

Screenshot from pdf at 200%

2

A bit unfriendly in places, but it pretty much does the job...

\documentclass[tikz,border=5pt]{standalone}
\begin{document} 
\begin{tikzpicture}[x=1.5cm,y=1.25cm,>=stealth]
\foreach \i [count=\y] in {0,1,\vdots,k}
  \foreach \j [count=\x] in {1,2,\ldots,n-1}
    \node (C-\y-\x) at (\x,-\y+2.5) 
      {$\ifnum\y=3\ifnum\x=3\else\i\fi\else\ifnum\x=3\j\else C_{\i,\j}\fi\fi$};
\node at (0,0) (X) {$X$};
\node at (5,0) (Y) {$Y$};    
\foreach \j in {1,2,4}{
  \foreach \i [count=\k from 2] in {1,2,3}
     \draw [->] (C-\j-\i) -- (C-\j-\k) (C-\i-\j) -- (C-\k-\j);
  \draw (X) -- (C-\j-1) (C-\j-4) -- (Y);
}
\end{tikzpicture}
\end{document}

enter image description here

Mark Wibrow
  • 70,437