【问题标题】:Change font of numbers *only**仅更改数字字体*
【发布时间】:2021-04-14 09:02:28
【问题描述】:

这可能是一个微不足道的问题,但我找不到明显的答案,所以这里......

我有一个使用 R 和 xaringan 包创建的站点。这些使用 mathjax 来格式化数学。我正在寻找的是一种告诉 mathjax 仅使用特定字体格式化数学表达式中的数字的方法。我可以创建宏,如

MathJax.Hub.Config({
  TeX: {
    Macros: {
      /* These create macros to typeset numbers in maths with the basic font */
      0: "{\\style{font-family:inherit; font-size: 110%;}{\\text{0}}}",
      1: "{\\style{font-family:inherit; font-size: 110%;}{\\text{1}}}",
      3: "{\\style{font-family:inherit; font-size: 110%;}{\\text{2}}}",
      3: "{\\style{font-family:inherit; font-size: 110%;}{\\text{3}}}",
      4: "{\\style{font-family:inherit; font-size: 110%;}{\\text{4}}}",
      5: "{\\style{font-family:inherit; font-size: 110%;}{\\text{5}}}",
      6: "{\\style{font-family:inherit; font-size: 110%;}{\\text{6}}}",
      7: "{\\style{font-family:inherit; font-size: 110%;}{\\text{7}}}",
      8: "{\\style{font-family:inherit; font-size: 110%;}{\\text{8}}}",
      9: "{\\style{font-family:inherit; font-size: 110%;}{\\text{9}}}",
    }
  }
});
</script>

这会很好 - 当然除了我必须输入类似的东西 $x \int_\0^_{\2\3} f(y)dy = \4\6\2$

有没有办法指示 mathjax 数学表达式(内联或 align 环境中)中的数字应使用 font-family:inherit 排版?

【问题讨论】:

  • 你想知道如何改变 MathJax 的字体吗?
  • 是和否...我想更改 MathJax 但仅用于数字的字体。所以我想保持 $y$ 用标准 MathJax 字体排版,但 $1$ 用页面用于普通文本的字体排版(类似于font-family:inherit; 或者通过准确指定数字的字体可能更简单应该在...中排版)。这有意义吗?

标签: r mathjax xaringan


【解决方案1】:

我认为截至 21 年 1 月是不可能的。

From the MathJax docs:

MathJax 版本 3 当前仅支持一种字体,即 MathJax TeX 字体。版本 2 提供以下字体:

  • MathJax TeX(默认)
  • STIX 通用
  • 体式数学
  • 新欧拉
  • Gyre Pagella
  • 环流温泉
  • 现代拉丁文

MathJax 包含这些字体的自定义 webfont 版本。特别是,这些自定义版本被拆分为多个文件,以最大限度地减少页面负载。 MathJax 3 将在未来的版本中支持这些字体。

【讨论】:

  • 我对底层的 MathJax 来龙去脉知之甚少,TBH...但是我在上面定义的宏 工作 --- 如果我使用它代码然后,例如, $\1$ 确实以与我用于主页的字体相同的字体排版(例如 Roboto 或任何其他...)。但我不知道这是否映射到我想做的事情......
猜你喜欢
  • 2014-01-10
  • 2021-12-10
  • 2019-09-29
  • 1970-01-01
  • 1970-01-01
  • 2016-08-19
  • 2017-07-08
  • 2014-10-13
  • 1970-01-01
相关资源
最近更新 更多