Function: org-texinfo-latex-fragment

org-texinfo-latex-fragment is a byte-compiled function defined in ox-texinfo.el.gz.

Signature

(org-texinfo-latex-fragment FRAGMENT CONTENTS INFO)

Documentation

Transcode a LaTeX FRAGMENT from Org to Texinfo.

INFO is a plist holding contextual information.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-texinfo.el.gz
;;;; LaTeX Fragment

(defun org-texinfo-latex-fragment (fragment _contents info)
  "Transcode a LaTeX FRAGMENT from Org to Texinfo.
INFO is a plist holding contextual information."
  (let ((with-latex (plist-get info :with-latex)))
    (when (or (eq with-latex t)
              (and (eq with-latex 'detect)
                   (org-texinfo-supports-math-p)))
      (let ((value (org-remove-indentation
                    (org-element-property :value fragment))))
        (cond
         ((or (string-match-p "^\\\\\\[" value)
              (string-match-p "^\\$\\$" value))
          (concat "\n"
                  "@displaymath"
                  "\n"
                  (string-trim (substring value 2 -2))
                  "\n"
                  "@end displaymath"
                  "\n"))
         ((string-match-p "^\\$" value)
          (concat "@math{"
                  (string-trim (substring value 1 -1))
                  "}"))
         ((string-match-p "^\\\\(" value)
          (concat "@math{"
                  (string-trim (substring value 2 -2))
                  "}"))
         (t value))))))