I'm trying to export a table to LaTeX form my org-file which looks like this.
#+LATEX_HEADER: \usepackage{adjustbox}
* table test
#+begin_table
#+LATEX: \caption{my caption}
label:tab:mylabel
#+ATTR_LATEX: :placement [h]
#+LATEX: \centering
#+LATEX: \adjustbox{max width=\linewidth}{
#+ATTR_LATEX: :center nil
| | |
| id | Question |
|----+--------------------------|
| | |
| 1 | Does it export with [h]? |
#+end_table
I want to get the exported TeX to look like this:
...
\begin{table}[h]
\caption{my caption}
\label{tab:mylabel}
\centering
\adjustbox{max width=\linewidth}{
\begin{tabular}{ll}
& \\
id & Question\\
\hline
& \\
1 & Does it export with [h]?\\
\end{tabular}
\end{table}
...
but only I'm just getting
...
\begin{table}
\caption{my caption}
\label{tab:mylabel}
\centering
\adjustbox{max width=\linewidth}{
\begin{tabular}{ll}
& \\
id & Question\\
\hline
& \\
1 & Does it export with [h]?\\
\end{tabular}
\end{table}
...
using the following versions
GNU Emacs 25.1.1 (x86_64-apple-darwin15.5.0, NS appkit-1404.47 Version 10.11.5 (Build 15F34)) of 2017-01-06
Org mode version 9.0.5 (release_9.0.5-444-g998576 @ ~/git/org-mode/lisp/)
I also tried
#+ATTR_LATEX: :float t :placement [h]
#+ATTR_LATEX: :center nil :float t :placement [h]
#+ATTR_LATEX: :center nil :placement [h]
#+begin_table :placement [h]
#+begin_table :float t :placement [h]
My search on the internet only found some emails from 2010, where org-latex.el existed. Since it is still exists in the documentation I thought it should work some how.
So can anyone help me? Or leak the magic words I have to feed Google with to find my answer?
Thx @Nick, we're on the right way bud sadly not at the end of it.
Well I did not want to brake the parsing, it explains some things. I've got some more requirements and things to explain.
At First some of my tables are a bit wider like this:
| id | Question |
|----+---------------------------------------------------------------------------------------------------------------------------|
| 1 | Does it export with [h]? |
| 2 | I have some tables witch are very wide so What if you have a really wide table wich needs to be shrinked to the right size |
The Adjustbox package is the first I found that shrinks the whole tavle to the correct width. I tried your suggested tabulrx
but it's not shrinking the contents of the table. Without the shrinking most of my tables look wired.
The second Thing, I'm using org-ref
. With your version (witch I would prefer when the 2 probs are gone) exports on my box to:
\caption{\label{tab:org56e3a68}
My caption}
I added #+lable: tab:my-label
as intended in the documentation. Addet it before and after #+caption:
and #+name:
but it dos not change anything in the .tex file.
any idea?
:placement [h]
, not:plcement [h]
. Untested. – NickD:placement [h]
– Dings