* shrink latex table to fit beamer slide
@ 2014-12-05 11:18 Zhihao Ding
2014-12-05 13:12 ` Andreas Leha
0 siblings, 1 reply; 6+ messages in thread
From: Zhihao Ding @ 2014-12-05 11:18 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: shrink latex table to fit beamer slide
2014-12-05 11:18 shrink latex table to fit beamer slide Zhihao Ding
@ 2014-12-05 13:12 ` Andreas Leha
2014-12-05 14:39 ` Zhihao Ding
0 siblings, 1 reply; 6+ messages in thread
From: Andreas Leha @ 2014-12-05 13:12 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: shrink latex table to fit beamer slide
2014-12-05 13:12 ` Andreas Leha
@ 2014-12-05 14:39 ` Zhihao Ding
2014-12-05 14:55 ` Andreas Leha
2014-12-06 11:04 ` Eric S Fraga
0 siblings, 2 replies; 6+ messages in thread
From: Zhihao Ding @ 2014-12-05 14:39 UTC (permalink / raw)
To: Andreas Leha; +Cc: emacs-orgmode@gnu.org
Thanks a lot Andreas. Is there a way to globally
shrink/resize table for latex export without having
to define column width like this
“:align p{1cm} p{0.5cm} p{1cm}” ?
I am hopting to do something like width=\textwidth
and leave the rest to org for finding suitable font
sizes.
Zhihao
> On 5 Dec 2014, at 13:12, Andreas Leha <andreas.leha@med.uni-goettingen.de> wrote:
>
> 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
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: shrink latex table to fit beamer slide
2014-12-05 14:39 ` Zhihao Ding
@ 2014-12-05 14:55 ` Andreas Leha
2014-12-06 11:04 ` Eric S Fraga
1 sibling, 0 replies; 6+ messages in thread
From: Andreas Leha @ 2014-12-05 14:55 UTC (permalink / raw)
To: emacs-orgmode
Hi Zhihao,
Zhihao Ding <zhihao.ding@imm.ox.ac.uk> writes:
> Thanks a lot Andreas. Is there a way to globally
> shrink/resize table for latex export without having
> to define column width like this
> “:align p{1cm} p{0.5cm} p{1cm}” ?
> I am hopting to do something like width=\textwidth
> and leave the rest to org for finding suitable font
> sizes.
>
For that I'd let LaTeX do the job and use
\resizebox{\textwidth}{!}{}
as in
#+LaTeX: \resizebox{\textwidth}{!}{
| | | <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 |
#+LaTeX: }
Best,
Andreas
> Zhihao
>
>
>> On 5 Dec 2014, at 13:12, Andreas Leha <andreas.leha@med.uni-goettingen.de> wrote:
>>
>> 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
>>
>>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: shrink latex table to fit beamer slide
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
1 sibling, 1 reply; 6+ messages in thread
From: Eric S Fraga @ 2014-12-06 11:04 UTC (permalink / raw)
To: Zhihao Ding; +Cc: Andreas Leha, emacs-orgmode@gnu.org
On Friday, 5 Dec 2014 at 14:39, Zhihao Ding wrote:
> Thanks a lot Andreas. Is there a way to globally
> shrink/resize table for latex export without having
Beamer allows for shrinking of a whole frame to ensure it fits:
--8<---------------cut here---------------start------------->8---
* Frame title
:PROPERTIES:
:BEAMER_optimisation: shrink
:END:
| my | table |
| et | cetera |
--8<---------------cut here---------------end--------------->8---
The shrink option can also specify a percentage, as in "shrink=20".
--
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-581-g0e52f0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: shrink latex table to fit beamer slide
2014-12-06 11:04 ` Eric S Fraga
@ 2014-12-06 14:19 ` Zhihao Ding
0 siblings, 0 replies; 6+ messages in thread
From: Zhihao Ding @ 2014-12-06 14:19 UTC (permalink / raw)
To: Eric S Fraga; +Cc: Andreas Leha, emacs-orgmode@gnu.org
Thanks guys, in the end using R to round numbers and latex
resizebox to shrink table fonts as Andreas suggested works
best for me.
Cheers,
Zhihao
#+name: origtable
| 124.195548 | 310.528 |
| 120.848541 | 122.70234 |
#+name: formatorigtable
#+begin_src R :var origtable=origtable :colnames yes
origtable[,1:2] <- format(origtable[,1:2], digits=3)
origtable
#+end_src
#+results: formatorigtable
#+LaTeX: \resizebox{\textwidth}{!}{
| 124.195 | 310.528 |
| 120.848 | 122.702 |
#+LaTeX: }
> On 6 Dec 2014, at 11:04, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:
>
> On Friday, 5 Dec 2014 at 14:39, Zhihao Ding wrote:
>> Thanks a lot Andreas. Is there a way to globally
>> shrink/resize table for latex export without having
>
> Beamer allows for shrinking of a whole frame to ensure it fits:
>
> --8<---------------cut here---------------start------------->8---
> * Frame title
> :PROPERTIES:
> :BEAMER_optimisation: shrink
> :END:
>
> | my | table |
> | et | cetera |
> --8<---------------cut here---------------end--------------->8---
>
> The shrink option can also specify a percentage, as in "shrink=20".
>
> --
> : Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-581-g0e52f0
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-12-06 14:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-05 11:18 shrink latex table to fit beamer slide Zhihao Ding
2014-12-05 13:12 ` Andreas Leha
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
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).