Function: org-latex-latex-environment

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

Signature

(org-latex-latex-environment LATEX-ENVIRONMENT CONTENTS INFO)

Documentation

Transcode a LATEX-ENVIRONMENT element from Org to LaTeX.

CONTENTS is nil. INFO is a plist holding contextual information.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-latex.el.gz
(defun org-latex-latex-environment (latex-environment _contents info)
  "Transcode a LATEX-ENVIRONMENT element from Org to LaTeX.
CONTENTS is nil.  INFO is a plist holding contextual information."
  (when (plist-get info :with-latex)
    (let* ((value (org-remove-indentation
		   (org-element-property :value latex-environment)))
	   (type (org-latex--environment-type latex-environment))
	   (caption (if (eq type 'math)
			(org-latex--label latex-environment info nil t)
		      (org-latex--caption/label-string latex-environment info)))
	   (caption-above-p
            (or (eq type 'math)
                (org-latex--caption-above-p latex-environment info))))
      (if (not (or (org-element-property :name latex-environment)
		 (org-element-property :caption latex-environment)))
	  value
	;; Environment is labeled: label must be within the environment
	;; (otherwise, a reference pointing to that element will count
	;; the section instead).  Also insert caption if `latex-environment'
	;; is not a math environment.
	(with-temp-buffer
	  (insert value)
	  (if caption-above-p
	      (progn
		(goto-char (point-min))
		(forward-line))
	    (goto-char (point-max))
	    (forward-line -1))
	  (insert caption)
	  (buffer-string))))))