-
-
Notifications
You must be signed in to change notification settings - Fork 873
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
Align numbers at dot within table columns #170
Comments
I would just right align: #set text(font: "Segoe UI")
#table(
align: right,
columns: 2,
[*category*], [*cost*],
[widgets], [#"42.00"],
[gadgets], [#"1.10"],
[thingies], [#"890.00"]
) or you could do something like this: align: (col, row) => if col == 1 and row >= 1 { right } else { center }, if you really want to nitpick, you can also mess with pad: |
Ideally also an arbitrary alignment mark \begin{align}
2x - 5y &= 8 \\
3x 9y &= 4
\end{align} |
I think this should be a built-in feature. It's fairly common in some end-uses to have differing numbers of digits both before and after the point, as you move down the columns of characteristics from, say, small to large product models. In certain page layout apps I'd just centre align then pad the whole column with figure-width spaces, assuming a font with fixed-width digits/decimal point. But a built-in markup for decimal (or arbitrary character) alignment makes things easier. As indeed do figure spaces. |
I think, by default, the decimal delimiter that's used for alignment should depend on the context language. Also, it should be compatible with existing cell alignments:
Non-number symbols should be aligned on their own axis. Not sure how to handle " " and "-". Maybe that should be configurable:
|
That's good up to a point, but locale isn't the motive for all cases. As an
example, I recently set a table with number ranges, where the range symbol
(an en dash) was the alignment character. In other cases it's been a space,
or part of a unit of measurement, etc... By all means default to locales,
but please don't set locales up as a limiting factor for all alignment
cases - better an "align on this character" option, which can override
defaults when required.
…On Sat, 24 Aug 2024, 15:38 luewolf, ***@***.***> wrote:
I think, by default, the decimal delimiter that's used for alignment
should depend on the context language.
Also, it should be compatible with existing cell alignments:
|left num | center num | right num|
|_____________|_____________|_____________|
|100.359 | 100.359 | 100.359|
| 99.23 | 99.23 | 99.23 |
| 21.445 | 21.445 | 21.445|
Non-number symbols should be aligned on their own axis. Not sure how to
handle " " and "-". Maybe that should be configurable:
| prefix| suffix| sign?|
|_____________|_____________|___________________________|
| > 100.359| 100.359 mm| -100.359| -100.359|
| ≥ 99.23 | 99.23 µm| -99.23 | - 99.23 |
| ~ 21.445| 21.445 nm| -21.445| - 21.445|
—
Reply to this email directly, view it on GitHub
<#170 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACJ2AX77YM53KZFKILPNL3TZTCLHNAVCNFSM6AAAAABNBUWUR2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBYGQYTMMRWGA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Hi. I have a spreadsheet-like report that looks like
I would like to align the numbers so the periods are vertically aligned.
This seems perhaps possible already, but not simple. Something like a loop and manually calculating max width over of both sides of the period-split number, and then a for loop, etc..
The text was updated successfully, but these errors were encountered: