Commands\fcolorbox

\fcolorboxCommand

Places text, optionally with inline math, in a framed box with separate frame and background colors to call out a result or warning; optional model arguments give each color numerically, and the background model defaults to the frame model.

\fcolorbox{red}{yellow}{check}
Available in
color
Kind
prefix
Allowed mode
both
Frequency
Not measured
Commonality
low
Tags
presentation
Renderer support
PackageMathJaxKaTeXXeTeX
colorMathJax: FullKaTeX: PartialXeTeX: Full
About the test scope

Syntax#

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

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

Examples#

\fcolorbox{blue}{white}{$E = mc^2$}
\fcolorbox[rgb]{0.8,0,0}{1,1,0.8}{$a + b$}
\fcolorbox[RGB]{200,0,0}[gray]{0.95}{$x$ is fixed}

In TeXForm#

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

Test cases#

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