emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [patch] LaTeX export using tabu tables
Date: Sun, 24 Mar 2013 10:26:24 +0100	[thread overview]
Message-ID: <87ehf5ywqn.fsf@gmail.com> (raw)
In-Reply-To: <87li9e4u7q.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Sat, 23 Mar 2013 12:26:49 +0800")

Hello,

Eric Abrahamsen <eric@ericabrahamsen.net> 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

  parent reply	other threads:[~2013-03-24  9:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-23  4:26 [patch] LaTeX export using tabu tables Eric Abrahamsen
2013-03-24  0:18 ` Vikas Rawal
2013-03-24  9:26 ` Nicolas Goaziou [this message]
2013-03-25  5:35   ` Eric Abrahamsen
2013-03-25  5:54     ` Bastien
2013-03-25  6:54       ` Eric Abrahamsen
2013-03-25  6:51         ` Bastien
2013-03-25 19:59     ` Nicolas Goaziou
2013-03-26  2:54       ` Eric Abrahamsen
2013-03-27 14:29         ` Nicolas Goaziou
2013-03-26 20:05     ` Marcin Borkowski
2013-03-27  1:59       ` Eric Abrahamsen
2013-04-07 13:15         ` Marcin Borkowski

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=87ehf5ywqn.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=eric@ericabrahamsen.net \
    /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).