From: "Eric Schulte" <schulte.eric@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Re: latex export and booktabs tables
Date: Sun, 27 Jun 2010 22:09:39 -0700 [thread overview]
Message-ID: <878w5zd9po.fsf@gmail.com> (raw)
In-Reply-To: <87tyouyx6b.fsf@mundaneum.com> ("Sébastien Vauban"'s message of "Wed, 23 Jun 2010 10:23:40 +0200")
[-- Attachment #1: Type: text/plain, Size: 417 bytes --]
One way to deal with this without adding even more complexity to the
core of org-mode could be through the use of "Library of Babel"
functions.
The attached org-mode file provides a function for exporting to the
longtable environment with some example usage. If this looks generally
useful it (and maybe similar functions) could be added to the library of
babel distributed w/Org-mode.
What do you think? -- Eric
[-- Attachment #2: longtable.org --]
[-- Type: application/octet-stream, Size: 2690 bytes --]
#+TITLE: longtable
#+OPTIONS: toc:nil
a simple example
#+call: longtable(table=my-table, align="{|r|}") :results latex :exports results
a more complex example which uses =my-first-header= from below
#+call: longtable(table=my-table, align="{|r|}", firsthead=my-firsthead) :results latex :exports results
* COMMENT table hidden in a commented section
#+tblname: my-table
| 1 |
| 2 |
| 3 |
| 4 |
#+results: my-firsthead
#+begin_LaTeX
\hline
\multicolumn{1}{ |c|}{Numbers}\\
\hline
\hline
#+end_LaTeX
* COMMENT longtable function
This block can be used to wrap a table in the latex =longtable=
environment, it takes the following arguments -- all but the first two
are optional.
| arg | description |
|-----------+-------------------------------------------------------------|
| table | a reference to the table |
| align | optional alignment string |
| width | optional width specification string |
| hline | the string to use as hline separator, defaults to "\\hline" |
| head | optional "head" string |
| firsthead | optional "firsthead" string |
| foot | optional "foot" string |
| lastfoot | optional "lastfoot" string |
#+srcname: longtable
#+begin_src emacs-lisp :var table='((:table)) :var width='() :var align='() :var hline="\\hline" :var firsthead='() :var head='() :var foot='() :var lastfoot='() :noweb yes :results latex
(org-fill-template
"
\\begin{longtable}%width%align
%firsthead
%head
%foot
%lastfoot
%table
\\end{longtable}\n"
(list
(cons "width" (if width (format "{%s}" width) ""))
(cons "align" (if align (format "{%s}" align) ""))
(cons "firsthead" (if firsthead (concat firsthead "\n\\endfirsthead\n") ""))
(cons "head" (if head (concat head "\n\\endhead\n") ""))
(cons "foot" (if foot (concat foot "\n\\endfoot\n") ""))
(cons "lastfoot" (if lastfoot (concat lastfoot "\n\\endlastfoot\n") ""))
(cons "table" (orgtbl-to-generic
(mapcar (lambda (lis)
(if (listp lis)
(mapcar (lambda (el)
(if (stringp el)
el
(format "%S" el))) lis)
lis)) table)
(list :lend " \\\\" :sep " & " :hline hline)))))
#+end_src
[-- Attachment #3: Type: text/plain, Size: 1016 bytes --]
Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
> Hi Erik,
>
> Erik Butz wrote:
>> I found a very old thread on the list about using the booktabs package to
>> have nicer tables in latex export.
>>
>> I found that, making the changes below I can use the booktab package to
>> export tables, and using standard tables only, this seems to work fine.
>>
>> Can anyone advice on whether this kind of change is meaningful or if this is
>> likely to introduce difficulties elsewhere which I did not experience due to
>> the limited scope of usage? It should be said that I did not at all look
>> into longtables so far.
>
> While trying to improve this, I think one could extend it so that the table
> environment can be changed as well, from `tabular' to `array', `tabular*',
> `tabularx' or any other.
>
> There was a discussion on this, a while ago, by Francesco Pizzolante. Have a
> read at: http://www.mail-archive.com/emacs-orgmode@gnu.org/msg18311.html.
>
> Best regards,
> Seb
[-- Attachment #4: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
next prev parent reply other threads:[~2010-06-28 5:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-22 21:36 latex export and booktabs tables Erik Butz
2010-06-22 23:03 ` Thomas S. Dye
2010-06-23 8:23 ` Sébastien Vauban
2010-06-28 5:09 ` Eric Schulte [this message]
2010-06-28 6:05 ` Carsten Dominik
2010-06-28 8:45 ` Sébastien Vauban
2010-06-28 15:16 ` Eric Schulte
2010-06-28 20:07 ` Erik Butz
2010-06-28 20:14 ` Sébastien Vauban
2010-06-29 8:00 ` Thomas S. Dye
2010-06-29 17:10 ` Eric Schulte
2010-06-30 3:01 ` Thomas S. Dye
2010-06-30 18:54 ` Eric Schulte
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=878w5zd9po.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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).