Math formatting "Pro Tips" edition: Adding color to your answers! - "?"

3 Answers
Mar 21, 2015

I was playing around with mathjax the other day and I stumbled upon a way of adding color to a text.

I don't know if this could actually be useful or not, but I already know where I'll use color - stoichiometric coefficients, mole ratios, stuff like that.

The syntax looks like this

color(whatever color you want)(whatever text or math you want)

Here are some examples

  • without the hashtags

color(red)(2 + 2 + 2)

  • with the hashtags

#color(red)(2 + 2 + 2)#

  • without the hashtags

color(blue)(2 + 2 + 2)

  • with the hashtags

#color(blue)(2+2 + 2)#

Other examples:

#color(green)(ax^(2) + bx + c)#

#color(red)(2)C_2H_6 + color(blue)(7)O_2 -> color(green)(4)CO_2 + color(purple)(6)H_2O#

If you use color(black)(whatever), it will act as a regular bold text

#color(black)("Testing, testing...")#

Addendum

You can use color(white)(text) to write invisible characters. This is very useful for spacing issues

  • without the hashtags

color(white)(222)

  • with the hashtags

#color(white)(222) -># you can't see it, but it's there! Highlight it using your mouse!

Jun 18, 2015

Put hashtags around the following:

(color)("the type of color you want")("text you want to color")

Explanation:

For example, if I wanted to color the equation #x^2+1#

hashtag (color)(blue)(x^2+1) hashtag

#color(blue)(x^2+1)#

hashtag (color)(green)(x^2+1) hashtag

#color(green)(x^2+1)#

hashtag (color)(red)(x^2+1) hashtag

#color(red)(x^2+1)#

Press the edit answer button for this question if you want to take a look at the code.

Sep 27, 2016

This is an old (but still useful) answer; here are the possible values for "color" that can be used. Obviously many of these are too light to be useful. (Thanks to Tony B for suggesting these).

Explanation:

aliceblue: #color(aliceblue)("aliceblue")#

antiquewhite: #color(antiquewhite)("antiquewhite")#

aqua: #color(aqua)("aqua")#

aquamarine: #color(aquamarine)("aquamarine")#

azure: #color(azure)("azure")#

beige: #color(beige)("beige")#

bisque: #color(bisque)("bisque")#

black: #color(black)("black")#

blanchedalmond: #color(blanchedalmond)("blanchedalmond")#

blue: #color(blue)("blue")#

blueviolet: #color(blueviolet)("blueviolet")#

brown: #color(brown)("brown")#

burlywood: #color(burlywood)("burlywood")#

cadetblue: #color(cadetblue)("cadetblue")#

chartreuse: #color(chartreuse)("chartreuse")#

chocolate: #color(chocolate)("chocolate")#

coral: #color(coral)("coral")#

cornflowerblue: #color(cornflowerblue)("cornflowerblue")#

cornsilk: #color(cornsilk)("cornsilk")#

crimson: #color(crimson)("crimson")#

cyan: #color(cyan)("cyan")#

darkblue: #color(darkblue)("darkblue")#

darkcyan: #color(darkcyan)("darkcyan")#

darkgoldenrod: #color(darkgoldenrod)("darkgoldenrod")#

darkgray: #color(darkgray)("darkgray")#

darkgreen: #color(darkgreen)("darkgreen")#

darkkhaki: #color(darkkhaki)("darkkhaki")#

darkmagenta: #color(darkmagenta)("darkmagenta")#

darkolivegreen: #color(darkolivegreen)("darkolivegreen")#

darkorange: #color(darkorange)("darkorange")#

darkorchid: #color(darkorchid)("darkorchid")#

darkred: #color(darkred)("darkred")#

darksalmon: #color(darksalmon)("darksalmon")#

darkseagreen: #color(darkseagreen)("darkseagreen")#

darkslateblue: #color(darkslateblue)("darkslateblue")#

darkslategray: #color(darkslategray)("darkslategray")#

darkturquoise: #color(darkturquoise)("darkturquoise")#

darkviolet: #color(darkviolet)("darkviolet")#

deeppink: #color(deeppink)("deeppink")#

deepskyblue: #color(deepskyblue)("deepskyblue")#

dimgray: #color(dimgray)("dimgray")#

dodgerblue: #color(dodgerblue)("dodgerblue")#

firebrick: #color(firebrick)("firebrick")#

floralwhite: #color(floralwhite)("floralwhite")#

forestgreen: #color(forestgreen)("forestgreen")#

fuchsia: #color(fuchsia)("fuchsia")#

gainsboro: #color(gainsboro)("gainsboro")#

ghostwhite: #color(ghostwhite)("ghostwhite")#

gold: #color(gold)("gold")#

goldenrod: #color(goldenrod)("goldenrod")#

gray: #color(gray)("gray")#

green: #color(green)("green")#

