From 64a5290bd6b7b8d29e9b77ecc3fe7c29619e37e0 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 13 Jan 2014 17:48:19 +0100 Subject: [PATCH] ox-latex: Fix items starting with a square bracket * lisp/ox-latex.el (org-latex-headline, org-latex-item): Fix items starting with a square bracket Thanks to Jon Degenhardt for reporting it. --- lisp/ox-latex.el | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 8294938..f695dfc 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -1374,7 +1374,12 @@ 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 " + (replace-regexp-in-string "\\`[ \t]*\\[" "{\\[}" 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. @@ -1565,7 +1570,12 @@ contextual information." (concat checkbox (org-export-data tag info))))))) (concat counter "\\item" (or tag (concat " " checkbox)) - (and contents (org-trim contents)) + (cond ((not contents) nil) + ((or tag + checkbox + (not (string-match "\\`[ \t]*\\[" contents))) + (org-trim contents)) + (t (replace-match "{[}" nil nil contents))) ;; 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 -- 1.8.5.2