From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [patch] LaTeX export using tabu tables Date: Sun, 24 Mar 2013 10:26:24 +0100 Message-ID: <87ehf5ywqn.fsf@gmail.com> References: <87li9e4u7q.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:48117) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJhCE-0000FT-G8 for emacs-orgmode@gnu.org; Sun, 24 Mar 2013 05:26:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UJhCD-0005qQ-7Q for emacs-orgmode@gnu.org; Sun, 24 Mar 2013 05:26:34 -0400 Received: from mail-wg0-f47.google.com ([74.125.82.47]:41601) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJhCD-0005qI-1O for emacs-orgmode@gnu.org; Sun, 24 Mar 2013 05:26:33 -0400 Received: by mail-wg0-f47.google.com with SMTP id dt14so2419185wgb.2 for ; Sun, 24 Mar 2013 02:26:32 -0700 (PDT) In-Reply-To: <87li9e4u7q.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Sat, 23 Mar 2013 12:26:49 +0800") 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: Eric Abrahamsen Cc: emacs-orgmode@gnu.org Hello, Eric Abrahamsen writes: > Attached is a patch that lets you use the "tabu" and "longtabu" table > environments. Mostly the patch is necessary because tabu has its own > annoying syntax for table width declarations. Where everyone else does > something like: > > \begin{tabular}{\textwidth}{cllr} > > tabu does this: > > \begin{tabu} to \textwidth {cllr} > > Where you're allowed to use either "to" or "spread". Annoying, but in my > case still worth it. Since table plists can handle spaces, this works > with the attached patch: > > #+ATTR_LATEX: :environment tabu :width to \textwidth :font \scriptsize :align rXrXrr > > Actually I've just set `org-latex-default-table-environment' to tabu. Thanks for your patch. I didn't know about "tabu" package, but it looks interesting. I added some comments and suggestions wrt to the patch. > Dunno if this is worth it for other people, but there's the patch. If > access to the "spread" keyword isn't worth the trouble I can hard-code > "to": that would at least mean you could switch between table and tabu > without having to edit your ATTR_LATEX lines. You could also add another attribute, :spread, which would used "spread" instead of "to" when non-nil. This way, users can have the best of both worlds. That new attribute needs to be documented in the comments at the beginning of the library. > Subject: [PATCH 8/8] Allow LaTeX export of tables using the tabu > package You need to list each modified function in the commit message. > --- > lisp/ox-latex.el | 23 ++++++++++++++--------- > 1 file changed, 14 insertions(+), 9 deletions(-) > > diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el > index 310fa14..1410b49 100644 > --- a/lisp/ox-latex.el > +++ b/lisp/ox-latex.el > @@ -2429,7 +2429,7 @@ This function assumes TABLE has `org' as its `:type' property and > org-latex-default-table-environment)) > ;; If table is a float, determine environment: table, table* > ;; or sidewaystable. > - (float-env (unless (equal "longtable" table-env) > + (float-env (unless (string-match-p "longtab" table-env) IMO, it's cleaner (as in more explicit) to use: (unless (member table-env '("longtable" "longtabu")) ...) > - ;; Longtable. > - ((equal "longtable" table-env) > + ;; Longtable or longtabu. > + ((string-match-p "longtab" table-env) Ditto. You may also use another branch in the `cond', in order to clearly separate "tabu" and "longtabu" environments from other packages. It would lead to some code duplication, but would allow for easier development of tabu specific features (e.g. :spread keyword), if ever needed. > - (longtablep (string= (or (plist-get attr :environment) > - org-latex-default-table-environment) > - "longtable")) > + (longtablep (string-match-p "longtab" > + (or (plist-get attr :environment) > + org-latex-default-table-environment))) See remark above. Regards, -- Nicolas Goaziou