# Identity and a morphism

> A wire is the identity on an object; a box on a wire is a morphism from the object below to the object above. A String diagrams example with its LaTeX source.

A String diagrams example in the TeXeR TikZ library: https://texer.org/library/string-diagrams/morphism

Package: [String diagrams](https://texer.org/library/string-diagrams.md), on CTAN at https://ctan.org/pkg/pgf.

Tags: identity, morphism, string diagram

## Source

```latex
\begin{tikzpicture}[thick, baseline=(current bounding box.center)]
  \draw (0,0) node[below] {$A$} -- (0,2) node[above] {$A$};
  \draw (2,0) node[below] {$A$} -- (2,2) node[above] {$B$};
  \node[draw, fill=white, minimum width=8mm, minimum height=6mm] at (2,1) {$f$};
\end{tikzpicture}
```

## As a complete document

The same example in a document that compiles on its own with pdfLaTeX:

```latex
\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{amssymb}

\begin{document}
\begin{tikzpicture}[thick, baseline=(current bounding box.center)]
  \draw (0,0) node[below] {$A$} -- (0,2) node[above] {$A$};
  \draw (2,0) node[below] {$A$} -- (2,2) node[above] {$B$};
  \node[draw, fill=white, minimum width=8mm, minimum height=6mm] at (2,1) {$f$};
\end{tikzpicture}
\end{document}
```
