How can I write tables on Socratic?

3 Answers

Ideas on matrix, spacing, and fractional ways to make a table

Explanation:

Let's say I have some points I want to graph and I want to present them in a table format. I'll have a column for #x# values and another for #y# values.

There are a couple of ways to do it:

  • use matrix formatting

This is the method I prefer to use. Here I use the format:

hashtag ( ( x, y), (1, 5), (2, 4) ) hashtag

This will return

#( ( x, y), (1, 5), (2, 4) ) #

With this I can now also use things like vertical dots (vdots), diagonal dots (ddots), white space to hold open a particular cell, etc.

A sample of what I've used it for is a table showing the list of possible die rolls using 2 standard dice:

#((color(white)(0),ul1,ul2,ul3,ul4,ul5,ul6),(1|,2,3,4,5,6,7),(2|,3,4,5,6,7,8),(3|,4,5,6,7,8,9),(4|,5,6,7,8,9,10),(5|,6,7,8,9,10,11),(6|,7,8,9,10,11,12))#

  • use spacing and white space

Alignment of cells is, in my opinion, harder with this method, but it can be done.

I can do something like this:

hashtag color(white)(00000) x color(white)(00000) y hashtag
hashtag color(white)(00000) 1 color(white)(00000) 5 hashtag
hashtag color(white)(00000) 2 color(white)(00000) 4 hashtag

and it will return:

# color(white)(00000) x color(white)(00000) y #
# color(white)(00000) 1 color(white)(00000) 5 #
# color(white)(00000) 2 color(white)(00000) 4 #

  • use fractional formatting

I'm not sure of the usefulness in making a larger table, but for something small it could work.

I can write something like:

hashtag color(white)00000color(black) x/color(black)1 00000 color(black) y/color(black)5 hashtag
hashtag color(white)00000color(black) 2/1 00000 color(black) 4/5 hashtag

which will return:

# color(white)(00000color(black) x/color(black)1 00000 color(black) y/color(black)5 )#
# color(white)(00000color(black) 2/2 00000 color(black) 4/5 )#

May 11, 2017

Other examples include...

Explanation:

You can play around a bit with the matrix design to get really cool tables.

For example, using the matrix Parzival used in his answer

  • without hashtags

( (color(white)(0),ul1,ul2,ul3,ul4,ul5,ul6),(1|,2,3,4,5,6,7),(2|,3,4,5,6,7,8),(3|,4,5,6,7,8,9),(4|,5,6,7,8,9,10),(5|,6,7,8,9,10,11),(6|,7,8,9,10,11,12) )

  • with hashtags

#( (color(white)(0),ul1,ul2,ul3,ul4,ul5,ul6),(1|,2,3,4,5,6,7),(2|,3,4,5,6,7,8),(3|,4,5,6,7,8,9),(4|,5,6,7,8,9,10),(5|,6,7,8,9,10,11),(6|,7,8,9,10,11,12) )#

you can have something like this

  • without hashtags

{: (color(white)(0),ul1,ul2,ul3,ul4,ul5,ul6),(1|,2,3,4,5,6,7),(2|,3,4,5,6,7,8),(3|,4,5,6,7,8,9),(4|,5,6,7,8,9,10),(5|,6,7,8,9,10,11),(6|,7,8,9,10,11,12) :}

  • with hashtags

# {: (color(white)(0),ul1,ul2,ul3,ul4,ul5,ul6),(1|,2,3,4,5,6,7),(2|,3,4,5,6,7,8),(3|,4,5,6,7,8,9),(4|,5,6,7,8,9,10),(5|,6,7,8,9,10,11),(6|,7,8,9,10,11,12) :}#

Notice that if you replace the first parenthesis with #"{:"# and the last parenthesis with #":}"#, you can make the borders of the matrix invisible.

You can also add a bit of spacing and some color to get something like this

  • without hashtags

{: (color(white)(0)," "ul1" "," "ul2" "," "ul3" "," "ul4" "," "ul5" "," "ul6" "),(1|," "2" "," "3" "," "4" "," "5" "," "6" "," "color(red)(7)" "),(2|," "3" "," "4" "," "5" "," "6" "," "color(red)(7)" "," "8" "),(3|," "4" "," "5" "," "6" "," "color(red)(7)" "," "8" "," "9" "),(4|," "5" "," "6" "," "color(red)(7)" "," "8" "," "9" "," "10" "),(5|," "6" "," "color(red)(7)" "," "8" "," "9" "," "10" "," "11" "),(6|," "color(red)(7)" "," "8" "," "9" "," "10" "," "11" "," "12" ") :}

  • with hashtags*

#{: (color(white)(0)," "ul1" "," "ul2" "," "ul3" "," "ul4" "," "ul5" "," "ul6" "),(1|," "2" "," "3" "," "4" "," "5" "," "6" "," "color(red)(7)" "),(2|," "3" "," "4" "," "5" "," "6" "," "color(red)(7)" "," "8" "),(3|," "4" "," "5" "," "6" "," "color(red)(7)" "," "8" "," "9" "),(4|," "5" "," "6" "," "color(red)(7)" "," "8" "," "9" "," "10" "),(5|," "6" "," "color(red)(7)" "," "8" "," "9" "," "10" "," "11" "),(6|," "color(red)(7)" "," "8" "," "9" "," "10" "," "11" "," "12" ") :}#

