all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Bug: Export to Latex - Incorrect output for list items starting with left bracket [8.2.3c (8.2.3c-elpa @ /Users/jdegenhardt/.emacs.d/elpa/org-20131115/)]
@ 2014-01-11 21:18 Jon Degenhardt
  2014-01-13  0:26 ` Vladimir Lomov
  2014-01-13 16:51 ` Nicolas Goaziou
  0 siblings, 2 replies; 19+ messages in thread
From: Jon Degenhardt @ 2014-01-11 21:18 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 4083 bytes --]

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)
 )

[-- Attachment #2: Type: text/html, Size: 7055 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2014-08-03  7:56 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-11 21:18 Bug: Export to Latex - Incorrect output for list items starting with left bracket [8.2.3c (8.2.3c-elpa @ /Users/jdegenhardt/.emacs.d/elpa/org-20131115/)] Jon Degenhardt
2014-01-13  0:26 ` Vladimir Lomov
2014-01-13 16:51 ` Nicolas Goaziou
2014-01-13 23:56   ` Vladimir Lomov
2014-01-14 16:39   ` Eric S Fraga
2014-01-14 18:42     ` Nicolas Goaziou
2014-01-14 19:54       ` Eric S Fraga
2014-01-14 20:52         ` Nicolas Goaziou
2014-01-15  8:35           ` Eric S Fraga
2014-01-15 13:18             ` Nicolas Goaziou
2014-01-16  9:55               ` Eric S Fraga
2014-01-16 12:03                 ` Sebastien Vauban
2014-01-16 15:10                   ` Eric S Fraga
2014-01-16 15:15                     ` Nicolas Goaziou
     [not found]                       ` <87ha94vtyj.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-01-16 15:24                         ` Sebastien Vauban
2014-01-16 16:42                           ` Eric S Fraga
2014-08-03  7:57                             ` Nicolas Goaziou
2014-01-16 14:54                 ` Nicolas Goaziou
2014-01-18 20:06                   ` Jon Degenhardt

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.