emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* LaTeX export ignores caption if table is in a drawer
@ 2023-05-26  0:48 Richard H. Stanton
  2023-05-26  6:33 ` Ihor Radchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Richard H. Stanton @ 2023-05-26  0:48 UTC (permalink / raw)
  To: emacs-orgmode

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? 

[By the way, this would be particularly helpful at the moment, as for some reason emacs-jupyter currently seems to put all results in a drawer regardless of whether you ask it to or not…).

Thanks.

Richard Stanton




———

#+caption: Small table
| C1 | C2 |
|----+----|

#+caption: Small table
:results:
| C1 | C2 |
|----+----|
:end:


———

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: LaTeX export ignores caption if table is in a drawer
  2023-05-26  0:48 LaTeX export ignores caption if table is in a drawer Richard H. Stanton
@ 2023-05-26  6:33 ` Ihor Radchenko
  2023-05-26 16:51   ` Richard Stanton
  0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2023-05-26  6:33 UTC (permalink / raw)
  To: Richard H. Stanton; +Cc: emacs-orgmode

"Richard H. Stanton" <rhstanton@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>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: LaTeX export ignores caption if table is in a drawer
  2023-05-26  6:33 ` Ihor Radchenko
@ 2023-05-26 16:51   ` Richard Stanton
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Stanton @ 2023-05-26 16:51 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Thanks, Ihor.

":results raw replace" seems to do what I need.

Best,

Richard


> On May 25, 2023, at 11:33 PM, Ihor Radchenko <yantar92@posteo.net> wrote:
> 
> "Richard H. Stanton" <rhstanton@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>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-26 16:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-26  0:48 LaTeX export ignores caption if table is in a drawer Richard H. Stanton
2023-05-26  6:33 ` Ihor Radchenko
2023-05-26 16:51   ` Richard Stanton

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).