emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Dominik Ernst <dominik.ernst@gmx.de>
To: emacs-orgmode@gnu.org
Subject: empty default captions for src blocks
Date: Mon, 14 Apr 2014 16:04:43 +0200	[thread overview]
Message-ID: <534BEAFB.4080607@gmx.de> (raw)

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	other threads:[~2014-04-14 14:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-14 14:04 Dominik Ernst [this message]
2014-04-15 13:13 ` empty default captions for src blocks Dominik Ernst
2014-04-17 15:11 ` Bastien
2014-04-17 16:22   ` Nicolas Goaziou
2014-04-17 16:25     ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=534BEAFB.4080607@gmx.de \
    --to=dominik.ernst@gmx.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).