```R
\def\zxEnableIntersectionsNodes{}%
\tikzset{
    /zx/user overlay wires/.style={
        %% Nbase changes both N-like and >-like styles.
        %% Use N/.append to change only N-like.
        Nbase/.append style={%
            ui, % intersection only for arrows based on N (N and <)
        },
        edge above, % For debugging
        control points visible % For debugging
    }
}
\def\zxDebugMode{}
\def\zxControlPointsVisible{}
\begin{ZX}[
    execute at begin picture={%
        %% Definition of long items (the goal is to have a small and readable matrix
        % (warning: macro can't have numbers in TeX. Also, make sure not to use existing names)
        \def\Zpifour{\zxFracZ[a=Zpi4]-{\pi}{4}}%
        \def\mypitwo{\zxFracX[a=mypi2]{\pi}{2}}%
    }
]
%% Matrix: in emacs "M-x align" is practical to automatically format it. a is for 'alias'
& \zxN[a=n]{} & \zxZ[a=\xmiddle]{} & & & \zxN[a=\out1]{} \\
\zxN[a=\in1]{} & \Zpifour{} & \zxX[a=Xdoun]{} & & \mypitwo{} & \\
& & & & \zxN[a=\out2]{} \\
\zxN[a=\in2]{} & \zxX[a=X1]{} & \zxZ[a=\toprightpi]{\pi} & & & \zxN[a=\out3]{} \\
%% Arrows
% Column 1
\ar[from=\in1,to=X1,s]
\ar[from=\in2,to=Zpi4,..]
% Column 2
\ar[from=X1,to=\xmiddle,N']
\ar[from=X1,to=\toprightpi,H]
\ar[from=Zpi4,to=n,C] \ar[from=n,to=\xmiddle,wc]
\ar[from=Zpi4,to=Xdoun]
% Column 3
\ar[from=\xmiddle,to=Xdoun,C-]
\ar[from=\xmiddle,to=mypi2,'>]
% Column 4
\ar[from=\toprightpi,to=mypi2,-N]
\ar[from=mypi2,to=\out1,<']
\ar[from=mypi2,to=\out2,<.]
\ar[edge above,use intersections,from=Xdoun,to=\out3,<.]
\end{ZX}
```

### \zxIntersectionLineBetweenStartEnd

/zx/wires definition/intersections mode between start end (style, no value)

/zx/wires definition/intersections mode bezier controls (style, no value)

Node that we also defined another intersection mechanism, in which the intersection with the node boundary is computed using the line that links the two fake centers of the starting and ending point. To use it, either define `\def\zxIntersectionLineBetweenStartEnd{}` or use the style `intersections between start end` (or to come back to the normal intersection mode `intersections bezier controls`). Note that this just changes the mode of computing intersections, but does not enable intersections, you still need to enable intersections as explained above (for instance using `use intersection`, or `ui` if you also want to load our style). Note however that we don't spent too much effort in this mode as the result is often not really appealing, in particular the o shapes, and therefore we designed no special style for it and made only a few tests.

<figure><img src="image_222.png" /></figure>
```math
{%
  \def\zxEnableIntersectionsNodes{}
  \begin{ZX}
    \zxX{\alpha} \ar[rd,N]\\ & \zxX{\beta}
    \end{ZX} $\Rightarrow$ $\beta$ between start end \begin{ZX}
    \zxX{\alpha} \ar[edge above,rd,ui,intersections mode between start end,N]\\ & \zxX{\beta}
    \end{ZX}.
  \begin{ZX}
    \zxX{\alpha} \ar[r,o'] \ar[r,o.] & \zxX{\beta}
    \end{ZX} $\Rightarrow$ $\beta$ between start end \begin{ZX}
    \zxX{\alpha} \ar[r,ui,intersections mode between start end,o']
      \ar[r,ui,intersections mode between start end,o.] & \zxX{\beta}
    \end{ZX}.
```

## 5.4 Nested diagrams

If you consider this example:

<figure><img src="image_223.png" /></figure>

```math
Alone \begin{ZX}
  \zxX{} \rar \ar[r,o'] \ar[r,o.] & \zxZ{}
\end{ZX} %
in a diagram %
\begin{ZX}[math baseline=myb]
  &[\zxwCol] \zxFracX-\{\pi\}{2} & \zxX{}
  \rar
  \ar[r,o']
  \ar[r,o.] & \zxZ{} & [\zxwCol]\\
  \zxN[a=myb]{\} \rar & \zxFracZ{\pi}{2} \rar & \zxFracX{\pi}{2} \rar & \zxFracZ{\pi}{2} \rar & \zxN{}
\end{ZX}
```

You can see that the constant looks much wider in the second picture, due to the fact that the nodes below increase the column size. One solution I found for this problem is to use `savebox` to create your drawing *before* the diagram, and then use the `fit` library to include it where you want in the matrix (see below for a command that does that automatically):

<figure><img src="image_224.png" /></figure>

