mode table caption appear below table when exported to LaTeX

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?


In the link posted by NN, 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

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 .

链接地址: http://www.djcxy.com/p/61872.html

上一篇: 模式:逐字环境

下一篇: 模式表格标题在导出到LaTeX时出现在表格下方