emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric S Fraga <e.fraga@ucl.ac.uk>
To: Emacs Org mode mailing list <emacs-orgmode@gnu.org>
Subject: [patch] give tables their own default placement in LaTeX export
Date: Fri, 18 Feb 2022 12:37:31 +0000	[thread overview]
Message-ID: <87sfsgs644.fsf@ucl.ac.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 610 bytes --]


attached is a small patch to give tables their own default placement in
LaTeX export.  Up to now, tables have used the default placement for
figures but figures and tables are very different creatures so it does
not make sense to have just one default for both.

This patch unfortunately could break documents (if people have changed
the default for figures, expecting that change to apply to tables as
well) but I see no way to avoid this.  So maybe not worth incorporating
but I leave that decision to others.

Thank you,

: Eric S Fraga, with org release_9.5.2-385-g37d8bc in Emacs 29.0.50

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-ox-latex.el-give-tables-their-own-placement-def.patch --]
[-- Type: text/x-diff, Size: 2514 bytes --]

From 77d94298beb3a1b215e7602beba46b81e827b3a1 Mon Sep 17 00:00:00 2001
From: Eric S Fraga <e.fraga@ucl.ac.uk>
Date: Fri, 18 Feb 2022 12:23:01 +0000
Subject: [PATCH] lisp/ox-latex.el: give tables their own placement default

* ox-latex.el (org-latex--org-table): define and use a new variable,
org-latex-default-table-position, for setting the default placement
option for the export of tables.
 etc/ORG-NEWS     |  5 +++++
 lisp/ox-latex.el | 11 ++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 5a94e737e..506161937 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -100,6 +100,11 @@ argument.
 ** Miscellaneous
+*** Tables now have separate default placement option for LaTeX export
+Tables and figures now have separate settings for the default
+placement in LaTeX export.
 *** Styles are customizable in ~biblatex~ citation processor
 It is now possible to add new styles or modify old ones in ~biblatex~
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 5dda9b3ab..48efc7d98 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -120,6 +120,7 @@
     (:latex-caption-above nil nil org-latex-caption-above)
     (:latex-classes nil nil org-latex-classes)
     (:latex-default-figure-position nil nil org-latex-default-figure-position)
+    (:latex-default-table-position nil nil org-latex-default-table-position)
     (:latex-default-table-environment nil nil org-latex-default-table-environment)
     (:latex-default-quote-environment nil nil org-latex-default-quote-environment)
     (:latex-default-table-mode nil nil org-latex-default-table-mode)
@@ -753,6 +754,14 @@ environment."
   :package-version '(Org . "9.0")
   :safe #'stringp)
+(defcustom org-latex-default-table-position "htbp"
+  "Default position for LaTeX tables."
+  :group 'org-export-latex
+  :type 'string
+  :version "26.1"
+  :package-version '(Org . "9.0")
+  :safe #'stringp)
 (defcustom org-latex-inline-image-rules
   `(("file" . ,(rx "."
                    (or "pdf" "jpeg" "jpg" "png" "ps" "eps" "tikz" "pgf" "svg")
@@ -3274,7 +3283,7 @@ Return new environment, as a string."
 		  (t nil))))
 	  (or (plist-get attributes :placement)
-	      (format "[%s]" (plist-get info :latex-default-figure-position))))
+	      (format "[%s]" (plist-get info :latex-default-table-position))))
 	 (center? (if (plist-member attributes :center)
 		      (plist-get attributes :center)
 		    (plist-get info :latex-tables-centered)))

                 reply	other threads:[~2022-02-18 12:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sfsgs644.fsf@ucl.ac.uk \
    --to=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: [patch] give tables their own default placement in LaTeX export' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:


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).