Skip to content

Instantly share code, notes, and snippets.

@fmitha
Last active Aug 1, 2021
Embed
What would you like to do?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Execute with `pdflatex lt3.tex`
% Please check whether the following LaTeX warning appears with the
% most recent version of Pandas, currently 1.3.0. This appears to be a
% bug in the Python library Pandas.
% LaTeX Warning: Label `table' multiply defined.
% [...]
% LaTeX Warning: There were multiply-defined labels.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[12pt, twoside=semi]{scrartcl}
\usepackage{longtable}
\usepackage{booktabs}
\begin{filecontents}[overwrite,noheader]{lt.py}
import pandas as pd
d = {'one': list(range(1, 50)), 'two': list(range(51, 100))}
df = pd.DataFrame(d)
with open('lt3inc.tex', 'w') as tf:
tf.write(df.to_latex(longtable=True, caption='Table', index=False, label='table'))
\end{filecontents}
\immediate\write18{python3 lt.py}
\begin{document}
\input{lt3inc.tex}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment