How can I position equation numbers to the left side? #3106
-
I try to use the place function, but the result is strange. When The function #let fixed-content-numbering(..nums) = {
return "(hello)"
}
#let left-side-numbering(align: left, ..nums) = {
place(align: align, "(hello)")
} For now, my workaround is to use move in combination with layout. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi, Your approach with setting the Instead, the best option is to recreate the equation in a show rule. We can turn off the default numbering and provide our custom output, like this: #show math.equation: eq => {
// apply custom style only to block equations with numbering enabled
if eq.block and eq.numbering != none {
// default numbering of the equation
let eqCounter = counter(math.equation).at(eq.location())
let eqNumbering = numbering(eq.numbering, ..eqCounter)
grid(
// change "0pt" to "auto" to give the numbering its own space on the line
columns: (0pt, 1fr),
align(left + horizon)[#eqNumbering],
// note that "numbering: none" avoids infinite recursion
math.equation(eq.body, block: true, numbering: none),
)
} else {
// default output for inline equations or without numbering
eq
}
} Interestingly, setting the text direction to right-to-left also seems to do the job, but this is a dangerous approach, because it could result in unexpected behaviour. #show math.equation: eq => {
set text(dir: rtl)
eq
} Reproduction URL: https://typst.app/project/r9ely_g1bPta8rV9ohR0r0 |
Beta Was this translation helpful? Give feedback.
As of typst 0.11.0, PR #3446, which provides
math.equation
with an argumentnumber-align
, has been merged.