Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Equation numbering other than none breaks bytefields #37

Open
sthagen opened this issue Jun 8, 2024 · 1 comment
Open

Equation numbering other than none breaks bytefields #37

sthagen opened this issue Jun 8, 2024 · 1 comment

Comments

@sthagen
Copy link

sthagen commented Jun 8, 2024

Thanks for this nice package. Much appreciated. I did not see in the documentation of bytefield that one should disable equation numbering for the bytefields. The alignment the implementation relies on breaks the display otherwise. The disablement approach works for me, but maybe a hint in the documentation or some change in implementation might help others too.

An example (not minimal, but using the official example):

#import "@preview/bytefield:0.0.6": *
== Bytefields

Bytefields seem to get squashed into mostly a vertical line and center text 
when `numbering` attribute of `math.equation()` is set e.g. to "(1)".

#set math.equation(block: false, numbering: "(1)")
// comment out the next line to see the example break with numbering of equations:
#set math.equation(block: false, numbering: none)

#bytefield(
// Config the header
bitheader(
"bytes",
// adds every multiple of 8 to the header.
0, [start], // number with label
5,
// number without label
12, [#text(14pt, fill: red, "test")],
23, [end_test],
24, [start_break],
36, [Fix], // will not be shown
angle: -50deg, // angle (default: -60deg)
text-size: 8pt, // length (default: global header_font_size or 9pt)
),
// Add data fields (bit, bits, byte, bytes) and notes
// A note always aligns on the same row as the start of the next data field.
note(left)[#text(16pt, fill: blue, font: "ITC Franklin Gothic Std", "Testing")],
bytes(3,fill: red.lighten(30%))[Test],
note(right)[#set text(9pt); #sym.arrow.l This field \ breaks into 2 rows.],
bytes(2)[Break],
note(left)[#set text(9pt); and continues \ here #sym.arrow],
bits(24,fill: green.lighten(30%))[Fill],
group(right,3)[spanning 3 rows],
bytes(12)[#set text(20pt); *Multi* Row],
note(left, bracket: true)[Flags],
bits(4)[#text(8pt)[reserved]],
flag[#text(8pt)[SYN]],
flag(fill: orange.lighten(60%))[#text(8pt)[ACK]],
flag[#text(8pt)[BOB]],
bits(25, fill: purple.lighten(60%))[Padding],
// padding(fill: purple.lighten(40%))[Padding],
bytes(2)[Next],
bytes(8, fill: yellow.lighten(60%))[Multi break],
note(right)[#emoji.checkmark Finish],
bytes(2)[_End_],
)

Thanks again for sharing the code.

PS: I tested using typst 0.11.1.

@jomaway
Copy link
Owner

jomaway commented Jun 9, 2024

Thanks for pointing this out. I will look into it and will add some note to the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants