emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] [feature request] Quotation marks in LaTeX export


From: Carsten Dominik
Subject: Re: [Orgmode] [feature request] Quotation marks in LaTeX export
Date: Wed, 27 Jan 2010 11:58:02 +0100

OK, thanks, I will take a look at that.

Hmmm, I also see that csquotes is not always present in distributions... :(

So this really has to be optional....

- Carsten

On Jan 27, 2010, at 10:29 AM, Sven Bretfeld wrote:

Hi Carsten

Carsten Dominik <address@hidden> writes:

can you send me a path, preferably with an option to turn this on and
off?

For now, I only have this dummy solution in my .emacs:

--8<---------------cut here---------------start------------->8---
(eval-after-load "org-latex"
'(defun org-export-latex-quotation-marks ()
 "Export quotation marks depending on language conventions."
 (let* ((lang (plist-get org-export-latex-options-plist :language))
         (quote-rpl (if (equal lang "fr")
                        '(("\\(\\s-\\)\"" "«~")
                          ("\\(\\S-\\)\"" "~»")
                          ("\\(\\s-\\)'" "`"))
                      '(("\\(\\s-\\|[[(]\\)\"" "\\enquote\{")
                        ("\\(\\S-\\)\"" "\}")
                        ("\\(\\s-\\|(\\)'" "`")))))
   (mapc (lambda(l) (goto-char (point-min))
            (while (re-search-forward (car l) nil t)
              (let ((rpl (concat (match-string 1)
                                 (org-export-latex-protect-string
                                  (copy-sequence (cadr l))))))
                (org-if-unprotected-1
                 (replace-match rpl t t))))) quote-rpl)))
)
--8<---------------cut here---------------end--------------->8---

It's a static setup, just an altered clone of the code in org- latex.el.
I have not the skills to make a switch out of this. One has to add the
header \usepackage[babel]{csquotes}. So, an option has to make sure that csquotes as well as babel is loaded with the correct language settings:
\usepackage[english,ngerman]{babel} in my case. If connected to babel,
csquotes will also take care to pick the correct quotation marks if the
language is switched in the midst of the document.

Greetings

Sven


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

- Carsten







reply via email to

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