texlive[60838] Master/texmf-dist: zx-calculus (22oct21)

commits+karl at tug.org commits+karl at tug.org
Fri Oct 22 23:35:38 CEST 2021


Revision: 60838
          http://tug.org/svn/texlive?view=revision&revision=60838
Author:   karl
Date:     2021-10-22 23:35:38 +0200 (Fri, 22 Oct 2021)
Log Message:
-----------
zx-calculus (22oct21)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/zx-calculus/zx-calculus.pdf
    trunk/Master/texmf-dist/doc/latex/zx-calculus/zx-calculus.tex
    trunk/Master/texmf-dist/tex/latex/zx-calculus/tikzlibraryzx-calculus.code.tex
    trunk/Master/texmf-dist/tex/latex/zx-calculus/zx-calculus.sty

Modified: trunk/Master/texmf-dist/doc/latex/zx-calculus/zx-calculus.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/zx-calculus/zx-calculus.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/zx-calculus/zx-calculus.tex	2021-10-22 21:33:43 UTC (rev 60837)
+++ trunk/Master/texmf-dist/doc/latex/zx-calculus/zx-calculus.tex	2021-10-22 21:35:38 UTC (rev 60838)
@@ -1,9 +1,11 @@
 \documentclass[a4paper]{ltxdoc}
 
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%% Packages
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+\usepackage{amsmath}
 \usepackage[margin=3cm]{geometry}
 \usepackage{calc}
 \usepackage{tikz}
