我正在尝试使用 pythontex 和 ltablex 来输出从 python 脚本获取输出的表格。我在下面做了一个简单的示例:
\documentclass{article}
%\usepackage{tabularx}
\usepackage{ltablex}
\usepackage[keeptemps, runall=true]{pythontex}
\begin{document}
\begin{tabularx}{\linewidth}{lX}
HELLO & This is a very very long line which will keep on going and going at least until we go beyond the length of the linewidth \\
\end{tabularx}
\begin{tabularx}{\linewidth}{lX}
\pyc{print("HELLO & This is a very very long line which will keep on going and going at least until we go beyond the length of the linewidth")} \\
\end{tabularx}
\end{document}
输出如下图所示。另一个有趣的事情是,如果我使用 tabularx 而不是 ltablex,它确实会换行,但位置不一样。关于如何将 pythentex 与 ltablex 包一起使用,您有什么想法吗?