瀏覽代碼

LaTeX export: Make the verbatim environment configurable

Carsten Dominik 16 年之前
父節點
當前提交
e23665ee66
共有 3 個文件被更改,包括 20 次插入1 次删除
  1. 5 0
      lisp/ChangeLog
  2. 3 1
      lisp/org-exp.el
  3. 12 0
      lisp/org-latex.el

+ 5 - 0
lisp/ChangeLog

@@ -1,5 +1,10 @@
 2009-06-18  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-latex.el (org-export-latex-verbatim-wrap): New option.
+
+	* org-exp.el (org-export-format-source-code-or-example): Use
+	`org-export-latex-verbatim-wrap'.
+
 	* org.el (org-clone-subtree-with-time-shift): Also shift inactive
 	time stamps.
 

+ 3 - 1
lisp/org-exp.el

@@ -2145,6 +2145,7 @@ in the list) and remove property and value from the list in LISTVAR."
 
 (defvar htmlp)  ;; dynamically scoped
 (defvar latexp)  ;; dynamically scoped
+(defvar org-export-latex-verbatim-wrap) ;; defined in org-latex.el
 
 (defun org-export-format-source-code-or-example
   (backend lang code &optional opts indent)
@@ -2249,7 +2250,8 @@ INDENT was the original indentation of the block."
 	     ((eq backend 'latex)
 	      (setq rtn (org-export-number-lines rtn 'latex 0 0 num cont rpllbl fmt))
 	      (concat "\n#+BEGIN_LaTeX\n"
-		      (org-add-props (concat "\\begin{verbatim}\n" rtn "\n\\end{verbatim}\n")
+		      (org-add-props (concat (car org-export-latex-verbatim-wrap)
+					     rtn (cdr org-export-LaTeX-verbatim-wrap))
 			  '(org-protected t))
 		      "#+END_LaTeX\n\n"))
 	     ((eq backend 'ascii)

+ 12 - 0
lisp/org-latex.el

@@ -274,6 +274,18 @@ will pass them (combined with the LaTeX default list parameters) to
   :group 'org-export-latex
   :type 'plist)
 
+(defcustom org-export-latex-verbatim-wrap
+  '("\\begin{verbatim}\n" . "\\end{verbatim}\n")
+  "Environment to be wrapped around a fixed-width section in LaTeX export.
+This is a cons with two strings, to be added before and after the
+fixed-with text.
+
+Defaults to \\begin{verbatim} and \\end{verbatim}."
+  :group 'org-export_translation
+  :group 'org-export-latex
+  :type '(cons (string :tag "Open")
+	       (string :tag "Close")))
+
 (defcustom org-export-latex-remove-from-headlines
   '(:todo nil :priority nil :tags nil)
   "A plist of keywords to remove from headlines. OBSOLETE.