Function: org-compute-latex-and-related-regexp

org-compute-latex-and-related-regexp is a byte-compiled function defined in org.el.gz.

Signature

(org-compute-latex-and-related-regexp)

Documentation

Compute regular expression for LaTeX, entities and sub/superscript.

Result depends on variable org-highlight-latex-and-related.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-compute-latex-and-related-regexp ()
  "Compute regular expression for LaTeX, entities and sub/superscript.
Result depends on variable `org-highlight-latex-and-related'."
  (let ((re-sub
	 (cond ((not (memq 'script org-highlight-latex-and-related)) nil)
	       ((eq org-use-sub-superscripts '{})
		(list org-match-substring-with-braces-regexp))
	       (org-use-sub-superscripts (list org-match-substring-regexp))))
	(re-latex
	 (when (or (memq 'latex org-highlight-latex-and-related)
		   (memq 'native org-highlight-latex-and-related))
	   (let ((matchers (plist-get org-format-latex-options :matchers)))
	     (delq nil
		   (mapcar (lambda (x)
			     (and (member (car x) matchers) (nth 1 x)))
			   org-latex-regexps)))))
	(re-entities
	 (when (memq 'entities org-highlight-latex-and-related)
	   (list "\\\\\\(there4\\|sup[123]\\|frac[13][24]\\|[a-zA-Z]+\\)\
\\($\\|{}\\|[^[:alpha:]]\\)"))))
    (setq-local org-latex-and-related-regexp
		(mapconcat #'identity
			   (append re-latex re-entities re-sub)
			   "\\|"))))