Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7018633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:04:38+00:00 2026-05-27T23:04:38+00:00

RowSpacings allows one to change row spacings in a Grid. Help says: RowSpacings->{Subscript[s, 12],Subscript[s,

  • 0

RowSpacings allows one to change row spacings in a Grid.

Help says:

RowSpacings->{Subscript[s, 12],Subscript[s, 23],...} can be used to specify 
different spacings between different rows. If there are more rows than 
entries in this list, then the last element of the list is used repeatedly 
for the remaining rows

Notice, where it says the remaining rows above.

What I want is to make all starting rows use some spacing, but the last row to use different spacing.

This example does the documented way (the remaining rows)

n = 5;
data = Table[Random[], {n}, {n}];
Grid[data, Frame -> All, RowSpacings -> {6, 1}, Alignment -> Center]

enter image description here

But I wanted to do the reverse, i.e. set the last row to something, and all rows before it to another. Only way I could do it is the long way, i.e. by writing down all the spacings for all the rows until the last one:

n = 5;
data = Table[Random[], {n}, {n}];
Grid[data, Frame -> All, 
 RowSpacings -> {Sequence @@ Table[1, {n - 2}], 6},Alignment -> Center]

enter image description here

The above is just another way to write

Grid[data, Frame -> All, RowSpacings -> {1, 1, 1, 6}, Alignment -> Center]

I also tried things like

Grid[data, Frame -> All, RowSpacings -> {{1}, 6}, Alignment -> Center]
Grid[data, Frame -> All, RowSpacings -> {{1 ;; 3}, 6}, Alignment -> Center]

but they do not work. I could not find a short cut like in the first example above.

Any one knows a trick to tell RowSpacings to set only the last Row to some specific value, and all rows up to it to some other one, without the use of the above hack?

This is not a big deal really to do it as I did, I just was wondering if I am overlooking one of those trick syntax usage in Mathematica, that is all.

thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:04:39+00:00Added an answer on May 27, 2026 at 11:04 pm

    Assuming you don’t have other reasons to use RowSpacings + GridBox combination, using Spacings option for Grid

    Grid[data, Spacings -> {Automatic, Dimensions[data][[1]] -> 6}, 
         Frame -> All, Alignment -> Center]
    

    gives what you need.

    EDIT: More conveniently, Grid[data, Spacings -> {Automatic, -2-> 6}, Frame -> All, Alignment -> Center] where -2 refers to the second from last element of the row indices that go from 1 to 1+number of rows

    EDIT 2: Using GridBox, the following produces the same output:

    GridBox[data, RowLines -> True, ColumnLines -> True, 
      GridFrame -> True, RowAlignments -> Center, 
      ColumnAlignments -> Center, 
      GridBoxSpacings -> {"RowsIndexed" -> {-2 -> 6}}] //DisplayForm
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I apologise for the length of this question. My current Mathematica programming project involves

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.