简体   繁体   English

如何在MathJax中插入真棒字体图标?

[英]How to insert font-awesome icons in MathJax?

I want to write a formular with MathJax where I use a font-awesome icon as a replacement for an mathematical symbol. 我想用MathJax编写公式,在其中使用超棒字体图标代替数学符号。

If I try something like 如果我尝试类似

$$6 \cdot <i class="fa fa-home" aria-hidden="true"></i> + 5 \cdot <i class="fa fa-home" aria-hidden="true"></i>$$

I get 我懂了

在此处输入图片说明

Is there an easy way to get font-awesome icons integrated in MathJax? 是否有一种简单的方法来将真棒字体图标集成到MathJax中?

If you can ensure an HTML-based output, you can use MathJax's non-standard \\class{classname}{math} macro as below. 如果可以确保基于HTML的输出,则可以使用MathJax的非标准\\class{classname}{math}宏,如下所示。

Note that this won't work in the SVG output (without additional hacks anyway). 请注意 ,这在SVG输出中不起作用(无论如何都没有其他技巧)。

 script = document.createElement('script'); script.src = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_CHTML-full'; document.getElementsByTagName('head')[0].appendChild(script); 
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"></link> <h1>Using fontawesome in math</h1> $$ f: \\class{fa fa-twitter}{} \\to \\class{fa fa-home}{}$$ 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM