5

Background. I recently came across a Youtube video with a bunch of really nicely typeset 'diagram chases' that seem to have been made in TeX (perhaps TikZ?):

Exmples of a diagram chase

I'd like to create something similar for a presentation that I'm working on, but I feel a bit lost when it comes to figuring out a systematic/scalable way to this.

Own attempt. For small diagrams, it's possible to do this in a very ad hoc way, by just playing around with coordinates and the bend right and bend left attributes in TikZ. A quick example of what this might look like:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}

\begin{document}

\begin{tikzpicture}[scale=1.5, bend left=15, bend right=15]

        \node (B) at (0,0) {$B$};
        \node (B') at (0,-1) {$B'$};
        \node (C) at (1,0) {$C$};
        \node (C') at (1,-1) {$C'$};

        \draw[->,gray] (B) -- (B');
        \draw[->,gray,shorten >= -1pt] (B') -- (C');
        \draw[->,gray,shorten >= -1pt] (B) -- (C);
        \draw[->,gray] (C) -- (C');

        \node (b) at (-0.3,0.2) {\footnotesize $b$};
        \node (bprime) at (-0.3,-1.2) {\footnotesize $b'$};
        \node (cbar) at (0.7,0.2) {\footnotesize $\bar{c}$};
        \node (cdiff) at (0.7,-1.3) {\footnotesize $c'-c''$};

        \path (b) edge [{|[scale=0.7]}-{>[scale=0.7]},bend left] node [left] {} (cbar);
        \path (b) edge [{|[scale=0.7]}-{>[scale=0.7]},bend right] node [left] {} (bprime);
        \path (bprime) edge [{|[scale=0.7]}-{>[scale=0.7]},bend right] node [left] {} (cdiff);
        \path (cbar) edge [{|[scale=0.7]}-{>[scale=0.7]},bend right, shorten >= -2pt, shorten <= -1pt] node [left] {} (cdiff);

\end{tikzpicture}

\end{document}

Result of own attempt

I think this gives a decent end result. But for larger diagrams, it would be an absolute nightmare to work with a code that is so messy and so heavily dependent on coordinates and tweaked parameters.

Thus, if anyone has suggestions (big or small) for a more clever way to do this (with or without TikZ) and/or a way to make my own approach a bit cleaner or more systematic somehow, that would be greatly appreciated!

  • Any other tools that you think could be useful? I'm definitely willing to try out other tools than TikZ if need be! – Oskar Henriksson Apr 15 at 4:38
6

We clearly can't avoid difficulties and complexity when dealing with such a complicated graph when using any kinds of tool, but by using matrices it has saved a lot of work.

\documentclass[tikz]{standalone}
\usetikzlibrary{matrix,positioning,arrows.meta}
\usepackage{mathptmx}
\tikzset{toarrow/.style={{|[scale=0.7]}-{>[scale=0.7]}},
    backarrow/.style={{<[scale=0.7]}-{|[scale=0.7]}}}
\begin{document}
\begin{tikzpicture}
\matrix[matrix of math nodes,row sep=2cm,column sep=2cm] (m) {%
A & B & C & D & E\\
A' & B' & C' & D' & E'\\};
\path   (m-1-2) node[above left=1.5ex and 1.5ex] (b) {$b$}
        (m-1-3) node[above left=1.5ex and 1.5ex] (c) {$c$}
        (m-1-4) node[above left=1.5ex and 1.5ex] (d) {$d$}
        (m-1-5) node[above left=1.5ex and 1.5ex] (e) {$e$}   
        (m-2-2) node[below left=1.5ex and 1.5ex] (b2) {$b'$}
        (m-2-3) node[below left=1.5ex and 1.5ex] (c2) {$c'$}
        (m-2-4) node[below left=1.5ex and 1.5ex] (d2) {$d'$}
        (m-2-5) node[below left=1.5ex and 1.5ex] (e2) {$0$}
        (m-2-3) node[above left=1.5ex and 1.5ex] (c3) {$c''$}
        (c) node[above left=1.5ex and -1.5ex] (cp) {$\overline{c}+c$}
        (c2) node[below=1.5ex] (cm) {$c'-c''$}
        (d2) node[below=1.5ex] (db) {$0$}
        (e.base east) node[above right=-.3333em and -1ex] {$=0$}
        (c.base west) node[above left=-.3333em and 1.5ex] (co) {$\overline{c}$};
% Delete the following part to see what happens
\foreach \i [count=\j from 2] in {1,2,3,4} {
    \draw[dotted,->] (m-1-\i) -- (m-2-\i);
    \draw[dotted,->] (m-1-\i) -- (m-1-\j);
    \draw[dotted,->] (m-2-\i) -- (m-2-\j);
}
\draw[dotted,->] (m-1-5) -- (m-2-5);
\draw[toarrow] (b) edge[bend right] (b2) edge[bend left] (co);
\draw[toarrow] (b2) to[bend right] (cm);
\draw[toarrow] (cm) to[bend right] (db);
\draw[toarrow] (co) to[bend right] (cm);
\draw[toarrow] (cp) to[bend right] (c2);
\draw[toarrow] (c) edge[bend right] (c3) edge[bend left] (d);
\draw[backarrow] (d2) edge[bend left] (c2) edge[bend right=20] (c3) edge[bend left] (d);
\draw[backarrow] (e2) edge[bend left] (d2) edge[bend left] (e);
\draw[toarrow] (d) edge[bend left] (e);
\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

Not the answer you're looking for? Browse other questions tagged or ask your own question.