Sarmate.net Sarmate.net
Home Features Pricing Documentation Contact
Log in Sign up
Back to gallery
Math EN

Commutative diagram with TikZ-cd

Sarmate sarmate_examples 2026-05-02 0 17

Minimal commutative diagram drawn with the tikz-cd library — square shape with four objects A, B, C, D and four labelled morphisms f, g, h, k. The library handles arrow routing, label placement, and spacing automatically. Drop-in replacement for old XY-pic diagrams.

Open in demo Sign in to like
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{cd}
\begin{document}
\begin{tikzcd}[row sep=large, column sep=large]
  A \arrow[r, "f"] \arrow[d, "g"'] & B \arrow[d, "h"] \\
  C \arrow[r, "k"'] & D
\end{tikzcd}
\end{document}
This example is licensed under CC‑BY‑4.0. You may copy, modify, and redistribute it as long as you credit the author (Sarmate sarmate_examples).