LaTeX export: Automatically choose \verb delimiter
This commit is contained in:
parent
722fc9a490
commit
8461b96e79
|
@ -1,5 +1,10 @@
|
|||
2009-03-14 Carsten Dominik <carsten.dominik@gmail.com>
|
||||
|
||||
* org-export-latex.el (org-export-latex-emphasis-alist): Better
|
||||
defaults for verbose emphasis.
|
||||
(org-export-latex-emph-format): New function.
|
||||
(org-export-latex-fontify): Call `org-export-latex-emph-format'.
|
||||
|
||||
* org-agenda.el (org-agenda-menu): Add new commands to menu.
|
||||
(org-agenda-do-date-later, org-agenda-do-date-earlier)
|
||||
(org-agenda-date-later-minutes, org-agenda-date-earlier-minutes)
|
||||
|
|
|
@ -165,12 +165,14 @@ to represent the section title."
|
|||
("/" "\\emph{%s}" nil)
|
||||
("_" "\\underline{%s}" nil)
|
||||
("+" "\\texttt{%s}" nil)
|
||||
("=" "\\verb=%s=" nil)
|
||||
("~" "\\verb~%s~" t))
|
||||
("=" "\\verb" t)
|
||||
("~" "\\verb" t))
|
||||
"Alist of LaTeX expressions to convert emphasis fontifiers.
|
||||
Each element of the list is a list of three elements.
|
||||
The first element is the character used as a marker for fontification.
|
||||
The second element is a formatting string to wrap fontified text with.
|
||||
If it is \"\\verb\", Org will automatically select a deimiter
|
||||
character that is not in the string.
|
||||
The third element decides whether to protect converted text from other
|
||||
conversions."
|
||||
:group 'org-export-latex
|
||||
|
@ -1203,15 +1205,30 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
|
|||
(string-match
|
||||
"[|\n]" (buffer-substring beg end))))))
|
||||
(setq rpl (concat (match-string 1)
|
||||
(format (org-export-latex-protect-char-in-string
|
||||
'("\\" "{" "}") (cadr emph))
|
||||
(match-string 4))
|
||||
(org-export-latex-emph-format (cadr emph)
|
||||
(match-string 4))
|
||||
(match-string 5)))
|
||||
(if (caddr emph)
|
||||
(setq rpl (org-export-latex-protect-string rpl)))
|
||||
(replace-match rpl t t)))
|
||||
(backward-char)))
|
||||
|
||||
(defun org-export-latex-emph-format (format string)
|
||||
"Format an emphasis string and handle the \\verb special case."
|
||||
(when (equal format "\\verb")
|
||||
(save-match-data
|
||||
(let ((ll "~,./?;':\"|!@#%^&-_=+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<>()[]{}"))
|
||||
(catch 'exit
|
||||
(loop for i from 0 to (1- (length ll)) do
|
||||
(if (not (string-match (regexp-quote (substring ll i (1+ i)))
|
||||
string))
|
||||
(progn
|
||||
(setq format (concat "\\verb" (substring ll i (1+ i))
|
||||
"%s" (substring ll i (1+ i))))
|
||||
(throw 'exit nil))))))))
|
||||
(setq string (org-export-latex-protect-string
|
||||
(format format string))))
|
||||
|
||||
(defun org-export-latex-links ()
|
||||
;; Make sure to use the LaTeX hyperref and graphicx package
|
||||
;; or send some warnings.
|
||||
|
|
Loading…
Reference in New Issue