Jupyter (Python):显示 .txt 文件中的 .tex 表格
Jupyter (Python): Display .tex tables from .txt files
我有一个包含与此类似的 Latex table 的文本文件:
\begin{tabular}{lrrrr}
\toprule
{} & 2011 & 2012 & 2013 & 2014 \
\midrule
Number of Firms & 1500 & 1500 & 1500 & 1500 \
...
\bottomrule
\end{tabular}
是否可以调用此 .txt
文件以在 Jupyter notebook 中以正确的 latex 格式显示?按格式,我的意思是查看实际的 table 而不是 .tex
代码。
有没有Python包可以把.txt
文件里的latextable转成HTML?
不确定我是否完全理解了这个问题,但如果它正在渲染乳胶,那么你有为此提供的魔法:
%%胶乳
之后,您可以放置 latex,它会在执行单元格时呈现它。
另一种选择是加载乳胶:
from IPython.display import Latex
Latex(r"""\begin{eqnarray}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \
\nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \
\nabla \cdot \vec{\mathbf{B}} & = 0
\end{eqnarray}""")
我有一个包含与此类似的 Latex table 的文本文件:
\begin{tabular}{lrrrr}
\toprule
{} & 2011 & 2012 & 2013 & 2014 \
\midrule
Number of Firms & 1500 & 1500 & 1500 & 1500 \
...
\bottomrule
\end{tabular}
是否可以调用此 .txt
文件以在 Jupyter notebook 中以正确的 latex 格式显示?按格式,我的意思是查看实际的 table 而不是 .tex
代码。
有没有Python包可以把.txt
文件里的latextable转成HTML?
不确定我是否完全理解了这个问题,但如果它正在渲染乳胶,那么你有为此提供的魔法:
%%胶乳
之后,您可以放置 latex,它会在执行单元格时呈现它。 另一种选择是加载乳胶:
from IPython.display import Latex
Latex(r"""\begin{eqnarray}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \
\nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \
\nabla \cdot \vec{\mathbf{B}} & = 0
\end{eqnarray}""")