diff --git a/lisp/org.el b/lisp/org.el index 4cc10358a..2f10f5211 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -20738,7 +20738,10 @@ With prefix arg UNCOMPILED, load the uncompiled versions." (defun org-in-verbatim-emphasis () (save-match-data - (and (org-in-regexp org-emph-re 2) (member (match-string 3) '("=" "~"))))) + (and (org-in-regexp org-emph-re 2) + (>= (point) (match-beginning 3)) + (<= (point) (match-end 4)) + (member (match-string 3) '("=" "~"))))) (defun org-goto-marker-or-bmk (marker &optional bookmark) "Go to MARKER, widen if necessary. When marker is not live, try BOOKMARK." diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 0ac251f2a..3b0924c51 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -1482,7 +1482,7 @@ holding contextual information." (org-export-data (org-export-get-optional-title headline info) info) (and (eq (plist-get info :with-tags) t) tags)))) - (if (and opt-title (string-match "\\`\\\\\\(.*?\\){" section-fmt)) + (if (and opt-title (string-match "\\`\\\\\\(.*?[^*]\\){" section-fmt)) (format (replace-match "\\1[%s]" nil nil section-fmt 1) ;; Replace square brackets with parenthesis ;; since square brackets are not supported in