greenyellow: #color(greenyellow)("greenyellow")#

honeydew: #color(honeydew)("honeydew")#

hotpink: #color(hotpink)("hotpink")#

indianred: #color(indianred)("indianred")#

indigo: #color(indigo)("indigo")#

ivory: #color(ivory)("ivory")#

khaki: #color(khaki)("khaki")#

lavender: #color(lavender)("lavender")#

lavenderblush: #color(lavenderblush)("lavenderblush")#

lawngreen: #color(lawngreen)("lawngreen")#

lemonchiffon: #color(lemonchiffon)("lemonchiffon")#

lightblue: #color(lightblue)("lightblue")#

lightcoral: #color(lightcoral)("lightcoral")#

lightcyan: #color(lightcyan)("lightcyan")#

lightgoldenrodyellow: #color(lightgoldenrodyellow)("lightgoldenrodyellow")#

lightgreen: #color(lightgreen)("lightgreen")#

lightgray: #color(lightgray)("lightgray")#

lightmagenta: #color(lightmagenta)("lightmagenta")#

lightpink: #color(lightpink)("lightpink")#

lightsalmon: #color(lightsalmon)("lightsalmon")#

lightseagreen: #color(lightseagreen)("lightseagreen")#

lightskyblue: #color(lightskyblue)("lightskyblue")#

lightslategray: #color(lightslategray)("lightslategray")#

lightsteelblue: #color(lightsteelblue)("lightsteelblue")#

lightyellow: #color(lightyellow)("lightyellow")#

lime: #color(lime)("lime")#

limegreen: #color(limegreen)("limegreen")#

linen: #color(linen)("linen")#

magenta: #color(magenta)("magenta")#

maroon: #color(maroon)("maroon")#

mediumaquamarine: #color(mediumaquamarine)("mediumaquamarine")#

mediumblue: #color(mediumblue)("mediumblue")#

mediumorchid: #color(mediumorchid)("mediumorchid")#

mediumpurple: #color(mediumpurple)("mediumpurple")#

mediumseagreen: #color(mediumseagreen)("mediumseagreen")#

mediumslateblue: #color(mediumslateblue)("mediumslateblue")#

mediumspringgreen: #color(mediumspringgreen)("mediumspringgreen")#

mediumturquoise: #color(mediumturquoise)("mediumturquoise")#

mediumvioletred: #color(mediumvioletred)("mediumvioletred")#

midnightblue: #color(midnightblue)("midnightblue")#

mintcream: #color(mintcream)("mintcream")#

mistyrose: #color(mistyrose)("mistyrose")#

moccasin: #color(moccasin)("moccasin")#

navajowhite: #color(navajowhite)("navajowhite")#

navy: #color(navy)("navy")#

oldlace: #color(oldlace)("oldlace")#

olive: #color(olive)("olive")#

olivedrab: #color(olivedrab)("olivedrab")#

orange: #color(orange)("orange")#

orangered: #color(orangered)("orangered")#

orchid: #color(orchid)("orchid")#

palegoldenrod: #color(palegoldenrod)("palegoldenrod")#

palegreen: #color(palegreen)("palegreen")#

paleturquoise: #color(paleturquoise)("paleturquoise")#

palevioletred: #color(palevioletred)("palevioletred")#

papayawhip: #color(papayawhip)("papayawhip")#

peachpuff: #color(peachpuff)("peachpuff")#

peru: #color(peru)("peru")#

pink: #color(pink)("pink")#

plum: #color(plum)("plum")#

powderblue: #color(powderblue)("powderblue")#

purple: #color(purple)("purple")#

red: #color(red)("red")#

rosybrown: #color(rosybrown)("rosybrown")#

royalblue: #color(royalblue)("royalblue")#

saddlebrown: #color(saddlebrown)("saddlebrown")#

salmon: #color(salmon)("salmon")#

sandybrown: #color(sandybrown)("sandybrown")#

seagreen: #color(seagreen)("seagreen")#

seashell: #color(seashell)("seashell")#

sienna: #color(sienna)("sienna")#

silver: #color(silver)("silver")#

skyblue: #color(skyblue)("skyblue")#

slateblue: #color(slateblue)("slateblue")#

slategray: #color(slategray)("slategray")#

snow: #color(snow)("snow")#

springgreen: #color(springgreen)("springgreen")#

steelblue: #color(steelblue)("steelblue")#

tan: #color(tan)("tan")#

teal: #color(teal)("teal")#

thistle: #color(thistle)("thistle")#

tomato: #color(tomato)("tomato")#

turquoise: #color(turquoise)("turquoise")#

violet: #color(violet)("violet")#

wheat: #color(wheat)("wheat")#

white: #color(white)("white")#

whitesmoke: #color(whitesmoke)("whitesmoke")#

yellow: #color(yellow)("yellow")#

yellowgreen: #color(yellowgreen)("yellowgreen")#