R Blogdown雨果主题未遵循与LaTeX有关的Pandoc规则 [英] Pandoc rules regarding LaTeX not followed on R blogdown hugo themes
问题描述
我可以使用默认的
当 Pandoc 应该遵循我上面引用的规则时,为什么会调用 LaTeX?我如何使用其他"雨果主题,仍然使用LaTeX数学方程式,让Pandoc遵循自己的规则吗?不幸的是,转义 $
不会执行任何操作,并且显示与未转义版本相同的结果.
#不起作用\ $ 5到\ $ 10之间的金额.
进入双斜杠转义操作似乎也不起作用:
#不起作用\\ $ 5到\\ $ 10之间的金额.
对于那些想知道的问题-回答了最后两个问题, 1 , 2 ,如果回答了该问题,则应为这三部分的结尾.
首先创建以下文件:
/your-blogdown-site/themes/hugo-theme-codex/layouts/partials/math.html
然后将其添加到刚创建的 math.html
的正文中:
<脚本src ="//yihui.org/js/math-code.js"</script<脚本异步src ="//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML"</script>
似乎只有MathJax版本 2.7.5
正常工作.
blogdown书籍模板部分是阅读此类材料的很好来源的东西.您必须在YAML中包括 math:true
才能使用此方法显示LaTeX数学方程式.
I can create a new blogdown site utilizing the default hugo-lithium theme and the text statement below will not render as a LaTeX equation, which is the behavior I expect.
An amount between $5 and $10.
Pandoc's manual explains the reason why, which I'll paste below with a bold emphasis:
Anything between two
$
characters will be treated as TeX math. The opening$
must have a non-space character immediately to its right, while the closing$
must have a non-space character immediately to its left, and must not be followed immediately by a digit. Thus,$20,000 and $30,000
won’t parse as math. If for some reason you need to enclose text in literal$
characters, backslash-escape them and they won’t be treated as math delimiters.
HOWEVER, I can change to other Hugo themes (e.g. hugo-theme-codex) and this exact same text block renders improperly whenever I include math: true
in my YAML.
An amount between $5 and $10.
ends up displaying as:
Why is LaTeX invoked, when Pandoc is supposed to follow the rule I quoted above? How can I use "other" hugo themes, still use LaTeX math equations, and have Pandoc follow it's own rules? Escaping the $
unfortunately doesn't do anything, and displays the same result as the un-escaped version.
# Doesn't work
An amount between \$5 and \$10.
Getting in on the double slash escape action doesn't seem to work either:
# Doesn't work
An amount between \\$5 and \\$10.
And for those wondering - the last two questions have been answered, 1, 2, and if this question is answered this should be the end of this three part story.
First create the following file:
/your-blogdown-site/themes/hugo-theme-codex/layouts/partials/math.html
Then add this to the body of math.html
that you just created:
<script src="//yihui.org/js/math-code.js"></script>
<script async
src="//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
Only MathJax release 2.7.5
seems to work right.
The blogdown book templates section is a good source of reading material for this sort of thing. You must include math: true
in your YAML to display LaTeX math equations utilizing this method.
这篇关于R Blogdown雨果主题未遵循与LaTeX有关的Pandoc规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!