Friday, 23 April 2021

How to show all DataFrame/ table columns for wide tables while exporting as pdf from Jupyter using nbconvert?

This question is linked to Jupyter nbconvert LaTex Export Theme

I am trying to export my Jupyter Notebook as a .pdf using nbconvert through the terminal (on Mac). I already created a .tplx template that will hide the code and show only outputs and markdowns.

# this is my jupyter notebook heading
pd.set_option('display.notebook_repr_html', True)
pd.set_option('display.expand_frame_repr', True)
pd.set_option("display.latex.repr", True)
pd.set_option("display.latex.longtable", True)
pd.set_option("display.latex.escape", True)
# this is the .tplx template for hiding the input and (preferably) setting the table width
# to fit the page width (including margins)
((*- extends 'article.tplx' -*))

((* block input_group *))
    ((*- if cell.metadata.get('nbconvert', {}).get('show_code', False) -*))
        ((( super() )))
    ((*- endif -*))
((* endblock input_group *))

((* block docclass *))   
\documentclass[8pt]{article}
\AtBeginDocument{
   \usepackage{graphicx}
   \resizebox{\textwidth}
   }
((* endblock docclass *))

What I get with this is a pdf with a table that has the proper style and continues the rows on the next page but it doesn't slice the columns to the next page. Instead, it just doesn't show them at all. Here is the screenshot. enter image description here

I have checked previous posts on SO and I tried to edit the .tplx file using the available documentation, but I couldn't find a solution.



from How to show all DataFrame/ table columns for wide tables while exporting as pdf from Jupyter using nbconvert?

No comments:

Post a Comment