emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Aidan Gauland <aidan@dimension8.tehua.net>
To: emacs-orgmode@gnu.org
Subject: Problem with brackets in LaTeX exports
Date: Tue, 7 Sep 2010 15:21:27 +1200	[thread overview]
Message-ID: <20100907032127.GA19261@dimension8.tehua.net> (raw)


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

                 reply	other threads:[~2010-09-07  3:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100907032127.GA19261@dimension8.tehua.net \
    --to=aidan@dimension8.tehua.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).