```math
% Create a new box
\newsavebox{\myZXbox}
% Save our small diagram.
% Warning: on older versions, you needed to use \& instead of &
% (the char ' &' cause troubles in functions), but I fixed it 2022/02/09
\sbox{\myZXbox}{%}
% add \tikzset{external/optimize=false} if you use tikz "external" library %
\zx{ % you may need
  \zxX{} \rar \ar[r,o'] \ar[r,o.] & \zxZ{}
}%
}
$x = \begin{ZX}[
  execute at end picture={
    % Add our initial drawing at the end:
    \node[fit=(start)(end),yshift=-axis_height] {\usebox{\myZXbox}};
  },
  math baseline=myb]
    &[\zxwCol] \zxFracX-\{\pi\}{2} & \zxN[a=\start]{\} & \zxN[a=\end]{\}\\
  \zxN[a=myb]{\} \rar & \zxFracZ{\pi}{2} \rar & \zxFracX{\pi}{2} \rar & \zxFracZ{\pi}{2} \rar & \zxN{}
\end{ZX}$
```

Note that this has the advantage of preserving the baseline of the big drawing. However, it is
a bit cumbersome to use, so we provide here a wrapper that automatically does the following code
(this has not been tested extensively, and may be subject to changes):

$\zxSaveDiagram{\langle name with backslash \rangle}[\langle zx options \rangle]{\langle diagram with ampersand \& \rangle}$
$\text{/zx/wires definition/use diagram={\langle name with \rangle}{\langle (nodes)(to)(fit) \rangle}}$ (style, no default)

