summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2014-01-16 15:52:12 +0100
committerNicolas Goaziou <n.goaziou@gmail.com>2014-01-16 15:52:12 +0100
commitd99ffcf954f7087da3d4d42ece13c5b14dad4465 (patch)
tree7fe0530a99d8d7a1567e144c6dc66aa289c5260e
parent81dad90342d93392f0c2cd33986dd192086969f2 (diff)
parent7d3205a20f5c0fc58754e78f5a2afa45ba6446d0 (diff)
downloadorg-mode-d99ffcf954f7087da3d4d42ece13c5b14dad4465.tar.gz
Merge branch 'maint'
-rw-r--r--lisp/ox-latex.el28
1 files changed, 26 insertions, 2 deletions
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index ed84c7b..0262ff9 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1391,7 +1391,13 @@ holding contextual information."
(when (org-export-first-sibling-p headline info)
(format "\\begin{%s}\n" (if numberedp 'enumerate 'itemize)))
;; Itemize headline
- "\\item " full-text "\n" headline-label pre-blanks contents)))
+ "\\item"
+ (and full-text (org-string-match-p "\\`[ \t]*\\[" full-text)
+ "\\relax")
+ " " full-text "\n"
+ headline-label
+ pre-blanks
+ contents)))
;; If headline is not the last sibling simply return
;; LOW-LEVEL-BODY. Otherwise, also close the list, before
;; any blank line.
@@ -1581,7 +1587,25 @@ contextual information."
(and tag (format "[{%s}] "
(concat checkbox
(org-export-data tag info)))))))
- (concat counter "\\item" (or tag (concat " " checkbox))
+ (concat counter
+ "\\item"
+ (cond
+ (tag)
+ (checkbox (concat " " checkbox))
+ ;; 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
+ (org-string-match-p "\\`[ \t]*\\[" contents)
+ (not (let ((e (car (org-element-contents item))))
+ (and (eq (org-element-type e) 'paragraph)
+ (let ((o (car (org-element-contents e))))
+ (and (eq (org-element-type o) 'export-snippet)
+ (eq (org-export-snippet-backend o)
+ 'latex)))))))
+ "\\relax ")
+ (t " "))
(and contents (org-trim contents))
;; If there are footnotes references in tag, be sure to
;; add their definition at the end of the item. This