tably icon indicating copy to clipboard operation
tably copied to clipboard

[Suggestion] Option to align deciamal places

Open legendre6891 opened this issue 8 years ago • 2 comments

Could you add an option a column that aligns decimal places? This is fairly common in social sciences.

See: https://tex.stackexchange.com/questions/2746/aligning-numbers-by-decimal-points-in-table-columns

It would be nice if tably could automatically figure out:

  1. The number of places before the decimal point, i.e., the maximal number column.
  2. The number of places after the decimal point, i.e., the maximal number in a particular column.

That way, [table-format=3.2] doesn't have to be specified manually.

In addition, it would be nice if it can handle the 'header column' and automatically wrap the contents around braces to prevent aligning the decimal point. The comment at the TeX.SX link above provides the context:

in response to a comment by daniel kullmann Nov 15 '11 at 10:31 The official way of getting siunitx to ignore bits of text, like headers, is to just wrap them in braces; i.e. {name} will work just as well as \multicolumn{1}{c}{name}. See for instance tex.stackexchange.com/questions/3709/… (would still like newbies to be able to post comments!) – Sam Mason Sep 23 '12 at 17:41

legendre6891 avatar Oct 09 '17 18:10 legendre6891

Could you add an option a column that aligns decimal places?

Thank you for the suggestion! I'll see what I can do.

It would be nice if tably could automatically figure out (...) That way, [table-format=3.2] doesn't have to be specified manually.

I'm thinking maybe an option to specify it manually (something like -d 3.2) might be useful in cases where you want to have the control in your hands (e.g. specify more places before the decimal point than the biggest number has).

Thoughts?

narimiran avatar Oct 10 '17 06:10 narimiran

Yes, on further thought, it actually would make more sense for the [table-format=#.#] to be specified manually. The idea is that the CSV file is generated by some external program (e.g., MATLAB) and its numbers have many decimal places. Then, specifying -d 3.2 allows the user to choose how many in the decimal places there should be.

Though, when specifying -d 3.2, it would make sense for tably to directly truncate the output LaTeX source output as well, e.g. using print()'s format specifiers.

Thoughts?

legendre6891 avatar Oct 10 '17 06:10 legendre6891