emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Myles English <mylesenglish@gmail.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: [PATCH] org-e-latex: Tables get correct amount of vertical space
Date: Tue, 13 Nov 2012 14:29:21 +0000	[thread overview]
Message-ID: <87d2zhr2ym.fsf@gmail.com> (raw)


This patch replaces every occurence of the \begin{center} environment
with \centering in the file contrib/lisp/org-e-latex.el.  I have tested
the export of a basic table and it works but not sure if all the
replacements are correct.

( BTW, this issue came to light using the nag package like this:
\RequirePackage[l2tabu, orthodox]{nag} )


From 54ae2245978fa755cd5daa483616ffdfa3e5ed0f Mon Sep 17 00:00:00 2001
From: Myles English <mylesenglish@gmail.com>
Date: Tue, 13 Nov 2012 14:14:56 +0000
Subject: [PATCH] org-e-latex:  Tables get correct amount of vertical space

* contrib/lisp/org-e-latex.el: Replaced \begin{center} ..\end{center}
  environments with \centering declarations.

Using both \begin{table} and \being{center} environments leads to double
the vertical space around the float, whereas \centering adds none.

 contrib/lisp/org-e-latex.el | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/contrib/lisp/org-e-latex.el b/contrib/lisp/org-e-latex.el
index 165beb3..c268c2c 100644
--- a/contrib/lisp/org-e-latex.el
+++ b/contrib/lisp/org-e-latex.el
@@ -550,14 +550,13 @@ in order to mimic default behaviour:
 	  \(when tags
             \(format \"\\\\hfill{}\\\\textsc{:%s:}\"
                     \(mapconcat 'identity tags \":\")))))
-    \(format (concat \"\\\\begin{center}\\n\"
+    \(format (concat \"\\\\centering\\n\"
-		    \"\\\\end{minipage}}\"
-		    \"\\\\end{center}\")
+		    \"\\\\end{minipage}}\")
 	    full-title contents))"
   :group 'org-export-e-latex
   :type 'function)
@@ -1086,7 +1085,7 @@ CONTENTS holds the contents of the center block.  INFO is a plist
 holding contextual information."
-   (format "\\begin{center}\n%s\\end{center}" contents)))
+   (format "\\centering\n%s" contents)))
 ;;;; Clock
@@ -1508,15 +1507,14 @@ holding contextual information."
 	       (when tags (format "\\hfill{}\\textsc{:%s:}"
 				  (mapconcat 'identity tags ":"))))))
-	 (format (concat "\\begin{center}\n"
+	 (format (concat "\\centering\n"
-			 "}\n"
-			 "\\end{center}")
+			 "}")
 		 full-title contents))))))
@@ -2302,14 +2300,13 @@ This function assumes TABLE has `org' as its `:type' attribute."
 		   (format "\\begin{%s}%s\n" float-env placement)
 		   (if org-e-latex-table-caption-above caption "")))
-		(when org-e-latex-tables-centered "\\begin{center}\n")
+		(when org-e-latex-tables-centered "\\centering\n")
 		(format "\\begin{%s}%s{%s}\n%s\\end{%s}"
 			(if width (format "{%s}" width) "")
-		(when org-e-latex-tables-centered "\n\\end{center}")
 		(when float-env
 		  (concat (if org-e-latex-table-caption-above "" caption)
 			  (format "\n\\end{%s}" float-env))))))))
@@ -2351,7 +2348,7 @@ attribute."
 	    (unless (= n 2)
 	      (setq output (replace-match "" nil nil output)))))))
     (if (not org-e-latex-tables-centered) output
-      (format "\\begin{center}\n%s\n\\end{center}" output))))
+      (format "\\centering\n%s" output))))
 ;;;; Table Cell

             reply	other threads:[~2012-11-13 14:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-13 14:29 Myles English [this message]
2012-11-13 14:54 ` [PATCH] org-e-latex: Tables get correct amount of vertical space Sebastien Vauban
2012-11-13 15:05   ` Myles English
2012-11-13 15:56     ` Nick Dokos
2012-11-13 16:15       ` Sebastien Vauban
2012-11-13 16:20         ` Nick Dokos
2012-11-13 16:32           ` Nick Dokos
2012-11-14  8:44             ` Sebastien Vauban
2012-11-14  9:40               ` Myles English
2012-11-13 21:31         ` Myles English
2012-11-14 14:03           ` Nicolas Goaziou

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=87d2zhr2ym.fsf@gmail.com \
    --to=mylesenglish@gmail.com \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public 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).