From 04057e2195dcd9ac8f938c31e087aae0791e339d Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Thu, 28 Jan 2010 15:50:20 +0100 Subject: [PATCH] LaTeX export: Protect <...> arguments for BEAMER export Bill Jackson writes: > When exporting to LaTeX, curly brackets in a command will be escaped > if that command also contains angle brackets. This can be a problem > when using beamer. An example input file: > > ------------------------------------------------------------------------ > > #+LaTeX_CLASS: beamer > > * The One and Only Frame > When LaTeX \alert<2>{commands} contain angle brackets, the curly > brackets are erroneously escaped in the output. \alert{Commands} > that do not contain angle brackets work properly. > > ------------------------------------------------------------------------ > > Typing C-c C-e l will generate the output file: > > ------------------------------------------------------------------------ > > % Created 2010-01-15 Fri 13:57 > \documentclass{beamer} > \usepackage[latin1]{inputenc} > \usepackage[T1]{fontenc} > \usepackage{graphicx} > \usepackage{longtable} > \usepackage{float} > \usepackage{wrapfig} > \usepackage{soul} > \usepackage{amssymb} > \usepackage{hyperref} > > > \title{escCurly} > \author{} > \date{15 January 2010} > > \begin{document} > > \maketitle > > \begin{frame} > \frametitle{Outline} > \setcounter{tocdepth}{3} > \tableofcontents > \end{frame} > > \begin{frame} > \frametitle{The One and Only Frame} > \label{sec-1} > > When \LaTeX{} \alert<2>\{commands\} contain angle brackets, the curly > brackets are erroneously escaped in the output. \alert{Commands} > that do not contain angle brackets work properly. > \end{frame} > > \end{document} --- lisp/ChangeLog | 2 ++ lisp/org-latex.el | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2dc260df9..b1fcc5b27 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,6 +2,8 @@ * org-latex.el (org-export-latex-preprocess): More consistent conversion and protection of the words LaTeX and TeX. + (org-export-latex-fontify-headline, org-export-latex-preprocess): + Allow angle brackets in commands, for beamer. 2010-01-26 Carsten Dominik diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 472d406b3..4a4947c3c 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -1307,9 +1307,10 @@ links, keywords, lists, tables, fixed-width" ;; the beginning of the buffer - inserting "\n" is safe here though. (insert "\n" string) (goto-char (point-min)) - (let ((re (concat "\\\\[a-zA-Z]+\\(?:" - "\\[.*\\]" - "\\)?" + (let ((re (concat "\\\\[a-zA-Z]+" + "\\(?:<[^<>\n]*>\\)*" + "\\(?:\\[[^][\n]*?\\]\\)*" + "\\(?:<[^<>\n]*>\\)*" (org-create-multibrace-regexp "{" "}" 3)))) (while (re-search-forward re nil t) (unless (save-excursion (goto-char (match-beginning 0)) @@ -1954,7 +1955,9 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (goto-char (point-min)) (let ((re (concat "\\\\[a-zA-Z]+" + "\\(?:<[^<>\n]*>\\)*" "\\(?:\\[[^][\n]*?\\]\\)*" + "\\(?:<[^<>\n]*>\\)*" "\\(" (org-create-multibrace-regexp "{" "}" 3) "\\)\\{1,3\\}"))) (while (re-search-forward re nil t) (unless (save-excursion (goto-char (match-beginning 0))