emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* resize org-table when exporting to latex
@ 2017-02-28  0:21 Jeremie Juste
  2017-02-28  2:56 ` Nick Dokos
  2017-02-28 14:17 ` Vicente Vera
  0 siblings, 2 replies; 3+ messages in thread
From: Jeremie Juste @ 2017-02-28  0:21 UTC (permalink / raw)
  To: emacs-orgmode


Hello,

Is there a way to resize latex table when exporting to latex?
For now my only recourse is to export the latex table copy the latex
code back to org-mode apply \scalebox.

Do you have a more convenient way in mind?

Best wishes,

Jeremie

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: resize org-table when exporting to latex
  2017-02-28  0:21 resize org-table when exporting to latex Jeremie Juste
@ 2017-02-28  2:56 ` Nick Dokos
  2017-02-28 14:17 ` Vicente Vera
  1 sibling, 0 replies; 3+ messages in thread
From: Nick Dokos @ 2017-02-28  2:56 UTC (permalink / raw)
  To: emacs-orgmode

Jeremie Juste <jeremiejuste@gmail.com> writes:

> Hello,
>
> Is there a way to resize latex table when exporting to latex?
> For now my only recourse is to export the latex table copy the latex
> code back to org-mode apply \scalebox.
>
> Do you have a more convenient way in mind?
>

You need to use tabularx - something like this:

--8<---------------cut here---------------start------------->8---
#+LATEX_HEADER: \usepackage{tabularx}

* Export a table

#+CAPTION: foo
#+NAME: bar
#+ATTR_LATEX: :environment tabularx :width .8\textwidth :align X|X|X|X
| a | b | c | d | 
|---+---+---+---|
| 1 | 2 | 3 | 4 |

--8<---------------cut here---------------end--------------->8---

-- 
Nick

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: resize org-table when exporting to latex
  2017-02-28  0:21 resize org-table when exporting to latex Jeremie Juste
  2017-02-28  2:56 ` Nick Dokos
@ 2017-02-28 14:17 ` Vicente Vera
  1 sibling, 0 replies; 3+ messages in thread
From: Vicente Vera @ 2017-02-28 14:17 UTC (permalink / raw)
  To: Jeremie Juste; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1482 bytes --]

This requires some LaTeX plumbing work. A few tricks:

First, use tabularx as suggested to stretch the columns automatically as
the size of the table changes.

- Use a smaller font size, such as :font \scriptsize
- Enlarge the table horizontally (for example: :width 0.8\paperheight)
- Put the page in landscape with the "pdflscape" package: wrap the table
with "#+BEGIN_landscape ... #+END_landscape" and change :width to
\paperheight
- Use package "graphicx" and wrap the table in "#+LATEX:
\resizebox{0.8\paperheight}{!}{ ... #+LATEX: }" to make the whole table
smaller

An example of the above in Org syntax (remember to call the necessary
packages):

#+BEGIN_landscape
#+ATTR_LATEX: :options [htbp]
#+BEGIN_table
#+BEGIN_center
#+LATEX: \resizebox{0.8\paperheight}{!}{
#+CAPTION: A big table made small
#+BEGIN_threeparttable
#+ATTR_LATEX: :center nil :environment tabularx :width \paperheight :align
XXXXXXXX :font \scriptsize :booktabs t
...
#+ATTR_LATEX: :options [flushleft]
#+BEGIN_tablenotes
\item[] Source: Someone on the Internet.
#+END_tablenotes
#+END_threeparttable
#+LATEX: }
#+END_center
#+END_table
#+END_landscape


2017-02-28 0:21 GMT+00:00 Jeremie Juste <jeremiejuste@gmail.com>:

>
> Hello,
>
> Is there a way to resize latex table when exporting to latex?
> For now my only recourse is to export the latex table copy the latex
> code back to org-mode apply \scalebox.
>
> Do you have a more convenient way in mind?
>
> Best wishes,
>
> Jeremie
>
>
>
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 2039 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-28 14:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-28  0:21 resize org-table when exporting to latex Jeremie Juste
2017-02-28  2:56 ` Nick Dokos
2017-02-28 14:17 ` Vicente Vera

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).