emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus Pank Roulund <rasmus@gmx.us>
To: tsd@tsdye.com
Cc: emacs-orgmode@gnu.org
Subject: Re: nbsp and /italics/
Date: Wed, 17 Oct 2012 00:45:24 +0200	[thread overview]
Message-ID: <87bog2c9yz.fsf@pank.iue.private> (raw)
In-Reply-To: <87k3uqcgyn.fsf@pank.iue.private> (rasmus@gmx.us's message of "Tue, 16 Oct 2012 22:14:24 +0200")

Rasmus <rasmus@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	other threads:[~2012-10-16 22:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-14 15:59 nbsp and /italics/ Thomas S. Dye
2012-10-14 16:37 ` Thomas S. Dye
2012-10-14 20:11 ` Nicolas Goaziou
2012-10-14 22:40   ` Thomas S. Dye
2012-10-16 20:14 ` Rasmus
2012-10-16 22:45   ` Rasmus Pank Roulund [this message]
2012-10-18 11:35   ` Suvayu Ali

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=87bog2c9yz.fsf@pank.iue.private \
    --to=rasmus@gmx.us \
    --cc=emacs-orgmode@gnu.org \
    --cc=tsd@tsdye.com \
    /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).