Pretty cool, right? :D

Like Parzival showed in his answer, you can create spacing by using white characters. The following is taken from this answer.

Alternatively, you can ditch the matrix syntax altogether and simply use color(white)() to create the spacing you need.

  • without hashtags

color(white)(aaaaa color(black)("something")aaaaaaacolor(black)("something else")aaaa)

color(white)(aaaaaaaacolor(black)("yes")aaaaaaaaaaaaaaacolor(black)("no")aaaa)

color(white)(aaaaaaaacolor(black)("yes")aaaaaaaaaaaaaaacolor(black)("yes")aaaa)

color(white)(aaaaaaaacolor(black)("no")aaaaaaaaaaaaaaaacolor(black)("no")aaaa)

  • with hashtags

#color(white)(aaaaa color(black)("something")aaaaaaacolor(black)("something else")aaaa)#

#color(white)(aaaaaaaacolor(black)("yes")aaaaaaaaaaaaaaacolor(black)("no")aaaa)#

#color(white)(aaaaaaaacolor(black)("yes")aaaaaaaaaaaaaaacolor(black)("yes")aaaa)#

#color(white)(aaaaaaaacolor(black)("no")aaaaaaaaaaaaaaaacolor(black)("no")aaaa)#

You can add a bit of flavor by using other colors.

  • without hashtags

color(white)(aaaaa color(blue)(ul("something"))aaaaaaacolor(purple)(ul("something else"))aaaa)

color(white)(aaaaaaaacolor(green)("yes")aaaaaaaaaaaaaaacolor(red)("no")aaaa)

color(white)(aaaaaaaacolor(green)("yes")aaaaaaaaaaaaaaacolor(green)("yes")aaaa)

color(white)(aaaaaaaacolor(red)("no")aaaaaaaaaaaaaaaacolor(red)("no")aaaa)

  • with hashtags

#color(white)(aaaaa color(blue)("something")aaaaaaacolor(purple)("something else")aaaa)#

#color(white)(aaaaaaaacolor(green)("yes")aaaaaaaaaaaaaaacolor(red)("no")aaaa)#

#color(white)(aaaaaaaacolor(green)("yes")aaaaaaaaaaaaaaacolor(green)("yes")aaaa)#

#color(white)(aaaaaaaacolor(red)("no")aaaaaaaaaaaaaaaacolor(red)("no")aaaa)#

You can even add a horizontal line if you want

  • without hashtags

color(black)(ul(color(white)(aaaaa color(blue)("something")aaaaaaacolor(purple)("something else")aaaa))

color(white)(aaaaaaaacolor(green)("yes")aaaaaaaaaaaaaaacolor(red)("no")aaaa)

color(white)(aaaaaaaacolor(green)("yes")aaaaaaaaaaaaaaacolor(green)("yes")aaaa)

color(white)(aaaaaaaacolor(red)("no")aaaaaaaaaaaaaaaacolor(red)("no")aaaa)

  • with hashtags

#color(black)(ul(color(white)(aaaaa color(blue)("something")aaaaaaacolor(purple)("something else")aaaa))#

#color(white)(aaaaaaaacolor(green)("yes")aaaaaaaaaaaaaaacolor(red)("no")aaaa)#

#color(white)(aaaaaaaacolor(green)("yes")aaaaaaaaaaaaaaacolor(green)("yes")aaaa)#

#color(white)(aaaaaaaacolor(red)("no")aaaaaaaaaaaaaaaacolor(red)("no")aaaa)#

This might look a bit intimidating at first, but you'll get the hang of it in no time if you practice.

Enjoy! :D

Jul 20, 2017

There's somewhat of a workaround. A table can be formatted with some careful spacing, and an underline command can be used to mark the header.

#ul("Trial"" ""Item 1 (unit)"" ""Item 2 (unit)"" ""Item 3 (unit)")#
#1" "" "" "0.05" "" "" "" "0.07" "" "" "" "" "0.08#

#2" "" "" "0.07" "" "" "" "0.04" "" "" "" "" "0.12#

#3" "" "" "0.02" "" "" "" "0.06" "" "" "" "" "0.09#

The MathJax looks like:

#">"#hashtagul("Trial"" ""Item 1 (unit)"" ""Item 2 (unit)"" ""Item 3 (unit)")hashtag
#">"#hashtag1" "" "" "0.05" "" "" "" "0.07" "" "" "" "" "0.08hashtag

#">"#hashtag2" "" "" "0.07" "" "" "" "0.04" "" "" "" "" "0.12hashtag

#">"#hashtag3" "" "" "0.02" "" "" "" "0.06" "" "" "" "" "0.09hashtag