1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303
|
# quantikz package
# Matthew Bertucci 12/28/2021 for v0.9.6
#include:tikz
# loads quantikz tikzlibrary
# from quantikz tikzlibrary
#include:xargs
#include:ifthen
#include:xstring
#include:xparse
#include:etoolbox
#include:mathtools
#include:pgfmath
#include:environ
# loads cd, decorations.pathreplacing, calc, positioning, fit, shapes.symbols, shapes.misc
# decorations.pathmorphing, backgrounds, decorations.markings, and math tikzlibraries
\begin{quantikz}#\math,array
\begin{quantikz}[options%keyvals]]#\math,array
\end{quantikz}
\gate{label}#/tikzcd,quantikz
\gate[options%keyvals]{label}#/tikzcd,quantikz
\gate[options%keyvals][width]{label}#/tikzcd,quantikz
\gate[options%keyvals][width][height]{label}#/tikzcd,quantikz
\phase{label}#/tikzcd,quantikz
\phase[TikZ options%keyvals]{label}#/tikzcd,quantikz
\lstick{text}#/tikzcd,quantikz
\lstick[options%keyvals]{text}#/tikzcd,quantikz
\rstick{text}#/tikzcd,quantikz
\rstick[options%keyvals]{text}#/tikzcd,quantikz
\qw#/tikzcd,quantikz
\cw#/tikzcd,quantikz
\push{label}#/tikzcd,quantikz
\alias{arg}#*/tikzcd,quantikz
\trash{label}#/tikzcd,quantikz
\trash[TikZ options%keyvals]{label}#/tikzcd,quantikz
\qwbundle{label}#/tikzcd,quantikz
\qwbundle[alternate]{%<label%>}#/tikzcd,quantikz
\qwbundle[alternate=2]{%<label%>}#/tikzcd,quantikz
\ctrl{number}#/tikzcd,quantikz
\octrl{number}#/tikzcd,quantikz
\targ{}#/tikzcd,quantikz
\targ[TikZ options%keyvals]{}#/tikzcd,quantikz
\control{}#/tikzcd,quantikz
\control[TikZ options%keyvals]{}#/tikzcd,quantikz
\ocontrol{}#/tikzcd,quantikz
\ocontrol[TikZ options%keyvals]{}#/tikzcd,quantikz
\targX{}#/tikzcd,quantikz
\targX[TikZ options%keyvals]{}#/tikzcd,quantikz
\swap{number}#/tikzcd,quantikz
\vqw{number}#/tikzcd,quantikz
\vcw{number}#/tikzcd,quantikz
\cwbend{number}#/tikzcd,quantikz
\ctrlbundle{number}#/tikzcd,quantikz
\ctrlbundle[1 or 2]{number}#/tikzcd,quantikz
\ctrlbundle[1 or 2][TikZ options%keyvals]{number}#/tikzcd,quantikz
\gateinput{text}#/tikzcd,quantikz
\gateinput[options%keyvals]{text}#/tikzcd,quantikz
\gateoutput{text}#/tikzcd,quantikz
\gateoutput[options%keyvals]{text}#/tikzcd,quantikz
\slice{title%text}#/tikzcd,quantikz
\slice[options%keyvals]{title%text}#/tikzcd,quantikz
\phantomgate{text%plain}#/tikzcd,quantikz
\hphantomgate{text%plain}#/tikzcd,quantikz
\ghost{text%plain}#/tikzcd,quantikz
\ghost[options]{text%plain}#*/tikzcd,quantikz
\ghost[options][width]{text%plain}#*/tikzcd,quantikz
\ghost[options][width][height]{text%plain}#*/tikzcd,quantikz
\midstick{text}#/tikzcd,quantikz
\midstick[options%keyvals]{text}#/tikzcd,quantikz
\linethrough#/tikzcd,quantikz
\meter{text}#/tikzcd,quantikz
\meter[TikZ options%keyvals]{text}#/tikzcd,quantikz
\measuretab{label}#/tikzcd,quantikz
\measuretab[TikZ options%keyvals]{label}#/tikzcd,quantikz
\meterD{label}#/tikzcd,quantikz
\meterD[TikZ options%keyvals]{label}#/tikzcd,quantikz
\measure{label}#/tikzcd,quantikz
\measure[TikZ options%keyvals]{label}#/tikzcd,quantikz
\gategroup{text}#/tikzcd,quantikz
\gategroup[options%keyvals]{text}#/tikzcd,quantikz
\wave#/tikzcd,quantikz
\wave[TikZ options%keyvals]#/tikzcd,quantikz
\makeebit{text}#/tikzcd,quantikz
\makeebit[angle]{text}#/tikzcd,quantikz
\makeebit[angle][TikZ options%keyvals]{text}#/tikzcd,quantikz
\ket{arg%formula}
\bra{arg%formula}
\proj{arg%formula}
\braket{left%formula}{right%formula}
#keyvals:\begin{quantikz}#c,\begin{tikzcd}#c
slice all
remove end slices=%<integer%>
slice titles=%<text%>
slice style={%<TikZ options%>}
slice label style={%<TikZ options%>}
vertical slice labels
align equals at=%<wire number%>
thin lines
transparent
#endkeyvals
#keyvals:\gate#c,\lstick#c,\rstick#c,\gateinput#c,\gateoutput#c,\slice#c,\midstick#c,\gategroup#c
wires=%<integer%>
style={%<TikZ options%>}
label style={%<TikZ options%>}
cwires=%<integer%>
nwires=%<integer%>
bundle=%<integer%>
disable auto height
brackets=#none,left,right,both
%<integer%>
steps=%<integer%>
background
swap
#endkeyvals
\myl#*
\myh#*
\myd#*
\theaaa#*
\IfInList{item}{list}#*
\ifnodedefined{node}{true}{false}#*
\MathAxis#*
\DisableMinSize#*
\quantwires#*
\dotikzset#*
\undotikzset#*
\sliceallr#*
\sliceallvr#*
\DivideRowsCols#*
\setmiddle{row num}#*
\vqwexplicit{from}{to}#*
\vqbundleexplicit{from}{to}#*
\vcwhexplicit{from}{to}#*
\vqwexplicitcenter{from}{to}#*
\resetstyles#*
\maketransparent#*
\row#*
\col#*
# from cd tikzlibrary
\begin{tikzcd}#\array,math
\begin{tikzcd}[options%keyvals]#\array,math
\end{tikzcd}
\arrow[%<options%>]#/tikzcd,quantikz
\arrow[%<options%>]{%<direction%>}{%<label%>}#*/tikzcd,quantikz
\arrow[%<options%>]{%<direction%>}[%<label options%>]{%<label%>}#*/tikzcd,quantikz
\ar[%<options%>]#*/tikzcd,quantikz
\rar[%<options%>]#*/tikzcd,quantikz
\rar[%<options%>]{%<label%>}#*/tikzcd,quantikz
\lar[%<options%>]#*/tikzcd,quantikz
\lar[%<options%>]{%<label%>}#*/tikzcd,quantikz
\dar[%<options%>]#*/tikzcd,quantikz
\dar[%<options%>]{%<label%>}#*/tikzcd,quantikz
\uar[%<options%>]#*/tikzcd,quantikz
\uar[%<options%>]{%<label%>}#*/tikzcd,quantikz
\drar[%<options%>]#*/tikzcd,quantikz
\drar[%<options%>]{%<label%>}#*/tikzcd,quantikz
\urar[%<options%>]#*/tikzcd,quantikz
\urar[%<options%>]{%<label%>}#*/tikzcd,quantikz
\dlar[%<options%>]#*/tikzcd,quantikz
\dlar[%<options%>]{%<label%>}#*/tikzcd,quantikz
\ular[%<options%>]#*/tikzcd,quantikz
\ular[%<options%>]{%<label%>}#*/tikzcd,quantikz
\tikzcdset{options%keyvals}
\tikzcd#S
\endtikzcd#S
## arrow types
#keyvals:\arrow#c,\ar#c,\rar#c,\lar#c,\dar#c,\uar#c,\drar#c,\urar#c,\dlar#c,\ular#c
to head
rightarrow
leftarrow
leftrightarrow
Rightarrow
Leftarrow
Leftrightarrow
maps to
mapsto
mapsfrom
Mapsto
Mapsfrom
hook
hook'
hookrightarrow
hookleftarrow
dashed
dashrightarrow
dashleftarrow
tail
rightarrowtail
leftarrowtail
squiggly
rightsquigarrow
leftsquigarrow
leftrightsquigarrow
two heads
twoheadrightarrow
twoheadleftarrow
no head
no tail
dash
equal
harpoon
harpoon'
rightharpoonup
rightharpoondown
leftharpoonup
leftharpoondown
#endkeyvals
## appearance of diagrams
#keyvals:\tikzcdset#c,\begin{tikzcd}#c,\begin{quantikz}#c
every diagram
diagrams={%<options%>}
every matrix
every cell
cells={%<options%>}
row sep=##L
column sep=##L
sep=##L
cramped
math mode#true,false
background color=#%color
every arrow
arrows={%<options%>}
arrow style=#Latin Modern,math font,tikz
every label
labels={%<options%>}
center yshift=##L
ampersand replacement=%<macro%>
#endkeyvals
## shared cd keys
#keyvals:\arrow#c,\ar#c,\rar#c,\lar#c,\dar#c,\uar#c,\drar#c,\urar#c,\dlar#c,\ular#c,\tikzcdset#c,\begin{tikzcd}#c,\begin{quantikz}#c
shorten=##L
crossing over
crossing over clearance=##L
marking
description
# some useful shared TikZ keys
%color
color=#%color
in=%<degrees%>
out=%<degrees%>
font=%<font commands%>
line width=##L
#endkeyvals
## arrow keys
#keyvals:\arrow#c,\ar#c,\rar#c,\lar#c,\dar#c,\uar#c,\drar#c,\urar#c,\dlar#c,\ular#c
from=
to=
phantom
shift left=##L
shift right=##L
shift={%<coordinate%>}
xshift=##L
yshift=##L
start anchor=%<anchor%>
start anchor={[%<coord transforms%>]%<anchor%>}
end anchor=%<anchor%>
end anchor={[%<coord transforms%>]%<anchor%>}
# some useful TikZ keys for arrows
bend left
bend left=%<degrees%>
bend right
bend right=%<degrees%>
near start
near end
very near start
very near end
above
below
left
right
swap
to path={%<path spec%>}
#endkeyvals
\tikzcdmatrixname#*
|