Math formatting "Pro tips" edition: Boxing answers! - "?"

1 Answer
Mar 4, 2016

I want to share a cool technique I plan on using in my answers from now on.

I've been addicted to boxing formulas and solutions ever since I was in secondary school, so I figure it was about time to start doing it on Socratic as well.

So here's what I came up with for doing that. Let's say I want to box something classic like

#ax^2 + bx + c = 0#

The two side lines are covered by the vertical line symbol, #|#, the one I assume many people are using for absolute value.

  • without hashtags

| ax^2 + bx + c = 0 |

  • with hashtags

#| ax^2 + bx + c = 0 |#

The bottom line is covered by the underline function, ul(), which looks like this

  • without hashtags

ul(ax^2 + bx + c = 0)

  • with hashtags

#ul(ax^2 + bx + c = 0)#

The top line is covered by the bar() function, which looks like this

  • without hashtags

bar(ax^2 + bx + c = 0)

  • with hashtags

#bar(ax^2 + bx + c = 0)#

So basically all you have to do is put all these three things together to get

  • without hashtags

bar( ul( | ax^2 + bx + c = 0 | ))

  • with hashtags

# bar( ul( | ax^2 + bx + c = 0 |)) #

And there you have it, a boxed answer!

Now, if you bring color into the mix, things can get really interesting. To write all that in color simply write it in a color()() function

  • without hashtags

color(green)(bar( ul( | ax^2 + bx + c = 0 | )))

  • with hashtags

#color(green)(bar( ul( | ax^2 + bx + c = 0 |)))#

You can get creative with it, too. Let's say that you want to have a black frame and a blue text. You can write

  • without hashtags

bar( ul( | color(blue)( (2pi)/7 ) | ))

  • with hashtags

#bar(ul(|color(blue)( (2pi)/7 )| ))#

Here's a tricky one. Get the text black and the frame red, for example. To do that, you will have to use color(black)() to break the red text.

  • without hashtags

color(red)( bar( ul( | color(black)((2pi)/7) | ))

  • with hashtags

#color(red)( bar( ul( | color(black)((2pi)/7) | ))#

Pretty cool, right? :D

ADDENDUM - CREATING A BIT OF SPACE

Notice that the outline of the box is really close to the text. If you want to enlarge the box, you can use this cool trick.

  • without hashtags

color(red)( bar( ul( | color(white)(a/a) color(black)( ax^2 + bx + c = 0 ) color(white)(a/a) | )))

  • with hashtags

#color(red)( bar(ul(|color(white)(a/a)color(black)( ax^2 + bx + c = 0) color(white)(a/a)| )))#

Here I used color(white)(a/a) to create some space between the edges of the box and the text.

Here's how that would look with color(green)(a/a)

  • without hashtags

color(red)( bar( ul( | color(green)(a/a) color(black)( ax^2 + bx + c = 0 ) color(green)(a/a) | )))

  • with hashtags

#color(red)(bar( ul( |color(green)(a/a)color(black)( ax^2 + bx + c = 0) color(green)(a/a)| )))#