# Centering a Grid between page margins

**URL:** <https://community.wolfram.com/t/centering-a-grid-between-page-margins/2833>\
**Category:** Questions\
**Tags:** authoring-and-publishing, mathematica, computational-notebooks, ui-ux-and-ide\
**Created:** [August 1, 2014, 5:00am UTC](https://community.wolfram.com/t/centering-a-grid-between-page-margins/2833 "2014-08-01T05:00:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gcrlsn](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/gcrlsn/32/8283_2.png) [@gcrlsn](https://community.wolfram.com/u/gcrlsn)\
**Post date:** [August 1, 2014, 5:00am UTC](https://community.wolfram.com/t/centering-a-grid-between-page-margins/2833/1 "2014-08-01T05:00:45Z")

</div>

I have several sets of data that I want to display in columnar form. Each set of data is in a Table and will display with different number of columns.

Is there an easy way to center each set of data so it appears centered between the page margins?

So far, I display each set using something like Grid Grid Table… The inner Grid creates the columnar form, and the outer Grid displays the column form in the center position. I end up with something like this:

 ![8669Image2.png](https://global.discourse-cdn.com/wolfram/original/3X/7/7/771176a65111bfaca702a8cfaee8b8ca7fc67c82.png)

But even this requires that I manually size the Spacings of the outer Grid. I’d rather avoid the outer Grid and just center the columnar form between the page margins.

Thanks for any suggestions.

---

<div class="post-metadata">

**Author:** ![gcrlsn](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/gcrlsn/32/8283_2.png) [@gcrlsn](https://community.wolfram.com/u/gcrlsn)\
**Post date:** [August 2, 2014, 4:16am UTC](https://community.wolfram.com/t/centering-a-grid-between-page-margins/2833/2 "2014-08-02T04:16:12Z")

</div>

I’m still looking for a way to do this with one Grid, but a partial solution is to use ItemSize to avoid manually sizing Spacings in outer Grid.

```
(* Eight data triplets *)
data1 := {{0, -2, 14632971213167*^-14}, {0, -1, -84548187169114*^-14}, 
          {0, 0, -37563603672040*^-13}, {0, 1, 33855169168385*^-13}, 
          {0, 2, -95791963387872*^-14}, {0, 3, 15772038513228*^-14}, 
          {0, 4, -16616417199501*^-15}, {0, 5, 81214629983568*^-17}}

(* Create a table of the data w/ header row *)
tbl01 := Prepend[
  Table[{i, data1[[i]][[1]], data1[[i]][[2]], 
    NumberForm[N[data1[[i]][[3]], 14], 14, 
     ExponentFunction -> (If[(# + 1) == 0, "", (# + 1)] &), 
     DigitBlock -> 3, 
     NumberSeparator -> "[ThickSpace][ThickSpace]"], i + 4, 
    data1[[i + 4]][[1]], data1[[i + 4]][[2]], 
    NumberForm[N[data1[[i + 4]][[3]], 14], 14, 
     ExponentFunction -> (If[(# + 1) == 0, "", (# + 1)] &), 
     DigitBlock -> 3, 
     NumberSeparator -> "[ThickSpace][ThickSpace]"]}, {i, 
    4}], {Item["i", Alignment -> Center], 
   Item["!(*SubscriptBox[(I), (i)])", Alignment -> Center], 
   Item["!(*SubscriptBox[(J), (i)])", Alignment -> Center], 
   Item["!(*SubscriptBox[(n), (i)])", Alignment -> Center], 
   Item["i", Alignment -> Center], 
   Item["!(*SubscriptBox[(I), (i)])", Alignment -> Center], 
   Item["!(*SubscriptBox[(J), (i)])", Alignment -> Center], 
   Item["!(*SubscriptBox[(n), (i)])", Alignment -> Center]}]

(* Display the data as a grid *)
tbl02 = Grid[tbl01, Alignment -> {{{Center, Right, Right, "."}}}, 
  Spacings -> {{0, 1, 1, 1, 3, 1, 1, 1}, Automatic}, 
  ItemStyle -> {Directive[FontFamily -> "Times", 
     FontSize -> 14], {Italic}}, 
  Dividers -> {None, {1 -> Directive[Thickness[1]], 2 -> True, 
     6 -> True}}]

(* Center between margins by displaying as a grid in a grid *)
Grid[{{tbl02}}, ItemSize -> Scaled[1.0]]

```

The result is

 ![Image1.png](https://global.discourse-cdn.com/wolfram/original/3X/6/5/6537a43defe03dbba71f356b70e3a300603c48fc.png)
