* nbsp and /italics/
@ 2012-10-14 15:59 Thomas S. Dye
2012-10-14 16:37 ` Thomas S. Dye
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Thomas S. Dye @ 2012-10-14 15:59 UTC (permalink / raw
To: Org-mode
Aloha Nicolas,
Using the filter you kindly provided (below) and this construct, "/Sida/
cf. /fallax/" I get the following incorrect LaTeX export, "\emph{Sida}
cf.~/fallax/". I'm expecting "\emph{Sida} cf.~\emph{fallax}".
All the best,
Tom
#+name: ngz-nbsp
#+begin_src emacs-lisp
(defun ngz-latex-filter-nobreaks (text backend info)
"Ensure \"_\" are properly handled in Beamer/LaTeX export."
(when (memq backend '(e-beamer e-latex))
(replace-regexp-in-string " " "~" text)))
(add-to-list 'org-export-filter-plain-text-functions
'ngz-latex-filter-nobreaks)
#+end_src
--
Thomas S. Dye
http://www.tsdye.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: nbsp and /italics/
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-16 20:14 ` Rasmus
2 siblings, 0 replies; 7+ messages in thread
From: Thomas S. Dye @ 2012-10-14 16:37 UTC (permalink / raw
To: Org-mode
Arghh. I should have pointed out that this is the new exporter, and
that the first argument to replace-regexp-in-string is an alternative
underscore, not the blank space that shows up in my gnus.
Tom
tsd@tsdye.com (Thomas S. Dye) writes:
> Aloha Nicolas,
>
> Using the filter you kindly provided (below) and this construct, "/Sida/
> cf. /fallax/" I get the following incorrect LaTeX export, "\emph{Sida}
> cf.~/fallax/". I'm expecting "\emph{Sida} cf.~\emph{fallax}".
>
> All the best,
> Tom
>
> #+name: ngz-nbsp
> #+begin_src emacs-lisp
> (defun ngz-latex-filter-nobreaks (text backend info)
> "Ensure \"_\" are properly handled in Beamer/LaTeX export."
> (when (memq backend '(e-beamer e-latex))
> (replace-regexp-in-string " " "~" text)))
> (add-to-list 'org-export-filter-plain-text-functions
> 'ngz-latex-filter-nobreaks)
> #+end_src
--
Thomas S. Dye
http://www.tsdye.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: nbsp and /italics/
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
2 siblings, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2012-10-14 20:11 UTC (permalink / raw
To: Thomas S. Dye; +Cc: Org-mode
Hello,
tsd@tsdye.com (Thomas S. Dye) writes:
> Using the filter you kindly provided (below) and this construct, "/Sida/
> cf. /fallax/" I get the following incorrect LaTeX export, "\emph{Sida}
> cf.~/fallax/". I'm expecting "\emph{Sida} cf.~\emph{fallax}".
This is because `org-emph-re' only accepts the beginning of line,
a white space, a tab, or any symbol among ('\"{ before emphasis markup.
Hence, _ (nobreak space) prevents identification of italics.
You may add _ to "pre" part of `org-emphasis-regexp-components'.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: nbsp and /italics/
2012-10-14 20:11 ` Nicolas Goaziou
@ 2012-10-14 22:40 ` Thomas S. Dye
0 siblings, 0 replies; 7+ messages in thread
From: Thomas S. Dye @ 2012-10-14 22:40 UTC (permalink / raw
To: Nicolas Goaziou; +Cc: Org-mode
Thanks Nicolas,
Works like magic.
All the best,
Tom
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> Hello,
>
> tsd@tsdye.com (Thomas S. Dye) writes:
>
>> Using the filter you kindly provided (below) and this construct, "/Sida/
>> cf. /fallax/" I get the following incorrect LaTeX export, "\emph{Sida}
>> cf.~/fallax/". I'm expecting "\emph{Sida} cf.~\emph{fallax}".
>
> This is because `org-emph-re' only accepts the beginning of line,
> a white space, a tab, or any symbol among ('\"{ before emphasis markup.
> Hence, _ (nobreak space) prevents identification of italics.
>
> You may add _ to "pre" part of `org-emphasis-regexp-components'.
>
>
> Regards,
--
Thomas S. Dye
http://www.tsdye.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: nbsp and /italics/
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-16 20:14 ` Rasmus
2012-10-16 22:45 ` Rasmus Pank Roulund
2012-10-18 11:35 ` Suvayu Ali
2 siblings, 2 replies; 7+ messages in thread
From: Rasmus @ 2012-10-16 20:14 UTC (permalink / raw
To: Thomas S. Dye; +Cc: emacs-orgmode
tsd@tsdye.com (Thomas S. Dye) writes:
> #+name: ngz-nbsp
> #+begin_src emacs-lisp
> (defun ngz-latex-filter-nobreaks (text backend info)
> "Ensure \"_\" are properly handled in Beamer/LaTeX export."
> (when (memq backend '(e-beamer e-latex))
> (replace-regexp-in-string " " "~" text)))
> (add-to-list 'org-export-filter-plain-text-functions
> 'ngz-latex-filter-nobreaks)
> #+end_src
Hmm, I'm intrigued by this and it could solve one of my long standing
issue with Org LaTeX export.
I write all new sentences with " ", and for stuff like "fig. " I use
one space. Pretty consistently. I would love to modify the function
to recognize "point one space" as ".~" and "point double space" as
". ". (i.e. no translation).
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. . .
Thanks in advance,
Rasmus
--
I almost cut my hair, it was happened just the other day
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: nbsp and /italics/
2012-10-16 20:14 ` Rasmus
@ 2012-10-16 22:45 ` Rasmus Pank Roulund
2012-10-18 11:35 ` Suvayu Ali
1 sibling, 0 replies; 7+ messages in thread
From: Rasmus Pank Roulund @ 2012-10-16 22:45 UTC (permalink / raw
To: tsd; +Cc: emacs-orgmode
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: nbsp and /italics/
2012-10-16 20:14 ` Rasmus
2012-10-16 22:45 ` Rasmus Pank Roulund
@ 2012-10-18 11:35 ` Suvayu Ali
1 sibling, 0 replies; 7+ messages in thread
From: Suvayu Ali @ 2012-10-18 11:35 UTC (permalink / raw
To: emacs-orgmode
On Tue, Oct 16, 2012 at 10:14:24PM +0200, Rasmus wrote:
> 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. . .
>
I believe you need to group the whole regexp for the {1} to work. Try
something like this: "\\(\\. \\)\\{1\\}"
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-10-18 11:35 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2012-10-18 11:35 ` Suvayu Ali
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.