0

I'm trying to use pythontex with ltablex to output a table that gets output from a python script. I've done a simple example below:

\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}

The output is below in the Figure. The other interesting thing is if I use tabularx over ltablex it does wrap but not in the same place. Any thoughts on how I can use pythentex with the ltablex package?

Using ltablex

Using Tabularx

  • It is normally not a good idea to hide the cell separator & inside a command argument. Cells are groups and it can easily confuse the tabular. – Ulrike Fischer Apr 11 '17 at 7:59
  • @UlrikeFischer - Having the & inside or outside the command argument does not have an effect - i.e. \pyc{print("HELLO") & \pyc{print("This is a very.....")} produces the same result – Ross W Apr 11 '17 at 14:48
  • tabularx does two passes over the material, which can, and in fact does, confuse PythonTeX about what Python code to use. – egreg Apr 12 '17 at 8:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.