3

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

Thanks

Yan Zhu
  • 4,036
  • 3
  • 21
  • 37
  • 1
    You can insert raw LaTeX commands with a ReST directive: `.. raw:: latex`. This should allow you to configure the landscape package from LaTeX. – Paebbels May 31 '18 at 09:40
  • That might be good in combination with the [`only` directive](https://stackoverflow.com/questions/6473660/using-sphinx-docs-how-can-i-specify-png-image-formats-for-html-builds-and-pdf-im) for rotating in latex and not rotating in html. More options in https://stackoverflow.com/questions/6473660/using-sphinx-docs-how-can-i-specify-png-image-formats-for-html-builds-and-pdf-im – askaroni Feb 06 '20 at 05:26

1 Answers1

1

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}
Phil
  • 19
  • 3