Use \zxSaveDiagram to save and name a diagram (must be done before the diagram you want to insert this diagram into, also do not forget the backslash before the name (note that before 2022/09/02, you needed to use \& instead of & , but this has been fixed after 2022/02/09. In case you really care about backward compatibility, either download the sty file in your folder, or add ampersand replacement=\& in the options of the \zxSaveDiagram function and use \& as before). Then, use diagram to insert it inside a diagram (the second argument is a list of nodes given to the fit library):

$$x = -\left(\frac{\pi}{2} \right) \circled{=} \left(\frac{\pi}{2} \right) \circled{=} \left(\frac{\pi}{2} \right)$$

```math
\% \qquad v--- note the backslash
\zxSaveDiagram{\myZXconstant}{\zxX{} \rar \ar[r,o'] \ar[r,o.] & \zxZ{}}
$x = \begin{ZX}[use diagram={\myZXconstant}{(start)(end)}, math baseline=myb]
    &[\zxwCol] \zxFracX-{\pi}{2} & \zxN[a(start)] & \zxN[a=end]\\
\zxN[a=myb] \ \rar & \zxFracZ{\pi}{2} \ \rar & \zxFracX{\pi}{2} \ \rar & \zxFracZ{\pi}{2} \ \rar & \zxN{}
\end{ZX}$
```

Note that if you need more space to insert the drawing, you can use \zxN+ [a(start, minimum width=2cm)]{} instead of \zxN.

Sometimes, you may also find useful to stack diagram (for instance because the matrix of the first diagram is not related to the matrix of the second diagram), or position multiple diagrams relative to each others. You can use arrays to do that, but it will not preserve the baseline. Another solution is to put the ZX environment inside nodes contained in tikzpicture (I know that tikz does not like nesting... but it works nice for what I tried. I will also try to provide an helper function to do that later). For example here we use it to add the constants below the second diagram:

<figure><img src="image_225.png" /></figure>
```math
\begin{equation*}
\begin{ZX}
    &[\zxwCol] & &[\zxwCol] \zxN{} \ar[dd,3 vdots] \\
    \zxN{} \rar & \zxZ{\pi} \rar & \zxX{\alpha} \ar[ru,N'-] & \ar[rd,N.-] & \\
    & & & \& \zxN{}
\end{ZX} =
\begin{tikzpicture}[
    baseline=(A.base)
]
\node[inner sep=Opt] (A){%}
    \begin{ZX}
        &[\zxwCol] & \zxZ{\pi} \ar[dd,3 vdots] \rar &[\zxwCol] \zxN{} \\
        \zxN{} \rar & \zxX{-\alpha} \ar[ru,N'-] \ar[rd,N.-] & \\
        & & & \& \zxZ{\pi} \rar & \zxN{}
    \end{ZX}
};
\node[inner sep=Opt,below=\zxDefaultColumnSep of A] (B){
    \begin{ZX}
        \zxOneOverSqrtTwo{} & \zxX{\alpha} \rar & \zxZ{\pi}
    \end{ZX}
};
\end{tikzpicture}
\end{equation*}
```

## 5.5 Further customization

You can further customize your drawings using any functionality from TikZ and tikz-cd (but it is of course at your own risk). For instance, we can change the separation between rows and/or columns for a whole picture (but prefer to use `zx row sep` as it also updates pre-configured column spaces):

<figure><img src="image_226.png" /></figure>

```math
\begin{ZX}[row sep=1mm]
    & & & & & \& \zxZ{\pi} \\
    \zxN{} \rar & \zxX{} \ar[rd, (.) \ar[urrr, (', H)] & & & & \& \& \& \zxN{} \\
    & & & & & \& \zxZ{} \ar[rd, s.] \rar & \\
    \zxFracX{\pi}{2} \ar[uur, (') \ar[rru, <'] \ar[rr] & & \& \zxN{} \\
    \zxN{} \rar & \zxFracZ{-\pi}{4} \ar[ru, (') \ar[rr, o.] & & \& \zxX{} \ar[rr] & & \& \zxN{}
\end{ZX}
```

You can also use the tikz between origins option in order to specify the distance between the center of the rows and not between their borders. This is particularly practical when gates have different heights, or if you want to compare two diagram with different content (you might also want to use something like `mbr=1.5` to set the math baseline between two lines):

<figure><img src="image_227.png" /></figure>

```math
$\begin{ZX}[circuit, row sep={.6cm, between origins}]
    \rar & \zxCross{} \rar \dar & \\
    \rar & \zxCross{} \rar & \\
\end{ZX} =
\begin{ZX}[circuit, row sep={.6cm, between origins}]
    \rar & \zxN{} \ar[rd,s] & \zxN{} \rar & \\
    \rar & \zxN{} \ar[ru,s] & \zxN{} \rar & \\
\end{ZX}$
```

Or we can define our own style to create blocks:
<figure><img src="image_228.png" /></figure>

```r
{ % \usetikzlibrary{shadows}
\tikzset{
    my bloc/.style={
        anchor=center,
        inner sep=2pt,
        inner xsep=.7em,
        minimum height=3em,
        draw,
        thick,
        fill=blue!10!white,
        double copy shadow={opacity=.5}, tape,
    }
}
\zx{|[my bloc]| f \rar &[1mm] |[my bloc]| g \rar &[1mm] \zxZ{\alpha} \rar & \zxNone{}}
}
```

We can also use for instance `fit`, `alias`, `execute at end picture` and layers (the user can use `background` for things behind the drawing, `box` for special nodes above the drawings (like multi-column nodes, see below), and `foreground` which is even higher) to do something like that:

CNOT

<figure><img src="image_229.png" /></figure>

```r
% \usetikzlibrary{fit}
\begin{ZX}[
    execute at end picture={
        \node[
            inner sep=2pt,
            node on layer=background, %% Ensure the node is behind the drawing
            rounded corners,
            draw=blue,
            dashed,
            fill=blue!50!white,
            opacity=.5,
            fit=(cnot1)(cnot2), %% position of the node, thanks fit library
            "\textsc{cnot}" {above, inner sep=1mm} %% Adds label, thanks quote
            library. Not sure why, inner sep is set to 0 when using tikz "external"
            library.
        ] {};
    }
]
\zxNone{} \rar & \zxZ[alias=cnot1][] \dar \rar & \zxNone{}\\
\zxNone{} \rar & \zxX[alias=cnot2][] \rar & \zxNone{}\\
\end{ZX}
```

Because this code is quite lengthy and useful, we provide in section 4.6 a shorter syntax.

You can also use other libraries, in particular `nfold` can be practical to insert many wires at once (note that you need a recent version since it was introduced in CTAN 2023, or you need to manually install the library):

<figure><img src="image_230.png" /></figure>

```r
% \usetikzlibrary{nfold} % needs very recent CTAN > 2023, or manually copy the .tex files
\begin{ZX}[circuit]
\rar[scaling nfold=5]
    & \zxGate{X} \rar[rd, line join=round, double distance=2pt, scaling nfold=3,--|] & \\
    & & \zxGate{Y}
\end{ZX}
```
# 6 Future works

There is surely many things to improve in this library, and given how young it is there is surely many undiscovered bugs. So feel free to propose ideas or report bugs one the github page<fnref n="14" />. The intersections code is also quite slow, so I would be curious to check if I can optimize it (the first goal was to make it work). I should also work on the compatibility with tikzit (basically just write tikz configuration files that you can just use and document how to use tikzit with it), or even write a dedicated graphical tool (why not based on tikzit itself, or this tool<fnref n="15" />). I also want to find a nicer way to merge cells (for now I propose to use the fit library but it's not very robust against overlays) and to nest ZX diagrams. And of course fix typos in the documentation and write other styles, including notations not specific to ZX-calculus. Feel free to submit Pull Requests to solve that, or to submit bug reports to explain uncovered use-cases!

# 7 Acknowledgement

I'm very grateful of course to everybody that worked on these amazing field which made diagramatic quantum computing possible, and to the many StackExchange users that helped me to understand a bit more LATEX and TikZ (sorry, I don't want to risk an incomplete list, but many thanks to egreg, David Carlisle, cfr, percusse, Andrew Stacey, Henri Menke, SebGlav, Qrrbrbirlbel...). I also thank Robert Booth for making me realize how my old style was ugly, and for giving advices on how to improve it. Thanks to John van de Wetering and Alastair Kay (author of Quantikz), whose styles have also been a source of inspiration [vdWet20], and to Augusto Stoffel for the great tikzcd package on which this library is built.

# 8 Changelog

* 2024/03/15:

- Do not use semantic versioning anymore as LATEX seems not to support it: https://tex stackexchange com questions 713222 provides package with semantic versioning

* v2.2 (11/03/2024):

- Added slice with percentage position

* v2.1 (09/03/2024):

- Fix bug with arguments impossible:

Hey green!

Hey red!

Hey

```tex
\begin{ZX}[
  /utils/exec={
    \def\foo#1{
      \node[fill=#1,inner sep=2pt,rounded corners,alias=foo]{\text{Hey #1!}};
      \node[fill=#1!50!black,circle,inner sep=1pt] at (foo.north west) {};
    }
  }
]
\foo{green} & \foo{red} & |[foo/.style={color=#1},foo=red] | Hey
\end{ZX}
```

* v2.0 (22/12/2023, now using semantic versioning):

- Fix bugs with baseline like mbr=1.5

<footnote n="14">¹⁴https://github.com/leo-colisson/zx-calculus/issues</footnote>

<footnote n="15">¹⁵https://tikzcd.yichuanshen.de/</footnote>
- Fix bugs related to bracemulti (now can use multiple wires)

- Other bug fixes

- Add new line connection `--|`, `h--|` etc.

* 2023/09/26: Many updates in the past months:

- Custom nodes are made easy

- Multi-gates nodes and many circuit-related functions

- Added `post arrow style if start node` and other similar commands

- updated the doc to use the latest version of robust-externalize that is much simpler to use now...

- Some nodes can also now be usable outside tikzcd, but I've not tried (I should provide more options for this).

- Group gates

* 2022/02/09:

- Added compatibility with external tikz library

- More robust handling of `&`: align and macros does not need `\&` anymore.

- `\&` in `\zxSaveDiagram` is replaced with `&`. This introduces a small backward incompatibility, but hey, I said it was still subject to changes :-)

