2

I would like to be create diagrams using TikZ that have a number on the side of the page (like the equation environment makes) that I can label using \label and cross-reference using \ref.

Essentially, I am looking for something like \tag that works inside the tikzpicture environment.

For a concrete example, I would like to create something like the first two diagrams on the following page. enter image description here

Does anyone know how this can be done in TikZ specifically?

3

You can put everything you like into the equation environment. Like this, it will behave like an equation which seems to be what you want.

% arara: pdflatex

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

\begin{document} 
\setcounter{page}{15}
\noindent
into a commutative diagramm 
\begin{equation}
    \begin{tikzcd}
        B\times_A C \arrow{r}{\pi_2}\arrow{d}[swap]{\pi_1} & C\arrow{d}{g} \\
        B \arrow{r}[swap]{f} & A;
    \end{tikzcd}
\end{equation}
\blindtext

In a general category $C$, one says that a commutative square
\begin{equation}
    \begin{tikzcd}
        P \arrow{r}{q}\arrow{d}[swap]{p} & C\arrow{d}{g} \\
        B \arrow{r}[swap]{f} & A
    \end{tikzcd}
\end{equation}
\blindtext
\end{document} 

enter image description here


If you which to have the last diagram as well:

\begin{equation*}
    \begin{tikzcd}
        X\arrow{drr}{\gamma}\arrow[dashed]{dr}[near end]{!\delta}\arrow{ddr}[swap]{\beta} & & \\[1ex]
        & P \arrow{r}{q}\arrow{d}[swap]{p} & C\arrow{d}{g} \\
        & B \arrow{r}[swap]{f} & A
\end{tikzcd}
\end{equation*}
| improve this answer | |
  • Thank you! This is exactly what I was looking for. I can't believe I never tried sticking a TikZ environment inside equation... – Artem Mavrin Sep 11 '15 at 10:19
  • @ArtemMavrin Glad to hear that. Sometimes, things are that clear that one can oversee them... :-) – LaRiFaRi Sep 11 '15 at 10:24

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.