emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* issues with export of LaTeX figure captions
@ 2013-05-06  0:50 RJ Cunningham
  2013-05-06  7:18 ` Sebastien Vauban
  0 siblings, 1 reply; 4+ messages in thread
From: RJ Cunningham @ 2013-05-06  0:50 UTC (permalink / raw)
  To: emacs-orgmode

G'day fellow orgmode users,

I've encountered an issue/difference with the way the recent "babel
processor" handles captions.

In versions prior to 8 the following WORKED (on export produced a figure
environment with a caption):

#+CAPTION: Fails to produce table environment and so caption in the new orgmode
#+LABEL: fig:fails
#+begin_src R :session :results graphics :file fails.pdf :exports results
plot(1:10)
#+end_src

Under orgmode version 8.0.2 (8.0.2-2-g93da18-elpa the same code does
not work, the includegraphics is exported sans the figure environment.


Under this latest orgmode the following does work:

#+begin_src R :session :results graphics :file ok.pdf :exports results
plot(1:10)
#+end_src

#+CAPTION: Succeeds to produce table environment and so caption
#+LABEL: fig:OK
#+RESULTS[2d39a23f088d95e808bb867f97a0ecd2df621bbd]:
[[file:ok.pdf]]



However, this second construction of code has the following issues:
 1. it is different to prior method which worked
 2. it is ugly to have the caption sandwiched between the code and the
 results
 3. often, but not always, when the code is re-executed the caption and
 label is lost

I also see that HTML export also fails to produce a caption.


Is this an issue in orgmode that can be addressed or is it an issue with
my understanding? I must admit as much as I like org-babel I have long
found the options for headers and arguments hard to understand well.


Cheers,

Robert Cunningham

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

* Re: issues with export of LaTeX figure captions
  2013-05-06  0:50 issues with export of LaTeX figure captions RJ Cunningham
@ 2013-05-06  7:18 ` Sebastien Vauban
  2013-05-06  9:39   ` RJ Cunningham
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastien Vauban @ 2013-05-06  7:18 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi RJ,

RJ Cunningham wrote:
> I've encountered an issue/difference with the way the recent "babel
> processor" handles captions.
>
> In versions prior to 8 the following WORKED (on export produced a figure
> environment with a caption):
>
> #+CAPTION: Fails to produce table environment and so caption in the new orgmode
> #+LABEL: fig:fails
> #+begin_src R :session :results graphics :file fails.pdf :exports results
> plot(1:10)
> #+end_src

Side-remark: I find it weird, if not uncorrect, to have the header argument
":session" empty. IIRC, this is, at best, dangerous, because it could
interpret what follows as its value.

> Under orgmode version 8.0.2 (8.0.2-2-g93da18-elpa the same code does
> not work, the includegraphics is exported sans the figure environment.
>
> Under this latest orgmode the following does work:
>
> #+begin_src R :session :results graphics :file ok.pdf :exports results
> plot(1:10)
> #+end_src
> #+CAPTION: Succeeds to produce table environment and so caption
> #+LABEL: fig:OK
> #+RESULTS[2d39a23f088d95e808bb867f97a0ecd2df621bbd]:
> [[file:ok.pdf]]
>
> However, this second construction of code has the following issues:
>  1. it is different to prior method which worked

Yes, a lot of changes have been made in Org 8. This is for good, even if the
switch can be somewhat painful.

>  2. it is ugly to have the caption sandwiched between the code and the
>  results

Not really. Please well think that there are two different beasts here: the
code block and the results block. You can export both, and you could attach
(different) captions to both. So, that does not seems that illogical to me.

>  3. often, but not always, when the code is re-executed the caption and
>  label is lost

Can you provide an ECM for this?

> I also see that HTML export also fails to produce a caption.

Confirmed, in a 1-min test. Though, I had the impression that captions were
handled in ox-html. To be further checked.

> Is this an issue in orgmode that can be addressed or is it an issue with
> my understanding? I must admit as much as I like org-babel I have long
> found the options for headers and arguments hard to understand well.

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: issues with export of LaTeX figure captions
  2013-05-06  7:18 ` Sebastien Vauban
