Newcomers wanting to use TikZ to create commutative diagrams face a varied (non-uniform) approach.
I found this simple method to create a commutative diagram:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\begin{document}
$$\begin{tikzpicture}[node distance=2cm, auto]
\node (C) {$C$};
\node (P) [below of=C] {$\prod_{i \in I} A_i$};
\node (Ai) [right of=P] {$A_i$};
\draw[->] (C) to node {$f_i$} (Ai);
\draw[->, dashed] (C) to node [swap] {$\langle f_i \rangle_{i \in I}$} (P);
\draw[->] (P) to node [swap] {$\pi_i$} (Ai);
\end{tikzpicture}$$
\end{document}
Which produces a neat commutative diagram:
I wished to adapt this for my own commutative diagram. The code is as below:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\begin{document}
$$\begin{tikzpicture}[node distance=2cm, auto]
\node (V) {$V$};
\node (FAI) [right of= V] {$FAI(V)$};
\node (CL) [below of= FAI] {$CL(V,q)$};
\draw[->] (V) to node (FAI);
\draw[->, dashed] (FAI) to node (CL);
\draw[->] (V) to node (CL);
\end{tikzpicture}$$
\end{document}
However, my diagram produces the compile error: "Package tikz Error: (, +, coordinate, pic, or node expected."
Reading on TeX, I have noticed users recommend alternative methods to draw commutative diagrams.
- What are current best practices (best packages to use, etc.)
- How do I use these best practise methods to accomplish my (simple) commutative diagram?
Best Answer
Here there is my version with
tikz-cd
. It is very easy to create simple and complex commutative diagrams.Advice: do not worry about the background because It does not appear. Your initial code it is into this link.