【问题标题】:Adding colorful background to equation by acting directly on MathJax without CSS通过在没有 CSS 的情况下直接作用于 MathJax 来为方程添加彩色背景
【发布时间】:2022-01-13 17:10:51
【问题描述】:

我正在尝试为方程式添加彩色背景。我可以通过使用CSS 来实现这一点,但现在我想知道在哪里可以直接在调用 MathJax 的脚本中做到这一点。

请在下面找到rmarkdown 示例。

---
title: "Untitled"
output: html_document
---

Some text:

$$Y = \beta_0 + \beta_ 1 X_1 + \ldots + \beta_n X_n.$$

【问题讨论】:

    标签: r r-markdown markdown mathjax


    【解决方案1】:

    很简单:

    $$\require{color}\colorbox{magenta}{y = (sin)x}$$
    

    对于等式的着色文本,您可以使用:

    $$\color{green}{y = (cos)x}$$
    

    【讨论】:

    • 谢谢,@manro,但是是否可以使用 典型 LaTeX 数学字体来获得方程式?
    • 我刚刚发现了,@manro:$$\require{color}\displaystyle{\colorbox{yellow}{$ y = \sin x$}}$$。非常感谢您的帮助!
    • @PaulSmith 祝你好运,你是 SO 色彩的爱好者;)
    猜你喜欢
    • 1970-01-01
    • 2013-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-01
    相关资源
    最近更新 更多