emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* empty default captions for src blocks
@ 2014-04-14 14:04 Dominik Ernst
  2014-04-15 13:13 ` Dominik Ernst
  2014-04-17 15:11 ` Bastien
  0 siblings, 2 replies; 5+ messages in thread
From: Dominik Ernst @ 2014-04-14 14:04 UTC (permalink / raw)
  To: emacs-orgmode

Hallo,

I have a small question, I hope it is right here. The following org code:

#+CAPTION: caption of block 1
#+BEGIN_SRC
vmpovapd %%zmm0, %zmm1
#+END_SRC


#+BEGIN_SRC
vmpovapd %%zmm0, %zmm1
#+END_SRC

is exported (in my setup) to latex as:

\lstset{language=phiassembler,caption={caption of block1},numbers=none}
\begin{lstlisting}
vmpovapd %%zmm0, %zmm1
\end{lstlisting}

\begin{lstlisting}
vmpovapd %%zmm0, %zmm1
\end{lstlisting}

which results in the rendered pdf as two listings with the same caption, 
although only the first block has a caption. I think this is because of 
the lstlistings statemachine, that is maniupulated through lstset. It 
has an unchanged state in the second listing, which then gets the same 
caption.

Is there an easy way to  fix this? My hack so far is to modify 
ox-latex.el so that

2171:    (when caption-str `(("caption" ,caption-str)))

becomes:

2171:    (if caption-str `(("caption" ,caption-str)) `(("caption" ,"{}")) )

which adds a default empty caption, which makes everything behave like I 
want it to, so no wrong captions on source blocks where I define no 
caption. My org version is 8.2.5h.

Regards,
Dominik

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

* Re: empty default captions for src blocks
  2014-04-14 14:04 empty default captions for src blocks Dominik Ernst
@ 2014-04-15 13:13 ` Dominik Ernst
  2014-04-17 15:11 ` Bastien
  1 sibling, 0 replies; 5+ messages in thread
From: Dominik Ernst @ 2014-04-15 13:13 UTC (permalink / raw)
  To: emacs-orgmode

By the way, the same applies to labels. I had hoped, that moving the options
from lstset into [] brackets in front of the region would make it be valid
for that element only, but it did nothing.

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

* Re: empty default captions for src blocks
  2014-04-14 14:04 empty default captions for src blocks Dominik Ernst
  2014-04-15 13:13 ` Dominik Ernst
@ 2014-04-17 15:11 ` Bastien
  2014-04-17 16:22   ` Nicolas Goaziou
  1 sibling, 1 reply; 5+ messages in thread
From: Bastien @ 2014-04-17 15:11 UTC (permalink / raw)
  To: Dominik Ernst; +Cc: emacs-orgmode

Hi Dominik,

Dominik Ernst <dominik.ernst@gmx.de> writes:

> I have a small question, I hope it is right here.

It is!

> #+BEGIN_SRC
> vmpovapd %%zmm0, %zmm1
> #+END_SRC

(Btw, you need a language after BEGIN_SRC ...)

> which results in the rendered pdf as two listings with the same caption, 

Bug confirmed and fixed in maint, with a dummy fix:

Nicolas, do you see another way around this?

-- 
 Bastien

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

* Re: empty default captions for src blocks
  2014-04-17 15:11 ` Bastien
@ 2014-04-17 16:22   ` Nicolas Goaziou
  2014-04-17 16:25     ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2014-04-17 16:22 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Dominik Ernst

Hello,

Bastien <bzg@gnu.org> writes:

> Bug confirmed and fixed in maint, with a dummy fix:
>
> Nicolas, do you see another way around this?

Well, not really. But it looks like a bug on the "listings" side, not
the Org one. If we add a workaround in Org core, it may stay here
forever, even after the bug is fixed upstream. I think the OP should
first ask "listings" maintainer about it.


Regards,

-- 
Nicolas Goaziou

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

* Re: empty default captions for src blocks
  2014-04-17 16:22   ` Nicolas Goaziou
@ 2014-04-17 16:25     ` Bastien
  0 siblings, 0 replies; 5+ messages in thread
From: Bastien @ 2014-04-17 16:25 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Dominik Ernst

Hi Nicolas,

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Well, not really. But it looks like a bug on the "listings" side, not
> the Org one. If we add a workaround in Org core, it may stay here
> forever, even after the bug is fixed upstream. I think the OP should
> first ask "listings" maintainer about it.

Dominik, can you ask the listings maintainers about this?

In the meantime, let's stick with the current workaround.

-- 
 Bastien

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

end of thread, other threads:[~2014-04-17 16:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-14 14:04 empty default captions for src blocks Dominik Ernst
2014-04-15 13:13 ` Dominik Ernst
2014-04-17 15:11 ` Bastien
2014-04-17 16:22   ` Nicolas Goaziou
2014-04-17 16:25     ` Bastien

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