Skip to content

Instantly share code, notes, and snippets.

@fmitha
Last active August 1, 2021 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fmitha/5b56efb42c6023db71d81c2aacaef4e4 to your computer and use it in GitHub Desktop.
Save fmitha/5b56efb42c6023db71d81c2aacaef4e4 to your computer and use it in GitHub Desktop.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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