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

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