From 9ee2fdde8dc3a7ca68ccec1cf0eabfca2e367830 Mon Sep 17 00:00:00 2001 From: Mc-Zen Date: Sun, 31 Mar 2024 12:54:38 +0200 Subject: [PATCH] [fix] equation numbering with circuits When equation numbering is turned on, display-style braces as used with lstick, rstick and gate inputs/outputs, are not drawn correctly. We could use non-block math but then the bounding box of the rectangles is not measured correctly. Instead we just turn equation numbering off for the entire circuit. fixes #3 --- src/draw-functions.typ | 13 +++++++------ src/quill.typ | 3 ++- tests/decorations/lstick rstick/ref/6.png | Bin 0 -> 472 bytes tests/decorations/lstick rstick/test.typ | 10 +++++++++- 4 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 tests/decorations/lstick rstick/ref/6.png diff --git a/src/draw-functions.typ b/src/draw-functions.typ index 510fe0c..e4f0c65 100644 --- a/src/draw-functions.typ +++ b/src/draw-functions.typ @@ -8,14 +8,15 @@ -// create a sized brace with given length. +// Creates a sized brace with given length. // `brace` can be auto, defaulting to "{" if alignment is right -// and "}" if alignment is left. +// and "}" if alignment is left. Other possible values are +// "[", "]", "|", "{", and "}". #let create-brace(brace, alignment, length) = { - let brace-symbol = if brace == auto { - if alignment == right {"{"} else {"}"} - } else { brace } - return $ lr(#brace-symbol#block(height: length)) $ + if brace == auto { + brace = if alignment == right {"{"} else {"}"} + } + return $ lr(#brace, size: length) $ } diff --git a/src/quill.typ b/src/quill.typ index dd836c4..57273fc 100644 --- a/src/quill.typ +++ b/src/quill.typ @@ -71,7 +71,8 @@ panic("Unexpected named argument '" + children.named().keys().at(0) + "' for quantum-circuit()") } set text(color, size: font-size) - + set math.equation(numbering: none) + style(styles => { // Parameter object to pass to draw-function containing current style info diff --git a/tests/decorations/lstick rstick/ref/6.png b/tests/decorations/lstick rstick/ref/6.png new file mode 100644 index 0000000000000000000000000000000000000000..a603322b42cc53a6b2be20cf209b80aae97368e1 GIT binary patch literal 472 zcmV;}0Vn>6P)&mi0004>NklCdKTw!Q=vC-P6IZ~7gL^*^^OTm`bK+Nf{3T?vrr z)dUi^)G<{2;n$_e^m|O(fvgJ*CxE2QQFImi8R{uAeLBMhAnO&_lsTzr3jX;BKcvX? zdWKs-))$5(Ao)r18;bmgG_Jk>DKb5i;XaV{lfe%p5VsgvdLF+Y%;o1Du!DR8rpGdX zO!&dz3JzvxWa;an;uE2T`~7V_*w*;`Fi4J!T1I8l!QeYI^GJTDy6FfoJ>x$OO*cP5L({KnQMYbdj?%b2 zzh#)UI4pU-)6n!~46A8q`fn@6Cp7HYeDhP7@`Z-|rc-&Xqdm%zX*vLVto!4UU}1a! O0000