This commit is contained in:
Bastien 2020-02-19 18:10:26 +01:00
parent 10607d45ae
commit 88d218a5a0
1 changed files with 25 additions and 21 deletions

View File

@ -2172,25 +2172,27 @@ contextual information."
"Transcode an ITEM element from Org to LaTeX.
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
(let* ((counter
(let ((count (org-element-property :counter item))
(level
;; Determine level of current item to determine the
;; correct LaTeX counter to use (enumi, enumii...).
(let ((parent item) (level 0))
(while (memq (org-element-type
(setq parent (org-export-get-parent parent)))
'(plain-list item))
(when (and (eq (org-element-type parent) 'plain-list)
(eq (org-element-property :type parent)
'ordered))
(cl-incf level)))
level)))
(and count
(< level 5)
(format "\\setcounter{enum%s}{%s}\n"
(nth (1- level) '("i" "ii" "iii" "iv"))
(1- count)))))
(let* ((orderedp (eq (org-element-property
:type (org-export-get-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 (memq (org-element-type
(setq parent (org-export-get-parent parent)))
'(plain-list item))
(when (and (eq (org-element-type 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$")
@ -2209,9 +2211,11 @@ contextual information."
"\\item"
(cond
((and checkbox tag)
(format "{%s %s} %s" checkbox tag tag-footnotes))
(format (if orderedp "{%s %s} %s" "[{%s %s}] %s")
checkbox tag tag-footnotes))
((or checkbox tag)
(format "{%s} %s" (or checkbox tag) tag-footnotes))
(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