emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] empty default captions for src blocks


From: Dominik Ernst
Subject: [O] empty default captions for src blocks
Date: Mon, 14 Apr 2014 16:04:43 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

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

[Prev in Thread] Current Thread [Next in Thread]