6
$\begingroup$

I have a list of words (strings) same as

list = {"resident",  "occupant",  "tenant",  "resider",  "inhabiter",  "habitant",  "dweller",  "citizen",  "native",  "denizen",  "aborigine"};

with 11 elements.

I want to insert them in a 4*3 table with an empty cell (of course) with the below syntax

grid = Grid[Partition[list, 4], Dividers -> All] // Text

But my command is not correct how can I modify this command?

$\endgroup$

3 Answers 3

10
$\begingroup$

Use UpTo

list =
  {"resident", "occupant", "tenant", "resider", "inhabiter", 
   "habitant", "dweller", "citizen", "native", "denizen", 
   "aborigine"};

Grid[Partition[list, UpTo @ 4], Dividers -> All]

enter image description here

$\endgroup$
5
$\begingroup$

Use Multicolumn

Multicolumn[list, 4, Dividers -> All]

table

or

Multicolumn[list, 4, Dividers -> All, Appearance -> "Horizontal" ]

table2

$\endgroup$
3
$\begingroup$

Use TableView and Framed:

f = TableView[#, AllowedDimensions -> Reverse@Dimensions@#, 
    AppearanceElements -> {"Frame"}] &;

Framed[f@Partition[Append[list, ""], 4], 
FrameStyle -> {AbsoluteThickness[3], Red}, FrameMargins -> None]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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