7
7
;; Emacs Muse is free software; you can redistribute it and/or modify
8
8
;; it under the terms of the GNU General Public License as published
9
;; by the Free Software Foundation; either version 2, or (at your
9
;; by the Free Software Foundation; either version 3, or (at your
10
10
;; option) any later version.
12
12
;; Emacs Muse is distributed in the hope that it will be useful, but
267
268
(end-center . "\n\\end{center}")
268
269
(begin-quote . "\\begin{quote}\n")
269
270
(end-quote . "\n\\end{quote}")
271
(begin-cite . "\\cite{")
272
(begin-cite-author . "\\citet{")
273
(begin-cite-year . "\\citet{")
270
275
(begin-uli . "\\begin{itemize}\n")
271
276
(end-uli . "\n\\end{itemize}")
272
277
(begin-uli-item . "\\item ")
489
494
(replace-match "''")
490
495
(setq open t))))))
497
(defun muse-latex-fixup-citations ()
498
"Replace semicolons in multi-head citations with colons."
499
(goto-char (point-min))
500
(while (re-search-forward "\\\\cite.?{" nil t)
501
(let ((start (point))
502
(end (re-search-forward "}")))
504
(narrow-to-region start end)
505
(goto-char (point-min))
506
(while (re-search-forward ";" nil t)
507
(replace-match ","))))))
509
(defun muse-latex-fixup-headings ()
510
"Remove footnotes in headings, since LaTeX does not permit them to exist.
512
This can happen if there is a link in a heading, because by
513
default Muse will add a footnote for each link."
514
(goto-char (point-min))
515
(while (re-search-forward "^\\\\section.?{" nil t)
517
(narrow-to-region (match-beginning 0) (muse-line-end-position))
518
(goto-char (point-min))
519
(while (re-search-forward "\\\\footnote{[^}\n]+}" nil t)
492
523
(defun muse-latex-munge-buffer ()
493
524
(muse-latex-fixup-dquotes)
525
(muse-latex-fixup-citations)
526
(muse-latex-fixup-headings)
494
527
(when (and muse-latex-permit-contents-tag
495
528
muse-publish-generate-contents)
496
529
(goto-char (car muse-publish-generate-contents))
497
530
(muse-insert-markup "\\tableofcontents")))
532
(defun muse-latex-bibliography ()
534
(goto-char (point-min))
535
(if (re-search-forward "\\\\cite.?{" nil t)
538
(muse-publishing-directive "bibsource")
499
542
(defun muse-latex-pdf-browse-file (file)
500
543
(shell-command (concat "open " file)))
562
605
(muse-derive-style "slides" "latex"
563
606
:header 'muse-latex-slides-header
564
:tags 'muse-latex-slides-markup-tags)
607
:tags 'muse-latex-slides-markup-tags)
566
609
(muse-derive-style "slides-pdf" "pdf"
567
610
:header 'muse-latex-slides-header
568
:tags 'muse-latex-slides-markup-tags)
611
:tags 'muse-latex-slides-markup-tags)
570
613
(muse-derive-style "lecture-notes" "slides"
571
614
:header 'muse-latex-lecture-notes-header)