I was wondering if it's possible to colour a column or a row in a matrix.
For example is it possible to add colour for one of the rows/columns of the following matrixform code?
MatrixForm[{{n, -1 + n, -2 + n, ⋯, 1}, {2 n, 2 n - 1,
2 n - 2, ⋯, n + 1}, {3 n, 3 n - 1, 3 n - 2, ⋯,
2 n + 1}, {⋮, ⋮, ⋮, ⋱, ⋮}, {n^2, -1 + n^2, -2 + n^2,⋯, HoldForm[(n - 1) n + 1]}}]
I would appreciate any help or suggestion.
EDIT: For example what if we want to colour only one column in the following matrix?
Rasterize@
Style[MatrixForm[{{n, -1 + n, -2 + n, ⋯, 1}, {2 n, 2 n - 1,
2 n - 2, ⋯, n + 1}, {3 n, 3 n - 1, 3 n - 2, ⋯,
2 n + 1}, {⋮, ⋮, ⋮, ⋱, ⋮}, {n^2, -1 + n^2, -2 + n^2,⋯, HoldForm[(n - 1) n + 1]}},
TableAlignments -> {Center, Center}] // TraditionalForm,
Background -> LightBlue, FontFamily -> Times, 30]
EDIT: Thanks to @Kuba, @E.Doroskevic and @Mr. Wizard I managed to get the following matrix:
Grid[Table[{{1, 2, 3, ⋯, 10}, {2, 3, 4, ⋯, 11}, {3, 4, 5, ⋯, 12},
{⋮, ⋮, ⋮, ⋱, ⋮}, {10, 11, 12, ⋯, 20}}], Background ->{{LightBlue},None},
ItemStyle -> {{Red, Blue, Green, Black}}, ItemSize -> {5, 5}]
Also how can I present the above as a matrix with parentheses or square brackets?
I have tried \\MatrixForm
but it didn't work.
MapIndexed[]
to applyStyle[]
to any particular row, column, or entry. $\endgroup$ – J. M.'s ennui♦ Nov 26 '15 at 14:41Background
option which quite wide documentation. Take a look there. $\endgroup$ – Kuba♦ Nov 26 '15 at 15:31