title: How to export a org-mode table to LaTeX with the correct placement [h]?
body: <p>I'm trying to export a table to LaTeX form my org-file which looks like this:</p>
  <pre><code>    #+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
  </code></pre>
  <p>I want to get the exported TeX to look like this:</p>
  <pre><code>    ... 
      \begin{table}[h]
      \caption{my caption}
      \label{tab:mylabel}
      \centering
      \adjustbox{max width=\linewidth}{
      \begin{tabular}{ll}
       &amp; \\
      id &amp; Question\\
      \hline
       &amp; \\
      1 &amp; Does it export with [h]?\\
      \end{tabular}
      \end{table}
      ...
  </code></pre>
  <p>but I'm just getting</p>
  <pre><code>    ... 
      \begin{table}
      \caption{my caption}
      \label{tab:mylabel}
      \centering
      \adjustbox{max width=\linewidth}{
      \begin{tabular}{ll}
       &amp; \\
      id &amp; Question\\
      \hline
       &amp; \\
      1 &amp; Does it export with [h]?\\
      \end{tabular}
      \end{table}
      ...
  </code></pre>
  <p>using  the following versions</p>
  <p><i>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</i></p>
  <p><i>Org mode version 9.0.5 (release_9.0.5-444-g998576 @ ~/git/org-mode/lisp/)</i></p>
  <p>I also tried</p>
  <p><code>#+ATTR_LATEX: :float t :placement [h]</code></p>
  <p><code>#+ATTR_LATEX: :center nil :float t :placement [h]</code></p>
  <p><code>#+ATTR_LATEX: :center nil :placement [h]</code></p>
  <p><code>#+begin_table :placement [h]</code></p>
  <p><code>#+begin_table :float t :placement [h]</code></p>
  <p>My search on the internet only found some emails from 2010, when org-latex.el existed. Since it still exists in the documentation I thought it should work somehow.</p>
  <p>So can anyone help me? Or leak the magic words I have to feed Google with to find my answer?</p>
  <hr />
  <p>Thx @Nick, we're on the right way but sadly not at the end of it.</p>
  <p>Well I did not want to break the parsing, it explains some things.
  I've got some more requirements and things to explain.</p>
  <p>At First some of my tables are a bit wider like this:</p>
  <pre><code>   | 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 |
  </code></pre>
  <p>The Adjustbox package is the first I found that shrinks the whole table to the correct width. I tried your suggested <code>tabularx</code> but it's not shrinking the contents of the table. Without the shrinking most of my tables look weird.</p>
  <p>The second Thing, I'm using <code>org-ref</code>. With your version (which I would prefer when the 2 probs are gone) exports to:</p>
  <pre><code>   \caption{\label{tab:org56e3a68}
     My caption}  
  </code></pre>
  <p>I added <code>#+label: tab:my-label</code> as intended in the documentation. Added it before and after <code>#+caption:</code> and <code>#+name:</code> but it does not change anything in the <code>.tex</code> file.</p>
  <p>any idea?</p>