Rasmus <ras...@gmx.us> 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