13
votes

I'm producing a document using org-mode which has quite a few tables in it, constructed using the built in table functionality. I've added captions to the tables, but when I export them to LaTeX, rather than the caption appearing below the table, it appears above it. In the manual section on tables and the latex export documentation, there is no mention of any method of changing this, other than fiddling with the LaTeX code manually. As an illustration, the following code snippets show what is generated by the export on an example table with a caption.

#+CAPTION: Results using two methods with different parameter settings.
#+LABEL: tbl:rescomp
| Parameter | Result 1 | Result 2 |
|-----------+----------+----------|
|       0.5 |      0.1 |      0.8 |
|         1 |      0.8 |      0.1 |

Exported:

\begin{table}[htb]
\caption{Results using two methods with different parameter settings.}
\label{tbl:rescomp}
\begin{center}
\begin{tabular}{rrr}
 Parameter  &  Result 1  &  Result 2  \\
\hline
       0.5  &       0.1  &       0.8  \\
         1  &       0.8  &       0.1  \\
\end{tabular}
\end{center}
\end{table}

The problem could be fixed very simply. The caption appears above the table in the document because it is above the table in the code. Moving the caption definition below the tabular section fixes the issue:

\begin{table}[htb]

\begin{center}
\begin{tabular}{rrr}
 Parameter  &  Result 1  &  Result 2  \\
\hline
       0.5  &       0.1  &       0.8  \\
         1  &       0.8  &       0.1  \\
\end{tabular}
\end{center}
\caption{Results using two methods with different parameter settings.}
\label{tbl:rescomp}
\end{table}

Placing the caption definition below the table in the org file is not possible, as it defines the caption for the next table, as described in the manual. Is there any way that I can get org-mode to export the caption below the table produced?

2

2 Answers

11
votes

Just updating the answer for Org-mode version 8.3.2 because setting org-export-latex-table-caption-above to nil does nothing now.

I added the next line to my .emacs or init.el file:

(setq org-latex-caption-above nil)

Just as a side note, that variable contains the value (table) by default, which is the one that we are overriding to nil.

10
votes

In the link posted by N.N., a patch to implement functionality to allow captions to be placed above or below the float was applied. Looking at the org-mode code on github, the default behaviour of Emacs 24.1 is to place captions above the table. To place captions below tables instead, set the org-export-latex-table-caption-above variable to nil:

M-x customize-variable RET org-export-latex-table-caption-above RET nil

or

M-x set-variable RET org-export-latex-table-caption-above RET nil