Commands\colorbox

\colorboxCommand

Places text, optionally with inline math, on a colored background to highlight a short note or result; an optional model argument gives the background color numerically.

\colorbox{yellow}{key step}
Available in
color
Kind
prefix
Allowed mode
both
Frequency
0% of corpus formulasrank 261 of 263
Commonality
low
Tags
presentation
Renderer support
PackageMathJaxKaTeXXeTeX
colorMathJax: FullKaTeX: PartialXeTeX: Full
About the test scope

Syntax#

\colorboxo:N[\cs]optional control sequencem:N{\cs}control sequencem:T{a}text content

Argspec o:N m:N m:T — one optional and two mandatory arguments. Reading argspecs

Examples#

\colorbox{yellow}{$x^2 + y^2 = r^2$}
\colorbox[gray]{0.9}{for all $n \ge 1$}

In TeXForm#

TeXForm parses this entry as prefix syntax; the package determines its argument specification.

Test cases#

color
InputCaseMathJaxKaTeXXeTeX
\colorbox{yellow}{a}Positive · baselinePassPassPass
\colorbox[gray]{0.85}{a}Positive · vary:o[0]PassFailPass
\colorbox{yellow}aPositive · bare[2]PassPassPass
\colorbox[\alpha]{0.85}{a}Negative · neg:N[0]FailFailFail
\colorbox{\alpha}{a}Negative · neg:N[1]PassFailFail
\colorbox{yellow}{a^2}Negative · neg:T[2]PassFailFail