Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sphinx doc generate a landscape page for long table or graph

Say I have a table with many columns, so I would like to put it into a landscape page in latexpdf. Is it possible to achieve this?

like image 796
Yan Zhu Avatar asked Oct 16 '25 07:10

Yan Zhu


1 Answers

I know this question was asked a long time ago, but it can still be useful.

In my case, I had a reStructuredText (rst) file with a CSV table that I wanted to rotate to have a landscape page only in my Latex file.

Using the raw directive, I was able to do it.

First, add this in your conf.py file to load the lscape package :

latex_elements = {

  'preamble': r'''\usepackage{lscape}'''
}

After, you can use the directive this way :

My CSV table
~~~~~~~~~~~~~~~~

.. raw:: latex

    \begin{landscape}

.. csv-table::
    :header: "Col 1", "Col 2", "Col 3"
    :widths: 10 10 10

    "Value 1", "Value 2", "Value 3"

.. raw:: latex

    \end{landscape}
like image 133
Phil Avatar answered Oct 19 '25 04:10

Phil



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!