@ 2013-05-06  9:39   ` RJ Cunningham
  2013-05-06 12:11     ` Sebastien Vauban
  0 siblings, 1 reply; 4+ messages in thread
From: RJ Cunningham @ 2013-05-06  9:39 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: emacs-orgmode

Thanks for the reply Seb,

"Sebastien Vauban" <sva-news@mygooglest.com> writes:

> Hi RJ,
>
> RJ Cunningham wrote:
>> I've encountered an issue/difference with the way the recent "babel
>> processor" handles captions.
>>
>> In versions prior to 8 the following WORKED (on export produced a figure
>> environment with a caption):
>>
>> #+CAPTION: Fails to produce table environment and so caption in the new orgmode
>> #+LABEL: fig:fails
>> #+begin_src R :session :results graphics :file fails.pdf :exports results
>> plot(1:10)
>> #+end_src
>
> Side-remark: I find it weird, if not uncorrect, to have the header argument
> ":session" empty. IIRC, this is, at best, dangerous, because it could
> interpret what follows as its value.

I guess it could be dangerous, though it is convenient and I don't
believe it has ever caused me any issues. I note that at one time, at
least, a name was an optional argument for the :session header (see
http://www.jstatsoft.org/v46/i03/paper p 10). I will consider being less
weird though as you suggest.

>
>> Under orgmode version 8.0.2 (8.0.2-2-g93da18-elpa the same code does
>> not work, the includegraphics is exported sans the figure environment.
>>
>> Under this latest orgmode the following does work:
>>
>> #+begin_src R :session :results graphics :file ok.pdf :exports results
>> plot(1:10)
>> #+end_src
>> #+CAPTION: Succeeds to produce table environment and so caption
>> #+LABEL: fig:OK
>> #+RESULTS[2d39a23f088d95e808bb867f97a0ecd2df621bbd]:
>> [[file:ok.pdf]]
>>
>> However, this second construction of code has the following issues:
>>  1. it is different to prior method which worked
>
> Yes, a lot of changes have been made in Org 8. This is for good, even if the
> switch can be somewhat painful.

Indeed.

>
>>  2. it is ugly to have the caption sandwiched between the code and the
>>  results
>
> Not really. Please well think that there are two different beasts here: the
> code block and the results block. You can export both, and you could attach
> (different) captions to both. So, that does not seems that illogical to me.

OK, that is not something I have ever needed but I see that it would
make sense in such a situation. Is there any way that I can export
figures with captions WITHOUT having to execute the code and capture the
results in the org file. With the previous construction the caption was
added to the executed code results on export-so reducing the clutter in the
org file by not having the results in the org file.


>>  3. often, but not always, when the code is re-executed the caption and
>>  label is lost
>
> Can you provide an ECM for this?
>

The problem seems to relate to :cache

This gobbles up the caption and label. 

#+begin_src R :session :results graphics :file ok.pdf :exports results :cache yes
plot(1:10, col="blue",cex=1)
#+end_src

#+CAPTION: Succeeds to produce table environment and so caption XXXX
#+LABEL: fig:OK
#+RESULTS:
[[file:ok.pdf]]


:cache no is fine



Cheers,

Robert

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

* Re: issues with export of LaTeX figure captions
  2013-05-06  9:39   ` RJ Cunningham
@ 2013-05-06 12:11     ` Sebastien Vauban
  0 siblings, 0 replies; 4+ messages in thread
From: Sebastien Vauban @ 2013-05-06 12:11 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi RJ,

RJ Cunningham wrote:
> "Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org> writes:
>> RJ Cunningham wrote:
>>> I've encountered an issue/difference with the way the recent "babel
>>> processor" handles captions.
>>>
>>> In versions prior to 8 the following WORKED (on export produced a figure
>>> environment with a caption):
>>>
>>> #+CAPTION: Fails to produce table environment and so caption in the new orgmode
>>> #+LABEL: fig:fails
>>> #+begin_src R :session :results graphics :file fails.pdf :exports results
>>> plot(1:10)
>>> #+end_src
>>
>> Side-remark: I find it weird, if not uncorrect, to have the header argument
>> ":session" empty. IIRC, this is, at best, dangerous, because it could
>> interpret what follows as its value.
>
> I guess it could be dangerous, though it is convenient and I don't
> believe it has ever caused me any issues. I note that at one time, at
> least, a name was an optional argument for the :session header (see
> http://www.jstatsoft.org/v46/i03/paper p 10). I will consider being less
> weird though as you suggest.

It never occurred to me that there could be a default name (see
http://orgmode.org/manual/session.html#session), but OK, maybe. Anyway, I told
you that because I once had the problem of the following header arg eaten as
the option given to the previous one, though not with ":session".

>>> Under orgmode version 8.0.2 (8.0.2-2-g93da18-elpa the same code does
>>> not work, the includegraphics is exported sans the figure environment.
>>>
>>> Under this latest orgmode the following does work:
>>>
>>> #+begin_src R :session :results graphics :file ok.pdf :exports results
>>> plot(1:10)
>>> #+end_src
>>> #+CAPTION: Succeeds to produce table environment and so caption
>>> #+LABEL: fig:OK
>>> #+RESULTS[2d39a23f088d95e808bb867f97a0ecd2df621bbd]:
>>> [[file:ok.pdf]]
>>>
>>> However, this second construction of code has the following issues [...]:
>>>  2. it is ugly to have the caption sandwiched between the code and the
>>>  results
>>
>> Not really. Please well think that there are two different beasts here: the
>> code block and the results block. You can export both, and you could attach
>> (different) captions to both. So, that does not seems that illogical to me.
>
> OK, that is not something I have ever needed but I see that it would
> make sense in such a situation.

We do agree.

> Is there any way that I can export figures with captions WITHOUT having to
> execute the code and capture the results in the org file.

Once again, some question I never asked myself, always wanting to see at least
as much as what will be exported. But I understand your question, and a
possible good reason therefore (when the results is huge).

> With the previous construction the caption was added to the executed code
> results on export-so reducing the clutter in the org file by not having the
> results in the org file.

Honestly, I don't know. I would have the impression that you can't, but I may
be totally mislead...

>>>  3. often, but not always, when the code is re-executed the caption and
>>>  label is lost
>>
>> Can you provide an ECM for this?
>
> The problem seems to relate to :cache
>
> This gobbles up the caption and label.

If you did not execute the code block previously. Once pre-evaluated, your bug
does not appear anymore -- that does not mean it's not a problem, though.

> #+begin_src R :session :results graphics :file ok.pdf :exports results :cache yes
> plot(1:10, col="blue",cex=1)
> #+end_src
> #+CAPTION: Succeeds to produce table environment and so caption XXXX
> #+LABEL: fig:OK
> #+RESULTS:
> [[file:ok.pdf]]
>
> :cache no is fine

I don't have time right now to further try to understand and help you, but it
really is strange. I confirm your saying about with or without cache, but had
other strange behaviors trying to export (only one fig got exported when I had
the two blocks).

I can't commit on when, but I'll also try to better understand what happens
here. Maybe others (Eric, Nicolas, Achim...) will come earlier with hints
about this.

Best regards,
  Seb

-- 
Sebastien Vauban

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

end of thread, other threads:[~2013-05-06 12:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-06  0:50 issues with export of LaTeX figure captions RJ Cunningham
2013-05-06  7:18 ` Sebastien Vauban
2013-05-06  9:39   ` RJ Cunningham
2013-05-06 12:11     ` Sebastien Vauban

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).