emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] shrink latex table to fit beamer slide


From: Andreas Leha
Subject: Re: [O] shrink latex table to fit beamer slide
Date: Fri, 05 Dec 2014 13:12:42 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (darwin)

Hi Zhihao,



Zhihao Ding <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]