一个多月以来,我一直使用 Ipython notebook 处理测量数据,发现通过在 Ipython notebook 中即时查看,使用 matplotlib 创建绘图非常轻松。对于表格,我使用 matrix2latex 然后我用它来包含到我的长 latex 文档中。由于我通常无法让我的表格在第一次出现时如我所愿,所以我浪费了很多时间来编译我的长 LaTeX 文件。
那么问题是:
有没有办法显示所有 latex 格式的文件内联 python 笔记本,我可以用它来绘制 matrix2latex 生成的文件?
最佳答案
由于 IPython 只是将 MathJax 用于 LaTeX 显示,因此它仅限于数学命令族。 matrix2latex 输出以下形式的 LaTeX 表格:
\begin{table}[ht]
\begin{center}
\begin{tabular}{cc}
\toprule
$1$ & $1$\\
$2$ & $4$\\
$3$ & $9$\\
\bottomrule
\end{tabular}
\end{center}
\end{table}
话虽这么说,如果您需要打印一些漂亮的矩阵,那么我建议这样:
from IPython.core.display import Math
m = eye(10)
display(Math(latex(m)))
关于latex - Ipython Notebook 中有没有办法内联显示 LaTeX 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12863339/