0
$\begingroup$

I'm doing a simple multiplication table and I have this that I'm having a hard time with. I imagine that there must be a shorter way to do it, what I can't get is that it paints black the first column on the left and the main diagonal where the squares of the numbers are. help me a little

Insert[Insert[
Grid[Table[i*j, {i, 1, 10}, {j, 1, 10}]], {Dividers -> All, 
Spacings -> 1.5 {1, 1}}, 
 2]                                   , {Background -> {None, 
 { GrayLevel[0.7], {White}}}, Dividers -> {Black, {All -> Black}}, 
Frame -> True, Spacings -> {3, {3, {0.7}, 3}}}, 3]
$\endgroup$
2
$\begingroup$
Clear["Global`*"]

Grid[
 Table[i*j, {i, 1, 10}, {j, 1, 10}],
 Frame -> All, 
 Background -> {{1 -> LightGray}, 
   None, ({#, #} -> LightGray & /@ Range[10])}]

enter image description here

Or perhaps

Grid[
 Table[i*j, {i, 1, 10}, {j, 1, 10}],
 Frame -> All, 
 Background -> {{1 -> LightGray}, {1 -> 
     LightGray}, ({#, #} -> LightBlue & /@ Range[10])}]

enter image description here

$\endgroup$
0
$\begingroup$

Somewhat simpler would be to use TableForm. One possibility:

TableForm[Table[i*j, {i, 2, 10}, {j, 2, 10}], TableHeadings -> {Range[10], Range[10]}]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.