Message Boards Message Boards

0
|
5371 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

How to display elements using Grid ?

Posted 9 years ago

I am making Sudoku Solver using Mathematica. This question is related to display Sudoke puzzle. My blog in Japanese is here.
This is an example of nested grids in Document Center.
Question 1

Grid[{{a, Grid[{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}], b}, {c, d, e}}, 
 ItemSize -> {3, 3}, Frame -> All, Spacings -> {1, 1}, 
 ItemStyle -> {Automatic, Automatic, {{1, 1} -> Directive[Red, 20, Bold], {1, 3} -> Directive[Green, 20, Bold], 
                    {2, 2} -> Directive[Blue, 20, Bold]}}]

enter image description here

Question 2

 Grid[{{a, x, b}, {c, d, e}}, ItemSize -> {3, 3}, Frame -> All, 
 Spacings -> {1, 1}, 
 ItemStyle -> {Automatic, 
   Automatic, {{1, 1} -> Directive[Red, 20, Bold], {1, 3} -> Directive[Green, 20, Bold], 
                      {2, 2} ->  Directive[Blue, 20, Bold]}}]

enter image description here

Would you give me a suggestion how to display elements using Gird ?

POSTED BY: Yoshihiro Sato
2 Replies
Posted 9 years ago

I learned how to set the font family in Grid.
Thank you

POSTED BY: Yoshihiro Sato

The following seems to work for your first question:

Grid[{{a, Grid[{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}], b}, {c, d, e}}, 
 ItemSize -> {3, 3}, Frame -> All, Spacings -> {1, 1}, 
 ItemStyle -> {"FontFamily" -> "Helvetica", 
   Automatic, {{1, 1} -> Directive[Red, 20, Bold], {1, 3} -> 
     Directive[Green, 20, Bold], {2, 2} -> 
     Directive[Blue, 20, Bold]}}]

I wonder why this other way the matrix gets mangled:

Grid[{{a, Grid[{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}], b}, {c, d, e}}, 
 ItemSize -> {3, 3}, Frame -> All, Spacings -> {1, 1}, 
 ItemStyle -> {Automatic, 
   Automatic, {{1, 1} -> Directive[Red, 20, Bold], {1, 3} -> 
     Directive[Green, 20, Bold], {2, 2} -> 
     Directive[Blue, 20, Bold]}}, 
 BaseStyle -> "FontFamily" -> "Helvetica"]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract