emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Add support for `ltablex'
@ 2013-09-03 14:52 Francesco Pizzolante
  2013-09-03 15:48 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Francesco Pizzolante @ 2013-09-03 14:52 UTC (permalink / raw)
  To: mailing-list-org-mode

Hello,

Please find here a patch to support the tabularx table environment when used
in conjunction with the ltablex LaTeX package.

ltablex combines the advantages of longtable and tabularx packages: it enables
splitting of table across pages, and have fixed-width tables with
auto-adjusted columns.

Like longtable, it does not require a float table environment around.

I added a ltablex environment name which will be exported as a tabularx LaTeX
environment without a table float environment (this is the exact same behavior
as for longtable).

Usage is the same as tabularx (except that you use ltablex as :environment
name in the ATTR_LATEX specification):

- you need to specify a :width attribute, and
- an :align attribute.

In this case, like for longtable, the :float attribute is also ignored.

Best regards,
 Francesco

* ox-latex.el (org-latex--org-table): Add support for `ltablex'.

From: Francesco Pizzolante <fpz-djc/iPCCuDYQheJpep6IedvLeJWuRmrY@public.gmane.org>
Date: Tue, 3 Sep 2013 16:44:24 +0200
Subject: [PATCH] Add support for `ltablex'

---
 lisp/ox-latex.el |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index e66c717..6af3acf 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2350,7 +2350,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 (member table-env '("longtable" "longtabu"))
+	 (float-env (unless (member table-env '("longtable" "longtabu" "ltablex"))
 		      (let ((float (plist-get attr :float)))
 			(cond
 			 ((and (not float) (plist-member attr :float)) nil)
@@ -2401,6 +2401,21 @@ This function assumes TABLE has `org' as its `:type' property and
 		   (concat caption "\\\\\n"))
 	      "\\end{longtabu}\n"
 	      (and fontsize "}")))
+     ;; Ltablex (Tabularx without float).
+     ((equal "ltablex" table-env)
+      (concat (and fontsize (concat "{" fontsize))
+	      (format "\\begin{tabularx}{%s}{%s}\n"
+		      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{tabularx}\n"
+	      (and fontsize "}")))
      ;; Others.
      (t (concat (cond
 		 (float-env
--
1.7.9

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add support for `ltablex'
  2013-09-03 14:52 [PATCH] Add support for `ltablex' Francesco Pizzolante
@ 2013-09-03 15:48 ` Nicolas Goaziou
       [not found]   ` <8761uh3nz1.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2013-09-03 15:48 UTC (permalink / raw)
  To: Francesco Pizzolante; +Cc: mailing-list-org-mode



Hello,

Francesco Pizzolante
<fpz-djc/iPCCuDYQheJpep6IedvLeJWuRmrY@public.gmane.org> writes:

> Please find here a patch to support the tabularx table environment when used
> in conjunction with the ltablex LaTeX package.

Thanks for the patch.

What are its advantages over "longtabu" environment, which is already
supported? There is a lot of table related packages, I'm not sure we
want to support them all.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add support for `ltablex'
       [not found]   ` <8761uh3nz1.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2013-09-04 11:09     ` Francesco Pizzolante
  0 siblings, 0 replies; 3+ messages in thread
From: Francesco Pizzolante @ 2013-09-04 11:09 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: mailing-list-org-mode, Francesco Pizzolante



Hi Nicolas,

> What are its advantages over "longtabu" environment, which is already
> supported? There is a lot of table related packages, I'm not sure we
> want to support them all.

I wasn't aware about the tabu package and its tabu and longtabu environments.
I'll try to use it and see if I can get what I want.

One nice thing about ltablex is that you don't need to use different
environments for short or long tables: you still use the well known tabularx
environment in any case.

For now, please ignore my patch unless I come up with issues using the tabu
package.

Thanks a lot for your answer.

Regards,
 Francesco

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-04 11:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-03 14:52 [PATCH] Add support for `ltablex' Francesco Pizzolante
2013-09-03 15:48 ` Nicolas Goaziou
     [not found]   ` <8761uh3nz1.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-09-04 11:09     ` Francesco Pizzolante

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).