added doc for circuit, util and wire

This commit is contained in:
2024-05-17 09:36:38 +02:00
parent ef4461bd18
commit 7e0209b712
5 changed files with 99 additions and 0 deletions

View File

@ -1,3 +1,4 @@
/// Predefined color palette
#let colors = (
orange: rgb(245, 180, 147),
yellow: rgb(250, 225, 127),
@ -6,11 +7,24 @@
purple: rgb(189, 151, 255)
)
/// Pads a string on the left with 0s to the given length
///
/// #example(`#util.lpad("0100", 8)`, mode: "markup")
///
/// - s (str): The string to pad
/// - len (int): The target length
/// -> str
#let lpad(s, len) = {
let res = "0" * len + s
return res.slice(-len)
}
/// Returns the anchor on the opposite side of the given one
///
/// #example(`#util.opposite-anchor("west")`, mode: "markup")
///
/// - anchor (str): The input anchor
/// -> str
#let opposite-anchor(anchor) = {
return (
north: "south",
@ -25,6 +39,11 @@
).at(anchor)
}
/// Returns the anchor rotated 90 degrees clockwise relative to the given one
///
/// #example(`#util.rotate-anchor("west")`, mode: "markup")
/// - anchor (str): The anchor to rotate
/// -> str
#let rotate-anchor(anchor) = {
return (
north: "east",