我是初学者。我正在尝试使用数学Jax构建表,但无法编译。如何添加表格?
\begin{center}
\begin{tabular}{ | m{7em} | m{5em}| m{9em} | }
\hline
Set & operation & Identity \\
\hline
\(\mathbb{Z}\) & \(+\) & \(0\) \\
\hline
\(\mathbb{Q}\) & \(+\) & \(0\) \\
\hline
\(\mathbb{R}\) & \(+\) & \(0\) \\
\hline
\(\mathbb{Z}\) & \(\times \) & \(0\) \\
\hline
\(\mathbb{Q}\) & \(\times\) & \(0\) \\
\hline
\(\mathbb{R}\) & \(\times\) & \(0\) \\
\hline
\end{tabular}
\end{center}
Run Code Online (Sandbox Code Playgroud)
Dav*_*one 10
MathJax 只实现用于数学布局的宏,而不是文本布局,因此不支持\begin{tabular}和\begin{center}不支持。相反,您可以使用一个array环境,例如:
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS_CHTML-full"></script>
\[
\begin{array}{|c|c|c|}
\hline
\text{Set} & \text{Operation} & \text{Identity} \\
\hline
\mathbb{Z} & + & 0 \\
\hline
\mathbb{Q} & + & 0 \\
\hline
\mathbb{R} & + & 0 \\
\hline
\mathbb{Z} & \times & 1 \\
\hline
\mathbb{Q} & \times & 1 \\
\hline
\mathbb{R} & \times & 1 \\
\hline
\end{array}
\]Run Code Online (Sandbox Code Playgroud)
另一方面,最好使用其中包含数学的 HTML 表格,而不是尝试使用 MathJax 来完成整个表格。
sau*_*rav 10
我使用MathJax的数组为MathJax制作了一个表生成器:https ://isaurssaurav.github.io/mathjax-table-generator/
用法:
回购链接:https : //github.com/isaurssaurav/mathjax-table-generator
(欢迎任何更改)
