Peter Tittmann <[email protected]> writes: > Minimal example: > > #+NAME: tab:summary > #+CAPTION: Summary statistics. > #+begin_src python :results value raw > return "| A | B |\n|---+---|\n| 1 | 2 |" > #+end_src > > On LaTeX export, the table has no \caption{} or \label{}. The caption > attaches to the source block element, not the results. > > Existing workarounds > -------------------- > > 1. Place #+NAME: / #+CAPTION: directly above the #+RESULTS: block. > This works but is overwritten on every re-execution, making it > impractical for active documents.
Hi, Peter, Your FR for a header may be helpful, but I can't reproduce the problem you experience with the first workaround (or as I think of it: the solution). Placing NAME and CAPTION directly above the RESULTS block works for me, and they are /not/ overwritten on re-execution. With a couple of extra headers to make it work in my test doc: #+NAME: tab:summary #+headers: :exports both :python python3 #+begin_src python :results value raw return "| A | B |\n|---+---|\n| 1 | 2 |" #+end_src #+name: tab:summary-generated #+caption: Summary statistics #+RESULTS: tab:summary | A | B | |---+---| | 1 | 2 | The table has a caption and the label [[tab:summary-generated]]. Both are exported to LaTeX/PDF. Regards, Christian
