7

I have an Org-mode document that I am exporting to PDF, and my document contains a table that I would like to rotate on export. I have been able to achieve the rotation with #+ATTR_LATEX: :float sideways. However, this places the table at the very end of the document, whereas I would like it closer to where it appears in the text. One solution I have tried is using #+LATEX: \begin{sidewaystable}[htbp] above the table and #+LATEX: \end{sidewaystable} below it, which is hacky and makes me lose my table caption and the ability to reference the table elsewhere in the text. It does, however, put the table where I want it. Is there a way to specify the location of a sidewaystable when exporting from Org-mode?

7

Try to use the :placement [H] modifier like in this example:

    #+NAME: tblSideways
    #+CAPTION: A sidewaystable
    #+ATTR_LATEX: :font \footnotesize :float sidewaystable :placement [H]
    | Column 1 | Column 2 | Column 3 | Column 4 | Column 5 | Column 6 |
    |----------+----------+----------+----------+----------+----------|
    |        1 |       10 |      100 |     1000 | example  | result   |
    |        2 |       11 |      101 |     1001 | example  | result   |
    |        3 |       12 |      102 |     1002 | example  | result   |
    |        4 |       13 |      103 |     1003 | example  | result   |
    |        5 |       14 |      104 |     1004 | example  | result   |
    |        6 |       15 |      105 |     1005 | example  | result   |
    |        7 |       16 |      106 |     1006 | example  | result   |

Note that this works, even though in the documentation it reads

:placement is ignored for :float sideways tables.

The modifier [H] is observed, as can be confirmed in the resulting LaTeX, as can be seen here:

\begin{sidewaystable}[H]
\caption{\label{tab:orgtable3}
A sidewaystable}
\centering
\footnotesize
\begin{tabular}{rrrrll}
Column 1 & Column 2 & Column 3 & Column 4 & Column 5 & Column 6\\
\hline
1 & 10 & 100 & 1000 & example & result\\
2 & 11 & 101 & 1001 & example & result\\
3 & 12 & 102 & 1002 & example & result\\
4 & 13 & 103 & 1003 & example & result\\
5 & 14 & 104 & 1004 & example & result\\
6 & 15 & 105 & 1005 & example & result\\
7 & 16 & 106 & 1006 & example & result\\
\end{tabular}
\end{sidewaystable}

You can find an example Org file + rendered PDF in my examples at https://github.com/dfeich/org-babel-examples/tree/master/latex

For reference: I am using Emacs version: GNU Emacs 25.1.50.3 and org version: 8.3.3

Cheers, Derek

  • 1
    This works to place the table, though I get an Unknown float option 'H' error. Using :placement [hp] works with no error. Thanks for pointing out the discrepancy in the documentation. – Kara Woo Feb 24 '16 at 16:37
  • 1
    @KaraWoo The H float option (meaning "really put it here") is defined by the float LaTeX package, so you need to \usepackage{float} to use it. – JeanPierre Feb 28 '16 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.