From: Andreas Leha <andreas.leha@med.uni-goettingen.de>
To: emacs-orgmode@gnu.org
Subject: Re: shrink latex table to fit beamer slide
Date: Fri, 05 Dec 2014 13:12:42 +0000 [thread overview]
Message-ID: <oluppbytf3p.fsf@med.uni-goettingen.de> (raw)
In-Reply-To: ba7c6d3f-751b-4825-8263-119f5d2b1992@HUB05.ad.oak.ox.ac.uk
Hi Zhihao,
Zhihao Ding <zhihao.ding@imm.ox.ac.uk> writes:
> Dear Org experts,
>
> I am trying to fit a slightly wide latex table into a beamer
> slide in org. Below is my current solution and I was wondering
> if anyone can offer some advice on improving it.
>
> #+begin_scriptsize
> #+ATTR_LATEX: :align p{1cm} p{0.5cm} p{1cm}
> | | | <7> |
> | Site | Ind | -log10.pval |
> | 123279713 | 1 | 6.006102 |
> | 123279713 | 2 | 6.274326 |
> | 123279713 | 4 | 6.210920 |
> | 123279710 | 4 | 97.163695 |
> | 123279710 | 5 | 208.841892 |
> #+end_scriptsize
>
> In this solution, the issues are: (1) <N> for column width
> doesn’t seem to round text for latex output, and (2) I need
> to define column width in addition to <N>.
> I’d like to seek a solution that just shrinks the table to fit
> the text width without this fiddling.
>
> Many thanks,
> Zhihao
>
first:
you can set the font size in the #+ATTR_LATEX: line with
#+ATTR_LATEX: :font \scriptsize
second:
If you want to get the numbers rounded, you can either
(a) use babel or
(b) use the spreadsheet capabilities.
In both cases, you'll generate a new table which you want to export
example:
--8<---------------cut here---------------start------------->8---
* orig table :noexport:
#+name: origtable
| | | <7> |
| Site | Ind | -log10.pval |
| 123279713 | 1 | 6.006102 |
| 123279713 | 2 | 6.274326 |
| 123279713 | 4 | 6.210920 |
| 123279710 | 4 | 97.163695 |
| 123279710 | 5 | 208.841892 |
* the table formatted with babel
This (untested!) used to work, but due to a bug [fn:1] does not.
#+name: formatorigtable
#+begin_src R :var origtable=origtable :colnames yes
origtable[,3] <- format(origtable[,3], digits=3)
origtable
#+end_src
#+ATTR_LATEX: :align p{1cm} p{0.5cm} p{1cm}
#+results: formatorigtable
* the table formatted with calc/orgmode
This is quite complicated but works.
| | | <7> |
| Site | Ind | -log10.pval |
|-----------+-----+---------|
| 123279713 | 1 | 6.01 |
| 123279713 | 2 | 6.27 |
| 123279713 | 4 | 6.21 |
| 123279710 | 4 | 97.16 |
| 123279710 | 5 | 208.84 |
#+TBLFM: $1=remote(origtable, @@#$1)::$2=remote(origtable, @@#$2)::$3=remote(origtable, @@#$3); f-2
* Footnotes
[fn:1] I am unable to locate the thread about this for some strange reason.
The messages were sent between 2014-10-14 and 2014-10-16.
--8<---------------cut here---------------end--------------->8---
Best,
Andreas
next prev parent reply other threads:[~2014-12-05 13:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-05 11:18 shrink latex table to fit beamer slide Zhihao Ding
2014-12-05 13:12 ` Andreas Leha [this message]
2014-12-05 14:39 ` Zhihao Ding
2014-12-05 14:55 ` Andreas Leha
2014-12-06 11:04 ` Eric S Fraga
2014-12-06 14:19 ` Zhihao Ding
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=oluppbytf3p.fsf@med.uni-goettingen.de \
--to=andreas.leha@med.uni-goettingen.de \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.