From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [patch] LaTeX export using tabu tables Date: Mon, 25 Mar 2013 20:59:38 +0100 Message-ID: <87y5dbxnbp.fsf@gmail.com> References: <87li9e4u7q.fsf@ericabrahamsen.net> <87ehf5ywqn.fsf@gmail.com> <878v5cdotv.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:36497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKDYf-0006XI-DG for emacs-orgmode@gnu.org; Mon, 25 Mar 2013 15:59:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UKDYZ-0006VC-3W for emacs-orgmode@gnu.org; Mon, 25 Mar 2013 15:59:53 -0400 Received: from mail-we0-x232.google.com ([2a00:1450:400c:c03::232]:35008) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKDYY-0006Ux-SC for emacs-orgmode@gnu.org; Mon, 25 Mar 2013 15:59:47 -0400 Received: by mail-we0-f178.google.com with SMTP id z53so815879wey.37 for ; Mon, 25 Mar 2013 12:59:46 -0700 (PDT) In-Reply-To: <878v5cdotv.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Mon, 25 Mar 2013 13:35:08 +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: > I was trying to be too clever! Attached is a non-clever version that > includes a :spread keyword, and a (hopefully) correctly-written commit > message. Nice. A few more comments follow. > Subject: [PATCH 8/8] ox-latex.el (org-latex--org-table, org-latex-table-row): > Allow use of the "tabu" table environment when exporting tables to > LaTeX. Actually the first line of the commit should be more general (and shouldn't end with a full stop). Perhaps something like: ox-latex: Allow use of "tabu" table environment > * ox-latex.el (org-latex--org-table): New latex export attribute > :spread accommodates weird width specification syntax of the tabu > package. I would drop a note about the "tabu" and "longtabu" support in the description of the patch. > +;; - `:spread' is a boolean attribute specific to the "tabu" and > +;; "longtabu" environments, and only takes effect when used in > +;; conjunction with the `:width' attribute. When `:spread' is Nitpick: Emacs documentation and comments require two spaces after a sentence. > + (spread (plist-member attr :spread)) I think you mean (plist-get attr :spread), otherwise ":spread nil" will still activate spread. Also, since it's a predicate, I suggest to name the variable "spreadp". > (placement (or (plist-get attr :placement) > (format "[%s]" org-latex-default-figure-position))) > (centerp (if (plist-member attr :center) (plist-get attr :center) > @@ -2460,6 +2467,23 @@ This function assumes TABLE has `org' as its `:type' property and > (concat caption "\\\\\n")) > "\\end{longtable}\n" > (and fontsize "}"))) > + ;; Longtabu > + ((equal "longtabu" table-env) > + (concat (and fontsize (concat "{" fontsize)) > + (format "\\begin{longtabu}%s{%s}\n" > + (if width > + (format " %s %s " > + (if spread "spread" "to") width) "") > + alignment) > + (and org-latex-table-caption-above > + (org-string-nw-p caption) > + (concat caption "\\\\\n")) > + contents > + (and (not org-latex-table-caption-above) > + (org-string-nw-p caption) > + (concat caption "\\\\\n")) > + "\\end{longtabu}\n" > + (and fontsize "}"))) > ;; Others. > (t (concat (cond > (float-env > @@ -2471,7 +2495,10 @@ This function assumes TABLE has `org' as its `:type' property and > (fontsize (concat "{" fontsize))) > (format "\\begin{%s}%s{%s}\n%s\\end{%s}" > table-env > - (if width (format "{%s}" width) "") > + (if width (format > + (if (equal "tabu" table-env) > + (if spread " spread %s " " to %s") > + "{%s}") width) "") "longtabu" gets its own cond branch, but not "tabu". I think that defeats the purpose of the separation, which is to be able to add support for features of this rich table environment without cluttering the rest of the code. Doing it partially isn't worth the code duplication it implies. IOW, either we separate both "tabu" and "longtabu" completely, or we separate none of them. Your call. Thank you again. Regards, -- Nicolas Goaziou