我试图在javascript中使用mathjax节点。
正如你在图片中所看到的,我想让tex中心不要左转。
在mathjax节点上有任何配置吗?
我试着用文本对齐和displayAlign来对中,但是它不起作用。
function convert(tex, options, callback) {
mathjax.typeset({
width: options.width,
ex: 10,
math: tex,
format: "TeX",
// style: "text-align: center;",
svg: true, // SVG output
linebreaks: true,
}, function (data) {
if (data.errors) return callback(data.errors);
callback(undefined, data.svg);
});
}
const mathjax = require('mathjax-node');
mathjax.config({
TeX: {
extensions: ["color.js"]
},
MathJax: {
displayAlign: "center",
// 'text-align': "center"
extensions: ["TeX/color.js"],
'fast-preview':{disabled:false}
},
});
mathjax.start();这是mathjax.typeset和config的代码
发布于 2021-01-07 11:00:36
在以显示模式编写MathJax时,MathJax将自动为您对MathJax代码进行居中。
要在显示模式下打印您的方程,请使用下列分隔符之一:.,\begin{displaymath} .\end{ display }或\begin{equation} . \end{equation}。$$ . $$是不被鼓励的,因为它会给出不一致的间距,并且可能不能很好地处理一些数学包。
<p>
The mass-energy equivalence is described by the famous equation
\[ E=mc^2 \]
discovered in 1905 by Albert Einstein.
In natural units (\(c = 1 \)), the formula expresses the identity
\begin{equation}
E=m
\end{equation}
</p>
<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
上面的示例和引号是从这里派生的。
这是一种非常快速的数学中心方式,因为不需要额外的配置。
https://stackoverflow.com/questions/65608207
复制相似问题