emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org c881b60: Merge branch 'maint'


From: ELPA Syncer
Subject: [elpa] externals/org c881b60: Merge branch 'maint'
Date: Sat, 3 Apr 2021 18:57:09 -0400 (EDT)

branch: externals/org
commit c881b60593b3beeed7b8c7a2bada64157cd9940a
Merge: 635920c bcfe6f9
Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Commit: Nicolas Goaziou <mail@nicolasgoaziou.fr>

    Merge branch 'maint'
---
 lisp/ox-latex.el | 41 ++++++++++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 17 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index da3c3f8..f492ebb 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1521,22 +1521,23 @@ INFO is a plist used as a communication channel.  See
                 separator
                 (replace-regexp-in-string "\n" " " text)
                 separator)))
-      ;; Handle the `protectedtexttt' special case: Protect some
-      ;; 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)))
+      (protectedtexttt (org-latex--protect-texttt text))
       ;; Else use format string.
       (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)
   "Return footnotes definitions in ELEMENT as a string.
 
@@ -1954,10 +1955,16 @@ holding contextual information."
           ;; Create a temporary export back-end that hard-codes
           ;; "\underline" within "\section" and alike.
           (section-back-end
-           (org-export-create-backend
-            :parent 'latex
-            :transcoders
-            '((underline . (lambda (o c i) (format "\\underline{%s}" c))))))
+            (org-export-create-backend
+             :parent 'latex
+             :transcoders
+             '((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
            (org-export-data-with-backend
             (org-element-property :title headline) section-back-end info))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]