Make it possible to place table captions below the table

* lisp/org-latex.el (org-export-latex-tables): Honor
`org-export-latex-table-caption-above'
(org-export-latex-table-caption-above): New option.

Patch by Thomas Dye.
This commit is contained in:
Carsten Dominik 2011-10-10 21:05:03 +02:00
parent 968313f113
commit 54d7df6774
1 changed files with 16 additions and 4 deletions

View File

@ -73,7 +73,6 @@
org-deadline-string "\\|"
org-closed-string"\\)")
"Regexp matching special time planning keywords plus the time after it.")
(defvar org-re-quote) ; dynamically scoped from org.el
(defvar org-commentsp) ; dynamically scoped from org.el
@ -358,6 +357,12 @@ string defines the replacement string for this quote."
:group 'org-export-latex
:type 'boolean)
(defcustom org-export-latex-table-caption-above t
"When non-nil, the caption is set above the table. When nil,
the caption is set below the table."
:group 'org-export-latex
:type 'boolean)
(defcustom org-export-latex-tables-column-borders nil
"When non-nil, grouping columns can cause outer vertical lines in tables.
When nil, grouping causes only separation lines between groups."
@ -1965,13 +1970,13 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
(concat "\\begin{longtable}{" align "}\n")
(if floatp
(format "\\begin{%s}%s\n" tblenv placement)))
(if floatp
(if (and floatp org-export-latex-table-caption-above)
(format
"\\caption%s{%s} %s"
(if shortn (concat "[" shortn "]") "")
(or caption "")
(if label (format "\\label{%s}" label) "")))
(if (and longtblp caption) "\\\\\n" "\n")
(if (and longtblp caption) "\\\\\n" "\n")
(if (and org-export-latex-tables-centered (not longtblp))
"\\begin{center}\n")
(if (not longtblp)
@ -1993,6 +1998,12 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
(if (not longtblp) (format "\n\\end{%s}" tabular-env))
(if longtblp "\n" (if org-export-latex-tables-centered
"\n\\end{center}\n" "\n"))
(if (and floatp (not org-export-latex-table-caption-above))
(format
"\\caption%s{%s} %s"
(if shortn (concat "[" shortn "]") "")
(or caption "")
(if label (format "\\label{%s}" label) "")))
(if longtblp
"\\end{longtable}"
(if floatp (format "\\end{%s}" tblenv)))))
@ -2042,11 +2053,12 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
(setq tbl (concat "\\begin{center}\n" tbl "\\end{center}")))
(when floatp
(setq tbl (concat "\\begin{table}\n"
(if (not org-export-latex-table-caption-above) tbl)
(format "\\caption%s{%s%s}\n"
(if shortn (format "[%s]" shortn) "")
(if label (format "\\label{%s}" label) "")
(or caption ""))
tbl
(if org-export-latex-table-caption-above tbl)
"\n\\end{table}\n")))
(insert (org-export-latex-protect-string tbl))))