From eb8a5d6cd70d4dd80c5a1d484fa82bdc643ff923 Mon Sep 17 00:00:00 2001 From: "Michael W. Olson" Date: Thu, 23 Aug 2007 21:11:11 -0400 Subject: [PATCH] latex: Remove footnote references in headers * lisp/muse-latex.el (muse-latex-fixup-headings): New function that removes footnotes from headers, since they are invalid in LaTeX. (muse-latex-munge-buffer): Call it. * ChangeLog: Fix incorrect paths in entries. --- ChangeLog | 11 ++++++++--- lisp/muse-latex.el | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f289f7e..4d14176 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,14 @@ 2007-08-23 Michael Olson - * muse-html.el (muse-html-insert-contents): Escape heading title - just before extracting it. + * lisp/muse-html.el (muse-html-insert-contents): Escape heading + title just before extracting it. - * muse-publish.el (muse-publish-markup-heading): Don't escape + * lisp/muse-latex.el (muse-latex-fixup-headings): New function + that removes footnotes from headers, since they are invalid in + LaTeX. + (muse-latex-munge-buffer): Call it. + + * lisp/muse-publish.el (muse-publish-markup-heading): Don't escape specials here. This fixes a bug involving links in headings. 2007-08-21 Michael Olson diff --git a/lisp/muse-latex.el b/lisp/muse-latex.el index fe650e3..04a42c3 100644 --- a/lisp/muse-latex.el +++ b/lisp/muse-latex.el @@ -506,9 +506,24 @@ This is used by the slides and lecture-notes publishing styles." (while (re-search-forward ";" nil t) (replace-match ",")))))) +(defun muse-latex-fixup-headings () + "Remove footnotes in headings, since LaTeX does not permit them to exist. + +This can happen if there is a link in a heading, because by +default Muse will add a footnote for each link." + (goto-char (point-min)) + (while (re-search-forward "^\\\\section.?{" nil t) + (save-restriction + (narrow-to-region (match-beginning 0) (muse-line-end-position)) + (goto-char (point-min)) + (while (re-search-forward "\\\\footnote{[^}\n]+}" nil t) + (replace-match "")) + (forward-line 1)))) + (defun muse-latex-munge-buffer () (muse-latex-fixup-dquotes) (muse-latex-fixup-citations) + (muse-latex-fixup-headings) (when (and muse-latex-permit-contents-tag muse-publish-generate-contents) (goto-char (car muse-publish-generate-contents)) -- 2.11.4.GIT