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


Reply via email to