2

I have been using ox-pandoc to export my org-mode files (generally to pdf using pandoc and xelatex) but I am having a lot of trouble formatting images and tables. #+ATTR_LATEX commands for images is generally ignored, but I found a workaround for images using #+ATTR_HTML, for example:

image example no formatting added

#+CAPTION: not formatted
[[file:~/Dropbox/lab_notebook/screenshots/image.png]]

gives the following latex:

image example not formatted

  \begin{figure}
  \centering
  \includegraphics{~/Dropbox/lab_notebook/screenshots/image.png}
  \caption{not formatted}
  \end{figure}

image example formatted

#+CAPTION: latex formatted
#+ATTR_LATEX: :width 75% :placement [!htb]
[[file:~/Dropbox/lab_notebook/screenshots/image.png]]

basically strips away all formatting and gives the following latex

\includegraphics{~/Dropbox/lab_notebook/screenshots/image.png}

but with ATTR_HTML it works fine (besides ignoring the latex :placement)

#+CAPTION: formatted html
#+ATTR_HTML: :width 75% :placement [!htb]
[[file:~/Dropbox/lab_notebook/screenshots/image.png]]

gives this latex

 \begin{figure}
  \centering
  \includegraphics[width=0.75000\textwidth]{~/Dropbox/lab_notebook/screenshots/image.png}
  \caption{formatted html}
  \end{figure}

I have tried all the formatting for ATTR_LATEX listed in the org manual and they are all stripped away.

The ATTR_HTML (discussed here) workaround works for images, but it fails with tables. No matter what html or latex formatting I specify for tables, the output is always the same.

HTML attr

#+ATTR_HTML: :width 480
   | Condition | table  | example  | here     |
   |-----------+--------+----------+----------|
   | ex        | Normal | Normal   | Normal   |
   | am        | Normal | Abnormal | Abnormal |
   | ple       | Normal | Abnormal | Normal   |

gives the following latex

  \begin{longtable}[]{@{}llll@{}}
  \toprule
  Condition & table & example & here\tabularnewline
  \midrule
  \endhead
  ex & Normal & Normal & Normal\tabularnewline
  am & Normal & Abnormal & Abnormal\tabularnewline
  ple & Normal & Abnormal & Normal\tabularnewline
  \bottomrule
  \end{longtable}

and attr_latex formatted

#+ATTR_LATEX: :environment longtable :align l|lp{3cm}r|l
   | Condition | table  | example  | here     |
   |-----------+--------+----------+----------|
   | ex        | Normal | Normal   | Normal   |
   | am        | Normal | Abnormal | Abnormal |
   | ple       | Normal | Abnormal | Normal   |

gives the following latex

 \begin{longtable}[]{@{}llll@{}}
  \toprule
  Condition & table & example & here\tabularnewline
  \midrule
  \endhead
  ex & Normal & Normal & Normal\tabularnewline
  am & Normal & Abnormal & Abnormal\tabularnewline
  ple & Normal & Abnormal & Normal\tabularnewline
  \bottomrule
  \end{longtable}

Am i missing a setting or tag attribute? how can I specify formatting for tables and images for export?

Nick
  • 33
  • 3
  • Off-topic: Why do you prefer producing PDFs through Pandoc, instead of using Org Mode's usual PDF (through LaTeX) export? – Omar Jun 06 '17 at 16:33
  • I started using ox-pandoc because i could not get minted to highlight my source code despite using [this](https://emacs.stackexchange.com/questions/27982/export-code-blocks-in-org-mode-with-minted-environment) setup. Pandoc formats the source code quite nicely but I suppose I should switch back and try to figure out my problem with the org-mode parser. – Nick Jun 07 '17 at 14:39

0 Answers0