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: Sven Bretfeld
Subject: Re: [Orgmode] [feature request] Quotation marks in LaTeX export
Date: 27 Jan 2010 10:29:55 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (gnu/linux)

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




reply via email to

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