emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Fix regexp error for protecting final } when exporting emphasis elements to latex
@ 2009-12-09 14:35 Julien Barnier
  2009-12-09 21:35 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Julien Barnier @ 2009-12-09 14:35 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I recntly noticed that in some specific cases, the final '}' was
esacped when exproting an emphasis element to LaTeX.

For example, the following element :

/éaa/

Is exported to :

\emph{éaa\}

This does not append if the string begins with a space or if it
is ASCII-only. For example, the followig strings are exported
correctly :

/aaa/
 /ééé/

I don't understand why the problem only occurs with non-ASCII chars,
but I think that the regexp to protect added special chars in the
org-export-latex-fontify function is missing a '?' in the
beginning. Tha attached patch corrects it.

Thanks for all,

Julien

---
 lisp/org-latex.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index ce697a3..3d25139 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -1508,7 +1508,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
        (if (caddr emph)
            (setq rpl (org-export-latex-protect-string rpl))
          (save-match-data
-           (if (string-match "\\`.\\(\\\\[a-z]+{\\)\\(.*\\)\\(}\\).?\\'" rpl)
+           (if (string-match "\\`.?\\(\\\\[a-z]+{\\)\\(.*\\)\\(}\\).?\\'" rpl)
                (progn
                  (add-text-properties (match-beginning 1) (match-end 1)
                                       '(org-protected t) rpl)
-- 
1.6.5.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix regexp error for protecting final } when exporting emphasis elements to latex
  2009-12-09 14:35 [PATCH] Fix regexp error for protecting final } when exporting emphasis elements to latex Julien Barnier
@ 2009-12-09 21:35 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2009-12-09 21:35 UTC (permalink / raw)
  To: Julien Barnier; +Cc: emacs-orgmode

Hi Julien,

I have applied you patch, thanks for tracking down a difficult issue.

- Carsten

On Dec 9, 2009, at 3:35 PM, Julien Barnier wrote:

> Hi,
>
> I recntly noticed that in some specific cases, the final '}' was
> esacped when exproting an emphasis element to LaTeX.
>
> For example, the following element :
>
> /éaa/
>
> Is exported to :
>
> \emph{éaa\}
>
> This does not append if the string begins with a space or if it
> is ASCII-only. For example, the followig strings are exported
> correctly :
>
> /aaa/
> /ééé/
>
> I don't understand why the problem only occurs with non-ASCII chars,
> but I think that the regexp to protect added special chars in the
> org-export-latex-fontify function is missing a '?' in the
> beginning. Tha attached patch corrects it.
>
> Thanks for all,
>
> Julien
>
> ---
> lisp/org-latex.el |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/lisp/org-latex.el b/lisp/org-latex.el
> index ce697a3..3d25139 100644
> --- a/lisp/org-latex.el
> +++ b/lisp/org-latex.el
> @@ -1508,7 +1508,7 @@ The conversion is made depending of STRING- 
> BEFORE and STRING-AFTER."
>        (if (caddr emph)
>            (setq rpl (org-export-latex-protect-string rpl))
>          (save-match-data
> -           (if (string-match "\\`.\\(\\\\[a-z]+{\\)\\(.*\\)\\(}\\).? 
> \\'" rpl)
> +           (if (string-match "\\`.?\\(\\\\[a-z]+{\\)\\(.*\\)\\(}\ 
> \).?\\'" rpl)
>                (progn
>                  (add-text-properties (match-beginning 1) (match-end  
> 1)
>                                       '(org-protected t) rpl)
> -- 
> 1.6.5.3
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-12-09 21:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-09 14:35 [PATCH] Fix regexp error for protecting final } when exporting emphasis elements to latex Julien Barnier
2009-12-09 21:35 ` Carsten Dominik

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).