## 9 TODO

* I think that some anchors are not properly configured in stuff like `\zxBox` etc, so a nice sanity check should be done

* Clean the code, eventually

* Consider subnodes as anchors (fake center etc)

* more circuit related stuff

* multigate invisible element

* curly braces made easy

* lstick
classical key, 28
content inner nodes key, 25
control points not visible key, 81
control points visible key, 81
\dar, 35
default style nodes key, 75
default style wires key, 76
defaultEnvdebug mode key, 17
\dlar, 35
dont use intersections key, 82
down to up key, 41
\drar, 35
edge above key, 80
edge not above key, 80
end fake center east key, 41
end fake center north key, 41
end fake center south key, 41
end fake center west key, 41
end real center key, 41
end subnode key, 57
enlarge brace key, 29
Environments
  ZX, 10
every box key, 24
/every node/
  post arrow style if end node, 70
  post arrow style if start node, 70
  pre arrow style if end node, 70
  pre arrow style if start node, 70
fit content key, 25
force down to up key, 41
force left to right key, 41
force right to left key, 41
force up to down key, 41
gate input multi label style key, 29
gate input multi style key, 29
gate input style key, 29
gate output multi label style key, 29
gate output multi style key, 29
gate output style key, 29
H key, 48
I.SS key, 44
I.ss- key, 44
INN key, 47
input multi label style key, 29
input multi style key, 29
input style key, 29
intersections mode between start end key, 91
intersections mode bezier controls key, 91
invert top bottom key, 58
IO key, 50
IO/'> key, 53
IO/'> key, 54
IO/( key, 52
IO/( ' key, 52

IO/) key, 52
IO/-N' key, 54
IO/-N. key, 54
IO/-o key, 51
IO/-s' key, 52
IO/-s. key, 52
IO/./> key, 53
IO/.sIs key, 53
IO/.ss key, 53
IO/<' key, 53
IO/<. key, 53
IO/C key, 51
IO/C' key, 51
IO/C- key, 51
IO/I.ss- key, 53
IO/N' key, 54
IO/N'- key, 54
IO/N. key, 54
IO/N.- key, 54
IO/o' key, 51
IO/o- key, 51
IO/o. key, 51
IO/s key, 52
IO/s' key, 52
IO/s'- key, 52
IO/s. key, 52
IO/s.- key, 52
IO/sIs. key, 53
IO/ss key, 53
IO/ss. key, 53
IO/ss.I- key, 53
IO/v' key, 54
ISS key, 44
\lar, 35
left to right key, 41
\leftManyDots, 14
Libraries
  zx-calculus, 5
ls key, 55
main key, 25
main text key, 25
math baseline key, 18
math baseline row key, 18
mbr key, 18
\middleManyDots, 14
N key, 46
N' key, 46
N'- key, 46
N- key, 46
N. key, 46
N.- key, 46
NB key, 55
Nbase key, 46
NIN key, 47
NN key, 47
NN. key, 47
NNI key, 47
no fake center key, 41
non bold key, 55

o' key, 40

o- key, 40

o. key, 40

output multi label style key, 29

output multi style key, 29

output style key, 29

Packages and files

zx-calculus, 5

picCustomStyleAterUserMatrix key, 23

picCustomStyleBeforeUserMatrix key, 23

picCustomStyleLastPicMatrix key, 23

picCustomStyleMatrixLabel key, 23

picCustomStyleMatrixMainNode key, 23

post arrow style if end node key, 70

post arrow style if start node key, 70

pre arrow style if end node key, 70

pre arrow style if start node key, 70

\rar, 35

right to left key, 41

rounded style key, 77

rounded style preload/big minus key, 78

rounded style preload/content fixed also
frac key, 15

rounded style preload/content fixed
baseline key, 15

rounded style preload/content vertically
centered key, 15

rounded style preload/small minus key, 78

rounded style/BBw key, 56

rounded style/big minus key, 78

rounded style/Bw key, 56

rounded style/content fixed baseline key,
15

rounded style/content vertically centered
key, 15

rounded style/phase in content key, 16

rounded style/phase in label key, 16

rounded style/phase in label above key, 16

rounded style/phase in label below key, 16

rounded style/phase in label left key, 16

rounded style/phase in label right key, 16

rounded style/pil key, 16

rounded style/pila key, 16

rounded style/pilb key, 16

rounded style/pill key, 16

rounded style/pilr key, 16

rounded style/small minus key, 78

rounded style/wires bold key, 56

rounded style/zxAllNodes key, 77

rounded style/zxEmptyDiagram key, 77

rounded style/zxH key, 78

rounded style/zxHSmall key, 78

rounded style/zxLong key, 77

rounded style/zxLongX key, 77

rounded style/zxLongZ key, 77

rounded style/zxNone key, 77

rounded style/zxNone+ key, 77

rounded style/zxNone- key, 77

rounded style/zxNoneDouble key, 77

rounded style/zxNoneDouble+ key, 77

rounded style/zxNoneDouble- key, 77

rounded style/zxNoneDoubleI key, 77

rounded style/zxNoneI key, 77

rounded style/zxNoPhase key, 77

rounded style/zxNoPhaseSmall key, 77

rounded style/zxNoPhaseSmallX key, 77

rounded style/zxNoPhaseSmallZ key, 77

rounded style/zxNoPhaseX key, 77

rounded style/zxNoPhaseZ key, 77

rounded style/zxShort key, 77

rounded style/zxShortX key, 77

rounded style/zxShortZ key, 77

rounded style/zxSpiders key, 77

s key, 42

s' key, 42

S'- key, 43

s'- key, 43

S- key, 43

s- key, 43

s. key, 42

S.- key, 43

s.- key, 43

safe fit key, 25

SIS key, 44

sIs. key, 44

slice label style key, 31

slice line style key, 31

SS key, 44

ss key, 44

ss. key, 44

SS.I key, 44

ss.I- key, 44

SSI key, 44

start fake center east key, 41

start fake center north key, 41

start fake center south key, 41

start fake center west key, 41

start real center key, 41

start subnode key, 57, 58

stop subnode key, 58

thick lines key, 37

/tikz/

end subnode, 57

every node/

a, 17

block, 33

invert top bottom, 58

start subnode, 57, 58

stop subnode, 58

zx at origin, 57

zx create anchors, 58

zx filling style, 33

zx main node, 57

zx style from variable, 67

zx subnode, 57

zx thickness wires style, 37
```
\uar, 35
ui key, 83
\ular, 35
up to down key, 41
\urar, 35
use diagram key, 93
use intersections key, 82
user overlay key, 76
user overlay nodes key, 76
user overlay wires key, 76

v' key, 47
vertical slice label style key, 31
vertical slice line style key, 31

wc key, 48
wce key, 49
wcs key, 48
wire centered key, 48
wire centered end key, 49
wire centered start key, 48

X key, 48

Z key, 48
ZX environment, 10
\zx, 9
zx-calculus package, 5
/zx/
  args/
    -andL/, 80
    -andL/-, 41
    -andL/1 angle, 42
    -andL/1 angle and length, 42
    -andL/1-, 41
    -andL/1L, 41
    -andL/1a, 42
    -andL/1al, 42
    -andL/2 angle, 42
    -andL/2 angle and length, 42
    -andL/2-, 41
    -andL/2L, 42
    -andL/2al, 42
    -andL/L, 41
    -andL/a, 42
    -andL/al, 42
    -andL/angle, 42
    -andL/angle and length, 42
    -andL/default-S (default 1=-.8,1L=0), 80
    -andL/defaultN (default -=.2,L=).8), 80
    -andL/defaultN- (default 1=-.4,1L=0), 80
    -andL/defaultNIN (default 1=-0,1L=).6), 80
    -andL/defaultNN (default ), 80
    -andL/defaultO (default -=.2,L=).4), 80
    -andL/defaultS (default -=.8,L=0), 80
```

```
-andL/defaultS' (default -=.8,L=).2), 80
-andL/defaultSIS (default 1=-0,1L=).8), 80
-andL/negate-, 42
-andL/negate1-, 42
-andL/negate1L, 42
-andL/negate2-, 42
-andL/negate2L, 42
-andL/negateL, 42
-andL/oneMinus1-, 42
-andL/oneMinus1L, 42
-andL/oneMinus2-, 42
-andL/oneMinus2L, 42
-andL/symmetry, 42
-andL/symmetry-L, 42
boxes, 24
default style nodes, 75
default style wires, 76
defaultEnv/
  amp, 10
circuit, 25
math baseline, 18
math baseline row, 18
mbr, 18
thick lines, 37
zx column sep, 78, 79
zx row sep, 80
defaultEnvdebug mode, 17
enlarge brace, 29
every box, 24
gate input multi label style, 29
gate input multi style, 29
gate input style, 29
gate output multi label style, 29
gate output multi style, 29
gate output style, 29
generic multi/
  add label, 25
  add label advanced, 25
  additional code, 25
  content inner nodes, 25
  fit content, 25
  main, 25
  main text, 25
  safe fit, 25
input multi label style, 29
input multi style, 29
input style, 29
output multi label style, 29
output multi style, 29
output style, 29
picCustomStyleAterUserMatrix, 23
picCustomStyleBeforeUserMatrix, 23
picCustomStyleLastPicMatrix, 23
picCustomStyleMatrixLabel, 23
picCustomStyleMatrixMainNode, 23
slice label style, 31
slice line style, 31
styles/
  rounded style, 77
```
<table>
  <tbody>
    <tr>
      <td>rounded style preload/big minus, 78</td>
      <td>vertical slice label style, 31</td>
    </tr>
    <tr>
      <td>rounded style preload/content fixed also frac, 15</td>
      <td>vertical slice line style, 31</td>
    </tr>
    <tr>
      <td>rounded style preload/content fixed baseline, 15</td>
      <td>wires definition/'>, 47</td>
    </tr>
    <tr>
      <td>rounded style preload/content vertically centered, 15</td>
      <td>'v, 47</td>
    </tr>
    <tr>
      <td>rounded style preload/small minus, 78</td>
      <td>(, 40</td>
    </tr>
    <tr>
      <td>rounded style/BBw, 56</td>
      <td>(' , 40</td>
    </tr>
    <tr>
      <td>rounded style/big minus, 78</td>
      <td>), 40</td>
    </tr>
    <tr>
      <td>rounded style/Bw, 56</td>
      <td>--|, 38</td>
    </tr>
    <tr>
      <td>rounded style/content fixed baseline, 15</td>
      <td>-N, 46</td>
    </tr>
    <tr>
      <td>rounded style/content vertically centered, 15</td>
      <td>-N', 46</td>
    </tr>
    <tr>
      <td>rounded style/phase in content, 16</td>
      <td>-N., 46</td>
    </tr>
    <tr>
      <td>rounded style/phase in label, 16</td>
      <td>-S, 43</td>
    </tr>
    <tr>
      <td>rounded style/phase in label above, 16</td>
      <td>-S', 43</td>
    </tr>
    <tr>
      <td>rounded style/phase in label below, 16</td>
      <td>-S., 43</td>
    </tr>
    <tr>
      <td>rounded style/phase in label left, 16</td>
      <td>-o, 40</td>
    </tr>
    <tr>
      <td>rounded style/phase in label right, 16</td>
      <td>-s, 43</td>
    </tr>
    <tr>
      <td>rounded style/pil, 16</td>
      <td>-s', 43</td>
    </tr>
    <tr>
      <td>rounded style/pilb, 16</td>
      <td>-s., 43</td>
    </tr>
    <tr>
      <td>rounded style/pill, 16</td>
      <td>>, 47</td>
    </tr>
    <tr>
      <td>rounded style/pilr, 16</td>
      <td>.NN, 47</td>
    </tr>
    <tr>
      <td>rounded style/small minus, 78</td>
      <td>.SIS, 44</td>
    </tr>
    <tr>
      <td>rounded style/wires bold, 56</td>
      <td>.sIs, 44</td>
    </tr>
    <tr>
      <td>rounded style/zxAllNodes, 77</td>
      <td>.ss, 44</td>
    </tr>
    <tr>
      <td>rounded style/zxEmptyDiagram, 77</td>
      <td>&lt;' , 47</td>
    </tr>
    <tr>
      <td>rounded style/zxH, 78</td>
      <td>&lt;., 47</td>
    </tr>
    <tr>
      <td>rounded style/zxHSmall, 78</td>
      <td>|-- , 38</td>
    </tr>
    <tr>
      <td>rounded style/zxLong, 77</td>
      <td>3 dots, 48</td>
    </tr>
    <tr>
      <td>rounded style/zxLongX, 77</td>
      <td>3 vdots, 48</td>
    </tr>
    <tr>
      <td>rounded style/zxLongZ, 77</td>
      <td>3d above, 37</td>
    </tr>
    <tr>
      <td>rounded style/zxNone, 77</td>
      <td>B, 55</td>
    </tr>
    <tr>
      <td>rounded style/zxNone+, 77</td>
      <td>between none, 55</td>
    </tr>
    <tr>
      <td>rounded style/zxNone-, 77</td>
      <td>bezier, 49</td>
    </tr>
    <tr>
      <td>rounded style/zxNoneDouble, 77</td>
      <td>bezier 4, 49</td>
    </tr>
    <tr>
      <td>rounded style/zxNoneDouble+, 77</td>
      <td>bezier 4 x, 49</td>
    </tr>
    <tr>
      <td>rounded style/zxNoneDouble-, 77</td>
      <td>bezier 4 y, 49</td>
    </tr>
    <tr>
      <td>rounded style/zxNoneDoubleI, 77</td>
      <td>bezier x, 49</td>
    </tr>
    <tr>
      <td>rounded style/zxNoneI, 77</td>
      <td>bezier y, 49</td>
    </tr>
    <tr>
      <td>rounded style/zxNoPhase, 77</td>
      <td>Bn, 55</td>
    </tr>
    <tr>
      <td>rounded style/zxNoPhaseSmall, 77</td>
      <td>bn, 55</td>
    </tr>
    <tr>
      <td>rounded style/zxNoPhaseSmallX, 77</td>
      <td>Bn', 55</td>
    </tr>
    <tr>
      <td>rounded style/zxNoPhaseSmallZ, 77</td>
      <td>Bn'Args, 55</td>
    </tr>
    <tr>
      <td>rounded style/zxNoPhaseX, 77</td>
      <td>Bn-, 55</td>
    </tr>
    <tr>
      <td>rounded style/zxNoPhaseZ, 77</td>
      <td>Bn-Args, 55</td>
    </tr>
    <tr>
      <td>rounded style/zxShort, 77</td>
      <td>Bn., 55</td>
    </tr>
    <tr>
      <td>rounded style/zxShortX, 77</td>
      <td>Bn-Args, 55</td>
    </tr>
    <tr>
      <td>rounded style/zxShortZ, 77</td>
      <td>Bn-Args, 55</td>
    </tr>
    <tr>
      <td>rounded style/zxSpiders, 77</td>
      <td>bold, 55</td>
    </tr>
    <tr>
      <td>user overlay, 76</td>
      <td>boldn, 55</td>
    </tr>
    <tr>
      <td>user overlay nodes, 76</td>
      <td>boldn', 55</td>
    </tr>
    <tr>
      <td>user overlay wires, 76</td>
      <td>boldn-, 55</td>
    </tr>
    <tr>
      <td></td>
      <td>boldn., 55</td>
    </tr>
    <tr>
      <td></td>
      <td>C, 39</td>
    </tr>
    <tr>
      <td></td>
      <td>C', 39</td>
    </tr>
    <tr>
      <td></td>
      <td>C-, 39</td>
    </tr>
    <tr>
      <td></td>
      <td>C., 39</td>
    </tr>
    <tr>
      <td></td>
      <td>cl, 28</td>
    </tr>
    <tr>
      <td></td>
      <td>classical, 28</td>
    </tr>
    <tr>
      <td></td>
      <td>control points not visible, 81</td>
    </tr>
    <tr>
      <td></td>
      <td>control points visible, 81</td>
    </tr>
    <tr>
      <td></td>
      <td>dont use intersections, 82</td>
    </tr>
  </tbody>
</table>
down to up, 41
edge above, 80
edge not above, 80
end fake center east, 41
end fake center north, 41
end fake center south, 41
end fake center west, 41
end real center, 41
force down to up, 41
force left to right, 41
force right to left, 41
force up to down, 41
H, 48
horizontal --|, 38
horizontal |-->, 38
I.SS, 44
I.ss-, 44
INN, 47
intersections mode between start
end, 91
intersections mode bezier controls,
91
IO, 50
IO/>, 53
IO/'v, 54
IO/(, 52
IO/(', 52
IO/), 52
IO/-N', 54
IO/-N., 54
IO/-o, 51
IO/-s', 52
IO/-s., 52
IO/.>, 53
IO/.sIs, 53
IO/.ss, 53
IO/<', 53
IO/<., 53
IO/C, 51
IO/C', 51
IO/C-, 51
IO/I.ss-, 53
IO/N', 54
IO/N'-, 54
IO/N., 54
IO/N.-, 54
IO/o', 51
IO/o-, 51
IO/o., 51
IO/s, 52
IO/s', 52
IO/s'-, 52
IO/s., 52
IO/s.-, 52
IO/sIs., 53
IO/ss, 53
IO/ss., 53
IO/ss.I-, 53
IO/v', 54
ISS, 44
left to right, 41

ls, 55
N, 46
N', 46
N'-, 46
N-, 46
N., 46
N.-, 46
NB, 55
Nbase, 46
NIN, 47
NN, 47
NN., 47
NNI, 47
no fake center, 41
non bold, 55
o', 40
o-, 40
o., 40
right to left, 41
s, 42
s', 42
S'-, 43
s'-, 43
S-, 43
s-, 43
s., 42
S.-, 43
s.-, 43
SIS, 44
sIs., 44
SS, 44
ss, 44
ss., 44
SS.I, 44
ss.I-, 44
SSI, 44
start fake center east, 41
start fake center north, 41
start fake center south, 41
start fake center west, 41
start real center, 41
ui, 83
up to down, 41
use diagram, 93
use intersections, 82
v', 47
vertical --|, 38
vertical |-->, 38
wc, 48
wce, 49
wcs, 48
wire centered, 48
wire centered end, 49
wire centered start, 48
X, 48
Z, 48
zx at origin key, 57
zx column sep key, 78, 79
zx create anchors key, 58
zx filling style key, 33
zx main node key, 57
zx row sep key, 80
zx style from variable key, 67
zx subnode key, 57
zx thickness wires style key, 37
\zxAmp, 10
\zxBox, 24
\zxCont, 74
\zxContName, 74
\zxControlPointsVisible, 81
\zxConvertToFracInContent, 78
\zxConvertToFracInLabel, 78
\zxCoordinateMain, 57
\zxCoordinateSubnode, 57
\zxCross, 28
\zxCtrl, 28
\zxDebugMode, 17
\zxDefaultColumnSep, 79
\zxDefaultColumnSepCircuit, 24
\zxDefaultRowSep, 79
\zxDefaultRowSepCircuit, 24
\zxDefaultSoftAngleChevron, 80
\zxDefaultSoftAngle0, 80
\zxDefaultSoftAngleS, 80
\zxDisableIntersections, 82
\zx Divider, 20
\zxDotsCol, 79
\zxDotsRow, 79
\zxEdgesAbove, 80
\zxElt, 28
\zxEmptyDiagram, 11
\zxEnableIntersections, 82
\zxEnableIntersectionsNodes, 82
\zxEnableIntersectionsWires, 82
\zxExecuteAtCellAbsolute, 66
\zxExecuteAtCellRelative, 66
\zxExecuteAtEndPicture, 66
\zxExecuteAtRegionRelative, 66
\zxExternalAuto, 73
\zxExternalNoWrap, 73
\zxExternalNoWrapNoExt, 73
\zxExternalSuffix, 73
\zxExternalWrap, 73
\zxExternalWrapForceExt, 73
\zxFracX, 13
\zxFracZ, 12
\zxGate, 24
\zxGateInput, 29
\zxGateInputMulti, 29
\zxGateMulti, 25
\zxGateOutput, 29
\zxGateOutputMulti, 29
\zxGet NameAbsoluteNode, 66
\zxGet NameRelativeNode, 66
\zxGet NameRelativeNodeStartOne, 66
\zxGetVariable, 67
\zxGround, 19
\zxGroundScale, 19
\zxGroupGates, 74
\zxH, 14
\zxHCol, 79
\zxHColFlat, 79

\zxHRow, 79
\zxHRowFlat, 79
\zxHSCol, 79
\zxHSColFlat, 79
\zxHSRow, 79
\zxHSRowFlat, 79
\zxInput, 29
\zxInputMulti, 29
\zxIntersectionLineBetweenStartEnd, 91
\zxLoop, 14
\zxLoopAboveDots, 14
\zxMatrix, 20
\zxMeter, 28
\zxMinus, 78
\zxMinusInShort, 78
\zxMinusUnchanged, 78
\zxN, 11
\zxNamedBox, 74
\zxNCol, 79
\zxNewNodeFromPic, 58
\zxNL, 11
\zxNone, 11
\zxNoneDouble, 12
\zxNot, 28
\zxNR, 11
\zxNRow, 79
\zxOCtrl, 28
\zxOriginalCol, 66
\zxOriginalRow, 66
\zxOutput, 29
\zxOutputMulti, 29
\zxSaveDiagram, 93
\zxSCol, 79
\zxSColFlat, 79
\zxSetVariable, 67
\zxSetVariableExpand, 67
\zxSetVariableExpandOnce, 67
\zxSlice, 31
\zxSRow, 79
\zxSRowFlat, 79
\zxVSlice, 31
\zxWCol, 79
\zxwCol, 79
\zxWire, 34
\zxWRow, 79
\zxwRow, 79
\zxX, 13
\zxZ, 13
\zxZeroCol, 79
\zxZeroRow, 79
References

[CHP19] T. Carette, D. Horsman, and S. Perdrix. SZX-calculus: Scalable Graphical Quantum Reasoning. 2019.

[CK17] B. Coecke and A. Kissinger. *Picturing Quantum Processes: A First Course in Quantum Theory and Diagrammatic Reasoning*. Cambridge University Press, Cambridge, 2017.

[vdWet20] J. van de Wetering. ZX-calculus for the working quantum computer scientist. December 27, 2020.