I have a snippet of Python code that outputs an Org mode formatted table. After I'm satisfied with the table, I would like to generate the LaTeX markup via orgtbl-to-latex
function.
For example, I have a source block similar to the following:
#+begin_src python :output table :results output drawer
print('\n'.join(('| factor | mean diff | t-value | p-value |',
'|--------+-----------+---------+---------|',
....))
#+end_src
Which generates the following, elided, output:
#+RESULTS:
:results:
| factor | mean diff | t-value | p-value |
|-------------------+-----------+----------+---------|
| A | -21.08 | -2.14404 | 0.03867 |
:end:
Now, I would prefer to name the output table such that I can pass it to an elisp block as such:
#+begin_src elisp :var tab=ttest :results raw drawer replace :colnames no
(orgtbl-to-latex tab nil)
#+end_src
I have not had luck using #+NAME
at the top of the generating source block, and I'm not sure what else to try. For now, I copy the table and name it so the orgtbl-to-latex
function operates on the copy. Similarly, I can change the python code to generate the LaTeX markup, but this is painful since it is easier to read the org table first to ensure I have the data formatted how I want before translating to LaTeX. More, moreover, I cannot author directly in Org mode since collaboration would be near impossible to deal with, so that's out as well.
This looks like the solution, but it's not using drawers. Is that my problem? Or is there a way to achieve this with drawers.