Function: org-latex-item
org-latex-item is a byte-compiled function defined in ox-latex.el.gz.
Signature
(org-latex-item ITEM CONTENTS INFO)
Documentation
Transcode an ITEM element from Org to LaTeX.
CONTENTS holds the contents of the item. INFO is a plist holding contextual information.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ox-latex.el.gz
;;;; Item
(defun org-latex-item (item contents info)
"Transcode an ITEM element from Org to LaTeX.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
(let* ((orderedp (eq (org-element-property
:type (org-element-parent item))
'ordered))
(level
;; Determine level of current item to determine the
;; correct LaTeX counter to use (enumi, enumii...).
(let ((parent item) (level 0))
(while (org-element-type-p
(setq parent (org-element-parent parent))
'(plain-list item))
(when (and (org-element-type-p parent 'plain-list)
(eq (org-element-property :type parent)
'ordered))
(cl-incf level)))
level))
(count (org-element-property :counter item))
(counter (and count
(< level 5)
(format "\\setcounter{enum%s}{%s}\n"
(nth (1- level) '("i" "ii" "iii" "iv"))
(1- count))))
(checkbox (cl-case (org-element-property :checkbox item)
(on "$\\boxtimes$")
(off "$\\square$")
(trans "$\\boxminus$")))
(tag (let ((tag (org-element-property :tag item)))
(and tag (org-export-data tag info))))
;; If there are footnotes references in tag, be sure to add
;; their definition at the end of the item. This workaround
;; is necessary since "\footnote{}" command is not supported
;; in tags.
(tag-footnotes
(or (and tag (org-latex--delayed-footnotes-definitions
(org-element-property :tag item) info))
"")))
(concat counter
"\\item"
(cond
((and checkbox tag)
(format (if orderedp "{%s %s} %s" "[{%s %s}] %s")
checkbox tag tag-footnotes))
((or checkbox tag)
(format (if orderedp "{%s} %s" "[{%s}] %s")
(or checkbox tag) tag-footnotes))
;; Without a tag or a check-box, if CONTENTS starts with
;; an opening square bracket, add "\relax" to "\item",
;; unless the brackets comes from an initial export
;; snippet (i.e. it is inserted willingly by the user).
((and contents
(string-match-p "\\`[ \t]*\\[" contents)
(not (let ((e (car (org-element-contents item))))
(and (org-element-type-p e 'paragraph)
(let ((o (car (org-element-contents e))))
(and (org-element-type-p o 'export-snippet)
(eq (org-export-snippet-backend o)
'latex)))))))
"\\relax ")
(t " "))
(and contents (org-trim contents)))))