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.
This commit is contained in:
Carsten Dominik 2009-09-24 10:02:00 +01:00
parent 38f82c430b
commit c950e4b3ac
2 changed files with 8 additions and 3 deletions

View File

@ -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

View File

@ -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))