Here are two approaches, just a bit creative (opposite of useful?). The first one is the one I’d do in school (took some effort to remember) and the second and third are the way you set it up.
I think the short syntax with replacement letters is great for a one off, but it doesn’t scale ultimately, it’s just cute.
#[
// being very creative with our own syntax
#let mkrow(text) = text.split("").filter(elt => elt != "").map(elt => $#elt$)
#show "-": math.minus
#show "X": text(size: 0.6em, math.underline[10])
#let smashit(x) = box(width: 0pt, $ script(#x) $)
#show "Y": $attach(cancel(4), tl: smashit(text(size: #0.8em, 3)))$
#table(
inset: (y: 0.3em, x: 0.05em),
align: right,
stroke: none,
columns: 6,
..mkrow(" X "),
..mkrow(" 1Y,01"),
..mkrow("- 3,50"),
table.hline(stroke: 1pt),
..mkrow(" 10,51"),
)
#show "Z": $attach(0, bl: 1)$
#show "I": text(size: 0.8em, [1])
#table(
inset: (y: 0.3em, x: 0.05em),
align: right,
stroke: none,
columns: 6,
..mkrow(" 14,Z1"),
..mkrow("- 3,50"),
..mkrow(" I "),
table.hline(stroke: 1pt),
..mkrow(" 10,51"),
)
]
#[
// slightly more verbose but good if we want to have
// more regular syntax and functions
#import "@preview/rowmantic:0.2.0": rowtable
#let s1 = $text(size: #0.6em, 1)$ // s1: small one
#rowtable(
inset: (y: 0.3em, x: 0.05em),
align: right,
stroke: none,
separator: ",",
$,1,4,.,s1 0,1$,
$-,,3,., 5,0$,
$ ,,s1, $,
table.hline(stroke: 1pt),
$,1,0,., 5,1$,
)
]
Ultimately going back to @nleanba’s smart answer and using the smash function, it’s almost working out. But we kind of want table alignment here…
#let smashit(x) = box(width: 0pt, $ script(#x) $)
$
14. med smashit(1 med)01 &\
- space.fig 3.med 50 &\
space.fig s1 space.fig space.fig space.fig &\
#line(length: 3em) &\
10. med 51 &\
$