* Placement=[H] not exporting to LaTeX anymore?
@ 2010-07-23 15:03 John Hendy
2010-07-23 16:31 ` Nick Dokos
0 siblings, 1 reply; 5+ messages in thread
From: John Hendy @ 2010-07-23 15:03 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 1283 bytes --]
Hi,
I had a problem with floating tables/figures a ways back, found here:
http://www.mail-archive.com/emacs-orgmode@gnu.org/msg25566.html
The solution, which was simply inserting #+ATTR_LATEX: placement=[H], worked
perfectly.
I just ran into it again, however. my org file has the following order in a
section:
* section
text before table 1
table 1 (featuring both #+CAPTION and #+ATTR_LATEX: placement [H])
text before table 2
table 2 (featuring both #+CAPTION and #+ATTR_LATEX: placement [H])
But it's being exported to pdf like so:
text before table 1
text before table 2
table 1
table 2
The exported .tex has this for table 1:
\begin{table}[htb]
\caption{table 1 caption}
\begin{center}
If I manually change the \begin{table}[htb] line to \begin{table}[H], things
work exactly as I want. Somehow the [H] option just isn't making it
through...
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?
John
[-- Attachment #1.2: Type: text/html, Size: 2199 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Placement=[H] not exporting to LaTeX anymore?
2010-07-23 15:03 Placement=[H] not exporting to LaTeX anymore? John Hendy
@ 2010-07-23 16:31 ` Nick Dokos
2010-07-23 17:48 ` John Hendy
2010-07-23 22:16 ` Nick Dokos
0 siblings, 2 replies; 5+ messages in thread
From: Nick Dokos @ 2010-07-23 16:31 UTC (permalink / raw)
To: John Hendy; +Cc: nicholas.dokos, emacs-orgmode
John Hendy <jw.hendy@gmail.com> wrote:
>
> I had a problem with floating tables/figures a ways back, found here: http://www.mail-archive.com/emacs-orgmode@gnu.org/msg25566.html
>
> The solution, which was simply inserting #+ATTR_LATEX: placement=[H], worked perfectly.
>
> I just ran into it again, however. my org file has the following order in a section:
>
> * section
> text before table 1
> table 1 (featuring both #+CAPTION and #+ATTR_LATEX: placement [H])
> text before table 2
> table 2 (featuring both #+CAPTION and #+ATTR_LATEX: placement [H])
>
[Just a note for the unwary: the syntax above is not quite correct -
John gives the correct syntax below in his example.]
> But it's being exported to pdf like so:
>
> text before table 1
> text before table 2
> table 1
> table 2
>
> The exported .tex has this for table 1:
> \begin{table}[htb]
> \caption{table 1 caption}
> \begin{center}
>
> If I manually change the \begin{table}[htb] line to \begin{table}[H], things work exactly as I want. Somehow the [H] option just isn't making it
> through...
>
> 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.
Nick
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Placement=[H] not exporting to LaTeX anymore?
2010-07-23 16:31 ` Nick Dokos
@ 2010-07-23 17:48 ` John Hendy
2010-07-23 22:16 ` Nick Dokos
1 sibling, 0 replies; 5+ messages in thread
From: John Hendy @ 2010-07-23 17:48 UTC (permalink / raw)
To: nicholas.dokos; +Cc: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 2208 bytes --]
Thanks Nick.
- Whoops on forgetting the = in my first example!
- Is this hard to integrate? Is it possible to pass this option to LaTeX
just as with figures? It only involves overriding [htb] with [H]...
John
On Fri, Jul 23, 2010 at 11:31 AM, Nick Dokos <nicholas.dokos@hp.com> wrote:
> John Hendy <jw.hendy@gmail.com> wrote:
>
> >
> > I had a problem with floating tables/figures a ways back, found here:
> http://www.mail-archive.com/emacs-orgmode@gnu.org/msg25566.html
> >
> > The solution, which was simply inserting #+ATTR_LATEX: placement=[H],
> worked perfectly.
> >
> > I just ran into it again, however. my org file has the following order in
> a section:
> >
> > * section
> > text before table 1
> > table 1 (featuring both #+CAPTION and #+ATTR_LATEX: placement [H])
> > text before table 2
> > table 2 (featuring both #+CAPTION and #+ATTR_LATEX: placement [H])
> >
>
> [Just a note for the unwary: the syntax above is not quite correct -
> John gives the correct syntax below in his example.]
>
> > But it's being exported to pdf like so:
> >
> > text before table 1
> > text before table 2
> > table 1
> > table 2
> >
> > The exported .tex has this for table 1:
> > \begin{table}[htb]
> > \caption{table 1 caption}
> > \begin{center}
> >
> > If I manually change the \begin{table}[htb] line to \begin{table}[H],
> things work exactly as I want. Somehow the [H] option just isn't making it
> > through...
> >
> > 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.
>
> Nick
>
[-- Attachment #1.2: Type: text/html, Size: 3063 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Placement=[H] not exporting to LaTeX anymore?
2010-07-23 16:31 ` Nick Dokos
2010-07-23 17:48 ` John Hendy
@ 2010-07-23 22:16 ` Nick Dokos
2010-07-31 9:17 ` Patchwork: Patch 167 Accepted Bastien Guerry
1 sibling, 1 reply; 5+ messages in thread
From: Nick Dokos @ 2010-07-23 22:16 UTC (permalink / raw)
To: nicholas.dokos; +Cc: emacs-orgmode
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.
---
lisp/org-latex.el | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index f3a55ee..74af57a 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -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}"
--
1.5.6.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Patchwork: Patch 167 Accepted
2010-07-23 22:16 ` Nick Dokos
@ 2010-07-31 9:17 ` Bastien Guerry
0 siblings, 0 replies; 5+ messages in thread
From: Bastien Guerry @ 2010-07-31 9:17 UTC (permalink / raw)
To: emacs-orgmode
Patch 167 (http://patchwork.newartisans.com/patch/167/) is now Accepted.
This relates to the following submission:
http://mid.gmane.org/%3C12750.1279923404%40alphaville.usa.hp.com%3E
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-07-31 9:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-23 15:03 Placement=[H] not exporting to LaTeX anymore? John Hendy
2010-07-23 16:31 ` Nick Dokos
2010-07-23 17:48 ` John Hendy
2010-07-23 22:16 ` Nick Dokos
2010-07-31 9:17 ` Patchwork: Patch 167 Accepted Bastien Guerry
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).