gpt4 book ai didi

javascript - Next.js 上的 MathJax

转载 作者:行者123 更新时间:2023-12-05 07:17:40 26 4
gpt4 key购买 nike

<分区>

我想在我的网站上实现 MathJax,我在组件文件中这样编码:

export default ({ pathname, children }) => {
const post = posts.find(post => post.urlPath === pathname)
const title = post ? post.title : "(my website)"
return (
<div>
<Head>
<title>(my website) | {title}</title>
<style>{globalStyles}</style>

</Head>
<div className='contentContainer'>
<SiteTitle isHomepage={pathname === '/'} />
<Header />
{children}

</div>
</div>
)
}

我在 <Head></Head> 中添加了以下代码标签:

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ]
},
CommonHTML: { matchFontHeight: false }
});
</script>

为方便起见,我需要添加 tex2jax 配置。

我试着运行它。然而,它不起作用

[ error ] ./components/BlogLayout.js
SyntaxError: /home/website/components/BlogLayout.js: Unexpected token, expected "}" (72:15)

70 | <script type="text/x-mathjax-config">
71 | MathJax.Hub.Config({
> 72 | tex2jax: {
| ^
73 | inlineMath: [["\\(","\\)"] ],
74 | displayMath: [ ['$$','$$'], ["\\[","\\]"] ]
75 | },
\`\`\`

如何运行它?

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