emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] nbsp and /italics/


From: Rasmus Pank Roulund
Subject: Re: [O] nbsp and /italics/
Date: Wed, 17 Oct 2012 00:45:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

Rasmus <address@hidden> writes:

> Can anyone think of a clever regexp that recognizes the above pattern?
> I tried, "\\.[ ]\{1\}" but it didn't work.  And without the \{1\} it's
> too strong. . .

Here's one that seems to work in the primitive cases, but not when
there's a link. 

Tested on 
       test of tilde. small space fig. [[latex:ref][test]].  But here's a large 
space.

the regexp recognizes both small spaces, but does not insert the
tilde between "fig." and "[[".

Could I add it to an earlier hook or something similar to make it
work?

#+begin_src emacs-lisp
(defun ngz-latex-filter-nobreaks-double-space (text backend info)
  "Tries to export \"S1. S2\" as \"S1.~S2\" while letting \"S1.  S2\" be 
exported without tilde"
  (when (memq backend '(e-beamer e-latex))
    (replace-regexp-in-string "\\.[ ]\\{1\\}\\([^ ]\\)" ".~\\1" text)))

(add-to-list 'org-export-filter-plain-text-functions
             'ngz-latex-filter-nobreaks-double-space)
#+end_src

Thanks,
Rasmus

-- 
I almost cut my hair, it was happened just the other day



reply via email to

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