首页 > 解决方案 > 从 Latex 和 Pandoc 创建的 Mathjax 中方程的标签和引用

问题描述

我是 Mathjax 的新手,如果我的问题很明显,我很抱歉。浏览互联网对我没有帮助。

我尝试从乳胶文件 test.tex 生成一个 html 页面,并引用标记的方程。

我的乳胶文件

\documentclass[12pt]{article}
\begin{document}
An equation
\begin{equation}
\label{test}
x=3.
\end{equation}
Here a reference to equation (\ref{test}).
\end{document}

命令生成的html代码:pandoc test.tex -s --mathjax -o test.html

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="pandoc" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
  <title>test</title>
  <style>
    code{white-space: pre-wrap;}
    span.smallcaps{font-variant: small-caps;}
    span.underline{text-decoration: underline;}
    div.column{display: inline-block; vertical-align: top; width: 50%;}
    div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
    ul.task-list{list-style: none;}
  </style>
  <script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js" type="text/javascript"></script>
  <!--[if lt IE 9]>
    <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
  <![endif]-->
</head>
<body>
<p>An equation <span class="math display">\[\label{test}
x=3.\]</span> Here a reference to equation (<a href="#test" data-reference-type="ref" data-reference="test">[test]</a>).</p>
</body>
</html>

我的 Chrome 浏览器中的结果,方程式没有标签,并且参考不是我想要的: 在此处输入图像描述

谢谢你的帮助 !

标签: htmllatexpandocmathjax

解决方案


推荐阅读