Diagram examples
Creating Diagrams in Category Theory
This page provides examples of different diagram types available for category theory notes.
Commutative Diagrams with MathJax
Use the AMScd package for simple commutative diagrams:
Basic Square Diagram
\[\begin{CD} A @>f>> B\\ @VgVV @VVhV\\ C @>>k> D \end{CD}\]Code:
$$
\begin{CD}
A @>f>> B\\
@VgVV @VVhV\\
C @>>k> D
\end{CD}
$$
Triangle Diagram
\[\begin{CD} A @>f>> B\\ @| @VVgV\\ A @>>h> C \end{CD}\]Functor Diagram
\[\begin{CD} F(A) @>F(f)>> F(B)\\ @V\eta_AVV @VV\eta_BV\\ G(A) @>>G(f)> G(B) \end{CD}\]Product Diagram
\[\begin{CD} @. A \times B @.\\ @. @V\pi_1VV @VV\pi_2V @.\\ @. A @. B \end{CD}\]String Diagrams (SVG)
For string diagrams (used in monoidal categories), use inline SVG:
Identity Wire
Cup (Creation/Unit)
Map $\eta: I \to A \otimes A^*$ - creates a pair from nothing:
Cap (Evaluation/Counit)
Map $\epsilon: A^* \otimes A \to I$ - evaluates a pair to nothing:
Zigzag (Snake Equation)
The yanking identity: $(1_A \otimes \epsilon) \circ (\eta \otimes 1_A) = 1_A$
Morphism Box
Composition
Tensor Product
Braiding
String Diagram Notation
String diagrams use graphical elements to represent categorical structures:
- Wires (straight lines): Represent objects flowing through the diagram
- Boxes: Represent morphisms/functions transforming objects
- Curves: Special morphisms like cups (creation) and caps (evaluation)
- Connections: Composition shown by joining wires vertically
Reading String Diagrams
Convention: Diagrams can be read from bottom to top (objects flow upward) or top to bottom (composition flows downward). In these notes, we read top to bottom.
Commutative Diagram Notation (AMScd)
Arrow styles for commutative diagrams:
-
@>>>: Long right arrow -
@>label>>: Right arrow with label above -
@VVV: Down arrow -
@VlabelVV: Down arrow with label on left -
@AAA: Up arrow -
@AAlabelA: Up arrow with label on left -
@<<<: Left arrow -
@=: Equals sign (for identities) -
@|: Vertical bar -
@.: Empty cell (for spacing)
Tips for Good Diagrams
- Keep it simple: Start with AMScd for basic commutative diagrams
-
String diagrams: Use the
string-diagramclass for monoidal category diagrams - Complex cases: Use TikZ only when AMScd isn’t sufficient
- Labels: Keep labels concise and readable
- Spacing: Use proper spacing for readability
- Dark mode: All diagram styles are dark-mode compatible
Common Patterns
Adjunction
\[\begin{CD} @. F(A) @.\\ @. @| @.\\ \text{Hom}(F(A), B) @>{\cong}>> \text{Hom}(A, G(B)) \end{CD}\]Limit Cone
\[\begin{CD} @. L @.\\ @. @VVV @.\\ A @>>f> B @<g<< C \end{CD}\]Yoneda Lemma
\[\begin{CD} \text{Nat}(\text{Hom}(A, -), F) @>{\cong}>> F(A)\\ @. @VV{\alpha \mapsto \alpha_A(\text{id}_A)}V\\ @. F(A) \end{CD}\]See: