From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christophe Rhodes Subject: [PATCH] customize latex table export Date: Thu, 19 May 2011 13:34:06 +0100 Message-ID: <87r57uyim9.fsf@cantab.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:43291) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QN2Qc-0000IE-Uu for emacs-orgmode@gnu.org; Thu, 19 May 2011 08:34:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QN2Qb-0004JI-WD for emacs-orgmode@gnu.org; Thu, 19 May 2011 08:34:10 -0400 Received: from relay.pcl-ipout01.plus.net ([212.159.7.99]:51309) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QN2Qb-0004JE-Ry for emacs-orgmode@gnu.org; Thu, 19 May 2011 08:34:09 -0400 Received: from [81.174.155.115] (helo=lambda) by outmx02.plus.net with esmtp (Exim) id 1QN2Qa-0006xN-2A for emacs-orgmode@gnu.org; Thu, 19 May 2011 13:34:08 +0100 Received: from csr21 by lambda with local (Exim 4.72) (envelope-from ) id 1QN2QY-0004lx-Rp for emacs-orgmode@gnu.org; Thu, 19 May 2011 13:34:06 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= 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. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0002-allow-customization-of-table-headers-in-latex-export.patch >From 68160f0c7c54309e76d882f871ad01a019e9acab Mon Sep 17 00:00:00 2001 From: Christophe Rhodes 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 --=-=-= Best, Christophe --=-=-=--