emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Problem with brackets in LaTeX exports


From: Aidan Gauland
Subject: [Orgmode] Problem with brackets in LaTeX exports
Date: Tue, 7 Sep 2010 15:21:27 +1200
User-agent: Mutt/1.5.20 (2009-06-14)

First off, I'm using a workaround for the problem with closing brackets
terminating a footnote, even if they're supposed to be *within* the
footnote.  Here is the relevant part of my init file...

;; Workaround for the bracket-in-footnote bug.
(add-hook 'org-export-html-final-hook  'gio/replace-square-brackets)
(add-hook 'org-export-ascii-final-hook 'gio/replace-square-brackets)
(add-hook 'org-export-latex-final-hook 'gio/replace-square-brackets)
(defun gio/replace-square-brackets ()
        "Replace #91; with [ and #93; with ] "
        (interactive)
        (setq a "#91;")  ; use "\[" for LaTeX export
        (setq b "#93;")  ; use "\]" for LaTeX export
        (setq a1 "[")
        (setq b1 "]")

        (ignore-errors (goto-char 1) (setq p (point)) 
                                                                 (while (< p 
(point-max)) 
                                                                         
(re-search-forward a nil nil) (replace-match a1)  (setq p (point)) )  )
        (ignore-errors (goto-char 1) (setq p (point)) 
                                                                 (while (< p 
(point-max)) 
                                                                         
(re-search-forward b nil nil) (replace-match b1)  (setq p (point)) )  )
        (save-buffer))

Now here is my problem, illustrated by an example Org file...

* A heading
This footnote will export to LaTeX improperly.[fn:: Some book at #91;42-24#93;.]
A second footnote to make the visual problem more obvious in a PDF export.[fn::
Another book at #91;13-37#93;.]

It will export to...
#+BEGIN_SRC latex
This footnote will export to \LaTeX{} improperly.\footnote{Some book at 
\[42-24\]. }
#+END_SRC
...but should be...
#+BEGIN_SRC latex
This footnote will export to \LaTeX{} improperly.\footnote{Some book at 
[42-24]. }
#+END_SRC
You will see why this is if you look at a PDF export.

If I don't set the function gio/replace-square-brackets as a
org-export-latex-final-hook, then #91; and #93; are exported literally.
I can't explain the comments...
; use "\[" for LaTeX export
; use "\]" for LaTeX export
are in that function, as I did not write it.

Can anyone with more experience with Org and LaTeX help me out here?
It is very annoying having to manually correct each set of brackets manually for
every LaTeX export.

Thanks,
Aidan

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]