Math formatting "Pro Tips" edition: Using the cancel() and color() functions together! -"?"

2 Answers
Jul 26, 2015

Answer:

Just some quick tips on how the cancel() and color() functions can be used together.

Explanation:

I came across a very cool variation of the syntax used to combine the cancel() and color() functions.

As I'm sure most of you know already, you can use the color() and cancel() functions together to write things like

  • without the hashtags

cancel(color(red)(x^2 + 2x))

cancel(color(blue)("testing, testing...")

  • with the hashtags

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

#cancel(color(blue)("testting, testing...")#

Reversing the order in which the functions are being called will get you

  • without the hashtags

color(red)(cancel(x^2 + 2x))

color(blue)(cancel("testing, testing..."))

  • with the hashtags

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

#color(blue)(cancel("testing, testing..."))#

Now, to use color only for the strikeout line, you have to use the color() function once more for the text that's being used for the cancel() function.

More specifically, you need to call color(black)(text) within the cancel function to get this to happen. Here's how that would look like

  • without the hashtags

color(red)(cancel(color(black)(x^2 + 2x)))

color(blue)(cancel(color(black)("testing, testing...")))

  • with the hashtags

#color(red)(cancel(color(black)(x^2 + 2x)))#

#color(blue)(cancel(color(black)("testing, testing...")))#

Alternatively, you can use different sets of colors for the two functions to write things like

  • without the hashtags

color(red)(cancel(color(green)("color mix 1")))

color(blue)(cancel(color(red)("color mix 2")))

  • with the hashtags

#color(red)(cancel(color(green)("color mix 1")))#

#color(blue)(cancel(color(red)("color mix 2")))#

Answer:

To put a red strikeout through xyz, I use "color(red)(cancel(color(black)(" before the xyz and ")))" after the xyz.

Explanation:

I can't claim credit for the method, because Stefan Z developed it.

The "color(red)cancel" inserts the red strikeout mark.

The "(color(black)" changes to black everything that follows, i.e. "(xyz)", and the closing parentheses are added to match the number of opening parentheses.

Without hashtags:

color(red)(cancel(color(black)(xyz)))

With hashtags:

#color(red)(cancel(color(black)(xyz)))#

You can use quotes in the argument to avoid italics.

Thus,

color(red)(cancel(color(black)("xyz")))

gives (with hashtags) #color(red)(cancel(color(black)("xyz")))#

You have to get the number of parentheses just right, or it doesn't work.