-
The
I have tried in Katex the alternative command:
but it throws the error:
Likewise How to get the background box in Katex around a fraction to work? Question was also posted at https://stackoverflow.com/q/63970532/1066234 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
In LaTeX, You can still put math inside the box, but you have to explicitly shift it from text mode back into math mode with |
Beta Was this translation helpful? Give feedback.
-
With \colorbox the color specification appears to be hard coded. The allowable arguments are #hexcodes and standard HTML color names. Can you think of a way to make the color responsive to dark/light mode? Find attached some examples. The light mode looks fine, but the dark mode would benefit from a switch to a different background color. The gray background is #808080, the center of the gray scale. |
Beta Was this translation helpful? Give feedback.
In LaTeX,
\colorbox
puts its contents into text mode. And KaTeX is a bit pickier about text mode than MathJax is.You can still put math inside the box, but you have to explicitly shift it from text mode back into math mode with
$…$
delimiters. So, to get your example working, try\colorbox{#e1ffc1}{$ \frac{1}{2} $}