Function: org--math-p

org--math-p is a byte-compiled function defined in org.el.gz.

Signature

(org--math-p ORIG-FUN &rest ARGS)

Documentation

Return t inside math fragments or running cdlatex-math-symbol.

This function is intended to be an :around advice for texmathp.

If Org mode thinks that point is actually inside an embedded LaTeX environment, return t when the environment is math or let texmathp do its job otherwise. M-x org-cdlatex-mode-map (org-cdlatex-mode-map)

Aliases

org--math-always-on (obsolete since 9.7)

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org--math-p (orig-fun &rest args)
  "Return t inside math fragments or running `cdlatex-math-symbol'.
This function is intended to be an :around advice for `texmathp'.

If Org mode thinks that point is actually inside
an embedded LaTeX environment, return t when the environment is math
or let `texmathp' do its job otherwise.
`\\[org-cdlatex-mode-map]'"
  (cond
   ((not (derived-mode-p 'org-mode)) (apply orig-fun args))
   ((eq this-command 'cdlatex-math-symbol)
    (setq texmathp-why '("cdlatex-math-symbol in org-mode" . 0))
    t)
   (t
    (let ((element (org-element-context)))
      (when (org-inside-LaTeX-fragment-p element)
        (pcase (substring-no-properties
                (org-element-property :value element)
                0 2)
          ((or "\\(" "\\[" (pred (string-match-p (rx string-start "$"))))
           (setq texmathp-why '("Org mode embedded math" . 0))
           t)
          (_ (apply orig-fun args))))))))