Export to Latex (org-latex-export-to-pdf) generates incorrect latex when
list items start with a left square bracket. This occurs because the
\item command interprets the left square bracket as the start of an
argument list. An example:
An item list:
- abc def
- [def] ghi
- [jkl m n o]
- pqr
This produces the latex fragment:
An item list:
\begin{itemize}
\item abc def
\item [def] ghi
\item [jkl m n o]
\item pqr
\end{itemize}
The pdf output renders the second and third items incorrectly. If there
is no right bracket to terminate the
argument, then pdf generation may
fail with message:
org-latex-compile: PDF file ./example.pdf wasn't produced: Runaway argument
I fixed these cases in my local environment using defadvise on org-latex-item
to wrap an initial left square bracket in braces. I used this form:
(eval-after-load "ox-latex"
'(progn
(defadvice org-latex-item (after escape-initial-bracket activate)
(setq ad-return-value
(replace-regexp-in-string
"\\\\item \\["
"\\\\item {[}"
ad-return-value)))))
This changes the latex fragment for the above example to:
An item list:
\begin{itemize}
\item abc def
\item {[}def] ghi
\item {[}jkl m n o]
\item pqr
\end{itemize}
This form renders PDF correctly. My knowledge of latex is very limited,
I don't know if this is a reasonable approach or not. There appears to
be one other function in the ox-latex.el generating the \item command:
(org-latex-headline). I did not try to reproduce this case.
------------------------------------------------------------------------
Emacs : GNU Emacs 24.2.1 (x86_64-apple-darwin, NS apple-appkit-1038.36)
of 2012-08-27 on bob.porkrind.org
Package: Org-mode
version 8.2.3c (8.2.3c-elpa @ /Users/jdegenhardt/.emacs.d/elpa/org-20131115/)
current state:
==============
(setq
org-tab-first-hook '(org-hide-block-toggle-maybe
org-src-native-tab-command-maybe
org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
org-speed-command-hook '(org-speed-command-default-hook
org-babel-speed-command-hook)
org-occur-hook
'(org-first-headline-recenter)
org-metaup-hook '(org-babel-load-in-session-maybe)
org-log-done 'time
org-confirm-shell-link-function 'yes-or-no-p
org-use-sub-superscripts '{}
org-startup-indented t
org-after-todo-state-change-hook '(org-clock-out-if-current)
org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-babel-pre-tangle-hook '(save-buffer)
org-mode-hook '(#[nil "\300\301\302\303\304$\207"
[org-add-hook change-major-mode-hook
org-show-block-all
append local]
5]
#[nil "\300\301\302\303\304$\207"
[org-add-hook change-major-mode-hook
org-babel-show-result-all append local]
5]
org-babel-result-hide-spec
org-babel-hide-all-hashes
(lambda nil (turn-on-visual-line-mode) (turn-off-auto-fill)))
org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
org-babel-execute-safely-maybe)
org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
org-cycle-hide-inline-tasks org-cycle-show-empty-lines
org-optimize-window-after-visibility-change)
org-todo-keywords '((sequence "TODO" "STARTED" "ONHOLD" "|" "DONE"
"CANCELED")
)
org-latex-packages-alist '(("margin=0.75in" "geometry" nil))
org-confirm-elisp-link-function 'yes-or-no-p
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-agenda-files '("~/Notes/General-Ongoing.org")
org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
)