@@ -19,8 +21,8 @@
 \usepackage[hidelinks]{hyperref}
 \newcommand{\mylink}[2]{\href{#1}{#2}\footnote{\url{#1}}}
 \usepackage{verbatim}
+\usepackage{cleveref}
 
-
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%% Documentation
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -36,7 +38,7 @@
   {\Large\bfseries ZX-calculus with \tikzname}
 
   \vspace{1em}
-  {Version 2021/10/15}\\[3mm]
+  {Version 2021/10/22}\\[3mm]
   {\href{https://github.com/leo-colisson/zx-calculus}{\texttt{github.com/leo-colisson/zx-calculus}}}
 \end{center}
 
@@ -61,7 +63,7 @@
 
 The goal is to provide an alternative to the great |tikzit| package: we wanted a solution that does not require the creation of an additional file, the use of an external software, and which automatically adapts the width of columns and rows depending on the content of the nodes (in |tikzit| one needs to manually tune the position of each node, especially when dealing with large nodes). Our library also provides a default style and tries to separate the content from the style: that way it should be easy to globally change the styling of a given project without redesigning all diagrams. However, it should be fairly easy to combine tikzit and this library: when some diagrams are easier to design in tikzit, then it should be possible to directly load the style of this library inside tikzit.
 
-This library is quite young, so feel free to propose improvements or report issues on \href{https://github.com/leo-colisson/zx-calculus}{\texttt{github.com/leo-colisson/zx-calculus}}. We will of course try to maintain backward compatibility as much as possible, but we can't guarantee at 100\% that small changes (spacing\dots{}) won't be made later. In case you want a completely unalterable style, just copy this library in your project forever! The documentation is also a work in progress, so feel free to check the code to discover new functionalities.
+This library is quite young, so feel free to propose improvements or report issues on \href{https://github.com/leo-colisson/zx-calculus/issues}{\texttt{github.com/leo-colisson/zx-calculus/issues}}. We will of course try to maintain backward compatibility as much as possible, but we can't guarantee at 100\% that small changes (spacing, wire looks\dots{}) won't be made later. In case you want a completely unalterable style, just copy the two files of this library in your project forever (see installation)!
 
 \section{Installation}
 
@@ -80,6 +82,223 @@
 \end{verse}
 If this library is not yet packaged into CTAN (which is very likely in 2021), you must first download \mylink{https://github.com/leo-colisson/zx-calculus/blob/main/tikzlibraryzx-calculus.code.tex}{\texttt{tikzlibraryzx-calculus.code.tex}} and \mylink{https://github.com/leo-colisson/zx-calculus/blob/main/zx-calculus.sty}{\texttt{zx-calculus.sty}} (right-click on ``Raw'' and ``Save link as'') and save them at the root of your project.
 
+\section{Quickstart}
+
+You can create a diagram either with |\zx[options]{matrix}| or with:
+\begin{verse}
+  |\begin{ZX}[options]|\\
+    |  matrix|\\
+  |\end{ZX}|
+\end{verse}
+The matrix is composed of columns separated by |&| and rows separated by |\\|. This matrix is basically a \tikzname{} matrix of nodes (even better, a |tikz-cd| matrix, so you can use all the machinary of |tikz-cd|), so cells can be created using \verb#|tikz style| content#. However, the users does not usually need to use this syntax since many nodes like |\zxZ{spider phase}| have been created for them (including |\zxN{}| which is an empty node):
+
+\begin{codeexample}[width=0pt]
+\begin{ZX}
+  \zxZ{} & \zxZ{\alpha} & \zxZ-{\alpha} & \zxZ{\alpha+\beta} & \zxFracZ{\pi}{2} & \zxFracZ-{\pi}{2}\\
+  \zxX{} & \zxX{\alpha} & \zxX-{\alpha} & \zxX{\alpha+\beta} & \zxFracX{\pi}{2} & \zxFracX-{\pi}{2}\\
+  \zxN{} & \zxH{}
+\end{ZX}
+\end{codeexample}
+
+Note that if a node has no argument like |\zxN|, you should still end it like |\zxN{}| to make sure you code will be backward compatible and will behave correctly.
+
+To link the nodes, you should use |\arrow[options]| (|\ar[options]| for short) at the end of a cell (you can put many arrows). The options can contain a direction, made of a string of |r| (for ``right''), |l| (for ``left''), |d| (for `down''), |u| (for ``up'') letters. That way, |\ar[rrd]| would be an arrow going right, right, and down:
+\begin{codeexample}[]
+\begin{ZX}
+  \zxZ{} \ar[rrd] & \zxX{}\\
+                  &        & \zxX-{\alpha}
+\end{ZX}
+\end{codeexample}
+See how the alignment of your matrix helps reading it: in emacs |M-x align| is your friend. You may also encounter some shortcuts, like |\rar| instead of |\ar[r]|. Since straight lines are boring, we created many styles that you can just add in the options. For instance, a measured Bell-pair can be created using the |C| style (note also how the |*| argument forces the node to be tighter):
+\begin{codeexample}[]
+\begin{ZX}
+  \zxZ*{a \pi} \ar[d,C]\\
+  \zxZ*{b \pi}
+\end{ZX}
+\end{codeexample}
+The name of the style usually tries to graphically represent the shape of a node (here it looks like a |C|). We also introduce many other styles, like |N| for wires that arrive and leave at wide angle (yeah, the |N| is the best letter I could find to fit that shape):
+\begin{codeexample}[]
+\begin{ZX}
+  \zxN{}                           & \zxZ{\beta}\\
+  \zxZ{\alpha} \ar[ru,N] \ar[rd,N] &\\
+                                   & \zxZ{\gamma}
+\end{ZX}
+\end{codeexample}
+Or |s| for wires that arrive and leave at sharp angles (the |\zxN{}| is used because it seems that the first cell of a matrix can't be empty):
+\begin{codeexample}[]
+\begin{ZX}
+  \zxN{}                           & \zxZ{\beta}\\
+  \zxZ{\alpha} \ar[ru,s] \ar[rd,s] &\\
+                                   & \zxZ{\gamma}
+\end{ZX}
+\end{codeexample}
+You have then different variations of a style depending on the shape and/or direction of it. For instance, if we want the arrival of the |N| wire to be flat, use |N-|:
+\begin{codeexample}[]
+\begin{ZX}
+  \zxZ{\alpha} \ar[rd,N-] \\
+                         & \zxZ{\beta}
+\end{ZX}
+\end{codeexample}
+Similarly |o'| is a style for wires that have the shape of the top part of the circle, and comes with variations depending on the part of the circle that must be kept:
+\begin{codeexample}[width=0pt]
+\begin{ZX}
+  \zxZ{\alpha} \ar[r,o',green] \ar[r,o.,red] \ar[d,o-,blue] \ar[d,-o,purple] & \zxZ{\beta}\\
+  \zxZ{\beta}
+\end{ZX}
+\end{codeexample}
+Note that the position of the embellishments (|'|, |-|, |.|\dots{}) tries to graphically represent the shape of the node. That way |-o| means ``take the left part (position of |-|) or the circle |o|''. Applied to |C|, this gives:
+\begin{codeexample}[]
+\begin{ZX}
+  \zxX{} \ar[d,C] \ar[r,C']  & \zxZ{} \ar[d,C-]\\
+  \zxZ{} \ar[r,C.]           & \zxX{}
+\end{ZX}
+\end{codeexample}
+
+You also have styles which automatically add another node in between, for instance |H| adds a Hadamard node in the middle of the node:
+\begin{codeexample}[]
+\begin{ZX}
+  \zxZ{\alpha} \ar[r,o',H] \ar[r,o.,H] &[\zxHCol] \zxZ{\beta}
+\end{ZX}
+\end{codeexample}
+Note that we used also |&[\zxHCol]| instead of |&| (on the first line). This is useful to add an extra space between the columns to have a nicer look. The same apply for rows (see the |*Row| instead of |*Col|):
+\begin{codeexample}[]
+\begin{ZX}
+  \zxZ{\alpha} \ar[d,-o,Z] \ar[d,o-,X] \\[\zxSRow]
+  \zxX{\beta}
+\end{ZX}
+\end{codeexample}
+The reason for this is that it is hard to always get exactly the good spacing by default (for instance here \tikzname{} has no idea that a |H| node will be inserted when it starts to build the diagram), and sometimes the spacing needs some adjustments. However, while you could manually tweak this space using something like |&[1mm]| (it adds |1mm| to the column space), it is better to use some pre-configured spaced that can be (re)-configured document-wise to keep a uniform spacing. You could define your own spacing, but we already provide a list for the most important spacings. They all start with |zx|, then you find the type of space: |H| for Hadamard, |S| for spiders, |W| when you connect only |\zxNone| nodes (otherwise the diagram will be too shrinked), |w| when one side of the row contains only |\zxNone|\dots{} and then you find |Col| (for columns spacing) or |Row| (for rows spacing). For instance we can use the |\zxNone| style (|\zxN| for short) style and the above spacing to obtain this:
+\begin{codeexample}[]
+\begin{ZX}
+  \zxN{} \rar &[\zxwCol] \zxH{} \rar &[\zxwCol] \zxN{}
+\end{ZX}
+\end{codeexample}
+\noindent or that:
+\begin{codeexample}[]
+\begin{ZX}
+  \zxN{} \ar[d,C] \ar[dr,s] &[\zxWCol] \zxN{} \\[\zxWRow]
+  \zxN{} \ar[ru,s]          &          \zxN{} \\
+\end{ZX}
+\end{codeexample}
+
+
+When writing equations, you may also want to change the baseline to align properly your diagrams on a given line like that:
+\begin{codeexample}[]
+  $\zx[math baseline=myZ]{
+    \zxX{}\\
+    \zxZ[a=myZ]{}
+  }
+  = \zx{\zxX{} & \zxZ{}}$
+\end{codeexample}
+
+We also provide easy methods like |phase in label right| to change the labelling of a note (per-node, per-picture or document wise) to move the phase in a label automatically:
+\begin{codeexample}[]
+  \begin{ZX}[phase in label right]
+    \zxZ{\alpha} \arrow[d] \\
+    \zxFracX-{\pi}{4}
+  \end{ZX}
+\end{codeexample}
+
+Now you should know enough to start your first diagrams. The rest of the documentation will go through all the styles, customizations and features, including the one needed to obtain:
+\begin{codeexample}[width=3cm]
+\begin{ZX}
+  \leftManyDots{n} \zxX{\alpha} \zxLoopAboveDots{} \middleManyDots{} \ar[r,o'={a=75}]
+      & \zxX{\beta} \zxLoopAboveDots{} \rightManyDots{m}
+\end{ZX}
+\end{codeexample}
+\noindent You will also see some tricks (notably based on alias) to create clear bigger diagrams, like this debug mode which turns
+{
+\begin{ZX}[zx row sep=1pt,
+  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=Xdown]{}         & \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=Xdown]
+  % Column 3
+  \ar[from=xmiddle,to=Xdown,C-]
+  \ar[from=xmiddle,to=mypi2,)]
+  % Column 4
+  \ar[from=mypi2,to=toprightpi,(']
+  \ar[from=mypi2,to=out1,<']
+  \ar[from=mypi2,to=out2,<.]
+  \ar[from=Xdown,to=out3,<.]
+\end{ZX} into %
+{%
+  \def\zxDebugMode{}%%%%
+  \begin{ZX}[zx row sep=1pt,
+    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=Xdown]{}         & \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=Xdown]
+    % Column 3
+    \ar[from=xmiddle,to=Xdown,C-]
+    \ar[from=xmiddle,to=mypi2,)]
+    % Column 4
+    \ar[from=mypi2,to=toprightpi,(']
+    \ar[from=mypi2,to=out1,<']
+    \ar[from=mypi2,to=out2,<.]
+    \ar[from=Xdown,to=out3,<.]
+  \end{ZX}
+} \ (of course it only helps during the construction).\\
+
+You will also see how you can customize the styles, and how you can easily extand this library to get any custom diagram:
+{\catcode`\|=12 % Ensures | is not anymore \verb|...|
+\begin{codeexample}[width=0pt]
+{ % \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{}}
+}
+\end{codeexample}
+}
+
+If you have some questions, suggestions, or bugs, please report them on \texttt{\url{https://github.com/leo-colisson/zx-calculus/issues}}.
+
+\textbf{Tips}: if you are unsure of the definition of a style in an example, just click on it, a link will point to its definition. Also, if your pdf viewer does not copy/paste these examples correctly, you can copy them from the source code of this documentation available \mylink{https://github.com/leo-colisson/zx-calculus/blob/main/doc/zx-calculus.tex}{here} (to find the example, just use the ``search'' function of your web browser).
+
 \section{Usage}
 
 \subsection{Add a diagram}
@@ -119,21 +338,53 @@
   \extractcommand\zxNone\opt{+}\opt{-}\marg{text}\@@
   \extractcommand\zxN\opt{+}\opt{-}\marg{text}\@@
   \pgfmanualbody
-  Adds an empty node with |\zxNone{}| (alias |\zxN{}|). |\zxNone| is just a coordinate, but |\zxNone-{}| and \verb#\zxNone|{}# are actually nodes with |inner sep=0| along one direction. For that reason, they still have a tiny height or width (impossible to remove as far as I know). If you don't want to get holes when connecting multiple wires to them, it is therefore necessary to use the |wire centered| style for straight lines or |C|-like wires (alias |wc|), or |between none| style (alias |bn|) for other curved lines. Moreover, you should also add column and row spacing |&[\zxWCol]| and |\\[\zxWRow]| to avoid too shrinked diagrams when only wires are involved. The \verb#-|+# decorations are used to add a bit of (respectively) horizontal (\verb#\zxNone-{}#), vertical (\verb#\zxNone|{}#) and both (\verb#\zxNone+{}#) spacing (I don't know how to add \verb#|# in the documentation of the function).
+  Adds an empty node with |\zxNone{}| (alias |\zxN{}|). The \verb#-|+# decorations are used to add a bit of horizontal (\verb#\zxNone-{}#), vertical (\verb#\zxNone|{}#) and both (\verb#\zxNone+{}#) spacing (I don't know how to add \verb#|# in the documentation of the function).
+
+  |\zxNone| is just a coordinate (when possible this node should be preferred over the other versions), but |\zxNone-{}| and \verb#\zxNone|{}# are actually nodes with |inner sep=0| along one direction. For that reason, they still have a tiny height or width (impossible to remove as far as I know). If you don't want to get holes when connecting multiple wires to them, it is therefore necessary to use the |wire centered| style (alias |wc|) (if you are using the |IO| mode, see also the |between none| style).
+
+  Moreover, you should also add column and row spacing |&[\zxWCol]| and |\\[\zxWRow]| to avoid too shrinked diagrams when only wires are involved.
 \begin{codeexample}[width=3cm]
 \begin{ZX}
-  \zxNone{} \ar[C,d] \ar[rd,s,bn] &[\zxWCol] \zxNone{}\\[\zxWRow]
-  \zxNone{}          \ar[ru,s,bn] &          \zxNone{}
+  \zxNone{} \ar[C,d] \ar[rd,s] &[\zxWCol] \zxNone{}\\[\zxWRow]
+  \zxNone{}          \ar[ru,s] &          \zxNone{}
 \end{ZX}
 \end{codeexample}
+Use |&[\zxwCol]| (on the first line) and/or |\\[\zxwRow]| when a single None node is connected to the wire to add appropriate spacing (this spacing can of course be redefined to your preferences):
+\begin{codeexample}[]
+Compare \begin{ZX}
+  \zxN{} \rar & \zxZ{} \rar & \zxN{}
+\end{ZX} with \begin{ZX}
+  \zxN{} \rar &[\zxwCol] \zxZ{} \rar &[\zxwCol] \zxN{}
+\end{ZX}
+\end{codeexample}
+Note also that when the top left cell is empty, you can get an error at the compilation (no idea why) |Single ampersand used with wrong catcode|. To prevent that, you can add a none node at this position:
+\begin{codeexample}[]
+\begin{ZX}
+  \zxN{}         &[\zxwCol] \zxN{} \ar[d]\\[\zxwRow]
+  \zxNone{} \rar & \zxZ{}
+\end{ZX}
+\end{codeexample}
 \end{pgfmanualentry}
+You may also get this error when |&| has already a different meaning, for instance in |align|, in that case you may change the |&| character into |\&| using |[ampersand replacement=\&]|:
+\begin{codeexample}[vbox]
+\begin{align}
+  \begin{ZX}[ampersand replacement=\&]
+    \zxN{} \rar \&[\zxwCol] \zxN{}
+  \end{ZX}
+  &= \begin{ZX}[ampersand replacement=\&]
+    \zxN{} \rar \&[\zxwCol] \zxZ{} \rar \&[\zxwCol] \zxN{}
+  \end{ZX}\\
+  &= \begin{ZX}[ampersand replacement=\&]
+    \zxN{} \rar \&[\zxwCol] \zxX{} \rar \&[\zxwCol] \zxN{}
+  \end{ZX}
+\end{align}
+\end{codeexample}
 
-
 \begin{command}{\zxNoneDouble\opt{+-}\marg{text}}
   Like |\zxNone|, but the spacing for \verb#+-|# is large enough to fake two lines in only one. Not extremely useful (or one needs to play with |start anchor=south,end anchor=north|).
 \begin{codeexample}[width=3cm]
 \begin{ZX}
-  \zxNoneDouble|{} \ar[r,s,start anchor=north,end anchor=south,ls=1.2] \ar[r,s,start anchor=south,end anchor=north,ls=1.2] &[\zxWCol] \zxNoneDouble|{}
+  \zxNoneDouble|{} \ar[r,s,start anchor=north,end anchor=south] \ar[r,s,start anchor=south,end anchor=north] &[\zxWCol] \zxNoneDouble|{}
 \end{ZX}
 \end{codeexample}
 \end{command}
@@ -166,21 +417,39 @@
 \end{codeexample}
 \end{command}
 
-
-\begin{command}{\zxZ\opt{\oarg{other styles}}\marg{text}}
-  Adds a Z node.
+\begin{command}{\zxZ\opt{\oarg{other styles}*-}\marg{text}}
+  Adds a Z node. \meta{other styles} are optional \tikzname{} arguments (the same as the one provided to |tikz-cd|) They should be use with care, and if possible moved to the style directly to keep a consistent look across the paper.
 \begin{codeexample}[width=3cm]
 \begin{ZX}
   \zxZ{} & \zxZ{\alpha} & \zxZ{\alpha + \beta} & \zxZ[text=red]{(a \oplus b)\pi}
 \end{ZX}
 \end{codeexample}
+The optional |-| optional argument is to add a minus sign (customizable, see |\zxMinusInShort|) in front of a very short expression and try to keep a circular shape. This is recommended notably for single letter expressions.
+\begin{codeexample}[width=3cm]
+  Compare \zx{\zxZ{-\alpha}} with \zx{\zxZ-{\alpha}}. Labels:
+  \zx[pila]{\zxZ{-\alpha}} vs \zx[pila]{\zxZ-{\alpha}}.
+\end{codeexample}
+The |*| optional argument is to force a condensed style, no matter what is the text inside. This can be practical \emph{sometimes}:
+\begin{codeexample}[width=3cm]
+  Compare \zx{\zxN{} \rar &[\zxwCol] \zxZ{a\pi}} with \zx{\zxN{} \rar &[\zxwCol] \zxZ*{a\pi}}.
+\end{codeexample}
+\noindent but you should use it as rarely as possible (otherwise, change the style directly). See that it does not always give nice results:
+\begin{codeexample}[width=3cm]
+  Compare \zx{\zxZ{-\alpha} \rar & \zxZ{\alpha+\beta}}
+  with \zx{\zxZ*{-\alpha} \rar & \zxZ*{\alpha+\beta}}.
+  Labels:
+  \zx[pila]{\zxZ{-\alpha} \rar & \zxZ{\alpha+\beta}}
+  vs \zx[pila]{\zxZ*{-\alpha} \rar & \zxZ*{\alpha+\beta}}.
+\end{codeexample}
 \end{command}
 
-\begin{command}{\zxX\opt{\oarg{other styles}}\marg{text}}
-  Adds an X node.
+
+\begin{command}{\zxX\opt{\oarg{other styles}*-}\marg{text}}
+  Adds an X node, like for the Z node.
 \begin{codeexample}[width=3cm]
 \begin{ZX}
-  \zxX{} & \zxX{\alpha} & \zxX{\alpha + \beta} & \zxX[text=green]{(a \oplus b)\pi}
+  \zxX{} & \zxX{\alpha} & \zxX-{\alpha} & \zxX{\alpha + \beta}
+  & \zxX[text=green]{(a \oplus b)\pi}
 \end{ZX}
 \end{codeexample}
 \end{command}
@@ -197,7 +466,7 @@
 
 
 \begin{command}{\leftManyDots\opt{\oarg{text scale}\oarg{dots scale}}\marg{text}}
-  Shortcut to add a dots and a text next to it. It automatically adds the new column, see more examples below.
+  Shortcut to add a dots and a text next to it. It automatically adds the new column, see more examples below. Internally, it uses |3 dots| to place the dots, and can be reproduced using the other nodes around. Note that this node automatically adds a new cell, so you should \emph{not} use |&|.
 \begin{codeexample}[]
 \begin{ZX}
   \leftManyDots{n} \zxX{\alpha}
@@ -244,7 +513,7 @@
 \noindent The previous commands can be useful to create this figure:
 \begin{codeexample}[width=0pt]% Forces code/example on two lines.
 \begin{ZX}
-  \leftManyDots{n} \zxX{\alpha} \zxLoopAboveDots{} \middleManyDots{} \ar[r,o'=60]
+  \leftManyDots{n} \zxX{\alpha} \zxLoopAboveDots{} \middleManyDots{} \ar[r,o'={a=75}]
       & \zxX{\beta} \zxLoopAboveDots{} \rightManyDots{m}
 \end{ZX}
 \end{codeexample}
@@ -352,9 +621,46 @@
 \end{codeexample}
 \end{stylekey}
 
+\begin{stylekey}{/zx/defaultEnv/math baseline=node alias}
+  You can easily change the default baseline which defaults to:
+  \begin{verse}
+    |baseline={([yshift=-axis_height]current bounding box.center)}|
+  \end{verse}
+  (|axis_height| is the distance to use to center equations on the ``mathematical axis'') by using this in the \meta{options} field of |\zx[options]{...}|. However, this can be a bit long to write, so |math baseline=yourAlias| is a shorcut to |baseline={([yshift=-axis_height]yourAlias)}|:
+\begin{codeexample}[width=0pt]
+  Compare $\begin{ZX}
+    \leftManyDots{n} \zxX{\alpha} \zxLoopAboveDots{} \middleManyDots{} \ar[r,o'={a=75}]
+    & \zxX{\beta} \zxLoopAboveDots{} \rightManyDots{m}
+  \end{ZX}
+  = {\def\zxDefaultSoftAngleS{20} % useful to make the angle in \leftManyDots{} nicer.
+    \begin{ZX}
+      \leftManyDots{n} \zxX{\alpha+\beta} \rightManyDots{m}
+    \end{ZX}}$ with $\begin{ZX}[math baseline=wantedBaseline]
+    \leftManyDots{n} \zxX{\alpha} \zxLoopAboveDots{} \middleManyDots{} \ar[r,o'={a=75}]
+    %% See here --v the node chosen as the baseline
+    & \zxX[a=wantedBaseline]{\beta} \zxLoopAboveDots{} \rightManyDots{m}
+  \end{ZX}
+  = {\def\zxDefaultSoftAngleS{20} % useful to make the angle in \leftManyDots{} nicer.
+    \begin{ZX}
+      \leftManyDots{n} \zxX{\alpha+\beta} \rightManyDots{m}
+    \end{ZX}}$
+\end{codeexample}
+Also, if you find your diagram a bit ``too high'', check that you did not forget to remove a trailing |\\| at the end of the last line:
+\begin{codeexample}[width=3cm]
+  Compare $\begin{ZX}
+    \zxZ{} \rar[o'] \rar[o.]      & \zxX{}\\
+    \zxZ{} \rar[o'] \rar[o.] \rar & \zxX{}\\ %% <--- remove last |\\|
+  \end{ZX} = \zx{\zxEmptyDiagram}$ with $\begin{ZX}
+    \zxZ{} \rar[o'] \rar[o.]      & \zxX{}\\
+    \zxZ{} \rar[o'] \rar[o.] \rar & \zxX{}
+  \end{ZX}  = \zx{\zxEmptyDiagram}$
+\end{codeexample}
+\end{stylekey}
 
 \subsection{Wires}
 
+\subsubsection{Creating wires and debug mode}
+
 \begin{pgfmanualentry}
   \extractcommand\arrow\opt{\oarg{options}}\@@
   \extractcommand\ar\opt{\oarg{options}}\@@
@@ -396,9 +702,9 @@
 \end{verse}
 and the other ones work analogously.
 
-Note that sometimes, it may be practical to properly organize big diagrams to increase readability. To that end, one surely wants to have a small and well indented matrix (emacs |M-x align-current| is very practical to indent matrices automatically). Unfortunately, adding wires inside the matrix can make the line really long and hard to read. Similarly, some nodes involving fractions or long expressions can also be quite long. It is however easy to increase readability (and maintainability) by moving the wires at the very end of the diagram, using |alias| (shortcut |a|) to connect nodes and |\def| to create shortcuts. Putting inside a macro with |\def| long node definitions can also be useful to keep small items in the matrix:
+Note that sometimes, it may be practical to properly organize big diagrams to increase readability. To that end, one surely wants to have a small and well indented matrix (emacs |M-x align-current| or |M-x align| (for selected lines) commands are very practical to indent matrices automatically). Unfortunately, adding wires inside the matrix can make the line really long and hard to read. Similarly, some nodes involving fractions or long expressions can also be quite long. It is however easy to increase readability (and maintainability) by moving the wires at the very end of the diagram, using |a| (like |alias|, but with a debug mode) to connect nodes and |\def| to create shortcuts. Putting inside a macro with |\def| long node definitions can also be useful to keep small items in the matrix:
 \begin{codeexample}[width=0pt]
-\begin{ZX}[row sep=1pt,
+\begin{ZX}[zx row sep=1pt,
   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)
@@ -435,7 +741,7 @@
 \begin{codeexample}[width=0pt]
 {
   \def\zxDebugMode{}%%%%
-  \begin{ZX}[row sep=1pt,
+  \begin{ZX}[zx row sep=1pt,
     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)
@@ -453,7 +759,7 @@
     \ar[from=in1,to=X1,s]
     \ar[from=in2,to=Zpi4,.>]
     % Column 2
-    \ar[from=X1,to=xmiddle,N'=70]
+    \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=Xdown]
@@ -469,9 +775,12 @@
 }
 \end{codeexample}
 
-We give now a list of wire styles provided in this library (|/zx/wires definition/| is an automatically loaded style). We recommend using them instead of manual styling to ensure they are the same document-wise, but they can of course be customized to your need. Note that the name of the styles are supposed to graphically represent the action of the style, and some characters are added to precise the shape: typically |'| means top, |.| bottom, |X-| is right to X (or should arrive with angle 0), |-X| is left to X (or should leave with angle zero). These shapes are usually designed to work when the starting node is left most (or above of both nodes have the same column). But they may work both way for some of them.
+\subsubsection{Wire styles (new generation)}
 
+We give now a list of wire styles provided in this library (|/zx/wires definition/| is an automatically loaded style). We recommend using them instead of manual styling to ensure they are the same document-wise, but they can of course be customized to your need. Note that the name of the styles are supposed (ahah, I do my best with what ASCII provides) to graphically represent the action of the style, and some characters are added to precise the shape: typically |'| means top, |.| bottom, |X-| is right to X (or should arrive with angle 0), |-X| is left to X (or should leave with angle zero). These shapes are usually designed to work when the starting node is left most (or above of both nodes have the same column). But they may work both way for some of them.
 
+Note that the first version of that library (which appeared one week before this new version\dots{} hopefully backward compatibility won't be too much of a problem) was using |in=| and |out=| to create these styles. However, it turns out to be not very reliable since the shape of the wire was changing (sometimes importantly) depending on the position of the nodes. This new version should be more reliable, but the older styles are still available by using |IO, nameOfWirestyle| (read more in \cref{subsub:IOwires}).
+
 \begin{pgfmanualentry}
   \makeatletter
   \def\extrakeytext{style, }
@@ -481,17 +790,22 @@
   \extractkey/zx/wires definition/C-=radius ratio (default 1)\@nil%
   \makeatother
   \pgfmanualbody
-  Bell-like wires with an arrival at ``right angle'', |C| represents the shape of the wire, while |.| (bottom), |'| (top) and |-| (side) represent (visually) its position. Combine with |wire centered| (|wc|) to avoid holes when connecting multiple wires.
+  Bell-like wires with an arrival at ``right angle'', |C| represents the shape of the wire, while |.| (bottom), |'| (top) and |-| (side) represent (visually) its position. Combine with |wire centered| (|wc|) to avoid holes when connecting multiple wires (not required with |\zxNone{}|, alias |\zxN{}|).
 \begin{codeexample}[]
-  Bell pair \zx{\zxNone{} \ar[d,C,wc] \\[\zxWRow]
+  A Bell pair \zx{\zxNone{} \ar[d,C] \\[\zxWRow]
                 \zxNone{}}
-  and funny graph
+  , a swapped Bell pair
   \begin{ZX}
+    \zxN{} \ar[d,C] \ar[rd,s] &[\zxWCol] \zxN{} \\[\zxWRow]
+    \zxN{}          \ar[ru,s] &          \zxN{}
+  \end{ZX}
+  and a funny graph
+  \begin{ZX}
     \zxX{} \ar[d,C] \ar[r,C']  & \zxZ{} \ar[d,C-]\\
     \zxZ{} \ar[r,C.]           & \zxX{}
   \end{ZX}.
 \end{codeexample}
-Note that this style is actually connecting the nodes using a perfect circle (it is \emph{not} based on |curve to|), and therefore should \emph{not} be used together with |in|, |out|, |looseness|\dots{} It has the advantage of connecting nicely nodes which are not aligned or with different shapes:
+Note that this style is actually connecting the nodes using a perfect circle (it is \emph{not} based on |curve to|), and therefore should \emph{not} be used together with |in|, |out|, |looseness|\dots{} (this is the case also for most other styles except the ones in |IO|). It has the advantage of connecting nicely nodes which are not aligned or with different shapes:
 \begin{codeexample}[]
   \begin{ZX}
     \zxX{\alpha} \ar[dr,C]\\
@@ -565,22 +879,105 @@
                                & \zxX{}
 \end{ZX}
 \end{codeexample}
-When the nodes are too far appart, the default angle of |30| may produce strange results as it will go above (for |('|) the vertical line. Either choose a shorter angle, or see |<'| instead.
+When the nodes are too far appart, the default angle of |30| may produce strange results as it will go above (for |('|) the vertical line. Either choose a shorter angle, or see |<'| instead. Note that for now this node is based on |in| and |out|, but it may change later. So if you want to change looseness, or really rely on the precise specified angle, prefer to use |IO,(| instead (which takes the |IO| version, guaranteed to stay untouched).
 \end{pgfmanualentry}
 
 \begin{pgfmanualentry}
   \makeatletter
   \def\extrakeytext{style, }
-  \extractkey/zx/wires definition/s\@nil%
-  \extractkey/zx/wires definition/s'=angle (default 30)\@nil%
-  \extractkey/zx/wires definition/s.=angle (default 30)\@nil%
-  \extractkey/zx/wires definition/-s'=angle (default 30)\@nil%
-  \extractkey/zx/wires definition/-s.=angle (default 30)\@nil%
-  \extractkey/zx/wires definition/s'-=angle (default 30)\@nil%
-  \extractkey/zx/wires definition/s.-=angle (default 30)\@nil%
+  \extractkey/zx/wires definition/start fake center north\@nil%
+  \extractkey/zx/wires definition/start fake center south\@nil%
+  \extractkey/zx/wires definition/start fake center east\@nil%
+  \extractkey/zx/wires definition/start fake center west\@nil%
+  \extractkey/zx/wires definition/start real center\@nil
+  \extractkey/zx/wires definition/end fake center north\@nil%
+  \extractkey/zx/wires definition/end fake center south\@nil%
+  \extractkey/zx/wires definition/end fake center east\@nil%
+  \extractkey/zx/wires definition/end fake center west\@nil%
+  \extractkey/zx/wires definition/end real center\@nil
+  \extractkey/zx/wires definition/left to right\@nil%
+  \extractkey/zx/wires definition/right to left\@nil%
+  \extractkey/zx/wires definition/up to down\@nil%
+  \extractkey/zx/wires definition/down to up\@nil%
+  \extractkey/zx/wires definition/force left to right\@nil%
+  \extractkey/zx/wires definition/force right to left\@nil%
+  \extractkey/zx/wires definition/force up to down\@nil%
+  \extractkey/zx/wires definition/force down to up\@nil%
+  \extractkey/zx/wires definition/no fake center\@nil%
   \makeatother
   \pgfmanualbody
-  |s| is used to create a s-like wire, to have nicer soften diagonal lines between nodes. Other versions are soften versions (the input and output angles are not as sharp, and the difference angle can be configured as an argument or globally using |\zxDefaultSoftAngleS|). Adding |'| or |.| specifies if the wire is going up-right or down-right.
+  Usually each wire should properly use these functions, so the end user should not need that too often (during a first reading, you can skip this paragraph). We added 4 anchors to nodes: |fake center north|, |fake center south|, |fake center east| and |fake center west|. These anchors are used to determine the starting point of the wires depending on the direction of the wire (I tried to use more complex methods to ensure the wires would start on the boundary, but \mylink{https://tex.stackexchange.com/questions/619274}{they all fail}). Because some nodes may not have these anchors, we can't directly set |start anchor=fake center north, on layer=edgelayer| (but the user can do that if they are using only nodes with these anchors) or the code may fail on some nodes. For that reason, we check that these anchors exist while drawing our wires (which, at the best of my knowledge, can only be done while drawing the path). The |start/end fake center *| code is responsible to configure that properly (|start real center| will use the real center), and |left to right| (and similar) just configure both the |start| and |end| point to ensure the node starts at the appropriate anchor. However this won't work for style not defined in this library: in case you are sure that these anchors exists and want to use your own wire styles, you can then set the anchors manually and use |on layer=edgelayer|, or use |force left to right| (and similar) which will automatically do that for the |start| and |end| points.
+\begin{codeexample}[]
+\begin{ZX}
+  \zxX{\alpha+\beta} \ar[r,o',no fake center] & \zxZ{\alpha+\beta}\\
+  \zxX{\alpha+\beta} \ar[r,o'] & \zxZ{\alpha+\beta}
+\end{ZX}
+\end{codeexample}
+\end{pgfmanualentry}
+
+\begin{pgfmanualentry}
+  \makeatletter
+  \def\extrakeytext{style, }
+  \extractkey/zx/args/-andL/-=x\@nil%
+  \extractkey/zx/args/-andL/1-=x\@nil%
+  \extractkey/zx/args/-andL/2-=x\@nil%
+  \extractkey/zx/args/-andL/L=y\@nil%
+  \extractkey/zx/args/-andL/1L=y\@nil%
+  \extractkey/zx/args/-andL/2L=y\@nil%
+  \extractkey/zx/args/-andL/1 angle and length=\marg{angle}\marg{length}\@nil%
+  \extractkey/zx/args/-andL/1al=\marg{angle}\marg{length}\@nil%
+  \extractkey/zx/args/-andL/2 angle and length=\marg{angle}\marg{length}\@nil%
+  \extractkey/zx/args/-andL/2al=\marg{angle}\marg{length}\@nil%
+  \extractkey/zx/args/-andL/angle and length=\marg{angle}\marg{length}\@nil%
+  \extractkey/zx/args/-andL/al=\marg{angle}\marg{length}\@nil%
+  \extractkey/zx/args/-andL/1 angle=\marg{angle}\@nil%
+  \extractkey/zx/args/-andL/1a=\marg{angle}\@nil%
+  \extractkey/zx/args/-andL/2 angle=\marg{angle}\@nil%
+  \extractkey/zx/args/-andL/1a=\marg{angle}\marg{length}\@nil%
+  \extractkey/zx/args/-andL/angle=\marg{angle}\@nil%
+  \extractkey/zx/args/-andL/a=\marg{angle}\@nil%
+  \extractkey/zx/args/-andL/symmetry-L\@nil%
+  \extractkey/zx/args/-andL/symmetry\@nil%
+  \extractkey/zx/args/-andL/negate1L\@nil%
+  \extractkey/zx/args/-andL/negate2L\@nil%
+  \extractkey/zx/args/-andL/negateL\@nil%
+  \extractkey/zx/args/-andL/negate1-\@nil%
+  \extractkey/zx/args/-andL/negate2-\@nil%
+  \extractkey/zx/args/-andL/negate-\@nil%
+  \extractkey/zx/args/-andL/oneMinus1-\@nil%
+  \extractkey/zx/args/-andL/oneMinus2-\@nil%
+  \extractkey/zx/args/-andL/oneMinus1L\@nil%
+  \extractkey/zx/args/-andL/oneMinus2L\@nil%
+  \makeatother
+  \pgfmanualbody
+  The next wires can take multiple options. They are all based on the same set of options for now, namely |/zx/args/-andL/|. The |1*| options are used to configure the starting point, the |2*| to configure the ending point, if no number is given both points are updated. |-| and |L| are used to place two anchors of a Bezier curve. They are expressed in relative distance (so they are typically between $0$ and $1$, but can be pushed above $1$ or below $0$ for stronger effects), |-| is typically on the |x| axis and |L| on the |y| axis (the name represents ``graphically'' the direction). They are however not named |x| and |y| because some wires use them slighlty differently, notably |o| which uses |-| for the direction of the arrow and |L| for the direction perpendicular to the arrow (again the shape of |L| represents a perpendicular line). Each wire interprets |-| and |L| to ensure that $0$ should lead to a straight line, and that a correct shape is obtained when |1-| equals |2-|, |1L| equals |2L| (except for non-symmetric shapes of course), and both |-| and |L| are positive.
+
+  The other expressions involving |angle| (or the shortcut |a|) allow you to define |1-|,|1L|\dots{} using a maybe more intuitive ``polar'' notation, i.e.\ an ``angle'' and a relative length (if not specified, like in |1 angle|, the length defaults to $0.6$). Note that the angle is not really an angle (it is an angle only when the nodes are placed at $45$ degrees, or for the |bezier x/y| variations), but a ``squeezed angle'' (when nodes are not at $45$ degrees, the shape is squeezed horizontally or vertically not to change the wire) and similarly for the length. In the above list, the meaning of each expression should be clear from the name: for instance |1angle and length={45}{.8}| will setup a squeezed angle of $45$ and a relative length of $.8$ for the first point, i.e.\ this is equivalent to $1-=.8\cos(45)$ and $1L=.8\sin(45)$, and |angle=45| will change the angle of both points to $45$, with a relative length of $.6$. In the above list, each long expression has below it a shorter version, for intance |a=45| is equivalent to |angle=45|.
+
+  The last expressions (|symmetry-L|, |symmetry|\dots) are used internally to do some math. Of course if you need to do symmetries at some point you can use these keys (|symmetry-L| exchange |-| and |L|, and |symmetry| exchanges |1| and |2|), |negateX| just negates |X| and |oneMinusX| replaces |X| with |1-X|. Each of the following nodes have default values which can be configured as explained in \cref{subsec:wirecustom}.
+\end{pgfmanualentry}
+
+\begin{pgfmanualentry}
+  \makeatletter
+  \def\extrakeytext{style, }
+  \extractkey/zx/wires definition/s=-andL config (default defaultS)\@nil%
+  \extractkey/zx/wires definition/s'=-andL config (default defaultS')\@nil%
+  \extractkey/zx/wires definition/s.=-andL config (default defaultS')\@nil%
+  \extractkey/zx/wires definition/-s=-andL config (default default-S)\@nil%
+  \extractkey/zx/wires definition/-s'=-andL config (default \{defaultS',default-S\})\@nil%
+  \extractkey/zx/wires definition/-s.=-andL config (default \{defaultS',default-S\})\@nil%
+  \extractkey/zx/wires definition/s-=-andL config (default \{defaultS',default-S,symmetry\})\@nil%
+  \extractkey/zx/wires definition/s'-=-andL config (default \{defaultS',default-S,symmetry\})\@nil%
+  \extractkey/zx/wires definition/s.-=-andL config (default \{defaultS',default-S,symmetry\})\@nil%
+  \extractkey/zx/wires definition/-S=-andL config (default \{defaultS',default-S\})\@nil%
+  \extractkey/zx/wires definition/-S'=-andL config (default \{defaultS',default-S\})\@nil%
+  \extractkey/zx/wires definition/-S.=-andL config (default \{defaultS',default-S\})\@nil%
+  \extractkey/zx/wires definition/S-=-andL config (default \{defaultS',default-S,symmetry\})\@nil%
+  \extractkey/zx/wires definition/S'-=-andL config (default \{defaultS',default-S,symmetry\})\@nil%
+  \extractkey/zx/wires definition/S.-=-andL config (default \{defaultS',default-S,symmetry\})\@nil%
+  \makeatother
+  \pgfmanualbody
+  |s| and |S| are used to create a s-like wire, to have nicer diagonal lines between nodes. Other versions are soften versions (the input and output angles are not as sharp. Adding |'| or |.| specifies if the wire is going up-right or down-right, however as of today if it mostly used for backward compatibility since, for instance, |-s'| is the same as |-s| (but some styles may want to do a difference later). The only exception is for |s|/|s'|/|s.|: |s| has a sharper output angle than |s'| and |s.| (which are both equals).
 \begin{codeexample}[width=3cm]
   \begin{ZX}
     \zxX{\alpha} \ar[s,rd] \\
@@ -588,12 +985,12 @@
     \zxX{\alpha} \ar[s.,rd] \\
                            & \zxZ{\beta}\\
                            & \zxZ{\alpha}\\
-    \zxX{\beta} \ar[s,ru] \\
+    \zxX{\beta} \ar[S,ru] \\
                            & \zxZ{\alpha}\\
     \zxX{\beta} \ar[s',ru] \\
   \end{ZX}
 \end{codeexample}
-|-| forces the angle on the side of |-| to be horizontal.
+|-| forces the angle on the side of |-| to be horizontal. Because for now the wires start inside the node, this is not very visible. For that reason, versions with a capital |S| have an anchor on the side of |-| lying on the surface of the node (|S| has two such anchors since both inputs and outputs arrives horizontally) instead of on the |fake center *| anchor (see explanation on |fake center| anchors above).
 \begin{codeexample}[width=3cm]
   \begin{ZX}
     \zxX{\alpha} \ar[s.,rd] \\
@@ -602,20 +999,52 @@
                            & \zxZ{\beta}\\
     \zxX{\alpha} \ar[s.-,rd] \\
                            & \zxZ{\beta}\\
+    \zxX{\alpha} \ar[S,rd] \\
+                           & \zxZ{\beta}\\
   \end{ZX}
 \end{codeexample}
+It is possible to configure it using the options in |-andL config| as explained above (default values are given in \cref{subsec:wirecustom}), where |-| is the (relative) position of the horizontal Bezier anchor and |L| its relative vertical position (to keep a |s|-shape, you should have |-|$>$|L|).
+\begin{codeexample}[width=3cm]
+\begin{ZX}
+  \zxX{\alpha} \ar[rd,s.] \\
+  & \zxZ{\beta}\\
+  % same as s., configure globally using defaultS'\\
+  \zxX{\alpha} \ar[rd,s.={-=.8,L=.2}]\\
+                 & \zxZ{\beta}\\
+  \zxX{\alpha} \ar[rd,s.={L=.4}] \\
+                 & \zxZ{\beta}\\
+  \zxX{\alpha} \ar[rd,s.={L=0.1,-=1}] \\
+                 & \zxZ{\beta}\\
+  \zxX{\alpha} \ar[rd,edge above, control points visible,s.={-=2}] \\
+                 & \zxZ{\beta}
+\end{ZX}
+\end{codeexample}
+For the non-symmetric versions (involving a vertical arrival), you can configure each point separately using |1-| and |1L| (first point) and |2-| and |2L| (second points). You can also specify the ``squeezed angle'' and ``length'' of each point, for instance using the |1 angle and length={10}{.8}| option (short version is |1al={10}{.8}|) or both at the same time using |al={10}{.6}| (this last command being itself equivalent to |a=10|). As explained later |edge above| and |control points visible| can help you to visualize the control points of the underlying Bezier curve.
+\begin{codeexample}[width=3cm]
+  \begin{ZX}
+    \zxZ{} \ar[dr,s.={al={10}{.8}}]\\ &\zxZ{}\\
+    \zxZ{} \ar[edge above,control points visible,dr,s.={a=10}]\\ &\zxZ{}
+  \end{ZX}
+\end{codeexample}
 \end{pgfmanualentry}
 
 \begin{pgfmanualentry}
   \makeatletter
   \def\extrakeytext{style, }
-  \extractkey/zx/wires definition/ss\@nil%
-  \extractkey/zx/wires definition/ss.=angle (default 30)\@nil%
-  \extractkey/zx/wires definition/.ss=angle (default 30)\@nil%
-  \extractkey/zx/wires definition/sIs.=angle (default 30)\@nil%
-  \extractkey/zx/wires definition/.sIs=angle (default 30)\@nil%
-  \extractkey/zx/wires definition/ss.I-=angle (default 30)\@nil%
-  \extractkey/zx/wires definition/I.ss-=angle (default 30)\@nil%
+  \extractkey/zx/wires definition/ss=-andL config (default \{defaultS,symmetry-L\})\@nil%
+  \extractkey/zx/wires definition/SS=-andL config (default \{defaultS,symmetry-L\})\@nil%
+  \extractkey/zx/wires definition/ss.=-andL config (default \{defaultS',symmetry-L\})\@nil%
+  \extractkey/zx/wires definition/.ss=-andL config (default \{defaultS',symmetry-L\}30)\@nil%
+  \extractkey/zx/wires definition/sIs.=-andL config (default defaultSIS)\@nil%
+  \extractkey/zx/wires definition/.sIs=-andL config (default \{defaultS',defaultSIS\})\@nil%
+  \extractkey/zx/wires definition/ss.I-=-andL config (default \{defaultS',defaultSIS,symmetry\})\@nil%
+  \extractkey/zx/wires definition/I.ss-=-andL config (default \{defaultS',defaultSIS,symmetry\})\@nil%
+  \extractkey/zx/wires definition/SIS=-andL config (default \{defaultS',defaultSIS\})\@nil%
+  \extractkey/zx/wires definition/.SIS=-andL config (default \{defaultS',defaultSIS\})\@nil%
+  \extractkey/zx/wires definition/ISS=-andL config (default \{defaultS',defaultSIS,symmetry\})\@nil%
+  \extractkey/zx/wires definition/SS.I=-andL config (default \{defaultS',defaultSIS,symmetry\})\@nil%
+  \extractkey/zx/wires definition/I.SS=-andL config (default \{defaultS',defaultSIS,symmetry\})\@nil%
+  \extractkey/zx/wires definition/SSI=-andL config (default \{defaultS',defaultSIS,symmetry\})\@nil%
   \makeatother
   \pgfmanualbody
   |ss| is similar to |s| except that we go from top to bottom instead of from left to right. The position of |.| says if the node is wire is going bottom right (|ss.|) or bottom left (|.ss|).
@@ -627,7 +1056,7 @@
                            & \zxZ{\beta}\\
                            & \zxX{\beta} \ar[.ss,dl] \\
     \zxZ{\alpha}\\
-                           & \zxX{\beta} \ar[.ss=40,dl] \\
+                           & \zxX{\beta} \ar[.ss={},dl] \\
     \zxZ{\alpha}\\
   \end{ZX}
 \end{codeexample}
@@ -646,32 +1075,146 @@
     \zxZ{\alpha}\\
   \end{ZX}
 \end{codeexample}
+The |S| version forces the anchor on the vertical line to be on the boundary.
+\begin{codeexample}[width=3cm]
+  \begin{ZX}
+    \zxX{\alpha} \ar[SS,rd] \\
+                           & \zxZ{\beta}\\
+    \zxX{\alpha} \ar[SIS,rd] \\
+                           & \zxZ{\beta}\\
+    \zxX{\alpha} \ar[SSI,rd] \\
+                           & \zxZ{\beta}\\
+                           & \zxX{\beta} \ar[.sIs,dl] \\
+    \zxZ{\alpha}\\
+                           & \zxX{\beta} \ar[I.ss,dl] \\
+    \zxZ{\alpha}\\
+  \end{ZX}
+\end{codeexample}
+As for |s| it can be configured:
+\begin{codeexample}[width=3cm]
+\begin{ZX}
+  \zxX{\alpha} \ar[rd,SIS] \\
+                             & \zxZ{\beta}\\
+  \zxX{\alpha} \ar[rd,SIS={1L=.4}] \\
+                             & \zxZ{\beta}\\
+  \zxX{\alpha} \ar[rd,SIS={1L=.8}] \\
+                             & \zxZ{\beta}\\
+  \zxX{\alpha} \ar[rd,SIS={1L=1,2L=1}] \\
+                             & \zxZ{\beta}\\
+\end{ZX}
+\end{codeexample}
 \end{pgfmanualentry}
 
+\begin{pgfmanualentry}
+  \makeatletter
+  \def\extrakeytext{style, }
+  \extractkey/zx/wires definition/N=-andL config (default defaultN)\@nil%
+  \extractkey/zx/wires definition/N'=-andL config (default defaultN)\@nil%
+  \extractkey/zx/wires definition/N.=-andL config (default defaultN)\@nil%
+  \extractkey/zx/wires definition/-N=-andL config (default \{defaultN,defaultN-\})\@nil%
+  \extractkey/zx/wires definition/-N'=-andL config (default \{defaultN,defaultN-\})\@nil%
+  \extractkey/zx/wires definition/-N.=-andL config (default \{defaultN,defaultN-\})\@nil%
+  \extractkey/zx/wires definition/N-=-andL config (default \{defaultN,defaultN-,symmetry\})\@nil%
+  \extractkey/zx/wires definition/N'-=-andL config (default \{defaultN,defaultN-,symmetry\})\@nil%
+  \extractkey/zx/wires definition/N.-=-andL config (default \{defaultN,defaultN-,symmetry\})\@nil%
+  \extractkey/zx/wires definition/Nbase=-andL config (default defaultN)\@nil%
+  \makeatother
+  \pgfmanualbody
+  |N| is used to create a left-to-right wire leaving at wide angle and arriving at wide angle (it's named |N| because it roughly have the shape of a capital |N|). In older versions, |'| and |.| was required to specify if the wire should go up-right or down-right, but it is not useful anymore (we keep it for compatibilty with |IO| styles and in case some styles want to do a distinction later).
+\begin{codeexample}[width=3cm]
+  \begin{ZX}
+    \zxX{\alpha} \ar[N,rd] \\
+                               & \zxZ{\beta}\\
+                               & \zxZ{\alpha}\\
+    \zxX{\beta} \ar[N,ru]
+  \end{ZX}
+\end{codeexample}
+|-| forces the angle on the side of |-| to be horizontal.
+\begin{codeexample}[width=3cm]
+  \begin{ZX}
+    \zxX{\alpha} \ar[-N,rd] \\
+                               & \zxZ{\beta}\\
+                               & \zxZ{\alpha}\\
+    \zxX{\beta} \ar[N-,ru]
+  \end{ZX}
+\end{codeexample}
+Like other wires, it can be configured using |-| (horizontal relative position of anchor points) and |L| (vertical relative position of anchor points, make sure to have |-|$<$|L| to have a |N|-looking shape), |al={angle}{relative length}|\dots{}
+\begin{codeexample}[width=3cm]
+  \begin{ZX}
+    \zxX{\alpha} \ar[N,rd] \\
+                               & \zxZ{\beta}\\
+    \zxX{\alpha} \ar[N={L=1.2},rd] \\
+                               & \zxZ{\beta}
+  \end{ZX}
+\end{codeexample}
+All these styles are based on Nbase (which should not be used directly), including the styles like |<|. If you wish to overwrite later |N|-like commands, but not |<|-like, then change |N|. If you wish to also update |<| commands, use |Nbase|.
+\end{pgfmanualentry}
 
+
+
 \begin{pgfmanualentry}
   \makeatletter
   \def\extrakeytext{style, }
-  \extractkey/zx/wires definition/<'=angle (default 60)\@nil%
-  \extractkey/zx/wires definition/<.=angle (default 60)\@nil%
-  %\extractkey/zx/wires definition/^.=angle (default 60)\@nil%
-  %\extractkey/zx/wires definition/.^=angle (default 60)\@nil%
-  \extractkey/zx/wires definition/'v=angle (default 60)\@nil%
-  \extractkey/zx/wires definition/v'=angle (default 60)\@nil%
+  \extractkey/zx/wires definition/NN=-andL config (default \{defaultN,symmetry-L,defaultNN\})\@nil%
+  \extractkey/zx/wires definition/NN.=-andL config (default \{defaultN,symmetry-L,defaultNN\})\@nil%
+  \extractkey/zx/wires definition/.NN=-andL config (default \{defaultN,symmetry-L,defaultNN\})\@nil%
+  \extractkey/zx/wires definition/NIN=-andL config (default \{defaultN,symmetry-L,defaultNN,defaultNIN\})\@nil%
+  \extractkey/zx/wires definition/INN=-andL config (default \{defaultN,symmetry-L,defaultNN,defaultNIN,symmetry\})\@nil%
+  \extractkey/zx/wires definition/NNI=-andL config (default \{defaultN,symmetry-L,defaultNN,defaultNIN,symmetry\})\@nil%
   \makeatother
   \pgfmanualbody
-  These keys are a bit like |('| or |(.| but the arrival angle is vertical (or horizontal for the |^| (up-down) and |v| (down-up) versions). As before, the position of the decorator |.|,|'| denote the direction of the wire.
+  Like |N| but for diagrams read up-to-down or down-to-up. The |.| are maintly used for backward compatibility with |IO| style.
+% \begin{codeexample}[width=3cm]
+%   \begin{ZX}
+%     \zxX{\alpha} \ar[NN,rd] \\
+%                                & \zxZ{\beta}\\
+%                                & \zxZ{\alpha}\\
+%     \zxX{\beta} \ar[NN,ru]
+%   \end{ZX}
+% \end{codeexample}
+% |I| forces the angle on the side of |I| to be vertical.
+% \begin{codeexample}[width=3cm]
+%   \begin{ZX}
+%     \zxX{\alpha} \ar[NIN,rd] \\
+%                                & \zxZ{\beta}\\
+%                                & \zxZ{\alpha}\\
+%     \zxX{\beta} \ar[NNI,ru]
+%   \end{ZX}
+% \end{codeexample}
+% It can be configured like |N| using |-|, |L|\dots{}
+\end{pgfmanualentry}
+
+\begin{pgfmanualentry}
+  \makeatletter
+  \def\extrakeytext{style, }
+  \extractkey/zx/wires definition/<'=-andL config (default like N-)\@nil%
+  \extractkey/zx/wires definition/<.=-andL config (default like N-)\@nil%
+  \extractkey/zx/wires definition/'>=-andL config (default like -N)\@nil%
+  \extractkey/zx/wires definition/.>=-andL config (default like -N)\@nil%
+  %\extractkey/zx/wires definition/^.=-andL config (default 60)\@nil%
+  %\extractkey/zx/wires definition/.^=-andL config (default 60)\@nil%
+  \extractkey/zx/wires definition/'v=-andL config (default like INN)\@nil%
+  \extractkey/zx/wires definition/v'=-andL config (default like NNI)\@nil%
+  \makeatother
+  \pgfmanualbody
+  |<'| and |<.| are similar to |N-|, except that the anchor of the vertical line is put on the boundary (similarly for |*>| and |-N|, |*v*| and |INN|, and |*^*| and |NIN|: |.^| and |^.| were not possible to put in this documentation since the documentation package does not like the |^| character). The position of |'| and |.| does not really matters anymore in new versions, but for backward compatibility with |IO| styles, and maybe forward compatibility (another style may need this information), it's cleaner to put |.| or |'| on the direction of the wire. It also helps the reader of your diagrams to see the shape of the wire.
 \begin{codeexample}[width=0cm]
 \begin{ZX}
-  \zxN{}                         & & \zxZ{}\\
-  \zxX{} \ar[rru,<'] \ar[rrd,<.] & \\
-  \zxN{}                         & & \zxZ{}\\
+  \zxN{}                         & \zxZ{}\\
+  \zxX{} \ar[ru,<'] \ar[rd,<.] \\
+  \zxN{}                         & \zxZ{}\\
 \end{ZX}
 \end{codeexample}
 \begin{codeexample}[width=0cm]
 \begin{ZX}
-  \zxN{} & \zxFracX{\pi}{2} \ar[ddl,.^] \ar[ddr,^.] & \\
-         &                                & \\
+  \zxN{}                         & \zxZ{}\\
+  \zxX{} \ar[ru,.>] \ar[rd,'>] \\
+  \zxN{}                         & \zxZ{}\\
+\end{ZX}
+\end{codeexample}
+\begin{codeexample}[width=0cm]
+\begin{ZX}
+  \zxN{} & \zxFracX{\pi}{2} \ar[dl,.^] \ar[dr,^.] & \\
   \zxZ{} &                                & \zxX{}
 \end{ZX}
 \end{codeexample}
@@ -678,12 +1221,12 @@
 \begin{codeexample}[width=0cm]
 \begin{ZX}
   \zxZ{} &                                & \zxX{}\\
-         &                                & \\
-  \zxN{} & \zxX{} \ar[uul,'v] \ar[uur,v'] &
+  \zxN{} & \zxX{} \ar[ul,'v] \ar[ur,v'] &
 \end{ZX}
 \end{codeexample}
 \end{pgfmanualentry}
 
+
 \begin{pgfmanualentry}
   \makeatletter
   \def\extrakeytext{style, }
@@ -705,9 +1248,9 @@
 \begin{pgfmanualentry}
   \makeatletter
   \def\extrakeytext{style, }
-  \extractkey/zx/wires definition/H\@nil%
-  \extractkey/zx/wires definition/Z\@nil%
-  \extractkey/zx/wires definition/X\@nil%
+  \extractkey/zx/wires definition/H=style (default {})\@nil%
+  \extractkey/zx/wires definition/Z=style (default {})\@nil%
+  \extractkey/zx/wires definition/X=style (default {})\@nil%
   \makeatother
   \pgfmanualbody
   Adds a |H| (Hadamard), |Z| or |X| node (without phase) in the middle of the wire. Width of column or rows should be adapted accordingly using |\zxNameRowcolFlatnot| where |Name| is replaced by |H|, |S| (for ``spiders'', i.e.\ |X| or |Z|), |HS| (for both |H| and |S|) or |W|, |Rowcol| is either |Row| (for changing row sep) or |Col| (for changing column sep) and |Flatnot| is empty or |Flat| (if the wire is supposed to be a straight line as it requires more space). For instance:
@@ -718,6 +1261,17 @@
   \zxX{\gamma}
 \end{ZX}
 \end{codeexample}
+The \meta{style} parameter can be used to add additional \tikzname{} style to the nodes, notably a position using |\ar[rd,-N.,H={pos=.35}]|. The reason for using that is that the wires start inside the nodes, therefore the ``middle'' of the wire is closer to the node when the other side is on an empty node.
+\begin{codeexample}[width=0pt]
+\begin{ZX}[zx row sep=0pt]
+ \zxN{} \ar[rd,-N.,H={pos=.35}] &[\zxwCol,\zxHCol]  &[\zxwCol,\zxHCol] \zxN{} \\[\zxNRow]%%
+                                & \zxX{\alpha}
+                                     \ar[ru,N'-,H={pos=1-.35}]
+                                     \ar[rd,N.-,H={pos=1-.35}] &  \\[\zxNRow]
+ \zxN{} \ar[ru,-N',H={pos=.35}]                                &  & \zxN{}
+\end{ZX}
+\end{codeexample}
+Note that it's possible to automatically start wires on the border of the node, but it is slower and create other issues, see \cref{subsec:wiresInsideOutside} for more details. The second option (also presented in this section) is to manually define the |start anchor| and |end anchor|, but it can change the shape of the wire).
 \end{pgfmanualentry}
 
 \begin{pgfmanualentry}
@@ -731,30 +1285,337 @@
   \extractkey/zx/wires definition/wce\@nil%
   \makeatother
   \pgfmanualbody
-  When the wires are drawn, they start from the border of the node. However, it can make strange results if nodes do not have the same size, or if we connect none nodes (we will get holes). It is therefore possible to force the wire to start at the center of the node (|wire centered start|, alias |wcs|), to end at the center of the node -|wire centered end|, alias |wce|) or both (|wire centered|, alias |wc|). See also |between node| to also increase looseness when connecting only wires.
+  Forces the wires to start at the center of the node (|wire centered start|, alias |wcs|), to end at the center of the node (|wire centered end|, alias |wce|) or both (|wire centered|, alias |wc|). This may be useful, for instance in the old |IO| mode (see below) when nodes have different sizes (the result looks strange otherwise), or with some wires (like |C|) connected to |\ZxNone+| (if possible, use |\zxNone| (without any embellishment) since it does not suffer from this issue as it is a coordinate).
+
+  See also |between none| to also increase looseness when connecting only wires (use |between none| \emph{only} in |IO| mode).
 \begin{codeexample}[width=3cm]
 \begin{ZX}
-  \zxZ{} \ar[o',r] \ar[o.,r]       & \zxX{\alpha}\\
-  \zxZ{} \ar[o',r,wc] \ar[o.,r,wc] & \zxX{\alpha}
+  \zxZ{} \ar[IO,o',r] \ar[IO,o.,r]       & \zxX{\alpha}\\
+  \zxZ{} \ar[IO,o',r,wc] \ar[IO,o.,r,wc] & \zxX{\alpha}
 \end{ZX}
 \end{codeexample}
-Without |wc| (note that because there is no node, we need to use |&[\zxWCol]| (for columns) and |\\[\zxWRow]| (for rows) to get nicer spacing):
+% Without |wc| (note that because there is no node, we need to use |&[\zxWCol]| (for columns) and |\\[\zxWRow]| (for rows) to get nicer spacing):
+% \begin{codeexample}[width=3cm]
+% \zx{\zxNone{} \rar &[\zxWCol] \zxNone{} \rar &[\zxWCol] \zxNone{} }
+% \end{codeexample}
+% With |wc|:
+% \begin{codeexample}[width=3cm]
+% \zx{\zxNone{} \rar[wc] &[\zxWCol] \zxNone{} \rar[wc] &[\zxWCol] \zxNone{}}
+% \end{codeexample}
+\end{pgfmanualentry}
+
+
+\begin{pgfmanualentry}
+  \makeatletter
+  \def\extrakeytext{style, }
+  \extractkey/zx/wires definition/bezier=-andL config \@nil%
+  \extractkey/zx/wires definition/bezier x=-andL config \@nil%
+  \extractkey/zx/wires definition/bezier y=-andL config \@nil%
+  \extractkey/zx/wires definition/bezier 4=\{x1\}\{y1\}\{x2\}\{y2\} \@nil%
+  \extractkey/zx/wires definition/bezier 4 x=\{x1\}\{y1\}\{x2\}\{y2\} \@nil%
+  \extractkey/zx/wires definition/bezier 4 y=\{x1\}\{y1\}\{x2\}\{y2\} \@nil%
+  \makeatother
+  \pgfmanualbody
+  To create a bezier wire. These styles are not really meant to be used for the final user because they are long to type and would not be changed document-wise when the style is changed, but most styles are based on these styles. For the |bezier 4 *| versions, the two first arguments are the relative position of the first anchor (|x| and |y| position), the next two of the second anchor. In the |bezier *| versions, the value of |1-| will be the relative |x| position of the first point, |1L| the relative position of the second, and |2-| and |2L| will be for the second point (the advantage of this is that it is also possible to specify angles using |1al={angle}{length}|\dots{} as explained in the |-andL| syle). They are said to be relative in the sense that |{0}{0}| is the coordinate of the first point, and |{1}{1}| the second point. The |bezier x| and |bezier 4 y| are useful when the node are supposed to be horizontally or vertically aligned: the distance are now expressed as a fraction of the horizontal (respectively vertical) distance between the two nodes. Using relative coordinates has the advantage that if the nodes positions are moved, the aspect of the wire does not change (it is just squeezed), while this is not true with |in|/|out| wires which preserves angles but not shapes.
+\end{pgfmanualentry}
+
+
+\subsubsection{IO wires, the old styles}\label{subsub:IOwires}
+
+\begin{stylekey}{/zx/wires definition/IO}
+As explained above, wires were first defined using |in|, |out| and |looseness|, but this turned out to be sometimes hard to use since the shape of the wire was changing depending on the position. For example consider the differences between the older version:
+\begin{codeexample}[]
+\begin{ZX}
+  \zxN{}                       & \zxZ{} \\
+  \zxZ{} \ar[ru,IO,N'] \ar[rd,IO,N.] &\\
+                               & \zxZ{} \\
+\end{ZX}
+\begin{ZX}
+  \zxN{}                       & \zxZ{} \\[-3pt]
+  \zxZ{} \ar[ru,IO,N'] \ar[rd,IO,N.] &\\[-3pt]
+                               & \zxZ{} \\
+\end{ZX}
+\begin{ZX}
+  \zxN{}                       & \zxZ{} \\[-5pt]
+  \zxZ{} \ar[ru,IO,N'] \ar[rd,IO,N.] &\\[-5pt]
+                               & \zxZ{} \\
+\end{ZX}
+\end{codeexample}
+\begin{codeexample}[]
+\begin{ZX}
+  \zxN{}                       & \zxZ{} \\
+  \zxZ{} \ar[ru,N'] \ar[rd,N.] &\\
+                               & \zxZ{} \\
+\end{ZX}
+and the newer:
+\begin{ZX}
+  \zxN{}                       & \zxZ{} \\[-3pt]
+  \zxZ{} \ar[ru,N'] \ar[rd,N.] &\\[-3pt]
+                               & \zxZ{} \\
+\end{ZX}
+\begin{ZX}
+  \zxN{}                       & \zxZ{} \\[-5pt]
+  \zxZ{} \ar[ru,N'] \ar[rd,N.] &\\[-5pt]
+                               & \zxZ{} \\
+\end{ZX}
+\end{codeexample}
+Here is another example:
+\begin{codeexample}[]
+Before \begin{ZX}
+  \zxNone{} \ar[IO,C,d,wc] \ar[rd,IO,s] &[\zxWCol] \zxNone{} \\[\zxWRow]
+  \zxNone{}                \ar[ru,IO,s] &          \zxNone{}
+\end{ZX} after \begin{ZX}
+  \zxNone{} \ar[C,d] \ar[rd,s] &[\zxWCol] \zxNone{} \\[\zxWRow]
+  \zxNone{}          \ar[ru,s] &          \zxNone{}
+\end{ZX}
+\end{codeexample}
+This example led to the creation of the |bn| style, in order to try to find appropriate looseness values depending on the case\dots{} but it is harder to use and results are less predictable.
+
+The new method also allowed us to use |N| for both |N.| and |N'| styles (however we kept both versions for backward compatibility and in case later we want to make a distinction between nodes going doing or up).
+
+However, if you prefer the old style, you can just use them by adding |IO,| in front of the style name (styles are nested inside |IO|). Note however that the customization options are of course different.
+\end{stylekey}
+
+We list now the older |IO| styles:
+
+\begin{pgfmanualentry}
+  \makeatletter
+  \def\extrakeytext{style, }
+  \extractkey/zx/wires definition/IO/C\@nil%
+  \extractkey/zx/wires definition/IO/C\@nil%
+  \extractkey/zx/wires definition/IO/C'\@nil%
+  \extractkey/zx/wires definition/IO/C-\@nil%
+  \makeatother
+  \pgfmanualbody
+  |IO| mode for the |C| wire (used for Bell-like shapes).
+\begin{codeexample}[]
+  Bell pair \zx{\zxNone{} \ar[d,IO,C] \\[\zxWRow]
+                \zxNone{}}
+  and funny graph
+  \begin{ZX}
+    \zxX{} \ar[d,IO,C] \ar[r,C']  & \zxZ{} \ar[d,IO,C-]\\
+    \zxZ{} \ar[r,IO,C.]           & \zxX{}
+  \end{ZX}.
+\end{codeexample}
+Note that the |IO| version cannot really be used when nodes are not aligned (using |wc| can sometimes help with the alignment):
+\begin{codeexample}[]
+  Normal \begin{ZX}
+    \zxX{\alpha} \ar[dr,C]\\
+    & \zxNone{}
+  \end{ZX}, and |IO| \begin{ZX}
+    \zxX{\alpha} \ar[dr,IO,C]\\
+    & \zxNone{}
+  \end{ZX}
+\end{codeexample}
+\end{pgfmanualentry}
+
+\begin{pgfmanualentry}
+  \makeatletter
+  \def\extrakeytext{style, }
+  \extractkey/zx/wires definition/IO/o'=angle (default 40)\@nil%
+  \extractkey/zx/wires definition/IO/o.=angle (default 40)\@nil%
+  \extractkey/zx/wires definition/IO/o-=angle (default 40)\@nil%
+  \extractkey/zx/wires definition/IO/-o=angle (default 40)\@nil%
+  \makeatother
+  \pgfmanualbody
+  |IO| version of |o|. Curved wire, similar to |C| but with a soften angle (optionally specified via \meta{angle}, and globally editable with |\zxDefaultLineWidth|). Again, the symbols specify which part of the circle (represented with |o|) must be kept.
 \begin{codeexample}[width=3cm]
-\zx{\zxNone{} \rar &[\zxWCol] \zxNone{} \rar &[\zxWCol] \zxNone{} }
+  \begin{ZX}
+    \zxX{} \ar[d,IO,-o] \ar[d,IO,o-]\\
+    \zxZ{} \ar[r,IO,o'] \ar[r,IO,o.] & \zxX{}
+  \end{ZX}.
 \end{codeexample}
-With |wc|:
+ Note that these wires can be combined with |H|, |X| or |Z|, in that case one should use appropriate column and row spacing as explained in their documentation:
 \begin{codeexample}[width=3cm]
-\zx{\zxNone{} \rar[wc] &[\zxWCol] \zxNone{} \rar[wc] &[\zxWCol] \zxNone{}}
+  \begin{ZX}
+    \zxX{\alpha} \ar[d,IO,-o,H] \ar[d,IO,o-,H]\\[\zxHRow]
+    \zxZ{\beta} \rar & \zxZ{} \ar[r,IO,o',X] \ar[r,IO,o.,Z] &[\zxSCol] \zxX{}
+  \end{ZX}.
 \end{codeexample}
 \end{pgfmanualentry}
 
+\begin{pgfmanualentry}
+  \makeatletter
+  \def\extrakeytext{style, }
+  \extractkey/zx/wires definition/IO/(=angle (default 30)\@nil%
+  \extractkey/zx/wires definition/IO/)=angle (default 30)\@nil%
+  \extractkey/zx/wires definition/IO/('=angle (default 30)\@nil%
+  \extractkey/zx/wires definition/IO/('=angle (default 30)\@nil%
+  \makeatother
+  \pgfmanualbody
+  |IO| version of |(| (so far they are the same, but it may change later, use this version if you want to play with |looseness|). Curved wire, similar to |o| but can be used for diagonal items. The angle is, like in |bend right|, the opening angle from the line which links the two nodes. For the first two commands, the |(| and |)| symbols must be imagined as if the starting point was on top of the parens, and the ending point at the bottom.
+\begin{codeexample}[width=3cm]
+  \begin{ZX}
+    \zxX{} \ar[rd,IO,(] \ar[rd,IO,),red]\\
+    & \zxZ{}
+  \end{ZX}.
+\end{codeexample}
+Then, |('|=|(| and |(.|=|)|; this notation is, I think, more intuitive when linking nodes from left to right. |('| is used when going to top right and |(.| when going to bottom right.
+\begin{codeexample}[width=3cm]
+\begin{ZX}
+  \zxN{}                       & \zxX{}\\
+  \zxZ{} \ar[ru,IO,('] \ar[IO,rd,(.] & \\
+                               & \zxX{}
+\end{ZX}
+\end{codeexample}
+When the nodes are too far appart, the default angle of |30| may produce strange results as it will go above (for |('|) the vertical line. Either choose a shorter angle, or see |<'| instead.
+\end{pgfmanualentry}
+
+\begin{pgfmanualentry}
+  \makeatletter
+  \def\extrakeytext{style, }
+  \extractkey/zx/wires definition/IO/s\@nil%
+  \extractkey/zx/wires definition/IO/s'=angle (default 30)\@nil%
+  \extractkey/zx/wires definition/IO/s.=angle (default 30)\@nil%
+  \extractkey/zx/wires definition/IO/-s'=angle (default 30)\@nil%
+  \extractkey/zx/wires definition/IO/-s.=angle (default 30)\@nil%
+  \extractkey/zx/wires definition/IO/s'-=angle (default 30)\@nil%
+  \extractkey/zx/wires definition/IO/s.-=angle (default 30)\@nil%
+  \makeatother
+  \pgfmanualbody
+  |IO| version of |s|. |s| is used to create a s-like wire, to have nicer soften diagonal lines between nodes. Other versions are soften versions (the input and output angles are not as sharp, and the difference angle can be configured as an argument or globally using |\zxDefaultSoftAngleS|). Adding |'| or |.| specifies if the wire is going up-right or down-right.
+\begin{codeexample}[width=3cm]
+  \begin{ZX}
+    \zxX{\alpha} \ar[IO,s,rd] \\
+                               & \zxZ{\beta}\\
+    \zxX{\alpha} \ar[IO,s.,rd] \\
+                               & \zxZ{\beta}\\
+                               & \zxZ{\alpha}\\
+    \zxX{\beta} \ar[IO,s,ru] \\
+                               & \zxZ{\alpha}\\
+    \zxX{\beta} \ar[IO,s',ru] \\
+  \end{ZX}
+\end{codeexample}
+|-| forces the angle on the side of |-| to be horizontal.
+\begin{codeexample}[width=3cm]
+  \begin{ZX}
+    \zxX{\alpha} \ar[IO,s.,rd] \\
+                           & \zxZ{\beta}\\
+    \zxX{\alpha} \ar[IO,-s.,rd] \\
+                           & \zxZ{\beta}\\
+    \zxX{\alpha} \ar[IO,s.-,rd] \\
+                           & \zxZ{\beta}\\
+  \end{ZX}
+\end{codeexample}
+\end{pgfmanualentry}
+
+\begin{pgfmanualentry}
+  \makeatletter
+  \def\extrakeytext{style, }
+  \extractkey/zx/wires definition/IO/ss\@nil%
+  \extractkey/zx/wires definition/IO/ss.=angle (default 30)\@nil%
+  \extractkey/zx/wires definition/IO/.ss=angle (default 30)\@nil%
+  \extractkey/zx/wires definition/IO/sIs.=angle (default 30)\@nil%
+  \extractkey/zx/wires definition/IO/.sIs=angle (default 30)\@nil%
+  \extractkey/zx/wires definition/IO/ss.I-=angle (default 30)\@nil%
+  \extractkey/zx/wires definition/IO/I.ss-=angle (default 30)\@nil%
+  \makeatother
+  \pgfmanualbody
+  |IO| version of |ss|. |ss| is similar to |s| except that we go from top to bottom instead of from left to right. The position of |.| says if the node is wire is going bottom right (|ss.|) or bottom left (|.ss|).
+\begin{codeexample}[width=3cm]
+  \begin{ZX}
+    \zxX{\alpha} \ar[IO,ss,rd] \\
+                           & \zxZ{\beta}\\
+    \zxX{\alpha} \ar[IO,ss.,rd] \\
+                           & \zxZ{\beta}\\
+                           & \zxX{\beta} \ar[IO,.ss,dl] \\
+    \zxZ{\alpha}\\
+                           & \zxX{\beta} \ar[IO,.ss,dl] \\
+    \zxZ{\alpha}\\
+  \end{ZX}
+\end{codeexample}
+|I| forces the angle above (if in between the two |s|) or below (if on the same side as |.|) to be vertical.
+\begin{codeexample}[width=3cm]
+  \begin{ZX}
+    \zxX{\alpha} \ar[IO,ss,rd] \\
+                           & \zxZ{\beta}\\
+    \zxX{\alpha} \ar[IO,sIs.,rd] \\
+                           & \zxZ{\beta}\\
+    \zxX{\alpha} \ar[IO,ss.I,rd] \\
+                           & \zxZ{\beta}\\
+                           & \zxX{\beta} \ar[IO,.sIs,dl] \\
+    \zxZ{\alpha}\\
+                           & \zxX{\beta} \ar[IO,I.ss,dl] \\
+    \zxZ{\alpha}\\
+  \end{ZX}
+\end{codeexample}
+\end{pgfmanualentry}
+
+\begin{pgfmanualentry}
+  \makeatletter
+  \def\extrakeytext{style, }
+  \extractkey/zx/wires definition/IO/<'=angle (default 60)\@nil%
+  \extractkey/zx/wires definition/IO/<.=angle (default 60)\@nil%
+  \extractkey/zx/wires definition/IO/'>=angle (default 60)\@nil%
+  \extractkey/zx/wires definition/IO/.>=angle (default 60)\@nil%
+  %\extractkey/zx/wires definition/IO/^.=angle (default 60)\@nil%
+  %\extractkey/zx/wires definition/IO/.^=angle (default 60)\@nil%
+  \extractkey/zx/wires definition/IO/'v=angle (default 60)\@nil%
+  \extractkey/zx/wires definition/IO/v'=angle (default 60)\@nil%
+  \makeatother
+  \pgfmanualbody
+  These keys are a bit like |('| or |(.| but the arrival angle is vertical (or horizontal for the |^| (up-down) and |v| (down-up) versions). As before, the position of the decorator |.|,|'| denote the direction of the wire.
+\begin{codeexample}[width=0cm]
+\begin{ZX}
+  \zxN{}                         & \zxZ{}\\
+  \zxX{} \ar[IO,ru,<'] \ar[IO,rd,<.] \\
+  \zxN{}                         & \zxZ{}\\
+\end{ZX}
+\end{codeexample}
+\begin{codeexample}[width=0cm]
+\begin{ZX}
+  \zxN{} & \zxFracX{\pi}{2} \ar[IO,dl,.^] \ar[IO,dr,^.] & \\
+  \zxZ{} &                                & \zxX{}
+\end{ZX}
+\end{codeexample}
+\begin{codeexample}[width=0cm]
+\begin{ZX}
+  \zxZ{} &                                & \zxX{}\\
+  \zxN{} & \zxX{} \ar[IO,ul,'v] \ar[IO,ur,v'] &
+\end{ZX}
+\end{codeexample}
+\end{pgfmanualentry}
+
+\begin{pgfmanualentry}
+  \makeatletter
+  \def\extrakeytext{style, }
+  \extractkey/zx/wires definition/IO/N'=angle (default 60)\@nil%
+  \extractkey/zx/wires definition/IO/N.=angle (default 60)\@nil%
+  \extractkey/zx/wires definition/IO/-N'=angle (default 60)\@nil%
+  \extractkey/zx/wires definition/IO/-N.=angle (default 60)\@nil%
+  \extractkey/zx/wires definition/IO/N'-=angle (default 60)\@nil%
+  \extractkey/zx/wires definition/IO/N.-=angle (default 60)\@nil%
+  \makeatother
+  \pgfmanualbody
+  |IO| version of |N|. |N| is used to create a wire leaving at wide angle and arriving at wide angle. Adding |'| or |.| specifies if the wire is going up-right or down-right.
+\begin{codeexample}[width=3cm]
+  \begin{ZX}
+    \zxX{\alpha} \ar[IO,N.,rd] \\
+                               & \zxZ{\beta}\\
+                               & \zxZ{\alpha}\\
+    \zxX{\beta} \ar[IO,N',ru] \\
+  \end{ZX}
+\end{codeexample}
+|-| forces the angle on the side of |-| to be horizontal.
+\begin{codeexample}[width=3cm]
+  \begin{ZX}
+    \zxX{\alpha} \ar[IO,-N.,rd] \\
+                               & \zxZ{\beta}\\
+                               & \zxZ{\alpha}\\
+    \zxX{\beta} \ar[IO,N'-,ru] \\
+  \end{ZX}
+\end{codeexample}
+\end{pgfmanualentry}
+
 \begin{stylekey}{/zx/wires definition/ls=looseness}
-  Shortcut for |looseness|, allows to quickly redefine looseness. Use with care (or redefine style directly). Note that you can also change yourself other values, like |in|, |out|\dots
+  Shortcut for |looseness|, allows to quickly redefine looseness. Use with care (or redefine style directly), and \emph{do not use on styles that are not in |IO|}, since they don't use the |in|/|out| mechanism (only |(|-like styles use |in|/|out|\dots{} for now. In case you want to change looseness of |(|, prefer to use |IO,(| as it is guaranteed to be backward compatible). We may try later to give a key |looseness| for these styles, but it's not the case for now. For |IO| styles, you can also change yourself other values, like |in|, |out|\dots
 \begin{codeexample}[]
 \begin{ZX}
   \zxZ{} \ar[rd,s] \\
                    & \zxX{}\\
-  \zxZ{} \ar[rd,s,ls=3] \\
+  \zxZ{} \ar[rd,IO,s] \\
+                   & \zxX{}\\
+  \zxZ{} \ar[rd,IO,s,ls=3] \\
                    & \zxX{}
 \end{ZX}
 \end{codeexample}
@@ -767,12 +1628,12 @@
   \extractkey/zx/wires definition/bn\@nil%
   \makeatother
   \pgfmanualbody
-  When drawing wires only, the default looseness may not be good looking and holes may appear in the line. This style (whose alias is |bn|) should therefore be used when curved wires (except |C| which already has a good looseness, use |wire centered| instead) are connected together. In that case, also make sure to separate columns using |&[\zxWCol]| and row using |\\[\zxWRow]|.
+  When drawing only |IO| wires (normal wires would suffer from this parameter), the default looseness may not be good looking and holes may appear in the line. This style (whose alias is |bn|) should therefore be used when curved wires \emph{from the |IO| path} are connected together. In that case, also make sure to separate columns using |&[\zxWCol]| and rows using |\\[\zxWRow]|.
 \begin{codeexample}[width=3cm]
 A swapped Bell pair is %
 \begin{ZX}
-  \zxNone{} \ar[C,d,wc] \ar[rd,s,bn] &[\zxWCol] \zxNone{} \\[\zxWRow]
-  \zxNone{}             \ar[ru,s,bn] &          \zxNone{}
+  \zxNone{} \ar[IO,C,d,wc] \ar[rd,IO,s,bn] &[\zxWCol] \zxNone{} \\[\zxWRow]
+  \zxNone{}                \ar[ru,IO,s,bn] &          \zxNone{}
 \end{ZX}
 \end{codeexample}
 \end{pgfmanualentry}
@@ -786,7 +1647,7 @@
 \begin{stylekey}{/zx/default style nodes}
   This is where the default style must be loaded. By default, it simply loads the (nested) style packed with this library, |/zx/styles/rounded style|. You can change the style here if you would like to globally change a style.
 
-  Note that a style must typically define at least |zxZ2|, |zxX2|, |zxFracZ6|, |zxFracX6|, |\zxH|, |zxHSmall|, |zxNoPhaseSmallZ|, |zxNoPhaseSmallX|, |zxNone{,+,-,I}|, |zxNoneDouble{,+,-,I}| and all the |phase in label*|, |pil*| styles (see code on how to define them). Because the above styles (notably |zxZ*| and |zxFrac*|) are slightly complex to define (this is needed in order to implement |phase in label|), it may be quite long to implement them all properly by yourself.
+  Note that a style must typically define at least |zxZ4|, |zxX4|, |zxFracZ6|, |zxFracX6|, |\zxH|, |zxHSmall|, |zxNoPhaseSmallZ|, |zxNoPhaseSmallX|, |zxNone{,+,-,I}|, |zxNoneDouble{,+,-,I}| and all the |phase in label*|, |pil*| styles (see code on how to define them). Because the above styles (notably |zxZ*| and |zxFrac*|) are slightly complex to define (this is needed in order to implement |phase in label|, |-| versions\dots{}), it may be quite long to implement them all properly by yourself.
 
   For that reason, it may be easier to load our default style and overlay only some of the styles we use (see example in |/zx/user overlay nodes| right after). You can check our code in |/zx/styles/rounded style| to see what you can redefine (intuitively, the styles like |my style name| should be callable by the end user, |myStyleName| may be redefined by users or used in tikzit, and |my at style@name| are styles that should not be touched by the user). The styles that have most interests are |zxNoPhase| (for Z and X nodes without any phase inside), |zxShort| (for Z and X nodes for fractions typically), |zxLong| (for other Z and X nodes) and |stylePhaseInLabel| (for labels when using |phase in label|). These basic styles are extended to add colors (just add |Z|/|X| after the name) like |zxNoPhaseZ|\dots{} You can change them, but if you just want to change the color, prefer to redefine |colorZxZ|/|colorZxZ| instead (note that this color does not change |stylePhaseInLabelZ/X|, so you are free to redefine these styles as well). All the above styles can however be called from inside a tikzit style, if you want to use tikzit internally (make sure to load this library then in |*.tikzdefs|).
 
@@ -926,6 +1787,18 @@
 This is used to change how the library does the conversion between |\zxFrac| and the actual written text (either in the node content or in the label depending on the function). The first argument is the sign (string |-| for minus, anything else must be written in place of the minus), the second and third argument are the numerator and denominator of the fraction when used in |\frac{}{}| while the last two arguments are the same except that they include the parens which should be added when using an inline version. For instance, one could get a call |\zxConvertToFracInLabel{-}{a+b}{c+d}{(a+b)}{(c+d)}|. See part on labels to see an example of use.
 \end{pgfmanualentry}
 
+\begin{command}{\zxMinusInShort}
+  Sign used in |\zxZ-{\alpha}| and |\zxX-{\alpha}|-like patterns. You can redefine it, for instance:
+\begin{codeexample}[]
+Compare {\def\zxMinusInShort{-}
+  \zx{\zxZ-{\alpha}}
+} and
+{\def\zxMinusInShort{\zxMinus}
+  \zx{\zxZ-{\alpha}}
+}
+\end{codeexample}
+\end{command}
+
 \noindent We also define several spacing commands that can be redefined to your needs:
 \begin{pgfmanualentry}
   \extractcommand\zxHCol{}\@@
@@ -942,13 +1815,41 @@
   \extractcommand\zxHSRowFlat{}\@@
   \extractcommand\zxWCol{}\@@
   \extractcommand\zxWRow{}\@@
+  \extractcommand\zxwCol{}\@@
+  \extractcommand\zxwRow{}\@@
   \extractcommand\zxDotsCol{}\@@
   \extractcommand\zxDotsRow{}\@@
+  \extractcommand\zxZeroCol{}\@@
+  \extractcommand\zxZeroRow{}\@@
+  \extractcommand\zxNCol{}\@@
+  \extractcommand\zxNRow{}\@@
   \pgfmanualbody
-  These are spaces, to use like |&[\zxHCol]| or |\\[\zxHRow]| in order to increase the default spacing of rows and columns depending on the style of the wire. |H| stands for Hadamard, |S| for Spiders, |W| for Wires only, |HS| for both Spiders and Hadamard, |Dots| for the 3 dots styles. And of course |Col| for columns, |Row| for rows.
+  These are spaces, to use like |&[\zxHCol]| or |\\[\zxHRow]| in order to increase the default spacing of rows and columns depending on the style of the wire. |H| stands for Hadamard, |S| for Spiders, |W| for Wires only, |w| is you link a |zxNone| to a spider (goal is to increase the space), |N| is when you have a |\zxN| and want to reduce the space between columns, |HS| for both Spiders and Hadamard, |Dots| for the 3 dots styles, |Zero| completely resets the default column sep. And of course |Col| for columns, |Row| for rows.
+\begin{codeexample}[width=3cm]
+\begin{ZX}
+ \zxN{} \ar[rd,-N.] &[\zxwCol]    &[\zxwCol] \zxN{} \\[\zxNRow]%%
+                    & \zxX{\alpha}
+                      \ar[ru,N'-]
+                      \ar[rd,N.-] &  \\[\zxNRow]
+ \zxN{} \ar[ru,-N']               &  & \zxN{}
+\end{ZX}
+\end{codeexample}
+Note that you can add multiple of them by separating with commas (see |\pgfmatrixnextcell|'s documentation for more details). For instance to have a column separation of exactly |2mm|, do |&[\zxZeroCol,2mm]| (if you just do |&[2mm]| the column will be |2mm| larger).
 \end{pgfmanualentry}
 
+\begin{pgfmanualentry}
+  \def\extrakeytext{style, }
+  \extractcommand\zxDefaultColumnSep{}\@@
+  \extractcommand\zxDefaultRowSep{}\@@
+  \makeatletter% should not be letter for \@@... strange
+  \extractkey/zx/defaultEnv/zx column sep=length\@nil%
+  \extractkey/zx/defaultEnv/zx row sep=length\@nil%
+  \makeatother
+  \pgfmanualbody
+  |\zxDefaultColumn/RowSep| are the column and row space, and the corresponding styles are to change a single matrix. Prefer to change these parameters compared to changing the |row sep| and |column sep| (without |zx|) of the matrix directly since other spacing styles like |\zxZeroCol| or |\zxNCol| depend on |\zxDefaultColumn|.
+\end{pgfmanualentry}
 
+
 \begin{pgfmanualentry}
   \extractcommand\zxDefaultSoftAngleS{}\@@
   \extractcommand\zxDefaultSoftAngleO{}\@@
@@ -961,9 +1862,693 @@
   The minus sign used in fractions.
 \end{command}
 
+\subsection{Wire customization}\label{subsec:wirecustom}
+
+\begin{pgfmanualentry}
+  \makeatletter
+  \def\extrakeytext{style, }
+  \extractkey/zx/args/-andL/\@nil%
+  \extractkey/zx/args/-andL/defaultO (default {-=.2,L=.4})\@nil%
+  \extractkey/zx/args/-andL/defaultN (default {-=.2,L=.8})\@nil%
+  \extractkey/zx/args/-andL/defaultN- (default {1-=.4,1L=0})\@nil%
+  \extractkey/zx/args/-andL/defaultNN (default {})\@nil%
+  \extractkey/zx/args/-andL/defaultNIN (default {1-=0,1L=.6})\@nil%
+  \extractkey/zx/args/-andL/defaultS (default {-=.8,L=0})\@nil%
+  \extractkey/zx/args/-andL/defaultS' (default {-=.8,L=.2})\@nil%
+  \extractkey/zx/args/-andL/default-S (default {1-=.8,1L=0})\@nil%
+  \extractkey/zx/args/-andL/defaultSIS (default {1-=0,1L=.8})\@nil%
+  \makeatother
+  \pgfmanualbody
+  Default values used by wires (). You can customize them globally using something like:
+  \begin{verse}
+    |\tikzset{|\\
+    |  /zx/args/-andL/.cd,|\\
+    |  defaultO/.style={-=.2,L=.4}|\\
+    |}|
+   \end{verse}
+   Basically |defaultO| will configure all the |o| familly, |defaultS'| will configure all the ``soft'' versions of |s|, |default-S| will configure the anchor on the side of the vertical arrival\dots{} For more details or which wire uses which configuration, check the default value given in each style definition.
+\end{pgfmanualentry}
+
+\subsection{Wires starting inside or on the boundary of the node}\label{subsec:wiresInsideOutside}
+
+This library provides multiple methods to draw the wires between the nodes (for all curves depending on |bezier|, which is basically everything but |C| and straight lines).
+
+\paragraph{Default drawing method.}
+By default the lines will be drawn behind the node and the starting and ending points will be defined to be a |fake center *| anchor (if it exists, the exact chosen anchors (north, south\dots{}) depending on the direction). Because this anchor lies behind the node, we put them on the |edgelayer| layer. For debugging purpose, it can be practical to display them:
+\begin{pgfmanualentry}
+  \def\extrakeytext{style, }
+  \extractcommand\zxEdgesAbove\@@
+  \makeatletter% should not be letter for \@@... strange
+  \extractkey/zx/wires definition/edge above\@nil%
+  \extractkey/zx/wires definition/edge not above\@nil%
+  \makeatother
+  \pgfmanualbody
+  If the macro |\zxEdgesAbove| is undefined (using |\let\zxEdgesAbove\undefined|) edges will be drawn above the nodes. To change it on a per-edge basis, use |edge above| (or its contrary |edge not above|) \emph{before the name of the wire}. This is mostly useful to understand how lines are drawn and for debugging purpose.
+\begin{codeexample}[]
+  What you see:
+  \zx{\zxZ{\alpha+\beta} \ar[dr,s] \\
+                         & \zxZ{\alpha+\beta}}
+  What is drawn:
+  \zx{\zxZ{\alpha+\beta} \ar[dr,edge above,s] \\
+                         & \zxZ{\alpha+\beta}}
+\end{codeexample}
+(you can node the fact that the wire does not start at the center but at a |fake center *| anchor to provide a nicer look)
+\end{pgfmanualentry}
+
+\begin{pgfmanualentry}
+  \def\extrakeytext{style, }
+  \extractcommand\zxControlPointsVisible\@@
+  \makeatletter% should not be letter for \@@... strange
+  \extractkey/zx/wires definition/control points visible\@nil%
+  \extractkey/zx/wires definition/control points not visible\@nil%
+  \makeatother
+  \pgfmanualbody
+  Similarly, it can be useful for debugging to see the control points of the curves (note that |C|, straight lines and |(| wires are not based on our curve system, so it won't do anything for them). If the macro |\zxControlPointsVisible| is defined (using |\def\zxEdgesAbove{}|) control points will be drawn. To change it on a per-edge basis, use |control points visible| (or its contrary |control points not visible|). This is mostly useful to understand how lines are drawn and for debugging purpose.
+\begin{codeexample}[]
+  Controls not visible:
+  \zx{\zxZ{\alpha+\beta} \ar[dr,s] \\
+                         & \zxZ{\alpha+\beta}}
+  Control visible:
+  \zx{\zxZ{\alpha+\beta} \ar[dr,control points visible,s] \\
+                         & \zxZ{\alpha+\beta}}
+  Control visible + edge above:
+  \zx{\zxZ{\alpha+\beta} \ar[dr,edge above,control points visible,s] \\
+                         & \zxZ{\alpha+\beta}}
+\end{codeexample}
+\textbf{WARNING}: this command adds some points in the wire path, and in particular if you have a |H| wire (Hadamard in the middle of the wire), this option will not place it correctly. But it's not really a problem since it's just to do a quick debugging.
+\end{pgfmanualentry}
+
+Unfortunately, the default drawing method also has drawbacks. For instance, when using the |H| edge between a spider and an empty node, the ``middle'' of the edge will appear too close to the center by default (we draw the first edge above to illustrate the reason of this visual artifact):
+\begin{codeexample}[width=0cm]
+\begin{ZX}
+ \zxN{} \ar[rd,edge above,-N.,H] &[\zxwCol,\zxHCol]  &[\zxwCol,\zxHCol] \zxN{} \\[\zxNRow]%%
+                                 & \zxX{\alpha}
+                                   \ar[ru,N'-,H]
+                                   \ar[rd,N.-,H] &  \\[\zxNRow]
+ \zxN{} \ar[ru,-N',H]                        &  & \zxN{}
+\end{ZX}
+\end{codeexample}
+To solve that issue, you need to manually position the |H| node as shown before:
+\begin{codeexample}[width=0cm]
+\begin{ZX}
+ \zxN{} \ar[rd,edge above,-N.,H={pos=.35}] &[\zxwCol,\zxHCol]  &[\zxwCol,\zxHCol] \zxN{} \\[\zxNRow]%%
+                                           & \zxX{\alpha}
+                                             \ar[ru,N'-,H={pos=1-.35}]
+                                             \ar[rd,N.-,H={pos=1-.35}] &  \\[\zxNRow]
+ \zxN{} \ar[ru,-N',H={pos=.35}]                                  &  & \zxN{}
+\end{ZX}
+\end{codeexample}
+Or manually position the anchor outside the node (you can use angles, centered on the real center on the shape), but be aware that it can change the shape of the node (see below):
+\begin{codeexample}[width=0cm]
+\begin{ZX}
+ \zxN{} \ar[rd,edge above,-N.,H,end anchor=180-45] &[\zxwCol,\zxHCol]  &[\zxwCol,\zxHCol] \zxN{} \\[\zxNRow]%%
+                                           & \zxX{\alpha}
+                                             \ar[ru,N'-,H,start anchor=45]
+                                             \ar[rd,N.-,H,start anchor=-45] &  \\[\zxNRow]
+ \zxN{} \ar[ru,-N',H,end anchor=180+45]                                  &  & \zxN{}
+\end{ZX}
+\end{codeexample}
+
+A second drawback is that it is not possible to add arrows on the curved wires (except |C| which uses a different approach), since they will be hidden behind the node:
+\begin{codeexample}[]
+  What you see:
+  \zx{\zxZ{\alpha+\beta} \ar[dr,s,<->] \\
+                         & \zxZ{\alpha+\beta}}
+  What is drawn:
+  \zx{\zxZ{\alpha+\beta} \ar[dr,edge above,s,<->] \\
+                         & \zxZ{\alpha+\beta}}
+\end{codeexample}
+Here, the only solution (without changing the drawing mode) is to manually position the anchor as before\dots{} but note that on nodes with a large content |45| degrees is actually nearly on the top since the angle is not taken from a fake center but from the real center of the node.
+\begin{codeexample}[]
+  \zx{\zxZ{\alpha+\beta} \ar[dr,s,<->,start anchor=-45,end anchor=180-45] \\
+                         & \zxZ{\alpha+\beta}}
+  \zx{\zxZ{\alpha+\beta} \ar[dr,s,<->,start anchor=-15,end anchor=180-15] \\
+                         & \zxZ{\alpha+\beta}}
+\end{codeexample}
+ Note that the shape of the wire may be a bit different since the ending and leaving parts was hidden before, and the current styles are not designed to look nicely when starting on the border of a node. For that reason, you may need to tweak the style of the wire yourself using |-|, |L| options.
+
+ \paragraph{The ``intersection'' drawing methods}
+
+ We also define other modes to draw wires (they are very new and not yet tested a lot). In the first mode, appropriate |fake center *| is taken, then depending on the bezier control points, a point is taken on the border of the shape (starting from the fake center and using the direction of the bezier control point). Then the node is drawn. Here is how to enable this mode:
+
+\begin{pgfmanualentry}
+  \def\extrakeytext{style, }
+  \extractcommand\zxEnableIntersections\marg{}\@@
+  \extractcommand\zxDisableIntersections\marg{}\@@
+  \extractcommand\zxEnableIntersectionsNodes\@@
+  \extractcommand\zxEnableIntersectionsWires\@@
+  \makeatletter% should not be letter for \@@... strange
+  \extractkey/zx/wires definition/use intersections\@nil%
+  \extractkey/zx/wires definition/dont use intersections\@nil%
+  \makeatother
+  \pgfmanualbody
+  The simpler method to enables or disable intersections is to call |\zxEnableIntersections{}| or |\zxDisableIntersections{}| (potentially in a group to have a local action only). Note that \emph{this does not automatically adapt the styles}, see |ui| to adapt the styles automatically.
+\begin{codeexample}[width=0cm]
+{% Enable intersections (but does not load our custom "intersections" style, see ui).
+  \zxEnableIntersections{}% Small space left = artifact of the documentation
+  \begin{ZX}
+    \zxN{} \ar[rd,edge above,-N.,H] &[\zxwCol,\zxHCol] &[\zxwCol,\zxHCol] \zxN{} \\[\zxNRow]%%
+                                    & \zxX{\alpha}
+                                      \ar[ru,N'-,H]
+                                      \ar[rd,N.-,H]    &  \\[\zxNRow]
+    \zxN{} \ar[ru,-N',H]            &                  & \zxN{}
+  \end{ZX}
+}
+\end{codeexample}
+(The |edge above| is just to show that the wire does not go inside.) However, this method enable intersections for the whole drawing. You can disable it for a single arrow using the |dont use intersections| style. But it is possible instead to enable it for a single wire. To do that, first define |\def\zxEnableIntersectionsNodes{}| (it will automatically add a |name path| on each node. If you don't care about optimizations, you can just define it once at the beginning of your project), and then use |use intersections| on the wires which should use intersections:
+\begin{codeexample}[width=0cm]
+{% Create the machinary needed to compute intersections, but does not enable it.
+  \def\zxEnableIntersectionsNodes{}% Small space left = artifact of the documentation
+  \begin{ZX}
+    \zxN{} \ar[rd,edge above,-N.,H, %% "use intersections" does not load any style, cf ui.
+            use intersections] &[\zxwCol,\zxHCol]  &[\zxwCol,\zxHCol] \zxN{} \\[\zxNRow]%%
+                                                   & \zxX{\alpha}
+                                                     \ar[ru,edge above,N'-,H,use intersections]
+                                                        \ar[rd,edge above,N.-,H]  &  \\[\zxNRow]
+    \zxN{} \ar[ru,edge above,-N',H]                &                              & \zxN{}
+  \end{ZX}
+}
+\end{codeexample}
+\end{pgfmanualentry}
+
+\begin{pgfmanualentry}
+  \def\extrakeytext{style, }
+  \makeatletter% should not be letter for \@@... strange
+  \extractkey/zx/wires definition/ui\@nil%
+  \makeatother
+  \pgfmanualbody
+  This method has however a few drawbacks. One of the first reason that explains why we don't use it by default is that it is quite long to compute (it involves the |intersections| library to obtain the bezier point to start at and my code may also be not very well optimized as I'm a beginner with \LaTeX{} and \tikzname{} programming\dots{} and what a strange language!). Secondly, it has not yet been tested a lot. Note also that the default wire styles have not been optimized for this setup and the results may vary compared to the default drawing mode (sometimes they are ``better'', sometimes they are not). We have however tried to define a second style |/zx/args/-andL/ui/| that have nicer results. To load it, just type |ui| \emph{before the wire style name}, it will automatically load |use intersections| together with our custom styles (see below how to use |user overlay wires| to load it by default):
+%%% I'm not sure why, but inside codeexample if I write zxEnableIntersections{}%<go to line>\begin{ZX}... then an additional space is added... Not sure why.
+\begin{codeexample}[]
+{%
+  \def\zxEnableIntersectionsNodes{}
+  Before \begin{ZX}
+    \zxX{\beta} \ar[r,o'] & \zxX{}
+  \end{ZX} after \begin{ZX}
+    \zxX{\beta} \ar[r,o',use intersections] & \zxX{}
+  \end{ZX} corrected manually \begin{ZX}
+    \zxX{\beta} \ar[r,edge above, use intersections, o'={-=.2,L=.15}] & \zxX{}
+  \end{ZX} or with our custom style \begin{ZX}
+    \zxX{\beta} \ar[r,edge above, ui, o'] & \zxX{}
+  \end{ZX}.
+}
+\end{codeexample}
+Here are further comparisons:
+\begin{codeexample}[]
+{%
+  \def\zxEnableIntersectionsNodes{}
+  Before \begin{ZX}
+    \zxX{} \ar[r,o'] & \zxX{}
+  \end{ZX} ui \begin{ZX}
+    \zxX{} \ar[r, ui, o'] & \zxX{}
+  \end{ZX}. Before \begin{ZX}
+    \zxX{\alpha} \ar[r,o'] & \zxZ{\beta}
+  \end{ZX} ui \begin{ZX}
+    \zxX{\alpha} \ar[r, ui, o'] & \zxZ{\beta}
+  \end{ZX}. Before \begin{ZX}
+    \zxX{\alpha+\beta} \ar[r,o'] & \zxZ{\alpha+\beta}
+  \end{ZX} ui \begin{ZX}
+    \zxX{\alpha+\beta} \ar[r, ui, o'] & \zxZ{\alpha+\beta}
+  \end{ZX}.
+}
+\end{codeexample}
+With |N|:
+\begin{codeexample}[]
+{%
+  \def\zxEnableIntersectionsNodes{}
+  \begin{ZX}
+    \zxX{} \ar[rd,N]\\ & \zxX{}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{} \ar[rd,ui,N]\\ & \zxX{}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha} \ar[rd,N]\\ & \zxX{}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha} \ar[rd,ui,N]\\ & \zxX{}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha} \ar[rd,N]\\ & \zxX{\beta}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha} \ar[rd,ui,N]\\ & \zxX{\beta}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha+\beta} \ar[rd,N]\\ & \zxX{\alpha+\beta}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha+\beta} \ar[rd,ui,N]\\ & \zxX{\alpha+\beta}
+  \end{ZX}.
+}
+\end{codeexample}
+
+With |N-|:
+\begin{codeexample}[]
+{%
+  \def\zxEnableIntersectionsNodes{}
+  \begin{ZX}
+    \zxX{} \ar[rd,N-]\\ & \zxX{}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{} \ar[rd,ui,N-]\\ & \zxX{}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha} \ar[rd,N-]\\ & \zxX{}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha} \ar[rd,ui,N-]\\ & \zxX{}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha} \ar[rd,N-]\\ & \zxX{\beta}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha} \ar[rd,ui,N-]\\ & \zxX{\beta}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha+\beta} \ar[rd,N-]\\ & \zxX{\alpha+\beta}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha+\beta} \ar[rd,ui,N-]\\ & \zxX{\alpha+\beta}
+  \end{ZX}.
+}
+\end{codeexample}
+
+With |<.|:
+\begin{codeexample}[]
+{%
+  \def\zxEnableIntersectionsNodes{}
+  \begin{ZX}
+    \zxX{} \ar[rd,<.]\\ & \zxX{}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{} \ar[rd,ui,<.]\\ & \zxX{}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha} \ar[rd,<.]\\ & \zxX{}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha} \ar[rd,ui,<.]\\ & \zxX{}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha} \ar[rd,<.]\\ & \zxX{\beta}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha} \ar[rd,ui,<.]\\ & \zxX{\beta}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha+\beta} \ar[rd,<.]\\ & \zxX{\alpha+\beta}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha+\beta} \ar[rd,ui,<.]\\ & \zxX{\alpha+\beta}
+  \end{ZX}.
+}
+\end{codeexample}
+
+With |NIN|:
+\begin{codeexample}[]
+{%
+  \def\zxEnableIntersectionsNodes{}
+  \begin{ZX}
+    \zxX{} \ar[rd,NIN]\\ & \zxX{}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{} \ar[rd,ui,NIN]\\ & \zxX{}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha} \ar[rd,NIN]\\ & \zxX{}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha} \ar[rd,ui,NIN]\\ & \zxX{}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha} \ar[rd,NIN]\\ & \zxX{\beta}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha} \ar[rd,ui,NIN]\\ & \zxX{\beta}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha+\beta} \ar[rd,NIN]\\ & \zxX{\alpha+\beta}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha+\beta} \ar[rd,ui,NIN]\\ & \zxX{\alpha+\beta}
+  \end{ZX}.
+}
+\end{codeexample}
+
+With this mode |s| behaves basically like |S| since the only difference is the anchor:
+\begin{codeexample}[]
+{%
+  \def\zxEnableIntersectionsNodes{}
+  \begin{ZX}
+    \zxX{} \ar[rd,s]\\ & \zxX{}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{} \ar[rd,ui,s]\\ & \zxX{}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha} \ar[rd,s]\\ & \zxX{}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha} \ar[rd,ui,s]\\ & \zxX{}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha} \ar[rd,s]\\ & \zxX{\beta}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha} \ar[rd,ui,s]\\ & \zxX{\beta}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha+\beta} \ar[rd,s]\\ & \zxX{\alpha+\beta}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha+\beta} \ar[rd,ui,s]\\ & \zxX{\alpha+\beta}
+  \end{ZX}.
+}
+\end{codeexample}
+
+With |s'|:
+\begin{codeexample}[]
+{%
+  \def\zxEnableIntersectionsNodes{}
+  \begin{ZX}
+    \zxX{} \ar[rd,s']\\ & \zxX{}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{} \ar[rd,ui,s']\\ & \zxX{}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha} \ar[rd,s']\\ & \zxX{}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha} \ar[rd,ui,s']\\ & \zxX{}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha} \ar[rd,s']\\ & \zxX{\beta}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha} \ar[rd,ui,s']\\ & \zxX{\beta}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha+\beta} \ar[rd,s']\\ & \zxX{\alpha+\beta}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha+\beta} \ar[rd,ui,s']\\ & \zxX{\alpha+\beta}
+  \end{ZX}.
+}
+\end{codeexample}
+
+With |-s|:
+\begin{codeexample}[]
+{%
+  \def\zxEnableIntersectionsNodes{}
+  \begin{ZX}
+    \zxX{} \ar[rd,-s]\\ & \zxX{}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{} \ar[rd,ui,-s]\\ & \zxX{}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha} \ar[rd,-s]\\ & \zxX{}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha} \ar[rd,ui,-s]\\ & \zxX{}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha} \ar[rd,-s]\\ & \zxX{\beta}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha} \ar[rd,ui,-s]\\ & \zxX{\beta}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha+\beta} \ar[rd,-s]\\ & \zxX{\alpha+\beta}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha+\beta} \ar[rd,ui,-s]\\ & \zxX{\alpha+\beta}
+  \end{ZX}.
+}
+\end{codeexample}
+
+With |SIS|:
+\begin{codeexample}[]
+{%
+  \def\zxEnableIntersectionsNodes{}
+  \begin{ZX}
+    \zxX{} \ar[rd,SIS]\\ & \zxX{}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{} \ar[rd,ui,SIS]\\ & \zxX{}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha} \ar[rd,SIS]\\ & \zxX{}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha} \ar[rd,ui,SIS]\\ & \zxX{}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha} \ar[rd,SIS]\\ & \zxX{\beta}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha} \ar[rd,ui,SIS]\\ & \zxX{\beta}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha+\beta} \ar[rd,SIS]\\ & \zxX{\alpha+\beta}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha+\beta} \ar[rd,ui,SIS]\\ & \zxX{\alpha+\beta}
+  \end{ZX}.
+}
+\end{codeexample}
+
+With |^.|:
+\begin{codeexample}[]
+{%
+  \def\zxEnableIntersectionsNodes{}
+  \begin{ZX}
+    \zxX{} \ar[rd,^.]\\ & \zxX{}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{} \ar[rd,ui,^.]\\ & \zxX{}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha} \ar[rd,^.]\\ & \zxX{}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha} \ar[rd,ui,^.]\\ & \zxX{}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha} \ar[rd,^.]\\ & \zxX{\beta}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha} \ar[rd,ui,^.]\\ & \zxX{\beta}
+  \end{ZX}.
+  \begin{ZX}
+    \zxX{\alpha+\beta} \ar[rd,^.]\\ & \zxX{\alpha+\beta}
+  \end{ZX} $\Rightarrow $ ui \begin{ZX}
+    \zxX{\alpha+\beta} \ar[rd,ui,^.]\\ & \zxX{\alpha+\beta}
+  \end{ZX}.
+}
+\end{codeexample}
+
+Now using our favorite drawing. Here we illustrate how we apply our custom style to all arrows.
+\begin{codeexample}[width=0pt]
+\def\zxEnableIntersectionsNodes{}%
+\tikzset{
+  /zx/user overlay wires/.style={
+    ui, % Other method
+  }
+}
+\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=Xdown]{}         & \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=Xdown]
+  % Column 3
+  \ar[from=xmiddle,to=Xdown,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=Xdown,to=out3,<.]
+\end{ZX}
+\end{codeexample}
+
+The same using |control points visible| to check if the good styles are applied:
+\begin{codeexample}[width=0pt]
+\def\zxEnableIntersectionsNodes{}%
+\tikzset{
+  /zx/user overlay wires/.style={
+    ui, % Enable our style on all
+    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=Xdown]{}         & \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=Xdown]
+  % Column 3
+  \ar[from=xmiddle,to=Xdown,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=Xdown,to=out3,<.]
+\end{ZX}
+\end{codeexample}
+
+Now, we can also globally enable the |ui| style and the intersection only for some kinds of arrows. For instance (here we enable it for all styles based on |N|, i.e.\ |*N*| and |>|-like wires). See that the |s| node is note using the intersections mode:
+\begin{codeexample}[width=0pt]
+\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=Xdown]{}         & \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=Xdown]
+  % Column 3
+  \ar[from=xmiddle,to=Xdown,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=Xdown,to=out3,<.]
+\end{ZX}
+\end{codeexample}
+
+\end{pgfmanualentry}
+
+
+\begin{pgfmanualentry}
+  \def\extrakeytext{style, }
+  \extractcommand\zxIntersectionLineBetweenStartEnd\@@
+  \makeatletter% should not be letter for \@@... strange
+  \extractkey/zx/wires definition/intersections mode between start end\@nil%
+  \extractkey/zx/wires definition/intersections mode bezier controls\@nil%
+  \makeatother
+  \pgfmanualbody
+
+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.
+\begin{codeexample}[]
+{%
+  \def\zxEnableIntersectionsNodes{}
+  \begin{ZX}
+    \zxX{\alpha} \ar[rd,N]\\ & \zxX{\beta}
+  \end{ZX} $\Rightarrow $ 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 $ 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}.
+}
+\end{codeexample}
+\end{pgfmanualentry}
+
+\subsection{Nested diagrams}
+
+
+If you consider this example:
+
+\begin{codeexample}[]
+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}
+\end{codeexample}
+
+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 \emph{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):
+
+\begin{codeexample}[width=0pt]
+%% Create a new box
+\newsavebox{\myZXbox}
+%% Save our small diagram.
+%% Warning: the char '&' cause troubles in functions, so use ampersand replacement
+%% and \& instead:
+\sbox{\myZXbox}{%
+  \zx[ampersand replacement=\&]{ %<-- strange font? this is just an ampersand.
+    \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}$
+\end{codeexample}
+
+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):
+
+\begin{pgfmanualentry}
+  \def\extrakeytext{style, }
+  \extractcommand\zxSaveDiagram\marg{name with backslash}\opt{\oarg{zx options}}\marg{diagram with ampersand \textbackslash\&}\@@
+  \makeatletter% should not be letter for \@@... strange
+  \extractkey/zx/wires definition/use diagram=\marg{name with \textbackslash}\marg{(nodes)(to)(fit)}\@nil%
+  \makeatother
+  \pgfmanualbody
+  Use |\zxSaveDiagram| to save and name a diagram (must be done before the diagram you want to insert this diagram into, also \textbf{do not forget the backslash before the name} and \textbf{replace all} |&| \textbf{in the first diagram with} |\&|. Then, |use diagram| to insert it inside a diagram (the second argument is a list of nodes given to the |fit| library):
+\begin{codeexample}[width=0pt]
+%%             v---- note the backslash      note the \&   ---v
+\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}$
+\end{codeexample}
+Note that if you need more space to insert the drawing, you can use |\zxN+[a=start,minimum width=2cm]{}| instead of |\zxN|.
+\end{pgfmanualentry}
+
 \subsection{Further customization}
 
-You can further customize your drawings using any functionality from \tikzname{} 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 using:
+You can further customize your drawings using any functionality from \tikzname{} 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):
 \begin{codeexample}[width=0pt]
   \begin{ZX}[row sep=1mm]
                 &                                         &                        & & \zxZ{\pi} \\
@@ -1039,9 +2624,14 @@
 \end{ZX}
 \end{codeexample}
 }
+
+\section{Futur 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 \mylink{https://github.com/leo-colisson/zx-calculus/issues}{one the github page}. I also would like to provide externalization to boost compilation time. But |tikz-cd| is not really compatible with externalization, so it would need a bit of work (of course, you can always compile your images in a separate file, but it is cumbersome). See potential solutions here: \mylink{https://tex.stackexchange.com/questions/171931/}{here}. 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 \mylink{https://tikzcd.yichuanshen.de/}{this tool}). 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 (see ). 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!
+
 \section{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 (sorry, I don't want to risk an incomplete list) that helped me to understand a bit more \LaTeX and \tikzname. I also thank Robert Booth for making me realize how my old style was bad, and for giving advices on how to improve it. Thanks to John van de Wetering, whose style has also been a source of inspiration.
+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 \tikzname{} (sorry, I don't want to risk an incomplete list, but many thanks to egreg, David Carlisle, cfr, percusse, Andrew Stacey, Henri Menke, SebGlav\dots{}). I also thank Robert Booth for making me realize how my old style was bad, and for giving advices on how to improve it. Thanks to John van de Wetering, whose style has also been a source of inspiration.
 
 \printindex
 

Modified: trunk/Master/texmf-dist/tex/latex/zx-calculus/tikzlibraryzx-calculus.code.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/zx-calculus/tikzlibraryzx-calculus.code.tex	2021-10-22 21:33:43 UTC (rev 60837)
+++ trunk/Master/texmf-dist/tex/latex/zx-calculus/tikzlibraryzx-calculus.code.tex	2021-10-22 21:35:38 UTC (rev 60838)
@@ -1,5 +1,5 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%% Version: 2021/10/15
+%%% Version: 2021/10/22
 %%% License: MIT
 %%% Author: Léo Colisson
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -15,7 +15,7 @@
 \RequirePackage{xparse} % For NewDocumentComments
 \RequirePackage{bm} % For bold math fonts
 
-\usetikzlibrary{cd,backgrounds,positioning,shapes,calc}
+\usetikzlibrary{cd,backgrounds,positioning,shapes,calc,intersections}
 % Declare layers.
 \pgfdeclarelayer{background} % Fox boxes using "fit" to group parts of the graph.
 \pgfdeclarelayer{edgelayer} % For edges that are explicitely defined "wc"
@@ -28,6 +28,7 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%% User modifiable variables
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 % Define colors, can be redefine by user
 \definecolor{colorZxZ}{RGB}{204,255,204}
 \definecolor{colorZxX}{RGB}{255,136,136}
@@ -54,11 +55,24 @@
 \newcommand{\zxHSColFlat}{1mm}
 \newcommand{\zxHSRowFlat}{1mm}
 %% Wires only: when adding only wires with empty nodes, the space between columns can be too small. Useful not to shrink swap gates...
-\newcommand{\zxWCol}{.55em}
-\newcommand{\zxWRow}{.55em}
+\newcommand{\zxWCol}{2mm}
+\newcommand{\zxWRow}{2mm}
+%% Same as zxWCol, but when a single empty node is connected to a non-empty node.
+\newcommand{\zxwCol}{1mm}
+\newcommand{\zxwRow}{1mm}
 %% When vdots/dots are used in lines
 \newcommand{\zxDotsCol}{3mm}
 \newcommand{\zxDotsRow}{3mm}
+%% Default separation between rows and columns
+\newcommand{\zxDefaultColumnSep}{1.5mm}
+\newcommand{\zxDefaultRowSep}{1.5mm}
+% To cancel the default tow separation
+\newcommand{\zxZeroCol}{-\zxDefaultColumnSep}
+\newcommand{\zxZeroRow}{-\zxDefaultRowSep}
+%% When adding two lines with only empty nodes, it can create quite a large space. Use this to reduce it
+%% Yes, we can add multiple arguments, space will add up (see documentation pgfmatrixnextcell)
+\newcommand{\zxNCol}{-\zxDefaultColumnSep,.5mm}
+\newcommand{\zxNRow}{-\zxDefaultRowSep,.5mm}
 
 
 % Angles by default for s and o related arrows
@@ -67,6 +81,48 @@
 \def\zxDefaultSoftAngleO{40}
 \def\zxDefaultSoftAngleChevron{60}
 
+% Angles by default for s and o related arrows
+\def\zxDefaultSoftAngleS{30}
+\def\zxDefaultSoftAngleN{60}
+\def\zxDefaultSoftAngleO{40}
+\def\zxDefaultSoftAngleChevron{60}
+
+% Angles by default for s and o related arrows (in/out version)
+\def\zxDefaultSoftAngleN{60}
+\def\zxDefaultSoftAngleO{40}
+\def\zxDefaultSoftAngleChevron{60}
+
+% Styles for O,N,... (new bezier version)
+\tikzset{
+  /zx/args/-andL/.cd,
+  defaultO/.style={-=.2,L=.4},
+  defaultN/.style={-=.2,L=.8},
+  defaultN-/.style={1-=.4,1L=0},
+  defaultNN/.style={},
+  defaultNIN/.style={1-=0,1L=.6},
+  defaultChevron/.style={}, % < should be stronger than N- also in ui mode.
+  defaultChevronDown/.style={}, % The ^ v versions (default NN and default NIN will be loaded before).
+  defaultS/.style={-=.8,L=0},
+  defaultS'/.style={-=.8,L=.2},
+  default-S/.style={1-=.8,1L=0},
+  defaultSIS/.style={1-=0,1L=.8},
+  % Loads the default styles for the "use intersection" method.
+  /zx/args/-andL/ui/.style={
+    /zx/args/-andL/defaultO/.style={-=.2,L=.17},
+    /zx/args/-andL/defaultN/.style={-=.2,L=.7},
+    /zx/args/-andL/defaultN-/.style={1-=.5,1L=.2,2-=.2,2L=.5}, %% Todo: write a different style for <
+    /zx/args/-andL/defaultNN/.style={},
+    /zx/args/-andL/defaultChevron/.style={1-=.2,1L=0,2-=.2,2L=.8},
+    /zx/args/-andL/defaultChevronDown/.style={1L=.2,1-=0,2L=.2,2-=.8},
+    /zx/args/-andL/defaultNIN/.style={1-=0,1L=.66,2-=.55,2L=.16},
+    /zx/args/-andL/defaultS/.style={-=.8,L=0},
+    /zx/args/-andL/defaultS'/.style={-=.8,L=.3},
+    /zx/args/-andL/default-S/.style={1-=.8,1L=0},
+    /zx/args/-andL/defaultSIS/.style={1-=0,1L=.8,2-=.15,2L=.6},
+  },
+}
+
+
 % Scale to use when scaling 3 dots
 \def\zxScaleDots{.7}
 
@@ -86,11 +142,410 @@
   \ifthenelse{\equal{#1}{-}}{\zxMinus}{#1}#4/#5%
 }
 
+% Minus sign to use in \zxZ-{\alpha}
+%\NewExpandableDocumentCommand{\zxMinusInShort}{}{-}
+\NewExpandableDocumentCommand{\zxMinusInShort}{}{-}
 
+% The library tries to find intersection between fake center east/... and the border of the node
+% to draw the nodes directly on the border.
+% To enable this function (can also be set locally), enable this macro:
+% \def\zxEnableIntersectionsNodes{} %% To add the "name shape" on each node
+% \def\zxEnableIntersectionsWires{} %% For wires only (can't work without \zxEnableIntersectionsNodes)
+\newcommand{\zxEnableIntersections}{%
+  \def\zxEnableIntersectionsWires{}%
+  \def\zxEnableIntersectionsNodes{}%
+}
+% to disable intersections, undefined it:
+\let\zxEnableIntersectionsNodes\undefined
+\let\zxEnableIntersectionsWires\undefined
+\newcommand{\zxDisableIntersections}{%
+  \let\zxEnableIntersectionsNodes\undefined%
+  \let\zxEnableIntersectionsWires\undefined%
+}
+% Now, if it cannot find a good intersection (either because "name path" is disabled, or
+% because no intersection is found, or because intersections are disabled anyway) we need to
+% have a fallback mechanism. Either we choose instead the "fake center" (or center if fake
+% center does not exists), but then the wire will be hidden behind the node (it is a problem
+% mostly if you use H nodes a lot, otherwise we recommend this solution):
+\def\zxWireInsideIfNoIntersectionName{}
+% If you prefer to start the wire on the surface of the node, do that instead...
+% but be aware that the shape of the wire will be changed a lot, since we can't use anymore the
+% fake anchors... You could also define a style that does that.
+% \let\zxWireInsideIfNoIntersectionName\undefined
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%% Adding anchors
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% We add anchors "fake center {north, south, east, west}" to the nodes. The wires will leave from these anchors (except in IO mode) depending on the direction. If the anchor does not exist, center is picked.
+% https://tex.stackexchange.com/questions/14769/add-more-anchors-to-standard-tikz-nodes
+\def\zx at pgfaddtoshape#1#2{%
+  \begingroup
+  \def\pgf at sm@shape at name{#1}%
+  \let\anchor\pgf at sh@anchor
+  #2%
+  \endgroup
+}
+\def\zx at useanchor#1#2{\csname pgf at anchor@#1@#2\endcsname}
+\zx at pgfaddtoshape{rounded rectangle}{%
+  \anchor{fake center east}{%
+    \zx at useanchor{rounded rectangle}{north east}%
+    \pgf at yc=.5\pgf at y% final y = 0.5*this y + 0.5*other y.
+    \zx at useanchor{rounded rectangle}{south east}%
+    \pgf at y=.5\pgf at y%
+    \advance\pgf at y by \pgf at yc%
+  }%
+  \anchor{fake center west}{%
+    \zx at useanchor{rounded rectangle}{north west}%
+    \pgf at yc=.5\pgf at y% final y = 0.5*this y + 0.5*other y.
+    \zx at useanchor{rounded rectangle}{south west}%
+    \pgf at y=.5\pgf at y%
+    \advance\pgf at y by \pgf at yc%
+  }%
+  \anchor{fake center north}{%
+    \zx at useanchor{rounded rectangle}{center}%
+  }%
+  \anchor{fake center south}{%
+    \zx at useanchor{rounded rectangle}{center}%
+  }%
+}
+
+\zx at pgfaddtoshape{coordinate}{%
+  \anchor{fake center east}{%
+    \zx at useanchor{coordinate}{center}%
+  }%
+  \anchor{fake center west}{%
+    \zx at useanchor{coordinate}{center}%
+  }%
+  \anchor{fake center north}{%
+    \zx at useanchor{coordinate}{center}%
+  }%
+  \anchor{fake center south}{%
+    \zx at useanchor{coordinate}{center}%
+  }%
+}
+
+\zx at pgfaddtoshape{circle}{%
+  \anchor{fake center east}{%
+    \zx at useanchor{circle}{center}%
+  }%
+  \anchor{fake center west}{%
+    \zx at useanchor{circle}{center}%
+  }%
+  \anchor{fake center north}{%
+    \zx at useanchor{circle}{center}%
+  }%
+  \anchor{fake center south}{%
+    \zx at useanchor{circle}{center}%
+  }%
+}
+
+\zx at pgfaddtoshape{rectangle}{
+  \anchor{fake center east}{%
+    \zx at useanchor{rectangle}{center}%
+  }%
+  \anchor{fake center west}{%
+    \zx at useanchor{rectangle}{center}%
+  }%
+  \anchor{fake center north}{%
+    \zx at useanchor{rectangle}{center}%
+  }%
+  \anchor{fake center south}{%
+    \zx at useanchor{rectangle}{center}%
+  }%
+}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%% Tikz styles
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+%%% For arguments later:
+\tikzset{
+  /zx/args/-andL/.cd,
+  % - is "towards the point", or "x value",
+  % L is "perpendicular to the line going towards the point" (L is for the perpendicular shape), or "y value".
+  1-/.initial=.5, % random value, defaultO... will change that.
+  2-/.initial=.5,
+  -/.style={
+    1-=#1,
+    2-=#1,
+  },
+  1L/.initial=.5,
+  2L/.initial=.5,
+  L/.style={
+    1L=#1,
+    2L=#1,
+  },
+  symmetry-L/.code={% 1- <-> 1L, 2- <-> 2L
+    \edef\zx at tmpone{\pgfkeysvalueof{/zx/args/-andL/1-}}%
+    \edef\zx at tmptwo{\pgfkeysvalueof{/zx/args/-andL/2-}}%
+    \pgfkeysalso{%
+      1-/.evaluated=\pgfkeysvalueof{/zx/args/-andL/1L},
+      2-/.evaluated=\pgfkeysvalueof{/zx/args/-andL/2L},
+      1L/.evaluated=\zx at tmpone,
+      2L/.evaluated=\zx at tmptwo,
+    }%
+  },
+  symmetry/.code={% 1- <-> 2-, 1L <-> 2L
+    \edef\zx at tmpone{\pgfkeysvalueof{/zx/args/-andL/1-}}%
+    \edef\zx at tmptwo{\pgfkeysvalueof{/zx/args/-andL/1L}}%
+    \pgfkeysalso{
+      1-/.evaluated=\pgfkeysvalueof{/zx/args/-andL/2-},
+      1L/.evaluated=\pgfkeysvalueof{/zx/args/-andL/2L},
+      2-/.evaluated=\zx at tmpone,
+      2L/.evaluated=\zx at tmptwo,
+    }%
+  },
+  negate1L/.style={
+    /zx/args/-andL/1L/.evaluated=-\pgfkeysvalueof{/zx/args/-andL/1L},
+  },
+  negate2L/.style={
+    /zx/args/-andL/2L/.evaluated=-\pgfkeysvalueof{/zx/args/-andL/2L},
+  },
+  negateL/.style={
+    negate1L,
+    negate2L,
+  },
+  negate1-/.style={
+    /zx/args/-andL/1-/.evaluated=-\pgfkeysvalueof{/zx/args/-andL/1-},
+  },
+  negate2-/.style={
+    /zx/args/-andL/2-/.evaluated=-\pgfkeysvalueof{/zx/args/-andL/2-},
+  },
+  negate-/.style={
+    negate1-,
+    negate2-,
+  },
+  negateL/.style={
+    negate1L,
+    negate2L,
+  },
+  oneMinus1-/.style={
+    /zx/args/-andL/2-/.evaluated=1-\pgfkeysvalueof{/zx/args/-andL/2-},
+  },
+  oneMinus2-/.style={
+    /zx/args/-andL/2-/.evaluated=1-\pgfkeysvalueof{/zx/args/-andL/2-},
+  },
+  oneMinus1L/.style={
+    /zx/args/-andL/1L/.evaluated=1-\pgfkeysvalueof{/zx/args/-andL/1L},
+  },
+  oneMinus2L/.style={
+    /zx/args/-andL/2L/.evaluated=1-\pgfkeysvalueof{/zx/args/-andL/2L},
+  },
+  % Angle/length:
+  1 angle and length/.code 2 args={%
+    \pgfmathparse{#2*cos(#1)}%
+    \pgfkeysalso{1-/.expand once=\pgfmathresult}%
+    \pgfmathparse{#2*sin(#1)}%
+    \pgfkeysalso{1L/.expand once=\pgfmathresult}%
+  },
+  2 angle and length/.code 2 args={%
+    \pgfmathparse{#2*cos(#1)}%
+    \pgfkeysalso{2-/.expand once=\pgfmathresult}%
+    \pgfmathparse{#2*sin(#1)}%
+    \pgfkeysalso{2L/.expand once=\pgfmathresult}%
+  },
+  1al/.style 2 args={
+    1 angle and length={#1}{#2}
+  },
+  2al/.style 2 args={
+    2 angle and length={#1}{#2}
+  },
+  al/.style 2 args={
+    1 angle and length={#1}{#2},
+    2 angle and length={#1}{#2},
+  },
+  1 angle/.style={
+    1 angle and length={#1}{.6}
+  },
+  2 angle/.style={
+    2 angle and length={#1}{.6}
+  },
+  1a/.style={
+    1 angle={#1},
+  },
+  2a/.style={
+    2 angle={#1},
+  },
+  angle/.style={
+    1 angle={#1},
+    2 angle={#1},
+  },
+  a/.style={
+    1 angle and length={#1}{.6},
+    2 angle and length={#1}{.6},
+  },
+}
+
+%%% Useful debug functions
+%% This function will be called when debugging the library.
+\def\zx at message#1{}
+% The ^^J adds a new line:
+\def\zx at verbose@message#1{\message{#1^^J}} % For more important messages. Like to show the code is not looping forever
+% To enable debugging:
+% WARNING: if you use in code, do not forget the makeatletter!
+%\def\zx at message#1{\message{#1^^J}}
+% To display stroke of while trying to compute the intersections:
+% WARNING: if you use in code, do not forget the makeatletter!
+%\def\zx at draw@stroke at inter@debug{}
+
+
+%% This function checks if the node has a "name path", if so it computes the intersection between
+%% if not if \zxWireInsideIfNoIntersectionName is defined it defines the \tikzto* to the
+%% new at center (argument #2), otherwise it does nothing.
+% #1: Node to consider: \tikztostart or \tikztotarget
+% #2: name of the new at center node corresponding to #1
+% #3: name of the other new at center node
+% #4: result will be stored in this macro... if there is something to change.
+% #5: 1 if start, 2 if end
+% Result will be moved back into #1
+\def\zx at find@intersection at fakecenter#1#2#3#4#5{%
+  % First, we check if the user wants to compute the intersection:
+  \ifdefined\zxEnableIntersectionsWires%
+     %% We compute the intersection
+    \edef\tikz at intersect@path at a{zx at name@path@#1}%
+    \ifcsname tikz at intersect@path at name@\tikz at intersect@path at a \endcsname%
+      \zx at verbose@message{[ZX] I will start computing intersections}%
+      \pgfintersectionofpaths{%
+        \begin{pgfinterruptboundingbox}%
+          %%%% /!\ This lines is the one I'm not sure how to write:
+          \expandafter\pgfsetpath\csname tikz at intersect@path at name@\tikz at intersect@path at a\endcsname%
+          \pgfgetpath\temppath%
+          \ifdefined\zx at draw@stroke at inter@debug%
+            \pgfusepath{stroke} % We draw it, useful to debug, and realize the shape is moved.
+          \fi%
+          \pgfsetpath\temppath%
+        \end{pgfinterruptboundingbox}%
+      }{% The first path is moved to the center... So we need to shift it also here.
+        %%% First intersection: we use the line between the two nodes... but it's really ugly (e.g. in o it does not make a lot of sense)
+        \begin{pgfinterruptboundingbox}%
+          \ifdefined\zxIntersectionLineBetweenStartEnd%
+            %% Not idea why, but x axis is inverted???
+            \pgfpointdiff{\tikz at scan@one at point\pgf at process(#2)}{\pgfpointanchor{#1}{center}}%
+            \pgfpathmoveto{\pgfpoint{-\pgf at x}{\pgf at y}}%
+            % And now both axis are???
+            \pgfpointdiff{\tikz at scan@one at point\pgf at process(#3)}{\pgfpointanchor{#1}{center}}%
+            \pgfpathlineto{\pgfpoint{-\pgf at x}{-\pgf at y}}%
+          \else%
+            %% We use now the method used for bezier curve (at least it's what I see "experimentally")
+            %% More precisely, we use the direction of the bezier curve to know where to start the wire.
+            %% Parse once the control points for efficiency reasons:
+            %% First parse the fake centers.
+            \tikz at scan@one at point\pgf at process(#2)%
+            \edef\zx at tmp@current at fake@x{\the\pgf at x}%
+            \edef\zx at tmp@current at fake@y{\the\pgf at y}%
+            \zx at message{The input fakes are #2 and #3.}%
+            \tikz at scan@one at point\pgf at process(#3)%
+            \edef\zx at tmp@other at fake@x{\the\pgf at x}%
+            \edef\zx at tmp@other at fake@y{\the\pgf at y}%
+            \zx at message{The parsed input fakes are (\zx at tmp@current at fake@x , \zx at tmp@current at fake@y) and (\zx at tmp@other at fake@x , \zx at tmp@other at fake@y).}%
+            %% Reorder the controls to compute. #5 = 1 if "start fake center" is "current fake center".
+            \ifnum#5=1 % <-- important space!!!
+              \edef\zx at tmp@start at fake@x{\zx at tmp@current at fake@x}%
+              \edef\zx at tmp@start at fake@y{\zx at tmp@current at fake@y}%
+              \edef\zx at tmp@end at fake@x{\zx at tmp@other at fake@x}%
+              \edef\zx at tmp@end at fake@y{\zx at tmp@other at fake@y}%
+            \else%
+              \edef\zx at tmp@end at fake@x{\zx at tmp@current at fake@x}%
+              \edef\zx at tmp@end at fake@y{\zx at tmp@current at fake@y}%
+              \edef\zx at tmp@start at fake@x{\zx at tmp@other at fake@x}%
+              \edef\zx at tmp@start at fake@y{\zx at tmp@other at fake@y}%
+            \fi%
+            \zx at message{We computed: start fake (\zx at tmp@start at fake@x , \zx at tmp@start at fake@y) end fake (\zx at tmp@end at fake@x , \zx at tmp@end at fake@y )}%
+            \pgfkeysalso{/zx/tmp/zx at getControlPoints={\zx at tmp@start at fake@x}{\zx at tmp@start at fake@y}{\zx at tmp@end at fake@x}{\zx at tmp@end at fake@y}}%
+            % Now results are in controlOne, and controlTwo
+            \ifnum#5=1 \relax%
+              \def\zx at control{\controlOne}%
+            \else%
+              \def\zx at control{\controlTwo}%
+            \fi%
+            %%% Parse new control
+            \tikz at scan@one at point\pgf at process(\zx at control)%
+            \edef\zx at tmp@current at ctrl@x{\the\pgf at x}%
+            \edef\zx at tmp@current at ctrl@y{\the\pgf at y}%
+            \zx at message{[ZX] Current control is number #5, i.e. \zx at control (both are \controlOne and \controlTwo)}%
+            % We store the center coordinates since it's used several times
+            \pgfpointanchor{#1}{center}%
+            \edef\zx at tmp@real at center@x{\the\pgf at x}%
+            \edef\zx at tmp@real at center@y{\the\pgf at y}%
+            %%% Go to  current fake center, except that real center is the new origin.
+            \pgfpointdiff{\pgfpoint{\zx at tmp@real at center@x}{\zx at tmp@real at center@y}}{\pgfpoint{\zx at tmp@current at fake@x}{\zx at tmp@current at fake@y}}%
+            \pgfpathmoveto{\pgfpoint{\pgf at x}{\pgf at y}}%
+            %% What, now both axis are inverted??? If someone can explain me this...
+            %% We scale the point to force it to cross the boundary.
+            \pgfpathlineto{%
+              \pgfpointadd{%
+                \pgf at process{%
+                  \pgfpointscale{10}{%
+                    \pgf at process{%
+                      \pgfpointdiff{%
+                        \pgfpoint{\zx at tmp@current at fake@x}{\zx at tmp@current at fake@y}%
+                      }{%
+                        \pgfpoint{\zx at tmp@current at ctrl@x}{\zx at tmp@current at ctrl@y}%
+                      }%
+                    }%
+                  }%
+                }%
+              }{%
+                \pgfpointdiff{%
+                  \pgfpoint{\zx at tmp@real at center@x}{\zx at tmp@real at center@y}%
+                }{%
+                  \pgfpoint{\zx at tmp@current at fake@x}{\zx at tmp@current at fake@y}%
+                }%
+              }%
+            }%
+          \fi%
+          \pgfgetpath\temppath%
+          \ifdefined\zx at draw@stroke at inter@debug%
+            \pgfusepath{stroke}% We draw it, useful to debug, and realize the shape is moved.
+          \fi%
+          \pgfsetpath\temppath%
+        \end{pgfinterruptboundingbox}%
+      }%
+      \pgfintersectionsolutions%
+      \pgfpointintersectionsolution{1}%
+      \ifnum\pgfintersectionsolutions=1%% The good number of solution has been found!
+        \zx at message{[ZX] Cool, just found one solution!}
+        %% Store the intersection (warning: the center of the shape is moved to the center!)
+        \edef\zx at relinter@x{\the\pgf at x}%
+        \edef\zx at relinter@y{\the\pgf at y}%
+        %% Because the shape was moved to center, we shift it back by adding the coord of the shape:
+        \pgfextractx\pgf at xa{\pgfpointanchor{#1}{center}}%
+        \pgfextractx\pgf at xb{\pgfpointanchor{#1}{center}}%
+        % WARNING! pgfmath removes the dimension (converted in pt). Make sure to put them back after
+        \pgfmathsetmacro{\zx at inter@x}{\pgf at x+\zx at relinter@x}%
+        \pgfmathsetmacro{\zx at inter@y}{\pgf at y+\zx at relinter@y}%
+        \edef#4{\zx at inter@x pt,\zx at inter@y pt}%
+      \else% The bad number of solution has been found
+        \zx at message{[ZX] WARNING: expecting one solution, found \pgfintersectionsolutions}%
+        \ifdefined\zxWireInsideIfNoIntersectionName%
+          % No intersection was found, but still want to use fake center (or center).
+          % ==> The wire will be inside the shape
+          % Basically \tikztostart := tikztostart at new@center
+          \edef#4{#2}%
+        \fi% Otherwise, do nothing
+      \fi%
+    \else%
+      \zx at message{ZX: no path named \tikz at intersect@path at a was found.}%
+      \ifdefined\zxWireInsideIfNoIntersectionName%
+        % No intersection was found, but still want to use fake center (or center).
+        % ==> The wire will be inside the shape
+        % Basically \tikztostart := tikztostart at new@center
+        \edef#4{#2}%
+      \fi% Otherwise, do nothing
+    \fi%
+  \else%
+      \zx at message{[ZX]: intersection mechanism disabled}%
+      \ifdefined\zxWireInsideIfNoIntersectionName%
+        % No intersection was found, but still want to use fake center (or center).
+        % ==> The wire will be inside the shape
+        % Basically \tikztostart := tikztostart at new@center
+        \edef#4{#2}%
+      \fi% Otherwise, do nothing
+  \fi%
+}%
+
 % Styles. User should not modify "wires definition", but is free to change:
 % - "/zx/default style nodes/" to change completely the node style
 % - "/zx/user overlay nodes" to add stuff on current node style
@@ -110,7 +565,7 @@
       looseness=1.2,
     },
     lw/.style={looseness wires only},
-    % Use this when you are drawing lines between none nodes only (like swap gates...)
+    % Use this when you are drawing lines between none nodes only (like swap gates...) in IO mode
     between none/.style={
       looseness wires only,
       wire centered
@@ -118,6 +573,50 @@
     bn/.style={
       between none
     },
+    % To debug the bezier curve.
+    edge above/.code={%
+      \def\zxEdgesAbove{}%
+    },%
+    edge not above/.code={%
+      \let\zxEdgesAbove\undefined%
+    },
+    control points visible/.code={%
+      \def\zxControlPointsVisible{}%
+    },%
+    control points not visible/.code={%
+      \let\zxControlPointsVisible\undefined%
+    },
+    % See explaination at the beginning where we define \def\zxEnableIntersectionsWires{}
+    % Rouhgly, tries to start the wires on the border of the shape on the line between the
+    % fake anchors.
+    use intersections/.code={%
+      \def\zxEnableIntersectionsWires{}%
+    },
+    dont use intersections/.code={%
+      \let\zxEnableIntersectionsWires\undefined%
+    },
+    ui/.style={
+      use intersections,
+      /zx/args/-andL/ui
+    },
+    intersections mode between start end/.code={%
+      \def\zxIntersectionLineBetweenStartEnd{}%
+    },
+    intersections mode bezier controls/.code={%
+      \let\zxIntersectionLineBetweenStartEnd\undefined%
+    },
+    wires behind nodes/.code={%
+      \def\zxWireInsideIfNoIntersectionName{}%
+    },
+    no wires behind nodes/.code={%
+      \let\zxWireInsideIfNoIntersectionName\undefined%
+    },
+    intersection between start end/.code={
+      \def\zxIntersectionLineBetweenStartEnd{}%
+    },
+    intersection bezier control/.code={
+      \let\zxIntersectionLineBetweenStartEnd\undefined%
+    },
     % ------------------------------
     % Practical stuff to draw lines easily:
     % Prefer to use these are they can be easily customized for each style and shorter to type.
@@ -133,7 +632,7 @@
     % If only tex was a functional language... https://tex.stackexchange.com/questions/618955
     C at generic/.style n args={8}{ % min/max, angle1, angle2, anchor, \x or \y, \y or \x, where to move,radius code (for circle should be "radius=\n3")
       to path={
-        \pgfextra{ %% <- we will use def... so need to "exit" a few seconds pgf
+        \pgfextra{%% <- we will use def... so need to "exit" a few seconds pgf
           % Test if tikztostart is a point or a node, and define StartPoint accordingly.
           \ifPgfpointOrNode{\tikztostart}{%
             \def\StartPoint{\tikztostart}%
@@ -163,24 +662,32 @@
         }%
         \ifpgfmathcomparison\else -- ##7\fi
         %%%% Version 1:
-        \pgfextra{
-          \pgfmathparse{
+        \pgfextra{%
+          \pgfmathparse{%
             ifthenelse(##61<##62, % if end angle < angle, draw clockwis
             "arc[start angle=##3,end angle=##2,##8]",%
             "arc[start angle=##2,end angle=##3,##8]"%
             )%
-          }
-        }
-        \pgfmathresult
+          }%
+        }%
+        \pgfmathresult%
         \pgfextra{%
           %% We check if we are moving or not (required to preserve arrow tip direction)
           \pgfmathapproxequalto{##52}{\n1}%
         }%
         \ifpgfmathcomparison\else -- (\TargetPoint)\fi
-        \tikztonodes % All to path finishes with that to deal with futur nodes I think
+        \tikztonodes% All to path finishes with that to deal with futur nodes I think
       }
     },
-    %%
+    % At the first version, styles were defined using in=... out=... looseness=... However
+    % it gives sometimes bad results (like the curve goes forward at some points) when nodes are
+    % too close or too far appart. However, it may still be useful, so now we define the old
+    % styles, that you can use them using \ar[r,IO,C].
+    % NB: for the newest styles, we add new anchors to the nodes depending on the direction.
+    % I also wanted to add more complicated ways to configqure the starting point (i.e. start at the boundary
+    % and not behind the node), but seems like it's hard (impossible?) to do with matrices...
+    % The reason is that the intersection library seems to fail with matrices.
+    % If you know how to solve that, you can help here: https://tex.stackexchange.com/questions/619274
     C/.style={C at generic={min}{90}{180+90}{west}{\x}{\y}{(\n1,\y1)}{y radius=\n3, x radius=##1*\n3}},
     C/.default=1,
     % Like C, but rotated
@@ -190,97 +697,568 @@
     C'/.default=1,
     C./.style={C at generic={min}{0}{-180}{south}{\y}{\x}{(\x1,\n1)}{x radius=\n3, y radius=##1*\n3}},
     C./.default=1,
-    % Like a C shape (with without a perfect half circle). This was the old definition of C...
-    % Hopefully not useful anymore.
-    c/.style={/tikz/in=180,/tikz/out=180,looseness=2},
-    % Like C, but symetric
-    c-/.style={/tikz/in=0,/tikz/out=0,looseness=2},
-    c'/.style={/tikz/in=90,/tikz/out=90,looseness=2},
-    c./.style={/tikz/in=-90,/tikz/out=-90,looseness=2},
+    %%% bezier{px1}{py1}{px2}{py2} creates a bezier curve where px1/py1 are the
+    %%% coordinates of the first control (in "percentage" 0<px1<1, between start and end point) and px2/py2
+    %%% are the coordinates in % of the second control point
+    %%% bezier at general is used to construct also x/y versions, 5 and 6'th argument are \x or \y.
+    bezier at general/.style n args={6}{
+      possibly at on@edge at layer/.code={%% see "edges above" style. for debug mode only.
+        \ifdefined\zxEdgesAbove\else%
+          \pgfkeysalso{%
+            on layer=edgelayer%
+          }%
+        \fi%
+      },
+      possibly at on@edge at layer,
+      to path={%
+        %%% First, check that inputs/outputs are points.
+        \pgfextra{% <- Type latex code inside path
+          %% Setup the startup node. This code can be changed by styles
+          %% /zx/tmp/zx at setup@start at node will contain the anchor of the first fake center
+          %% /zx/tmp/zx at setup@end at node will contain the anchor of the second fake center
+          %% If none of them are defined, nothing happens and the start point will be a node.
+          % Retrieve the content of the keys
+          % But first check if they are defined
+          \pgfkeysifdefined{/zx/tmp/zx at setup@start at node}{}{% Put an empty value
+            \pgfkeysalso{/zx/tmp/zx at setup@start at node/.initial=,}%
+          }%
+          \pgfkeysifdefined{/zx/tmp/zx at setup@end at node}{}{% Put an empty value
+            \pgfkeysalso{/zx/tmp/zx at setup@end at node/.initial=,}%
+          }%
+          \pgfkeysalso{
+            /zx/tmp/zx at setup@start at node/.get=\zx at anchor@start at node,
+            /zx/tmp/zx at setup@end at node/.get=\zx at anchor@end at node,
+            /zx/tmp/zx at getControlPoints/.code n args={4}{%
+              \zx at message{I will evaluate my control points:}%
+              % Args: start point, x,y then end point x,y
+              % Use ########1 ... (yes, LaTeX is a funny exponential language, and I love nested functions)
+              % Because to path is considered as a function already.
+              \def\x################1{%
+                \ifnum################1=1 % <-- super important space...
+                  ########1%
+                \else%
+                  ########3%
+                \fi%
+              }%
+              \zx at message{[ZX] x is defined.}%
+              \def\y################1{%
+                \ifnum ################1 = 1 % <-- super important space...
+                  ########2%
+                \else%
+                  ########4%
+                \fi%
+              }%
+              \tikz at scan@one at point\pgf at process(\x1-##51*##1+##52*##1,\y1-##61*##2+##62*##2)%
+              \edef\controlOne{\the\pgf at x,\the\pgf at y}%
+              \tikz at scan@one at point\pgf at process(\x1-##51*##3+##52*##3,\y1-##61*##4+##62*##4)%
+              \edef\controlTwo{\the\pgf at x,\the\pgf at y}%
+              \zx at message{[ZX] First control point is: \controlOne, second is \controlTwo.}%
+            },%
+          }%
+          %%% This will be the new \tikztostart and \tikztotarget... if someone defines them
+          \let\new at tikztostart\undefined%
+          \let\new at tikztotarget\undefined%
+          % Check if a start anchor was defined...
+          \ifthenelse{\equal{\zx at anchor@start at node}{}}{%
+            % No start anchor was chosen... :c
+            \ifthenelse{\equal{\zx at anchor@end at node}{}}{%
+              % Nothing was defined... So I won't do anything! :C
+            }{%
+              % An end node was defined :D Let's configure its end anchor.
+              \pgfkeysalso{%
+                /zx/utils/change at tikz@fake at center@intersect={\tikztotarget}{\zx at anchor@end at node}{\tikztostart}{center}{\new at tikztotarget}{2},
+              }%
+            }%
+          }{% A start node was chosen :D
+            \ifthenelse{\equal{\zx at anchor@end at node}{}}{%
+              % No end node was chosen... I'll take center to configure the start node,
+              % and not configure the end node.
+              \pgfkeysalso{
+                /zx/utils/change at tikz@fake at center@intersect={\tikztostart}{\zx at anchor@start at node}{\tikztotarget}{center}{\new at tikztostart}{1},
+              }%
+            }{%
+              % And an end node was chosen :D
+              \zx at message{[ZX] Both anchors are set. Lets configure intersection.}%
+              \pgfkeysalso{
+                /zx/utils/change at tikz@fake at center@intersect={\tikztostart}{\zx at anchor@start at node}{\tikztotarget}{\zx at anchor@end at node}{\new at tikztostart}{1},
+                /zx/utils/change at tikz@fake at center@intersect={\tikztotarget}{\zx at anchor@end at node}{\tikztostart}{\zx at anchor@start at node}{\new at tikztotarget}{2},
+              }%
+            }%
+          }%
+          \ifdefined\new at tikztostart%
+            \edef\tikztostart{\new at tikztostart}%
+          \fi%
+          \ifdefined\new at tikztotarget%
+            \edef\tikztotarget{\new at tikztotarget}%
+          \fi%
+          %%% Test if tikztostart is a point or a node, and define StartPoint accordingly.
+          % \ifPgfpointOrNode{\tikztostart}{%
+          %   \def\StartPoint{\tikztostart}%
+          % }{%
+          %   \def\StartPoint{\tikztostart.center}%
+          % }%
+          % % Test if tikztostart is a point or a node, and define StartPoint accordingly.
+          % \ifPgfpointOrNode{\tikztotarget}{%
+          %   \def\TargetPoint{\tikztotarget}%
+          % }{%
+          %   \def\TargetPoint{\tikztotarget.center}%
+          % }%
+          %%% Well, let's just use \tikztostart and \tikztotarget in any case, setting it to
+          %%% center will put the wire below the node which is not really desired for H nodes
+          %%% (position will be wrong) or when using arrows. And if center is really desired
+          %%% it's easy to force it using start anchor and end anchor.
+          \def\StartPoint{\tikztostart}%
+          \def\TargetPoint{\tikztotarget}%
+          %%% TODO: check that it does not change the shape of the wire since I'm not sure what \x1
+          %%% is in that case%
+        }%
+        let
+        \p1=(\StartPoint),
+        \p2=(\TargetPoint),%% ##5 = \x or \y, so ##51 = \x1 or \y1.
+        \p{control1}=(\x1-##51*##1+##52*##1, \y1-##61*##2+##62*##2),
+        \p{control2}=(\x1-##51*##3+##52*##3, \y1-##61*##4+##62*##4) in
+        (\StartPoint) .. controls (\p{control1}) and (\p{control2}) .. (\TargetPoint)
+        \ifdefined\zxControlPointsVisible
+          (\StartPoint) node[anchor=center,circle,fill=yellow,inner sep=.5pt,on layer=foreground]{}
+          -- (\p{control1}) node[anchor=center,circle,fill=orange,inner sep=.5pt,on layer=foreground]{}
+          (\p{control2}) node[anchor=center,circle,fill=purple,inner sep=.5pt,on layer=foreground]{}
+          -- (\TargetPoint) node[anchor=center,circle,fill=brown,inner sep=.5pt,on layer=foreground]{}
+        \fi
+        \tikztonodes
+      },
+    },
+    %% Not sure it will be very useful, compared to bezier, bezier x and bezier y directly.
+    bezier 4/.style n args={4}{
+      bezier at general={##1}{##2}{##3}{##4}{\x}{\y},
+    },
+    % Like bezier, all proportions are relative to x distance
+    bezier 4 x/.style n args={4}{
+      bezier at general={##1}{##2}{##3}{##4}{\x}{\x}
+    },
+    % Like bezier, all proportions are relative to y distance
+    bezier 4 y/.style n args={4}{
+      bezier at general={##1}{##2}{##3}{##4}{\y}{\y}
+    },
+    bezier/.code={%
+      \pgfkeys{
+        /zx/args/-andL/.cd,
+        ##1
+      }%
+      \pgfkeysalso{
+        bezier 4={\pgfkeysvalueof{/zx/args/-andL/1-}}{\pgfkeysvalueof{/zx/args/-andL/1L}}{\pgfkeysvalueof{/zx/args/-andL/2-}}{\pgfkeysvalueof{/zx/args/-andL/2L}}
+      }%
+    },
+    bezier x/.code={%
+      \pgfkeys{
+        /zx/args/-andL/.cd,
+        ##1
+      }%
+      \pgfkeysalso{
+        bezier 4 x={\pgfkeysvalueof{/zx/args/-andL/1-}}{\pgfkeysvalueof{/zx/args/-andL/1L}}{\pgfkeysvalueof{/zx/args/-andL/2-}}{\pgfkeysvalueof{/zx/args/-andL/2L}}
+      }%
+    },
+    bezier y/.code={%
+      \pgfkeys{
+        /zx/args/-andL/.cd,
+        ##1
+      }%
+      \pgfkeysalso{
+        bezier 4 y={\pgfkeysvalueof{/zx/args/-andL/1-}}{\pgfkeysvalueof{/zx/args/-andL/1L}}{\pgfkeysvalueof{/zx/args/-andL/2-}}{\pgfkeysvalueof{/zx/args/-andL/2L}}
+      }%
+    },
+    % Directions: configure start/end points to "fake center *" if it exists.
+    % If the input is not a node, it's copied to ##3
+    /zx/utils/change at tikz@fake at center/.code n args={3}{%
+      % ##1: \tikztostart or \tikztotarget,
+      % ##2: fake center north...
+      % ##3 name of result. e.g. \tikztostart
+      \ifPgfpointOrNode{##1}{%
+        %%% Sometimes, ##1 is not 1pt,2pt but "tikz-1-2.north east". Since later we use
+        %%% a parsing mechanism which assumes that we have a coordinate... this is a problem.
+        \edef##3{##1}%
+        % This is a great explaination of how parsing is done in tikz:
+        % https://tex.stackexchange.com/a/516897/116348
+      }{% This is a node, not a point:
+        \ifAnchorExists{##1}{##2}{%
+          \pgfpointanchor{##1}{##2}%
+        }{%
+          \pgfpointanchor{##1}{center}%
+        }%
+        %%% Whoo, pgfpoint only redefine pgf at x/pgf at y, but in no way it stores it!!!
+        %%% So can't do \pgfpoint{\pgf at x}{\pgf at y}...
+        %%% I needed to create my own system... see \zx at parse@coordx.
+        \edef##3{\the\pgf at x,\the\pgf at y}%
+      }%
+    },
+    % Directions: configure start/end points to the intersection between
+    % the "fake center *" if it exists and the "fake center *" of the destination.
+    % If the input is not a node, nothing is done.
+    /zx/utils/change at tikz@fake at center@intersect/.code n args={6}{%
+      % ##1: \tikztostart or \tikztotarget
+      % ##2: fake center north... for ##1
+      % ##3: \tikztostart or \tikztotarget, the other one (needed to compute the intersection)
+      % ##4 fake center north... for ##3
+      % ##5: result will be moved to that macro
+      % ##6: 1 if start, 2 if end.
+      \ifPgfpointOrNode{##1}{}{% This is a node, not a point:
+        %% Configure the zx at new@center@* which should point to "fake center" if it exists.
+        \pgfkeysalso{%
+          /zx/utils/change at tikz@fake at center={##1}{##2}{\zx at new@center},%
+        }%
+        \pgfkeysalso{%
+          /zx/utils/change at tikz@fake at center={##3}{##4}{\zx at new@center at other},%
+        }%
+        \zx at message{ZX: coordinate of new center is \zx at new@center}%
+        \zx at message{ZX: coordinate of new other center is \zx at new@center at other}%
+        \zx at find@intersection at fakecenter{##1}{\zx at new@center}{\zx at new@center at other}{##5}{##6}%
+      }%
+    },
+    start fake center east/.style={%
+      /zx/tmp/zx at setup@start at node/.initial=fake center east,
+    },
+    start fake center west/.style={%
+      /zx/tmp/zx at setup@start at node/.initial=fake center west,
+    },
+    start fake center north/.style={%
+      /zx/tmp/zx at setup@start at node/.initial=fake center north,
+    },
+    start fake center south/.style={%
+      /zx/tmp/zx at setup@start at node/.initial=fake center south,
+    },
+    start real center/.style={
+      /zx/tmp/zx at setup@start at node/.initial=center,
+    },
+    start no fake center/.style={
+      /zx/tmp/zx at setup@start at node/.initial=,
+    },
+    end fake center east/.style={%
+      /zx/tmp/zx at setup@end at node/.initial=fake center east,
+    },
+    end fake center west/.style={%
+      /zx/tmp/zx at setup@end at node/.initial=fake center west,
+    },
+    end fake center north/.style={%
+      /zx/tmp/zx at setup@end at node/.initial=fake center north,
+    },
+    end fake center south/.style={%
+      /zx/tmp/zx at setup@end at node/.initial=fake center south,
+    },
+    end real center/.style={
+      /zx/tmp/zx at setup@end at node/.initial=center,
+    },
+    end no fake center/.style={
+      /zx/tmp/zx at setup@end at node/.initial=,
+    },
+    left to right/.style={
+      start fake center east,
+      end fake center west
+    },
+    right to left/.style={
+      start fake center west,
+      end fake center east
+    },
+    up to down/.style={
+      start fake center south,
+      end fake center north
+    },
+    down to up/.style={
+      start fake center north,
+      end fake center south
+    },
+    no fake center/.style={
+      start no fake center,
+      end no fake center,
+      start anchor=,
+      end anchor=,
+    },
+    %% Forced versions are versions which do not nicely fallback to center if shape does not
+    %% have "fake center XXX". This is used mostly for wires based on in/out (our function b.
+    %% Not sure how to have a code which always fallback to center if shape does not.
+    %% All shapes used in the default style should work with force left to right.
+    force left to right/.style={
+      on layer=edgelayer,
+      start anchor=fake center east,
+      end anchor=fake center west
+    },
+    force right to left/.style={
+      on layer=edgelayer,
+      start anchor=fake center west,
+      end fake center east
+    },
+    force up to down/.style={
+      on layer=edgelayer,
+      start anchor=fake center south,
+      end fake center north
+    },
+    force down to up/.style={
+      on layer=edgelayer,
+      start anchor=fake center north,
+      end fake center south
+    },
     % Similar to C, but with a softer angle. The '.- marker represents the portion of
     % the circle (hence the o) to keep (top, bottom,left/right).
     % Angle is customizable, for instance o'=50.
-    o'/.style={/tikz/out=##1,/tikz/in=180-##1},
-    o'/.default=\zxDefaultSoftAngleO,
-    o./.style={/tikz/out=-##1,/tikz/in=180+##1},
-    o./.default=\zxDefaultSoftAngleO,
-    -o/.style={/tikz/out=-90-##1,/tikz/in=90+##1},
-    -o/.default=\zxDefaultSoftAngleO,
-    o-/.style={/tikz/out=-90+##1,/tikz/in=90-##1},
-    o-/.default=\zxDefaultSoftAngleO,
-    % Similar to o, but can be used also for diagonal items.
-    % Why ()? Visualize fixing the top part and moving the bottom part.
-    (/.style={bend right=##1},
+    %%% Actually, it may not be super useful to define it via bezier since it's used only
+    %%% horizontally and vertically... Anyway.
+    o'/.style={%
+      left to right,
+      bezier x={
+        defaultO,
+        ##1,
+        %% 2- --> 1 - (2-)
+        oneMinus2-,
+      },
+    },
+    o./.style={%
+      left to right,
+      bezier x={%
+        /zx/args/-andL/.cd,
+        defaultO,
+        ##1,
+        %% 2- --> 1 - (2-)
+        oneMinus2-,
+        negate1L,
+        negate2L,
+      },%
+    },
+    -o/.style={%
+      up to down,
+      bezier y={%
+        /zx/args/-andL/.cd,
+        defaultO,
+        ##1,
+        /zx/args/-andL/2-/.evaluated=1-\pgfkeysvalueof{/zx/args/-andL/2-},
+        symmetry-L,
+      }
+    },
+    o-/.style={%
+      up to down,
+      bezier y={%
+        /zx/args/-andL/.cd,
+        defaultO,
+        ##1,
+        /zx/args/-andL/2-/.evaluated=1-\pgfkeysvalueof{/zx/args/-andL/2-},
+        /zx/args/-andL/1L/.evaluated=-\pgfkeysvalueof{/zx/args/-andL/1L},
+        /zx/args/-andL/2L/.evaluated=-\pgfkeysvalueof{/zx/args/-andL/2L},
+        symmetry-L,
+      },
+    },
+    % Similar to o, but can be used also for diagonal items. Combine it with
+    % The dot versions are mode logic in "left to right", and the others for up to down (possible to change)
+    % Can combine with "force left to right"...
+    (/.style={
+      bend right=##1,
+    },
     (/.default=30,
-    )/.style={bend left=##1},
+    )/.style={
+      bend left=##1,
+    },
     )/.default=30,
-    ('/.style={bend left=##1},
+    ('/.style={
+      bend left=##1
+    },
     ('/.default=30,
-    (./.style={bend right=##1},
+    (./.style={
+      bend right=##1
+    },
     (./.default=30,
-    <'/.style={out=##1,in=180,looseness=0.65},
-    <'/.default=\zxDefaultSoftAngleChevron,
-    <./.style={out=-##1,in=180,looseness=0.65},
-    <./.default=\zxDefaultSoftAngleChevron,
-    '>/.style={out=0,in=180-##1,looseness=0.65},
-    '>/.default=\zxDefaultSoftAngleChevron,
-    .>/.style={out=0,in=180+##1,looseness=0.65},
-    .>/.default=\zxDefaultSoftAngleChevron,
-    ^./.style={out=-90+##1,in=90,looseness=0.65},
-    ^./.default=\zxDefaultSoftAngleChevron,
-    .^/.style={out=-90-##1,in=90,looseness=0.65},
-    .^/.default=\zxDefaultSoftAngleChevron,
-    'v/.style={out=90+##1,in=-90,looseness=0.65},
-    'v/.default=\zxDefaultSoftAngleChevron,
-    v'/.style={out=90-##1,in=-90,looseness=0.65},
-    v'/.default=\zxDefaultSoftAngleChevron,
-    % Links with a s-like shape.
-    s/.style={/tikz/out=0,/tikz/in=180,looseness=0.6},
+    %%%% Links with a N-shape, i.e. like s shape, but symetric against the diagonal. Equivalently, it's a soft 's' shape with a much wider angle (>45).
+    %% Nbase will be reused later by < > shapes as well. It's useful to make a distinction between N and
+    %% Nbase when user will want to overwrite N without overwritting < >.
+    Nbase/.style={
+      left to right,
+      bezier={
+        /zx/args/-andL/.cd,
+        defaultN,
+        ##1,
+        oneMinus2-,
+        oneMinus2L,
+      },
+    },
+    N/.style={Nbase={##1}},
+    % With this model, we don't need differences between N' and N. so we can also call it N.
+    % But keep other notations to allow easy style change (to use IO again for instance).
+    N'/.style={N={##1}},
+    N./.style={N={##1}},
+    -N/.style={N={defaultN-,##1}},
+    -N'/.style={-N={##1}},
+    -N./.style={-N={##1}},
+    N-/.style={-N'={symmetry,##1}},
+    N'-/.style={N-={##1}},
+    N.-/.style={N-={##1}},
+    %% Up to down version
+    NN/.style={N'={symmetry-L,defaultNN,##1},up to down},
+    NN./.style={NN={##1}},
+    .NN/.style={NN={##1}},
+    NIN/.style={NN={defaultNIN,##1}},
+    INN/.style={NIN={symmetry,##1}},
+    NNI/.style={INN={##1}},
+    %%% <' is basically like -N' (historically < was first), we just put an anchor on the east/....
+    <'/.style={Nbase={defaultN,defaultN-,defaultChevron,symmetry,##1},end anchor=west},
+    <./.style={<'={##1}},
+    % Don't use <>^ alone char as style name, it could be useful later for other shortcuts
+    % (replacement directions)
+    '>/.style={Nbase={defaultN,defaultN-,defaultChevron,##1},start anchor=east},
+    .>/.style={'>={##1}},
+    ^./.style={
+      Nbase={defaultN,defaultN-,defaultChevron,symmetry-L,defaultNN,defaultNIN,defaultChevronDown,symmetry,##1},
+      end anchor=north
+    },
+    .^/.style={^.={##1}},
+    'v/.style={
+      Nbase={defaultN,defaultN-,defaultChevron,symmetry-L,defaultNN,defaultNIN,defaultChevronDown,##1},
+      start anchor=south
+    },
+    v'/.style={'v={##1}},
+    %%%% Links with a s-like shape.
+    s/.style={
+      left to right,
+      bezier={%
+        /zx/args/-andL/.cd,
+        defaultS,
+        ##1,
+        oneMinus2-,
+        oneMinus2L,
+      }
+    },
+    % like S, but with anchor east and west
+    S/.style={
+      s={##1}, start anchor=east, end anchor=west
+    },
     % -s'.- shapes are like s, but with a soften (customizable like o) angle.
     % The '. say if you are going up or down, and - forces a sharp angle (- is flat) on the side of the -
-    s'/.style={/tikz/out=##1,/tikz/in=180+##1},
-    s'/.default=\zxDefaultSoftAngleS,
-    s./.style={/tikz/out=-##1,/tikz/in=180-##1},
-    s./.default=\zxDefaultSoftAngleS,
-    -s'/.style={/tikz/out=0,/tikz/in=180+##1},
-    -s'/.default=\zxDefaultSoftAngleS,
-    -s./.style={/tikz/out=0,/tikz/in=180-##1},
-    -s./.default=\zxDefaultSoftAngleS,
-    s'-/.style={/tikz/out=##1,/tikz/in=180},
-    s'-/.default=\zxDefaultSoftAngleS,
-    s.-/.style={/tikz/out=-##1,/tikz/in=180},
-    s.-/.default=\zxDefaultSoftAngleS,
+    s'/.style={s={defaultS',##1}},
+    s./.style={s'={##1}},
+    -s/.style={s'={default-S,##1}},
+    -s'/.style={-s={##1}},  % To fit with s' notation
+    -s./.style={-s={##1}},
+    s-/.style={-s'={symmetry,##1}},
+    s'-/.style={s-={##1}},
+    s.-/.style={s-={##1}},
+    % Anchor more marked
+    S/.style={s={##1}, start anchor=east, end anchor=west,},
+    -S/.style={-s'={##1},start anchor=east},
+    -S'/.style={-S={##1}},
+    -S./.style={-S={##1}},
+    S-/.style={s'-={##1},end anchor=west},
+    S'-/.style={S-={##1}},
+    S.-/.style={S-={##1}},
+    %%%% Doubling = up to down.
     % Links with a s-like shape... but read from top to bottom
-    ss/.style={/tikz/out=0-90,/tikz/in=180-90,looseness=0.6},
+    ss/.style={s={symmetry-L,##1},up to down},
+    SS/.style={ss={##1}, start anchor=south, end anchor=north},
     % -s'.- shapes are like s, but with a soften (customizable like o) angle.
-    % The '. say if you are going up or down, and - forces a sharp angle (- is flat) on the side of the -
-    ss./.style={/tikz/out=##1-90,/tikz/in=180-90+##1},
-    ss./.default=\zxDefaultSoftAngleS,
-    .ss/.style={/tikz/out=-##1-90,/tikz/in=180-90-##1},
-    .ss/.default=\zxDefaultSoftAngleS,
-    sIs./.style={/tikz/out=0-90,/tikz/in=180-90+##1},
-    sIs./.default=\zxDefaultSoftAngleS,
-    .sIs/.style={/tikz/out=0-90,/tikz/in=180-90-##1},
-    .sIs/.default=\zxDefaultSoftAngleS,
-    ss.I/.style={/tikz/out=##1-90,/tikz/in=180-90},
-    ss.I/.default=\zxDefaultSoftAngleS,
-    I.ss/.style={/tikz/out=-##1-90,/tikz/in=180-90},
-    I.ss/.default=\zxDefaultSoftAngleS,
-    %%%% Links with a N-shape, i.e. like s shape, but symetric against the diagonal. Equivalently, it's a soft 's' shape with a much wider angle (>45).
-    N'/.style={/tikz/out=##1,/tikz/in=180+##1},
-    N'/.default=\zxDefaultSoftAngleN,
-    N./.style={/tikz/out=-##1,/tikz/in=180-##1},
-    N./.default=\zxDefaultSoftAngleN,
-    -N'/.style={/tikz/out=0,/tikz/in=180+##1},
-    -N'/.default=\zxDefaultSoftAngleN,
-    -N./.style={/tikz/out=0,/tikz/in=180-##1},
-    -N./.default=\zxDefaultSoftAngleN,
-    N'-/.style={/tikz/out=##1,/tikz/in=180},
-    N'-/.default=\zxDefaultSoftAngleN,
-    N.-/.style={/tikz/out=-##1,/tikz/in=180},
-    N.-/.default=\zxDefaultSoftAngleN,
+    % The '. say if you are going up or down, and 'I' forces a sharp angle (I is flat) on the side of the I
+    ss./.style={s.={symmetry-L,##1},up to down},
+    .ss/.style={ss.={##1}},
+    sIs/.style={ss={defaultSIS,##1}},
+    sIs./.style={ss.={defaultSIS,##1}},
+    .sIs/.style={sIs.={##1}},
+    Iss/.style={sIs={symmetry,##1}},
+    ssI/.style={Iss={##1}},
+    ss.I/.style={sIs.={symmetry,##1}},
+    I.ss/.style={ss.I={##1}},
+    SIS/.style={sIs={##1},start anchor=south},
+    .SIS/.style={.sIs={##1},start anchor=south},
+    ISS/.style={ssI={##1},end anchor=north},
+    SS.I/.style={ss.I={##1},end anchor=north},
+    I.SS/.style={SS.I={##1}},
+    SSI/.style={ISS={##1}},
+    % At the first version, styles were defined using in=... out=... looseness=... However
+    % it gives sometimes bad results (like the curve goes forward at some points) when nodes are
+    % too close or too far appart. However, it may still be useful, so now we define the old
+    % styles, that you can use them using \ar[r,IO,C].
+    IO/.style={
+      C/.style={/tikz/in=180,/tikz/out=180,looseness=2},
+      % Like C, but symetric
+      C-/.style={/tikz/in=0,/tikz/out=0,looseness=2},
+      C'/.style={/tikz/in=90,/tikz/out=90,looseness=2},
+      C./.style={/tikz/in=-90,/tikz/out=-90,looseness=2},
+      % Similar to C, but with a softer angle. The '.- marker represents the portion of
+      % the circle (hence the o) to keep (top, bottom,left/right).
+      % Angle is customizable, for instance o'=50.
+      o'/.style={/tikz/out=####1,/tikz/in=180-####1},
+      o'/.default=\zxDefaultSoftAngleO,
+      o./.style={/tikz/out=-####1,/tikz/in=180+####1},
+      o./.default=\zxDefaultSoftAngleO,
+      -o/.style={/tikz/out=-90-####1,/tikz/in=90+####1},
+      -o/.default=\zxDefaultSoftAngleO,
+      o-/.style={/tikz/out=-90+####1,/tikz/in=90-####1},
+      o-/.default=\zxDefaultSoftAngleO,
+      % Similar to o, but can be used also for diagonal items.
+      % Why ()? Visualize fixing the top part and moving the bottom part.
+      (/.style={bend right=####1},
+      (/.default=30,
+      )/.style={bend left=####1},
+      )/.default=30,
+      ('/.style={bend left=####1},
+      ('/.default=30,
+      (./.style={bend right=####1},
+      (./.default=30,
+      <'/.style={out=####1,in=180,looseness=0.65},
+      <'/.default=\zxDefaultSoftAngleChevron,
+      <./.style={out=-####1,in=180,looseness=0.65},
+      <./.default=\zxDefaultSoftAngleChevron,
+      '>/.style={out=0,in=180-####1,looseness=0.65},
+      '>/.default=\zxDefaultSoftAngleChevron,
+      .>/.style={out=0,in=180+####1,looseness=0.65},
+      .>/.default=\zxDefaultSoftAngleChevron,
+      ^./.style={out=-90+####1,in=90,looseness=0.65},
+      ^./.default=\zxDefaultSoftAngleChevron,
+      .^/.style={out=-90-####1,in=90,looseness=0.65},
+      .^/.default=\zxDefaultSoftAngleChevron,
+      'v/.style={out=90+####1,in=-90,looseness=0.65},
+      'v/.default=\zxDefaultSoftAngleChevron,
+      v'/.style={out=90-####1,in=-90,looseness=0.65},
+      v'/.default=\zxDefaultSoftAngleChevron,
+      % Links with a s-like shape.
+      s/.style={/tikz/out=0,/tikz/in=180,looseness=0.6},
+      % -s'.- shapes are like s, but with a soften (customizable like o) angle.
+      % The '. say if you are going up or down, and - forces a sharp angle (- is flat) on the side of the -
+      s'/.style={/tikz/out=####1,/tikz/in=180+####1},
+      s'/.default=\zxDefaultSoftAngleS,
+      s./.style={/tikz/out=-####1,/tikz/in=180-####1},
+      s./.default=\zxDefaultSoftAngleS,
+      -s'/.style={/tikz/out=0,/tikz/in=180+####1},
+      -s'/.default=\zxDefaultSoftAngleS,
+      -s./.style={/tikz/out=0,/tikz/in=180-####1},
+      -s./.default=\zxDefaultSoftAngleS,
+      s'-/.style={/tikz/out=####1,/tikz/in=180},
+      s'-/.default=\zxDefaultSoftAngleS,
+      s.-/.style={/tikz/out=-####1,/tikz/in=180},
+      s.-/.default=\zxDefaultSoftAngleS,
+      % Links with a s-like shape... but read from top to bottom
+      ss/.style={/tikz/out=0-90,/tikz/in=180-90,looseness=0.6},
+      % -s'.- shapes are like s, but with a soften (customizable like o) angle.
+      % The '. say if you are going up or down, and - forces a sharp angle (- is flat) on the side of the -
+      ss./.style={/tikz/out=####1-90,/tikz/in=180-90+####1},
+      ss./.default=\zxDefaultSoftAngleS,
+      .ss/.style={/tikz/out=-####1-90,/tikz/in=180-90-####1},
+      .ss/.default=\zxDefaultSoftAngleS,
+      sIs./.style={/tikz/out=0-90,/tikz/in=180-90+####1},
+      sIs./.default=\zxDefaultSoftAngleS,
+      .sIs/.style={/tikz/out=0-90,/tikz/in=180-90-####1},
+      .sIs/.default=\zxDefaultSoftAngleS,
+      ss.I/.style={/tikz/out=####1-90,/tikz/in=180-90},
+      ss.I/.default=\zxDefaultSoftAngleS,
+      I.ss/.style={/tikz/out=-####1-90,/tikz/in=180-90},
+      I.ss/.default=\zxDefaultSoftAngleS,
+      %%%% Links with a N-shape, i.e. like s shape, but symetric against the diagonal. Equivalently, it's a soft 's' shape with a much wider angle (>45).
+      N'/.style={/tikz/out=####1,/tikz/in=180+####1},
+      N'/.default=\zxDefaultSoftAngleN,
+      N./.style={/tikz/out=-####1,/tikz/in=180-####1},
+      N./.default=\zxDefaultSoftAngleN,
+      -N'/.style={/tikz/out=0,/tikz/in=180+####1},
+      -N'/.default=\zxDefaultSoftAngleN,
+      -N./.style={/tikz/out=0,/tikz/in=180-####1},
+      -N./.default=\zxDefaultSoftAngleN,
+      N'-/.style={/tikz/out=####1,/tikz/in=180},
+      N'-/.default=\zxDefaultSoftAngleN,
+      N.-/.style={/tikz/out=-####1,/tikz/in=180},
+      N.-/.default=\zxDefaultSoftAngleN,
+    },
     % No line but vdots/dots in between.
-    3 vdots/.style={draw=none, "\makebox[0pt][r]{##1}\scalebox{\zxScaleDots}{$\cvdots$}" anchor=center},
+    3 vdots/.style={draw=none, "\makebox[0pt][r]{##1}\scalebox{\zxScaleDots}{$\cvdotsCenterMathline$}" anchor=center},
     3 vdots/.default={},
     3 dots/.style={draw=none, "\makebox[0pt][r]{##1}\scalebox{\zxScaleDots}{$\chdots$}" anchor=center},
     3 dots/.default={},
@@ -288,9 +1266,12 @@
     % a new column/row. However, make sure the corresponding row/column is larger, using &[\zxHCol]
     % for columns and \\[\zxHRow] for rows (for Z/X style, use zxSCol and sxSRow), if you have both spiders
     % and Hadamard, use \zxHSCol and \zxHSRow.
-    H/.style={"" {zxHSmall,anchor=center}},
-    Z/.style={"" {zxNoPhaseSmallZ,anchor=center}},
-    X/.style={"" {zxNoPhaseSmallX,anchor=center}},
+    H/.style={"" {zxHSmall,anchor=center,##1}},
+    H/.default={},
+    Z/.style={"" {zxNoPhaseSmallZ,anchor=center,##1}},
+    Z/.default={},
+    X/.style={"" {zxNoPhaseSmallX,anchor=center,##1}},
+    X/.default={},
     % Arrow will go out from the center of the shape instead of from the border. Useful
     % when connecting nodes with different shapes, it will give back a symetric connection.
     wire centered/.style={
@@ -319,7 +1300,7 @@
     % Style for empty nodes
     zxAllNodes/.style={
       shape=rectangle, % Otherwise nodes are asymetrical rectangle, which is not practical in our case. Gives notably anchor "center" which is really centered compared to asymatrical rectangles
-      anchor=center,   % Center cells
+      anchor=center, % Center cells
       line width=\zxDefaultLineWidth,
       execute at begin node={\thinmuskip=0mu\medmuskip=0mu\thickmuskip=0mu}, % Reduce space around +/-...
     },
@@ -372,9 +1353,20 @@
       zxNoneDouble+,
       inner ysep=0mm,
     },
+    % Used to compute the intersection with the node's boundary
+    allow boundary intersection/.code={%
+      \ifdefined\zxEnableIntersectionsNodes%
+        \edef\zx at name@path{zx at name@path@\tikz at fig@name}%
+        \zx at message{[ZX] The name of the path will be \zx at name@path.}%
+        \pgfkeysalso{
+          name path=\zx at name@path, % Used by intersection library
+        }%
+      \fi%
+    },
     % Will be specific to all spiders
     zxSpiders/.style={
       draw=black,
+      allow boundary intersection,% Used later to do math on it.
     },
     % Will use this style when drawing a X/Z node without phase (not for end user directly)
     zxNoPhase/.style={
@@ -388,7 +1380,7 @@
     zxNoPhaseSmall/.style={
       zxNoPhase
     },
-    % Style for nodes that are small enough to fit in a circle, like $\zxMinus \frac{\pi}{4}$
+    % Style for nodes that are small enough to fit in a circle, like $\zxMinus \frac{\pi}{4}$ or $- \alpha$
     zxShort/.style={
       zxAllNodes,
       zxSpiders,
@@ -397,7 +1389,7 @@
       rounded rectangle,
       inner sep=0.0mm,
       scale=0.8,
-    }, % negative outer sep would draw lines from inside...
+    },% negative outer sep would draw lines from inside...
     % Style for nodes that are bigger, like $\alpha+\beta$ or $(a\oplus b)\pi$
     zxLong/.style={zxShort, inner xsep=1.2mm},
     %%% Styles of the label when |phase in label| is used
@@ -429,14 +1421,16 @@
     %%% Instead of adding directly the style as the node's content (which would make
     %%% impossible styles that adds the phase in a label outside of the node)
     %%% add at Phase@Spider{,Z,X}={phase of the node} will be in charge of adding it.
-    add at Phase@Spider/.style n args={4}{ % add at Phase@Spider{emptyStyle}{NotEmptyStyle}{node content}
+    % add at Phase@Spider{emptyStyle}{ShortStyle}{LongStyle}{label style}{node content}
+    add at Phase@Spider/.style n args={5}{%
       zx at emptyStyle/.style={##1},
-      zx at notEmptyStyle/.style={##2},
-      zx at labelStyle/.style={##3},
-      /zx/zx at content/.initial={##4},
+      zx at shortStyle/.style={##2},
+      zx at notEmptyStyle/.style={##3},
+      zx at labelStyle/.style={##4},
+      /zx/zx at content/.initial={##5},
       phase in content,
     },
-    add at Phase@Spider at Frac/.style n args={8}{ % add at Phase@Spider{emptyStyle}{NotEmptyStyle}{labelstyle}{sign}{above fraction (no parens)}{below fraction (no parens)}{above fraction (parens)}{below fraction (parens)}
+    add at Phase@Spider at Frac/.style n args={8}{% add at Phase@Spider{emptyStyle}{NotEmptyStyle}{labelstyle}{sign}{above fraction (no parens)}{below fraction (no parens)}{above fraction (parens)}{below fraction (parens)}
       zx at emptyStyle/.style={##1},
       zx at notEmptyStyle/.style={##2},
       zx at labelStyle/.style={##3},
@@ -446,8 +1440,8 @@
     },
     % #1 is the node content. Seems that storing it in /zx/zx at content is not enough because keys
     % seems to be local to nodes and are not transfered to label.
-    zx at Execute@Very at End/.style n args={4}{
-      zx at commandToExecuteVeryEnd/.try={##1}{##2}{##3}{##4},
+    zx at Execute@Very at End/.style n args={5}{
+      zx at commandToExecuteVeryEnd/.try={##1}{##2}{##3}{##4}{##5},
     },
     zx at Execute@Very at End/.default={}{}{}{},
     %% zx at Execute@Very at End@Frac={emptystyle}{contentstyle}{labelstyle}{sign}{above frac (no parens)}{below frac (no parens)}{above frac (parens)}{below frac (parens)}
@@ -478,8 +1472,8 @@
         %% Modifies zx at commandToExecuteVeryEnd (which is executed at the very end by zx at Execute@Very at End)
         %% in order to add the good style
         \pgfkeysalso{
-          zx at commandToExecuteVeryEnd/.style n args={4}{%
-            execute at begin node={####4},% ####4 = content
+          zx at commandToExecuteVeryEnd/.style n args={5}{%
+            execute at begin node={####5},% ####4 = content
           }%
         }%
         % Checks if the content (stored by add at Phase@Spider in /zx/zx at content) is empty or not
@@ -487,9 +1481,15 @@
           \pgfkeysalso{%
             zx at emptyStyle,%
           }%
-        }{%
-          \pgfkeysalso{%
-            zx at notEmptyStyle,%
+        }{% We check if we need to force "short mode" (zxShort instead of zxLong)
+          \ifthenelse{\equal{\pgfkeysvalueof{/zx/zx at shortModeForced}}{true}}{%
+            \pgfkeysalso{%
+              zx at shortStyle,%
+            }%
+          }{% Otherwise, just use the default style.
+            \pgfkeysalso{%
+              zx at notEmptyStyle,%
+            }%
           }%
         }%
       }%
@@ -510,12 +1510,12 @@
       }{%
         \pgfkeysalso{%
           % ##1 is the argument of "phase in label", i.e. the style of the label
-          zx at commandToExecuteVeryEnd/.code n args={4}{% ####3: label style, ####4: content
+          zx at commandToExecuteVeryEnd/.code n args={5}{% ####4: label style, ####5: content
             % Checks if the content (stored by add at Phase@Spider in /zx/zx at content) is empty or not
-            \ifthenelse{\equal{####4}{}}{% Content is empty
+            \ifthenelse{\equal{####5}{}}{% Content is empty
             }{% Content is not empty
               \pgfkeysalso{
-                label={[####3,##1] ####4},%
+                label={[####4,##1] ####5},%
               }%
             }%
           },%
@@ -541,27 +1541,71 @@
     },
     pill/.style={phase in label left=##1},
     %%% Was supposed to automatically find the good style depending on content... Can't find how to do.
-    % Styles zxLong{X/Z} zxNoPhase{X/Z} are automatically selected by \zxZ2{...} and \zxX2{...} commands
+    % Styles zxLong{X/Z} zxNoPhase{X/Z} are automatically selected by \zxZ4{...} and \zxX4{...} commands
     % and zxShort is selected for fractions only like in \zxFracZ-{\pi}{4}
     % zxZ/.style={zxChoose={##1},fill=colorZxZ},
     % zxX/.style={zxChoose={##1},fill=colorZxX},
-    %%% First argument is additional style. Second argument is content of node.
-    zxZ2/.style 2 args={
-      add at Phase@Spider={zxNoPhaseZ}{zxLongZ}{stylePhaseInLabelZ}{##2},
-      /zx/post preparation labels,
-      /zx/user post preparation labels,
-      %/zx/user overlay nodes,
-      ##1,
-      zx at Execute@Very at End={zxNoPhaseZ}{zxLongZ}{stylePhaseInLabelZ}{##2},
+    %%% First argument is additional style.
+    %%% Second argument is the minus mode: "-" for minus sign, which forces short mode.
+    %%% Third argument is "*" for forced short mode.
+    %%% 4th argument is content of node.
+    zx at spider/.code n args={8}{
+      %% ##1: zxnophase style
+      %% ##2: zxshort style
+      %% ##3: zxlong style
+      %% ##4: label style
+      %% user provided:
+      %% ##5: additional tikz options
+      %% ##6: minus "-" or empty, like "-alpha"
+      %% ##7: star "*" or empty, to force short mode
+      %% ##8: content
+      %%% The argument is a minus. Like \zxZ-{\alpha}, goal is to typeset "-\alpha" in short mode.
+      \ifthenelse{\equal{##6}{-}}{% It's a minus!
+        \pgfkeysalso{% We update the content to "-content"
+          /zx/zx at shortModeForced/.initial={true},%
+        }%
+      }{}%
+      \ifthenelse{\equal{##7}{*}}{% We force short mode!
+        \pgfkeysalso{%
+          /zx/zx at shortModeForced/.initial={true},%
+        }%
+      }{}%
+      %  It's a minus, and LaTeX is... grrrr. How to get a cleaner code? Tried def/let, not working.
+      \ifthenelse{\equal{##6}{-}}{%
+        \pgfkeysalso{%
+          add at Phase@Spider={##1}{##2}{##3}{##4}{\zxMinusInShort##8},%
+        }%
+      }{%
+        \pgfkeysalso{%
+          add at Phase@Spider={##1}{##2}{##3}{##4}{##8},%
+        }%
+      }%
+      \pgfkeysalso{%
+        /zx/post preparation labels,
+        /zx/user post preparation labels,
+        % /zx/user overlay nodes,
+        ##5,
+      }%
+      \ifthenelse{\equal{##6}{-}}{% It's a minus, and LaTeX is... grrrr
+        \pgfkeysalso{%
+          zx at Execute@Very at End={##1}{##2}{##3}{##4}{\zxMinusInShort##8},%
+        }%
+      }{%
+        \pgfkeysalso{%
+          zx at Execute@Very at End={##1}{##2}{##3}{##4}{##8},%
+        }%
+      }%
     },
-    %% ##1: other styles, ##2: content
-    zxX2/.style 2 args={
-      add at Phase@Spider={zxNoPhaseX}{zxLongX}{stylePhaseInLabelX}{##2},
-      /zx/post preparation labels,
-      /zx/user post preparation labels,
-      ##1,
-      zx at Execute@Very at End={zxNoPhaseX}{zxLongX}{stylePhaseInLabelX}{##2},
+    %% ##1: additional tikz options
+    %% ##2: minus "-" or empty, like "-alpha"
+    %% ##3: star "*" or empty, to force short mode
+    %% ##4: content
+    zxZ4/.style n args={4}{
+      zx at spider={zxNoPhaseZ}{zxShortZ}{zxLongZ}{stylePhaseInLabelZ}{##1}{##2}{##3}{##4}
     },
+    zxX4/.style n args={4}{
+      zx at spider={zxNoPhaseX}{zxShortX}{zxLongX}{stylePhaseInLabelX}{##1}{##2}{##3}{##4}
+    },
     %% These take 6 arguments: additional style, sign (string "-" for minus, nothing for "+",
     %% otherwise inserted directly), above fraction (no parens), below fraction (no parens), above fraction (parens), below fraction (parens).
     zxFracZ6/.style n args={6}{
@@ -610,13 +1654,35 @@
   /zx/user overlay wires/.style={
   },
   /zx/defaultEnv/.style={
-    column sep=tiny,
-    row sep=tiny,
+    %tiny depends on the size of the font... which we want to keep consistent look
+    column sep=\zxDefaultColumnSep,
+    row sep=\zxDefaultRowSep,
+    zx column sep/.code={%
+      \def\zxDefaultColumnSep{##1}%
+      \pgfkeysalso{
+        column sep=##1,
+      }%
+    },
+    zx row sep/.code={%
+      \def\zxDefaultRowSep{##1}%
+      \pgfkeysalso{%
+        row sep=##1,
+      }%
+    },
+    %column sep=tiny,
+    %row sep=tiny,
     % center on the math axis
     baseline={([yshift=-axis_height]current bounding box.center)},
     % Fix 1-row diagram baseline
-    1-row diagram/.style={%
-      /tikz/baseline={([yshift=-axis_height]current bounding box.center)}%
+    % By default, 1-row diagrams have a different baseline... This package does not want a special case for 1-row diagrams.
+    1-row diagram/.style={},
+    %% usage: math baseline=wantedBaseline, where you have somewhere \zxX[a=wantedBaseline]{\beta}
+    math baseline/.style={baseline={([yshift=-axis_height]##1)}},
+    %%% Include a diagram in another diagram.
+    use diagram/.style 2 args={
+      execute at end picture={
+        \node[fit=##2,inner sep=0pt,yshift=-axis_height]{\zxUseDiagram{##1}};
+      }
     },
     % Load (thanks ".search also") our own style
     /tikz/every node/.style={%
@@ -625,6 +1691,15 @@
         \pgfkeysalso{%
           alias=####1,%
         }%
+        %% name path won't work with alias... So let's create two name path ^^
+        %% https://tex.stackexchange.com/questions/619622
+        \ifdefined\zxEnableIntersectionsNodes%
+          \edef\zx at name@path{zx at name@path@####1}%
+          \zx at message{[ZX] Name given using an alias: \zx at name@path.}%
+          \pgfkeysalso{
+            name path=\zx at name@path, % Used by intersection library
+          }%
+        \fi%
         \ifdefined\zxDebugMode%
           \pgfkeysalso{%
             label={[inner sep=0pt,overlay,red,font={\fontsize{5}{6}}]-45:\scalebox{.5}{####1}}
@@ -707,7 +1782,7 @@
 \def\node at on@layer{\aftergroup\node@@on at layer}
 
 %%% Declare a symbol for a short minus (useful in fractions)
-\DeclareMathSymbol{\zxMinus}{\mathbin}{AMSa}{"39} % Requires amssymb
+\DeclareMathSymbol{\zxMinus}{\mathbin}{AMSa}{"39}% Requires amssymb
 
 %%% Checks if a function is a point or a node.
 %%% Not sure if best solution (needed to dig into source of TeX), but can't find anything better in manual
@@ -720,7 +1795,24 @@
   }%
 }
 
+% shape anchor name if exists if not. Works, while doing \pgfutil at ifundefined{pgf at anchor@\shapenode{}@#2} fails.
+% I guess it has to do with the way macro are expanded...
+\def\ifAnchorExistsFromShape#1#2#3#4{
+  \pgfutil at ifundefined{pgf at anchor@#1@#2}{%
+    #4%
+  }{%
+    #3%
+  }%
+}
 
+% node name, anchor name, if exists, if not.
+\def\ifAnchorExists#1#2#3#4{%
+  %%% First we extract the shape of the node:
+  \edef\pgf at node@name{#1}%
+  \edef\shapenode{\csname pgf at sh@ns@\pgf at node@name\endcsname}%
+  \ifAnchorExistsFromShape{\shapenode}{#2}{#3}{#4}
+}
+
 %%% Create different kinds of dots...
 %% https://tex.stackexchange.com/questions/617959
 %% https://tex.stackexchange.com/questions/528774/excess-vertical-space-in-vdots/528775#528775
@@ -750,7 +1842,20 @@
 
 \DeclareRobustCommand{\cvdots}{\cvdotsCenterMathline}
 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% Practical functions to nest diagrams
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+\NewDocumentCommand{\zxSaveDiagram}{mO{}m}{
+  \newsavebox{#1}%
+  \savebox{#1}{\begin{ZX}[ampersand replacement=\&,#2]#3\end{ZX}}%
+}
+
+\NewDocumentCommand{\zxUseDiagram}{m}{
+  \usebox{#1}%
+}
+
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%% Practical macros to automatically choose appropriate style and arrows
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -762,7 +1867,7 @@
 % Useful to put on the left of a node like "n \vdots", linked to the next node.  Example: \leftManyDots{n}.
 % First optional argument is scale of text, second is scale of =.
 \NewExpandableDocumentCommand{\leftManyDots}{O{1}O{\zxScaleDots}m}{%
-  |[zxNone+,inner xsep=0pt]| \scalebox{#1}{$#3$\,}\makebox[0pt][l]{\scalebox{#2}{$\cvdots$}} \ar[r,-s.,start anchor=north east] \ar[r,-s',start anchor=south east] \pgfmatrixnextcell%
+  |[zxNone+,inner xsep=0pt]| \scalebox{#1}{$#3$\,}\makebox[0pt][l]{\scalebox{#2}{$\cvdotsCenterMathline$}} \ar[r,-N.,start anchor=north east] \ar[r,-N',start anchor=south east] \pgfmatrixnextcell[\zxwCol]%
 }
 
 % Useful to link two nodes and put a vdots in between.
@@ -772,7 +1877,7 @@
 
 % Like \leftManyDots but on the right. Do *not* create a new node, like in |[zxShortZ]| \alpha \rightManyDots{m}
 \NewExpandableDocumentCommand{\rightManyDots}{O{1}O{\zxScaleDots}m}{%
-  \ar[r,s'-,end anchor=north west] \ar[r,s.-,end anchor=south west] \pgfmatrixnextcell |[zxNone+,inner xsep=0pt]| \makebox[0pt][r]{\scalebox{#2}{$\cvdots$}}\scalebox{#1}{\,$#3$}
+  \ar[r,N'-,end anchor=north west] \ar[r,N.-,end anchor=south west] \pgfmatrixnextcell[\zxwCol] |[zxNone+,inner xsep=0pt]| \makebox[0pt][r]{\scalebox{#2}{$\cvdotsCenterMathline$}}\scalebox{#1}{\,$#3$}
 }
 
 % A swap on one line... Practical mostly to gain space. Must be used with large nodes tough...
@@ -786,19 +1891,20 @@
 }
 
 \NewExpandableDocumentCommand{\zxLoopAboveDots}{O{20}O{}m}{%
-  \ar[loop,in=90-#1,out=90+#1,looseness=8,min distance=3mm,"\cvdots" {scale=.6,anchor=north,yshift=-0.4mm},#2]
+  \ar[loop,in=90-#1,out=90+#1,looseness=8,min distance=3mm,"\cvdotsCenterMathline" {scale=.6,anchor=north,yshift=-0.25mm},#2]
 }
 
+
 % Usage: node without any style, but may have space. Default is no space, \zxNone+{} is both horizontal
 % and vertical, \zxNone-{} is only horizontal space, \zxNone|{} is only vertical space.
 \NewExpandableDocumentCommand{\zxNone}{t+t-t|O{}m}{
-  \IfBooleanTF{#1}{ % \zxNone+
+  \IfBooleanTF{#1}{% \zxNone+
     |[zxNone+,#4]| #5%
   }{
-    \IfBooleanTF{#2}{ % \zxNone-
+    \IfBooleanTF{#2}{% \zxNone-
       |[zxNone-,#4]| #5%
     }{
-      \IfBooleanTF{#3}{ % \zxNone
+      \IfBooleanTF{#3}{% \zxNone
         |[zxNoneI,#4]| #5%
       }{% \zxNone
         |[zxNone,#4]| #5%
@@ -809,13 +1915,13 @@
 
 % Usage: alias of \zxNone... To bad token can't be easily forwarded to another function.
 \NewExpandableDocumentCommand{\zxN}{t+t-t|O{}m}{
-  \IfBooleanTF{#1}{ % \zxNone+
+  \IfBooleanTF{#1}{% \zxNone+
     |[zxNone+,#4]| #5%
   }{
-    \IfBooleanTF{#2}{ % \zxNone-
+    \IfBooleanTF{#2}{% \zxNone-
       |[zxNone-,#4]| #5%
     }{
-      \IfBooleanTF{#3}{ % \zxNone
+      \IfBooleanTF{#3}{% \zxNone
         |[zxNoneI,#4]| #5%
       }{% \zxNone
         |[zxNone,#4]| #5%
@@ -826,13 +1932,13 @@
 
 % Cf \zxNone, but with larger space.
 \NewExpandableDocumentCommand{\zxNoneDouble}{t+t-t|O{}m}{
-  \IfBooleanTF{#1}{ % \zxNoneDouble+
+  \IfBooleanTF{#1}{% \zxNoneDouble+
     |[zxNoneDouble+,#4]| #5%
   }{
-    \IfBooleanTF{#2}{ % \zxNoneDouble-
+    \IfBooleanTF{#2}{% \zxNoneDouble-
       |[zxNoneDouble-,#4]| #5%
     }{
-      \IfBooleanTF{#3}{ % \zxNoneDouble
+      \IfBooleanTF{#3}{% \zxNoneDouble
         |[zxNoneDoubleI,#4]| #5%
       }{% \zxNoneDouble
         |[zxNoneDouble,#4]| #5%
@@ -843,14 +1949,14 @@
 
 %% For maximum styling liberty, the content is given directly to the style.
 % It allows the style to put the phase in a label.
-\NewExpandableDocumentCommand{\zxZ}{O{}m}{
-  |[zxZ2={#1}{#2}]| %
+\NewExpandableDocumentCommand{\zxZ}{O{}t*t-m}{
+  |[zxZ4={#1}{\IfBooleanTF{#3}{-}{}}{\IfBooleanTF{#2}{*}{}}{#4}]| %
 }
 
 %% For maximum styling liberty, the content is given directly to the style.
 %% It allows the style to put the phase in a label.
-\NewExpandableDocumentCommand{\zxX}{O{}m}{
-  |[zxX2={#1}{#2}]| %
+\NewExpandableDocumentCommand{\zxX}{O{}t*t-m}{
+  |[zxX4={#1}{\IfBooleanTF{#3}{-}{}}{\IfBooleanTF{#2}{*}{}}{#4}]| %
 }
 
 \NewExpandableDocumentCommand{\zxH}{O{}m}{
@@ -889,6 +1995,7 @@
 %%%%% Main environment \begin{ZX}...\end{ZX}
 \NewDocumentEnvironment{ZX}{O{}}{%
   \bgroup%
+  \fontsize{10}{12}\selectfont% Normalize the font size to have consistent drawings everywhere.
   % Add a switch in case someone really wants the current tikzcd version:
   \ifdefined\doNotPatchQuantikz% Do not patch tikzcd.
   \else% Restore locally original tikzcd.
@@ -895,7 +2002,7 @@
     \let\tikzcd@\tikzcd@@originalCopyZx%
     \let\endtikzcd\endtikzcd at originalCopyZx%
   \fi%
-  \pgfsetlayers{background,edgelayer,nodelayer,main,box,labellayer,foreground} % Layers are defined locally to avoid to disturb other drawings
+  \pgfsetlayers{background,edgelayer,nodelayer,main,box,labellayer,foreground}% Layers are defined locally to avoid to disturb other drawings
   \begin{tikzcd}[%
     /zx/defaultEnv,%
     #1]%
@@ -935,11 +2042,11 @@
       % Check if width < ratio*(height+depth) to see if short style applies
       \ifdimcomp{\wd\zx at box}{<}{\dimexpr \zxMaxRatio\ht\zx at box + \zxMaxRatio\dp\zx at box\relax}{%
         #3% Short style is used
-      }{ % Else
+      }{% Else
         #4% Long style is used
-      } %
-    }{
+      }%
+    }{%
       #4% Long style is used
-    }
+    }%
   }%
 }

Modified: trunk/Master/texmf-dist/tex/latex/zx-calculus/zx-calculus.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/zx-calculus/zx-calculus.sty	2021-10-22 21:33:43 UTC (rev 60837)
+++ trunk/Master/texmf-dist/tex/latex/zx-calculus/zx-calculus.sty	2021-10-22 21:35:38 UTC (rev 60838)
@@ -2,7 +2,7 @@
 % Written by Léo Colisson. Report bugs on https://github.com/leo-colisson/zx-calculus/issues
 % Published under the MIT license.
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{zx-calculus}[2021/10/15 A package to typeset ZX calculus in directly in LaTeX, based on tikz/tikzcd.]
+\ProvidesPackage{zx-calculus}[2021/10/22 A package to typeset ZX calculus in directly in LaTeX, based on tikz/tikzcd.]
 
 \RequirePackage{tikz}
 



More information about the tex-live-commits mailing list.