From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: Re: shrink latex table to fit beamer slide Date: Fri, 05 Dec 2014 14:55:32 +0000 Message-ID: References: <167d6201-d240-496d-804d-8953195f7212@HUB04.ad.oak.ox.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwuIK-0002R6-CN for emacs-orgmode@gnu.org; Fri, 05 Dec 2014 09:55:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XwuIE-000288-Le for emacs-orgmode@gnu.org; Fri, 05 Dec 2014 09:55:44 -0500 Received: from plane.gmane.org ([80.91.229.3]:39409) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwuIE-00027l-G9 for emacs-orgmode@gnu.org; Fri, 05 Dec 2014 09:55:38 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XwuIC-0008Ol-UX for emacs-orgmode@gnu.org; Fri, 05 Dec 2014 15:55:36 +0100 Received: from 193.63.222.11 ([193.63.222.11]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 05 Dec 2014 15:55:36 +0100 Received: from andreas.leha by 193.63.222.11 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 05 Dec 2014 15:55:36 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi Zhihao, Zhihao Ding 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 wrote: >> >> Hi Zhihao, >> >> >> >> Zhihao Ding 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) for column width >>> doesn’t seem to round text for latex output, and (2) I need >>> to define column width in addition to . >>> 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 >> >>