emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Problem with brackets in LaTeX exports
@ 2010-09-07  3:21 Aidan Gauland
  0 siblings, 0 replies; only message in thread
From: Aidan Gauland @ 2010-09-07  3:21 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2109 bytes --]

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 #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-09-07  3:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-07  3:21 Problem with brackets in LaTeX exports Aidan Gauland

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).