* When src block result is an image, how to define caption, html and latex attributes ?
@ 2024-04-09 14:11 Sébastien Gendre
2024-04-09 14:29 ` Ihor Radchenko
2024-04-09 15:59 ` Fraga, Eric
0 siblings, 2 replies; 10+ messages in thread
From: Sébastien Gendre @ 2024-04-09 14:11 UTC (permalink / raw)
To: orgmode
Hello,
When a source block create a result who is an image, how can I define
the #+CAPTION, #+LATEX_ATTR and #+HTML_ATTR of this image ?
If I add them manually after the result generation, and generate again
the result, the #+CAPTION, #+LATEX_ATTR and #+HTML_ATTR are moved after
the result.
In org-babel documentation, I didn't found any header argument like
":result-caption" or something similar. There is a post processing, but
I cannot found the list of available post processing actions and their
config.
Best regards
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: When src block result is an image, how to define caption, html and latex attributes ?
2024-04-09 14:11 When src block result is an image, how to define caption, html and latex attributes ? Sébastien Gendre
@ 2024-04-09 14:29 ` Ihor Radchenko
2024-04-09 16:50 ` Sébastien Gendre
2024-04-09 15:59 ` Fraga, Eric
1 sibling, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2024-04-09 14:29 UTC (permalink / raw)
To: Sébastien Gendre; +Cc: orgmode
Sébastien Gendre <seb@k-7.ch> writes:
> When a source block create a result who is an image, how can I define
> the #+CAPTION, #+LATEX_ATTR and #+HTML_ATTR of this image ?
>
> If I add them manually after the result generation, and generate again
> the result, the #+CAPTION, #+LATEX_ATTR and #+HTML_ATTR are moved after
> the result.
I am unable to reproduce. The updated result does not displace the
affiliated keywords on my side, using the latest main and the latest
stable Org mode version.
--
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] 10+ messages in thread
* Re: When src block result is an image, how to define caption, html and latex attributes ?
2024-04-09 14:11 When src block result is an image, how to define caption, html and latex attributes ? Sébastien Gendre
2024-04-09 14:29 ` Ihor Radchenko
@ 2024-04-09 15:59 ` Fraga, Eric
2024-04-09 16:58 ` Sébastien Gendre
1 sibling, 1 reply; 10+ messages in thread
From: Fraga, Eric @ 2024-04-09 15:59 UTC (permalink / raw)
To: Sébastien Gendre; +Cc: orgmode
On Tuesday, 9 Apr 2024 at 16:11, Sébastien Gendre wrote:
> If I add them manually after the result generation, and generate again
> the result, the #+CAPTION, #+LATEX_ATTR and #+HTML_ATTR are moved after
> the result.
Does this happen if your src block is NAMEd?
--
: Eric S Fraga, with org release_9.6.23-1314-g945046 in Emacs 30.0.50
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: When src block result is an image, how to define caption, html and latex attributes ?
2024-04-09 14:29 ` Ihor Radchenko
@ 2024-04-09 16:50 ` Sébastien Gendre
2024-04-09 17:13 ` Ihor Radchenko
0 siblings, 1 reply; 10+ messages in thread
From: Sébastien Gendre @ 2024-04-09 16:50 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: orgmode
If I place the #+CAPTION: and #+HTML_ATTR before the #+RESULTS:, then
generate again the result of the source block, I got a new #+RESULTS: on
top of the previous and its caption and html attributes.
Example, before regenerate the source block result:
#+CAPTION: Test image
#+HTML_ATTR: :width 30px
#+RESULTS:
[[file:images/simple-test.png]]
And after regenerate the source block result:
#+RESULTS:
[[file:images/simple-test.png]]
#+CAPTION: Test image
#+HTML_ATTR: :width 30px
#+RESULTS:
[[file:images/simple-test.png]]
My version of Org-mode is 9.6.15
Ihor Radchenko <yantar92@posteo.net> writes:
> Sébastien Gendre <seb@k-7.ch> writes:
>
>> When a source block create a result who is an image, how can I define
>> the #+CAPTION, #+LATEX_ATTR and #+HTML_ATTR of this image ?
>>
>> If I add them manually after the result generation, and generate again
>> the result, the #+CAPTION, #+LATEX_ATTR and #+HTML_ATTR are moved after
>> the result.
>
> I am unable to reproduce. The updated result does not displace the
> affiliated keywords on my side, using the latest main and the latest
> stable Org mode version.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: When src block result is an image, how to define caption, html and latex attributes ?
2024-04-09 15:59 ` Fraga, Eric
@ 2024-04-09 16:58 ` Sébastien Gendre
2024-04-10 7:06 ` Fraga, Eric
0 siblings, 1 reply; 10+ messages in thread
From: Sébastien Gendre @ 2024-04-09 16:58 UTC (permalink / raw)
To: Fraga, Eric; +Cc: orgmode
If I name the source block, it work.
Is it because:
* When a source block is named, it's result is also named
* When a result is named, Org-mode can locate it and replace its value
* But when a result is not named, Org-mode insert a #+RESULTS: just
after the block and create a new one if it cannot found the previous
one right after the block
?
"Fraga, Eric" <e.fraga@ucl.ac.uk> writes:
> On Tuesday, 9 Apr 2024 at 16:11, Sébastien Gendre wrote:
>> If I add them manually after the result generation, and generate again
>> the result, the #+CAPTION, #+LATEX_ATTR and #+HTML_ATTR are moved after
>> the result.
>
> Does this happen if your src block is NAMEd?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: When src block result is an image, how to define caption, html and latex attributes ?
2024-04-09 16:50 ` Sébastien Gendre
@ 2024-04-09 17:13 ` Ihor Radchenko
2024-04-09 18:20 ` Sébastien Gendre
0 siblings, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2024-04-09 17:13 UTC (permalink / raw)
To: Sébastien Gendre; +Cc: orgmode
Sébastien Gendre <seb@k-7.ch> writes:
> Example, before regenerate the source block result:
>
>
>
> #+CAPTION: Test image
> #+HTML_ATTR: :width 30px
> #+RESULTS:
> [[file:images/simple-test.png]]
You have a typo in one of the affiliated keywords.
Should be
#+ATTR_HTML: :width 30px
#+HTML_ATTR: is a very different construct - a full keyword rather than
affiliated keyword. So Org mode sees your
#+CAPTION: Test image
#+HTML_ATTR: :width 30px
and then
#+RESULTS:
[[file:images/simple-test.png]]
as two separate paragraph-like elements, while babel is only looking at
the first following elements for an existing result when the block is
not named.
P.S.
We should really indicate the difference between normal and affiliated
keywords better.
--
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] 10+ messages in thread
* Re: When src block result is an image, how to define caption, html and latex attributes ?
2024-04-09 17:13 ` Ihor Radchenko
@ 2024-04-09 18:20 ` Sébastien Gendre
2024-04-09 18:37 ` Ihor Radchenko
0 siblings, 1 reply; 10+ messages in thread
From: Sébastien Gendre @ 2024-04-09 18:20 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: orgmode
Ihor Radchenko <yantar92@posteo.net> writes:
> P.S.
>
> We should really indicate the difference between normal and affiliated
> keywords better.
What do you mean ?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: When src block result is an image, how to define caption, html and latex attributes ?
2024-04-09 18:20 ` Sébastien Gendre
@ 2024-04-09 18:37 ` Ihor Radchenko
0 siblings, 0 replies; 10+ messages in thread
From: Ihor Radchenko @ 2024-04-09 18:37 UTC (permalink / raw)
To: Sébastien Gendre; +Cc: orgmode
Sébastien Gendre <seb@k-7.ch> writes:
>> P.S.
>>
>> We should really indicate the difference between normal and affiliated
>> keywords better.
>
> What do you mean ?
You are not the first person stumbling upon this exact wrinkle with src
block results. So, it would be nice to address it somehow.
--
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] 10+ messages in thread
* Re: When src block result is an image, how to define caption, html and latex attributes ?
2024-04-09 16:58 ` Sébastien Gendre
@ 2024-04-10 7:06 ` Fraga, Eric
2024-04-10 14:55 ` Sébastien Gendre
0 siblings, 1 reply; 10+ messages in thread
From: Fraga, Eric @ 2024-04-10 7:06 UTC (permalink / raw)
To: Sébastien Gendre; +Cc: orgmode
On Tuesday, 9 Apr 2024 at 18:58, Sébastien Gendre wrote:
> If I name the source block, it work.
Excellent.
> Is it because:
>
> * When a source block is named, it's result is also named
>
> * When a result is named, Org-mode can locate it and replace its value
>
> * But when a result is not named, Org-mode insert a #+RESULTS: just
> after the block and create a new one if it cannot found the previous
> one right after the block
Yes, pretty much my understanding. I tend to name every src block
anyway as it makes navigation easier (using
org-babel-goto-named-src-block).
--
: Eric S Fraga, with org release_9.6.23-1314-g945046 in Emacs 30.0.50
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: When src block result is an image, how to define caption, html and latex attributes ?
2024-04-10 7:06 ` Fraga, Eric
@ 2024-04-10 14:55 ` Sébastien Gendre
0 siblings, 0 replies; 10+ messages in thread
From: Sébastien Gendre @ 2024-04-10 14:55 UTC (permalink / raw)
To: Fraga, Eric; +Cc: orgmode
"Fraga, Eric" <e.fraga@ucl.ac.uk> writes:
> I tend to name every src block
> anyway as it makes navigation easier (using
> org-babel-goto-named-src-block).
I didn't know this function exist. Thank you very much. :)
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-04-10 14:57 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-09 14:11 When src block result is an image, how to define caption, html and latex attributes ? Sébastien Gendre
2024-04-09 14:29 ` Ihor Radchenko
2024-04-09 16:50 ` Sébastien Gendre
2024-04-09 17:13 ` Ihor Radchenko
2024-04-09 18:20 ` Sébastien Gendre
2024-04-09 18:37 ` Ihor Radchenko
2024-04-09 15:59 ` Fraga, Eric
2024-04-09 16:58 ` Sébastien Gendre
2024-04-10 7:06 ` Fraga, Eric
2024-04-10 14:55 ` Sébastien Gendre
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).