emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sven Bretfeld" <sven.bretfeld@gmx.ch>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: emacs-org <emacs-orgmode@gnu.org>
Subject: Re: [feature request] Quotation marks in LaTeX export
Date: 27 Jan 2010 10:29:55 +0100	[thread overview]
Message-ID: <87pr4vzyi4.fsf@rub.de> (raw)
In-Reply-To: <E2689D3A-621C-4FD8-BC61-BFF3614DCDB6@gmail.com> (Carsten Dominik's message of "Tue, 26 Jan 2010 23:03:45 +0100")

Hi Carsten

Carsten Dominik <carsten.dominik@gmail.com> 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	other threads:[~2010-01-27  9:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-22 23:47 [feature request] Quotation marks in LaTeX export Sven Bretfeld
2010-01-24 19:22 ` Sven Bretfeld
2010-01-26  6:26   ` Scot Becker
2010-01-27  8:25     ` Carsten Dominik
2010-01-26 22:03   ` Carsten Dominik
2010-01-27  9:29     ` Sven Bretfeld [this message]
2010-01-27 10:58       ` Carsten Dominik

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=87pr4vzyi4.fsf@rub.de \
    --to=sven.bretfeld@gmx.ch \
    --cc=carsten.dominik@gmail.com \
    --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).