浏览代码

Fix backslash and other special characters in verbatim snippets

Jeff Kowalczyk writes:

> Is there a way to escape backslashes (\) in code and verbatim that
> will export to LaTeX correctly?
>
> When writing =\\host\share= or =C:\path\to=, pdftolatex output is
> incorrect.
Carsten Dominik 15 年之前
父节点
当前提交
c950e4b3ac
共有 2 个文件被更改,包括 8 次插入3 次删除
  1. 5 0
      lisp/ChangeLog
  2. 3 3
      lisp/org-latex.el

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2009-09-24  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-latex.el (org-export-latex-emph-format): Use better commands
+	to insert special characters in verbatim snippets.
+
 2009-09-22  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-faces.el (org-copy-face): New function.  Use it to create

+ 3 - 3
lisp/org-latex.el

@@ -1479,9 +1479,9 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
 					       "%s" (substring ll i (1+ i))))
 			  (throw 'exit nil))))))
 	(let ((start 0)
-	      (trans '(("\\" . "\\backslash")
-		       ("~" . "\\ensuremath{\\sim}")
-		       ("^" . "\\ensuremath{\\wedge}")))
+	      (trans '(("\\" . "\\textbackslash{}")
+		       ("~" . "\\textasciitilde{}")
+		       ("^" . "\\textasciicircum{}")))
 	      (rtn "") char)
 	  (while (string-match "[\\{}$%&_#~^]" string)
 	    (setq char (match-string 0 string))