diff options
author | Eric Schulte <schulte.eric@gmail.com> | 2010-07-21 10:39:53 -0700 |
---|---|---|
committer | Eric Schulte <schulte.eric@gmail.com> | 2010-07-21 10:39:53 -0700 |
commit | 717c73cc7a4caeacaedc44fa9df836b299f2212d (patch) | |
tree | 8a8ab6d5f1ecb5923ce2ca1576c6664d55c7f2a8 | |
parent | c31c1d627bd1b7016d0f1149370dd8351d1f65e2 (diff) | |
download | org-mode-717c73cc7a4caeacaedc44fa9df836b299f2212d.tar.gz |
improve latex listings code block name export
* lisp/org-exp.el (org-export-format-source-code-or-example): escape
underscores in code block names on latex listings export
* lisp/org-latex.el (org-export-latex-listings-w-names): make export
of code block names to latex optional
-rw-r--r-- | lisp/org-exp.el | 7 | ||||
-rw-r--r-- | lisp/org-latex.el | 8 |
2 files changed, 13 insertions, 2 deletions
diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 9c6fdf4..ed8ab05 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -2288,8 +2288,11 @@ INDENT was the original indentation of the block." lang))) (format "\\lstset{language=%s}\n" lstlang)) "\n") - (when caption - (format "\n%s $\\equiv$ \n" caption)) + (when (and caption + org-export-latex-listings-w-names) + (format "\n%s $\\equiv$ \n" + (replace-regexp-in-string + "_" "\\\\_" caption))) "\\begin{lstlisting}\n" rtn "\\end{lstlisting}\n") (concat (car org-export-latex-verbatim-wrap) diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 24dd8c1..f3a55ee 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -398,6 +398,14 @@ hurt if it is present." (symbol :tag "Major mode ") (string :tag "Listings language")))) +(defcustom org-export-latex-listings-w-names t + "Non-nil means export names of named code blocks. +Code blocks exported with the listings package (controlled by the +`org-export-latex-listings' variable) can be named in the style +of noweb." + :group 'org-export-latex + :type 'boolean) + (defcustom org-export-latex-remove-from-headlines '(:todo nil :priority nil :tags nil) "A plist of keywords to remove from headlines. OBSOLETE. |