2

I have a document I have written in org-mode which contains several tables. The tables all have the following attributes.

#+begin_table
#+LATEX: \caption{Initial risk List}
#+LATEX: \label{tab:risk-list}
#+LATEX: \centering
#+LATEX: \adjustbox{max width=\textwidth}{
#+ATTR_LATEX: :center t :placement [h]
|Col1|Col2|
|----+----|
| 1  | 2  |
|----+----|
#+end_table

The configuration is to allow my tables to scale correctly for my document without running off the page which works, however, the [h] argument isn't being read by LaTeX as all the tables get places on one page together in the pdf document instead of being at their positions in the text where I want them. Am I passing the wrong latex configuration or is it just not picking it up during the parsing? I am using spacemacs by the way I'm not sure if that changes anything.

After looking at the tex file org produced it seems there is no placement values put into the document.

4
  • Does this help? Basically, don't use [h], use [!htbp].
    – NickD
    Dec 10, 2018 at 23:52
  • Thanks for the help! But unfortunately it did not
    – Ben Moore
    Dec 10, 2018 at 23:57
  • I was using the table environment to keep the adjust box contained to just the table
    – Ben Moore
    Dec 11, 2018 at 14:52
  • I don't know how \adjustbox works, but it seems not the like the center environment that org-export generates around the tabular. There is also a syntax error: you need add a closing brace to close the \adjustbox argument (and of course you need to \usepackage{adjustbox} somehow, but I imagine that's been done).
    – NickD
    Dec 11, 2018 at 17:42

2 Answers 2

3

After looking at the problem for a while I found this solution.

 #+LATEX: \begin{adjustbox}{width={\textwidth},keepaspectratio}
 #+ATTR_LATEX: :placement [!h]  
 #+LATEX: \centering
|Col1|Col2|
|----+----|
| 1  | 2  |
|----+----|
#+LATEX: \end{adjustbox}

While also including

#+LATEX_HEADER: \usepackage{adjustbox}

At the top of the document.

0

Add this to header:

#+LATEX_HEADER: \usepackage{float}
#+LATEX_HEADER: \restylefloat{table}

And then write your tables like this:

#+CAPTION: ML Algorithms
#+NAME: ml-algos-table
#+ATTR_LATEX: :center t :placement [H]
|----+----|
|Col1|Col2|
|----+----|
| 1  | 2  |
|----+----|

Also refer this and this

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.