summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/yquant/yquant-config.tex
blob: ab07830929f7a487c2d0441c6b3cd6dd0253cb23 (plain)
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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
\pgfdeclaremetadecoration{tikz@internal}{pre}{%
   \state{pre}[width=\pgfkeysvalueof{/pgf/decoration/pre length}+\pgfkeysvalueof{/pgf/decoration/post length}, next state=main]{%
      \appto\tikz@dec@shift{\pgftransformxshift{-\pgfkeysvalueof{/pgf/decoration/post length}}}%
      \tikz@dec@trans%
      \decoration{\pgfkeysvalueof{/pgf/decoration/pre}}%
   }%
   \state{main}[width=\pgfmetadecoratedremainingdistance, next state=final]{%
      \tikz@dec@trans%
      \decoration{\tikz@decoration@name}%
   }%
   \state{final}{%
      \tikz@dec@trans%
      \decoration{\pgfkeysvalueof{/pgf/decoration/post}}%
   }%
}

% BEGIN_FOLD Circuit layout
\ifnum\yquant@compat<2 %
   \pgfqkeys{/yquant}{%
      register/minimum height/.code=%
         {\dimdef\yquant@config@register@minimum@height{.5\dimexpr#1\relax}%
          \let\yquant@config@register@minimum@depth=\yquant@config@register@minimum@height}%
   }
\else%
   \pgfqkeys{/yquant}{%
      register/minimum height/.code=%
         {\dimdef\yquant@config@register@minimum@height{#1}},%
      register/minimum depth/.code=%
         {\dimdef\yquant@config@register@minimum@depth{#1}},%
      register/minimum left/.forward to=/yquant/register/minimum height,%
      register/minimum right/.forward to=/yquant/register/minimum depth,%
      register/minimum before/.forward to=/yquant/register/minimum height,%
      register/minimum after/.forward to=/yquant/register/minimum after%
   }
\fi
\def\yquant@config@draw@ensurelayers@addwires#1,main,#2\yquant@stop{%
   \ifstrempty{#2}{%
      % main was the last item in the list, so we needed to add the comma
      \edef\pgf@layerlist{\@gobble#1,wires,main}%
   }{%
      % there were more items in the list, so we have a spurious comma in #2
      \expandafter\yquant@config@draw@ensurelayers@addwires@%
         \expandafter,\pgf@layerlist\yquant@stop%
   }%
}
\def\yquant@config@draw@ensurelayers@addwires@#1,main,#2\yquant@stop{%
   \edef\pgf@layerlist{\@gobble#1,wires,main,#2}%
}
\def\yquant@config@draw@ensurelayers@haswires#1,wires,#2\yquant@stop{%
   \ifstrempty{#2}{%
      % wires not present yet, take action
      \expandafter\yquant@config@draw@ensurelayers@addwires%
         \expandafter,\pgf@layerlist,\yquant@stop%
   }\relax%
}
\def\yquant@config@draw@ensurelayers@addbehindwires#1,wires,#2\yquant@stop{%
   \ifstrempty{#2}{%
      % wires was the last item in the list, so we needed to add the comma (should never happen)
      \edef\pgf@layerlist{\@gobble#1,behindwires,wires}%
      \PackageWarning{yquant.sty}{The wires layer was set on top of the main layer - expect undesirable outcomes.}%
   }{%
      % there were more items in the list, so we have a spurious comma in #2
      \expandafter\yquant@config@draw@ensurelayers@addbehindwires@%
         \expandafter,\pgf@layerlist\yquant@stop%
   }%
}
\def\yquant@config@draw@ensurelayers@addbehindwires@#1,wires,#2\yquant@stop{%
   \edef\pgf@layerlist{\@gobble#1,behindwires,wires,#2}%
}
\def\yquant@config@draw@ensurelayers@hasbehindwires#1,behindwires,#2\yquant@stop{%
   \ifstrempty{#2}{%
      % wires not present yet, take action
      \expandafter\yquant@config@draw@ensurelayers@addbehindwires%
         \expandafter,\pgf@layerlist,\yquant@stop%
   }\relax%
}
\def\yquant@config@draw@ensurelayers{%
   \expandafter\yquant@config@draw@ensurelayers@haswires%
      \expandafter,\pgf@layerlist,wires,\yquant@stop%
   \expandafter\yquant@config@draw@ensurelayers@hasbehindwires%
      \expandafter,\pgf@layerlist,behindwires,\yquant@stop%
   \ifyquant@config@draw@quality%
      % maybe the option was set outside of a tikzpicture, then we need to keep this
      \global\let\endpgfpicture=\yquant@old@endpgfpicture%
      \global\yquant@config@requirelayersfalse%
   \fi%
}

\pgfqkeys{/yquant}{%
   register/separation/.code=%
      {\dimdef\yquant@config@register@sep{#1}},%
   operator/minimum width/.code=%
      {\dimdef\yquant@config@operator@minimum@width{#1}},%
   operator/minimum extent/.forward to=/yquant/operator/minimum width,%
   operator/separation/.code=%
      {\dimdef\yquant@config@operator@sep{#1}},%
   operator/multi warning/.is if=%
      yquant@config@operator@multi@warn,%
   drawing mode/.is choice,%
   drawing mode/quality/.code=%
      {\yquant@config@draw@qualitytrue%
       \pgfkeysalso{/yquant/default background=none}%
       \unless\ifpgfpicture%
          % we do not reset the special layer injection (there may be multiple yquant environments, and only one of them had the "size" drawing mode; then, we still need the layers), unless this is actually set outside of a tikzpicture
          \ifdefined\yquant@old@endpgfpicture% only if we changed before
            \global\let\endpgfpicture=\yquant@old@endpgfpicture%
            \global\yquant@config@requirelayersfalse%
          \fi%
       \fi},%
   drawing mode/size/.code=%
      {\yquant@config@draw@qualityfalse%
       \pgfkeysalso{/yquant/default background=white}%
       \unless\ifyquant@config@requirelayers%
          \global\let\yquant@old@endpgfpicture=\endpgfpicture%
          \gpreto\endpgfpicture\yquant@config@draw@ensurelayers%
       \fi%
       \global\yquant@config@requirelayerstrue},%
   default background/.initial=%
      {none},%
   default fill/.style={%
      fill/.expanded=\pgfkeysvalueof{/yquant/default background}}
}%
% END_FOLD
% BEGIN_FOLD Register creation
\pgfqkeys{/yquant}{%
   register/default name/.store in=%
      \yquant@config@register@default@name,%
   register/default lazy name/.store in=%
      \yquant@config@register@default@lazyname%
}
\ifnum\yquant@compat<2 %
   \pgfqkeys{/yquant}{%
      every label/.style=%
         {shape=yquant-init, anchor=center,%
          align/.expanded=\ifyquanthorz{right}{center}, outer timesep=2pt},%
      every multi label/.style=%
         {draw, decoration/.expanded={gapped brace, raise=2pt, \ifyquanthorz{mirror}{}}, decorate}%
   }
\else
   \pgfqkeys{/yquant}{%
      every label/.style=%
         {shape=yquant-init, anchor=center,%
          align/.expanded=\ifyquanthorz{right}{center}, outer timesep=2pt,%
          /yquant/operator/if multi={draw, decoration/.expanded={gapped brace, raise=2pt, \ifyquanthorz{mirror}{}}, decorate}}%
    }
\fi
\pgfqkeys{/yquant}{
   every initial label/.style=%
      {anchor/.expanded=\ifyquanthorz{east}{south}, /yquant/internal/autorotate init},%
   every qubit label/.style=%
      {},%
   every cbit label/.style=%
      {},%
   every qubits label/.style=%
      {}%
}
\ifnum\yquant@compat<2 %
   \pgfqkeys{/yquant}{%
      every input label/.style=%
         {}%
   }%
\fi%
% END_FOLD
% BEGIN_FOLD Register outputs
\ifnum\yquant@compat<2 %
   \pgfqkeys{/yquant}{%
      every output/.style=%
         {shape=yquant-output, anchor/.expanded=\ifyquanthorz{west}{north},%
          align/.expanded=\ifyquanthorz{left}{center}, outer timesep=2pt,%
          /yquant/internal/autorotate output},%
      every multi output/.style=%
         {draw, decoration/.expanded={gapped brace, raise=2pt, \ifyquanthorz{}{mirror}}, decorate}%
   }
\else
   \pgfqkeys{/yquant}{%
      every output/.style=%
         {shape=yquant-output, anchor/.expanded=\ifyquanthorz{west}{north},%
          align/.expanded=\ifyquanthorz{left}{center}, outer timesep=2pt,%
          /yquant/operator/if multi={draw, decoration/.expanded={gapped brace, raise=2pt, \ifyquanthorz{}{mirror}}, decorate},%
          /yquant/internal/autorotate output}%
   }
\fi
\pgfqkeys{/yquant}{%
   every qubit output/.style=%
      {},%
   every cbit output/.style=%
      {},%
   every qubits output/.style=%
      {}%
}
% END_FOLD
% BEGIN_FOLD General styling
\pgfqkeys{/yquant}{%
   every circuit/.style={%
      every node/.prefix style={transform shape}
   }%
}
\@ifpackagelater{pgf}{2020/09/31}\relax{
   \pgfkeys{/yquant/every circuit/.append style={%
      every label/.prefix style={transform shape=false}%
   }}
}
\pgfqkeys{/yquant}{%
   every wire/.style=%
      {draw},%
   every qubit wire/.style=%
      {},%
   every cbit wire/.style=%
      {},%
   every qubits wire/.style=%
      {},%
   every control line/.style=%
      {draw},%
   every control/.style=%
      {shape=yquant-circle, anchor=center, radius=.5mm},%
   every positive control/.style=%
      {fill=black},%
   every negative control/.style=%
      {draw, /yquant/default fill},%
   every operator/.style=%
      {anchor=center},%
   every multi line/.style=%
      {draw, decoration={snake, amplitude=.25mm, segment length=5pt}, decorate},%
   this operator/.style=%
      {},%
   this control/.style=%
      {},%
   operator style/.style=%
      {/yquant/this operator/.append style={#1}},%
   control style/.style=%
      {/yquant/every control line/.append style={#1},%
       /yquant/this control/.append style={#1}},%
   style/.style=%
      {/yquant/this operator/.append style={#1},%
       /yquant/every control line/.append style={#1},%
       /yquant/this control/.append style={#1}},%
   operator/multi as single/.style=%
      {/yquant/every multi line/.style=/yquant/every control line},%
   operator/if multi/.code=%
      {\ifyquant@config@operator@multi\pgfkeysalso{#1}\fi},%
   circuit/seamless/.is if=yquant@config@circuit@seamless,%
   circuit/orientation/.is choice,%
   circuit/orientation/horizontal/.code={%
      \ifyquant@config@circuitsetup%
         \pgfkeysalso{/yquant/internal/autorotate init/.style={},%
            /yquant/internal/autorotate output/.style={}}%
         \yquant@config@circuit@orientation@horizontal%
      \else%
         \PackageError{yquant.sty}{`circuit/orientation' can only be modified in the environment options or globally.}{Don't modify this within a circuit.}%
      \fi%
   },%
   circuit/orientation/vertical/.code={%
      \ifyquant@config@circuitsetup%
         \yquant@config@circuit@orientation@vertical%
      \else%
         \PackageError{yquant.sty}{`circuit/orientation' can only be modified in the environment options or globally.}{Don't modify this within a circuit.}%
      \fi%
   },%
   horizontal/.forward to=/yquant/circuit/orientation/horizontal,%
   vertical/.code={%
      \pgfkeysalso{/yquant/circuit/orientation/vertical}%
      \unless\ifdim#1 pt=0pt %
         \ifdefined\adjustbox%
            \pgfkeysalso{%
               /yquant/internal/autorotate init/.style={%
                  /tikz/execute at begin node={\adjustbox{rotate=#1}}%
               }, /yquant/internal/autorotate output/.style={%
                  /tikz/execute at begin node={\adjustbox{rotate=-#1}}%
               }%
            }%
         \else%
            \PackageWarning{yquant.sty}{In order to use the automatic rotation of initial labels for vertical circuits, you need to load the `adjustbox' package.}%
         \fi%
      \fi%
   },%
   vertical/.default=0,%
   every post measurement control/.is choice,
   every post measurement control/indirect/.code={%
      \undef\yquant@lang@attr@directcontrol%
   },%
   every post measurement control/direct/.code={%
      \let\yquant@lang@attr@directcontrol=\relax%
   }%
}
% END_FOLD
% BEGIN_FOLD Styles for operators
\ifnum\yquant@compat<2 %
   \pgfqkeys{/yquant}{%
      operators/every barrier/.style=%
         {shape=yquant-line, dashed, draw}%
   }
\else
   \pgfqkeys{/yquant}{%
      operators/every barrier/.style=%
         {shape=yquant-line, dashed, draw, shorten <= -1mm, shorten >= -1mm}
   }
\fi
\pgfqkeys{/yquant}{%
   operators/every text/.style=%
      {shape=yquant-rectangle, align=center, inner timesep=1mm, time radius=2mm, space radius=2.47mm, /yquant/default fill}%
}
\ifnum\yquant@compat<3 %
   \pgfqkeys{/yquant}{%
      % we did not have this style before 0.6, but for the ease of implementation, we just change the direction of inheritance---users of earlier compat versions will never use the style, so this is fully transparent
      operators/every rectangular box/.style=%
         {/yquant/operators/every box},%
      operators/every box/.style=%
         {shape=yquant-rectangle, draw, align=center, inner timesep=1mm, time radius=2mm, space radius=2.47mm, /yquant/default fill}%
   }
\else
   \pgfqkeys{/yquant}{%
      operators/every rectangular box/.style=%
         {shape=yquant-rectangle, draw, align=center, inner timesep=1mm, time radius=2mm, space radius=2.47mm, /yquant/default fill},%
      operators/every box/.style=%
         {/yquant/operators/every rectangular box}%
   }
\fi
\ifnum\yquant@compat<2 %
   \pgfqkeys{/yquant}{%
      operators/every custom gate/.style=%
         {/yquant/operators/subcircuit/frameless, /yquant/register/default name=}%
   }
\else
   \pgfqkeys{/yquant}{%
      operators/every custom gate/.style=%
         {/yquant/operators/subcircuit/seamless}%
   }
\fi
\pgfqkeys{/yquant}{%
   operators/every dmeter/.style=%
      {shape=yquant-dmeter, time radius=2mm, space radius=2mm, draw, /yquant/default fill},
   % every h is implicitly defined during gate declaration
   operators/every inspect/.style=%
      {shape=yquant-output, align/.expanded=\ifyquanthorz{left}{center},
       outer timesep=.3333em, space radius=2.47mm, /yquant/default fill,%
       /yquant/operator/if multi={draw, decoration/.expanded={gapped brace, raise=2pt, \ifyquanthorz{}{mirror}}, decorate}},%
   operators/every measure/.style=%
      {shape=yquant-measure, x radius=4mm, y radius=2.5mm, draw, /yquant/default fill},%
   operators/every measure meter/.style=%
      {draw, -{Latex[length=2.5pt]}},%
   operators/every not/.style=%
      {shape=yquant-oplus, radius=1.3mm, draw, /yquant/default fill},%
   operators/every pauli/.style=%
      {/yquant/operators/every rectangular box},%
   operators/every phase/.style=%
      {shape=yquant-circle, radius=.5mm, fill},%
   operators/every slash/.style=%
      {shape=yquant-slash, x radius=.5mm, y radius=.7mm, draw},%
   operators/every subcircuit/.style=%
      {},%
   operators/every subcircuit box/.style=%
      {/yquant/operators/every rectangular box, fill=none},%
   subcircuit box style/.style=%
      {/yquant/operators/every subcircuit box/.append style={#1}},%
   operators/this subcircuit box/.style=%
      {},%
   this subcircuit box style/.style=%
      {/yquant/operators/this subcircuit box/.append style={#1}},%
   operators/subcircuit/frameless/.style=
      {/yquant/operators/this subcircuit box/.append style={draw=none, inner sep=0pt}},%
   operators/subcircuit/seamless/.code=%
      {\pgfkeysalso{/yquant/operators/subcircuit/frameless, /yquant/register/default name=}%
       \ifdefined\yquant@prefix%
          \csletcs{yquant@prevseamless}{\yquant@prefix seamless}%
       \else%
          \csletcs{yquant@prevseamless}{iffalse}%
       \fi%
       \yquant@config@circuit@seamlesstrue},
   operators/subcircuit/name mangling/.is choice,%
   operators/subcircuit/name mangling/prefix or discard/.code=%
      {\def\yquant@config@operator@subcircuit@mangling{0}},%
   operators/subcircuit/name mangling/prefix or transparent/.code=%
      {\def\yquant@config@operator@subcircuit@mangling{1}},%
   operators/subcircuit/name mangling/transparent/.code=%
      {\def\yquant@config@operator@subcircuit@mangling{2}},%
   operators/subcircuit/name mangling/discard/.code=%
      {\def\yquant@config@operator@subcircuit@mangling{3}},%
   operators/subcircuit/name mangling reset/.is if=%
      yquant@config@operator@subcircuit@manglingreset,
   operators/every swap/.style=%
      {shape=yquant-swap, radius=.75mm, draw},%
   operators/every wave/.style=%
      {shape=yquant-circle, radius=.5mm, fill},%
   % every x is implicitly defined during gate declaration
   operators/every xx/.style=%
      {shape=yquant-rectangle, radius=.75mm, draw, /yquant/default fill},%
   % every y is implicitly defined during gate declaration
   % every z is implicitly defined during gate declaration
   operators/every zz/.style=%
      {shape=yquant-circle, radius=.5mm, fill},%
}
% END_FOLD
% BEGIN_FOLD Internal styles (undocument, do not use!)
\pgfqkeys{/yquant}{%
   internal/move label/.code=%
      {\yquant@config@operator@position@rightaligntrue},
   internal/no advance/.code=%
      {\unless\ifyquantmeasuring% We don't draw subcircuits during measuring time, but we need their advancement
          \yquant@config@operator@position@advancefalse%
       \fi},
   internal/multi main/.is if=%
      yquant@config@internal@multi@main,%
   internal/setup done/.code=%
      {\yquant@config@circuitsetupfalse},%
   internal/autorotate init/.style={},%
   internal/autorotate output/.style={},%
}
\ifnum\yquant@compat<2 %
   \pgfqkeys{/yquant}{%
      internal/squeeze slash/.code=%
         {\dimdef\yquant@config@operator@sep{.5\dimexpr\yquant@config@operator@sep-\pgflinewidth\relax}%
          \yquant@config@operator@position@advancefalse},%
   }
\else%
   \pgfqkeys{/yquant}{%
      internal/squeeze slash/.code={}%
   }
\fi
% END_FOLD

\protected\def\yquant@config@circuit@orientation@horizontal{%
   \let\ifyquanthorz=\@firstoftwo%
   \tikzset{%
      % in principle, these are all /.forward to handlers, but we want them non-accumulative
      time radius/.code={\pgfkeys{/tikz/x radius={##1}}},%
      space radius/.code={\pgfkeys{/tikz/y radius={##1}}},%
      inner timesep/.code={\pgfkeys{/tikz/inner xsep={##1}}},%
      inner spacesep/.code={\pgfkeys{/tikz/inner ysep={##1}}},%
      outer timesep/.code={\pgfkeys{/tikz/outer xsep={##1}}},%
      outer spacesep/.code={\pgfkeys{/tikz/outer ysep={##1}}}%
   }%
   \def\yquant@config@register@minimum@height@default{1.5mm}%
   \def\yquant@config@register@minimum@depth@default{1.5mm}%
   \def\yquant@config@operator@minimum@width@default{5mm}%
   \let\yquant@pgf@picminx=\pgf@picminx%
   \let\yquant@pgf@picmaxx=\pgf@picmaxx%
   \let\yquant@pgf@picminy=\pgf@picminy%
   \let\yquant@pgf@picmaxy=\pgf@picmaxy%
   \let\yquant@pgf@x=\pgf@x%
   \let\yquant@pgf@y=\pgf@y%
   \let\yquant@pgf@pt@x=\pgf@pt@x%
   \let\yquant@pgf@pt@y=\pgf@pt@y%
   \let\yquant@pgfqpoint=\pgfqpoint%
   \let\yquant@coords=\empty%
   \let\pgfshapeclippath=\yquant@pgfshapeclippath@horz%
   \def\yquant@orientation@x{x}%
   \def\yquant@orientation@y{y}%
   \def\yquant@orientation@plus{+}%
   \def\yquant@orientation@minus{-}%
}

\protected\def\yquant@config@circuit@orientation@vertical{%
   \let\ifyquanthorz=\@secondoftwo%
   \tikzset{%
      % in principle, these are all /.forward to handlers, but we want them non-accumulative
      time radius/.code={\pgfkeys{/tikz/y radius={##1}}},%
      space radius/.code={\pgfkeys{/tikz/x radius={##1}}},%
      inner timesep/.code={\pgfkeys{/tikz/inner ysep={##1}}},%
      inner spacesep/.code={\pgfkeys{/tikz/inner xsep={##1}}},%
      outer timesep/.code={\pgfkeys{/tikz/outer ysep={##1}}},%
      outer spacesep/.code={\pgfkeys{/tikz/outer xsep={##1}}}%
   }%
   \def\yquant@config@register@minimum@height@default{2.5mm}%
   \def\yquant@config@register@minimum@depth@default{2.5mm}%
   \def\yquant@config@operator@minimum@width@default{3mm}%
   \let\yquant@pgf@picminx=\pgf@picminy%
   \let\yquant@pgf@picmaxx=\pgf@picmaxy%
   \let\yquant@pgf@picminy=\pgf@picminx%
   \let\yquant@pgf@picmaxy=\pgf@picmaxx%
   \let\yquant@pgf@x=\pgf@y%
   \let\yquant@pgf@y=\pgf@x%
   \let\yquant@pgf@pt@x=\pgf@pt@y%
   \let\yquant@pgf@pt@y=\pgf@pt@x%
   \def\yquant@pgfqpoint##1##2{\pgfqpoint{##2}{##1}}%
   \def\yquant@coords(##1,##2){({##2},{##1})}%
   \let\pgfshapeclippath=\yquant@pgfshapeclippath@vert%
   \def\yquant@orientation@x{y}%
   \def\yquant@orientation@y{x}%
   \def\yquant@orientation@plus{-}%
   \def\yquant@orientation@minus{+}%
}

\let\yquant@pgfshapeclippath@horz=\pgfshapeclippath
\let\yquant@pgfshapeclippath@vert=\pgfshapeclippath
\patchcmd\yquant@pgfshapeclippath@vert{%
   \global\let\pgfshapeclippathhorzresult=\pgfshapeclippathresult%
   \ifcsname pgf@sh@clipvert@\csname pgf@sh@ns@#1\endcsname\endcsname%
      % different clipping in vertical direction
      \pgfsyssoftpath@setcurrentpath\pgfutil@empty%
      \csname pgf@sh@clipvert@\csname pgf@sh@ns@#1\endcsname\endcsname%
      \pgfsyssoftpath@getcurrentpath\pgfshapeclippathresult%
      \pgfprocessround{\pgfshapeclippathresult}{\pgfshapeclippathresult}%
   \fi%
   \global\let\pgfshapeclippathvertresult=\pgfshapeclippathresult%
}{%
   \global\let\pgfshapeclippathvertresult=\pgfshapeclippathresult%
   \ifcsname pgf@sh@clipvert@\csname pgf@sh@ns@#1\endcsname\endcsname%
      % different clipping in vertical direction
      \pgfsyssoftpath@setcurrentpath\pgfutil@empty%
      \csname pgf@sh@clipvert@\csname pgf@sh@ns@#1\endcsname\endcsname%
      \pgfsyssoftpath@getcurrentpath\pgfshapeclippathresult%
      \pgfprocessround{\pgfshapeclippathresult}{\pgfshapeclippathresult}%
   \fi%
   \global\let\pgfshapeclippathhorzresult=\pgfshapeclippathresult%
}{}{%
   \PackageError{yquant.sty}{Unable to path \string\pgfshapeclippath}%
                {Vertical layout will not work.}%
}

\def\yquant@config@register@default@name{\regidx}
\let\yquant@config@register@default@lazyname=\empty
\def\yquant@config@register@minimum@height{\yquant@config@register@minimum@height@default}
\def\yquant@config@register@minimum@height@default{1.5mm}
\def\yquant@config@register@minimum@depth{\yquant@config@register@minimum@depth@default}
\def\yquant@config@register@minimum@depth@default{1.5mm}
\def\yquant@config@register@sep{1mm}
\def\yquant@config@operator@sep{1mm}
\def\yquant@config@operator@minimum@width{\yquant@config@operator@minimum@width@default}
\def\yquant@config@operator@minimum@width@default{5mm}
\newif\ifyquant@config@internal@multi@main%
\yquant@config@internal@multi@maintrue
\newif\ifyquant@config@operator@multi@warn
\yquant@config@operator@multi@warntrue
\newif\ifyquant@config@operator@position@rightalign
\newif\ifyquant@config@operator@position@advance
\yquant@config@operator@position@advancetrue
\newif\ifyquant@config@circuit@seamless
\def\yquant@config@operator@subcircuit@mangling{0}
\newif\ifyquant@config@operator@subcircuit@manglingreset
\yquant@config@operator@subcircuit@manglingresettrue
\newif\ifyquant@config@operator@multi
\newif\ifyquant@config@circuitsetup
\yquant@config@circuitsetuptrue
\yquant@config@circuit@orientation@horizontal
\newif\ifyquant@config@draw@quality
\yquant@config@draw@qualitytrue
\newif\ifyquant@config@requirelayers

\protected\def\yquant@config@operator@subcircuit@mangling@set#1{%
   \ifyquant@config@operator@subcircuit@manglingreset%
      \def\yquant@config@operator@subcircuit@mangling{#1}%
   \fi%
}