emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Thomas S. Dye" <tsd@tsdye.com>
To: Jeff Horn <jrhorn424@gmail.com>
Cc: Org-mode ml <emacs-orgmode@gnu.org>
Subject: Re: [babel] Passing an org table block to Eric Schulte's booktabs function
Date: Mon, 21 Feb 2011 09:51:27 -1000	[thread overview]
Message-ID: <672E9230-1995-44F2-90B6-C969897AA137@tsdye.com> (raw)
In-Reply-To: <AANLkTik+2m8mNJ_Af=iEcAXRWB6oP53rY5XUn586scqH@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2491 bytes --]

Aloha Jeff,

Do the instructions here work for you?

http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-12_1

hth,
Tom

On Feb 21, 2011, at 9:34 AM, Jeff Horn wrote:

> I've recently tried getting pretty tables in LaTeX export using Eric
> Schulte's function from Worg:
>
>    http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html#sec-5_2
>
> The problem is that passing the table to the function produces an
> error, specifically "wrong type of argument: listp".
>
> Any ideas about what to do differently? Here's a quick example:
>
> * Test Table
> Have a look at Table \ref{tab:example}.
> #+srcname: es-booktabs
> #+begin_src emacs-lisp :var table='((:head) hline (:body)) :exports  
> none
> (flet ((to-tab (tab)
>               (orgtbl-to-generic
>                (mapcar (lambda (lis)
>                          (if (listp lis)
>                              (mapcar (lambda (el)
>                                        (if (stringp el)
>                                            el
>                                          (format "%S" el))) lis)
>                            lis)) tab)
>                (list :lend " \\\\" :sep " & " :hline "\\hline"))))
>  (org-fill-template
>   "
> \\toprule
> %table
> \\bottomrule\n"
>   (list
>    (cons "table"
>          ;; only use \midrule if it looks like there are column  
> headers
>          (if (equal 'hline (second table))
>              (concat (to-tab (list (first table)))
>                      "\n\\midrule\n"
>                      (to-tab (cddr table)))
>            (to-tab table))))))
> #+end_src
> #+srcname: tab-example
> #+begin_src org :results replace :exports none
>       ,|            |   | Column Player |     |
>       ,|------------+---+---------------+-----|
>       ,| /          | < |               | >   |
>       ,|            |   | A             | B   |
>       ,| Row Player | A | 1,2           | 3,4 |
>       ,|            | B | 5,6           | 7,8 |
> #+end_src
> #+begin_src latex :noweb yes
> \begin{table}[htb!]
>   \centering
>   \caption{A test table}
>   \label{tab:example}
>   \begin{tabular}{rl}
>     <<es-booktabs(table=tab-example)>>
>   \end{tabular}
> \end{table}
> #+end_src
>
> -- 
> Jeffrey Horn
> http://www.failuretorefrain.com/jeff/
>
> _______________________________________________
> 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


[-- Attachment #1.2: Type: text/html, Size: 5714 bytes --]

[-- Attachment #2: 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

      reply	other threads:[~2011-02-21 19:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-21 19:34 [babel] Passing an org table block to Eric Schulte's booktabs function Jeff Horn
2011-02-21 19:51 ` Thomas S. Dye [this message]

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=672E9230-1995-44F2-90B6-C969897AA137@tsdye.com \
    --to=tsd@tsdye.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jrhorn424@gmail.com \
    /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).