gpt4 book ai didi

javascript - 在网页中使用 MathJax 时如何在非数学上下文中使用 "$"

转载 作者:行者123 更新时间:2023-11-30 19:52:09 24 4
gpt4 key购买 nike

<分区>

如何在非数学设置中绕过 MathJax 将美元符号识别为内联定界符?

我在我的博客中使用 MathJax 来显示数学方程式,但并不是我所有的帖子都与数学相关,所以每次我使用“$”符号时,MathJax 都会被触发并使我的帖子被解释为数学文本。

我尝试使用以下技巧在不直接输入的情况下呈现“$”符号。

Dollar HexCode = &#x24;
Dollar HTMLcode = &#36;
DollarHTMLentity = &dollar;
but MathJax still catches me.

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type='text/javascript'>
window.MathJax = {
TeX: {
extensions: ['AMSsymbols.js', '[a11y]/accessibility-menu.js']
},
menuSettings: {
collapsible: false,
autocollapse: false
},
messageStyle: 'none',
tex2jax: {
inlineMath: [
['$', '$'],
["\\(", "\\)"]
],
processEscapes: true
}
};
</script>
<!--MATHJAX SCRIPT ENDS-->
<script async='async' src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-MML-AM_CHTML'></script>

<div class="post-body">
This is the regular post<br> $100 The Whole Part Between These Two Dollar Signs Gets Caught By MathJax$100 This Part Doesn't Get Caught And Is Safely Displayed On The Page$200 This Part Gets Caught, $00 And This Part Doesn't $300 This Part Should Have
Been Caught But It Bypasses Because The Closing Dollar Sign Is Missing.
</div>
<br><br>
<div class="post-body">
Here I use "&amp;#x24;"<br> &#x24;100 The Whole Part Between These Two Dollar Signs Gets Caught By MathJax&#x24;100 This Part Doesn't Get Caught And Is Safely Displayed On The Page&#x24;200 This Part Gets Caught, &#x24;200 And This Part Doesn't &#x24;300
This Part Should Have Been Caught But It Bypasses Because The Closing Dollar Sign Is Missing.
</div>
<br>
<div class="post-body">
Here I'll use "&amp;#36;" &#36;100 The Whole Part Between These Two Dollar Signs Gets Caught By MathJax &#36;100 This Part Doesn't Get Caught And Is Safely Displayed On The Page &#36;200 This Part Gets Caught, &#36;200 And This Part Doesn't &#36;300 This
Part Should Have Been Caught But It Bypasses Because The Closing Dollar Sign Is Missing.
</div>
<br>
<div class="post-body">
Here I use "&amp;dollar;" &dollar;100 The Whole Part Between These Two Dollar Signs Gets Caught By MathJax &dollar;100 This Part Doesn't Get Caught And Is Safely Displayed On The Page &dollar;200 This Part Gets Caught, &dollar;200 And This Part Doesn't
&dollar;300 This Part Should Have Been Caught But It Bypasses Because The Closing Dollar Sign Is Missing.
</div>

对于冗长的代码,我深表歉意,但我认为代码描述了我的意思...我需要使用“$”符号,但我不能从我的整个博客中跳过 MathJax。

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com