From: Christophe Rhodes <csr21@cantab.net>
To: emacs-orgmode@gnu.org
Subject: [PATCH] customize latex table export
Date: Thu, 19 May 2011 13:34:06 +0100 [thread overview]
Message-ID: <87r57uyim9.fsf@cantab.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 712 bytes --]
Hi,
To produce documents in something approaching my organization's house
style, I need to be able to style the headers of tables. It's nice that
orgtbl has the functionality for this, but the call to orgtbl-to-latex
has a hard-coded list of parameters with no possibility for extension.
With the attached patch, I am able to put e.g.
#+BIND: org-export-latex-tables-orgtbl-extra-parameters (:hfmt "\\multicolumn{1}{c}{\\bf\\color{white}\\cellcolor{blue}%s}")
in the header of my document, and tables throughout the document all
pick up this style.
I daresay that this is not the optimal way of doing things; while this
solves my immediate problem there is likely to be a more general way of
doing things.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-allow-customization-of-table-headers-in-latex-export.patch --]
[-- Type: text/x-diff, Size: 2040 bytes --]
From 68160f0c7c54309e76d882f871ad01a019e9acab Mon Sep 17 00:00:00 2001
From: Christophe Rhodes <csr21@cantab.net>
Date: Thu, 19 May 2011 13:20:43 +0100
Subject: [PATCH 2/2] allow customization of table headers in latex export
* lisp/org-latex.el (org-export-latex-tables-orgtbl-extra-parameters): New
variable.
(org-export-latex-tables): Use it in call to orgtbl-to-latex.
---
lisp/org-latex.el | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index 516ee12..243cf84 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -325,6 +325,11 @@ When nil, grouping causes only separation lines between groups."
:group 'org-export-latex
:type 'boolean)
+(defcustom org-export-latex-tables-orgtbl-extra-parameters nil
+ "Extra parameters to pass to orgtbl-to-latex."
+ :group 'org-export-latex
+ :type 'plist)
+
(defcustom org-export-latex-low-levels 'itemize
"How to convert sections below the current level of sectioning.
This is specified by the `org-export-headline-levels' option or the
@@ -1929,15 +1934,16 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
align))
(orgtbl-to-latex
lines
- `(:tstart nil :tend nil
- :hlend ,(if longtblp
- (format "\\\\
+ (append org-export-latex-tables-orgtbl-extra-parameters
+ `(:tstart nil :tend nil
+ :hlend ,(if longtblp
+ (format "\\\\
\\hline
\\endhead
\\hline\\multicolumn{%d}{r}{Continued on next page}\\
\\endfoot
\\endlastfoot" (length org-table-last-alignment))
- nil)))
+ nil))))
(if (not longtblp) (format "\n\\end{%s}" tabular-env))
(if longtblp "\n" (if org-export-latex-tables-centered
"\n\\end{center}\n" "\n"))
--
1.7.2.5
[-- Attachment #3: Type: text/plain, Size: 19 bytes --]
Best,
Christophe
next reply other threads:[~2011-05-19 12:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-19 12:34 Christophe Rhodes [this message]
2011-05-24 11:02 ` [PATCH] customize latex table export Carsten Dominik
2011-11-29 17:44 ` Christophe Rhodes
2011-12-02 9:59 ` Niels Giesen
2011-12-02 10:21 ` Christophe Rhodes
2011-12-07 15:43 ` Christophe Rhodes
2011-12-14 9:01 ` Christophe Rhodes
2011-12-14 10:19 ` Bastien
2012-04-23 12:59 ` Bastien
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
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=87r57uyim9.fsf@cantab.net \
--to=csr21@cantab.net \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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
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).