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}
1
  • You might want to use tikz-cd package for this purpose.
    – percusse
    May 19, 2015 at 10:34

4 Answers 4

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%

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

10
  • 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.
    – user77998
    May 19, 2015 at 13:05
  • I don't know why but instead of your horizontal bars I have horizontal arrows. Any idea ?
    – user77998
    May 19, 2015 at 13:08
  • Where I have to write \listfiles ?
    – user77998
    May 19, 2015 at 13:18
  • I have Package: tikz-cd 2012/03/18 v0.2b Commutative diagrams with tikz.
    – user77998
    May 19, 2015 at 13:23
  • What is the line of command I have to write in the terminal please ?
    – user77998
    May 19, 2015 at 14:00
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

4
  • 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, 2015 at 11:31
  • 1
    @LaRiFaRi Interesting! Why don't you add it to your answer?
    – egreg
    May 19, 2015 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, 2015 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.
    – user77998
    May 19, 2015 at 12:58
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy