Fix bug with protecting LaTeX macros
The regular expression was not optimal, and if there was a horizontal rule, search would not start from the beginning of the buffer but from after the rule!
This commit is contained in:
parent
f444c8cd67
commit
41d82c78f9
|
@ -1,5 +1,10 @@
|
||||||
2009-12-16 Carsten Dominik <carsten.dominik@gmail.com>
|
2009-12-16 Carsten Dominik <carsten.dominik@gmail.com>
|
||||||
|
|
||||||
|
* org-latex.el (org-export-latex-preprocess): Better version of
|
||||||
|
the regular expression for protecting LaTeX macros.
|
||||||
|
(org-export-latex-preprocess): Start searching for macros to
|
||||||
|
protect from beginning of buffer.
|
||||||
|
|
||||||
* org-exp.el (org-export-target-internal-links): Check for
|
* org-exp.el (org-export-target-internal-links): Check for
|
||||||
protectedness earlier in the string.
|
protectedness earlier in the string.
|
||||||
|
|
||||||
|
|
|
@ -1877,11 +1877,11 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
|
||||||
(replace-match (org-export-latex-protect-string "\\hrule") t t)))
|
(replace-match (org-export-latex-protect-string "\\hrule") t t)))
|
||||||
|
|
||||||
;; Protect LaTeX commands like \command[...]{...} or \command{...}
|
;; Protect LaTeX commands like \command[...]{...} or \command{...}
|
||||||
(let ((re (concat "\\\\[a-zA-Z]+\\(?:"
|
(goto-char (point-min))
|
||||||
"\\[.*\\]"
|
(let ((re (concat
|
||||||
"\\)?"
|
"\\\\[a-zA-Z]+"
|
||||||
"\\(" (org-create-multibrace-regexp "{" "}" 3)
|
"\\(?:\\[[^][\n]*?\\]\\)*"
|
||||||
"\\)\\{1,3\\}")))
|
"\\(" (org-create-multibrace-regexp "{" "}" 3) "\\)\\{1,3\\}")))
|
||||||
(while (re-search-forward re nil t)
|
(while (re-search-forward re nil t)
|
||||||
(unless (save-excursion (goto-char (match-beginning 0))
|
(unless (save-excursion (goto-char (match-beginning 0))
|
||||||
(equal (char-after (point-at-bol)) ?#))
|
(equal (char-after (point-at-bol)) ?#))
|
||||||
|
|
Loading…
Reference in New Issue