# Can better support be added for creating tables, for science?

When writing an answer like the one here, I felt the need to create tables to display summarized data. Since I believe we are a site that encourages users to provide detailed data whenever possible, I was surprised to find after discussing with several folks that there is no easy way to create a searchable, consistently formatted, visually attractive table. The options that I am aware of are:

• Create table in another program, then screen capture and post the image.
• This option is not searchable, and will also likely produce many different visual looks. You can see I screen cap'd simple html formatted tables, but I could have easily screen cap'd an excel spreadsheet, or output from another similar program.
• Indent four spaces and use a the monospace font to make a text table.
• I originally took this to be the best, if somewhat tedious solution, since it is fully searchable. I quickly found that a table that easily fits with html formatting was far too wide to fit with the default monospaced font. So I could either greatly alter the data in my table to fit within space constraints, or go the image route - which is what I did.

Is there another solution I'm not aware of? If not, do others agree that this feature would be valuable (and ultimately can it be added)?

• MSO questions meta.stackexchange.com/questions/73566/… and meta.stackexchange.com/questions/5255/… are relevant. For a definitive no, see Jeff's meta.stackexchange.com/questions/1777/…. That said, +1! – Ian Pugsley Apr 4 '12 at 13:43
• Tables are a mess honestly, I don't begrudge them for not including it. Images of tables are probably the best we can do now, include important SEO info outside of the table – Ben Brocka Apr 4 '12 at 13:45
• This is helpful for ASCII tables: sensefulsolutions.com/2010/10/format-text-as-table.html – LessPop_MoreFizz Apr 4 '12 at 14:03
• From personal experience, tables being hard to make may translate into rep if you rise to the challenge! :P – Matthew Read Apr 4 '12 at 19:52
• @BenBrocka how exactly are tables a mess? I know some people have an irrational dislike of tables due to the way they were used for markup, which was a mess, but there's nothing wrong with using tables to present information that needs a table. – kotekzot Apr 5 '12 at 7:42
• @kotekzot There's no markdown for tables so it would require explicit HTML support or some horrific cludge, and HTML table support is a very dangerous thing to give users, lots of ways tables can break or uglify things. It would require some major HTML parsing to verify tables are entered properly – Ben Brocka Apr 5 '12 at 14:05
• @BenBrocka most HTML tags, when poorly implemented, could cause problems. I'm sure some good folks at SO would throw together a user-inputted table parser in SE's language of choice. As I see it, once properly implemented, the HTML solution would beat all the other solutions hands down, as preformatted ASCII art fails on smaller screens, and image tables fail in too many ways to enumerate in a comment (I'll just mention horrible support for editing, discoverability, poor SEO and bandwidth concerns). Add overflow:auto to your table and you've eliminated all width and height concerns. – kotekzot Apr 5 '12 at 16:23
• To be clear, I'm not married to the HTML table implementation. I'm looking for "table the format" not "table the HTML tag". In my incredibly unimpressive history of web design I have used <div> and CSS for "table-like" functionality. I am but a padawan, but I figured there must be some geniuses in the greater stack community that could tackle the problem. Or perhaps that assumption just shows my ignorance of web design :). – EBongo Apr 6 '12 at 4:17
• I would love to see an SE markup like >| where the | can be used to mark columns. Though maybe we'd need to use different syntax so as to not break existing tables with that format... – LoveAndCoding Apr 7 '12 at 2:33

You can make a table, then select it all, and go to Insert, Chart, and on the Charts tab, select More (at the bottom), then pick the bottom option, the Table style. This will drop the chart (table) onto the worksheet that you can resize to get rid of some whitespace and make it so the columns/rows don't look strange.

Then, in the options menu (top right corner when mousing over the chart), go to Publish chart, select Image for the publish format. SE supports the <img> tag, so you can just copy-paste that into a post.

Not necessary, but as an extra; especially for math-y tables, link the spreadsheet. Share the document with the internet (Anyone with the link), then hyperlink the image back to the worksheet.

That's what I did for this post, and it looks half-decent:

In case you were interested in the cumulative costs:

[The source image is too wide, so it's a little crushed]

Rather than starting with a Chipped gem, here are cumulative costs starting with Flawless Squares (the highest rank gem that drops):

I think because I linked to the source spreadsheet (read-only), someone else can copy it to their own Docs collection and edit it if they so choose.

• Perhaps a workaround, but a very very good workaround. Awesome answer, thank you. – EBongo Jun 6 '12 at 2:35
• I'd like to note that the result is an image and not a text, so textual searches will not be able to find it. – Oak Jun 6 '12 at 7:18
• @Oak how often does that matter? 1) presumably searches would get better hits on the question, 2) most answers benefit from a little prose anyways (or they're poor/the question is trivial), 3) isolated cells inside a table lacking context aren't terribly searchable. For the above example, the only "loss" of functionality I could envision is someone searching "581104000 gems" on Google. – Nick T Jun 6 '12 at 7:25
• Maybe it's not that bad, but I do think it's certainly noteworthy, which is why I added a comment starting with "I'd like to note" :) as someone who does a lot of data mining - including mining information from stackoverflow for academic purposes - I always prefer text to images when possible. But I agree I don't find it to be of critical importance. – Oak Jun 6 '12 at 7:34
• If the spreadsheet is published read/write, will updating the sheet update the image? Could be important if stuff needs editing (the linked question, for instance, after 1.0.3 is applied). – MBraedley Jun 6 '12 at 11:37
• Also, I realize that means that edits could go unchecked. Which just goes to show we need native table making ability. – MBraedley Jun 6 '12 at 11:44
• @MBraedley yes, changes to the source updates the chart/table. You could force yourself to "update" the post if instead of hotlinking to the published image you save and upload it. – Nick T Jun 6 '12 at 22:36

The method I make use of is generating tables through this website, where you can easily create the markup needed for okay-looking tables in markdown. This takes care of the tediousness, at least.

Using the example from that page, it will show up like this after adding <pre> tags:

| Tables   |      Are      |  Cool |
|----------|:-------------:|------:|
| col 1 is |  left-aligned | $1600 | | col 2 is | centered |$12 |
| col 3 is | right-aligned |    \$1 |


It's a little more practical that the information is manipulable, and can be edited on the fly. It's also easier to copy, for later reference. And it can be searched, as the OP mentioned.

It still looks like the 1980's, though (which is indubitably not a bad thing).

Copying parts of my answer from our feature request prioritisation thread as it's relevant here:

Some sites have access to the MathJax extension, and can use it's table formatting. Here's an example from RPG.SE:

But, MathJax markdown is clunky, and from a many reports, sites that use it suffer a performance hit. Enabling the entire library for tables (and maybe the occasional equation) would be overkill for our use case. MathJax is primarily built to be a formatting library for scientific/math purposes, that just so happens to support rendering tables because that's a common use case in the math world.

So if SE is going to do this, they should do it right. Rather than enabling MathJax here, SE should add markdown support for tables in the manner described by the Markdown Extended Syntax: