forked from mirrors/org-mode
Merge branch 'maint'
This commit is contained in:
commit
c881b60593
|
@ -1521,22 +1521,23 @@ INFO is a plist used as a communication channel. See
|
||||||
separator
|
separator
|
||||||
(replace-regexp-in-string "\n" " " text)
|
(replace-regexp-in-string "\n" " " text)
|
||||||
separator)))
|
separator)))
|
||||||
;; Handle the `protectedtexttt' special case: Protect some
|
(protectedtexttt (org-latex--protect-texttt text))
|
||||||
;; special chars and use "\texttt{%s}" format string.
|
|
||||||
(protectedtexttt
|
|
||||||
(format "\\texttt{%s}"
|
|
||||||
(replace-regexp-in-string
|
|
||||||
"--\\|[\\{}$%&_#~^]"
|
|
||||||
(lambda (m)
|
|
||||||
(cond ((equal m "--") "-{}-")
|
|
||||||
((equal m "\\") "\\textbackslash{}")
|
|
||||||
((equal m "~") "\\textasciitilde{}")
|
|
||||||
((equal m "^") "\\textasciicircum{}")
|
|
||||||
(t (org-latex--protect-text m))))
|
|
||||||
text nil t)))
|
|
||||||
;; Else use format string.
|
;; Else use format string.
|
||||||
(t (format fmt text)))))
|
(t (format fmt text)))))
|
||||||
|
|
||||||
|
(defun org-latex--protect-texttt (text)
|
||||||
|
"Protect special chars, then wrap TEXT in \"\\texttt{}\"."
|
||||||
|
(format "\\texttt{%s}"
|
||||||
|
(replace-regexp-in-string
|
||||||
|
"--\\|[\\{}$%&_#~^]"
|
||||||
|
(lambda (m)
|
||||||
|
(cond ((equal m "--") "-{}-")
|
||||||
|
((equal m "\\") "\\textbackslash{}")
|
||||||
|
((equal m "~") "\\textasciitilde{}")
|
||||||
|
((equal m "^") "\\textasciicircum{}")
|
||||||
|
(t (org-latex--protect-text m))))
|
||||||
|
text nil t)))
|
||||||
|
|
||||||
(defun org-latex--delayed-footnotes-definitions (element info)
|
(defun org-latex--delayed-footnotes-definitions (element info)
|
||||||
"Return footnotes definitions in ELEMENT as a string.
|
"Return footnotes definitions in ELEMENT as a string.
|
||||||
|
|
||||||
|
@ -1954,10 +1955,16 @@ holding contextual information."
|
||||||
;; Create a temporary export back-end that hard-codes
|
;; Create a temporary export back-end that hard-codes
|
||||||
;; "\underline" within "\section" and alike.
|
;; "\underline" within "\section" and alike.
|
||||||
(section-back-end
|
(section-back-end
|
||||||
(org-export-create-backend
|
(org-export-create-backend
|
||||||
:parent 'latex
|
:parent 'latex
|
||||||
:transcoders
|
:transcoders
|
||||||
'((underline . (lambda (o c i) (format "\\underline{%s}" c))))))
|
'((underline . (lambda (o c i) (format "\\underline{%s}" c)))
|
||||||
|
;; LaTeX isn't happy when you try to use \verb inside the argument of other
|
||||||
|
;; commands (like \section, etc.), and this causes compilation to fail.
|
||||||
|
;; So, within headings it's a good idea to replace any instances of \verb
|
||||||
|
;; with \texttt.
|
||||||
|
(code . (lambda (_ c _) (org-latex--protect-texttt c)))
|
||||||
|
(verbatim . (lambda (_ c _) (org-latex--protect-texttt c))))))
|
||||||
(text
|
(text
|
||||||
(org-export-data-with-backend
|
(org-export-data-with-backend
|
||||||
(org-element-property :title headline) section-back-end info))
|
(org-element-property :title headline) section-back-end info))
|
||||||
|
|
Loading…
Reference in New Issue