# Org mode table export latex with title (upper) and notes (lower)

I would like to create the following LaTeX type table by using the standard org-mode functions.

The LaTeX code is the following:

\begin{table}[!h]
\centering
\caption{Results}
\label{tab}
\begin{threeparttable}
\begin{tabular}{lccc}
\hline
\hline
& (1) & (2) & (3) \\
\hline
XXX & 1.60 & 2.38 & 2.80 \\
& (1.60) & (0.98) & (1.26) \\
Observations & 20 & 20 & 20 \\
\hline
\end{tabular}
\begin{tablenotes}
\small
\item
\hspace{-12pt}\emph{Notes:}
\end{tablenotes}
\end{threeparttable}
\end{table}


In the org table editor, I can create a similar result.

#+NAME: tab1
#+CAPTION: Results
|--------------+--------+--------+--------|
|--------------+--------+--------+--------|
|              | (1)    | (2)    | (3)    |
|--------------+--------+--------+--------|
| XXX          | 1.60   | 2.38   | 2.80   |
|              | (1.60) | (0.98) | (1.26) |
| Observations |  20    | 20     |  20    |
|--------------+--------+--------+--------|



But, I would like to understand how to add the Note by using org mode.

• Not sure to fully understand what you want, but it might be enough to set the variable org-latex-caption-above to the desired value. If this does not work, maybe you should provide the orgmode code you tried, the output you got and what you'd like to get. – Philopolis Apr 3 '20 at 12:31
• Thanks for the advise. I just edited the original question. I think the meaning become more clear. – hrkshr Apr 8 '20 at 19:54

Well, I think I found something which is a good workaround, but probably not a good solution.

1. First you'll have to set (as local variables) the variables org-latex-caption-above to t (so as to the get the caption above the table and not below), and org-latex-tables-centered to nil. This second setting aims to avoid your threeparttable environment to be enclosed in \begin{center} ... \end{center}, which triggers an error.

2. This minimal example does seem to work, but it is rather rather ugly and not very convenient:

#+LATEX_HEADER: \usepackage{threeparttable}
#+OPTIONS: toc:nil

#+NAME: tab1
#+ATTR_LATEX: :environment tabu :align lrrr
#+begin_table
#+CAPTION: Results
#+begin_threeparttable
|--------------+--------+--------+--------|
|--------------+--------+--------+--------|
|              | (1)    | (2)    | (3)    |
|--------------+--------+--------+--------|
| XXX          | 1.60   | 2.38   | 2.80   |
|              | (1.60) | (0.98) | (1.26) |
| Observations |  20    | 20     |  20    |
|--------------+--------+--------+--------|
#+begin_tablenotes
\item Source: my source.
#+end_tablenotes
#+end_threeparttable
#+end_table

* Lisp setup                                                       :noexport:
;;; Local variables:
;;; org-latex-caption-above: t
;;; org-latex-tables-centered: nil
;;; End:


I do not have better to propose... but you can use this as a skeleton (with yasnippet or something similar) to avoid all this typing each time.

• Thanks. To set "center" option for the whole table, I have to use "center" option like the following, right?  #+begin_table #+begin_center ~~ #+end_center #+end_table – hrkshr Apr 9 '20 at 11:58
• Yes, I guess! Or a \centring instruction somewhere. Or anything (manually added) that does play well with the threeparttable` environement. – Philopolis Apr 9 '20 at 12:25