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 6001195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:48:02+00:00 2026-05-23T00:48:02+00:00

TableForm with TableHeadings option is a quick and easy way to display good-looking classical

  • 0

TableForm with TableHeadings option is a quick and easy way to display good-looking classical table in Mathematica FrontEnd. The only problem is that it is common to display such a table with headings aligned to the left but the content of the table aligned to the right. Is it possible to force TableForm to behave in this way? Or if not, what is the best way to make an analog of TableForm that behaves in this way?

  • 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-23T00:48:03+00:00Added an answer on May 23, 2026 at 12:48 am

    It appears that one way to do this is:

    RawBoxes[ToBoxes[
       TableForm[RandomReal[{-10, 10}, {3, 3}], 
        TableHeadings -> {{"First left header", "Second left header", 
           "Trird left header"}, {"First top header", "Second top header",
            "Third top header"}}]] /. (ColumnAlignments -> _) -> 
       ColumnAlignments -> {Left, Right}]
    

    One can make such behavior permanent using Villegas-Gayley trick:

    Unprotect[TableForm];
    TableForm[args___] /; ! TrueQ@$inTableForm := 
     Block[{$inTableForm = True}, 
      RawBoxes[ToBoxes[TableForm[args]] /. (ColumnAlignments -> _) -> 
         ColumnAlignments -> {Left, Right}]]
    Protect[TableForm];
    

    Now

    TableForm[RandomReal[{-10, 10}, {3, 3}], 
     TableHeadings -> {{"First left header", "Second left header", 
        "Third left header"}, {"First top header", "Second top header", 
        "Third top header"}}]
    

    gives:

    Modified TableForm

    Another way is to define alternative function myTableForm:

    myTableForm[args___] := 
     RawBoxes[ToBoxes[TableForm[args]] /. (ColumnAlignments -> _) -> 
        ColumnAlignments -> {Left, {Right}}]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Quick question, looking for some recommendations. I have a site that will be requesting
I am facing a problem rendering a data table when selecting a date from
I have retrieve the Order table form database using hibernate criteria option. In my
i am simple cart page where it displays the content in table form and
I have generated a html table from my web application and save the table
I have a problem with the appointment form. When the form is filled in
I've the following table structure - Site: Master tablefor site Org: Master table for
I am implementing a simple drop-down using hiccup: ;DATASET/CREATE (defn get-cols-nms [table] This function
Having a slight problem on C#, still quite new to the language but hoping
I have the following Nested table (myinputmatrix = Table[Nest[function, myinputmatrix[[i]][[j]], myinputmatrix[[i]][[j]][[2]][[2]] + myinputmatrix[[i]][[j]][[3]][[2]]], {i,

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.