emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [patch] LaTeX export using tabu tables


From: Nicolas Goaziou
Subject: Re: [O] [patch] LaTeX export using tabu tables
Date: Sun, 24 Mar 2013 10:26:24 +0100

Hello,

Eric Abrahamsen <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]