From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: inter-word space in org -> latex Date: Tue, 22 Sep 2015 22:59:58 +0200 Message-ID: <878u7ykw4x.fsf@gmx.us> References: <87pp1a2oqb.fsf@mbork.pl> <87oagu2n5h.fsf@mbork.pl> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeUfp-0001A9-9e for emacs-orgmode@gnu.org; Tue, 22 Sep 2015 17:00:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZeUfl-0002oY-Pg for emacs-orgmode@gnu.org; Tue, 22 Sep 2015 17:00:25 -0400 Received: from plane.gmane.org ([80.91.229.3]:59237) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeUfl-0002mq-Jq for emacs-orgmode@gnu.org; Tue, 22 Sep 2015 17:00:21 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZeUfj-00032f-6T for emacs-orgmode@gnu.org; Tue, 22 Sep 2015 23:00:19 +0200 Received: from 46.166.190.201 ([46.166.190.201]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 22 Sep 2015 23:00:19 +0200 Received: from rasmus by 46.166.190.201 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 22 Sep 2015 23:00:19 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Marcin Borkowski writes: > ;; Convert single spaces after periods etc. to "\ " when exporting to LaTeX > > (defun my-latex-filter-nonfrenchspacing (text backend info) > "Convert single spaces after dots to \"\ \"." > (when (and (org-export-derived-backend-p backend 'latex) > sentence-end-double-space) > (replace-regexp-in-string > (concat "\\(" sentence-end-base "\\)" > "[ \u00a0]\\([^ \t\u00a0\n]\\)") > "\\1\\\\ \\2" text))) > > (add-to-list 'org-export-filter-plain-text-functions > 'my-latex-filter-nonfrenchspacing) > > It is a bit simplistic (after all, I wrote it just now in 15 minutes), > but it seems to work fine. It makes a few assumptions, though. One of > them is that you don't mess with sentence-end-base too much: I assumed > that there are no non-shy groups there. (By default there are not, and > I don't see any reason for them to be there, but what do I know.) Also, > I assume that for the period to /not/ end the sentence, it should be > followed by one space and something non-spacey. Here'a an alternative implementation with other limitation, e.g. only looking at [A-Z] for capitals: http://permalink.gmane.org/gmane.emacs.orgmode/101176 > Also, note that while Emacs' way of differentiating between > a sentence-ending period and a non-sentence-ending period are fairly > simple, (La)TeX's rules are a bit more complicated (look up "space > factor" in The TeXbook). For instance, LaTeX assumes that a period > after a capital letter /never/ ends the sentence, and you have to use \@ > before such period to change that. The algorithm TeX uses is really > clever, and can be (ab)used in funny ways to do funny stuff in > low-level, hackish TeX ways (been there, done that - for instance, when > I once reimplemented the theorem-like environments, I used space factor > to make sure that if a theorem begins with an enumeration, it looks > fine. The "standard" LaTeX implementation of theorem-like environments > is kind of crazy, even if it works in typical cases. Try typesetting > a theorem with a long optional argument in a narrow column and see what > happens, for instance.). But isn't a lot of the cruft from TeX "fixed" in LaTeX. E.g. I believe the correct space is automatically used after emphasis. > TL;DR: just use \frenchspacing. Everyone will be happier. Or not. -- The Kids call him Billy the Saint