How can I fix the different alignments of negativ numbers in a table?

Hello everyone,
I have some specific problem. The problem is that the negative numbers and fraction in my table has a different vertical orientation as the positive numbers.
I dont understand why.
I ask some AIs and try something like $ minus 1$ instead of $-1$ or a horizontal and center align. But nothing has solved the problem
When I dont use the mathematical case with $...$ than the numbers in the right orientation but thats only an okay solution by simple digits like -1 but not by fraction.
Thats also the reason why I dont bold the second row. Then if I do that, the orientation is also wrong.
I hope someone can help me or have some other ideas that I can try
thanks

My code is

#table(
  
  stroke: 0.5pt,
  align: (center,horizon),
  columns:(auto,auto,auto,auto,auto,auto,auto,auto,auto,auto,auto,auto),
  [], [*0°*], [*30°*], [*45°*], [*60°*], [*90°*], [*120°*], [*135°*], [*150°*], [*180°*], [*270°*], [*360°*],
  
  [], [$0$], [$pi/6$], [$pi/4$], [$pi/3$], [$pi/2$], [$2pi/3$], [$3pi/4$], [$5pi/6$], [$pi$], [$3pi/2$], [$2pi$],
  
  [*sin*], [$0$], [$1/2$], [$sqrt(2)/2$], [$sqrt(3)/2$], [$1$], [$sqrt(3)/2$], [$sqrt(2)/2$], [$1/2$], [$0$], [-1], [$0$],
  
  [*cos*], [$1$], [$sqrt(3)/2$], [$sqrt(2)/2$], [$1/2$], [$0$], [$-1/2$], [$-sqrt(2)/2$], [$-sqrt(3)/2$], [-1], [$0$], [$1$],
  
  [*tan*], [$0$], [$1/sqrt(3)$], [$1$], [$sqrt(3)$], [$∞$], [$-sqrt(3)$], [$-1$], [$-1/sqrt(3)$], [$0$], [$∞$], [$0$],
)
])

and it looks like this

Dear @kasekuchen ,

Welcome to the forum.

It would be much appreciated if you follow the guidance on posting code while asking for some assistance.

This will help us read your code better in order to help you.

Please read through How to post in the Questions category and update your post:

Regarding your issue, your code does not compile. And therefore it can hardly reproduce the issue you are describing. Could you please post a minimum working example (MWE)?

Also please indicate exactly what seems to be the issue and maybe post a visual representation of what you would be expecting?

1 Like

From what I understood you may have wanted to do this:


#table(
stroke: 0.5pt,
//align: (center,horizon),
align: (center+horizon),
columns:(auto,)*12,
[], [0°], [30°], [45°], [60°], [90°], [120°], [135°], [150°], [180°], [270°], [360°],

[], [$0$], [$pi/6$], [$pi/4$], [$pi/3$], [$pi/2$], [$2pi/3$], [$3pi/4$], [$5pi/6$], [$pi$], [$3pi/2$], [$2pi$],

[sin], [$0$], [$1/2$], [$sqrt(2)/2$], [$sqrt(3)/2$], [$1$], [$sqrt(3)/2$], [$sqrt(2)/2$], [$1/2$], [$0$], [-1], [$0$],

[cos], [$1$], [$sqrt(3)/2$], [$sqrt(2)/2$], [$1/2$], [$0$], [$-1/2$], [$-sqrt(2)/2$], [$-sqrt(3)/2$], [-1], [$0$], [$1$],

[tan], [$0$], [$1/sqrt(3)$], [$1$], [$sqrt(3)$], [$∞$], [$-sqrt(3)$], [$-1$], [$-1/sqrt(3)$], [$0$], [$∞$], [$0$],
)

The culprit causing misalignment: align: (center+horizon),

See Align Function – Typst Documentation

Combining alignments

You can combine two alignments with the + operator.

2 Likes
#{
  show table.cell.where(y: 0): strong
  show table.cell.where(x: 0): strong
  table(
    columns: 12,
    align: center + horizon,
    stroke: 0.5pt,
    inset: 0.6em,
    [], ..(0, 30, 45, 60, 90, 120, 135, 150, 180, 270, 360).map(num => $num degree$),
    [], $0$, $pi/6$, $pi/4$, $pi/3$, $pi/2$, $2 pi/3$, $3 pi/4$, $5 pi/6$, $pi$, $3 pi/2$, $2 pi$,
    $sin$, $0$, $1/2$, $sqrt(2)/2$, $sqrt(3)/2$, $1$, $sqrt(3)/2$, $sqrt(2)/2$, $1/2$, $0$, $-1$, $0$,
    $cos$, $1$, $sqrt(3)/2$, $sqrt(2)/2$, $1/2$, $0$, $-1/2$, $-sqrt(2)/2$, $-sqrt(3)/2$, $-1$, $0$, $1$,
    $tan$, $0$, $1/sqrt(3)$, $1$, $sqrt(3)$, $oo$, $-sqrt(3)$, $-1$, $-1/sqrt(3)$, $0$, $oo$, $0$,
  )
}

1 Like