In the following table
table = Table[x*n, {x, 0, 20},
{n, 0, 5}];
TableForm[table, TableHeadings ->
{{"x=0", "1", "2", "3", "4",
"5", "6", "7", "8", "9", "10",
"11", "12", "13", "14", "15",
"16", "17", "18", "19", "20"},
{"n=0", "1", "2", "3", "4",
"5"}}]
I want to create two versions:
- With the headings in bold for each row where
x
is prime, - With the whole row in bold (including its heading) for each row where
x
is prime.
How do I accomplish these?
I want a computed result rather than simply formatting rows or headers manually, since I may want to change the size of the table later. I'm after a global solution...
Table[Style[x*n, If[PrimeQ[x], Bold, ## &[]]], {x, 0, 20}, {n, 0, 5}]
$\endgroup$