0

I'm trying to export a table from org-mode to latex and have dynamic line-breaks/word-wrapping, so whenever a cell exceeds a certain length, it should wrap to the next line.

This is what the latex code should look like:

\begin{tabular}{p{0.35\linewidth}|p{0.6\linewidth}}
\end{tabular}

That seems to work when I manually edit the .tex file and convert to pdf again. Here is what my org code looks like:

#+ATTR_LATEX: :environment tabular :align p{0.35\linewidth}|p{0.6\linewidth}
...

Which produces this latex output:

\begin{tabular}{|l|l|}
...

How can I set the {|l|l|} to p{0.35\linewidth}|p{0.6\linewidth} in my org file?

Edit:

My solution was actually correct, the mistake was having the table in table.el format.

6
  • 1
    The :align spec that you have above worked for me: I get \begin{tabular}{p{0.35\linewidth}|p{0.6\linewidth}} in the LaTeX file. What version of Org mode are you running? – NickD Dec 17 '20 at 19:49
  • 1
    @NickD You're correct. It does work. Turns out it doesn't when using a table.el table. Thank you for your help. – b3nj4m1n Dec 17 '20 at 20:40
  • 1
    table.el tables are second-class citizens in Org mode unfortunately - there is very minimal support and AFAICT, currently the export is completely broken. – NickD Dec 17 '20 at 20:51
  • 1
    I submitted a bug report to the Org mode mailing list. – NickD Dec 17 '20 at 21:13
  • 1
    Nicolas Goaziou has fixed the bug that I reported: see this commit and this commit. This fixes the broken export but I don't think it does anything for your use case: table.el tables are still second-class citizens. – NickD Jan 5 at 0:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.