Thanks, Ihor. ":results raw replace" seems to do what I need.
Best, Richard > On May 25, 2023, at 11:33 PM, Ihor Radchenko <yanta...@posteo.net> wrote: > > "Richard H. Stanton" <rhstan...@berkeley.edu> writes: > >> I often create tables programatically from within an org code block. To make >> sure I don’t produce multiple copies of the output, I like to enclose the >> results in a drawer. However, the exporter seems to ignore any caption I >> might assign if the table itself is inside a drawer. For example, if you >> export the sample org file below to LaTeX, the first table gets exported >> with caption, the second without. Would it be possible for the exporter to >> keep the caption in the second case as well? >> ... >> #+caption: Small table >> | C1 | C2 | >> |----+----| >> >> #+caption: Small table >> :results: >> | C1 | C2 | >> |----+----| >> :end: > > The second example has a drawer with caption, not a table with caption. > Captions in drawers are ignored (or rather it is undefined behaviour). > > I recommend not wrapping tables into drawers in your use case - it is > not necessary if you just have a table in the output. If you have > multiple things, with table coming first, it would be unclear which part > you want to assign the caption to; so you would need to arrange yourself > to create table result with caption inside the drawer. > > -- > Ihor Radchenko // yantar92, > Org mode contributor, > Learn more about Org mode at <https://orgmode.org/>. > Support Org development at <https://liberapay.com/org-mode>, > or support my work at <https://liberapay.com/yantar92>