0

Extending on the brilliant (!!!) solution provided by muzimuzhi Z here: https://tex.stackexchange.com/a/543860/305561,:

  1. could we have a capability to ignore empty/non-numeric cells in a column, and leave them with the default white background? (Having empty cells in the latex answer/code provided leads to compilation error, something e.g. "Package color Error: Argument 1.01212 not in range [0,1].", as the empty cells gets treated as a value=0).

A. One solution that works is to mark every empty cell as \multicolumn{1}{l}{} or a cell to be ignored as \multicolumn{1}{l}{text to be ignored}. But this is tedious, and I wonder if there is a latex script to ignore empty/non-numeric cells automatically.

  1. could we determine min and max values in a column automatically to determine color scaling? i.e. instead of explicitly stating P{-0.0015}{0.003} as in the answer provided in the link above, i.e. could we have an automatic P{\auto_evaluated_min_in_column}{\auto_evaluated_max_in_column}?
  • Answer to question 1 is quite simple: just wrap the definition of \colorfromval (except for the last line \tablenum[#3]{#4}) in \ifstrempty{#4}{}{<original definition>}. (I just added a revised example in my previous answer.) As for question 2, first a second compilation is required if still using tabular environment, then currently I don't know how to get a distinct naming per P column (to store the min/max value to aux file). Maybe it's easier with tabularray, a recent tabular package. – muzimuzhi Z Oct 08 '23 at 14:06

0 Answers0