Placement=[H] not exporting to LaTeX anymore?
Nick Dokos <nicholas.dokos@hp.com> wrote: > John Hendy <jw.hendy@gmail.com> wrote: > > > Just to be sure I created an blank org file with only this: > > > > * test > > > > #+CAPTION: test table > > #+ATTR_LaTeX: placement=[H] > > | 1 | 2 | 3 | 4 | > > |------+------+------+------| > > | test | test | test | test | > > | test | test | test | test | > > > > It gets exported to this: > > > > \begin{table}[htb] > > \caption{test table} > > \begin{center} > > \begin{tabular}{llll} > > > > Did something change between 6.35 and 7.01 or in the LaTeX table options? > > > > I think that placement works fine for figures, but not for tables. In > fact, I cannot find the code that's supposed to do this for tables: I > suspect that it never existed. So unless I'm mistaken, it seems that > tables never got the placement treatment that figures did. > Try the following patch (might be wrong in detail, and its scope might be too limited, but I hope it's not too far off: at least it seems to work on your simple table.) It may also be white-space damaged, so some reformatting may be needed after applying it. Nick >From 4c8cdde9f3d80edc882efe83562a934fd9a6a8c8 Mon Sep 17 00:00:00 2001 From: Nick Dokos <nicholas.dokos@hp.com> Date: Fri, 23 Jul 2010 17:54:06 -0400 Subject: [PATCH] Process latex placement attribute for tables. Figures got placement attributes previously, but tables never did.
This commit is contained in:
parent
c708851b5e
commit
e555514feb
|
@ -1597,7 +1597,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
|
|||
(org-table-last-column-widths (copy-sequence
|
||||
org-table-last-column-widths))
|
||||
fnum fields line lines olines gr colgropen line-fmt align
|
||||
caption shortn label attr floatp longtblp)
|
||||
caption shortn label attr floatp placement longtblp)
|
||||
(if org-export-latex-tables-verbatim
|
||||
(let* ((tbl (concat "\\begin{verbatim}\n" raw-table
|
||||
"\\end{verbatim}\n")))
|
||||
|
@ -1617,7 +1617,12 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
|
|||
align (and attr (stringp attr)
|
||||
(string-match "\\<align=\\([^ \t\n\r]+\\)" attr)
|
||||
(match-string 1 attr))
|
||||
floatp (or caption label))
|
||||
floatp (or caption label)
|
||||
placement (if (and attr
|
||||
(stringp attr)
|
||||
(string-match "[ \t]*\\<placement=\\(\\S-+\\)" attr))
|
||||
(match-string 1 attr)
|
||||
"[htb]"))
|
||||
(setq caption (and caption (org-export-latex-fontify-headline caption)))
|
||||
(setq lines (org-split-string raw-table "\n"))
|
||||
(apply 'delete-region (list beg end))
|
||||
|
@ -1672,7 +1677,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
|
|||
(concat
|
||||
(if longtblp
|
||||
(concat "\\begin{longtable}{" align "}\n")
|
||||
(if floatp "\\begin{table}[htb]\n"))
|
||||
(if floatp (format "\\begin{table}%s\n" placement)))
|
||||
(if floatp
|
||||
(format
|
||||
"\\caption%s{%s}"
|
||||
|
|
Loading…
Reference in New Issue