From ebecf964123ab7b4e6deec85aa2f2fd58eddea29 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 13 Sep 2013 23:12:20 -0400 Subject: [PATCH] * GNUmakefile: Obey a .elpaignore file in a package's root directory. * admin/update-archive.sh: Don't copy .elc files to build/packages. * admin/archive-contents.el: Improve error message for invalid versions. * externals-list: Change auctex to be external. * copyright_exceptions: Update to adapt to AUCTeX-11.87. * package/auctex: Move it to an external branch, updated to 11.87. --- GNUmakefile | 24 +- admin/archive-contents.el | 9 +- admin/update-archive.sh | 8 +- copyright_exceptions | 4 +- externals-list | 2 +- packages/auctex/README | 243 - packages/auctex/auctex-pkg.el | 1 - packages/auctex/auctex.info | 119 - packages/auctex/auctex.info-1 | 6658 ------------------ packages/auctex/auctex.info-2 | Bin 27158 -> 0 bytes packages/auctex/bib-cite.el | 2622 ------- packages/auctex/context-en.el | 212 - packages/auctex/context-nl.el | 187 - packages/auctex/context.el | 1653 ----- packages/auctex/dir | 25 - packages/auctex/doc/auctex.texi | 4257 ----------- packages/auctex/doc/changes.texi | 800 --- packages/auctex/doc/copying.texi | 48 - packages/auctex/doc/faq.texi | 148 - packages/auctex/doc/fdl.texi | 506 -- packages/auctex/doc/history.texi | 1918 ----- packages/auctex/doc/install.texi | 576 -- packages/auctex/doc/intro.texi | 106 - packages/auctex/doc/macros.texi | 82 - packages/auctex/doc/preview-dtxdoc.texi | 488 -- packages/auctex/doc/preview-faq.texi | 340 - packages/auctex/doc/preview-latex.texi | 840 --- packages/auctex/doc/preview-problems.texi | 242 - packages/auctex/doc/preview-readme.texi | 230 - packages/auctex/doc/preview-todo.texi | 118 - packages/auctex/doc/quickstart.texi | 299 - packages/auctex/doc/todo.texi | 345 - packages/auctex/doc/version.texi | 2 - packages/auctex/doc/wininstall.texi | 391 - packages/auctex/font-latex.el | 1958 ----- packages/auctex/images/amstex.xpm | 207 - packages/auctex/images/bibtex.xpm | 82 - packages/auctex/images/dropdown.xpm | 30 - packages/auctex/images/dvipdf.xpm | 65 - packages/auctex/images/dvips.xpm | 89 - packages/auctex/images/error.xpm | 35 - packages/auctex/images/exec.xpm | 68 - packages/auctex/images/execbibtex.xpm | 127 - packages/auctex/images/execdvips.xpm | 52 - packages/auctex/images/execerror.xpm | 49 - packages/auctex/images/execpdftex.xpm | 205 - packages/auctex/images/exectex.xpm | 203 - packages/auctex/images/execviewdvi.xpm | 46 - packages/auctex/images/execviewpdf.xpm | 42 - packages/auctex/images/execviewps.xpm | 42 - packages/auctex/images/gv.xpm | 158 - packages/auctex/images/jumpdvi.xpm | 74 - packages/auctex/images/ltx-symb-turn-off.xpm | 47 - packages/auctex/images/ltx-symb-turn-on.xpm | 46 - packages/auctex/images/pdftex.xpm | 206 - packages/auctex/images/prverr16.xpm | 31 - packages/auctex/images/prverr20.xpm | 35 - packages/auctex/images/prverr24.xbm | 9 - packages/auctex/images/prverr24.xpm | 39 - packages/auctex/images/prvtex-cap-up.xpm | 48 - packages/auctex/images/prvtex12.xbm | 6 - packages/auctex/images/prvtex12.xpm | 32 - packages/auctex/images/prvtex16.xbm | 7 - packages/auctex/images/prvtex16.xpm | 36 - packages/auctex/images/prvtex20.xpm | 40 - packages/auctex/images/prvtex24.xbm | 10 - packages/auctex/images/prvtex24.xpm | 37 - packages/auctex/images/prvwrk12.xpm | 32 - packages/auctex/images/prvwrk14.xpm | 34 - packages/auctex/images/prvwrk16.xpm | 36 - packages/auctex/images/prvwrk20.xpm | 40 - packages/auctex/images/prvwrk24.xbm | 12 - packages/auctex/images/prvwrk24.xpm | 44 - packages/auctex/images/pspdf.xpm | 83 - packages/auctex/images/sep.xpm | 29 - packages/auctex/images/tex.xpm | 260 - packages/auctex/images/view.xpm | 31 - packages/auctex/images/viewdvi.xpm | 58 - packages/auctex/images/viewpdf.xpm | 54 - packages/auctex/images/viewps.xpm | 54 - packages/auctex/latex.el | 5468 -------------- packages/auctex/latex/prauctex.cfg | 48 - packages/auctex/latex/prauctex.def | 61 - packages/auctex/latex/prcounters.def | 38 - packages/auctex/latex/preview.sty | 391 - packages/auctex/latex/prfootnotes.def | 28 - packages/auctex/latex/prlyx.def | 32 - packages/auctex/latex/prshowbox.def | 32 - packages/auctex/latex/prshowlabels.def | 67 - packages/auctex/latex/prtightpage.def | 146 - packages/auctex/latex/prtracingall.def | 30 - packages/auctex/multi-prompt.el | 226 - packages/auctex/preview-latex.info | 2700 ------- packages/auctex/preview.el | 3610 ---------- packages/auctex/prv-emacs.el | 600 -- packages/auctex/style/.nosearch | 1 - packages/auctex/style/CJK.el | 93 - packages/auctex/style/CJKutf8.el | 38 - packages/auctex/style/MinionPro.el | 71 - packages/auctex/style/alltt.el | 55 - packages/auctex/style/alphanum.el | 99 - packages/auctex/style/amsart.el | 10 - packages/auctex/style/amsbook.el | 10 - packages/auctex/style/amsbsy.el | 18 - packages/auctex/style/amsmath.el | 181 - packages/auctex/style/amsopn.el | 19 - packages/auctex/style/amstex.el | 60 - packages/auctex/style/amstext.el | 16 - packages/auctex/style/amsthm.el | 53 - packages/auctex/style/article.el | 12 - packages/auctex/style/austrian.el | 39 - packages/auctex/style/babel.el | 108 - packages/auctex/style/beamer.el | 334 - packages/auctex/style/book.el | 12 - packages/auctex/style/booktabs.el | 74 - packages/auctex/style/bulgarian.el | 52 - packages/auctex/style/captcont.el | 46 - packages/auctex/style/comment.el | 69 - packages/auctex/style/csquotes.el | 245 - packages/auctex/style/czech.el | 7 - packages/auctex/style/danish.el | 16 - packages/auctex/style/dk-bib.el | 62 - packages/auctex/style/dk.el | 11 - packages/auctex/style/doc.el | 158 - packages/auctex/style/dutch.el | 11 - packages/auctex/style/emp.el | 84 - packages/auctex/style/fancyref.el | 122 - packages/auctex/style/flashcards.el | 60 - packages/auctex/style/foils.el | 46 - packages/auctex/style/francais.el | 41 - packages/auctex/style/frenchb.el | 77 - packages/auctex/style/german.el | 46 - packages/auctex/style/graphics.el | 10 - packages/auctex/style/graphicx.el | 302 - packages/auctex/style/harvard.el | 127 - packages/auctex/style/hyperref.el | 124 - packages/auctex/style/icelandic.el | 52 - packages/auctex/style/index.el | 83 - packages/auctex/style/inputenc.el | 86 - packages/auctex/style/italian.el | 59 - packages/auctex/style/j-article.el | 12 - packages/auctex/style/j-book.el | 12 - packages/auctex/style/j-report.el | 12 - packages/auctex/style/jarticle.el | 12 - packages/auctex/style/jbook.el | 12 - packages/auctex/style/jreport.el | 13 - packages/auctex/style/jsarticle.el | 12 - packages/auctex/style/jsbook.el | 12 - packages/auctex/style/jura.el | 39 - packages/auctex/style/jurabib.el | 634 -- packages/auctex/style/letter.el | 122 - packages/auctex/style/listings.el | 243 - packages/auctex/style/ltx-base.el | 86 - packages/auctex/style/ltxdoc.el | 40 - packages/auctex/style/makeidx.el | 48 - packages/auctex/style/mdwlist.el | 63 - packages/auctex/style/multido.el | 52 - packages/auctex/style/multind.el | 61 - packages/auctex/style/natbib.el | 110 - packages/auctex/style/naustrian.el | 39 - packages/auctex/style/ngerman.el | 46 - packages/auctex/style/nicefrac.el | 45 - packages/auctex/style/nomencl.el | 70 - packages/auctex/style/paralist.el | 104 - packages/auctex/style/pdfsync.el | 91 - packages/auctex/style/plfonts.el | 31 - packages/auctex/style/plhb.el | 31 - packages/auctex/style/polish.el | 51 - packages/auctex/style/polski.el | 54 - packages/auctex/style/pst-grad.el | 65 - packages/auctex/style/pst-node.el | 191 - packages/auctex/style/pst-plot.el | 137 - packages/auctex/style/pst-slpe.el | 67 - packages/auctex/style/pstricks.el | 866 --- packages/auctex/style/report.el | 12 - packages/auctex/style/ruby.el | 49 - packages/auctex/style/scrartcl.el | 26 - packages/auctex/style/scrbase.el | 222 - packages/auctex/style/scrbook.el | 62 - packages/auctex/style/scrlttr2.el | 239 - packages/auctex/style/scrpage2.el | 129 - packages/auctex/style/scrreprt.el | 63 - packages/auctex/style/shortvrb.el | 56 - packages/auctex/style/slides.el | 41 - packages/auctex/style/slovak.el | 10 - packages/auctex/style/subfigure.el | 73 - packages/auctex/style/swedish.el | 13 - packages/auctex/style/tabularx.el | 52 - packages/auctex/style/units.el | 49 - packages/auctex/style/url.el | 95 - packages/auctex/style/varioref.el | 63 - packages/auctex/style/verbatim.el | 43 - packages/auctex/style/virtex.el | 83 - packages/auctex/tex-bar.el | 513 -- packages/auctex/tex-buf.el | 2143 ------ packages/auctex/tex-fold.el | 980 --- packages/auctex/tex-font.el | 173 - packages/auctex/tex-fptex.el | 91 - packages/auctex/tex-info.el | 566 -- packages/auctex/tex-jp.el | 624 -- packages/auctex/tex-mik.el | 71 - packages/auctex/tex-site.el | 164 - packages/auctex/tex-style.el | 367 - packages/auctex/tex.el | 5605 --------------- packages/auctex/texmathp.el | 411 -- packages/auctex/toolbar-x.el | 2154 ------ 206 files changed, 30 insertions(+), 63902 deletions(-) delete mode 100644 packages/auctex/README delete mode 100644 packages/auctex/auctex-pkg.el delete mode 100644 packages/auctex/auctex.info delete mode 100644 packages/auctex/auctex.info-1 delete mode 100644 packages/auctex/auctex.info-2 delete mode 100644 packages/auctex/bib-cite.el delete mode 100644 packages/auctex/context-en.el delete mode 100644 packages/auctex/context-nl.el delete mode 100644 packages/auctex/context.el delete mode 100644 packages/auctex/dir delete mode 100644 packages/auctex/doc/auctex.texi delete mode 100644 packages/auctex/doc/changes.texi delete mode 100644 packages/auctex/doc/copying.texi delete mode 100644 packages/auctex/doc/faq.texi delete mode 100644 packages/auctex/doc/fdl.texi delete mode 100644 packages/auctex/doc/history.texi delete mode 100644 packages/auctex/doc/install.texi delete mode 100644 packages/auctex/doc/intro.texi delete mode 100644 packages/auctex/doc/macros.texi delete mode 100644 packages/auctex/doc/preview-dtxdoc.texi delete mode 100644 packages/auctex/doc/preview-faq.texi delete mode 100644 packages/auctex/doc/preview-latex.texi delete mode 100644 packages/auctex/doc/preview-problems.texi delete mode 100644 packages/auctex/doc/preview-readme.texi delete mode 100644 packages/auctex/doc/preview-todo.texi delete mode 100644 packages/auctex/doc/quickstart.texi delete mode 100644 packages/auctex/doc/todo.texi delete mode 100644 packages/auctex/doc/version.texi delete mode 100644 packages/auctex/doc/wininstall.texi delete mode 100644 packages/auctex/font-latex.el delete mode 100644 packages/auctex/images/amstex.xpm delete mode 100644 packages/auctex/images/bibtex.xpm delete mode 100644 packages/auctex/images/dropdown.xpm delete mode 100644 packages/auctex/images/dvipdf.xpm delete mode 100644 packages/auctex/images/dvips.xpm delete mode 100644 packages/auctex/images/error.xpm delete mode 100644 packages/auctex/images/exec.xpm delete mode 100644 packages/auctex/images/execbibtex.xpm delete mode 100644 packages/auctex/images/execdvips.xpm delete mode 100644 packages/auctex/images/execerror.xpm delete mode 100644 packages/auctex/images/execpdftex.xpm delete mode 100644 packages/auctex/images/exectex.xpm delete mode 100644 packages/auctex/images/execviewdvi.xpm delete mode 100644 packages/auctex/images/execviewpdf.xpm delete mode 100644 packages/auctex/images/execviewps.xpm delete mode 100644 packages/auctex/images/gv.xpm delete mode 100644 packages/auctex/images/jumpdvi.xpm delete mode 100644 packages/auctex/images/ltx-symb-turn-off.xpm delete mode 100644 packages/auctex/images/ltx-symb-turn-on.xpm delete mode 100644 packages/auctex/images/pdftex.xpm delete mode 100644 packages/auctex/images/prverr16.xpm delete mode 100644 packages/auctex/images/prverr20.xpm delete mode 100644 packages/auctex/images/prverr24.xbm delete mode 100644 packages/auctex/images/prverr24.xpm delete mode 100644 packages/auctex/images/prvtex-cap-up.xpm delete mode 100644 packages/auctex/images/prvtex12.xbm delete mode 100644 packages/auctex/images/prvtex12.xpm delete mode 100644 packages/auctex/images/prvtex16.xbm delete mode 100644 packages/auctex/images/prvtex16.xpm delete mode 100644 packages/auctex/images/prvtex20.xpm delete mode 100644 packages/auctex/images/prvtex24.xbm delete mode 100644 packages/auctex/images/prvtex24.xpm delete mode 100644 packages/auctex/images/prvwrk12.xpm delete mode 100644 packages/auctex/images/prvwrk14.xpm delete mode 100644 packages/auctex/images/prvwrk16.xpm delete mode 100644 packages/auctex/images/prvwrk20.xpm delete mode 100644 packages/auctex/images/prvwrk24.xbm delete mode 100644 packages/auctex/images/prvwrk24.xpm delete mode 100644 packages/auctex/images/pspdf.xpm delete mode 100644 packages/auctex/images/sep.xpm delete mode 100644 packages/auctex/images/tex.xpm delete mode 100644 packages/auctex/images/view.xpm delete mode 100644 packages/auctex/images/viewdvi.xpm delete mode 100644 packages/auctex/images/viewpdf.xpm delete mode 100644 packages/auctex/images/viewps.xpm delete mode 100644 packages/auctex/latex.el delete mode 100644 packages/auctex/latex/prauctex.cfg delete mode 100644 packages/auctex/latex/prauctex.def delete mode 100644 packages/auctex/latex/prcounters.def delete mode 100644 packages/auctex/latex/preview.sty delete mode 100644 packages/auctex/latex/prfootnotes.def delete mode 100644 packages/auctex/latex/prlyx.def delete mode 100644 packages/auctex/latex/prshowbox.def delete mode 100644 packages/auctex/latex/prshowlabels.def delete mode 100644 packages/auctex/latex/prtightpage.def delete mode 100644 packages/auctex/latex/prtracingall.def delete mode 100644 packages/auctex/multi-prompt.el delete mode 100644 packages/auctex/preview-latex.info delete mode 100644 packages/auctex/preview.el delete mode 100644 packages/auctex/prv-emacs.el delete mode 100644 packages/auctex/style/.nosearch delete mode 100644 packages/auctex/style/CJK.el delete mode 100644 packages/auctex/style/CJKutf8.el delete mode 100644 packages/auctex/style/MinionPro.el delete mode 100644 packages/auctex/style/alltt.el delete mode 100644 packages/auctex/style/alphanum.el delete mode 100644 packages/auctex/style/amsart.el delete mode 100644 packages/auctex/style/amsbook.el delete mode 100644 packages/auctex/style/amsbsy.el delete mode 100644 packages/auctex/style/amsmath.el delete mode 100644 packages/auctex/style/amsopn.el delete mode 100644 packages/auctex/style/amstex.el delete mode 100644 packages/auctex/style/amstext.el delete mode 100644 packages/auctex/style/amsthm.el delete mode 100644 packages/auctex/style/article.el delete mode 100644 packages/auctex/style/austrian.el delete mode 100644 packages/auctex/style/babel.el delete mode 100644 packages/auctex/style/beamer.el delete mode 100644 packages/auctex/style/book.el delete mode 100644 packages/auctex/style/booktabs.el delete mode 100644 packages/auctex/style/bulgarian.el delete mode 100644 packages/auctex/style/captcont.el delete mode 100644 packages/auctex/style/comment.el delete mode 100644 packages/auctex/style/csquotes.el delete mode 100644 packages/auctex/style/czech.el delete mode 100644 packages/auctex/style/danish.el delete mode 100644 packages/auctex/style/dk-bib.el delete mode 100644 packages/auctex/style/dk.el delete mode 100644 packages/auctex/style/doc.el delete mode 100644 packages/auctex/style/dutch.el delete mode 100644 packages/auctex/style/emp.el delete mode 100644 packages/auctex/style/fancyref.el delete mode 100644 packages/auctex/style/flashcards.el delete mode 100644 packages/auctex/style/foils.el delete mode 100644 packages/auctex/style/francais.el delete mode 100644 packages/auctex/style/frenchb.el delete mode 100644 packages/auctex/style/german.el delete mode 100644 packages/auctex/style/graphics.el delete mode 100644 packages/auctex/style/graphicx.el delete mode 100644 packages/auctex/style/harvard.el delete mode 100644 packages/auctex/style/hyperref.el delete mode 100644 packages/auctex/style/icelandic.el delete mode 100644 packages/auctex/style/index.el delete mode 100644 packages/auctex/style/inputenc.el delete mode 100644 packages/auctex/style/italian.el delete mode 100644 packages/auctex/style/j-article.el delete mode 100644 packages/auctex/style/j-book.el delete mode 100644 packages/auctex/style/j-report.el delete mode 100644 packages/auctex/style/jarticle.el delete mode 100644 packages/auctex/style/jbook.el delete mode 100644 packages/auctex/style/jreport.el delete mode 100644 packages/auctex/style/jsarticle.el delete mode 100644 packages/auctex/style/jsbook.el delete mode 100644 packages/auctex/style/jura.el delete mode 100644 packages/auctex/style/jurabib.el delete mode 100644 packages/auctex/style/letter.el delete mode 100644 packages/auctex/style/listings.el delete mode 100644 packages/auctex/style/ltx-base.el delete mode 100644 packages/auctex/style/ltxdoc.el delete mode 100644 packages/auctex/style/makeidx.el delete mode 100644 packages/auctex/style/mdwlist.el delete mode 100644 packages/auctex/style/multido.el delete mode 100644 packages/auctex/style/multind.el delete mode 100644 packages/auctex/style/natbib.el delete mode 100644 packages/auctex/style/naustrian.el delete mode 100644 packages/auctex/style/ngerman.el delete mode 100644 packages/auctex/style/nicefrac.el delete mode 100644 packages/auctex/style/nomencl.el delete mode 100644 packages/auctex/style/paralist.el delete mode 100644 packages/auctex/style/pdfsync.el delete mode 100644 packages/auctex/style/plfonts.el delete mode 100644 packages/auctex/style/plhb.el delete mode 100644 packages/auctex/style/polish.el delete mode 100644 packages/auctex/style/polski.el delete mode 100644 packages/auctex/style/pst-grad.el delete mode 100644 packages/auctex/style/pst-node.el delete mode 100644 packages/auctex/style/pst-plot.el delete mode 100644 packages/auctex/style/pst-slpe.el delete mode 100644 packages/auctex/style/pstricks.el delete mode 100644 packages/auctex/style/report.el delete mode 100644 packages/auctex/style/ruby.el delete mode 100644 packages/auctex/style/scrartcl.el delete mode 100644 packages/auctex/style/scrbase.el delete mode 100644 packages/auctex/style/scrbook.el delete mode 100644 packages/auctex/style/scrlttr2.el delete mode 100644 packages/auctex/style/scrpage2.el delete mode 100644 packages/auctex/style/scrreprt.el delete mode 100644 packages/auctex/style/shortvrb.el delete mode 100644 packages/auctex/style/slides.el delete mode 100644 packages/auctex/style/slovak.el delete mode 100644 packages/auctex/style/subfigure.el delete mode 100644 packages/auctex/style/swedish.el delete mode 100644 packages/auctex/style/tabularx.el delete mode 100644 packages/auctex/style/units.el delete mode 100644 packages/auctex/style/url.el delete mode 100644 packages/auctex/style/varioref.el delete mode 100644 packages/auctex/style/verbatim.el delete mode 100644 packages/auctex/style/virtex.el delete mode 100644 packages/auctex/tex-bar.el delete mode 100644 packages/auctex/tex-buf.el delete mode 100644 packages/auctex/tex-fold.el delete mode 100644 packages/auctex/tex-font.el delete mode 100644 packages/auctex/tex-fptex.el delete mode 100644 packages/auctex/tex-info.el delete mode 100644 packages/auctex/tex-jp.el delete mode 100644 packages/auctex/tex-mik.el delete mode 100644 packages/auctex/tex-site.el delete mode 100644 packages/auctex/tex-style.el delete mode 100644 packages/auctex/tex.el delete mode 100644 packages/auctex/texmathp.el delete mode 100644 packages/auctex/toolbar-x.el diff --git a/GNUmakefile b/GNUmakefile index 0fac72be8..2b077678f 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -42,15 +42,21 @@ process-archive: # FIXME, we could probably speed this up significantly with # rules like "%.tar: ../%/ChangeLog" so we only rebuild the packages # that have indeed changed. - cd $(ARCHIVE_TMP)/packages; \ - $(EMACS) -l $(CURDIR)/admin/archive-contents.el \ - -f batch-make-archive - @cd $(ARCHIVE_TMP)/packages; \ - for pt in *; do \ - if [ -d $$pt ]; then \ - echo "Creating tarball $${pt}.tar" && \ - tar -cf $${pt}.tar $$pt --remove-files; \ - fi; \ + cd $(ARCHIVE_TMP)/packages; \ + $(EMACS) -l $(CURDIR)/admin/archive-contents.el \ + -f batch-make-archive + @cd $(ARCHIVE_TMP)/packages; \ + for pt in *; do \ + if [ -f "$${pt}/.elpaignore" ]; then \ + ignore="$${pt}/.elpaignore"; \ + else \ + ignore="/dev/null"; \ + fi; \ + if [ -d $$pt ]; then \ + echo "Creating tarball $${pt}.tar" && \ + tar -cf $${pt}.tar $$pt -X "$$ignore"; \ + rm -r $${pt}; \ + fi; \ done mkdir -p archive/packages mv archive/packages archive/packages-old diff --git a/admin/archive-contents.el b/admin/archive-contents.el index 2d588e9f9..499728ecf 100644 --- a/admin/archive-contents.el +++ b/admin/archive-contents.el @@ -36,7 +36,8 @@ (when vers (let ((l (version-to-list vers))) ;; Signal an error for things like "1.02" which is parsed as "1.2". - (assert (equal vers (package-version-join l))) + (assert (equal vers (package-version-join l)) nil + "Unsupported version syntax %S" vers) l))) (defun archive--convert-require (elt) @@ -51,9 +52,9 @@ Otherwise return nil." (when (string-match "\\`[ \t]*[$]Revision:[ \t]+" str) (setq str (substring str (match-end 0)))) (condition-case nil - (if (archive--version-to-list str) - str) - (error nil)))) + (if (archive--version-to-list str) + str) + (error str)))) (defun archive--delete-elc-files (dir &optional only-orphans) "Recursively delete all .elc files in DIR. diff --git a/admin/update-archive.sh b/admin/update-archive.sh index fb7b91d7f..9d8d9c76c 100755 --- a/admin/update-archive.sh +++ b/admin/update-archive.sh @@ -52,7 +52,13 @@ make -f "$buildir/GNUmakefile" check_copyrights || cd "$buildir" -rsync -av --delete --exclude=ChangeLog --exclude=.git ../elpa/packages ./ +rsync -av --delete \ + --exclude=ChangeLog \ + --exclude=.git \ + --exclude='*.elc' \ + --exclude='*~' \ + --exclude='*-autoloads.el' \ + ../elpa/packages ./ # Refresh the ChangeLog files. This needs to be done in # the source tree, because it needs the VCS data! diff --git a/copyright_exceptions b/copyright_exceptions index 4fc04a61e..450facde3 100644 --- a/copyright_exceptions +++ b/copyright_exceptions @@ -1,5 +1,6 @@ ./auctex/latex.el: "pounds" "copyright" ./auctex/multi-prompt.el +./auctex/plain-tex.el: "copyright" ./auctex/style/amsart.el ./auctex/style/amsbook.el ./auctex/style/amsbsy.el @@ -25,8 +26,7 @@ ./auctex/style/jsarticle.el ./auctex/style/jsbook.el ./auctex/style/jurabib.el:;; you assign the copyright to the FSF. -./auctex/style/letter.el -./auctex/style/natbib.el +./auctex/style/latexinfo.el: '("copyright" nil) ./auctex/style/ngerman.el ./auctex/style/plfonts.el ./auctex/style/plhb.el diff --git a/externals-list b/externals-list index 2714f5ee5..5a6e2dff4 100644 --- a/externals-list +++ b/externals-list @@ -18,7 +18,7 @@ ;; diverged). (("ack" :subtree "https://github.com/leoliu/ack-el") - ;;FIXME:("auctex" :subtree "git://git.sv.gnu.org/auctex.git") + ("auctex" :external "git://git.sv.gnu.org/auctex.git") ("coffee-mode" :subtree "https://github.com/defunkt/coffee-mode") ("company" :subtree "https://github.com/company-mode/company-mode.git") ("dismal" :external nil) diff --git a/packages/auctex/README b/packages/auctex/README deleted file mode 100644 index f04b9cf05..000000000 --- a/packages/auctex/README +++ /dev/null @@ -1,243 +0,0 @@ -This is the README file for the AUCTeX distribution. - - Copyright (C) 2008 Free Software Foundation, Inc. - - Copying and distribution of this file, with or without - modification, are permitted in any medium without royalty provided - the copyright notice and this notice are preserved. - -Introduction to AUCTeX -********************** - -This file gives a brief overview of what AUCTeX is. It is *not* an -attempt to document AUCTeX. Real documentation for AUCTeX is available -in the manual, which should be available as an info file after -installation. - -AUCTeX is a comprehensive customizable integrated environment for -writing input files for TeX, LaTeX, ConTeXt, Texinfo, and docTeX using -Emacs or XEmacs. - -It supports you in the insertion of macros, environments, and sectioning -commands by providing completion alternatives and prompting for -parameters. It automatically indents your text as you type it and lets -you format a whole file at once. The outlining and folding facilities -provide you with a focused and clean view of your text. - -AUCTeX lets you process your source files by running TeX and related -tools (such as output filters, post processors for generating indices -and bibliographies, and viewers) from inside Emacs. AUCTeX lets you -browse through the errors TeX reported, while it moves the cursor -directly to the reported error, and displays some documentation for -that particular error. This will even work when the document is spread -over several files. - -One component of AUCTeX that LaTeX users will find attractive is -preview-latex, a combination of folding and in-source previewing that -provides true "What You See Is What You Get" experience in your -sourcebuffer, while letting you retain full control. For more -information, see further below. - -More detailed information about the features and usage of AUCTeX can be -found in the AUCTeX manual. You can access it from within Emacs by -typing `C-h i d m auctex '. If you prefer the standalone info -reader, issue the command `info auctex' in a terminal. - -AUCTeX is written entirely in Emacs Lisp, and hence you can easily add -new features for your own needs. It is a GNU project and distributed -under the `GNU General Public License Version 3'. - -The most recent version is always available at -`http://ftp.gnu.org/pub/gnu/auctex/'. - -WWW users may want to check out the AUCTeX page at -`http://www.gnu.org/software/auctex/'. - -For comprehensive information about how to install AUCTeX read the file -`INSTALL' or `INSTALL.windows', respectively. - -If you are considering upgrading AUCTeX, the recent changes are -described in the `CHANGES' file. - -If you want to discuss AUCTeX with other users or its developers, there -are several mailing lists you can use. - -Send a mail with the subject "subscribe" to in -order to join the general discussion list for AUCTeX. Articles should -be sent to . In a similar way, you can subscribe to -the list for just getting important announcements -about AUCTeX. The list is for bug reports which -you should usually file with the `M-x TeX-submit-bug-report ' -command. If you want to address the developers of AUCTeX themselves -with technical issues, they can be found on the discussion list -. - -preview-latex in a nutshell -*************************** - -Does your neck hurt from turning between previewer windows and the -source too often? This AUCTeX component will render your displayed -LaTeX equations right into the editing window where they belong. - -The purpose of preview-latex is to embed LaTeX environments such as -display math or figures into the source buffers and switch conveniently -between source and image representation. - -1 What use is it? -***************** - -WYSIWYG (what you see is what you get) sometimes is considered all the -rage, sometimes frowned upon. Do we really want it? Wrong question. -The right question is _what_ we want from it. Except when finetuning -the layout, we don't want to use printer fonts for on-screen text -editing. The low resolution and contrast of a computer screen render -all but the coarsest printer fonts (those for low-quality newsprint) -unappealing, and the margins and pagination of the print are not wanted -on the screen, either. On the other hand, more complex visual -compositions like math formulas and tables can't easily be taken in -when seen only in the source. preview-latex strikes a balance: it only -uses graphic renditions of the output for certain, configurable -constructs, does this only when told, and then right in the source code. -Switching back and forth between the source and preview is easy and -natural and can be done for each image independently. Behind the scenes -of preview-latex, a sophisticated framework of other programs like -`dvipng', Dvips and Ghostscript are employed together with a special -LaTeX style file for extracting the material of interest in the -background and providing fast interactive response. - -2 Activating preview-latex -************************** - -After installation, the package may need to be activated (and remember -to activate AUCTeX too). In XEmacs, and in any prepackaged versions -worth their salt, activation should be automatic upon installation. If -this seems not the case, complain to your installation provider. - -The usual activation (if it is not done automatically) would be - - (load "preview-latex.el" nil t t) - -If you still don't get a "Preview" menu in LaTeX mode in spite of -AUCTeX showing its "Command", your installation is broken. One -possible cause are duplicate Lisp files that might be detectable with -` list-load-path-shadows '. - -3 Getting started -***************** - -Once activated, preview-latex and its documentation will be accessible -via its menus (note that preview-latex requires AUCTeX to be loaded). -When you have loaded a LaTeX document (a sample document `circ.tex' is -included in the distribution, but most documents including math and/or -figures should do), you can use its menu or `C-c C-p C-d' (for -`Preview/Document'). Previews will now be generated for various -objects in your document. You can use the time to take a short look at -the other menu entries and key bindings in the `Preview' menu. You'll -see the previewed objects change into a roadworks sign when -preview-latex has determined just what it is going to preview. Note -that you can freely navigate the buffer while this is going on. When -the process is finished you will see the objects typeset in your buffer. - -It is a bad idea, however, to edit the buffer before the roadworks signs -appear, since that is the moment when the correlation between the -original text and the buffer locations gets established. If the buffer -changes before that point of time, the previews will not be placed where -they belong. If you do want to change some obvious error you just -spotted, we recommend you stop the background process by pressing `C-c -C-k'. - -To see/edit the LaTeX code for a specific object, put the point (the -cursor) on it and press `C-c C-p C-p' (for `Preview/at point'). It -will also do to click with the middle mouse button on the preview. Now -you can edit the code, and generate a new preview by again pressing -`C-c C-p C-p' (or by clicking with the middle mouse button on the icon -before the edited text). - -If you are using the `desktop' package, previews will remain from one -session to the next as long as you don't kill your buffer. If you are -using XEmacs, you will probably need to upgrade the package to the -newest one; things are being fixed just as I am writing this. - -4 Basic modes of operation -************************** - -preview-latex has a number of methods for generating its graphics. Its -default operation is equivalent to using the `LaTeX' command from -AUCTeX. If this happens to be a call of PDFLaTeX generating PDF output -(you need at least AUCTeX 11.51 for this), then Ghostscript will be -called directly on the resulting PDF file. If a DVI file gets -produced, first Dvips and then Ghostscript get called by default. - -The image type to be generated by Ghostscript can be configured with - - M-x customize-variable RET preview-image-type RET - -The default is `png' (the most efficient image type). A special -setting is `dvipng' in case you have the `dvipng' program installed. -In this case, `dvipng' will be used for converting DVI files and -Ghostscript (with a `PNG' device) for converting PDF files. `dvipng' -is much faster than the combination of Dvips and Ghostscript. You can -get downloads, access to its CVS archive and further information from -its project site (http://savannah.nongnu.org/projects/dvipng). - -5 More documentation -******************** - -After the installation, documentation in the form of an info manual -will be available. You can access it with the standalone info reader -with - - info preview-latex - -or by pressing `C-h i d m preview-latex ' in Emacs. Once -preview-latex is activated, you can instead use `C-c C-p ' (or the -menu entry `Preview/Read documentation'). - -Depending on your installation, a printable manual may also be -available in the form of `preview-latex.dvi' or `preview-latex.ps'. - -Detailed documentation for the LaTeX style used for extracting the -preview images is placed in `preview.dvi' in a suitable directory -during installation; on typical teTeX-based systems, - - texdoc preview - -will display it. - -6 Availability -************** - -The preview-latex project is now part of AUCTeX and accessible as part -of the AUCTeX project page (http://savannah.gnu.org/projects/auctex). -You can get its files from the AUCTeX download area -(ftp://ftp.gnu.org/pub/gnu/auctex). As of AUCTeX 11.81, preview-latex -should already be integrated into AUCTeX, so no separate download will -be necessary. - -You will also find `.rpm' files there for Fedora and possibly SuSE. -Anonymous CVS is available as well. - -7 Contacts -********** - -Bug reports should be sent by using `M-x preview-report-bug ', as -this will fill in a lot of information interesting to us. If the -installation fails (but this should be a rare event), report bugs to -. - -There is a general discussion list for AUCTeX which also covers -preview-latex, look at `http://lists.gnu.org/mailman/listinfo/auctex'. -For more information on the mailing list, send a message with just the -word "help" as subject or body to . For the -developers, there is the list; it would probably -make sense to direct feature requests and questions about internal -details there. There is a low-volume read-only announcement list -available to which you can subscribe by sending a mail with "subscribe" -in the subject to . - -Offers to support further development will be appreciated. If you want -to show your appreciation with a donation to the main developer, you can -do so via PayPal to , and of course you can arrange for -service contracts or for added functionality. Take a look at the -`TODO' list for suggestions in that area. - diff --git a/packages/auctex/auctex-pkg.el b/packages/auctex/auctex-pkg.el deleted file mode 100644 index 6b3dca3f2..000000000 --- a/packages/auctex/auctex-pkg.el +++ /dev/null @@ -1 +0,0 @@ -(define-package "auctex" "11.86.1" "Integrated environment for *TeX*" nil :url "http://www.gnu.org/software/auctex/") diff --git a/packages/auctex/auctex.info b/packages/auctex/auctex.info deleted file mode 100644 index fde0099b1..000000000 --- a/packages/auctex/auctex.info +++ /dev/null @@ -1,119 +0,0 @@ -This is auctex.info, produced by makeinfo version 4.13 from auctex.texi. - -This manual is for AUCTeX (version 11.86 from 2010-02-21), a -sophisticated TeX environment for Emacs. - - Copyright (C) 1992, 1993, 1994, 1995, 2001, 2002, 2004, 2005, 2006, -2007, 2008, 2009, 2010 Free Software Foundation, Inc. - - Permission is granted to copy, distribute and/or modify this - document under the terms of the GNU Free Documentation License, - Version 1.3 or any later version published by the Free Software - Foundation; with no Invariant Sections, no Front-Cover Texts and - no Back-Cover Texts. A copy of the license is included in the - section entitled "GNU Free Documentation License." - -INFO-DIR-SECTION Emacs -START-INFO-DIR-ENTRY -* AUCTeX: (auctex). A sophisticated TeX environment for Emacs. -END-INFO-DIR-ENTRY -INFO-DIR-SECTION TeX -START-INFO-DIR-ENTRY -* AUCTeX: (auctex). A sophisticated TeX environment for Emacs. -END-INFO-DIR-ENTRY - - -Indirect: -auctex.info-1: 961 -auctex.info-2: 291546 - -Tag Table: -(Indirect) -Node: Top961 -Node: Copying6965 -Node: Introduction8921 -Node: Summary9191 -Node: Installation11935 -Node: Prerequisites12901 -Node: Configure15930 -Node: Build/install21352 -Node: Loading the package21843 -Node: Advice for package providers23650 -Node: Advice for non-privileged users27598 -Node: Installation under MS Windows31555 -Node: Customizing46789 -Node: Quick Start48372 -Ref: Quick Start-Footnote-150165 -Node: Editing Facilities50312 -Node: Processing Facilities55108 -Node: Editing59002 -Node: Quotes60237 -Node: Font Specifiers63978 -Node: Sectioning65804 -Node: Environments70118 -Node: Equations72484 -Node: Floats73075 -Node: Itemize-like74614 -Node: Tabular-like75156 -Node: Customizing Environments75785 -Node: Mathematics76025 -Node: Completion78952 -Node: Commenting83017 -Node: Indenting84345 -Node: Filling90138 -Node: Display95459 -Node: Font Locking96772 -Node: Fontification of macros98847 -Node: Fontification of quotes108294 -Node: Fontification of math109789 -Node: Verbatim content111509 -Node: Faces112283 -Node: Known problems112772 -Node: Folding113700 -Node: Outline124133 -Node: Processing125387 -Node: Commands126550 -Node: Starting a Command127106 -Node: Selecting a Command130849 -Node: Processor Options133731 -Node: Viewing139415 -Node: Starting Viewers139789 -Node: I/O Correlation145957 -Node: Debugging148330 -Node: Checking149844 -Node: Control151148 -Node: Cleaning151877 -Node: Documentation153090 -Node: Customization153870 -Node: Modes and Hooks154363 -Node: Multifile155571 -Node: Parsing Files160282 -Node: Internationalization164687 -Node: European165868 -Node: Japanese172689 -Node: Automatic174386 -Node: Automatic Global176910 -Node: Automatic Private178071 -Node: Automatic Local179384 -Node: Style Files180471 -Node: Simple Style181264 -Node: Adding Macros182355 -Node: Adding Environments187859 -Node: Adding Other192128 -Node: Hacking the Parser192715 -Node: Appendices196588 -Node: Copying this Manual196839 -Node: GNU Free Documentation License197762 -Node: Changes222900 -Node: Development246154 -Node: Mid-term Goals246800 -Node: Wishlist248362 -Node: Bugs255300 -Node: FAQ256695 -Node: Indices262843 -Node: Key Index263006 -Node: Function Index268016 -Node: Variable Index275687 -Node: Concept Index291546 - -End Tag Table diff --git a/packages/auctex/auctex.info-1 b/packages/auctex/auctex.info-1 deleted file mode 100644 index 478d5bdcb..000000000 --- a/packages/auctex/auctex.info-1 +++ /dev/null @@ -1,6658 +0,0 @@ -This is auctex.info, produced by makeinfo version 4.13 from auctex.texi. - -This manual is for AUCTeX (version 11.86 from 2010-02-21), a -sophisticated TeX environment for Emacs. - - Copyright (C) 1992, 1993, 1994, 1995, 2001, 2002, 2004, 2005, 2006, -2007, 2008, 2009, 2010 Free Software Foundation, Inc. - - Permission is granted to copy, distribute and/or modify this - document under the terms of the GNU Free Documentation License, - Version 1.3 or any later version published by the Free Software - Foundation; with no Invariant Sections, no Front-Cover Texts and - no Back-Cover Texts. A copy of the license is included in the - section entitled "GNU Free Documentation License." - -INFO-DIR-SECTION Emacs -START-INFO-DIR-ENTRY -* AUCTeX: (auctex). A sophisticated TeX environment for Emacs. -END-INFO-DIR-ENTRY -INFO-DIR-SECTION TeX -START-INFO-DIR-ENTRY -* AUCTeX: (auctex). A sophisticated TeX environment for Emacs. -END-INFO-DIR-ENTRY - - -File: auctex.info, Node: Top, Next: Copying, Up: (dir) - -AUCTeX -****** - -This manual may be copied under the conditions spelled out in *note -Copying this Manual::. - - AUCTeX is an integrated environment for editing LaTeX, ConTeXt, -docTeX, Texinfo, and TeX files. - - Although AUCTeX contains a large number of features, there are no -reasons to despair. You can continue to write TeX and LaTeX documents -the way you are used to, and only start using the multiple features in -small steps. AUCTeX is not monolithic, each feature described in this -manual is useful by itself, but together they provide an environment -where you will make very few LaTeX errors, and makes it easy to find -the errors that may slip through anyway. - - It is a good idea to make a printout of AUCTeX's reference card -`tex-ref.tex' or one of its typeset versions. - - If you want to make AUCTeX aware of style files and multi-file -documents right away, insert the following in your `.emacs' file. - - (setq TeX-auto-save t) - (setq TeX-parse-self t) - (setq-default TeX-master nil) - - Another thing you should enable is RefTeX, a comprehensive solution -for managing cross references, bibliographies, indices, document -navigation and a few other things. (*note Installation: -(reftex)Installation.) - - For detailed information about the preview-latex subsystem of -AUCTeX, see *note Introduction: (preview-latex)Top. - - There is a mailing list for general discussion about AUCTeX: write a -mail with "subscribe" in the subject to to -join it. Send contributions to . - - Bug reports should go to , suggestions for new -features, and pleas for help should go to either -(the AUCTeX developers), or to if they might have -general interest. Please use the command `M-x TeX-submit-bug-report -RET' to report bugs if possible. You can subscribe to a low-volume -announcement list by sending "subscribe" in the subject of a mail to -. - -* Menu: - -* Copying:: Copying -* Introduction:: Introduction to AUCTeX -* Editing:: Editing the Document Source -* Display:: Controlling Screen Display -* Processing:: Starting Processors, Viewers and Other Programs -* Customization:: Customization and Extension -* Appendices:: Copying, Changes, Development, FAQ -* Indices:: Indices - - --- The Detailed Node Listing --- - -Introduction - -* Summary:: Overview of AUCTeX -* Installation:: Installing AUCTeX -* Quick Start:: Quick Start - -Editing the Document Source - -* Quotes:: Inserting double quotes -* Font Specifiers:: Inserting Font Specifiers -* Sectioning:: Inserting chapters, sections, etc. -* Environments:: Inserting Environment Templates -* Mathematics:: Entering Mathematics -* Completion:: Completion of macros -* Commenting:: Commenting text -* Indenting:: Reflecting syntactic constructs with whitespace -* Filling:: Automatic and manual line breaking - -Inserting Environment Templates - -* Equations:: Equations -* Floats:: Floats -* Itemize-like:: Itemize-like Environments -* Tabular-like:: Tabular-like Environments -* Customizing Environments:: Customizing Environments - -Controlling Screen Display - -* Font Locking:: Font Locking -* Folding:: Folding Macros and Environments -* Outline:: Outlining the Document - -Font Locking - -* Fontification of macros:: Fontification of macros -* Fontification of quotes:: Fontification of quotes -* Fontification of math:: Fontification of math constructs -* Verbatim content:: Verbatim macros and environments -* Faces:: Faces used by font-latex - -Starting Processors, Viewers and Other Programs - -* Commands:: Invoking external commands. -* Viewing:: Invoking external viewers. -* Debugging:: Debugging TeX and LaTeX output. -* Checking:: Checking the document. -* Control:: Controlling the processes. -* Cleaning:: Cleaning intermediate and output files. -* Documentation:: Documentation about macros and packages. - -Viewing the Formatted Output - -* Starting Viewers:: Starting viewers -* I/O Correlation:: Forward and inverse search - -Customization and Extension - -* Multifile:: Multifile Documents -* Parsing Files:: Automatic Parsing of TeX Files -* Internationalization:: Language Support -* Automatic:: Automatic Customization -* Style Files:: Writing Your Own Style Support - -Language Support - -* European:: Using AUCTeX with European Languages -* Japanese:: Using AUCTeX with Japanese - -Automatic Customization - -* Automatic Global:: Automatic Customization for the Site -* Automatic Private:: Automatic Customization for a User -* Automatic Local:: Automatic Customization for a Directory - -Writing Your Own Style Support - -* Simple Style:: A Simple Style File -* Adding Macros:: Adding Support for Macros -* Adding Environments:: Adding Support for Environments -* Adding Other:: Adding Other Information -* Hacking the Parser:: Automatic Extraction of New Things - -Copying, Changes, Development, FAQ - -* Copying this Manual:: -* Changes:: -* Development:: -* FAQ:: - -Copying this Manual - -* GNU Free Documentation License:: License for copying this manual. - -Indices - -* Key Index:: -* Function Index:: -* Variable Index:: -* Concept Index:: - - -File: auctex.info, Node: Copying, Next: Introduction, Prev: Top, Up: Top - -Copying -******* - -AUCTeX primarily consists of Lisp files for Emacs (and XEmacs), but -there are also installation scripts and files and TeX support files. -All of those are "free"; this means that everyone is free to use them -and free to redistribute them on a free basis. The files of AUCTeX are -not in the public domain; they are copyrighted and there are -restrictions on their distribution, but these restrictions are designed -to permit everything that a good cooperating citizen would want to do. -What is not allowed is to try to prevent others from further sharing -any version of these programs that they might get from you. - - Specifically, we want to make sure that you have the right to give -away copies of the files that constitute AUCTeX, that you receive source -code or else can get it if you want it, that you can change these files -or use pieces of them in new free programs, and that you know you can do -these things. - - To make sure that everyone has such rights, we have to forbid you to -deprive anyone else of these rights. For example, if you distribute -copies of parts of AUCTeX, you must give the recipients all the rights -that you have. You must make sure that they, too, receive or can get -the source code. And you must tell them their rights. - - Also, for our own protection, we must make certain that everyone -finds out that there is no warranty for AUCTeX. If any parts are -modified by someone else and passed on, we want their recipients to -know that what they have is not what we distributed, so that any -problems introduced by others will not reflect on our reputation. - - The precise conditions of the licenses for the files currently being -distributed as part of AUCTeX are found in the General Public Licenses -that accompany them. This manual specifically is covered by the GNU -Free Documentation License (*note Copying this Manual::). - - -File: auctex.info, Node: Introduction, Next: Editing, Prev: Copying, Up: Top - -1 Introduction -************** - -* Menu: - -* Summary:: Overview of AUCTeX -* Installation:: Installing AUCTeX -* Quick Start:: Quick Start - - -File: auctex.info, Node: Summary, Next: Installation, Up: Introduction - -1.1 Overview of AUCTeX -====================== - - AUCTeX is a comprehensive customizable integrated environment for -writing input files for TeX, LaTeX, ConTeXt, Texinfo, and docTeX using -Emacs or XEmacs. - - It supports you in the insertion of macros, environments, and -sectioning commands by providing completion alternatives and prompting -for parameters. It automatically indents your text as you type it and -lets you format a whole file at once. The outlining and folding -facilities provide you with a focused and clean view of your text. - - AUCTeX lets you process your source files by running TeX and related -tools (such as output filters, post processors for generating indices -and bibliographies, and viewers) from inside Emacs. AUCTeX lets you -browse through the errors TeX reported, while it moves the cursor -directly to the reported error, and displays some documentation for -that particular error. This will even work when the document is spread -over several files. - - One component of AUCTeX that LaTeX users will find attractive is -preview-latex, a combination of folding and in-source previewing that -provides true "What You See Is What You Get" experience in your -sourcebuffer, while letting you retain full control. - - More detailed information about the features and usage of AUCTeX can -be found in the remainder of this manual. - - AUCTeX is written entirely in Emacs Lisp, and hence you can easily -add new features for your own needs. It is a GNU project and -distributed under the `GNU General Public License Version 3'. - - The most recent version is always available at -`http://ftp.gnu.org/pub/gnu/auctex/'. - - WWW users may want to check out the AUCTeX page at -`http://www.gnu.org/software/auctex/'. - - For comprehensive information about how to install AUCTeX *Note -Installation::, or *note Installation under MS Windows::, respectively. - - If you are considering upgrading AUCTeX, the recent changes are -described in *note Changes::. - - If you want to discuss AUCTeX with other users or its developers, -there are several mailing lists you can use. - - Send a mail with the subject "subscribe" to -in order to join the general discussion list for AUCTeX. Articles -should be sent to . In a similar way, you can -subscribe to the list for just getting important -announcements about AUCTeX. The list is for bug -reports which you should usually file with the `M-x -TeX-submit-bug-report ' command. If you want to address the -developers of AUCTeX themselves with technical issues, they can be -found on the discussion list . - - -File: auctex.info, Node: Installation, Next: Quick Start, Prev: Summary, Up: Introduction - -1.2 Installing AUCTeX -===================== - - Installing AUCTeX should be simple: merely `./configure', `make', -and `make install' for a standard site-wide installation (most other -installations can be done by specifying a `--prefix=...' option). - - On many systems, this will already activate the package, making its -modes the default instead of the built-in modes of Emacs. If this is -not the case, consult *note Loading the package::. Please read through -this document fully before installing anything. The installation -procedure has changed as compared to earlier versions. Users of -MS Windows are asked to consult *Note Installation under MS Windows::. - -* Menu: - -* Prerequisites:: -* Configure:: -* Build/install:: -* Loading the package:: -* Advice for package providers:: -* Advice for non-privileged users:: -* Installation under MS Windows:: -* Customizing:: - - -File: auctex.info, Node: Prerequisites, Next: Configure, Up: Installation - -1.2.1 Prerequisites -------------------- - - * A recent version of Emacs, alternatively XEmacs - - Emacs 20 is no longer supported, and neither is XEmacs with a - version of `xemacs-base' older than 1.84 (released in sumo from - 02/02/2004). Using preview-latex requires a version of Emacs - compiled with image support. While the X11 version of Emacs 21 - will likely work, Emacs 22 and later is the preferred platform. - - Windows - Precompiled versions are available from - `ftp://ftp.gnu.org/gnu/emacs/windows/'. - - Mac OS X - For an overview of precompiled versions of Emacs for Mac OS X - see for example - `http://www.emacswiki.org/cgi-bin/wiki/EmacsForMacOS'. - - GNU/Linux - Most GNU/Linux distributions nowadays provide a variant of - Emacs 22 or later via their package repositories. - - Self-compiled - Compiling Emacs yourself requires a C compiler and a number - of tools and development libraries. Details are beyond the - scope of this manual. Instructions for checking out the - source code can be found at - `https://savannah.gnu.org/bzr/?group=emacs'. - - If you really need to use Emacs 21 on platforms where this implies - missing image support, you should disable the installation of - preview-latex (see below). - - While XEmacs (version 21.4.15, 21.4.17 or later) is supported, - doing this in a satisfactory manner has proven to be difficult. - This is mostly due to technical shortcomings and differing API's - which are hard to come by. If AUCTeX is your main application for - XEmacs, you are likely to get better results and support by - switching to Emacs. Of course, you can improve support for your - favorite editor by giving feedback in case you encounter bugs. - - * A working TeX installation - - Well, AUCTeX would be pointless without that. Processing - documentation requires TeX, LaTeX and Texinfo during installation. - preview-latex requires Dvips for its operation in DVI mode. The - default configuration of AUCTeX is tailored for teTeX or - TeXlive-based distributions, but can be adapted easily. - - * A recent Ghostscript - - This is needed for operation of preview-latex in both DVI and PDF - mode. Most versions of Ghostscript nowadays in use should work - fine (version 7.0 and newer). If you encounter problems, check - *note Problems with Ghostscript: (preview-latex)Problems with - Ghostscript. - - * The `texinfo' package - - Strictly speaking, you can get away without it if you are building - from the distribution tarball, have not modified any files and - don't need a printed version of the manual: the pregenerated info - file is included in the tarball. At least version 4.0 is required. - - - For some known issues with various software, see *note Known -problems: (preview-latex)Known problems. - - -File: auctex.info, Node: Configure, Next: Build/install, Prev: Prerequisites, Up: Installation - -1.2.2 Configure ---------------- - -The first step is to configure the source code, telling it where -various files will be. To do so, run - - ./configure OPTIONS - - (Note: if you have fetched AUCTeX from CVS rather than a regular -release, you will have to first follow the instructions in -`README.CVS'). - - On many machines, you will not need to specify any options, but if -`configure' cannot determine something on its own, you'll need to help -it out with one of these options: - -`--prefix=`/usr/local'' - All automatic placements for package components will be chosen from - sensible existing hierarchies below this: directories like `man', - `share' and `bin' are supposed to be directly below PREFIX. - - Only if no workable placement can be found there, in some cases an - alternative search will be made in a prefix deduced from a suitable - binary. - - `/usr/local' is the default PREFIX, intended to be suitable for a - site-wide installation. If you are packaging this as an operating - system component for distribution, the setting `/usr' will - probably be the right choice. If you are planning to install the - package as a single non-priviledged user, you will typically set - PREFIX to your home directory. - -`--with-emacs[=/PATH/TO/EMACS]' - If you are using a pretest which isn't in your `$PATH', or - `configure' is not finding the right Emacs executable, you can - specify it with this option. - -`--with-xemacs[=/PATH/TO/XEMACS]' - Configure for generation under XEmacs (Emacs is the default). - Again, the name of the right XEmacs executable can be specified, - complete with path if necessary. - -`--with-packagedir=/DIR' - This XEmacs-only option configures the directory for XEmacs - packages. A typical user-local setting would be - `~/.xemacs/xemacs-packages'. If this directory exists and is - below PREFIX, it should be detected automatically. This will - install and activate the package. - -`--without-packagedir' - This XEmacs-only option switches the detection of a package - directory and corresponding installation off. Consequently, the - Emacs installation scheme will be used. This might be appropriate - if you are using a different package system/installer than the - XEmacs one and want to avoid conflicts. - - The Emacs installation scheme has the following options: - -`--with-lispdir=/DIR' - This Emacs-only option specifies the location of the `site-lisp' - directory within `load-path' under which the files will get - installed (the bulk will get installed in a subdirectory). - `./configure' should figure this out by itself. - -`--with-auctexstartfile=`auctex.el'' -`--with-previewstartfile=`preview-latex.el'' - This is the name of the respective startup files. If LISPDIR - contains a subdirectory `site-start.d', the start files are placed - there, and `site-start.el' should load them automatically. Please - be aware that you must not move the start files after installation - since other files are found _relative_ to them. - -`--with-packagelispdir=`auctex'' - This is the directory where the bulk of the package gets located. - The startfile adds this into LOAD-PATH. - -`--with-auto-dir=/DIR' - You can use this option to specify the directory containing - automatically generated information. It is not necessary for most - TeX installs, but may be used if you don't like the directory that - configure is suggesting. - -`--help' - This is not an option specific to AUCTeX. A number of standard - options to `configure' exist, and we do not have the room to - describe them here; a short description of each is available, using - `--help'. If you use `--help=recursive', then also - preview-latex-specific options will get listed. - -`--disable-preview' - This disables configuration and installation of preview-latex. - This option is not actually recommended. If your Emacs does not - support images, you should really upgrade to a newer version. - Distributors should, if possible, refrain from distributing AUCTeX - and preview-latex separately in order to avoid confusion and - upgrade hassles if users install partial packages on their own. - -`--with-texmf-dir=/DIR - --without-texmf-dir' - This option is used for specifying a TDS-compliant directory - hierarchy. Using `--with-texmf-dir=/DIR' you can specify where - the TeX TDS directory hierarchy resides, and the TeX files will - get installed in `/DIR/tex/latex/preview/'. - - If you use the `--without-texmf-dir' option, the TeX-related files - will be kept in the Emacs Lisp tree, and at runtime the - `TEXINPUTS' environment variable will be made to point there. You - can install those files into your own TeX tree at some later time - with `M-x preview-install-styles RET'. - -`--with-tex-dir=/DIR' - If you want to specify an exact directory for the preview TeX - files, use `--with-tex-dir=/DIR'. In this case, the files will be - placed in `/DIR', and you'll also need the following option: - -`--with-doc-dir=/DIR' - This option may be used to specify where the TeX documentation - goes. It is to be used when you are using `--with-tex-dir=/DIR', - but is normally not necessary otherwise. - - -File: auctex.info, Node: Build/install, Next: Loading the package, Prev: Configure, Up: Installation - -1.2.3 Build/install -------------------- - -Once `configure' has been run, simply enter - - make - -at the prompt to byte-compile the lisp files, extract the TeX files and -build the documentation files. To install the files into the locations -chosen earlier, type - - make install - - You may need special privileges to install, e.g., if you are -installing into system directories. - - -File: auctex.info, Node: Loading the package, Next: Advice for package providers, Prev: Build/install, Up: Installation - -1.2.4 Loading the package -------------------------- - -You can detect the successful activation of AUCTeX and preview-latex in -the menus after loading a LaTeX file like `preview/circ.tex': AUCTeX -then gives you a `Command' menu, and preview-latex gives you a -`Preview' menu. - - For XEmacs, if the installation occured into a valid package -directory (which is the default), then this should work out of the box. - - With Emacs (or if you explicitly disabled use of the package system), -the startup files `auctex.el' and `preview-latex.el' may already be in -a directory of the `site-start.d/' variety if your Emacs installation -provides it. In that case they should be automatically loaded on -startup and nothing else needs to be done. If not, they should at -least have been placed somewhere in your `load-path'. You can then -load them by placing the lines - - (load "auctex.el" nil t t) - (load "preview-latex.el" nil t t) - - into your init file. - - If you explicitly used `--with-lispdir', you may need to add the -specified directory into Emacs' `load-path' variable by adding -something like - - (add-to-list 'load-path "~/elisp") - - before the above lines into your Emacs startup file. - - For site-wide activation in GNU Emacs, see *Note Advice for package -providers::. - - Once activated, the modes provided by AUCTeX are used per default for -all supported file types. If you want to change the modes for which it -is operative instead of the default, use - M-x customize-variable TeX-modes - - If you want to remove a preinstalled AUCTeX completely before any of -its modes have been used, - (unload-feature 'tex-site) - should accomplish that. - - -File: auctex.info, Node: Advice for package providers, Next: Advice for non-privileged users, Prev: Loading the package, Up: Installation - -1.2.5 Providing AUCTeX as a package ------------------------------------ - -As a package provider, you should make sure that your users will be -served best according to their intentions, and keep in mind that a -system might be used by more than one user, with different preferences. - - There are people that prefer the built-in Emacs modes for editing -TeX files, in particular plain TeX users. There are various ways to -tell AUCTeX even after auto-activation that it should not get used, and -they are described in *note Introduction to AUCTeX: Introduction. - - So if you have users that don't want to use the preinstalled AUCTeX, -they can easily get rid of it. Activating AUCTeX by default is -therefore a good choice. - - If the installation procedure did not achieve this already by placing -`auctex.el' and `preview-latex.el' into a possibly existing -`site-start.d' directory, you can do this by placing - - (load "auctex.el" nil t t) - (load "preview-latex.el" nil t t) - -in the system-wide `site-start.el'. - - If your package is intended as an XEmacs package or to accompany a -precompiled version of Emacs, you might not know which TeX system will -be available when preview-latex gets used. In this case you should -build using the `--without-texmf-dir' option described previously. -This can also be convenient for systems that are intended to support -more than a single TeX distribution. Since more often than not TeX -packages for operating system distributions are either much more -outdated or much less complete than separately provided systems like -TeX Live, this method may be generally preferable when providing -packages. - - The following package structure would be adequate for a typical fully -supported Unix-like installation: - -`preview-tetex' - Style files and documentation for `preview.sty', placed into a TeX - tree where it is accessible from the teTeX executables usually - delivered with a system. If there are other commonly used TeX - system packages, it might be appropriate to provide separate - packages for those. - -`auctex-emacs-tetex' - This package will require the installation of `preview-tetex' and - will record in `TeX-macro-global' where to find the TeX tree. It - is also a good idea to run - emacs -batch -f TeX-auto-generate-global - when either AUCTeX or teTeX get installed or upgraded. If your - users might want to work with a different TeX distribution - (nowadays pretty common), instead consider the following: - -`auctex-emacs' - This package will be compiled with `--without-texmf-dir' and will - consequently contain the `preview' style files in its private - directory. It will probably not be possible to initialize - `TeX-macro-global' to a sensible value, so running - `TeX-auto-generate-global' does not appear useful. This package - would neither conflict with nor provide `preview-tetex'. - -`auctex-xemacs-tetex' -`auctex-xemacs' - Those are the obvious XEmacs equivalents. For XEmacs, there is the - additional problem that the XEmacs sumo package tree already - possibly provides its own version of AUCTeX, and the user might - even have used the XEmacs package manager to updating this - package, or even installing a private AUCTeX version. So you - should make sure that such a package will not conflict with - existing XEmacs packages and will be at an appropriate place in - the load order (after site-wide and user-specific locations, but - before a distribution-specific sumo package tree). Using the - `--without-packagedir' option might be one idea to avoid - conflicts. Another might be to refrain from providing an XEmacs - package and just rely on the user or system administrator to - instead use the XEmacs package system. - - -File: auctex.info, Node: Advice for non-privileged users, Next: Installation under MS Windows, Prev: Advice for package providers, Up: Installation - -1.2.6 Installation for non-privileged users -------------------------------------------- - -Often people without system administration privileges want to install -software for their private use. In that case you need to pass more -options to the `configure' script. For XEmacs users, this is fairly -easy, because the XEmacs package system has been designed to make this -sort of thing practical: but GNU Emacs users (and XEmacs users for whom -the package system is for some reason misbehaving) may need to do a -little more work. - - The main expedient is using the `--prefix' option to the `configure' -script, and let it point to the personal home directory. In that way, -resulting binaries will be installed under the `bin' subdirectory of -your home directory, manual pages under `man' and so on. It is -reasonably easy to maintain a bunch of personal software, since the -prefix argument is supported by most `configure' scripts. - - You'll have to add something like -`/home/myself/share/emacs/site-lisp' to your `load-path' variable, if -it isn't there already. - - XEmacs users can achieve the same end by pointing `configure' at an -appropriate package directory (normally -`--with-packagedir=~/.xemacs/xemacs-packages' will serve). The package -directory stands a good chance at being detected automatically as long -as it is in a subtree of the specified PREFIX. - - Now here is another thing to ponder: perhaps you want to make it easy -for other users to share parts of your personal Emacs configuration. In -general, you can do this by writing `~myself/' anywhere where you -specify paths to something installed in your personal subdirectories, -not merely `~/', since the latter, when used by other users, will point -to non-existent files. - - For yourself, it will do to manipulate environment variables in your -`.profile' resp. `.login' files. But if people will be copying just -Elisp files, their copies will not work. While it would in general be -preferable if the added components where available from a shell level, -too (like when you call the standalone info reader, or try using -`preview.sty' for functionality besides of Emacs previews), it will be -a big help already if things work from inside of Emacs. - - Here is how to do the various parts: - -Making the Elisp available -.......................... - -In GNU Emacs, it should be sufficient if people just do - - (load "~myself/share/emacs/site-lisp/auctex.el" nil t t) - (load "~myself/share/emacs/site-lisp/preview-latex.el" nil t t) - - where the path points to your personal installation. The rest of the -package should be found relative from there without further ado. - - In XEmacs, you should ask the other users to add symbolic links in -the subdirectories `lisp', `info' and `etc' of their -`~/.xemacs/xemacs-packages/' directory. (Alas, there is presently no -easy programmatic way to do this, except to have a script do the -symlinking for them.) - -Making the Info files available -............................... - -For making the info files accessible from within Elisp, something like -the following might be convenient to add into your or other people's -startup files: - - (eval-after-load 'info - '(add-to-list 'Info-directory-list "~myself/info")) - - In XEmacs, as long as XEmacs can see the package, there should be no -need to do anything at all; the info files should be immediately -visible. However, you might want to set `INFOPATH' anyway, for the -sake of standalone readers outside of XEmacs. (The info files in XEmacs -are normally in `~/.xemacs/xemacs-packages/info'.) - -Making the LaTeX style available -................................ - -If you want others to be able to share your installation, you should -configure it using `--without-texmf-dir', in which case things should -work as well for them as for you. - - -File: auctex.info, Node: Installation under MS Windows, Next: Customizing, Prev: Advice for non-privileged users, Up: Installation - -1.2.7 Installation under MS Windows ------------------------------------ - -In a Nutshell -............. - -The following are brief installation instructions for the impatient. In -case you don't understand some of this, run into trouble of some sort, -or need more elaborate information, refer to the detailed instructions -further below. - - 1. Install the prerequisites, i.e. Emacs or XEmacs, MSYS or Cygwin, a - TeX system, and Ghostscript. - - 2. Open the MSYS shell or a Cygwin shell and change to the directory - containing the unzipped file contents. - - 3. Configure AUCTeX: - - For Emacs: Many people like to install AUCTeX into the pseudo file - system hierarchy set up by the Emacs installation. Assuming Emacs - is installed in `C:/Program Files/Emacs' and the directory for - local additions of your TeX system, e.g. MiKTeX, is - `C:/localtexmf', you can do this by typing the following statement - at the shell prompt: - - ./configure --prefix='C:/Program Files/Emacs' \ - --infodir='C:/Program Files/Emacs/info' \ - --with-texmf-dir='C:/localtexmf' - - For XEmacs: You can install AUCTeX as an XEmacs package. Assuming - XEmacs is installed in `C:/Program Files/XEmacs' and the directory - for local additions of your TeX system, e.g. MiKTeX, is - `C:/localtexmf', you can do this by typing the following command at - the shell prompt: - - ./configure --with-xemacs='C:/Program Files/XEmacs/bin/xemacs' \ - --with-texmf-dir='C:/localtexmf' - - The commands above are examples for common usage. More on - configuration options can be found in the detailed installation - instructions below. - - If the configuration script failed to find all required programs, - make sure that these programs are in your system path and add - directories containing the programs to the `PATH' environment - variable if necessary. Here is how to do that in W2000/XP: - - 1. On the desktop, right click "My Computer" and select - properties. - - 2. Click on "Advanced" in the "System Properties" window. - - 3. Select "Environment Variables". - - 4. Select "path" in "System Variables" and click "edit". Move - to the front in the line (this might require scrolling) and - add the missing path including drive letter, ended with a - semicolon. - - 4. If there were no further error messages, type - - make - - In case there were, please refer to the detailed description below. - - 5. Finish the installation by typing - - make install - -Detailed Installation Instructions -.................................. - -Installation of AUCTeX under Windows is in itself not more complicated -than on other platforms. However, meeting the prerequisites might -require more work than on some other platforms, and feel less natural. - - If you are experiencing any problems, even if you think they are of -your own making, be sure to report them to so -that we can explain things better in future. - - Windows is a problematic platform for installation scripts. The main -problem is that the installation procedure requires consistent file -names in order to find its way in the directory hierarchy, and Windows -path names are a mess. - - The installation procedure tries finding stuff in system search paths -and in Emacs paths. For that to succeed, you have to use the same -syntax and spelling and case of paths everywhere: in your system search -paths, in Emacs' `load-path' variable, as argument to the scripts. If -your path names contain spaces or other `shell-unfriendly' characters, -most notably backslashes for directory separators, place the whole path -in `"double quote marks"' whenever you specify it on a command line. - - Avoid `helpful' magic file names like `/cygdrive/c' and -`C:\PROGRA~1\' like the plague. It is quite unlikely that the scripts -will be able to identify the actual file names involved. Use the full -paths, making use of normal Windows drive letters like ` 'C:/Program -Files/Emacs' ' where required, and using the same combination of upper- -and lowercase letters as in the actual files. File names containing -shell-special characters like spaces or backslashes (if you prefer that -syntax) need to get properly quoted to the shell: the above example -used single quotes for that. - - Ok, now here are the steps to perform: - - 1. You need to unpack the AUCTeX distribution (which you seemingly - have done since you are reading this). It must be unpacked in a - separate installation directory outside of your Emacs file - hierarchy: the installation will later copy all necessary files to - their final destination, and you can ultimately remove the - directory where you unpacked the files. - - Line endings are a problem under Windows. The distribution - contains only text files, and theoretically most of the involved - tools should get along with that. However, the files are - processed by various utilities, and it is conceivable that not all - of them will use the same line ending conventions. If you - encounter problems, it might help if you try unpacking (or - checking out) the files in binary mode, if your tools allow that. - - If you don't have a suitable unpacking tool, skip to the next - step: this should provide you with a working `unzip' command. - - 2. The installation of AUCTeX will require the MSYS tool set from - `http://www.mingw.org/' or the Cygwin tool set from - `http://cygwin.com/'. The latter is slower and larger (the - download size of the base system is about 15 MB) but comes with a - package manager that allows for updating the tool set and - installing additional packages like, for example, the spell - checker aspell. - - If Cygwin specific paths like `/cygdrive/c' crop up in the course - of the installation, using a non-Cygwin Emacs could conceivably - cause trouble. Using Cygwin either for everything or nothing - might save headaches, _if_ things don't work out. - - 3. Install a current version of XEmacs from `http://www.xemacs.org/' - or Emacs from `ftp://ftp.gnu.org/gnu/emacs/windows/'. Emacs is - the recommended choice because it is currently the primary - platform for AUCTeX development. - - 4. You need a working TeX installation. One popular installation - under Windows is MiKTeX (http://www.miktex.org). Another much more - extensive system is TeX Live (http://www.tug.org/texlive) which is - rather close to its Unix cousins. - - 5. A working copy of Ghostscript (http://www.cs.wisc.edu/~ghost/) is - required for preview-latex operation. Examining the output from - gswin32c -h - on a Windows command line should tell you whether your Ghostscript - supports the `png16m' device needed for PNG support. MiKTeX - apparently comes with its own Ghostscript called `mgs.exe'. - - 6. Perl (http://www.perl.org) is needed for rebuilding the - documentation if you are working with a copy from CVS or have - touched documentation source files in the preview-latex part. If - the line endings of the file `preview/latex/preview.dtx' don't - correspond with what Perl calls `\n' when reading text files, - you'll run into trouble. - - 7. Now the fun stuff starts. If you have not yet done so, unpack the - AUCTeX distribution into a separate directory after rereading the - instructions for unpacking above. - - 8. Ready for takeoff. Start some shell (typically `bash') capable of - running `configure', change into the installation directory and - call `./configure' with appropriate options. - - Typical options you'll want to specify will be - `--prefix=DRIVE:/PATH/TO/EMACS-HIERARCHY' - which tells `configure' where to perform the installation. It - may also make `configure' find Emacs or XEmacs automatically; - if this doesn't happen, try one of `--with-emacs' or - `--with-xemacs' as described below. All automatic detection - of files and directories restricts itself to directories - below the PREFIX or in the same hierarchy as the program - accessing the files. Usually, directories like `man', - `share' and `bin' will be situated right under PREFIX. - - This option also affects the defaults for placing the Texinfo - documentation files (see also `--infodir' below) and - automatically generated style hooks. - - If you have a central directory hierarchy (not untypical with - Cygwin) for such stuff, you might want to specify its root - here. You stand a good chance that this will be the only - option you need to supply, as long as your TeX-related - executables are in your system path, which they better be for - AUCTeX's operation, anyway. - - `--with-emacs' - if you are installing for a version of Emacs. You can use - `--with-emacs=DRIVE:/PATH/TO/EMACS' to specify the name of the - installed Emacs executable, complete with its path if - necessary (if Emacs is not within a directory specified in - your `PATH' environment setting). - - `--with-xemacs' - if you are installing for a version of XEmacs. Again, you - can use `--with-xemacs=DRIVE:/PATH/TO/XEMACS' to specify the - name of the installed XEmacs executable complete with its - path if necessary. It may also be necessary to specify this - option if a copy of Emacs is found in your `PATH' environment - setting, but you still would like to install a copy of AUCTeX - for XEmacs. - - `--with-packagedir=DRIVE:/DIR' - is an XEmacs-only option giving the location of the package - directory. This will install and activate the package. - Emacs uses a different installation scheme: - - `--with-lispdir=DRIVE:/PATH/TO/SITE-LISP' - This Emacs-only option tells a place in `load-path' below - which the files are situated. The startup files `auctex.el' - and `preview-latex.el' will get installed here unless a - subdirectory `site-start.d' exists which will then be used - instead. The other files from AUCTeX will be installed in a - subdirectory called `auctex'. - - If you think that you need a different setup, please refer to - the full installation instructions in *note Configure::. - - `--infodir=DRIVE:/PATH/TO/INFO/DIRECTORY' - If you are installing into an Emacs directory, info files - have to be put into the `info' folder below that directory. - The configuration script will usually try to install into the - folder `share/info', so you have to override this by - specifying something like `--infodir='C:/Program Files/info'' - for the configure call. - - `--with-auto-dir=DRIVE:/DIR' - Directory containing automatically generated information. - You should not normally need to set this, as `--prefix' - should take care of this. - - `--disable-preview' - Use this option if your Emacs version is unable to support - image display. This will be the case if you are using a - native variant of Emacs 21. - - `--with-texmf-dir=DRIVE:/DIR' - This will specify the directory where your TeX installation - sits. If your TeX installation does not conform to the TDS - (TeX directory standard), you may need to specify more - options to get everything in place. - - For more information about any of the above and additional - options, see *note Configure::. - - Calling `./configure --help=recursive' will tell about other - options, but those are almost never required. - - Some executables might not be found in your path. That is not a - good idea, but you can get around by specifying environment - variables to `configure': - GS="DRIVE:/PATH/TO/GSWIN32C.EXE" ./configure ... - should work for this purpose. `gswin32c.exe' is the usual name for - the required _command line_ executable under Windows; in contrast, - `gswin32.exe' is likely to fail. - - As an alternative to specifying variables for the `configure' call - you can add directories containing the required executables to the - `PATH' variable of your Windows system. This is especially a good - idea if Emacs has trouble finding the respective programs later - during normal operation. - - 9. Run `make' in the installation directory. - - 10. Run `make install' in the installation directory. - - 11. With XEmacs, AUCTeX and preview-latex should now be active by - default. With Emacs, activation depends on a working - `site-start.d' directory or similar setup, since then the startup - files `auctex.el' and `preview-latex.el' will have been placed - there. If this has not been done, you should be able to load the - startup files manually with - (load "auctex.el" nil t t) - (load "preview-latex.el" nil t t) - in either a site-wide `site-start.el' or your personal startup file - (usually accessible as `~/.emacs' from within Emacs and - `~/.xemacs/init.el' from within XEmacs). - - The default configuration of AUCTeX is probably not the best fit - for Windows systems. You might want to add - (require 'tex-mik) - or - (require 'tex-fptex) - in order to get more appropriate values for MiKTeX and fpTeX, - respectively after loading `auctex.el' and `preview-latex.el'. - - You can always use - - M-x customize-group RET AUCTeX RET - - in order to customize more stuff, or use the `Customize' menu. - - 12. Load `preview/circ.tex' into Emacs or XEmacs and see if you get the - `Command' menu. Try using it to LaTeX the file. - - 13. Check whether the `Preview' menu is available in this file. Use it - to generate previews for the document. - - If this barfs and tells you that image type `png' is not supported, - you can either add PNG support to your Emacs installation or - choose another image format to be used by preview-latex. - - Adding support for an image format usually involves the - installation of a library, e.g. from `http://gnuwin32.sf.net/'. - If you got your Emacs from `gnu.org' you might want to check its - README file (ftp://ftp.gnu.org/gnu/emacs/windows/README) for - details. - - A different image format can be chosen by setting the variable - `preview-image-type'. While it is recommended to keep the - `dvipng' or `png' setting, you can temporarily select a different - format like `pnm' to check if the lack of PNG support is the only - problem with your Emacs installation. - - Try adding the line - - (setq preview-image-type 'pnm) - - to your init file for a quick test. You should remove the line - after the test again, because PNM files take away *vast* amounts - of disk space, and thus also of load/save time. - - Well, that about is all. Have fun! - - -File: auctex.info, Node: Customizing, Prev: Installation under MS Windows, Up: Installation - -1.2.8 Customizing ------------------ - -Most of the site-specific customization should already have happened -during configuration of AUCTeX. Any further customization can be done -with customization buffers directly in Emacs. Just type `M-x -customize-group RET AUCTeX RET' to open the customization group for -AUCTeX or use the menu entries provided in the mode menus. Editing the -file `tex-site.el' as suggested in former versions of AUCTeX should not -be done anymore because the installation routine will overwrite those -changes. - - You might check some variables with a special significance. They are -accessible directly by typing `M-x customize-variable RET -RET'. - - -- User Option: TeX-macro-global - Directories containing the site's TeX style files. - - Normally, AUCTeX will only allow you to complete macros and -environments which are built-in, specified in AUCTeX style files or -defined by yourself. If you issue the `M-x TeX-auto-generate-global' -command after loading AUCTeX, you will be able to complete on all -macros available in the standard style files used by your document. To -do this, you must set this variable to a list of directories where the -standard style files are located. The directories will be searched -recursively, so there is no reason to list subdirectories explicitly. -Automatic configuration will already have set the variable for you if -it could use the program `kpsewhich'. In this case you normally don't -have to alter anything. - - -File: auctex.info, Node: Quick Start, Prev: Installation, Up: Introduction - -1.3 Quick Start -=============== - -AUCTeX is a powerful program offering many features and configuration -options. If you are new to AUCTeX this might be deterrent. -Fortunately you do not have to learn everything at once. This Quick -Start Guide will give you the knowledge of the most important commands -and enable you to prepare your first LaTeX document with AUCTeX after -only a few minutes of reading. - - In this introduction, we assume that AUCTeX is already installed on -your system. If this is not the case, you should read the file -`INSTALL' in the base directory of the unpacked distribution tarball. -These installation instructions are available in this manual as well, -*note Installation::. We also assume that you are familiar with the -way keystrokes are written in Emacs manuals. If not, have a look at -the Emacs Tutorial in the Help menu. - - If AUCTeX is installed, you might still need to activate it, by -inserting - - (load "auctex.el" nil t t) - - in your user init file.(1) In order to get support for many of the -LaTeX packages you will use in your documents, you should enable -document parsing as well, which can be achieved by putting - - (setq TeX-auto-save t) - (setq TeX-parse-self t) - - into your init file. Finally, if you often use `\include' or -`\input', you should make AUCTeX aware of the multi-file document -structure. You can do this by inserting - - (setq-default TeX-master nil) - - into your init file. Each time you open a new file, AUCTeX will then -ask you for a master file. - -* Menu: - -* Editing Facilities:: Functions for editing TeX files -* Processing Facilities:: Creating and viewing output, debugging - - ---------- Footnotes ---------- - - (1) This usually is a file in your home directory called `.emacs' if -you are utilizing GNU Emacs or `.xemacs/init.el' if you are using -XEmacs. - - -File: auctex.info, Node: Editing Facilities, Next: Processing Facilities, Up: Quick Start - -1.3.1 Functions for editing TeX files -------------------------------------- - -1.3.1.1 Making your TeX code more readable -.......................................... - -AUCTeX can do syntax highlighting of your source code, that means -commands will get special colors or fonts. You can enable it locally by -typing `M-x font-lock-mode RET'. If you want to have font locking -activated generally, enable `global-font-lock-mode', e.g. with `M-x -customize-variable RET global-font-lock-mode RET'. - - AUCTeX will indent new lines to indicate their syntactical -relationship to the surrounding text. For example, the text of a -`\footnote' or text inside of an environment will be indented relative -to the text around it. If the indenting has gotten wrong after adding -or deleting some characters, use to reindent the line, `M-q' for -the whole paragraph, or `M-x LaTeX-fill-buffer RET' for the whole -buffer. - -1.3.1.2 Entering sectioning commands -.................................... - -Insertion of sectioning macros, that is `\chapter', `\section', -`\subsection', etc. and accompanying `\label' commands may be eased by -using `C-c C-s'. You will be asked for the section level. As nearly -everywhere in AUCTeX, you can use the or key to get a list -of available level names, and to auto-complete what you started typing. -Next, you will be asked for the printed title of the section, and last -you will be asked for a label to be associated with the section. - -1.3.1.3 Inserting environments -.............................. - -Similarly, you can insert environments, that is `\begin{}'-`\end{}' -pairs: Type `C-c C-e', and select an environment type. Again, you can -use or to get a list, and to complete what you type. -Actually, the list will not only provide standard LaTeX environments, -but also take your `\documentclass' and `\usepackage' commands into -account if you have parsing enabled by setting `TeX-parse-self' to `t'. -If you use a couple of environments frequently, you can use the up and -down arrow keys (or `M-p' and `M-n') in the minibuffer to get back to -the previously inserted commands. - - Some environments need additional arguments. Often, AUCTeX knows -about this and asks you to enter a value. - -1.3.1.4 Inserting macros -........................ - -`C-c C-m', or simply `C-c RET' will give you a prompt that asks you for -a LaTeX macro. You can use for completion, or the up/down arrow -keys (or `M-p' and `M-n') to browse the command history. In many -cases, AUCTeX knows which arguments a macro needs and will ask you for -that. It even can differentiate between mandatory and optional -arguments--for details, see *note Completion::. - - An additional help for inserting macros is provided by the -possibility to complete macros right in the buffer. With point at the -end of a partially written macro, you can complete it by typing `M-TAB'. - -1.3.1.5 Changing the font -......................... - -AUCTeX provides convenient keyboard shortcuts for inserting macros -which specify the font to be used for typesetting certain parts of the -text. They start with `C-c C-f', and the last `C-' combination tells -AUCTeX which font you want: - -`C-c C-f C-b' - Insert bold face `\textbf{-!-}' text. - -`C-c C-f C-i' - Insert italics `\textit{-!-}' text. - -`C-c C-f C-e' - Insert emphasized `\emph{-!-}' text. - -`C-c C-f C-s' - Insert slanted `\textsl{-!-}' text. - -`C-c C-f C-r' - Insert roman \textrm{-!-} text. - -`C-c C-f C-f' - Insert sans serif `\textsf{-!-}' text. - -`C-c C-f C-t' - Insert typewriter `\texttt{-!-}' text. - -`C-c C-f C-c' - Insert SMALL CAPS `\textsc{-!-}' text. - -`C-c C-f C-d' - Delete the innermost font specification containing point. - - - If you want to change font attributes of existing text, mark it as a -region, and then invoke the commands. If no region is selected, the -command will be inserted with empty braces, and you can start typing the -changed text. - - Most of those commands will also work in math mode, but then macros -like `\mathbf' will be inserted. - -1.3.1.6 Other useful features -............................. - -AUCTeX also tries to help you when inserting the right "quote" signs -for your language, dollar signs to typeset math, or pairs of braces. -It offers shortcuts for commenting out text (`C-c ;' for the current -region or `C-c %' for the paragraph you are in). The same keystrokes -will remove the % signs, if the region or paragraph is commented out -yet. With `TeX-fold-mode', you can hide certain parts (like footnotes, -references etc.) that you do not edit currently. Support for Emacs' -outline mode is provided as well. And there's more, but this is beyond -the scope of this Quick Start Guide. - - -File: auctex.info, Node: Processing Facilities, Prev: Editing Facilities, Up: Quick Start - -1.3.2 Creating and viewing output, debugging --------------------------------------------- - -1.3.2.1 One Command for LaTeX, helpers, viewers, and printing -............................................................. - -If you have typed some text and want to run LaTeX (or TeX, or other -programs--see below) on it, type `C-c C-c'. If applicable, you will be -asked whether you want to save changes, and which program you want to -invoke. In many cases, the choice that AUCTeX suggests will be just -what you want: first `latex', then a viewer. If a `latex' run produces -or changes input files for `makeindex', the next suggestion will be to -run that program, and AUCTeX knows that you need to run `latex' again -afterwards--the same holds for BibTeX. - - When no processor invocation is necessary anymore, AUCTeX will -suggest to run a viewer, or you can chose to create a PostScript file -using `dvips', or to directly print it. - - At this place, a warning needs to be given: First, although AUCTeX is -really good in detecting the standard situations when an additional -`latex' run is necessary, it cannot detect it always. Second, the -creation of PostScript files or direct printing currently only works -when your output file is a DVI file, not a PDF file. - - Ah, you didn't know you can do both? That brings us to the next -topic. - -1.3.2.2 Choosing an output format -................................. - -From a LaTeX file, you can produce DVI output, or a PDF file directly -via `pdflatex'. You can switch on source specials for easier -navigation in the output file, or tell `latex' to stop after an error -(usually `\noninteractive' is used, to allow you to detect all errors -in a single run). - - These options are controlled by toggles, the keystrokes should be -easy to memorize: - -`C-c C-t C-p' - This command toggles between DVI and PDF output - -`C-c C-t C-i' - toggles interactive mode - -`C-c C-t C-s' - toggles source specials support - -`C-c C-t C-o' - toggles usage of Omega/lambda. - - -1.3.2.3 Debugging LaTeX -....................... - -When AUCTeX runs a program, it creates an output buffer in which it -displays the output of the command. If there is a syntactical error in -your file, `latex' will not complete successfully. AUCTeX will tell you -that, and you can get to the place where the first error occured by -pressing `C-c `' (the last character is a backtick). The view will be -split in two windows, the output will be displayed in the lower buffer, -and both buffers will be centered around the place where the error -ocurred. You can then try to fix it in the document buffer, and use -the same keystrokes to get to the next error. This procedure may be -repeated until all errors have been dealt with. By pressing `C-c C-w' -(`TeX-toggle-debug-boxes') you can toggle whether AUCTeX should notify -you of overfull and underfull boxes in addition to regular errors. - - If a command got stuck in a seemingly infinite loop, or you want to -stop execution for other reasons, you can use `C-c C-k' (for "kill"). -Similar to `C-l', which centers the buffer you are in around your -current position, `C-c C-l' centers the output buffer so that the last -lines added at the bottom become visible. - -1.3.2.4 Running LaTeX on parts of your document -............................................... - -If you want to check how some part of your text looks like, and do not -want to wait until the whole document has been typeset, then mark it as -a region and use `C-c C-r'. It behaves just like `C-c C-c', but it -only uses the document preamble and the region you marked. - - If you are using `\include' or `\input' to structure your document, -try `C-c C-b' while you are editing one of the included files. It will -run `latex' only on the current buffer, using the preamble from the -master file. - - -File: auctex.info, Node: Editing, Next: Display, Prev: Introduction, Up: Top - -2 Editing the Document Source -***************************** - -The most commonly used commands/macros of AUCTeX are those which simply -insert templates for often used TeX, LaTeX, or ConTeXt constructs, like -font changes, handling of environments, etc. These features are very -simple, and easy to learn, and help you avoid mistakes like mismatched -braces, or `\begin{}'-`\end{}' pairs. - - Apart from that this chapter contains a description of some features -for entering more specialized sorts of text, for formatting the source -by indenting and filling and for navigating through the document. - -* Menu: - -* Quotes:: Inserting double quotes -* Font Specifiers:: Inserting Font Specifiers -* Sectioning:: Inserting chapters, sections, etc. -* Environments:: Inserting Environment Templates -* Mathematics:: Entering Mathematics -* Completion:: Completion of macros -* Commenting:: Commenting text -* Indenting:: Reflecting syntactic constructs with whitespace -* Filling:: Automatic and manual line breaking - - -File: auctex.info, Node: Quotes, Next: Font Specifiers, Up: Editing - -2.1 Insertion of Quotes, Dollars, and Braces -============================================ - -Quotation Marks ---------------- - -In TeX, literal double quotes `"like this"' are seldom used, instead -two single quotes are used ```like this'''. To help you insert these -efficiently, AUCTeX allows you to continue to press `"' to insert two -single quotes. To get a literal double quote, press `"' twice. - - -- Command: TeX-insert-quote COUNT - (`"') Insert the appropriate quote marks for TeX. - - Inserts the value of `TeX-open-quote' (normally ```') or - `TeX-close-quote' (normally `''') depending on the context. With - prefix argument, always inserts `"' characters. - - -- User Option: TeX-open-quote - String inserted by typing `"' to open a quotation. (*Note - European::, for language-specific quotation mark insertion.) - - -- User Option: TeX-close-quote - String inserted by typing `"' to close a quotation. (*Note - European::, for language-specific quotation mark insertion.) - - -- User Option: TeX-quote-after-quote - Determines the behavior of `"'. If it is non-nil, typing `"' will - insert a literal double quote. The respective values of - `TeX-open-quote' and `TeX-close-quote' will be inserted after - typing `"' once again. - - The `babel' package provides special support for the requirements of -typesetting quotation marks in many different languages. If you use -this package, either directly or by loading a language-specific style -file, you should also use the special commands for quote insertion -instead of the standard quotes shown above. AUCTeX is able to -recognize several of these languages and will change quote insertion -accordingly. *Note European::, for details about this feature and how -to control it. - - In case you are using the `csquotes' package, you should customize -`LaTeX-csquotes-open-quote', `LaTeX-csquotes-close-quote' and -`LaTeX-csquotes-quote-after-quote'. The quotation characters will only -be used if both variables--`LaTeX-csquotes-open-quote' and -`LaTeX-csquotes-close-quote'--are non-empty strings. But then the -`csquotes'-related values will take precedence over the -language-specific ones. - -Dollar Signs ------------- - -In AUCTeX, dollar signs should match like they do in TeX. This has -been partially implemented, we assume dollar signs always match within -a paragraph. The first `$' you insert in a paragraph will do nothing -special. The second `$' will match the first. This will be indicated -by moving the cursor temporarily over the first dollar sign. - - -- Command: TeX-insert-dollar ARG - (`$') Insert dollar sign. - - Show matching dollar sign if this dollar sign end the TeX math - mode. Ensure double dollar signs match up correctly by inserting - extra dollar signs when needed if `TeX-math-close-double-dollar' - is non-nil. - - With optional ARG, insert that many dollar signs. - - -- User Option: TeX-math-close-double-dollar - Control the insertion of double dollar signs for delimiting display - math. (Note that you should not use double dollar signs in LaTeX - because this practice can lead to wrong spacing in typeset - documents.) If the variable is non-nil and you enter a dollar - sign that matches a double dollar sign `$$' AUCTeX will - automatically insert two dollar signs. - -Braces ------- - -To avoid unbalanced braces, it is useful to insert them pairwise. You -can do this by typing `C-c {'. - - -- Command: TeX-insert-braces - (`C-c {') Make a pair of braces and position the cursor to type - inside of them. If there is an active region, put braces around - it and leave point after the closing brace. - - -File: auctex.info, Node: Font Specifiers, Next: Sectioning, Prev: Quotes, Up: Editing - -2.2 Inserting Font Specifiers -============================= - -Perhaps the most used keyboard commands of AUCTeX are the short-cuts -available for easy insertion of font changing macros. - - If you give an argument (that is, type `C-u') to the font command, -the innermost font will be replaced, i.e. the font in the TeX group -around point will be changed. The following table shows the available -commands, with `-!-' indicating the position where the text will be -inserted. - -`C-c C-f C-b' - Insert bold face `\textbf{-!-}' text. - -`C-c C-f C-i' - Insert italics `\textit{-!-}' text. - -`C-c C-f C-e' - Insert emphasized `\emph{-!-}' text. - -`C-c C-f C-s' - Insert slanted `\textsl{-!-}' text. - -`C-c C-f C-r' - Insert roman \textrm{-!-} text. - -`C-c C-f C-f' - Insert sans serif `\textsf{-!-}' text. - -`C-c C-f C-t' - Insert typewriter `\texttt{-!-}' text. - -`C-c C-f C-c' - Insert SMALL CAPS `\textsc{-!-}' text. - -`C-c C-f C-d' - Delete the innermost font specification containing point. - - - -- Command: TeX-font replace what - (`C-c C-f') Insert template for font change command. - - If REPLACE is not nil, replace current font. WHAT determines the - font to use, as specified by `TeX-font-list'. - - -- User Option: TeX-font-list - List of fonts used by `TeX-font'. - - Each entry is a list with three elements. The first element is the - key to activate the font. The second element is the string to - insert before point, and the third element is the string to insert - after point. An optional fourth element means always replace if - not nil. - - -- User Option: LaTeX-font-list - List of fonts used by `TeX-font' in LaTeX mode. It has the same - structure as `TeX-font-list'. - - -File: auctex.info, Node: Sectioning, Next: Environments, Prev: Font Specifiers, Up: Editing - -2.3 Inserting chapters, sections, etc. -====================================== - -Insertion of sectioning macros, that is `\chapter', `\section', -`\subsection', etc. and accompanying `\label''s may be eased by using -`C-c C-s'. This command is highly customizable, the following -describes the default behavior. - - When invoking you will be asked for a section macro to insert. An -appropriate default is automatically selected by AUCTeX, that is -either: at the top of the document; the top level sectioning for that -document style, and any other place: The same as the last occurring -sectioning command. - - Next, you will be asked for the actual name of that section, and -last you will be asked for a label to be associated with that section. -The label will be prefixed by the value specified in -`LaTeX-section-hook'. - - -- Command: LaTeX-section ARG - (`C-c C-s') Insert a sectioning command. - - Determine the type of section to be inserted, by the argument ARG. - - * If ARG is nil or missing, use the current level. - - * If ARG is a list (selected by C-u), go downward one level. - - * If ARG is negative, go up that many levels. - - * If ARG is positive or zero, use absolute level: - + 0 : part - - + 1 : chapter - - + 2 : section - - + 3 : subsection - - + 4 : subsubsection - - + 5 : paragraph - - + 6 : subparagraph - - The following variables can be set to customize the function. - - `LaTeX-section-hook' - Hooks to be run when inserting a section. - - `LaTeX-section-label' - Prefix to all section references. - - - The precise behavior of `LaTeX-section' is defined by the contents -of `LaTeX-section-hook'. - - -- User Option: LaTeX-section-hook - List of hooks to run when a new section is inserted. - - The following variables are set before the hooks are run - - LEVEL - Numeric section level, default set by prefix arg to - `LaTeX-section'. - - NAME - Name of the sectioning command, derived from LEVEL. - - TITLE - The title of the section, default to an empty string. - - TOC - Entry for the table of contents list, default nil. - - DONE-MARK - Position of point afterwards, default nil meaning after the - inserted text. - - A number of hooks are already defined. Most likely, you will be - able to get the desired functionality by choosing from these hooks. - - `LaTeX-section-heading' - Query the user about the name of the sectioning command. - Modifies LEVEL and NAME. - - `LaTeX-section-title' - Query the user about the title of the section. Modifies TITLE. - - `LaTeX-section-toc' - Query the user for the toc entry. Modifies TOC. - - `LaTeX-section-section' - Insert LaTeX section command according to NAME, TITLE, and - TOC. If TOC is nil, no toc entry is inserted. If TOC or - TITLE are empty strings, DONE-MARK will be placed at the - point they should be inserted. - - `LaTeX-section-label' - Insert a label after the section command. Controlled by the - variable `LaTeX-section-label'. - - To get a full featured `LaTeX-section' command, insert - - (setq LaTeX-section-hook - '(LaTeX-section-heading - LaTeX-section-title - LaTeX-section-toc - LaTeX-section-section - LaTeX-section-label)) - - in your `.emacs' file. - - The behavior of `LaTeX-section-label' is determined by the variable -`LaTeX-section-label'. - - -- User Option: LaTeX-section-label - Default prefix when asking for a label. - - If it is a string, it is used unchanged for all kinds of sections. - If it is nil, no label is inserted. If it is a list, the list is - searched for a member whose car is equal to the name of the - sectioning command being inserted. The cdr is then used as the - prefix. If the name is not found, or if the cdr is nil, no label - is inserted. - - By default, chapters have a prefix of `cha:' while sections and - subsections have a prefix of `sec:'. Labels are not automatically - inserted for other types of sections. - - -File: auctex.info, Node: Environments, Next: Mathematics, Prev: Sectioning, Up: Editing - -2.4 Inserting Environment Templates -=================================== - -A large apparatus is available that supports insertions of environments, -that is `\begin{}' -- `\end{}' pairs. - - AUCTeX is aware of most of the actual environments available in a -specific document. This is achieved by examining your `\documentclass' -command, and consulting a precompiled list of environments available in -a large number of styles. - - You insert an environment with `C-c C-e', and select an environment -type. Depending on the environment, AUCTeX may ask more questions -about the optional parts of the selected environment type. With `C-u -C-c C-e' you will change the current environment. - - -- Command: LaTeX-environment ARG - (`C-c C-e') AUCTeX will prompt you for an environment to insert. - At this prompt, you may press or to complete a - partially written name, and/or to get a list of available - environments. After selection of a specific environment AUCTeX may - prompt you for further specifications. - - If the optional argument ARG is not-nil (i.e. you have given a - prefix argument), the current environment is modified and no new - environment is inserted. - - As a default selection, AUCTeX will suggest the environment last -inserted or, as the first choice the value of the variable -`LaTeX-default-environment'. - - -- User Option: LaTeX-default-environment - Default environment to insert when invoking `LaTeX-environment' - first time. - - If the document is empty, or the cursor is placed at the top of the -document, AUCTeX will default to insert a `document' environment. - - Most of these are described further in the following sections, and -you may easily specify more. *Note Customizing Environments::. - -* Menu: - -* Equations:: Equations -* Floats:: Floats -* Itemize-like:: Itemize-like Environments -* Tabular-like:: Tabular-like Environments -* Customizing Environments:: Customizing Environments - - You can close the current environment with `C-c ]', but we suggest -that you use `C-c C-e' to insert complete environments instead. - - -- Command: LaTeX-close-environment - (`C-c ]') Insert an `\end' that matches the current environment. - - -File: auctex.info, Node: Equations, Next: Floats, Up: Environments - -2.4.1 Equations ---------------- - -When inserting equation-like environments, the `\label' will have a -default prefix, which is controlled by the following variables: - - -- User Option: LaTeX-equation-label - Prefix to use for `equation' labels. - - -- User Option: LaTeX-eqnarray-label - Prefix to use for `eqnarray' labels. - - -- User Option: LaTeX-amsmath-label - Prefix to use for amsmath equation labels. Amsmath equations - include `align', `alignat', `xalignat', `aligned', `flalign' and - `gather'. - - -File: auctex.info, Node: Floats, Next: Itemize-like, Prev: Equations, Up: Environments - -2.4.2 Floats ------------- - -Figures and tables (i.e., floats) may also be inserted using AUCTeX. -After choosing either `figure' or `table' in the environment list -described above, you will be prompted for a number of additional things. - -FLOAT POSITION - This is the optional argument of float environments that controls - how they are placed in the final document. In LaTeX this is a - sequence of the letters `htbp' as described in the LaTeX manual. - The value will default to the value of `LaTeX-float'. - -CAPTION - This is the caption of the float. The default is to insert the - caption at the bottom of the float. You can specify floats where - the caption should be placed at the top with - `LaTeX-top-caption-list'. - -LABEL - The label of this float. The label will have a default prefix, - which is controlled by the variables `LaTeX-figure-label' and - `LaTeX-table-label'. - - Moreover, you will be asked if you want the contents of the float -environment to be horizontally centered. Upon a positive answer a -`\centering' macro will be inserted at the beginning of the float -environment. - - -- User Option: LaTeX-float - Default placement for floats. - - -- User Option: LaTeX-figure-label - Prefix to use for figure labels. - - -- User Option: LaTeX-table-label - Prefix to use for table labels. - - -- User Option: LaTeX-top-caption-list - List of float environments with top caption. - - -File: auctex.info, Node: Itemize-like, Next: Tabular-like, Prev: Floats, Up: Environments - -2.4.3 Itemize-like Environments -------------------------------- - -In an itemize-like environment, nodes (i.e., `\item's) may be inserted -using `C-c '. - - -- Command: LaTeX-insert-item - (`C-c ') Close the current item, move to the next line and - insert an appropriate `\item' for the current environment. That is, - `itemize' and `enumerate' will have `\item ' inserted, while - `description' will have `\item[]' inserted. - - -File: auctex.info, Node: Tabular-like, Next: Customizing Environments, Prev: Itemize-like, Up: Environments - -2.4.4 Tabular-like Environments -------------------------------- - -When inserting Tabular-like environments, that is, `tabular' `array' -etc., you will be prompted for a template for that environment. -Related variables: - - -- User Option: LaTeX-default-format - Default format string for array and tabular environments. - - -- User Option: LaTeX-default-position - Default position string for array and tabular environments. If - nil, act like the empty string is given, but don't prompt for a - position. - - -File: auctex.info, Node: Customizing Environments, Prev: Tabular-like, Up: Environments - -2.4.5 Customizing Environments ------------------------------- - -*Note Adding Environments::, for how to customize the list of known -environments. - - -File: auctex.info, Node: Mathematics, Next: Completion, Prev: Environments, Up: Editing - -2.5 Entering Mathematics -======================== - -TeX is written by a mathematician, and has always contained good -support for formatting mathematical text. AUCTeX supports this -tradition, by offering a special minor mode for entering text with many -mathematical symbols. You can enter this mode by typing `C-c ~'. - - -- Command: LaTeX-math-mode - (`C-c ~') Toggle LaTeX Math mode. This is a minor mode rebinding - the key `LaTeX-math-abbrev-prefix' to allow easy typing of - mathematical symbols. ``' will read a character from the keyboard, - and insert the symbol as specified in `LaTeX-math-default' and - `LaTeX-math-list'. If given a prefix argument, the symbol will be - surrounded by dollar signs. - - You can use another prefix key (instead of ``') by setting the -variable `LaTeX-math-abbrev-prefix'. - - To enable LaTeX Math mode by default, add the following in your -`.emacs' file: - (add-hook 'LaTeX-mode-hook 'LaTeX-math-mode) - - -- User Option: LaTeX-math-abbrev-prefix - A string containing the prefix of `LaTeX-math-mode' commands; This - value defaults to ``'. - - The string has to be a key or key sequence in a format understood - by the `kbd' macro. This corresponds to the syntax usually used - in the manuals for Emacs Emacs Lisp. - - The variable `LaTeX-math-list' allows you to add your own mappings. - - -- User Option: LaTeX-math-list - A list containing user-defined keys and commands to be used in - LaTeX Math mode. Each entry should be a list of two to four - elements. - - First, the key to be used after `LaTeX-math-abbrev-prefix' for - macro insertion. If it is nil, the symbol has no associated - keystroke (it is available in the menu, though). - - Second, a string representing the name of the macro (without a - leading backslash.) - - Third, a string representing the name of a submenu the command - should be added to. Use a list of strings in case of nested menus. - - Fourth, the position of a Unicode character to be displayed in the - menu alongside the macro name. This is an integer value. - - -- User Option: LaTeX-math-menu-unicode - Whether the LaTeX menu should try using Unicode for effect. Your - Emacs built must be able to display include Unicode characters in - menus for this feature. - - AUCTeX's reference card `tex-ref.tex' includes a list of all math -mode commands. - - AUCTeX can help you write subscripts and superscripts in math -constructs by automatically inserting a pair of braces after typing <_> -or <^> respectively and putting point between the braces. In order to -enable this feature, set the variable -`TeX-electric-sub-and-superscript' to a non-nil value. - - -- User Option: TeX-electric-sub-and-superscript - If non-nil, insert braces after typing <^> and <_> in math mode. - - -File: auctex.info, Node: Completion, Next: Commenting, Prev: Mathematics, Up: Editing - -2.6 Completion -============== - -Emacs lisp programmers probably know the `lisp-complete-symbol' -command, usually bound to `M-'. Users of the wonderful ispell -mode know and love the `ispell-complete-word' command from that -package. Similarly, AUCTeX has a `TeX-complete-symbol' command, by -default bound to `M-' which is equivalent to `M-C-i'. Using -`TeX-complete-symbol' makes it easier to type and remember the names of -long LaTeX macros. - - In order to use `TeX-complete-symbol', you should write a backslash -and the start of the macro. Typing `M-' will now complete as much -of the macro, as it unambiguously can. For example, if you type -``\renewc'' and then `M-', it will expand to ``\renewcommand''. - - -- Command: TeX-complete-symbol - (`M-') Complete TeX symbol before point. - - A more direct way to insert a macro is with `TeX-insert-macro', -bound to `C-c C-m' which is equivalent to `C-c '. It has the -advantage over completion that it knows about the argument of most -standard LaTeX macros, and will prompt for them. It also knows about -the type of the arguments, so it will for example give completion for -the argument to `\include'. Some examples are listed below. - - -- Command: TeX-insert-macro - (`C-c C-m' or `C-c ') Prompt (with completion) for the name - of a TeX macro, and if AUCTeX knows the macro, prompt for each - argument. - - As a default selection, AUCTeX will suggest the macro last inserted -or, as the first choice the value of the variable `TeX-default-macro'. - - -- User Option: TeX-insert-macro-default-style - Specifies whether `TeX-insert-macro' will ask for all optional - arguments. - - If set to the symbol `show-optional-args', `TeX-insert-macro' asks - for optional arguments of TeX macros. If set to - `mandatory-args-only', `TeX-insert-macro' asks only for mandatory - arguments. When `TeX-insert-macro' is called with prefix argument - (`C-u'), it's the other way round. - - Note that for some macros, there are special mechanisms, e.g. - `LaTeX-includegraphics-options-alist'. - - - -- User Option: TeX-default-macro - Default macro to insert when invoking `TeX-insert-macro' first - time. - - A faster alternative is to bind the function `TeX-electric-macro' to -`\'. This can be done by setting the variable `TeX-electric-escape' - - -- User Option: TeX-electric-escape - If this is non-nil when AUCTeX is loaded, the TeX escape character - `\' will be bound to `TeX-electric-macro' - - The difference between `TeX-insert-macro' and `TeX-electric-macro' -is that space will complete and exit from the minibuffer in -`TeX-electric-macro'. Use if you merely want to complete. - - -- Command: TeX-electric-macro - Prompt (with completion) for the name of a TeX macro, and if - AUCTeX knows the macro, prompt for each argument. Space will - complete and exit. - - By default AUCTeX will put an empty set braces `{}' after a macro -with no arguments to stop it from eating the next whitespace. This can -be stopped by entering `LaTeX-math-mode', *note Mathematics::, or by -setting `TeX-insert-braces' to nil. - - -- User Option: TeX-insert-braces - If non-nil, append a empty pair of braces after inserting a macro. - - Completions work because AUCTeX can analyze TeX files, and store -symbols in Emacs Lisp files for later retrieval. *Note Automatic::, for -more information. - - AUCTeX will also make completion for many macro arguments, for -example existing labels when you enter a `\ref' macro with -`TeX-insert-macro' or `TeX-electric-macro', and BibTeX entries when you -enter a `\cite' macro. For this kind of completion to work, parsing -must be enabled as described in *note Parsing Files::. For `\cite' you -must also make sure that the BibTeX files have been saved at least once -after you enabled automatic parsing on save, and that the basename of -the BibTeX file does not conflict with the basename of one of TeX files. - - -File: auctex.info, Node: Commenting, Next: Indenting, Prev: Completion, Up: Editing - -2.7 Commenting -============== - -It is often necessary to comment out temporarily a region of TeX or -LaTeX code. This can be done with the commands `C-c ;' and `C-c %'. -`C-c ;' will comment out all lines in the current region, while `C-c %' -will comment out the current paragraph. Type `C-c ;' again to -uncomment all lines of a commented region, or `C-c %' again to -uncomment all comment lines around point. These commands will insert -or remove a single `%' respectively. - - -- Command: TeX-comment-or-uncomment-region - (`C-c ;') Add or remove `%' from the beginning of each line in the - current region. Uncommenting works only if the region encloses - solely commented lines. If AUCTeX should not try to guess if the - region should be commented or uncommented the commands - `TeX-comment-region' and `TeX-uncomment-region' can be used to - explicitly comment or uncomment the region in concern. - - -- Command: TeX-comment-or-uncomment-paragraph - (`C-c %') Add or remove `%' from the beginning of each line in the - current paragraph. When removing `%' characters the paragraph is - considered to consist of all preceding and succeeding lines - starting with a `%', until the first non-comment line. - - -File: auctex.info, Node: Indenting, Next: Filling, Prev: Commenting, Up: Editing - -2.8 Indenting -============= - -Indentation means the addition of whitespace at the beginning of lines -to reflect special syntactical constructs. This makes it easier to see -the structure of the document, and to catch errors such as a missing -closing brace. Thus, the indentation is done for precisely the same -reasons that you would indent ordinary computer programs. - - Indentation is done by LaTeX environments and by TeX groups, that is -the body of an environment is indented by the value of -`LaTeX-indent-level' (default 2). Also, items of an `itemize-like' -environment are indented by the value of `LaTeX-item-indent', default --2. (Items are identified with the help of `LaTeX-item-regexp'.) If -more environments are nested, they are indented `accumulated' just like -most programming languages usually are seen indented in nested -constructs. - - You can explicitely indent single lines, usually by pressing , -or marked regions by calling `indent-region' on it. If you have -`auto-fill-mode' enabled and a line is broken while you type it, Emacs -automatically cares about the indentation in the following line. If -you want to have a similar behavior upon typing , you can -customize the variable `TeX-newline-function' and change the default of -`newline' which does no indentation to `newline-and-indent' which -indents the new line or `reindent-then-newline-and-indent' which -indents both the current and the new line. - - There are certain LaTeX environments which should be indented in a -special way, like `tabular' or `verbatim'. Those environments may be -specified in the variable `LaTeX-indent-environment-list' together with -their special indentation functions. Taking the `verbatim' environment -as an example you can see that `current-indentation' is used as the -indentation function. This will stop AUCTeX from doing any indentation -in the environment if you hit for example. - - There are environments in `LaTeX-indent-environment-list' which do -not bring a special indentation function with them. This is due to the -fact that first the respective functions are not implemented yet and -second that filling will be disabled for the specified environments. -This shall prevent the source code from being messed up by accidently -filling those environments with the standard filling routine. If you -think that providing special filling routines for such environments -would be an appropriate and challenging task for you, you are invited to -contribute. (*Note Filling::, for further information about the filling -functionality) - - The check for the indentation function may be enabled or disabled by -customizing the variable `LaTeX-indent-environment-check'. - - As a side note with regard to formatting special environments: Newer -Emacsen include `align.el' and therefore provide some support for -formatting `tabular' and `tabbing' environments with the function -`align-current' which will nicely align columns in the source code. - - AUCTeX is able to format commented parts of your code just as any -other part. This means LaTeX environments and TeX groups in comments -will be indented syntactically correct if the variable -`LaTeX-syntactic-comments' is set to t. If you disable it, comments -will be filled like normal text and no syntactic indentation will be -done. - - Following you will find a list of most commands and variables related -to indenting with a small summary in each case: - -`' - `LaTeX-indent-line' will indent the current line. - -`' - `newline-and-indent' inserts a new line (much like ) and - moves the cursor to an appropriate position by the left margin. - - Most keyboards nowadays lack a linefeed key and `C-j' may be - tedious to type. Therefore you can customize AUCTeX to perform - indentation upon typing as well. The respective option is - called `TeX-newline-function'. - -`C-j' - Alias for - - -- User Option: LaTeX-indent-environment-list - List of environments with special indentation. The second element - in each entry is the function to calculate the indentation level in - columns. - - The filling code currently cannot handle tabular-like environments - which will be completely messed-up if you try to format them. - This is why most of these environments are included in this - customization option without a special indentation function. This - will prevent that they get filled. - - -- User Option: LaTeX-indent-level - Number of spaces to add to the indentation for each `\begin' not - matched by a `\end'. - - -- User Option: LaTeX-item-indent - Number of spaces to add to the indentation for `\item''s in list - environments. - - -- User Option: TeX-brace-indent-level - Number of spaces to add to the indentation for each `{' not - matched by a `}'. - - -- User Option: LaTeX-syntactic-comments - If non-nil comments will be filled and indented according to LaTeX - syntax. Otherwise they will be filled like normal text. - - -- User Option: TeX-newline-function - Used to specify the function which is called when is pressed. - This will normally be `newline' which simply inserts a new line. - In case you want to have AUCTeX do indentation as well when you - press , use the built-in functions `newline-and-indent' or - `reindent-then-newline-and-indent'. The former inserts a new line - and indents the following line, i.e. it moves the cursor to the - right position and therefore acts as if you pressed . The - latter function additionally indents the current line. If you - choose `Other', you can specify your own fancy function to be - called when is pressed. - - -File: auctex.info, Node: Filling, Prev: Indenting, Up: Editing - -2.9 Filling -=========== - -Filling deals with the insertion of line breaks to prevent lines from -becoming wider than what is specified in `fill-column'. The linebreaks -will be inserted automatically if `auto-fill-mode' is enabled. In this -case the source is not only filled but also indented automatically as -you write it. - - `auto-fill-mode' can be enabled for AUCTeX by calling -`turn-on-auto-fill' in one of the hooks AUCTeX is running. *Note Modes -and Hooks::. As an example, if you want to enable `auto-fill-mode' in -`LaTeX-mode', put the following into your init file: - - (add-hook 'LaTeX-mode-hook 'turn-on-auto-fill) - - You can manually fill explicitely marked regions, paragraphs, -environments, complete sections, or the whole buffer. (Note that manual -filling in AUCTeX will indent the start of the region to be filled in -contrast to many other Emacs modes.) - - There are some syntactical constructs which are handled specially -with regard to filling. These are so-called code comments and paragraph -commands. - - Code comments are comments preceded by code or text in the same line. -Upon filling a region, code comments themselves will not get filled. -Filling is done from the start of the region to the line with the code -comment and continues after it. In order to prevent overfull lines in -the source code, a linebreak will be inserted before the last -non-comment word by default. This can be changed by customizing -`LaTeX-fill-break-before-code-comments'. If you have overfull lines -with code comments you can fill those explicitely by calling -`LaTeX-fill-paragraph' or pressing `M-q' with the cursor positioned on -them. This will add linebreaks in the comment and indent subsequent -comment lines to the column of the comment in the first line of the -code comment. In this special case `M-q' only acts on the current line -and not on the whole paragraph. - - Lines with `\par' are treated similarly to code comments, i.e. -`\par' will be treated as paragraph boundary which should not be -followed by other code or text. But it is not treated as a real -paragraph boundary like an empty line where filling a paragraph would -stop. - - Paragraph commands like `\section' or `\noindent' (the list of -commands is defined by `LaTeX-paragraph-commands') are often to be -placed in their own line(s). This means they should not be consecuted -with any preceding or following adjacent lines of text. AUCTeX will -prevent this from happening if you do not put any text except another -macro after the end of the last brace of the respective macro. If -there is other text after the macro, AUCTeX regards this as a sign that -the macro is part of the following paragraph. - - Here are some examples: - - \begin{quote} - text text text text - - \begin{quote}\label{foo} - text text text text - - If you press `M-q' on the first line in both examples, nothing will -change. But if you write - - \begin{quote} text - text text text text - - and press `M-q', you will get - - \begin{quote} text text text text text - - Besides code comments and paragraph commands, another speciality of -filling in AUCTeX involves commented lines. You should be aware that -these comments are treated as islands in the rest of the LaTeX code if -syntactic filling is enabled. This means, for example, if you try to -fill an environment with `LaTeX-fill-environment' and have the cursor -placed on a commented line which does not have a surrounding -environment inside the comment, AUCTeX will report an error. - - The relevant commands and variables with regard to filling are: - -`C-c C-q C-p' - `LaTeX-fill-paragraph' will fill and indent the current paragraph. - -`M-q' - Alias for `C-c C-q C-p' - -`C-c C-q C-e' - `LaTeX-fill-environment' will fill and indent the current - environment. This may e.g. be the `document' environment, in - which case the entire document will be formatted. - -`C-c C-q C-s' - `LaTeX-fill-section' will fill and indent the current logical - sectional unit. - -`C-c C-q C-r' - `LaTeX-fill-region' will fill and indent the current region. - - -- User Option: LaTeX-fill-break-at-separators - List of separators before or after which respectively linebreaks - will be inserted if they do not fit into one line. The separators - can be curly braces, brackets, switches for inline math (`$', `\(', - `\)') and switches for display math (`\[', `\]'). Such formatting - can be useful to make macros and math more visible or to prevent - overfull lines in the LaTeX source in case a package for - displaying formatted TeX output inside the Emacs buffer, like - preview-latex, is used. - - -- User Option: LaTeX-fill-break-before-code-comments - Code comments are comments preceded by some other text in the same - line. When a paragraph containing such a comment is to be filled, - the comment start will be seen as a border after which no line - breaks will be inserted in the same line. If the option - `LaTeX-fill-break-before-code-comments' is enabled (which is the - default) and the comment does not fit into the line, a line break - will be inserted before the last non-comment word to minimize the - chance that the line becomes overfull. - - -File: auctex.info, Node: Display, Next: Processing, Prev: Editing, Up: Top - -3 Controlling Screen Display -**************************** - -It is often desirable to get visual help of what markup code in a text -actually does whithout having to decipher it explicitely. For this -purpose Emacs and AUCTeX provide font locking (also known as syntax -highlighting) which visually sets off markup code like macros or -environments by using different colors or fonts. For example text to be -typeset in italics can be displayed with an italic font in the editor as -well, or labels and references get their own distinct color. - - While font locking helps you grasp the purpose of markup code and -separate markup from content, the markup code can still be distracting. -AUCTeX lets you hide those parts and show them again at request with -its built-in support for hiding macros and environments which we call -folding here. - - Besides folding of macros and environments, AUCTeX provides support -for Emacs' outline mode which lets you narrow the buffer content to -certain sections of your text by hiding the parts not belonging to these -sections. - -* Menu: - -* Font Locking:: Font Locking -* Folding:: Folding Macros and Environments -* Outline:: Outlining the Document - - -File: auctex.info, Node: Font Locking, Next: Folding, Up: Display - -3.1 Font Locking -================ - -Font locking is supposed to improve readability of the source code by -highlighting certain keywords with different colors or fonts. It -thereby lets you recognize the function of markup code to a certain -extent without having to read the markup command. For general -information on controlling font locking with Emacs' Font Lock mode, see -*note Font Lock Mode: (emacs)Font Lock. - - -- User Option: TeX-install-font-lock - Once font locking is enabled globally or for the major modes - provided by AUCTeX, the font locking patterns and functionality of - font-latex are activated by default. You can switch to a - different font locking scheme or disable font locking in AUCTeX by - customizing the variable `TeX-install-font-lock'. - - Besides font-latex AUCTeX ships with a scheme which is derived - from Emacs' default LaTeX mode and activated by choosing - `tex-font-setup'. Be aware that this scheme is not coupled with - AUCTeX's style system and not the focus of development. Therefore - and due to font-latex being much more feature-rich the following - explanations will only cover font-latex. - - In case you want to hook in your own fontification scheme, you can - choose `other' and insert the name of the function which sets up - your font locking patterns. If you want to disable fontification - in AUCTeX completely, choose `ignore'. - - font-latex provides many options for customization which are -accessible with `M-x customize-group RET font-latex RET'. For this -description the various options are explained in conceptional groups. - -* Menu: - -* Fontification of macros:: Fontification of macros -* Fontification of quotes:: Fontification of quotes -* Fontification of math:: Fontification of math constructs -* Verbatim content:: Verbatim macros and environments -* Faces:: Faces used by font-latex -* Known problems:: Known fontification problems - - -File: auctex.info, Node: Fontification of macros, Next: Fontification of quotes, Up: Font Locking - -3.1.1 Fontification of macros ------------------------------ - -Highlighting of macros can be customized by adapting keyword lists which -can be found in the customization group `font-latex-keywords'. - - Three types of macros can be handled differently with respect to -fontification: - - 1. Commands of the form `\foo[bar]{baz}' which consist of the macro - itself, optional arguments in square brackets and mandatory - arguments in curly braces. For the command itself the face - `font-lock-keyword-face' will be used and for the optional - arguments the face `font-lock-variable-name-face'. The face - applied to the mandatory argument depends on the macro class - represented by the respective built-in variables. - - 2. Declaration macros of the form `{\foo text}' which consist of the - macro which may be enclosed in a TeX group together with text to be - affected by the macro. In case a TeX group is present, the macro - will get the face `font-lock-keyword-face' and the text will get - the face configured for the respective macro class. If no TeX - group is present, the latter face will be applied to the macro - itself. - - 3. Simple macros of the form `\foo' which do not have any arguments or - groupings. The respective face will be applied to the macro - itself. - - Customization variables for `\foo[bar]{baz}' type macros allow both -the macro name and the sequence of arguments to be specified. The -latter is done with a string which can contain the characters -`*' - indicating the existence of a starred variant for the macro, - -`[' - for optional arguments in brackets, - -`{' - for mandatory arguments in braces, - -`\' - for mandatory arguments consisting of a single macro and - -`|' - as a prefix indicating that two alternatives are following. - For example the specifier for `\documentclass' would be `[{' because -the macro has one optional followed by one mandatory argument. The -specifier for `\newcommand' would be `*|{\[[{' because there is a -starred variant, the mandatory argument following the macro name can be -a macro or a TeX group which can be followed by two optional arguments -and the last token is a mandatory argument in braces. - - Customization variables for the `{\foo text}' and `\foo' types are -simple lists of strings where each entry is a macro name (without the -leading backslash). - -General macro classes ---------------------- - -font-latex provides keyword lists for different macro classes which are -described in the following table: - -`font-latex-match-function-keywords' - Keywords for macros defining or related to functions, like - `\newcommand'. - Type: `\macro[...]{...}' - Face: `font-lock-function-name-face' - -`font-latex-match-reference-keywords' - Keywords for macros defining or related to references, like `\ref'. - Type: `\macro[...]{...}' - Face: `font-lock-constant-face' - -`font-latex-match-textual-keywords' - Keywords for macros specifying textual content, like `\caption'. - Type: `\macro[...]{...}' - Face: `font-lock-type-face' - -`font-latex-match-variable-keywords' - Keywords for macros defining or related to variables, like - `\setlength'. - Type: `\macro[...]{...}' - Face: `font-lock-variable-name-face' - -`font-latex-match-warning-keywords' - Keywords for important macros, e.g. affecting line or page break, - like `\clearpage'. - Type: `\macro' - Face: `font-latex-warning-face' - -Sectioning commands -------------------- - -Sectioning commands are macros like `\chapter' or `\section'. For -these commands there are two fontification schemes which may be -selected by customizing the variable `font-latex-fontify-sectioning'. - - -- User Option: font-latex-fontify-sectioning - Per default sectioning commands will be shown in a larger, - proportional font, which corresponds to a number for this - variable. The font size varies with the sectioning level, e.g. - `\part' (`font-latex-sectioning-0-face') has a larger font than - `\paragraph' (`font-latex-sectioning-5-face'). Typically, values - from 1.05 to 1.3 for `font-latex-fontify-sectioning' give best - results, depending on your font setup. If you rather like to use - the base font and a different color, set the variable to the symbol - `color'. In this case the face `font-lock-type-face' will be used - to fontify the argument of the sectioning commands. - - You can make font-latex aware of your own sectioning commands be -adding them to the keyword lists: -`font-latex-match-sectioning-0-keywords' -(`font-latex-sectioning-0-face') ... -`font-latex-match-sectioning-5-keywords' -(`font-latex-sectioning-5-face'). - - Related to sectioning there is special support for slide titles which -may be fontified with the face `font-latex-slide-title-face'. You can -add macros which should appear in this face by customizing the variable -`font-latex-match-slide-title-keywords'. - -Commands for changing fonts ---------------------------- - -LaTeX provides various macros for changing fonts or font attributes. -For example, you can select an italic font with `\textit{...}' or bold -with `\textbf{...}'. An alternative way to specify these fonts is to -use special macros in TeX groups, like `{\itshape ...}' for italics and -`{\bfseries ...}' for bold. As mentioned above, we call the former -variants commands and the latter declarations. - - Besides the macros for changing fonts provided by LaTeX there is an -infinite number of other macros--either defined by yourself for logical -markup or defined by macro packages--which affect the font in the -typeset text. While LaTeX's built-in macros and macros of packages -known by AUCTeX are already handled by font-latex, different keyword -lists per type style and macro type are provided for entering your own -macros which are listed in the table below. - -`font-latex-match-bold-command-keywords' - Keywords for commands specifying a bold type style. - Face: `font-latex-bold-face' - -`font-latex-match-italic-command-keywords' - Keywords for commands specifying an italic font. - Face: `font-latex-italic-face' - -`font-latex-match-math-command-keywords' - Keywords for commands specifying a math font. - Face: `font-latex-math-face' - -`font-latex-match-type-command-keywords' - Keywords for commands specifying a typewriter font. - Face: `font-lock-type-face' - -`font-latex-match-bold-declaration-keywords' - Keywords for declarations specifying a bold type style. - Face: `font-latex-bold-face' - -`font-latex-match-italic-declaration-keywords' - Keywords for declarations specifying an italic font. - Face: `font-latex-italic-face' - -`font-latex-match-type-declaration-keywords' - Keywords for declarations specifying a typewriter font. - Face: `font-latex-type-face' - -Deactivating defaults of built-in keyword classes -------------------------------------------------- - -font-latex ships with predefined lists of keywords for the classes -described above. You can disable these defaults per class by -customizing the variable `font-latex-deactivated-keyword-classes'. -This is a list of strings for keyword classes to be deactivated. Valid -entries are "warning", "variable", "reference", "function" , -"sectioning-0", "sectioning-1", "sectioning-2", "sectioning-3", -"sectioning-4", "sectioning-5", "textual", "bold-command", -"italic-command", "math-command", "type-command", "bold-declaration", -"italic-declaration", "type-declaration". - - You can also get rid of certain keywords only. For example if you -want to remove highlighting of footnotes as references you can put the -following stanza into your init file: - - (eval-after-load "font-latex" - '(setq-default - font-latex-match-reference-keywords-local - (remove "footnote" font-latex-match-reference-keywords-local))) - - But note that this means fiddling with font-latex's internals and is -not guaranteed to work in future versions of font-latex. - -User-defined keyword classes ----------------------------- - -In case the customization options explained above do not suffice for -your needs, you can specify your own keyword classes by customizing the -variable `font-latex-user-keyword-classes'. - - -- User Option: font-latex-user-keyword-classes - Every keyword class consists of four parts, a name, a list of - keywords, a face and a specifier for the type of macros to be - highlighted. - - When adding new entries, you have to use unique values for the - class names, i.e. they must not clash with names of the built-in - keyword classes or other names given by you. Additionally the - names must not contain spaces. - - The list of keywords defines which commands and declarations - should be covered by the keyword class. A keyword can either be a - simple command name omitting the leading backslash or a list - consisting of the command name and a string specifying the - sequence of arguments for the command. - - The face argument can either be an existing face or font - specifications made by you. (The latter option is not available - on XEmacs.) - - There are three alternatives for the type of keywords--"Command - with arguments", "Declaration inside TeX group" and "Command - without arguments"--which correspond with the macro types - explained above. - - -File: auctex.info, Node: Fontification of quotes, Next: Fontification of math, Prev: Fontification of macros, Up: Font Locking - -3.1.2 Fontification of quotes ------------------------------ - -Text in quotation marks is displayed with the face -`font-latex-string-face'. Besides the various forms of opening and -closing double and single quotation marks, so-called guillemets (<<, >>) -can be used for quoting. Because there are two styles of using -them--French style: << text >>; German style: >>text<<--you can -customize the variable `font-latex-quotes' to tell font-latex which -type you are using if the correct value cannot be derived from document -properties. - - -- User Option: font-latex-quotes - The default value of `font-latex-quotes' is `auto' which means - that font-latex will try to derive the correct type of quotation - mark matching from document properties like the language option - supplied to the babel LaTeX package. - - If the automatic detection fails for you and you mostly use one - specific style you can set it to a specific language-dependent - value as well. Set the value to `german' if you are using - >>German quotes<< and to `french' if you are using << French - quotes >>. font-latex will recognize the different ways these - quotes can be given in your source code, i.e. (`"<', `">'), (`<<', - `>>') and the respective 8-bit variants. - - If you set `font-latex-quotes' to nil, quoted content will not be - fontified. - - -File: auctex.info, Node: Fontification of math, Next: Verbatim content, Prev: Fontification of quotes, Up: Font Locking - -3.1.3 Fontification of mathematical constructs ----------------------------------------------- - -In LaTeX mathematics can be indicated by a variety of different -methods: toggles (like dollar signs), macros and environments. Math -constructs known by font-latex are displayed with the face -`font-latex-math-face'. Support for dollar signs and shorthands like -`\(...\)' or `\[...\]' is built-in and not customizable. Support for -other math macros and environments can be adapted by customizing the -variables `font-latex-match-math-command-keywords' and -`font-latex-math-environments' respectively. - - In order to make math constructs more readable, font-latex displays -subscript and superscript parts in a smaller font and raised or lowered -respectively. This fontification feature can be controlled with the -variables `font-latex-fontify-script' and `font-latex-script-display'. - - -- User Option: font-latex-fontify-script - If non-nil, fontify subscript and superscript strings. - - Note that this feature is not available on XEmacs, for which it is - disabled per default. In GNU Emacs raising and lowering is not - enabled for versions 21.3 and before due to it working not - properly. - - -- User Option: font-latex-script-display - Display specification for subscript and superscript content. The - car is used for subscript, the cdr is used for superscript. The - feature is implemented using so-called display properties. For - information on what exactly to specify for the values, see *note - Other Display Specifications: (elisp)Other Display Specs. - - -File: auctex.info, Node: Verbatim content, Next: Faces, Prev: Fontification of math, Up: Font Locking - -3.1.4 Verbatim macros and environments --------------------------------------- - -Usually it is not desirable to have content to be typeset verbatim -highlighted according to LaTeX syntax. Therefore this content will be -fontified uniformly with the face `font-latex-verbatim-face'. - - font-latex differentiates three different types of verbatim -constructs for fontification. Macros with special characters like | as -delimiters, macros with braces, and environments. Which macros and -environments are recognized is controlled by the variables -`LaTeX-verbatim-macros-with-delims', -`LaTeX-verbatim-macros-with-braces', and `LaTeX-verbatim-environments' -respectively. - - -File: auctex.info, Node: Faces, Next: Known problems, Prev: Verbatim content, Up: Font Locking - -3.1.5 Faces used by font-latex ------------------------------- - -In case you want to change the colors and fonts used by font-latex -please refer to the faces mentioned in the explanations above and use -`M-x customize-face RET RET'. All faces defined by font-latex -are accessible through a customization group by typing `M-x -customize-group RET font-latex-highlighting-faces RET'. - - -File: auctex.info, Node: Known problems, Prev: Faces, Up: Font Locking - -3.1.6 Known fontification problems ----------------------------------- - -In certain cases the fontification machinery fails to interpret buffer -contents correctly. This can lead to color bleed, i.e. large parts of a -buffer get fontified with an inappropriate face. A typical situation -for this to happen is the use of a dollar sign (`$') in a verbatim -macro or environment. If font-latex is not aware of the verbatim -construct, it assumes the dollar sign to be a toggle for mathematics and -fontifies the following buffer content with the respective face until it -finds a closing dollar sign or till the end of the buffer. - - As a remedy you can make the verbatim construct known to font-latex, -*note Verbatim content::. If this is not possible, you can insert a -commented dollar sign (`%$') at the next suitable end of line as a -quick workaround. - - -File: auctex.info, Node: Folding, Next: Outline, Prev: Font Locking, Up: Display - -3.2 Folding Macros and Environments -=================================== - -A popular complaint about markup languages like TeX and LaTeX is that -there is too much clutter in the source text and that one cannot focus -well on the content. There are macros where you are only interested in -the content they are enclosing, like font specifiers where the content -might already be fontified in a special way by font locking. Or macros -the content of which you only want to see when actually editing it, -like footnotes or citations. Similarly you might find certain -environments or comments distracting when trying to concentrate on the -body of your document. - - With AUCTeX's folding functionality you can collapse those items and -replace them by a fixed string, the content of one of their arguments, -or a mixture of both. If you want to make the original text visible -again in order to view or edit it, move point sideways onto the -placeholder (also called display string) or left-click with the mouse -pointer on it. (The latter is currently only supported on Emacs.) The -macro or environment will unfold automatically, stay open as long as -point is inside of it and collapse again once you move point out of it. -(Note that folding of environments currently does not work in every -AUCTeX mode.) - - In order to use this feature, you have to activate `TeX-fold-mode' -which will activate the auto-reveal feature and the necessary commands -to hide and show macros and environments. You can activate the mode in -a certain buffer by typing the command `M-x TeX-fold-mode RET' or using -the keyboard shortcut `C-c C-o C-f'. If you want to use it every time -you edit a LaTeX document, add it to a hook: - - (add-hook 'LaTeX-mode-hook (lambda () - (TeX-fold-mode 1))) - - If it should be activated in all AUCTeX modes, use `TeX-mode-hook' -instead of `LaTeX-mode-hook'. - - Once the mode is active there are several commands available to hide -and show macros, environments and comments: - - -- Command: TeX-fold-buffer - (`C-c C-o C-b') Hide all foldable items in the current buffer - according to the setting of `TeX-fold-type-list'. - - If you want to have this done automatically every time you open a - file, add it to a hook and make sure the function is called after - font locking is set up for the buffer. The following code should - accomplish this: - - (add-hook 'find-file-hook 'TeX-fold-buffer t) - - The command can be used any time to refresh the whole buffer and - fold any new macros and environments which were inserted after the - last invocation of the command. - - -- User Option: TeX-fold-type-list - List of symbols determining the item classes to consider for - folding. This can be macros, environments and comments. Per - default only macros and environments are folded. - - -- User Option: TeX-fold-force-fontify - In order for all folded content to get the right faces, the whole - buffer has to be fontified before folding is carried out. - `TeX-fold-buffer' therefore will force fontification of unfontified - regions. As this will prolong the time folding takes, you can - prevent forced fontification by customizing the variable - `TeX-fold-force-fontify'. - - -- User Option: TeX-fold-preserve-comments - By default items found in comments will be folded. If your - comments often contain unfinished code this might lead to - problems. Give this variable a non-nil value and foldable items - in your comments will be left alone. - - -- Command: TeX-fold-region - (`C-c C-o C-r') Hide all configured macros in the marked region. - - -- Command: TeX-fold-paragraph - (`C-c C-o C-p') Hide all configured macros in the paragraph - containing point. - - -- Command: TeX-fold-macro - (`C-c C-o C-m') Hide the macro on which point currently is located. - If the name of the macro is found in `TeX-fold-macro-spec-list', - the respective display string will be shown instead. If it is not - found, the name of the macro in sqare brackets or the default - string for unspecified macros - (`TeX-fold-unspec-macro-display-string') will be shown, depending - on the value of the variable `TeX-fold-unspec-use-name'. - - -- Command: TeX-fold-env - (`C-c C-o C-e') Hide the environment on which point currently is - located. The behavior regarding the display string is analogous to - `TeX-fold-macro' and determined by the variables - `TeX-fold-env-spec-list' and `TeX-fold-unspec-env-display-string' - respectively. - - -- Command: TeX-fold-math - Hide the math macro on which point currently is located. If the - name of the macro is found in `TeX-fold-math-spec-list', the - respective display string will be shown instead. If it is not - found, the name of the macro in sqare brackets or the default - string for unspecified macros - (`TeX-fold-unspec-macro-display-string') will be shown, depending - on the value of the variable `TeX-fold-unspec-use-name'. - - -- Command: TeX-fold-comment - (`C-c C-o C-c') Hide the comment point is located on. - - -- Command: TeX-fold-clearout-buffer - (`C-c C-o b') Permanently unfold all macros and environments in the - current buffer. - - -- Command: TeX-fold-clearout-region - (`C-c C-o r') Permanently unfold all macros and environments in the - marked region. - - -- Command: TeX-fold-clearout-paragraph - (`C-c C-o p') Permanently unfold all macros and environments in the - paragraph containing point. - - -- Command: TeX-fold-clearout-item - (`C-c C-o i') Permanently show the macro or environment on which - point currently is located. In contrast to temporarily opening the - macro when point is moved sideways onto it, the macro will be - permanently unfolded and will not collapse again once point is - leaving it. - - -- Command: TeX-fold-dwim - (`C-c C-o C-o') Hide or show items according to the current - context. If there is folded content, unfold it. If there is a - marked region, fold all configured content in this region. If - there is no folded content but a macro or environment, fold it. - - In case you want to use a different prefix than `C-c C-o' for these -commands you can customize the variable `TeX-fold-command-prefix'. -(Note that this will not change the key binding for activating the -mode.) - - The commands above will only take macros or environments into -consideration which are specified in the variables -`TeX-fold-macro-spec-list' or `TeX-fold-env-spec-list' respectively. - - -- User Option: TeX-fold-macro-spec-list - List of replacement specifiers and macros to fold. The specifier - can be a string, an integer or a function symbol. - - If you specify a string, it will be used as a display replacement - for the whole macro. Numbers in braces, brackets, parens or angle - brackets will be replaced by the respective macro argument. For - example `{1}' will be replaced by the first mandatory argument of - the macro. One can also define alternatives within the specifier - which are used if an argument is not found. Alternatives are - separated by `||'. They are most useful with optional arguments. - As an example, the default specifier for `\item' is `[1]:||*' which - means that if there is an optional argument, its value is shown - followed by a colon. If there is no optional argument, only an - asterisk is used as the display string. - - If you specify a number as the first element, the content of the - respective mandatory argument of a LaTeX macro will be used as the - placeholder. - - If the first element is a function symbol, the function will be - called with all mandatory arguments of the macro and the result of - the function call will be used as a replacement for the macro. - - The placeholder is made by copying the text from the buffer - together with its properties, i.e. its face as well. If - fontification has not happened when this is done (e.g. because of - lazy font locking) the intended fontification will not show up. - As a workaround you can leave Emacs idle a few seconds and wait - for stealth font locking to finish before you fold the buffer. Or - you just re-fold the buffer with `TeX-fold-buffer' when you notice - a wrong fontification. - - -- User Option: TeX-fold-env-spec-list - List of display strings or argument numbers and environments to - fold. Argument numbers refer to the `\begin' statement. That - means if you have e.g. `\begin{tabularx}{\linewidth}{XXX} ... - \end{tabularx}' and specify 3 as the argument number, the resulting - display string will be "XXX". - - -- User Option: TeX-fold-math-spec-list - List of display strings and math macros to fold. - - The variables `TeX-fold-macro-spec-list', `TeX-fold-env-spec-list', -and `TeX-fold-math-spec-list' apply to any AUCTeX mode. If you want to -make settings which are only applied to LaTeX mode, you can use the -mode-specific variables `LaTeX-fold-macro-spec-list', -`LaTeX-fold-env-spec-list', and `LaTeX-fold-math-spec-list' - - -- User Option: TeX-fold-unspec-macro-display-string - Default display string for macros which are not specified in - `TeX-fold-macro-spec-list'. - - -- User Option: TeX-fold-unspec-env-display-string - Default display string for environments which are not specified in - `TeX-fold-env-spec-list'. - - -- User Option: TeX-fold-unspec-use-name - If non-nil the name of the macro or environment surrounded by - square brackets is used as display string, otherwise the defaults - specified in `TeX-fold-unspec-macro-display-string' or - `TeX-fold-unspec-env-display-string' respectively. - - When you hover with the mouse pointer over folded content, its -original text will be shown in a tooltip or the echo area depending on -Tooltip mode being activate. In order to avoid exorbitantly big -tooltips and to cater for the limited space in the echo area the -content will be cropped after a certain amount of characters defined by -the variable `TeX-fold-help-echo-max-length'. - - -- User Option: TeX-fold-help-echo-max-length - Maximum length of original text displayed in a tooltip or the echo - area for folded content. Set it to zero in order to disable this - feature. - - -File: auctex.info, Node: Outline, Prev: Folding, Up: Display - -3.3 Outlining the Document -========================== - -AUCTeX supports the standard outline minor mode using LaTeX/ConTeXt -sectioning commands as header lines. *Note Outline Mode: -(emacs)Outline Mode. - - You can add your own headings by setting the variable -`TeX-outline-extra'. - - -- Variable: TeX-outline-extra - List of extra TeX outline levels. - - Each element is a list with two entries. The first entry is the - regular expression matching a header, and the second is the level - of the header. A `^' is automatically prepended to the regular - expressions in the list, so they must match text at the beginning - of the line. - - See `LaTeX-section-list' or `ConTeXt-INTERFACE-section-list' for - existing header levels. - - The following example add `\item' and `\bibliography' headers, with -`\bibliography' at the same outline level as `\section', and `\item' -being below `\subparagraph'. - - (setq TeX-outline-extra - '(("[ \t]*\\\\\\(bib\\)?item\\b" 7) - ("\\\\bibliography\\b" 2))) - - You may want to check out the unbundled `out-xtra' package for even -better outline support. It is available from your favorite emacs lisp -archive. - - -File: auctex.info, Node: Processing, Next: Customization, Prev: Display, Up: Top - -4 Starting Processors, Viewers and Other Programs -************************************************* - -The most powerful features of AUCTeX may be those allowing you to run -TeX, LaTeX, ConTeXt and other external commands like BibTeX and -`makeindex' from within Emacs, viewing and printing the results, and -moreover allowing you to _debug_ your documents. - - AUCTeX comes with a special tool bar for TeX and LaTeX which -provides buttons for the most important commands. You can enable or -disable it by customizing the options `plain-TeX-enable-toolbar' and -`LaTeX-enable-toolbar' in the `TeX-tool-bar' customization group. - -* Menu: - -* Commands:: Invoking external commands. -* Viewing:: Invoking external viewers. -* Debugging:: Debugging TeX and LaTeX output. -* Checking:: Checking the document. -* Control:: Controlling the processes. -* Cleaning:: Cleaning intermediate and output files. -* Documentation:: Documentation about macros and packages. - - -File: auctex.info, Node: Commands, Next: Viewing, Up: Processing - -4.1 Executing Commands -====================== - -Formatting the document with TeX, LaTeX or ConTeXt, viewing with a -previewer, printing the document, running BibTeX, making an index, or -checking the document with `lacheck' or `chktex' all require running an -external command. - -* Menu: - -* Starting a Command:: Starting a Command on a Document or Region -* Selecting a Command:: Selecting and Executing a Command -* Processor Options:: Options for TeX Processors - - -File: auctex.info, Node: Starting a Command, Next: Selecting a Command, Up: Commands - -4.1.1 Starting a Command on a Document or Region ------------------------------------------------- - -There are two ways to run an external command, you can either run it on -the current document with `TeX-command-master', or on the current -region with `TeX-command-region'. A special case of running TeX on a -region is `TeX-command-buffer' which differs from `TeX-command-master' -if the current buffer is not its own master file. - - -- Command: TeX-command-master - (`C-c C-c') Query the user for a command, and run it on the master - file associated with the current buffer. The name of the master - file is controlled by the variable `TeX-master'. The available - commands are controlled by the variable `TeX-command-list'. - - -- Command: TeX-command-region - (`C-c C-r') Query the user for a command, and run it on the - contents of the selected region. The region contents are written - into the region file, after extracting the header and trailer from - the master file. If mark is inactive (which can happen with - Transient Mark mode), use the old region. See also the command - `TeX-pin-region' about how to fix a region. - - The name of the region file is controlled by the variable - `TeX-region'. The name of the master file is controlled by the - variable `TeX-master'. The header is all text up to the line - matching the regular expression `TeX-header-end'. The trailer is - all text from the line matching the regular expression - `TeX-trailer-start'. The available commands are controlled by the - variable `TeX-command-list'. - - -- Command: TeX-command-buffer - (`C-c C-b') Query the user for a command, and apply it to the - contents of the current buffer. The buffer contents are written - into the region file, after extracting the header and trailer from - the master file. The command is then actually run on the region - file. See above for details. - - -- User Option: TeX-region - The name of the file for temporarily storing the text when - formatting the current region. - - -- User Option: TeX-header-end - A regular expression matching the end of the header. By default, - this is `\begin{document}' in LaTeX mode and `%**end of header' in - TeX mode. - - -- User Option: TeX-trailer-start - A regular expression matching the start of the trailer. By - default, this is `\end{document}' in LaTeX mode and `\bye' in TeX - mode. - - If you want to change the values of `TeX-header-end' and -`TeX-trailer-start' you can do this for all files by setting the -variables in a mode hook or per file by specifying them as file -variables (*note File Variables: (emacs)File Variables.). - - -- Command: TeX-pin-region - (`C-c C-t C-r') If you don't have a mode like Transient Mark mode - active, where marks get disabled automatically, the region would - need to get properly set before each call to `TeX-command-region'. - If you fix the current region with `C-c C-t C-r', then it will get - used for more commands even though mark and point may change. An - explicitly activated mark, however, will always define a new - region when calling `TeX-command-region'. - - AUCTeX will allow one process for each document, plus one process -for the region file to be active at the same time. Thus, if you are -editing N different documents, you can have N plus one processes -running at the same time. If the last process you started was on the -region, the commands described in *note Debugging:: and *note Control:: -will work on that process, otherwise they will work on the process -associated with the current document. - - -File: auctex.info, Node: Selecting a Command, Next: Processor Options, Prev: Starting a Command, Up: Commands - -4.1.2 Selecting and Executing a Command ---------------------------------------- - -Once you started the command selection with `C-c C-c', `C-c C-s' or -`C-c C-b' you will be prompted for the type of command. AUCTeX will -try to guess which command is appropriate in the given situation and -propose it as default. Usually this is a processor like `TeX' or -`LaTeX' if the document was changed or a viewer if the document was -just typeset. Other commands can be selected in the minibuffer with -completion support by typing . - - The available commands are defined by the variable -`TeX-command-list'. Per default it includes commands for typesetting -the document (e.g. `LaTeX'), for viewing the output (`View'), for -printing (`Print'), for generating an index (`Index') or for spell -checking (`Spell') to name but a few. You can also add your own -commands by adding entries to `TeX-command-list'. Refer to its doc -string for information about its syntax. You might also want to look -at `TeX-expand-list' to learn about the expanders you can use in -`TeX-command-list'. - - Note that the default of the variable occasionally changes. -Therefore it is advisable to add to the list rather than overwriting -it. You can do this with a call to `add-to-list' in your init file. -For example, if you wanted to add a command for running a program called -`foo' on the master or region file, you could do this with the -following form. - - (eval-after-load "tex" - '(add-to-list 'TeX-command-list - '("Foo" "foo %s" TeX-run-command t t :help "Run foo") t)) - - As mentioned before, AUCTeX will try to guess what command you want -to invoke. If you want to use another command than `TeX', `LaTeX' or -whatever processor AUCTeX thinks is appropriate for the current mode, -set the variable `TeX-command-default'. You can do this for all files -by setting it in a mode hook or per file by specifying it as a file -variable (*note File Variables: (emacs)File Variables.). - - -- User Option: TeX-command-default - The default command to run in this buffer. Must be an entry in - `TeX-command-list'. - - After confirming a command to execute, AUCTeX will try to save any -buffers related to the document, and check if the document needs to be -reformatted. If the variable `TeX-save-query' is non-nil, AUCTeX will -query before saving each file. By default AUCTeX will check emacs -buffers associated with files in the current directory, in one of the -`TeX-macro-private' directories, and in the `TeX-macro-global' -directories. You can change this by setting the variable -`TeX-check-path'. - - -- User Option: TeX-check-path - Directory path to search for dependencies. - - If nil, just check the current file. Used when checking if any - files have changed. - - -File: auctex.info, Node: Processor Options, Prev: Selecting a Command, Up: Commands - -4.1.3 Options for TeX Processors --------------------------------- - -There are some options you can customize affecting which processors are -invoked or the way this is done and which output they produce as a -result. These options control if DVI or PDF output should be produced, -if TeX should be started in interactive or nonstop mode, if source -specials or a SyncTeX file should be produced for making inverse and -forward search possible or which TeX engine should be used instead of -regular TeX, like PDFTeX, Omega or XeTeX. - - -- Command: TeX-PDF-mode - (`C-c C-t C-p') This command toggles the PDF mode of AUCTeX, a - buffer-local minor mode. You can customize `TeX-PDF-mode' to give - it a different default. The default is used when AUCTeX does not - have additional clue about what a document might want. This - option usually results in calling either PDFTeX or ordinary TeX. - - -- User Option: TeX-DVI-via-PDFTeX - If this is set, DVI will also be produced by calling PDFTeX, - setting `\pdfoutput=0'. This makes it possible to use PDFTeX - features like character protrusion even when producing DVI files. - Contemporary TeX distributions do this anyway, so that you need - not enable the option within AUCTeX. - - -- Command: TeX-interactive-mode - (`C-c C-t C-i') This command toggles the interactive mode of - AUCTeX, a global minor mode. You can customize - `TeX-interactive-mode' to give it a different default. In - interactive mode, TeX will pause with an error prompt when errors - are encountered and wait for the user to type something. - - -- Command: TeX-source-correlate-mode - (`C-c C-t C-s') Toggles support for forward and inverse search. - Forward search refers to jumping to the place in the previewed - document corresponding to where point is located in the document - source and inverse search to the other way round. *Note I/O - Correlation::. - - You can permanently activate `TeX-source-correlate-mode' by - customizing the variable `TeX-source-correlate-mode'. There is a - bunch of customization options for the mode, use `M-x - customize-group TeX-view ' to find out more. - - AUCTeX is aware of three different means to do I/O correlation: - source specials (only DVI output), the pdfsync LaTeX package (only - PDF output) and SyncTeX. The choice between source specials and - SyncTeX can be controlled with the variable - `TeX-source-correlate-method'. - - Should you use source specials it has to be stressed _very_ - strongly however, that source specials can cause differences in - page breaks and spacing, can seriously interfere with various - packages and should thus _never_ be used for the final version of - a document. In particular, fine-tuning the page breaks should be - done with source specials switched off. - - AUCTeX also allows you to easily select different TeX engines for -processing, either by using the entries in the `TeXing Options' submenu -below the `Command' menu or by calling the function `TeX-engine-set'. -These eventually set the variable `TeX-engine' which you can also -modify directly. - - -- User Option: TeX-engine - This variable allows you to choose which TeX engine should be used - for typesetting the document, i.e. the executables which will be - used when you invoke the `TeX' or `LaTeX' commands. The value - should be one of the symbols defined in `TeX-engine-alist-builtin' - or `TeX-engine-alist'. The symbols `default', `xetex', `luatex' - and `omega' are available from the built-in list. - - Note that `TeX-engine' is buffer-local, so setting the variable -directly or via the above mentioned menu or function will not take -effect in other buffers. If you want to activate an engine for all -AUCTeX modes, set `TeX-engine' in your init file, e.g. by using `M-x -customize-variable '. If you want to activate it for a certain -AUCTeX mode only, set the variable in the respective mode hook. If you -want to activate it for certain files, set it through file variables -(*note File Variables: (emacs)File Variables.). - - Should you need to change the executable names related to the -different engine settings, there are some variables you can tweak. -Those are `TeX-command', `LaTeX-command', `TeX-Omega-command', -`LaTeX-Omega-command', `ConTeXt-engine' and `ConTeXt-Omega-engine'. -The rest of the executables is defined directly in -`TeX-engine-alist-builtin'. If you want to override an entry from -that, add an entry to `TeX-engine-alist' that starts with the same -symbol as that the entry in the built-in list and specify the -executables you want to use instead. You can also add entries to -`TeX-engine-alist' in order to add support for engines not covered per -default. - - -- User Option: TeX-engine-alist - Alist of TeX engines and associated commands. Each entry is a - list with a maximum of five elements. The first element is a - symbol used to identify the engine. The second is a string - describing the engine. The third is the command to be used for - plain TeX. The fourth is the command to be used for LaTeX. The - fifth is the command to be used for the `--engine' parameter of - ConTeXt's `texexec' program. Each command can either be a - variable or a string. An empty string or nil means there is no - command available. - - You can customize AUCTeX to show the processor output as it is -produced. - - -- User Option: TeX-show-compilation - If non-nil, the output of TeX compilation is shown in another - window. - - -File: auctex.info, Node: Viewing, Next: Debugging, Prev: Commands, Up: Processing - -4.2 Viewing the Formatted Output -================================ - -AUCTeX allows you to start external programs for previewing the -formatted output of your document. - -* Menu: - -* Starting Viewers:: Starting viewers -* I/O Correlation:: Forward and inverse search - - -File: auctex.info, Node: Starting Viewers, Next: I/O Correlation, Up: Viewing - -4.2.1 Starting Viewers ----------------------- - -Viewers are normally invoked by pressing `C-c C-c' once the document is -formatted, which will propose the View command, or by activating the -respective entry in the Command menu. Alternatively you can type `C-c -C-v' which calls the function `TeX-view'. - - -- Command: TeX-view - (`C-c C-v') Start a viewer without confirmation. The viewer is - started either on a region or the master file, depending on the - last command issued. This is especially useful for jumping to the - location corresponding to point in the viewer when using - `TeX-source-correlate-mode'. - - AUCTeX will try to guess which type of viewer (DVI, PostScript or -PDF) has to be used and what options are to be passed over to it. This -decision is based on the output files present in the working directory -as well as the class and style options used in the document. For -example, if there is a DVI file in your working directory, a DVI viewer -will be invoked. In case of a PDF file it will be a PDF viewer. If -you specified a special paper format like `a5paper' or use the -`landscape' option, this will be passed to the viewer by the -appropriate options. Especially some DVI viewers depend on this kind -of information in order to display your document correctly. In case -you are using `pstricks' or `psfrag' in your document, a DVI viewer -cannot display the contents correctly and a PostScript viewer will be -invoked instead. - - The association between the tests for the conditions mentioned above -and the viewers is made in the variable `TeX-view-program-selection'. -Therefore this variable is the starting point for customization if you -want to use other viewers than the ones suggested by default. - - -- User Option: TeX-view-program-selection - This is a list of predicates and viewers which is evaluated from - front to back in order to find out which viewer to call under the - given conditions. In the first element of each list item you can - reference one or more predicates defined in - `TeX-view-predicate-list' or `TeX-view-predicate-list-builtin'. - In the second element you can reference a viewer defined in - `TeX-view-program-list' or `TeX-view-program-list-builtin'. The - viewer of the first item with a positively evaluated predicate is - selected. - - So `TeX-view-program-selection' only contains references to the -actual implementations of predicates and viewer commands respectively -which can be found elsewhere. AUCTeX comes with a set of preconfigured -predicates and viewer commands which are stored in the variables -`TeX-view-predicate-list-builtin' and `TeX-view-program-list-builtin' -respectively. If you are not satisfied with those and want to -overwrite one of them or add your own definitions, you can do so via -the variables `TeX-view-predicate-list' and `TeX-view-program-list'. - - -- User Option: TeX-view-predicate-list - This is a list of predicates for viewer selection and invocation. - The first element of each list item is a symbol and the second - element a Lisp form to be evaluated. The form should return nil - if the predicate is not fulfilled. - - A built-in predicate from `TeX-view-predicate-list-builtin' can be - overwritten by defining a new predicate with the same symbol. - - -- User Option: TeX-view-program-list - This is a list of viewer specifications each consisting of a - symbolic name and either a command line or a function to be - invoked when the viewer is called. If a command line is used, - parts of it can be conditionalized by prefixing them with - predicates from `TeX-view-predicate-list' or - `TeX-view-predicate-list-builtin'. (See the doc string for the - exact format to use.) The command line can also contain - placeholders as defined in `TeX-expand-list' which are expanded - before the viewer is called. - - A built-in viewer spec from `TeX-view-program-list-builtin' can be - overwritten by defining a new viewer spec with the same name. - - Note that the viewer selection and invocation as described above will -only work if certain default settings in AUCTeX are intact. For one, -the whole viewer selection machinery will only be triggered if the `%V' -expander in `TeX-expand-list' is unchanged. So if you have trouble -with the viewer invocation you might check if there is an older -customization of the variable in place. In addition, the use of a -function in `TeX-view-program-list' only works if the View command in -`TeX-command-list' makes use of the hook `TeX-run-discard-or-function'. - - Note also that the implementation described above replaces an older -one which was less flexible. This old implementation works with the -variables `TeX-output-view-style' and `TeX-view-style' which are used -to associate file types and style options with viewers. If desired you -can reactivate it by using the placeholder `%vv' for the View command -in `TeX-command-list'. Note however, that it is bound to be removed -from AUCTeX once the new implementation proved to be satisfactory. For -the time being, find a short description of the mentioned customization -options below. - - -- User Option: TeX-output-view-style - List of output file extensions, style options and view options. - Each item of the list consists of three elements. If the first - element (a regular expression) matches the output file extension, - and the second element (a regular expression) matches the name of - one of the style options, any occurrence of the string `%V' in a - command in `TeX-command-list' will be replaced with the third - element. - - -- User Option: TeX-view-style - List of style options and view options. This is the predecessor of - `TeX-output-view-style' which does not provide the possibility to - specify output file extensions. It is used as a fallback in case - none of the alternatives specified in `TeX-output-view-style' - match. In case none of the entries in `TeX-view-style' match - either, no suggestion for a viewer is made. - - -File: auctex.info, Node: I/O Correlation, Prev: Starting Viewers, Up: Viewing - -4.2.2 Forward and Inverse Search --------------------------------- - -Forward and inverse search refer to the correlation between the document -source in the editor and the typeset document in the viewer. Forward -search allows you to jump to the place in the previewed document -corresponding to a certain line in the document source and inverse -search vice versa. - - AUCTeX supports three methods for forward and inverse search: source -specials (only DVI output), the pdfsync LaTeX package (only PDF output) -and SyncTeX (any type of output). If you want to make use of forward -and inverse searching with source specials or SyncTeX, switch on -`TeX-source-correlate-mode'. *Note Processor Options::, on how to do -that. The use of the pdfsync package is detected automatically if -document parsing is enabled. - - Forward search happens automatically upon calling the viewer, e.g. by -typing `C-c C-v' (`TeX-view'). This will open the viewer or bring it -to front and display the output page corresponding to the position of -point in the source file. AUCTeX will automatically pass the necessary -command line options to the viewer for this to happen. - - Upon opening the viewer you will be asked if you want to start a -server process (Gnuserv or Emacs server) which is necessary for inverse -search. This happens only if there is no server running already. You -can customize the variable `TeX-source-correlate-start-server' to -inhibit the question and always or never start the server respectively. - - -- User Option: TeX-source-correlate-start-server - If `TeX-source-correlate-mode' is active and a viewer is invoked, - the default behavior is to ask if a server process should be - started. Set this variable to `t' if the question should be - inhibited and the server should always be started. Set it to - `nil' if the server should never be started. Inverse search will - not be available in the latter case. - - Inverse search, i.e. jumping to the part of your document source in -Emacs corresponding to a certain position in the viewer, is triggered -from the viewer, typically by a mouse click. Refer to the documentation -of your viewer to find out how it has to be configured and what you have -to do exactly. In xdvi you normally have to use `C-down-mouse-1'. - - -File: auctex.info, Node: Debugging, Next: Checking, Prev: Viewing, Up: Processing - -4.3 Catching the errors -======================= - -Once you've formatted your document you may `debug' it, i.e. browse -through the errors (La)TeX reported. - - -- Command: TeX-next-error - (`C-c `') Go to the next error reported by TeX. The view will be - split in two, with the cursor placed as close as possible to the - error in the top view. In the bottom view, the error message will - be displayed along with some explanatory text. - - Normally AUCTeX will only report real errors, but you may as well -ask it to report `bad boxes' and warnings as well. - - -- Command: TeX-toggle-debug-bad-boxes - (`C-c C-t C-b') Toggle whether AUCTeX should stop at bad boxes - (i.e. overfull and underfull boxes) as well as normal errors. - - -- Command: TeX-toggle-debug-warnings - (`C-c C-t C-w') Toggle whether AUCTeX should stop at warnings as - well as normal errors. - - As default, AUCTeX will display a special help buffer containing the -error reported by TeX along with the documentation. There is however -an `expert' option, which allows you to display the real TeX output. - - -- User Option: TeX-display-help - If t AUCTeX will automatically display a help text whenever an - error is encountered using `TeX-next-error' (`C-c `'). If nil a - terse information about the error is displayed in the echo area. - If `expert' AUCTeX will display the output buffer with the raw TeX - output. - - -File: auctex.info, Node: Checking, Next: Control, Prev: Debugging, Up: Processing - -4.4 Checking for problems -========================= - -Running TeX or LaTeX will only find regular errors in the document, not -examples of bad style. Furthermore, description of the errors may -often be confusing. The utility `lacheck' can be used to find style -errors, such as forgetting to escape the space after an abbreviation or -using `...' instead of `\ldots' and many other problems like that. You -start `lacheck' with `C-c C-c Check '. The result will be a list -of errors in the `*compilation*' buffer. You can go through the errors -with `C-x `' (`next-error', *note Compilation: (emacs)Compilation.), -which will move point to the location of the next error. - - Another newer program which can be used to find errors is `chktex'. -It is much more configurable than `lacheck', but doesn't find all the -problems `lacheck' does, at least in its default configuration. You -must install the programs before using them, and for `chktex' you may -also need modify `TeX-command-list' unless you use its `lacheck' -compatibility wrapper. You can get `lacheck' from -`' or -alternatively `chktex' from -`'. - - -File: auctex.info, Node: Control, Next: Cleaning, Prev: Checking, Up: Processing - -4.5 Controlling the output -========================== - -A number of commands are available for controlling the output of an -application running under AUCTeX - - -- Command: TeX-kill-job - (`C-c C-k') Kill currently running external application. This - may be either of TeX, LaTeX, previewer, BibTeX, etc. - - -- Command: TeX-recenter-output-buffer - (`C-c C-l') Recenter the output buffer so that the bottom line is - visible. - - -- Command: TeX-home-buffer - (`C-c ^') Go to the `master' file in the document associated with - the current buffer, or if already there, to the file where the - current process was started. - - -File: auctex.info, Node: Cleaning, Next: Documentation, Prev: Control, Up: Processing - -4.6 Cleaning intermediate and output files -========================================== - - -- Command: TeX-clean - Remove generated intermediate files. In case a prefix argument is - given, remove output files as well. - - Canonical access to the function is provided by the `Clean' and - `Clean All' entries in `TeX-command-list', invokable with `C-c - C-c' or the Command menu. - - The patterns governing which files to remove can be adapted - separately for each AUCTeX mode by means of the variables - `plain-TeX-clean-intermediate-suffixes', - `plain-TeX-clean-output-suffixes', - `LaTeX-clean-intermediate-suffixes', `LaTeX-clean-output-suffixes', - `docTeX-clean-intermediate-suffixes', - `docTeX-clean-output-suffixes', - `Texinfo-clean-intermediate-suffixes', - `Texinfo-clean-output-suffixes', - `ConTeXt-clean-intermediate-suffixes' and - `ConTeXt-clean-output-suffixes'. - - -- User Option: TeX-clean-confirm - Control if deletion of intermediate and output files has to be - confirmed before it is actually done. If non-nil, ask before - deleting files. - - -File: auctex.info, Node: Documentation, Prev: Cleaning, Up: Processing - -4.7 Documentation about macros and packages -=========================================== - - -- Command: TeX-doc - (`C-c ?') Get documentation about macros, packages or TeX & Co. - in general. The function will prompt for the name of a command or - manual, providing a list of available keywords for completion. If - point is on a command or word with available documentation, this - will be suggested as default. - - In case no documentation could be found, a prompt for querying the - `texdoc' program is shown, should the latter be available. - - The command can be invoked by the key binding mentioned above as - well as the `Find Documentation...' entry in the mode menu. - - -File: auctex.info, Node: Customization, Next: Appendices, Prev: Processing, Up: Top - -5 Customization and Extension -***************************** - -* Menu: - -* Modes and Hooks:: Modes and Hooks -* Multifile:: Multifile Documents -* Parsing Files:: Automatic Parsing of TeX Files -* Internationalization:: Language Support -* Automatic:: Automatic Customization -* Style Files:: Writing Your Own Style Support - - -File: auctex.info, Node: Modes and Hooks, Next: Multifile, Up: Customization - -5.1 Modes and Hooks -=================== - -AUCTeX supports a wide variety of derivatives and extensions of TeX. -Besides plain TeX those are LaTeX, AMS-TeX, ConTeXt, Texinfo and -docTeX. For each of them there is a separate major mode in AUCTeX and -each major mode runs `text-mode-hook', `TeX-mode-hook' as well as a -hook special to the mode in this order. The following table provides -an overview of the respective mode functions and hooks. - -Type Mode function Hook -------------------------------------------------------- -Plain TeX `plain-TeX-mode' `plain-TeX-mode-hook' -LaTeX `LaTeX-mode' `LaTeX-mode-hook' -AMS-TeX `ams-tex-mode' `AmS-TeX-mode-hook' -ConTeXt `ConTeXt-mode' `ConTeXt-mode-hook' -Texinfo `Texinfo-mode' `Texinfo-mode-hook' -DocTeX `docTeX-mode' `docTeX-mode-hook' - - If you need to make a customization via a hook which is only relevant -for one of the modes listed above, put it into the respective mode hook, -if it is relevant for any AUCTeX mode, add it to `TeX-mode-hook' and if -it is relevant for all text modes, append it to `text-mode-hook'. - - -File: auctex.info, Node: Multifile, Next: Parsing Files, Prev: Modes and Hooks, Up: Customization - -5.2 Multifile Documents -======================= - -You may wish to spread a document over many files (as you are likely to -do if there are multiple authors, or if you have not yet discovered the -power of the outline commands (*note Outline::)). This can be done by -having a "master" file in which you include the various files with the -TeX macro `\input' or the LaTeX macro `\include'. These files may also -include other files themselves. However, to format the document you -must run the commands on the top level master file. - - When you, for example, ask AUCTeX to run a command on the master -file, it has no way of knowing the name of the master file. By default, -it will assume that the current file is the master file. If you insert -the following in your `.emacs' file AUCTeX will use a more advanced -algorithm. - - (setq-default TeX-master nil) ; Query for master file. - - If AUCTeX finds the line indicating the end of the header in a master -file (`TeX-header-end'), it can figure out for itself that this is a -master file. Otherwise, it will ask for the name of the master file -associated with the buffer. To avoid asking you again, AUCTeX will -automatically insert the name of the master file as a file variable -(*note File Variables: (emacs)File Variables.). You can also insert -the file variable yourself, by putting the following text at the end of -your files. - - %%% Local Variables: - %%% TeX-master: "master" - %%% End: - - You should always set this variable to the name of the top level -document. If you always use the same name for your top level -documents, you can set `TeX-master' in your `.emacs' file. - - (setq-default TeX-master "master") ; All master files called "master". - - -- User Option: TeX-master - The master file associated with the current buffer. If the file - being edited is actually included from another file, then you can - tell AUCTeX the name of the master file by setting this variable. - If there are multiple levels of nesting, specify the top level - file. - - If this variable is `nil', AUCTeX will query you for the name. - - If the variable is `t', then AUCTeX will assume the file is a - master file itself. - - If the variable is `shared', then AUCTeX will query for the name, - but will not change the file. - - -- User Option: TeX-one-master - Regular expression matching ordinary TeX files. - - You should set this variable to match the name of all files, for - which it is a good idea to append a `TeX-master' file variable - entry automatically. When AUCTeX adds the name of the master file - as a file variable, it does not need to ask next time you edit the - file. - - If you dislike AUCTeX automatically modifying your files, you can - set this variable to `""'. By default, AUCTeX will modify - any file with an extension of `.tex'. - - -- Command: TeX-master-file-ask - (`C-c _') Query for the name of a master file and add the - respective File Variables (*note File Variables: (emacs)File - Variables.) to the file for setting this variable permanently. - - AUCTeX will not ask for a master file when it encounters existing - files. This function shall give you the possibility to insert the - variable manually. - - AUCTeX keeps track of macros, environments, labels, and style files -that are used in a given document. For this to work with multifile -documents, AUCTeX has to have a place to put the information about the -files in the document. This is done by having an `auto' subdirectory -placed in the directory where your document is located. Each time you -save a file, AUCTeX will write information about the file into the -`auto' directory. When you load a file, AUCTeX will read the -information in the `auto' directory about the file you loaded _and the -master file specified by `TeX-master'_. Since the master file (perhaps -indirectly) includes all other files in the document, AUCTeX will get -information from all files in the document. This means that you will -get from each file, for example, completion for all labels defined -anywhere in the document. - - AUCTeX will create the `auto' directory automatically if -`TeX-auto-save' is non-nil. Without it, the files in the document will -not know anything about each other, except for the name of the master -file. *Note Automatic Local::. - - -- Command: TeX-save-document - (`C-c C-d') Save all buffers known to belong to the current - document. - - -- User Option: TeX-save-query - If non-nil, then query the user before saving each file with - `TeX-save-document'. - - -File: auctex.info, Node: Parsing Files, Next: Internationalization, Prev: Multifile, Up: Customization - -5.3 Automatic Parsing of TeX Files -================================== - -AUCTeX depends heavily on being able to extract information from the -buffers by parsing them. Since parsing the buffer can be somewhat slow, -the parsing is initially disabled. You are encouraged to enable them by -adding the following lines to your `.emacs' file. - - (setq TeX-parse-self t) ; Enable parse on load. - (setq TeX-auto-save t) ; Enable parse on save. - - The latter command will make AUCTeX store the parsed information in -an `auto' subdirectory in the directory each time the TeX files are -stored, *note Automatic Local::. If AUCTeX finds the pre-parsed -information when loading a file, it will not need to reparse the buffer. -The information in the `auto' directory is also useful for multifile -documents, *note Multifile::, since it allows each file to access the -parsed information from all the other files in the document. This is -done by first reading the information from the master file, and then -recursively the information from each file stored in the master file. - - The variables can also be done on a per file basis, by changing the -file local variables. - - %%% Local Variables: - %%% TeX-parse-self: t - %%% TeX-auto-save: t - %%% End: - - Even when you have disabled the automatic parsing, you can force the -generation of style information by pressing `C-c C-n'. This is often -the best choice, as you will be able to decide when it is necessary to -reparse the file. - - -- User Option: TeX-parse-self - Parse file after loading it if no style hook is found for it. - - -- User Option: TeX-auto-save - Automatically save style information when saving the buffer. - - -- Command: TeX-normal-mode ARG - (`C-c C-n') Remove all information about this buffer, and apply the - style hooks again. Save buffer first including style information. - With optional argument, also reload the style hooks. - - When AUCTeX saves your buffer, it can optionally convert all tabs in -your buffer into spaces. Tabs confuse AUCTeX's error message parsing -and so should generally be avoided. However, tabs are significant in -some environments, and so by default AUCTeX does not remove them. To -convert tabs to spaces when saving a buffer, insert the following in -your `.emacs' file: - - (setq TeX-auto-untabify t) - - -- User Option: TeX-auto-untabify - Automatically remove all tabs from a file before saving it. - - Instead of disabling the parsing entirely, you can also speed it -significantly up by limiting the information it will search for (and -store) when parsing the buffer. You can do this by setting the default -values for the buffer local variables `TeX-auto-regexp-list' and -`TeX-auto-parse-length' in your `.emacs' file. - - ;; Only parse LaTeX class and package information. - (setq-default TeX-auto-regexp-list 'LaTeX-auto-minimal-regexp-list) - ;; The class and package information is usually near the beginning. - (setq-default TeX-auto-parse-length 2000) - - This example will speed the parsing up significantly, but AUCTeX -will no longer be able to provide completion for labels, macros, -environments, or bibitems specified in the document, nor will it know -what files belong to the document. - - These variables can also be specified on a per file basis, by -changing the file local variables. - - %%% Local Variables: - %%% TeX-auto-regexp-list: TeX-auto-full-regexp-list - %%% TeX-auto-parse-length: 999999 - %%% End: - - -- User Option: TeX-auto-regexp-list - List of regular expressions used for parsing the current file. - - -- User Option: TeX-auto-parse-length - Maximal length of TeX file that will be parsed. - - The pre-specified lists of regexps are defined below. You can use -these before loading AUCTeX by quoting them, as in the example above. - - -- Constant: TeX-auto-empty-regexp-list - Parse nothing - - -- Constant: LaTeX-auto-minimal-regexp-list - Only parse LaTeX class and packages. - - -- Constant: LaTeX-auto-label-regexp-list - Only parse LaTeX labels. - - -- Constant: LaTeX-auto-regexp-list - Parse common LaTeX commands. - - -- Constant: plain-TeX-auto-regexp-list - Parse common plain TeX commands. - - -- Constant: TeX-auto-full-regexp-list - Parse all TeX and LaTeX commands that AUCTeX can use. - - -File: auctex.info, Node: Internationalization, Next: Automatic, Prev: Parsing Files, Up: Customization - -5.4 Language Support -==================== - -TeX and Emacs are usable for European (Latin, Cyrillic, Greek) based -languages. Some LaTeX and EmacsLisp packages are available for easy -typesetting and editing documents in European languages. - - For CJK (Chinese, Japanese, and Korean) languages, Emacs or XEmacs -with MULE (MULtilingual Enhancement to GNU Emacs) support is required. -MULE is part of Emacs by default since Emacs 20. XEmacs has to be -configured with the `--with-mule' option. Special versions of TeX are -needed for CJK languages: CTeX and ChinaTeX for Chinese, ASCII pTeX and -NTT jTeX for Japanese, HLaTeX and kTeX for Korean. The CJK-LaTeX -package is required for supporting multiple CJK scripts within a single -document. - - Note that Unicode is not fully supported in Emacs 21 and XEmacs 21. -CJK characters are not usable. Please use the MULE-UCS EmacsLisp -package or Emacs 22 (not released yet) if you need CJK. - -* Menu: - -* European:: Using AUCTeX with European Languages -* Japanese:: Using AUCTeX with Japanese - - -File: auctex.info, Node: European, Next: Japanese, Up: Internationalization - -5.4.1 Using AUCTeX with European Languages ------------------------------------------- - -5.4.1.1 Typing and Displaying Non-ASCII Characters -.................................................. - -First you will need a way to write non-ASCII characters. You can either -use macros, or teach TeX about the ISO character sets. I prefer the -latter, it has the advantage that the usual standard emacs word -movement and case change commands will work. - - With LaTeX2e, just add `\usepackage[latin1]{inputenc}'. Other -languages than Western European ones will probably have other encoding -needs. - - To be able to display non-ASCII characters you will need an -appropriate font and a version of GNU Emacs capable of displaying 8-bit -characters (e.g. Emacs 21). The manner in which this is supported -differs between Emacsen, so you need to take a look at your respective -documentation. - - A compromise is to use an European character set when editing the -file, and convert to TeX macros when reading and writing the files. - -`iso-cvt.el' - Much like `iso-tex.el' but is bundled with Emacs 19.23 and later. - -`x-compose.el' - Similar package bundled with new versions of XEmacs. - -`X-Symbol' - a much more complete package for both Emacs and XEmacs that can - also handle a lot of mathematical characters and input methods. - -5.4.1.2 Style Files for Different Languages -........................................... - -AUCTeX supports style files for several languages. Each style file may -modify AUCTeX to better support the language, and will run a language -specific hook that will allow you to for example change ispell -dictionary, or run code to change the keyboard remapping. The -following will for example choose a Danish dictionary for documents -including `\usepackage[danish]{babel}'. This requires parsing to be -enabled, *note Parsing Files::. - - (add-hook 'TeX-language-dk-hook - (lambda () (ispell-change-dictionary "danish"))) - - The following style files are recognized: - -`bulgarian' - Runs style hook `TeX-language-bg-hook'. Gives `"' word syntax, - makes the <"> key insert a literal `"'. Typing <"> twice will - insert insert `"`' or `"'' depending on context. Typing <-> twice - will insert `"=', three times `--'. - -`czech' - Runs style hook `TeX-language-cz-hook'. Pressing <"> will insert - `\uv{' and `}' depending on context. - -`danish' - Runs style hook `TeX-language-dk-hook'. Pressing <"> will insert - `"`' and `"'' depending on context. Typing <-> twice will insert - `"=', i.e. a hyphen string allowing hyphenation in the composing - words. - -`dutch' - Runs style hook `TeX-language-nl-hook'. - -`german' -`ngerman' - Runs style hook `TeX-language-de-hook'. Gives `"' word syntax, - makes the <"> key insert a literal `"'. Pressing the key twice - will give you opening or closing German quotes (`"`' or `"''). - Typing <-> twice will insert `"=', three times `--'. - -`frenchb' -`francais' - Runs style hook `TeX-language-fr-hook'. Pressing <"> will insert - `\\og' and `\\fg' depending on context. Note that the language - name for customizing `TeX-quote-language-alist' is `french'. - -`icelandic' - Runs style hook `TeX-language-is-hook'. Gives `"' word syntax, - makes the <"> key insert a literal `"'. Typing <"> twice will - insert insert `"`' or `"'' depending on context. Typing <-> twice - will insert `"=', three times `--'. - -`italian' - Runs style hook `TeX-language-it-hook'. Pressing <"> will insert - `"<' and `">' depending on context. - -`polish' - Runs style hook `TeX-language-pl-hook'. Gives `"' word syntax and - makes the <"> key insert a literal `"'. Pressing <"> twice will - insert `"`' or `"'' depending on context. - -`polski' - Runs style hook `TeX-language-pl-hook'. Makes the <"> key insert - a literal `"'. Pressing <"> twice will insert `,,' or `''' - depending on context. - -`slovak' - Runs style hook `TeX-language-sk-hook'. Pressing <"> will insert - `\uv{' and `}' depending on context. - -`swedish' - Runs style hook `TeX-language-sv-hook'. Pressing <"> will insert - `'''. Typing <-> twice will insert `"=', three times `--'. - - Replacement of language-specific hyphen strings like `"=' with -dashes does not require to type <-> three times in a row. You can put -point after the hypen string anytime and trigger the replacement by -typing <->. - - In case you are not satisfied with the suggested behavior of quote -and hyphen insertion you can change it by customizing the variables -`TeX-quote-language-alist' and `LaTeX-babel-hyphen-language-alist' -respectively. - - -- User Option: TeX-quote-language-alist - Used for overriding the default language-specific quote insertion - behavior. This is an alist where each element is a list - consisting of four items. The first item is the name of the - language in concern as a string. See the list of supported - languages above. The second item is the opening quotation mark. - The third item is the closing quotation mark. Opening and closing - quotation marks can be specified directly as strings or as - functions returning a string. The fourth item is a boolean - controlling quote insertion. It should be non-nil if if the - special quotes should only be used after inserting a literal `"' - character first, i.e. on second key press. - - -- User Option: LaTeX-babel-hyphen-language-alist - Used for overriding the behavior of hyphen insertion for specific - languages. Every element in this alist is a list of three items. - The first item should specify the affected language as a string. - The second item denotes the hyphen string to be used as a string. - The third item, a boolean, controls the behavior of hyphen - insertion and should be non-nil if the special hyphen should be - inserted after inserting a literal `-' character, i.e. on second - key press. - - The defaults of hyphen insertion are defined by the variables -`LaTeX-babel-hyphen' and `LaTeX-babel-hyphen-after-hyphen' respectively. - - -- User Option: LaTeX-babel-hyphen - String to be used when typing <->. This usually is a hyphen - alternative or hyphenation aid provided by `babel' and the related - language style files, like `"=', `"~' or `"-'. - - Set it to an empty string or nil in order to disable - language-specific hyphen insertion. - - -- User Option: LaTeX-babel-hyphen-after-hyphen - Control insertion of hyphen strings. If non-nil insert normal - hyphen on first key press and swap it with the language-specific - hyphen string specified in the variable `LaTeX-babel-hyphen' on - second key press. If nil do it the other way round. - - -File: auctex.info, Node: Japanese, Prev: European, Up: Internationalization - -5.4.2 Using AUCTeX with Japanese TeX ------------------------------------- - -To write Japanese text with AUCTeX, you need to have versions of TeX -and Emacs that support Japanese. There exist at least two variants of -TeX for Japanese text (NTT jTeX and ASCII pTeX). AUCTeX can be used -with MULE (MULtilingual Enhancement to GNU Emacs) supported Emacsen. - - To use the Japanese TeX variants, simply activate -`japanese-plain-tex-mode' or `japanese-latex-mode' and everything -should work. If not, send mail to Masayuki Ataka -`', who kindly donated the code for -supporting Japanese in AUCTeX. None of the primary AUCTeX maintainers -understand Japanese, so they cannot help you. - - If you usually use AUCTeX in Japanese, setting the following -variables is useful. - - -- User Option: TeX-default-mode - Mode to enter for a new file when it cannott be determined whether - the file is plain TeX or LaTeX or what. - - If you want to enter Japanese LaTeX mode whenever this may happen, - set the variable like this: - (setq TeX-default-mode 'japanese-latex-mode) - - -- User Option: japanese-TeX-command-default - The default command for `TeX-command' in Japanese TeX mode. - - The default value is `"pTeX"'. - - -- User Option: japanese-LaTeX-command-default - The default command for `TeX-command' in Japanese LaTeX mode. - - The default value is `"LaTeX"'. - - -- User Option: japanese-LaTeX-default-style - The default style/class when creating a new Japanese LaTeX - document. - - The default value is `"jarticle"'. - - See `tex-jp.el' for more information. - - -File: auctex.info, Node: Automatic, Next: Style Files, Prev: Internationalization, Up: Customization - -5.5 Automatic Customization -=========================== - -Since AUCTeX is so highly customizable, it makes sense that it is able -to customize itself. The automatic customization consists of scanning -TeX files and extracting symbols, environments, and things like that. - - The automatic customization is done on three different levels. The -global level is the level shared by all users at your site, and consists -of scanning the standard TeX style files, and any extra styles added -locally for all users on the site. The private level deals with those -style files you have written for your own use, and use in different -documents. You may have a `~/lib/TeX/' directory where you store -useful style files for your own use. The local level is for a specific -directory, and deals with writing customization for the files for your -normal TeX documents. - - If compared with the environment variable `TEXINPUTS', the global -level corresponds to the directories built into TeX. The private level -corresponds to the directories you add yourself, except for `.', which -is the local level. - -* Menu: - -* Automatic Global:: Automatic Customization for the Site -* Automatic Private:: Automatic Customization for a User -* Automatic Local:: Automatic Customization for a Directory - - By default AUCTeX will search for customization files in all the -global, private, and local style directories, but you can also set the -path directly. This is useful if you for example want to add another -person's style hooks to your path. Please note that all matching files -found in `TeX-style-path' are loaded, and all hooks defined in the -files will be executed. - - -- User Option: TeX-style-path - List of directories to search for AUCTeX style files. Each must - end with a slash. - - By default, when AUCTeX searches a directory for files, it will -recursively search through subdirectories. - - -- User Option: TeX-file-recurse - Whether to search TeX directories recursively: nil means do not - recurse, a positive integer means go that far deep in the directory - hierarchy, t means recurse indefinitely. - - By default, AUCTeX will ignore files name `.', `..', `SCCS', `RCS', -and `CVS'. - - -- User Option: TeX-ignore-file - Regular expression matching file names to ignore. - - These files or directories will not be considered when searching - for TeX files in a directory. - - -File: auctex.info, Node: Automatic Global, Next: Automatic Private, Up: Automatic - -5.5.1 Automatic Customization for the Site ------------------------------------------- - -Assuming that the automatic customization at the global level was done -when AUCTeX was installed, your choice is now: will you use it? If you -use it, you will benefit by having access to all the symbols and -environments available for completion purposes. The drawback is slower -load time when you edit a new file and perhaps too many confusing -symbols when you try to do a completion. - - You can disable the automatic generated global style hooks by setting -the variable `TeX-auto-global' to nil. - - -- User Option: TeX-macro-global - Directories containing the site's TeX style files. - - -- User Option: TeX-style-global - Directory containing hand generated TeX information. Must end - with a slash. - - These correspond to TeX macros shared by all users of a site. - - -- User Option: TeX-auto-global - Directory containing automatically generated information. - - For storing automatic extracted information about the TeX macros - shared by all users of a site. - - -File: auctex.info, Node: Automatic Private, Next: Automatic Local, Prev: Automatic Global, Up: Automatic - -5.5.2 Automatic Customization for a User ----------------------------------------- - -You should specify where you store your private TeX macros, so AUCTeX -can extract their information. The extracted information will go to -the directories listed in `TeX-auto-private' - - Use `M-x TeX-auto-generate ' to extract the information. - - -- User Option: TeX-macro-private - Directories where you store your personal TeX macros. The value - defaults to the directories listed in the `TEXINPUTS' and - `BIBINPUTS' environment variables or to the respective directories - in `$TEXMFHOME' if no results can be obtained from the environment - variables. - - -- User Option: TeX-auto-private - List of directories containing automatically generated AUCTeX style - files. These correspond to the personal TeX macros. - - -- Command: TeX-auto-generate TEX AUTO - (`M-x TeX-auto-generate ') Generate style hook for TEX and - store it in AUTO. If TEX is a directory, generate style hooks for - all files in the directory. - - -- User Option: TeX-style-private - List of directories containing hand generated AUCTeX style files. - These correspond to the personal TeX macros. - - -File: auctex.info, Node: Automatic Local, Prev: Automatic Private, Up: Automatic - -5.5.3 Automatic Customization for a Directory ---------------------------------------------- - -AUCTeX can update the style information about a file each time you save -it, and it will do this if the directory `TeX-auto-local' exist. -`TeX-auto-local' is by default set to `"auto"', so simply creating an -`auto' directory will enable automatic saving of style information. - - The advantage of doing this is that macros, labels, etc. defined in -any file in a multifile document will be known in all the files in the -document. The disadvantage is that saving will be slower. To disable, -set `TeX-auto-local' to nil. - - -- User Option: TeX-style-local - Directory containing hand generated TeX information. Must end - with a slash. - - These correspond to TeX macros found in the current directory. - - -- User Option: TeX-auto-local - Directory containing automatically generated TeX information. - Must end with a slash. - - These correspond to TeX macros found in the current directory. - - -File: auctex.info, Node: Style Files, Prev: Automatic, Up: Customization - -5.6 Writing Your Own Style Support -================================== - -*Note Automatic::, for a discussion about automatically generated -global, private, and local style files. The hand generated style files -are equivalent, except that they by default are found in `style' -directories instead of `auto' directories. - -* Menu: - -* Simple Style:: A Simple Style File -* Adding Macros:: Adding Support for Macros -* Adding Environments:: Adding Support for Environments -* Adding Other:: Adding Other Information -* Hacking the Parser:: Automatic Extraction of New Things - - If you write some useful support for a public TeX style file, please -send it to us. - - -File: auctex.info, Node: Simple Style, Next: Adding Macros, Up: Style Files - -5.6.1 A Simple Style File -------------------------- - -Here is a simple example of a style file. - - ;;; book.el - Special code for book style. - - (TeX-add-style-hook - "book" - (lambda () - (LaTeX-largest-level-set "chapter"))) - - This file specifies that the largest kind of section in a LaTeX -document using the book document style is chapter. The interesting -thing to notice is that the style file defines an (anonymous) function, -and adds it to the list of loaded style hooks by calling -`TeX-add-style-hook'. - - The first time the user indirectly tries to access some style -specific information, such as the largest sectioning command available, -the style hooks for all files directly or indirectly read by the -current document is executed. The actual files will only be evaluated -once, but the hooks will be called for each buffer using the style file. - - -- Function: TeX-add-style-hook STYLE HOOK - Add HOOK to the list of functions to run when we use the TeX file - STYLE. - - -File: auctex.info, Node: Adding Macros, Next: Adding Environments, Prev: Simple Style, Up: Style Files - -5.6.2 Adding Support for Macros -------------------------------- - -The most common thing to define in a style hook is new symbols (TeX -macros). Most likely along with a description of the arguments to the -function, since the symbol itself can be defined automatically. - - Here are a few examples from `latex.el'. - - (TeX-add-style-hook - "latex" - (lambda () - (TeX-add-symbols - '("arabic" TeX-arg-counter) - '("label" TeX-arg-define-label) - '("ref" TeX-arg-label) - '("newcommand" TeX-arg-define-macro [ "Number of arguments" ] t) - '("newtheorem" TeX-arg-define-environment - [ TeX-arg-environment "Numbered like" ] - t [ TeX-arg-counter "Within counter" ])))) - - -- Function: TeX-add-symbols SYMBOL ... - Add each SYMBOL to the list of known symbols. - - Each argument to `TeX-add-symbols' is a list describing one symbol. -The head of the list is the name of the symbol, the remaining elements -describe each argument. - - If there are no additional elements, the symbol will be inserted with -point inside braces. Otherwise, each argument of this function should -match an argument of the TeX macro. What is done depends on the -argument type. - - If a macro is defined multiple times, AUCTeX will chose the one with -the longest definition (i.e. the one with the most arguments). - - Thus, to overwrite - '("tref" 1) ; one argument - you can specify - '("tref" TeX-arg-label ignore) ; two arguments - - `ignore' is a function that does not do anything, so when you insert -a `tref' you will be prompted for a label and no more. - - You can use the following types of specifiers for arguments: - -`string' - Use the string as a prompt to prompt for the argument. - -`number' - Insert that many braces, leave point inside the first. - -`nil' - Insert empty braces. - -`t' - Insert empty braces, leave point between the braces. - -`other symbols' - Call the symbol as a function. You can define your own hook, or - use one of the predefined argument hooks. - -`list' - If the car is a string, insert it as a prompt and the next element - as initial input. Otherwise, call the car of the list with the - remaining elements as arguments. - -`vector' - Optional argument. If it has more than one element, parse it as a - list, otherwise parse the only element as above. Use square - brackets instead of curly braces, and is not inserted on empty user - input. - - A lot of argument hooks have already been defined. The first -argument to all hooks is a flag indicating if it is an optional -argument. It is up to the hook to determine what to do with the -remaining arguments, if any. Typically the next argument is used to -overwrite the default prompt. - -`TeX-arg-conditional' - Implements if EXPR THEN ELSE. If EXPR evaluates to true, parse - THEN as an argument list, else parse ELSE as an argument list. - -`TeX-arg-literal' - Insert its arguments into the buffer. Used for specifying extra - syntax for a macro. - -`TeX-arg-free' - Parse its arguments but use no braces when they are inserted. - -`TeX-arg-eval' - Evaluate arguments and insert the result in the buffer. - -`TeX-arg-label' - Prompt for a label completing with known labels. - -`TeX-arg-macro' - Prompt for a TeX macro with completion. - -`TeX-arg-environment' - Prompt for a LaTeX environment with completion. - -`TeX-arg-cite' - Prompt for a BibTeX citation. - -`TeX-arg-counter' - Prompt for a LaTeX counter. - -`TeX-arg-savebox' - Prompt for a LaTeX savebox. - -`TeX-arg-file' - Prompt for a filename in the current directory, and use it without - the extension. - -`TeX-arg-input-file' - Prompt for the name of an input file in TeX's search path, and use - it without the extension. Run the style hooks for the file. - -`TeX-arg-define-label' - Prompt for a label completing with known labels. Add label to - list of defined labels. - -`TeX-arg-define-macro' - Prompt for a TeX macro with completion. Add macro to list of - defined macros. - -`TeX-arg-define-environment' - Prompt for a LaTeX environment with completion. Add environment to - list of defined environments. - -`TeX-arg-define-cite' - Prompt for a BibTeX citation. - -`TeX-arg-define-counter' - Prompt for a LaTeX counter. - -`TeX-arg-define-savebox' - Prompt for a LaTeX savebox. - -`TeX-arg-corner' - Prompt for a LaTeX side or corner position with completion. - -`TeX-arg-lr' - Prompt for a LaTeX side with completion. - -`TeX-arg-tb' - Prompt for a LaTeX side with completion. - -`TeX-arg-pagestyle' - Prompt for a LaTeX pagestyle with completion. - -`TeX-arg-verb' - Prompt for delimiter and text. - -`TeX-arg-pair' - Insert a pair of numbers, use arguments for prompt. The numbers are - surrounded by parentheses and separated with a comma. - -`TeX-arg-size' - Insert width and height as a pair. No arguments. - -`TeX-arg-coordinate' - Insert x and y coordinates as a pair. No arguments. - - If you add new hooks, you can assume that point is placed directly -after the previous argument, or after the macro name if this is the -first argument. Please leave point located after the argument you are -inserting. If you want point to be located somewhere else after all -hooks have been processed, set the value of `exit-mark'. It will point -nowhere, until the argument hook sets it. - - -File: auctex.info, Node: Adding Environments, Next: Adding Other, Prev: Adding Macros, Up: Style Files - -5.6.3 Adding Support for Environments -------------------------------------- - -Adding support for environments is very much like adding support for -TeX macros, except that each environment normally only takes one -argument, an environment hook. The example is again a short version of -`latex.el'. - - (TeX-add-style-hook - "latex" - (lambda () - (LaTeX-add-environments - '("document" LaTeX-env-document) - '("enumerate" LaTeX-env-item) - '("itemize" LaTeX-env-item) - '("list" LaTeX-env-list)))) - - It is completely up to the environment hook to insert the -environment, but the function `LaTeX-insert-environment' may be of some -help. The hook will be called with the name of the environment as its -first argument, and extra arguments can be provided by adding them to a -list after the hook. - - For simple environments with arguments, for example defined with -`\newenvironment', you can make AUCTeX prompt for the arguments by -giving the prompt strings in the call to `LaTeX-add-environments'. The -fact that an argument is optional can be indicated by wrapping the -prompt string in a vector. - - For example, if you have defined a `loop' environment with the three -arguments FROM, TO, and STEP, you can add support for them in a style -file. - - %% loop.sty - - \newenvironment{loop}[3]{...}{...} - - ;; loop.el - - (TeX-add-style-hook - "loop" - (lambda () - (LaTeX-add-environments - '("loop" "From" "To" "Step")))) - - If an environment is defined multiple times, AUCTeX will choose the -one with the longest definition. Thus, if you have an enumerate style -file, and want it to replace the standard LaTeX enumerate hook above, -you could define an `enumerate.el' file as follows, and place it in the -appropriate style directory. - - (TeX-add-style-hook - "latex" - (lambda () - (LaTeX-add-environments - '("enumerate" LaTeX-env-enumerate foo)))) - - (defun LaTeX-env-enumerate (environment &optional ignore) ...) - - The symbol `foo' will be passed to `LaTeX-env-enumerate' as the -second argument, but since we only added it to overwrite the definition -in `latex.el' it is just ignored. - - -- Function: LaTeX-add-environments ENV ... - Add each ENV to list of loaded environments. - - -- Function: LaTeX-insert-environment ENV [ EXTRA ] - Insert environment of type ENV, with optional argument EXTRA. - - Following is a list of available hooks for `LaTeX-add-environments': - -`LaTeX-env-item' - Insert the given environment and the first item. - -`LaTeX-env-figure' - Insert the given figure-like environment with a caption and a - label. - -`LaTeX-env-array' - Insert the given array-like environment with position and column - specifications. - -`LaTeX-env-label' - Insert the given environment with a label. - -`LaTeX-env-list' - Insert the given list-like environment, a specifier for the label - and the first item. - -`LaTeX-env-minipage' - Insert the given minipage-like environment with position and width - specifications. - -`LaTeX-env-tabular*' - Insert the given tabular*-like environment with width, position and - column specifications. - -`LaTeX-env-picture' - Insert the given environment with width and height specifications. - -`LaTeX-env-bib' - Insert the given environment with a label for a bibitem. - -`LaTeX-env-contents' - Insert the given environment with a filename as its argument. - -`LaTeX-env-args' - Insert the given environment with arguments. You can use this as - a hook in case you want to specify multiple complex arguments just - like in elements of `TeX-add-symbols'. This is most useful if the - specification of arguments to be prompted for with strings and - strings wrapped in a vector as described above is too limited. - - Here is an example from `listings.el' which calls a function with - one argument in order to prompt for a key=value list to be - inserted as an optional argument of the `lstlisting' environment: - - (LaTeX-add-environments - `("lstlisting" LaTeX-env-args - [TeX-arg-key-val ,LaTeX-listings-key-val-options])) - - -File: auctex.info, Node: Adding Other, Next: Hacking the Parser, Prev: Adding Environments, Up: Style Files - -5.6.4 Adding Other Information ------------------------------- - -You can also specify bibliographical databases and labels in the style -file. This is probably of little use, since this information will -usually be automatically generated from the TeX file anyway. - - -- Function: LaTeX-add-bibliographies BIBLIOGRAPHY ... - Add each BIBLIOGRAPHY to list of loaded bibliographies. - - -- Function: LaTeX-add-labels LABEL ... - Add each LABEL to the list of known labels. - - -File: auctex.info, Node: Hacking the Parser, Prev: Adding Other, Up: Style Files - -5.6.5 Automatic Extraction of New Things ----------------------------------------- - -The automatic TeX information extractor works by searching for regular -expressions in the TeX files, and storing the matched information. You -can add support for new constructs to the parser, something that is -needed when you add new commands to define symbols. - - For example, in the file `macro.tex' I define the following macro. - - \newcommand{\newmacro}[5]{% - \def#1{#3\index{#4@#5~cite{#4}}\nocite{#4}}% - \def#2{#5\index{#4@#5~cite{#4}}\nocite{#4}}% - } - - AUCTeX will automatically figure out that `newmacro' is a macro that -takes five arguments. However, it is not smart enough to automatically -see that each time we use the macro, two new macros are defined. We -can specify this information in a style hook file. - - ;;; macro.el --- Special code for my own macro file. - - ;;; Code: - - (defvar TeX-newmacro-regexp - '("\\\\newmacro{\\\\\\([a-zA-Z]+\\)}{\\\\\\([a-zA-Z]+\\)}" - (1 2) TeX-auto-multi) - "Matches \newmacro definitions.") - - (defvar TeX-auto-multi nil - "Temporary for parsing \\newmacro definitions.") - - (defun TeX-macro-cleanup () - "Move symbols from `TeX-auto-multi' to `TeX-auto-symbol'." - (mapcar (lambda (list) - (mapcar (lambda (symbol) - (setq TeX-auto-symbol - (cons symbol TeX-auto-symbol))) - list)) - TeX-auto-multi)) - - (defun TeX-macro-prepare () - "Clear `Tex-auto-multi' before use." - (setq TeX-auto-multi nil)) - - (add-hook 'TeX-auto-prepare-hook 'TeX-macro-prepare) - (add-hook 'TeX-auto-cleanup-hook 'TeX-macro-cleanup) - - (TeX-add-style-hook - "macro" - (lambda () - (TeX-auto-add-regexp TeX-newmacro-regexp) - (TeX-add-symbols '("newmacro" - TeX-arg-macro - (TeX-arg-macro "Capitalized macro: \\") - t - "BibTeX entry: " - nil)))) - - ;;; macro.el ends here - - When this file is first loaded, it adds a new entry to -`TeX-newmacro-regexp', and defines a function to be called before the -parsing starts, and one to be called after the parsing is done. It -also declares a variable to contain the data collected during parsing. -Finally, it adds a style hook which describes the `newmacro' macro, as -we have seen it before. - - So the general strategy is: Add a new entry to `TeX-newmacro-regexp'. -Declare a variable to contain intermediate data during parsing. Add -hook to be called before and after parsing. In this case, the hook -before parsing just initializes the variable, and the hook after parsing -collects the data from the variable, and adds them to the list of -symbols found. - - -- Variable: TeX-auto-regexp-list - List of regular expressions matching TeX macro definitions. - - The list has the following format ((REGEXP MATCH TABLE) ...), that - is, each entry is a list with three elements. - - REGEXP. Regular expression matching the macro we want to parse. - - MATCH. A number or list of numbers, each representing one - parenthesized subexpression matched by REGEXP. - - TABLE. The symbol table to store the data. This can be a - function, in which case the function is called with the argument - MATCH. Use `TeX-match-buffer' to get match data. If it is not a - function, it is presumed to be the name of a variable containing a - list of match data. The matched data (a string if MATCH is a - number, a list of strings if MATCH is a list of numbers) is put in - front of the table. - - -- Variable: TeX-auto-prepare-hook nil - List of functions to be called before parsing a TeX file. - - -- Variable: TeX-auto-cleanup-hook nil - List of functions to be called after parsing a TeX file. - - -File: auctex.info, Node: Appendices, Next: Indices, Prev: Customization, Up: Top - -Appendix A Copying, Changes, Development, FAQ -********************************************* - -* Menu: - -* Copying this Manual:: -* Changes:: -* Development:: -* FAQ:: - - -File: auctex.info, Node: Copying this Manual, Next: Changes, Up: Appendices - -A.1 Copying this Manual -======================= - -The copyright notice for this manual is: - - This manual is for AUCTeX (version 11.86 from 2010-02-21), a -sophisticated TeX environment for Emacs. - - Copyright (C) 1992, 1993, 1994, 1995, 2001, 2002, 2004, 2005, 2006, -2007, 2008, 2009, 2010 Free Software Foundation, Inc. - - Permission is granted to copy, distribute and/or modify this - document under the terms of the GNU Free Documentation License, - Version 1.3 or any later version published by the Free Software - Foundation; with no Invariant Sections, no Front-Cover Texts and - no Back-Cover Texts. A copy of the license is included in the - section entitled "GNU Free Documentation License." - -The full license text can be read here: - -* Menu: - -* GNU Free Documentation License:: License for copying this manual. - - -File: auctex.info, Node: GNU Free Documentation License, Up: Copying this Manual - -A.1.1 GNU Free Documentation License ------------------------------------- - - Version 1.3, 3 November 2008 - - Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software - Foundation, Inc. `http://fsf.org/' - - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - 0. PREAMBLE - - The purpose of this License is to make a manual, textbook, or other - functional and useful document "free" in the sense of freedom: to - assure everyone the effective freedom to copy and redistribute it, - with or without modifying it, either commercially or - noncommercially. Secondarily, this License preserves for the - author and publisher a way to get credit for their work, while not - being considered responsible for modifications made by others. - - This License is a kind of "copyleft", which means that derivative - works of the document must themselves be free in the same sense. - It complements the GNU General Public License, which is a copyleft - license designed for free software. - - We have designed this License in order to use it for manuals for - free software, because free software needs free documentation: a - free program should come with manuals providing the same freedoms - that the software does. But this License is not limited to - software manuals; it can be used for any textual work, regardless - of subject matter or whether it is published as a printed book. - We recommend this License principally for works whose purpose is - instruction or reference. - - 1. APPLICABILITY AND DEFINITIONS - - This License applies to any manual or other work, in any medium, - that contains a notice placed by the copyright holder saying it - can be distributed under the terms of this License. Such a notice - grants a world-wide, royalty-free license, unlimited in duration, - to use that work under the conditions stated herein. The - "Document", below, refers to any such manual or work. Any member - of the public is a licensee, and is addressed as "you". You - accept the license if you copy, modify or distribute the work in a - way requiring permission under copyright law. - - A "Modified Version" of the Document means any work containing the - Document or a portion of it, either copied verbatim, or with - modifications and/or translated into another language. - - A "Secondary Section" is a named appendix or a front-matter section - of the Document that deals exclusively with the relationship of the - publishers or authors of the Document to the Document's overall - subject (or to related matters) and contains nothing that could - fall directly within that overall subject. (Thus, if the Document - is in part a textbook of mathematics, a Secondary Section may not - explain any mathematics.) The relationship could be a matter of - historical connection with the subject or with related matters, or - of legal, commercial, philosophical, ethical or political position - regarding them. - - The "Invariant Sections" are certain Secondary Sections whose - titles are designated, as being those of Invariant Sections, in - the notice that says that the Document is released under this - License. If a section does not fit the above definition of - Secondary then it is not allowed to be designated as Invariant. - The Document may contain zero Invariant Sections. If the Document - does not identify any Invariant Sections then there are none. - - The "Cover Texts" are certain short passages of text that are - listed, as Front-Cover Texts or Back-Cover Texts, in the notice - that says that the Document is released under this License. A - Front-Cover Text may be at most 5 words, and a Back-Cover Text may - be at most 25 words. - - A "Transparent" copy of the Document means a machine-readable copy, - represented in a format whose specification is available to the - general public, that is suitable for revising the document - straightforwardly with generic text editors or (for images - composed of pixels) generic paint programs or (for drawings) some - widely available drawing editor, and that is suitable for input to - text formatters or for automatic translation to a variety of - formats suitable for input to text formatters. A copy made in an - otherwise Transparent file format whose markup, or absence of - markup, has been arranged to thwart or discourage subsequent - modification by readers is not Transparent. An image format is - not Transparent if used for any substantial amount of text. A - copy that is not "Transparent" is called "Opaque". - - Examples of suitable formats for Transparent copies include plain - ASCII without markup, Texinfo input format, LaTeX input format, - SGML or XML using a publicly available DTD, and - standard-conforming simple HTML, PostScript or PDF designed for - human modification. Examples of transparent image formats include - PNG, XCF and JPG. Opaque formats include proprietary formats that - can be read and edited only by proprietary word processors, SGML or - XML for which the DTD and/or processing tools are not generally - available, and the machine-generated HTML, PostScript or PDF - produced by some word processors for output purposes only. - - The "Title Page" means, for a printed book, the title page itself, - plus such following pages as are needed to hold, legibly, the - material this License requires to appear in the title page. For - works in formats which do not have any title page as such, "Title - Page" means the text near the most prominent appearance of the - work's title, preceding the beginning of the body of the text. - - The "publisher" means any person or entity that distributes copies - of the Document to the public. - - A section "Entitled XYZ" means a named subunit of the Document - whose title either is precisely XYZ or contains XYZ in parentheses - following text that translates XYZ in another language. (Here XYZ - stands for a specific section name mentioned below, such as - "Acknowledgements", "Dedications", "Endorsements", or "History".) - To "Preserve the Title" of such a section when you modify the - Document means that it remains a section "Entitled XYZ" according - to this definition. - - The Document may include Warranty Disclaimers next to the notice - which states that this License applies to the Document. These - Warranty Disclaimers are considered to be included by reference in - this License, but only as regards disclaiming warranties: any other - implication that these Warranty Disclaimers may have is void and - has no effect on the meaning of this License. - - 2. VERBATIM COPYING - - You may copy and distribute the Document in any medium, either - commercially or noncommercially, provided that this License, the - copyright notices, and the license notice saying this License - applies to the Document are reproduced in all copies, and that you - add no other conditions whatsoever to those of this License. You - may not use technical measures to obstruct or control the reading - or further copying of the copies you make or distribute. However, - you may accept compensation in exchange for copies. If you - distribute a large enough number of copies you must also follow - the conditions in section 3. - - You may also lend copies, under the same conditions stated above, - and you may publicly display copies. - - 3. COPYING IN QUANTITY - - If you publish printed copies (or copies in media that commonly - have printed covers) of the Document, numbering more than 100, and - the Document's license notice requires Cover Texts, you must - enclose the copies in covers that carry, clearly and legibly, all - these Cover Texts: Front-Cover Texts on the front cover, and - Back-Cover Texts on the back cover. Both covers must also clearly - and legibly identify you as the publisher of these copies. The - front cover must present the full title with all words of the - title equally prominent and visible. You may add other material - on the covers in addition. Copying with changes limited to the - covers, as long as they preserve the title of the Document and - satisfy these conditions, can be treated as verbatim copying in - other respects. - - If the required texts for either cover are too voluminous to fit - legibly, you should put the first ones listed (as many as fit - reasonably) on the actual cover, and continue the rest onto - adjacent pages. - - If you publish or distribute Opaque copies of the Document - numbering more than 100, you must either include a - machine-readable Transparent copy along with each Opaque copy, or - state in or with each Opaque copy a computer-network location from - which the general network-using public has access to download - using public-standard network protocols a complete Transparent - copy of the Document, free of added material. If you use the - latter option, you must take reasonably prudent steps, when you - begin distribution of Opaque copies in quantity, to ensure that - this Transparent copy will remain thus accessible at the stated - location until at least one year after the last time you - distribute an Opaque copy (directly or through your agents or - retailers) of that edition to the public. - - It is requested, but not required, that you contact the authors of - the Document well before redistributing any large number of - copies, to give them a chance to provide you with an updated - version of the Document. - - 4. MODIFICATIONS - - You may copy and distribute a Modified Version of the Document - under the conditions of sections 2 and 3 above, provided that you - release the Modified Version under precisely this License, with - the Modified Version filling the role of the Document, thus - licensing distribution and modification of the Modified Version to - whoever possesses a copy of it. In addition, you must do these - things in the Modified Version: - - A. Use in the Title Page (and on the covers, if any) a title - distinct from that of the Document, and from those of - previous versions (which should, if there were any, be listed - in the History section of the Document). You may use the - same title as a previous version if the original publisher of - that version gives permission. - - B. List on the Title Page, as authors, one or more persons or - entities responsible for authorship of the modifications in - the Modified Version, together with at least five of the - principal authors of the Document (all of its principal - authors, if it has fewer than five), unless they release you - from this requirement. - - C. State on the Title page the name of the publisher of the - Modified Version, as the publisher. - - D. Preserve all the copyright notices of the Document. - - E. Add an appropriate copyright notice for your modifications - adjacent to the other copyright notices. - - F. Include, immediately after the copyright notices, a license - notice giving the public permission to use the Modified - Version under the terms of this License, in the form shown in - the Addendum below. - - G. Preserve in that license notice the full lists of Invariant - Sections and required Cover Texts given in the Document's - license notice. - - H. Include an unaltered copy of this License. - - I. Preserve the section Entitled "History", Preserve its Title, - and add to it an item stating at least the title, year, new - authors, and publisher of the Modified Version as given on - the Title Page. If there is no section Entitled "History" in - the Document, create one stating the title, year, authors, - and publisher of the Document as given on its Title Page, - then add an item describing the Modified Version as stated in - the previous sentence. - - J. Preserve the network location, if any, given in the Document - for public access to a Transparent copy of the Document, and - likewise the network locations given in the Document for - previous versions it was based on. These may be placed in - the "History" section. You may omit a network location for a - work that was published at least four years before the - Document itself, or if the original publisher of the version - it refers to gives permission. - - K. For any section Entitled "Acknowledgements" or "Dedications", - Preserve the Title of the section, and preserve in the - section all the substance and tone of each of the contributor - acknowledgements and/or dedications given therein. - - L. Preserve all the Invariant Sections of the Document, - unaltered in their text and in their titles. Section numbers - or the equivalent are not considered part of the section - titles. - - M. Delete any section Entitled "Endorsements". Such a section - may not be included in the Modified Version. - - N. Do not retitle any existing section to be Entitled - "Endorsements" or to conflict in title with any Invariant - Section. - - O. Preserve any Warranty Disclaimers. - - If the Modified Version includes new front-matter sections or - appendices that qualify as Secondary Sections and contain no - material copied from the Document, you may at your option - designate some or all of these sections as invariant. To do this, - add their titles to the list of Invariant Sections in the Modified - Version's license notice. These titles must be distinct from any - other section titles. - - You may add a section Entitled "Endorsements", provided it contains - nothing but endorsements of your Modified Version by various - parties--for example, statements of peer review or that the text - has been approved by an organization as the authoritative - definition of a standard. - - You may add a passage of up to five words as a Front-Cover Text, - and a passage of up to 25 words as a Back-Cover Text, to the end - of the list of Cover Texts in the Modified Version. Only one - passage of Front-Cover Text and one of Back-Cover Text may be - added by (or through arrangements made by) any one entity. If the - Document already includes a cover text for the same cover, - previously added by you or by arrangement made by the same entity - you are acting on behalf of, you may not add another; but you may - replace the old one, on explicit permission from the previous - publisher that added the old one. - - The author(s) and publisher(s) of the Document do not by this - License give permission to use their names for publicity for or to - assert or imply endorsement of any Modified Version. - - 5. COMBINING DOCUMENTS - - You may combine the Document with other documents released under - this License, under the terms defined in section 4 above for - modified versions, provided that you include in the combination - all of the Invariant Sections of all of the original documents, - unmodified, and list them all as Invariant Sections of your - combined work in its license notice, and that you preserve all - their Warranty Disclaimers. - - The combined work need only contain one copy of this License, and - multiple identical Invariant Sections may be replaced with a single - copy. If there are multiple Invariant Sections with the same name - but different contents, make the title of each such section unique - by adding at the end of it, in parentheses, the name of the - original author or publisher of that section if known, or else a - unique number. Make the same adjustment to the section titles in - the list of Invariant Sections in the license notice of the - combined work. - - In the combination, you must combine any sections Entitled - "History" in the various original documents, forming one section - Entitled "History"; likewise combine any sections Entitled - "Acknowledgements", and any sections Entitled "Dedications". You - must delete all sections Entitled "Endorsements." - - 6. COLLECTIONS OF DOCUMENTS - - You may make a collection consisting of the Document and other - documents released under this License, and replace the individual - copies of this License in the various documents with a single copy - that is included in the collection, provided that you follow the - rules of this License for verbatim copying of each of the - documents in all other respects. - - You may extract a single document from such a collection, and - distribute it individually under this License, provided you insert - a copy of this License into the extracted document, and follow - this License in all other respects regarding verbatim copying of - that document. - - 7. AGGREGATION WITH INDEPENDENT WORKS - - A compilation of the Document or its derivatives with other - separate and independent documents or works, in or on a volume of - a storage or distribution medium, is called an "aggregate" if the - copyright resulting from the compilation is not used to limit the - legal rights of the compilation's users beyond what the individual - works permit. When the Document is included in an aggregate, this - License does not apply to the other works in the aggregate which - are not themselves derivative works of the Document. - - If the Cover Text requirement of section 3 is applicable to these - copies of the Document, then if the Document is less than one half - of the entire aggregate, the Document's Cover Texts may be placed - on covers that bracket the Document within the aggregate, or the - electronic equivalent of covers if the Document is in electronic - form. Otherwise they must appear on printed covers that bracket - the whole aggregate. - - 8. TRANSLATION - - Translation is considered a kind of modification, so you may - distribute translations of the Document under the terms of section - 4. Replacing Invariant Sections with translations requires special - permission from their copyright holders, but you may include - translations of some or all Invariant Sections in addition to the - original versions of these Invariant Sections. You may include a - translation of this License, and all the license notices in the - Document, and any Warranty Disclaimers, provided that you also - include the original English version of this License and the - original versions of those notices and disclaimers. In case of a - disagreement between the translation and the original version of - this License or a notice or disclaimer, the original version will - prevail. - - If a section in the Document is Entitled "Acknowledgements", - "Dedications", or "History", the requirement (section 4) to - Preserve its Title (section 1) will typically require changing the - actual title. - - 9. TERMINATION - - You may not copy, modify, sublicense, or distribute the Document - except as expressly provided under this License. Any attempt - otherwise to copy, modify, sublicense, or distribute it is void, - and will automatically terminate your rights under this License. - - However, if you cease all violation of this License, then your - license from a particular copyright holder is reinstated (a) - provisionally, unless and until the copyright holder explicitly - and finally terminates your license, and (b) permanently, if the - copyright holder fails to notify you of the violation by some - reasonable means prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is - reinstated permanently if the copyright holder notifies you of the - violation by some reasonable means, this is the first time you have - received notice of violation of this License (for any work) from - that copyright holder, and you cure the violation prior to 30 days - after your receipt of the notice. - - Termination of your rights under this section does not terminate - the licenses of parties who have received copies or rights from - you under this License. If your rights have been terminated and - not permanently reinstated, receipt of a copy of some or all of - the same material does not give you any rights to use it. - - 10. FUTURE REVISIONS OF THIS LICENSE - - The Free Software Foundation may publish new, revised versions of - the GNU Free Documentation License from time to time. Such new - versions will be similar in spirit to the present version, but may - differ in detail to address new problems or concerns. See - `http://www.gnu.org/copyleft/'. - - Each version of the License is given a distinguishing version - number. If the Document specifies that a particular numbered - version of this License "or any later version" applies to it, you - have the option of following the terms and conditions either of - that specified version or of any later version that has been - published (not as a draft) by the Free Software Foundation. If - the Document does not specify a version number of this License, - you may choose any version ever published (not as a draft) by the - Free Software Foundation. If the Document specifies that a proxy - can decide which future versions of this License can be used, that - proxy's public statement of acceptance of a version permanently - authorizes you to choose that version for the Document. - - 11. RELICENSING - - "Massive Multiauthor Collaboration Site" (or "MMC Site") means any - World Wide Web server that publishes copyrightable works and also - provides prominent facilities for anybody to edit those works. A - public wiki that anybody can edit is an example of such a server. - A "Massive Multiauthor Collaboration" (or "MMC") contained in the - site means any set of copyrightable works thus published on the MMC - site. - - "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 - license published by Creative Commons Corporation, a not-for-profit - corporation with a principal place of business in San Francisco, - California, as well as future copyleft versions of that license - published by that same organization. - - "Incorporate" means to publish or republish a Document, in whole or - in part, as part of another Document. - - An MMC is "eligible for relicensing" if it is licensed under this - License, and if all works that were first published under this - License somewhere other than this MMC, and subsequently - incorporated in whole or in part into the MMC, (1) had no cover - texts or invariant sections, and (2) were thus incorporated prior - to November 1, 2008. - - The operator of an MMC Site may republish an MMC contained in the - site under CC-BY-SA on the same site at any time before August 1, - 2009, provided the MMC is eligible for relicensing. - - -ADDENDUM: How to use this License for your documents ----------------------------------------------------- - -To use this License in a document you have written, include a copy of -the License in the document and put the following copyright and license -notices just after the title page: - - Copyright (C) YEAR YOUR NAME. - Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU Free Documentation License, Version 1.3 - or any later version published by the Free Software Foundation; - with no Invariant Sections, no Front-Cover Texts, and no Back-Cover - Texts. A copy of the license is included in the section entitled ``GNU - Free Documentation License''. - - If you have Invariant Sections, Front-Cover Texts and Back-Cover -Texts, replace the "with...Texts." line with this: - - with the Invariant Sections being LIST THEIR TITLES, with - the Front-Cover Texts being LIST, and with the Back-Cover Texts - being LIST. - - If you have Invariant Sections without Cover Texts, or some other -combination of the three, merge those two alternatives to suit the -situation. - - If your document contains nontrivial examples of program code, we -recommend releasing these examples in parallel under your choice of -free software license, such as the GNU General Public License, to -permit their use in free software. - - -File: auctex.info, Node: Changes, Next: Development, Prev: Copying this Manual, Up: Appendices - -A.2 Changes and New Features -============================ - -News in 11.86 -------------- - - * Parsing of LaTeX output was improved. It is now less likely that - AUCTeX opens a non-existent file upon calling `TeX-next-error'; a - problem for example encountered when using MiKTeX 2.8. In addition - quoted file names as emitted by MiKTeX are now supported. - - * A new framework for the definition and selection of viewers was - implemented. If you have customizations regarding viewers you - will have to redo them in this new framework or reenable the old - one. *Note Starting Viewers::, for details. - - * Comprehensive editing support for PSTricks was added. - - * Support for various LaTeX packages was added, e.g. `tabularx', - `CJK', and `hyperref'. - - * An easy way to switch between TeX engines (PDFTeX, LuaTeX, XeTeX, - Omega) was added. - - * Support for SyncTeX was added. This involves the command line - options for LaTeX and the viewer. - - * Folding can now be customized to use macro arguments as replacement - text. - - * `preview.sty' now works with XeTeX. - - * A lot of smaller and larger bugs have been squashed. - -News in 11.85 -------------- - - * Font locking has been improved significantly. It is now less - prone to color bleeding which could lead to high resource usage. - In addition it now includes information about LaTeX macro syntax - and can indicate syntactically incorrect macros in LaTeX mode. - - * The license was updated to GPLv3. - - * Support for the nomencl, flashcards and comment LaTeX packages as - well as the Icelandic language option of babel were added. - - * Support for folding of math macros was added. - - * Lots of minor bugs in features and documentation fixed. - -News in 11.84 -------------- - - * There have been problems with the `-without-texmf-dir' option to - `configure' when the value of `-with-kpathsea-sep' was set or - determined for an installation system with a default different - from that of the runtime system. `with-kpathsea-sep' has been - removed; the setting is now usually determined at runtime. - - Due to this and other problems, preview-latex in the released - XEmacs package failed under Windows or with anything except recent - 21.5 XEmacsen. - - * AUCTeX and preview-latex have been changed in order to accommodate - file names containing spaces. preview-latex now tolerates bad - PostScript code polluting the stack (like some Omega fonts). - - * `preview.sty' had in some cases failed to emit PostScript header - specials. - - * Support for folding of comments was added. - - * The `polish' language option of the babel LaTeX package as well as - the polski LaTeX package are now supported. Most notably this - means that AUCTeX will help to insert quotation marks as defined - by polish.sty (`"`..."'') and polski.sty (`,,...'''). - - * The TeX tool bar is now available and enabled by default in plain - TeX mode. *Note Processing Facilities::. - - * Bug fix in the display of math subscripts and superscripts. - - * Bug fix `TeX-doc' for Emacs 21. - - * There has been quite a number of other bug fixes to various - features and documentation across the board. - - -News in 11.83 -------------- - - * The new function `TeX-doc' provides easy access to documentation - about commands and packages or information related to TeX and - friends in general. *Note Documentation::. - - * You can now get rid of generated intermediate and output files by - means of the new `Clean' and `Clean All' entries in - `TeX-command-list' accessible with `C-c C-c' or the Command menu. - *Note Cleaning::. - - * Support for forward search with PDF files was added. That means - you can jump to a place in the output file corresponding to the - position in the source file. *Note Viewing::. - - Adding support for this feature required the default value of the - variable `TeX-output-view-style' to be changed. Please make sure - you either remove any customizations overriding the new default or - incorporate the changes into your customizations if you want to - use this feature. - - * TeX error messages of the `-file-line-error' kind are now - understood in AUCTeX and preview-latex (parsers are still - separate). - - * Bug fix in XyMTeX support. - - * The LaTeX tool bar is now enabled by default. *Note Processing - Facilities::. - - -News in 11.82 -------------- - - * Support for the MinionPro LaTeX package was added. - - * Warnings and underfull/overfull boxes are now being indicated in - the echo area after a LaTeX run, if the respective debugging - options are activated with `TeX-toggle-debug-warnings' (`C-c C-t - C-w') or `TeX-toggle-debug-bad-boxes' (`C-c C-t C-b'). In this - case `TeX-next-error' will find these warnings in addition to - normal errors. - - The key binding `C-c C-w' for `TeX-toggle-debug-bad-boxes' (which - was renamed from `TeX-toggle-debug-boxes') now is deprecated. - - * AUCTeX now can automatically insert a pair of braces after typing - <_> or <^> in math constructs if the new variable - `TeX-electric-sub-and-superscript' is set to a non-nil value. - - * Some language-specific support for French was added. There now is - completion support for the commands provided by the `frenchb' (and - `francais') options of the babel LaTeX package and easier input of - French quotation marks (`\\og ...\\fg') which can now be inserted - by typing <">. - - * Completion support for options of some LaTeX packages was added. - - * Already in version 11.81 the way to activate AUCTeX changed - substantially. This should now be done with `(load "auctex.el" nil - t t)' instead of the former `(require 'tex-site)'. Related to this - change `tex-mik.el' does not load `tex-site.el' anymore. That - means if you used only `(require 'tex-mik)' in order to activate - AUCTeX, you have to add `(load "auctex.el" nil t t)' before the - latter statement. *Note Loading the package::. - - * Handling of verbatim constructs was consolidated across AUCTeX. - This resulted in the font-latex-specific variables - `font-latex-verb-like-commands', `font-latex-verbatim-macros', and - `font-latex-verbatim-environments' being removed and the more - general variables `LaTeX-verbatim-macros-with-delims', - `LaTeX-verbatim-macros-with-braces', and - `LaTeX-verbatim-environments' being added. - - * The output of a BibTeX run is now checked for warnings and errors, - which are reported in the echo area. - - * The aliases for `font-latex-title-fontify' were removed. Use - `font-latex-fontify-sectioning' instead. - - * The problem that Japanese macros where broken across lines was - fixed. - - * Various bug fixes. - -News in 11.81 -------------- - - * `LaTeX-mark-section' now marks subsections of a given section as - well. The former behavior is available via the prefix argument. - - * preview-latex which was previously available separately became a - subsystem of AUCTeX. There is no documented provision for building - or installing preview-latex separately. It is still possible to - use and install AUCTeX without preview-latex, however. - - * The installation procedures have been overhauled and now also - install startup files as part of the process (those had to be - copied manually previously). You are advised to remove previous - installations of AUCTeX and preview-latex before starting the - installation procedure. A standard installation from an - unmodified tarball no longer requires Makeinfo or Perl. - - Also note that the way AUCTeX is supposed to be activated changed. - Instead of `(require 'tex-site)' you should now use `(load - "auctex.el" nil t t)'. While the former method may still work, - the new method has the advantage that you can deactivate a - preactivated AUCTeX with the statement `(unload-feature - 'tex-site)' before any of its modes have been used. This may be - important especially for site-wide installations. - - * Support for the babel LaTeX package was added. - - * Folding a buffer now ensures that the whole buffer is fontified - before the actual folding is carried out. If this results in - unbearably long execution times, you can fall back to the old - behavior of relying on stealth font locking to do this job in the - background by customizing the variable `TeX-fold-force-fontify'. - - * Folded content now reveals part of its original text in a tooltip - or the echo area when hovering with the mouse pointer over it. - - * The language-specific insertion of quotation marks was - generalized. The variables `LaTeX-german-open-quote', - `LaTeX-german-close-quote', `LaTeX-german-quote-after-quote', - `LaTeX-italian-open-quote', `LaTeX-italian-close-quote', and - `LaTeX-italian-quote-after-quote' are now obsolete. If you are not - satisfied with the default settings, you should customize - `TeX-quote-language-alist' instead. - - * Similar to language-specific quote insertion, AUCTeX now helps you - with hyphens in different languages as well. *Note European::, - for details. - - * Fill problems in Japanese text introduced in AUCTeX 11.55 were - fixed. AUCTeX tries not to break lines between 1-byte and 2-byte - chars. These features will work in Chinese text, too. - - * The scaling factor of the fontification of sectioning commands can - now be customized using the variable - `font-latex-fontify-sectioning'. This variable was previously - called `font-latex-title-fontify'; In this release we provide an - alias but this will disappear in one of the the next releases. - The faces for the sectioning commands are now called - `font-latex-sectioning-N-face' (N=0...5) instead of - `font-latex-title-N-face' (N=1...4). Analogously the names of the - variables holding the related keyword lists were changed from - `font-latex-title-N-keywords' to - `font-latex-sectioning-N-keywords'. *Note Font Locking::, for - details. Make sure to adjust your customizations. - - * Titles in beamer slides marked by the "\frametitle" command are - know displayed with the new face `font-latex-slide-title-face'. - You can add macros to be highlighted with this face to - `font-latex-match-slide-title-keywords'. - - * Of course a lot of bugs have been fixed. - -News in 11.55 -------------- - - * A bug was fixed which lead to the insertion of trailing whitespace - during filling. In particular extra spaces were added to sentence - endings at the end of lines. You can make this whitespace visible - by setting the variable `show-trailing-whitespace' to `t'. If you - want to delete all trailing whitespace in a buffer, type `M-x - delete-trailing-whitespace RET'. - - * A bug was fixed which lead to a `*Compile-Log*' buffer popping up - when the first LaTeX file was loaded in an Emacs session. - - * On some systems the presence of an outdated Emacspeak package lead - to the error message `File mode specification error: (error - "Variable binding depth exceeds max-specpdl-size")'. Precautions - were added which prevent this error from happening. But - nevertheless, it is advised to upgrade or uninstall the outdated - Emacspeak package. - - * The value of `TeX-macro-global' is not determined during - configuration anymore but at load time of AUCTeX. Consequently the - associated configuration option `--with-tex-input-dirs' was - removed. - - * Support for the LaTeX Japanese classes `jsarticle' and `jsbook' - was added. - -News in 11.54 -------------- - - * The parser (used e.g. for `TeX-auto-generate-global') was extended - to recognize keywords common in LaTeX packages and classes, like - "\DeclareRobustCommand" or "\RequirePackage". Additionally a bug - was fixed which led to duplicate entries in AUCTeX style files. - - * Folding can now be done for paragraphs and regions besides single - constructs and the whole buffer. With the new `TeX-fold-dwim' - command content can both be hidden and shown with a single key - binding. In course of these changes new key bindings for - unfolding commands where introduced. The old bindings are still - present but will be phased out in future releases. - - * Info files of the manual now have a .info extension. - - * There is an experimental tool bar support now. It is not - activated by default. If you want to use it, add - (add-hook 'LaTeX-mode-hook 'LaTeX-install-toolbar) - to your init file. - - * The manual now contains a new chapter "Quick Start". It explains - the main features and how to use them, and should be enough for a - new user to start using AUCTeX. - - * A new section "Font Locking" was added to the manual which explains - syntax highlighting in AUCTeX and its customization. Together with - the sections related to folding and outlining, the section is part - of the new chapter "Display". - - * Keywords for syntax highlighting of LaTeX constructs to be typeset - in bold, italic or typewriter fonts may now be customized. - Besides the built-in classes, new keyword classes may be added by - customizing the variable `font-latex-user-keyword-classes'. The - customization options can be found in the customization group - `font-latex-keywords'. - - * Verbatim content is now displayed with the `fixed-pitch' face. (GNU - Emacs only) - - * Syntax highlighting should not spill out of verbatim content - anymore. (GNU Emacs only) - - * Verbatim commands like `\verb|...|' will not be broken anymore - during filling. - - * You can customize the completion for graphic files with - `LaTeX-includegraphics-read-file'. - - * Support for the LaTeX packages `url', `listings', `jurabib' and - `csquotes' was added with regard to command completion and syntax - highlighting. - - * Performance of fontification and filling was improved. - - * Insertion of nodes in Texinfo mode now supports completion of - existing node names. - - * Setting the variable `LaTeX-float' to `nil' now means that you - will not be prompted for the float position of figures and tables. - You can get the old behaviour of `nil' by setting the variable to - `""', i.e. an empty string. See also *note Floats::. - - * The XEmacs-specific bug concerning `overlays-at' was fixed. - - * Lots of bug fixes. - -News in 11.53 -------------- - - * The LaTeX math menu can include Unicode characters if your Emacs - built supports it. See the variable `LaTeX-math-menu-unicode', - *note Mathematics::. - - * Bug fixes for XEmacs. - - * Completion for graphic files in the TeX search path has been added. - - * `start' is used for the viewer for MiKTeX and fpTeX. - - * The variable `TeX-fold-preserve-comments' can now be customized to - deactivate folding in comments. - -News in 11.52 -------------- - - * Installation and menus under XEmacs work again (maybe for the first - time). - - * Fontification of subscripts and superscripts is now disabled when - the fontification engine is not able to support it properly. - - * Bug fixes in the build process. - -News in 11.51 -------------- - - * PDFTeX and Source Special support did not work with ConTeXt, this - has been fixed. Similar for Source Special support under Windows. - - * Omega support has been added. - - * Bug fixes in the build process. - - * `TeX-fold' now supports folding of environments in Texinfo mode. - -News in 11.50 -------------- - - * The use of source specials when processing or viewing the document - can now be controlled with the new `TeX-source-specials' minor mode - which can be toggled via an entry in the Command menu or the key - binding `C-c C-t C-s'. If you have customized the variable - `TeX-command-list', you have to re-initialize it for this to work. - This means to open a customization buffer for the variable by - typing `M-x customize-variable RET TeX-command-list RET', selecting - "Erase Customization" and do your customization again with the new - default. - - * The content of the command menu now depends on the mode (plain TeX, - LaTeX, ConTeXt etc.). Any former customization of the variable - `TeX-command-list' has to be erased. Otherwise the command menu - and the customization will not work correctly. - - * Support for hiding and auto-revealing macros, e.g. footnotes or - citations, and environments in a buffer was added, *note Folding::. - - * You can now control if indentation is done upon typing by - customizing the variable `TeX-newline-function', *note Indenting::. - - * Limited support for `doc.sty' and `ltxdoc.cls' (`dtx' files) was - added. The new docTeX mode provides functionality for editing - documentation parts. This includes formatting (indenting and - filling), adding and completion of macros and environments while - staying in comments as well as syntax highlighting. (Please note - that the mode is not finished yet. For example syntax - highlighting does not work yet in XEmacs.) - - * For macro completion in docTeX mode the AUCTeX style files - `doc.el', `ltxdoc.el' and `ltx-base.el' were included. The latter - provides general support for low-level LaTeX macros and may be - used with LaTeX class and style files as well. It is currently - not loaded automatically for those files. - - * Support for ConTeXt with a separate ConTeXt mode is now included. - Macro definitions for completion are available in Dutch and - English. - - * The filling and indentation code was overhauled and is now able to - format commented parts of the source syntactically correct. Newly - available functionality and customization options are explained in - the manual. - - * Filling and indentation in XEmacs with preview-latex and activated - previews lead to the insertion of whitespace before multi-line - previews. AUCTeX now contains facilities to prevent this problem. - - * If `TeX-master' is set to `t', AUCTeX will now query for a master - file only when a new file is opened. Existing files will be left - alone. The new function `TeX-master-file-ask' (bound to `C-c _' - is provided for adding the variable manually. - - * Sectioning commands are now shown in a larger font on display - devices which support such fontification. The variable - `font-latex-title-fontify' can be customized to restore the old - appearance, i.e. the usage of a different color instead of a - change in size. - - * Support for `alphanum.sty', `beamer.cls', `booktabs.sty', - `captcont.sty', `emp.sty', `paralist.sty', `subfigure.sty' and - `units.sty'/`nicefrac.sty' was added. Credits go to the authors - mentioned in the respective AUCTeX style files. - - * Inserting graphics with `C-c RET \includegraphics RET' was - improved. See the variable `LaTeX-includegraphics-options-alist'. - - * If `LaTeX-default-position' is `nil', don't prompt for position - arguments in Tabular-like environments, see *note Tabular-like::. - - * Completion for available packages when using `C-c RET \usepackage - RET' was improved on systems using the kpathsea library. - - * The commenting functionality was fixed. The separate functions for - commenting and uncommenting were unified in one function for - paragraphs and regions respectively which do both. - - * Syntax highlighting can be customized to fontify quotes delimited - by either >>German<< or <> quotation marks by changing the - variable `font-latex-quotes'. - - * Certain TeX/LaTeX keywords for functions, references, variables - and warnings will now be fontified specially. You may add your own - keywords by customizing the variables - `font-latex-match-function-keywords', - `font-latex-match-reference-keywords', - `font-latex-match-variable-keywords' and - `font-latex-match-warning-keywords'. - - * If you include the style files `german' or `ngerman' in a document - (directly or via the `babel' package), you should now customize - `LaTeX-german-open-quote', `LaTeX-german-close-quote' and - `LaTeX-german-quote-after-quote' instead of `TeX-open-quote', - `TeX-close-quote' and `TeX-quote-after-quote' if you want to - influence the type of quote insertion. - - * Upon viewing an output file, the right viewer and command line - options for it are now determined automatically by looking at the - extension of the output file and certain options used in the - source file. The behavior can be adapted or extended respectively - by customizing the variable `TeX-output-view-style'. - - * You can control whether `TeX-insert-macro' (`C-c RET') ask for all - optional arguments by customizing the variable - `TeX-insert-macro-default-style', *note Completion::. - - * `TeX-run-discard' is now able to completely detach a process that - it started. - - * The build process was enhanced and is now based on `autoconf' - making installing AUCTeX a mostly automatic process. See *note - Installation:: and *note Installation under MS Windows:: for - details. - -News in 11.14 -------------- - - * Many more LaTeX and LaTeX2e commands are supported. Done by - Masayuki Ataka - -News in 11.12 -------------- - - * Support for the KOMA-Script classes. Contributed by Mark Trettin - . - -News in 11.11 -------------- - - * Support for `prosper.sty', see `http://prosper.sourceforge.net/'. - Contributed by Phillip Lord . - -News in 11.10 -------------- - - * `comment-region' now inserts %% by default. Suggested by "Davide - G. M. Salvetti" . - -News in 11.06 -------------- - - * You can now switch between using the `font-latex' (all emacsen), - the `tex-font' (Emacs 21 only) or no special package for font - locking. Customize `TeX-install-font-lock' for this. - -News in 11.04 -------------- - - * Now use -t landscape by default when landscape option appears. - Suggested by Erik Frisk . - -News in 11.03 -------------- - - * Use `tex-fptex.el' for fpTeX support. Contributed by Fabrice - Popineau . - -News in 11.02 -------------- - - * New user option `LaTeX-top-caption-list' specifies environments - where the caption should go at top. Contributed by - ataka@milk.freemail.ne.jp (Masayuki Ataka). - - * Allow explicit dimensions in `graphicx.sty'. Contributed by - ataka@milk.freemail.ne.jp (Masayuki Ataka). - - * Limited support for `verbatim.sty'. Contributed by - ataka@milk.freemail.ne.jp (Masayuki Ataka). - - * Better support for asmmath items. Patch by - ataka@milk.freemail.ne.jp (Masayuki Ataka). - - * More accurate error parsing. Added by David Kastrup - . - -News in 11.01 -------------- - - * Bug fixes. - -Older versions --------------- - -See the file `history.texi' for older changes. - - -File: auctex.info, Node: Development, Next: FAQ, Prev: Changes, Up: Appendices - -A.3 Future Development -====================== - -The following sections describe future development of AUCTeX. Besides -mid-term goals, bug reports and requests we cannot fix or honor right -away are being gathered here. If you have some time for Emacs Lisp -hacking, you are encouraged to try to provide a solution to one of the -following problems. If you don't know Lisp, you may help us to improve -the documentation. It might be a good idea to discuss proposed changes -on the mailing list of AUCTeX first. - -* Menu: - -* Mid-term Goals:: -* Wishlist:: -* Bugs:: - - -File: auctex.info, Node: Mid-term Goals, Next: Wishlist, Up: Development - -A.3.1 Mid-term Goals --------------------- - - * Integration of preview-latex into AUCTeX - - As of AUCTeX 11.81 preview-latex is a part of AUCTeX in the sense - that the installation routines were merged and preview-latex is - being packaged with AUCTeX. - - Further integration will happen at the backend. This involves - folding of error parsing and task management of both packages - which will ease development efforts and avoid redundant work. - - * More flexible option and command handling - - The current state of command handling with `TeX-command-list' is - not very flexible because there is no distinction between - executables and command line options to be passed to them. - - Customization of `TeX-command-list' by the user will interfere with - updates of AUCTeX. - - * Error help catalogs - - Currently, the help for errors is more or less hardwired into - `tex.el'. For supporting error help in other languages, it would - be sensible to instead arrange error messages in language-specific - files, make a common info file from all such catalogs in a given - language and look the error texts up in an appropriate index. The - user would then specify a preference list of languages, and the - errors would be looked up in the catalogs in sequence until they - were identified. - - * Combining `docTeX' with RefTeX - - Macro cross references should also be usable for document - navigation using RefTeX. - - - -File: auctex.info, Node: Wishlist, Next: Bugs, Prev: Mid-term Goals, Up: Development - -A.3.2 Wishlist --------------- - - * Documentation lookup for macros - - A parser could gather information about which macros are defined in - which LaTeX packages and store the information in a hashtable which - can be used in a backend for `TeX-doc' in order to open the - matching documentation for a given macro. The information could - also be used to insert an appropriate `\usepackage' statement if - the user tries to insert a macro for which the respective package - has not been requested yet. - - * Spell checking of macros - - A special ispell dictionary for macros could be nice to have. - - * Quick error overviews - - An error overview window (extract from the log file with just the - error lines, clickable like a "grep" buffer) and/or fringe - indicators for errors in the main text would be nice. - - * A math entry grid - - A separate frame with a table of math character graphics to click - on in order to insert the respective sequence into the buffer (cf. - the "grid" of x-symbol). - - * Crossreferencing support - - It would be nice if you could index process your favorite - collection of `.dtx' files (such as the LaTeX source), just call a - command on arbitrary control sequence, and get either the DVI - viewer opened right at the definition of that macro (using Source - Specials), or the source code of the `.dtx' file. - - * Better plain TeX support - - For starters, `LaTeX-math-mode' is not very LaTeX-specific in the - first place, and similar holds for indentation and formatting. - - * Poor man's Source Specials In particular in PDF mode (and where - Source Specials cause problems), alternatives would be desirable. - One could implement inverse search by something like Heiko - Oberdiek's `vpe.sty', and forward search by using the `.aux' file - info to correlate labels in the text (possibly in cooperation with - RefTeX) with previewer pages. - - In AUCTeX 11.83, support for forward search with PDF files was - added. Currently this only works if you use the pdfsync LaTeX - package and xpdf as your PDF viewer. *Note Viewing::. - - * Page count when compiling should (optionally) go to modeline of the - window where the compilation command was invoked, instead of the - output window. Suggested by Karsten Tinnefeld - . - - * Command to insert a macrodefinition in the preamble, without moving - point from the current location. Suggested by "Jeffrey C. Ely" - . - - * A database of all commands defined in all stylefiles. When a - command or environment gets entered that is provided in one of the - styles, insert the appropriate `\usepackage' in the preamble. - - * A way to add and overwrite math mode entries in style files, and to - decide where they should be. Suggested by Remo Badii - . - - * Create template for (first) line of tabular environment. - - * I think prompting for the master is the intended behaviour. It - corresponds to a `shared' value for TeX-master. - - There should probably be a `none' value which wouldn't query for - the master, but instead disable all features that relies on - TeX-master. - - This default value for TeX-master could then be controled with - mapping based on the extension. - - * Multiple argument completion for `\bibliography'. In general, I - ought to make `,' special for these kind of completions. - - * Suggest `makeindex' when appropriate. - - * Use index files (when available) to speed up `C-c C-m include - '. - - * Option not to calculate very slow completions like for `C-c C-m - include '. - - * Font menu should be created from `TeX-font-list'. - - * Installation procedure written purely in emacs lisp. - - * Included PostScript files should also be counted as part of the - document. - - * A nice hierarchical by-topic organization of all officially - documented LaTeX macros, available from the menu bar. - - * `TeX-command-default' should be set from the master file, if not - set locally. Suggested by Peter Whaite `'. - - * Make AUCTeX work with `crypt++'. Suggested by Chris Moore - `'. - - * Make AUCTeX work with `longlines'. This would also apply to - preview-latex, though it might make sense to unify error processing - before attempting this. - - * The `Spell' command should apply to all files in a document. Maybe - it could try to restrict to files that have been modified since - last spell check? Suggested by Ravinder Bhumbla - `'. - - * Make <.> check for abbreviations and sentences ending with capital - letters. - - * Use Emacs 19 minibuffer history to choose between previewers, and - other stuff. Suggested by John Interrante - `'. - - * Make features. - - A new command `TeX-update' (`C-c C-u') could be used to create an - up-to-date dvi file by repeatedly running BibTeX, MakeIndex and - (La)TeX, until an error occurs or we are done. - - An alternative is to have an `Update' command that ensures the - `dvi' file is up to date. This could be called before printing and - previewing. - - * Documentation of variables that can be set in a style hook. - - We need a list of what can safely be done in an ordinary style - hook. You can not set a variable that AUCTeX depends on, unless - AUCTeX knows that it has to run the style hooks first. - - Here is the start of such a list. - `LaTeX-add-environments' - - `TeX-add-symbols' - - `LaTeX-add-labels' - - `LaTeX-add-bibliographies' - - `LaTeX-largest-level' - - * Completion for counters and sboxes. - - * Outline should be (better) supported in TeX mode. - - At least, support headers, trailers, as well as TeX-outline-extra. - - * `TeX-header-start' and `TeX-trailer-end'. - - We might want these, just for fun (and outlines) - - * Plain TeX and LaTeX specific header and trailer expressions. - - We should have a way to globally specify the default value of the - header and trailer regexps. - - * Get closer to original `TeX-mode' keybindings. - - A third initialization file (`tex-mode.el') containing an emulator - of the standard `TeX-mode' would help convince some people to - change to AUCTeX. - - * Make `TeX-next-error' parse ahead and store the results in a list, - using markers to remember buffer positions in order to be more - robust with regard to line numbers and changed files. This is what - `next-error' does. (Or did, until Emacs 19). - - * Finish the Texinfo mode. For one thing, many Texinfo mode - commands do not accept braces around their arguments. - - * Hook up the letter environment with `bbdb.el'. - - - -File: auctex.info, Node: Bugs, Prev: Wishlist, Up: Development - -A.3.3 Bugs ----------- - - * The parsed files and style hooks for `example.dtx', `example.sty', - `example.drv' and `example.bib' all clash. Bad. - - * `C-c `' should always stay in the current window, also when it - finds a new file. - - * Do not overwrite emacs warnings about existing auto-save files when - loading a new file. - - * Maybe the regexp for matching a TeX symbol during parsing should be - `"\\\\\\([a-zA-Z]+\\|.\\)"' -- - `' Peter Thiemann. - - * AUCTeX should not parse verbatim environments. - - * Make ``' check for math context in `LaTeX-math-mode'. and simply - self insert if not in a math context. - - * Make `TeX-insert-dollar' more robust. Currently it can be fooled - by `\mbox''es and escaped double dollar for example. - - * Correct indentation for tabular, tabbing, table, math, and array - environments. - - * No syntactic font locking of verbatim macros and environments. - (XEmacs only) - - * Font locking inside of verbatim macros and environments is not - inhibited. This may result in syntax highlighting of unbalanced - dollar signs and the like spilling out of the verbatim content. - (XEmacs only) - - * Folding of LaTeX constructs spanning more than one line may result - in overfull lines. (XEmacs only) - - -File: auctex.info, Node: FAQ, Prev: Development, Up: Appendices - -A.4 Frequently Asked Questions -============================== - - 1. Something is not working correctly. What should I do? - - Well, you might have guessed it, the first place to look is in the - available documentation packaged with AUCTeX. This could be the - release notes (in the `RELEASE' file) or the news section of the - manual in case you are experiencing problems after an upgrade, the - `INSTALL' file in case you are having problems with the - installation, the section about bugs in the manual in case you - encountered a bug or the relevant sections in the manual for other - related problems. - - If this did not help, you can send a bug report to the AUCTeX bug - reporting list by using the command `M-x TeX-submit-bug-report - RET'. But before you do this, you can try to get more information - about the problem at hand which might also help you locate the - cause of the error yourself. - - First, you can try to generate a so-called backtrace which shows - functions involved in a program error. In order to do this, start - Emacs with the command line `emacs --debug-init' and/or put the - line - - (setq debug-on-error t) - - as the first line into your init file. XEmacs users might want to - add `(setq stack-trace-on-error t)' as well. After Emacs has - started, you can load a file which triggers the error and a new - window should pop up showing the backtrace. If you get such a - backtrace, please include it in the bug report. - - Second, you can try to figure out if something in your personal or - site configuration triggers the error by starting Emacs without - such customizations. You can do this by invoking Emacs with the - command line `emacs -q -no-site-file'. Once Emacs is running, - copy the line - - (load "auctex.el" nil t t) - - into the `*scratch*' buffer and type `M-x eval-buffer RET'. This - makes sure that AUCTeX will be used for the file types it - supports. After you have done so, you can load the file - triggering the error. If everything is working now, you know that - you have to search either in the site configuration file or your - personal init file for statements related to the problem. - - 2. What versions of Emacs and XEmacs are supported? - - AUCTeX was tested with Emacs 21 and XEmacs 21.4.15. Older - versions may work but are unsupported. Older versions of XEmacs - might possibly made to work by updating the `xemacs-base' package - through the XEmacs package system. If you are looking for a - recommendation, it would appear that the smoothest working - platform on all operating systems at the current point of time - would be Emacs 22.1. At the time of this writing, however, it has - not been released and is still under development. The quality of - the development version is quite solid, so we recommend giving it - a try. With a developer version, of course, you have to be - prepared to update in case you managed to get your snapshot at a - bad time. The second best choice would be the latest released - Emacs 21.4. However, Unicode support is less good, there is no - version for the popular GTK toolkit, and the native versions for - Windows and MacOS don't offer toolbar and preview-latex support. - - Our success with XEmacs has been less than convincing. Under the - Windows operating system, nominally the only option for a released, - stable Emacs variant supporting toolbars and preview-latex would be - XEmacs 21.4. However, code for core functionality like formatting - and syntax highlighting tends to be different and often older than - even Emacs 21.4, and Unicode support as delivered is problematic - at best, missing on Windows. Both AUCTeX and XEmacs developers - don't hear much from active users of the combination. Partly for - that reason, problems tend to go unnoticed for long amounts of - time and are often found, if at all, after releases. No - experiences or recommendations can be given for beta or developer - versions of XEmacs. - - 3. What should I do when `./configure' does not find programs like - latex? - - This is problem often encountered on Windows. Make sure that the - `PATH' environment variable includes the directories containing the - relevant programs, as described in *note Installation under MS - Windows: (auctex)Installation under MS Windows. - - 4. Why doesn't the completion, style file, or multi-file stuff work? - - It must be enabled first, insert this in your init file: - - (setq-default TeX-master nil) - (setq TeX-parse-self t) - (setq TeX-auto-save t) - - Read also the chapters about parsing and multifile documents in the - manual. - - 5. Why doesn't `TeX-save-document' work? - - `TeX-check-path' has to contain "./" somewhere. - - 6. Why is the information in `foo.tex' forgotten when I save - `foo.bib'? - - For various reasons, AUCTeX ignores the extension when it stores - information about a file, so you should use unique base names for - your files. E.g. rename `foo.bib' to `foob.bib'. - - 7. Why doesn't AUCTeX signal when processing a document is done? - - If the message in the minibuffer stays "Type `C-c C-l' to display - results of compilation.", you probably have a misconfiguration in - your init file (`.emacs', `init.el' or similar). To track this - down either search in the `*Messages*' buffer for an error message - or put `(setq debug-on-error t)' as the first line into your init - file, restart Emacs and open a LaTeX file. Emacs will complain - loudly by opening a debugging buffer as soon as an error occurs. - The information in the debugging buffer can help you find the - cause of the error in your init file. - - 8. What does AUC stand for? - - AUCTeX came into being at Aalborg University in Denmark. Back then - the Danish name of the university was Aalborg Universitetscenter; - AUC for short. - - - -File: auctex.info, Node: Indices, Prev: Appendices, Up: Top - -Indices -******* - -* Menu: - -* Key Index:: -* Function Index:: -* Variable Index:: -* Concept Index:: - - -File: auctex.info, Node: Key Index, Next: Function Index, Up: Indices - -Key Index -========= - -[index] -* Menu: - -* ": Quotes. (line 15) -* $: Quotes. (line 62) -* : Indenting. (line 72) -* : Indenting. (line 69) -* C-c %: Commenting. (line 23) -* C-c ;: Commenting. (line 15) -* C-c : Itemize-like. (line 10) -* C-c ?: Documentation. (line 7) -* C-c ]: Environments. (line 56) -* C-c ^: Control. (line 18) -* C-c _: Multifile. (line 70) -* C-c `: Debugging. (line 10) -* C-c C-b: Starting a Command. (line 35) -* C-c C-c: Starting a Command. (line 13) -* C-c C-d: Multifile. (line 98) -* C-c C-e: Environments. (line 20) -* C-c C-f: Font Specifiers. (line 44) -* C-c C-f C-b <1>: Font Specifiers. (line 16) -* C-c C-f C-b: Editing Facilities. (line 73) -* C-c C-f C-c <1>: Font Specifiers. (line 37) -* C-c C-f C-c: Editing Facilities. (line 94) -* C-c C-f C-e <1>: Font Specifiers. (line 22) -* C-c C-f C-e: Editing Facilities. (line 79) -* C-c C-f C-f <1>: Font Specifiers. (line 31) -* C-c C-f C-f: Editing Facilities. (line 88) -* C-c C-f C-i <1>: Font Specifiers. (line 19) -* C-c C-f C-i: Editing Facilities. (line 76) -* C-c C-f C-r <1>: Font Specifiers. (line 28) -* C-c C-f C-r: Editing Facilities. (line 85) -* C-c C-f C-s <1>: Font Specifiers. (line 25) -* C-c C-f C-s: Editing Facilities. (line 82) -* C-c C-f C-t <1>: Font Specifiers. (line 34) -* C-c C-f C-t: Editing Facilities. (line 91) -* C-c C-k: Control. (line 10) -* C-c C-l: Control. (line 14) -* C-c C-m: Completion. (line 30) -* C-c C-n: Parsing Files. (line 44) -* C-c C-o b: Folding. (line 113) -* C-c C-o C-b: Folding. (line 44) -* C-c C-o C-c: Folding. (line 110) -* C-c C-o C-e: Folding. (line 94) -* C-c C-o C-f: Folding. (line 32) -* C-c C-o C-m: Folding. (line 85) -* C-c C-o C-o: Folding. (line 132) -* C-c C-o C-p: Folding. (line 81) -* C-c C-o C-r: Folding. (line 78) -* C-c C-o i: Folding. (line 125) -* C-c C-o p: Folding. (line 121) -* C-c C-o r: Folding. (line 117) -* C-c C-q C-e: Filling. (line 92) -* C-c C-q C-p: Filling. (line 86) -* C-c C-q C-r: Filling. (line 101) -* C-c C-q C-s: Filling. (line 97) -* C-c C-r: Starting a Command. (line 19) -* C-c C-s: Sectioning. (line 23) -* C-c C-t C-b: Debugging. (line 19) -* C-c C-t C-i: Processor Options. (line 29) -* C-c C-t C-p: Processor Options. (line 15) -* C-c C-t C-r: Starting a Command. (line 61) -* C-c C-t C-s: Processor Options. (line 36) -* C-c C-t C-w: Debugging. (line 23) -* C-c C-v: Starting Viewers. (line 12) -* C-c {: Quotes. (line 86) -* C-c ~: Mathematics. (line 12) -* C-j: Indenting. (line 81) -* M-: Completion. (line 20) -* M-q: Filling. (line 89) - - -File: auctex.info, Node: Function Index, Next: Variable Index, Prev: Key Index, Up: Indices - -Function Index -============== - -[index] -* Menu: - -* LaTeX-add-bibliographies: Adding Other. (line 11) -* LaTeX-add-environments: Adding Environments. (line 67) -* LaTeX-add-labels: Adding Other. (line 14) -* LaTeX-close-environment: Environments. (line 56) -* LaTeX-env-args: Adding Environments. (line 109) -* LaTeX-env-array: Adding Environments. (line 81) -* LaTeX-env-bib: Adding Environments. (line 103) -* LaTeX-env-contents: Adding Environments. (line 106) -* LaTeX-env-figure: Adding Environments. (line 77) -* LaTeX-env-item: Adding Environments. (line 74) -* LaTeX-env-label: Adding Environments. (line 85) -* LaTeX-env-list: Adding Environments. (line 88) -* LaTeX-env-minipage: Adding Environments. (line 92) -* LaTeX-env-picture: Adding Environments. (line 100) -* LaTeX-env-tabular*: Adding Environments. (line 96) -* LaTeX-environment: Environments. (line 20) -* LaTeX-fill-environment: Filling. (line 81) -* LaTeX-fill-paragraph: Filling. (line 86) -* LaTeX-fill-region: Filling. (line 101) -* LaTeX-fill-section: Filling. (line 97) -* LaTeX-indent-line: Indenting. (line 69) -* LaTeX-insert-environment: Adding Environments. (line 70) -* LaTeX-insert-item: Itemize-like. (line 10) -* LaTeX-math-mode: Mathematics. (line 12) -* LaTeX-section: Sectioning. (line 23) -* LaTeX-section-heading: Sectioning. (line 85) -* LaTeX-section-label: Sectioning. (line 101) -* LaTeX-section-section: Sectioning. (line 95) -* LaTeX-section-title: Sectioning. (line 89) -* LaTeX-section-toc: Sectioning. (line 92) -* TeX-add-style-hook: Simple Style. (line 28) -* TeX-add-symbols: Adding Macros. (line 25) -* TeX-arg-cite: Adding Macros. (line 105) -* TeX-arg-conditional: Adding Macros. (line 82) -* TeX-arg-coordinate: Adding Macros. (line 165) -* TeX-arg-corner: Adding Macros. (line 143) -* TeX-arg-counter: Adding Macros. (line 108) -* TeX-arg-define-cite: Adding Macros. (line 134) -* TeX-arg-define-counter: Adding Macros. (line 137) -* TeX-arg-define-environment: Adding Macros. (line 130) -* TeX-arg-define-label: Adding Macros. (line 122) -* TeX-arg-define-macro: Adding Macros. (line 126) -* TeX-arg-define-savebox: Adding Macros. (line 140) -* TeX-arg-environment: Adding Macros. (line 102) -* TeX-arg-eval: Adding Macros. (line 93) -* TeX-arg-file: Adding Macros. (line 114) -* TeX-arg-free: Adding Macros. (line 90) -* TeX-arg-input-file: Adding Macros. (line 118) -* TeX-arg-label: Adding Macros. (line 96) -* TeX-arg-literal: Adding Macros. (line 86) -* TeX-arg-lr: Adding Macros. (line 146) -* TeX-arg-macro: Adding Macros. (line 99) -* TeX-arg-pagestyle: Adding Macros. (line 152) -* TeX-arg-pair: Adding Macros. (line 158) -* TeX-arg-savebox: Adding Macros. (line 111) -* TeX-arg-size: Adding Macros. (line 162) -* TeX-arg-tb: Adding Macros. (line 149) -* TeX-arg-verb: Adding Macros. (line 155) -* TeX-auto-generate: Automatic Private. (line 24) -* TeX-clean: Cleaning. (line 7) -* TeX-command-buffer: Starting a Command. (line 35) -* TeX-command-master: Starting a Command. (line 13) -* TeX-command-region: Starting a Command. (line 19) -* TeX-comment-or-uncomment-paragraph: Commenting. (line 23) -* TeX-comment-or-uncomment-region: Commenting. (line 15) -* TeX-complete-symbol: Completion. (line 20) -* TeX-doc: Documentation. (line 7) -* TeX-electric-macro: Completion. (line 67) -* TeX-fold-buffer: Folding. (line 44) -* TeX-fold-clearout-buffer: Folding. (line 113) -* TeX-fold-clearout-item: Folding. (line 125) -* TeX-fold-clearout-paragraph: Folding. (line 121) -* TeX-fold-clearout-region: Folding. (line 117) -* TeX-fold-comment: Folding. (line 110) -* TeX-fold-dwim: Folding. (line 132) -* TeX-fold-env: Folding. (line 94) -* TeX-fold-macro: Folding. (line 85) -* TeX-fold-math: Folding. (line 101) -* TeX-fold-mode: Folding. (line 32) -* TeX-fold-paragraph: Folding. (line 81) -* TeX-fold-region: Folding. (line 78) -* TeX-font: Font Specifiers. (line 44) -* TeX-header-end: Multifile. (line 29) -* TeX-home-buffer: Control. (line 18) -* TeX-insert-braces: Quotes. (line 86) -* TeX-insert-dollar: Quotes. (line 62) -* TeX-insert-macro: Completion. (line 30) -* TeX-insert-quote: Quotes. (line 15) -* TeX-interactive-mode: Processor Options. (line 29) -* TeX-kill-job: Control. (line 10) -* TeX-master-file-ask: Multifile. (line 70) -* TeX-next-error: Debugging. (line 10) -* TeX-normal-mode: Parsing Files. (line 44) -* TeX-PDF-mode: Processor Options. (line 15) -* TeX-pin-region: Starting a Command. (line 61) -* TeX-recenter-output-buffer: Control. (line 14) -* TeX-save-document: Multifile. (line 98) -* TeX-source-correlate-mode <1>: I/O Correlation. (line 12) -* TeX-source-correlate-mode: Processor Options. (line 36) -* TeX-toggle-debug-bad-boxes: Debugging. (line 19) -* TeX-toggle-debug-warnings: Debugging. (line 23) -* TeX-view <1>: I/O Correlation. (line 20) -* TeX-view: Starting Viewers. (line 12) - - -File: auctex.info, Node: Variable Index, Next: Concept Index, Prev: Function Index, Up: Indices - -Variable Index -============== - -[index] -* Menu: - -* ConTeXt-clean-intermediate-suffixes: Cleaning. (line 7) -* ConTeXt-clean-output-suffixes: Cleaning. (line 7) -* ConTeXt-engine: Processor Options. (line 83) -* ConTeXt-Omega-engine: Processor Options. (line 83) -* docTeX-clean-intermediate-suffixes: Cleaning. (line 7) -* docTeX-clean-output-suffixes: Cleaning. (line 7) -* font-latex-deactivated-keyword-classes: Fontification of macros. - (line 174) -* font-latex-fontify-script: Fontification of math. - (line 21) -* font-latex-fontify-sectioning: Fontification of macros. - (line 102) -* font-latex-match-bold-command-keywords: Fontification of macros. - (line 143) -* font-latex-match-bold-declaration-keywords: Fontification of macros. - (line 143) -* font-latex-match-function-keywords: Fontification of macros. - (line 66) -* font-latex-match-italic-command-keywords: Fontification of macros. - (line 143) -* font-latex-match-italic-declaration-keywords: Fontification of macros. - (line 143) -* font-latex-match-math-command-keywords <1>: Fontification of math. - (line 6) -* font-latex-match-math-command-keywords: Fontification of macros. - (line 143) -* font-latex-match-reference-keywords: Fontification of macros. - (line 66) -* font-latex-match-sectioning-0-keywords: Fontification of macros. - (line 113) -* font-latex-match-sectioning-1-keywords: Fontification of macros. - (line 113) -* font-latex-match-sectioning-2-keywords: Fontification of macros. - (line 113) -* font-latex-match-sectioning-3-keywords: Fontification of macros. - (line 113) -* font-latex-match-sectioning-4-keywords: Fontification of macros. - (line 113) -* font-latex-match-sectioning-5-keywords: Fontification of macros. - (line 113) -* font-latex-match-slide-title-keywords: Fontification of macros. - (line 120) -* font-latex-match-textual-keywords: Fontification of macros. - (line 66) -* font-latex-match-type-command-keywords: Fontification of macros. - (line 143) -* font-latex-match-type-declaration-keywords: Fontification of macros. - (line 143) -* font-latex-match-variable-keywords: Fontification of macros. - (line 66) -* font-latex-match-warning-keywords: Fontification of macros. - (line 66) -* font-latex-math-environments: Fontification of math. - (line 6) -* font-latex-quotes: Fontification of quotes. - (line 16) -* font-latex-script-display: Fontification of math. - (line 29) -* font-latex-sectioning-0-face: Fontification of macros. - (line 102) -* font-latex-sectioning-1-face: Fontification of macros. - (line 102) -* font-latex-sectioning-2-face: Fontification of macros. - (line 102) -* font-latex-sectioning-3-face: Fontification of macros. - (line 102) -* font-latex-sectioning-4-face: Fontification of macros. - (line 102) -* font-latex-sectioning-5-face: Fontification of macros. - (line 102) -* font-latex-slide-title-face: Fontification of macros. - (line 120) -* font-latex-user-keyword-classes: Fontification of macros. - (line 204) -* japanese-LaTeX-command-default: Japanese. (line 6) -* japanese-LaTeX-default-style: Japanese. (line 6) -* japanese-TeX-command-default: Japanese. (line 6) -* LaTeX-amsmath-label: Equations. (line 16) -* LaTeX-auto-label-regexp-list: Parsing Files. (line 100) -* LaTeX-auto-minimal-regexp-list: Parsing Files. (line 97) -* LaTeX-auto-regexp-list: Parsing Files. (line 103) -* LaTeX-babel-hyphen: European. (line 150) -* LaTeX-babel-hyphen-after-hyphen: European. (line 158) -* LaTeX-babel-hyphen-language-alist: European. (line 137) -* LaTeX-clean-intermediate-suffixes: Cleaning. (line 7) -* LaTeX-clean-output-suffixes: Cleaning. (line 7) -* LaTeX-command: Processor Options. (line 83) -* LaTeX-csquotes-close-quote: Quotes. (line 44) -* LaTeX-csquotes-open-quote: Quotes. (line 44) -* LaTeX-csquotes-quote-after-quote: Quotes. (line 44) -* LaTeX-default-environment: Environments. (line 35) -* LaTeX-default-format: Tabular-like. (line 11) -* LaTeX-default-position: Tabular-like. (line 14) -* LaTeX-enable-toolbar: Processing. (line 11) -* LaTeX-eqnarray-label: Equations. (line 13) -* LaTeX-equation-label: Equations. (line 10) -* LaTeX-figure-label: Floats. (line 25) -* LaTeX-fill-break-at-separators: Filling. (line 104) -* LaTeX-fill-break-before-code-comments: Filling. (line 114) -* LaTeX-float: Floats. (line 14) -* LaTeX-fold-env-spec-list: Folding. (line 189) -* LaTeX-fold-macro-spec-list: Folding. (line 189) -* LaTeX-fold-math-spec-list: Folding. (line 189) -* LaTeX-font-list: Font Specifiers. (line 59) -* LaTeX-indent-environment-check: Indenting. (line 51) -* LaTeX-indent-environment-list: Indenting. (line 37) -* LaTeX-indent-level: Indenting. (line 19) -* LaTeX-item-indent: Indenting. (line 19) -* LaTeX-item-regexp: Indenting. (line 19) -* LaTeX-math-abbrev-prefix: Mathematics. (line 27) -* LaTeX-math-list: Mathematics. (line 37) -* LaTeX-math-menu-unicode: Mathematics. (line 55) -* LaTeX-Omega-command: Processor Options. (line 83) -* LaTeX-paragraph-commands: Filling. (line 55) -* LaTeX-section-hook: Sectioning. (line 50) -* LaTeX-section-label: Sectioning. (line 53) -* LaTeX-syntactic-comments: Indenting. (line 63) -* LaTeX-table-label: Floats. (line 25) -* LaTeX-top-caption-list: Floats. (line 20) -* LaTeX-verbatim-environments: Verbatim content. (line 10) -* LaTeX-verbatim-macros-with-braces: Verbatim content. (line 10) -* LaTeX-verbatim-macros-with-delims: Verbatim content. (line 10) -* plain-TeX-auto-regexp-list: Parsing Files. (line 106) -* plain-TeX-clean-intermediate-suffixes: Cleaning. (line 7) -* plain-TeX-clean-output-suffixes: Cleaning. (line 7) -* plain-TeX-enable-toolbar: Processing. (line 11) -* TeX-auto-cleanup-hook: Hacking the Parser. (line 101) -* TeX-auto-empty-regexp-list: Parsing Files. (line 94) -* TeX-auto-full-regexp-list: Parsing Files. (line 109) -* TeX-auto-global: Automatic Global. (line 26) -* TeX-auto-local: Automatic Local. (line 23) -* TeX-auto-parse-length: Parsing Files. (line 88) -* TeX-auto-prepare-hook: Hacking the Parser. (line 98) -* TeX-auto-private: Automatic Private. (line 20) -* TeX-auto-regexp-list <1>: Hacking the Parser. (line 79) -* TeX-auto-regexp-list: Parsing Files. (line 85) -* TeX-auto-save: Parsing Files. (line 41) -* TeX-auto-untabify: Parsing Files. (line 58) -* TeX-brace-indent-level: Indenting. (line 103) -* TeX-check-path: Selecting a Command. (line 56) -* TeX-clean-confirm: Cleaning. (line 27) -* TeX-close-quote: Quotes. (line 26) -* TeX-command: Processor Options. (line 83) -* TeX-command-default: Selecting a Command. (line 43) -* TeX-command-list <1>: Selecting a Command. (line 14) -* TeX-command-list: Starting a Command. (line 16) -* TeX-default-macro: Completion. (line 52) -* TeX-default-mode: Japanese. (line 6) -* TeX-display-help: Debugging. (line 31) -* TeX-DVI-via-PDFTeX: Processor Options. (line 22) -* TeX-electric-escape: Completion. (line 59) -* TeX-electric-sub-and-superscript: Mathematics. (line 69) -* TeX-engine: Processor Options. (line 67) -* TeX-engine-alist: Processor Options. (line 83) -* TeX-engine-alist-builtin: Processor Options. (line 83) -* TeX-expand-list: Selecting a Command. (line 14) -* TeX-file-recurse: Automatic. (line 46) -* TeX-fold-command-prefix: Folding. (line 137) -* TeX-fold-env-spec-list: Folding. (line 180) -* TeX-fold-force-fontify: Folding. (line 64) -* TeX-fold-help-echo-max-length: Folding. (line 217) -* TeX-fold-macro-spec-list: Folding. (line 147) -* TeX-fold-math-spec-list: Folding. (line 187) -* TeX-fold-preserve-comments: Folding. (line 72) -* TeX-fold-type-list: Folding. (line 59) -* TeX-fold-unspec-env-display-string: Folding. (line 200) -* TeX-fold-unspec-macro-display-string: Folding. (line 196) -* TeX-fold-unspec-use-name: Folding. (line 204) -* TeX-font-list: Font Specifiers. (line 50) -* TeX-header-end: Starting a Command. (line 32) -* TeX-ignore-file: Automatic. (line 54) -* TeX-insert-braces: Completion. (line 77) -* TeX-insert-macro-default-style: Completion. (line 38) -* TeX-install-font-lock: Font Locking. (line 14) -* TeX-interactive-mode: Processor Options. (line 29) -* TeX-language-bg-hook: European. (line 53) -* TeX-language-cz-hook: European. (line 53) -* TeX-language-de-hook: European. (line 53) -* TeX-language-dk-hook: European. (line 53) -* TeX-language-is-hook: European. (line 53) -* TeX-language-it-hook: European. (line 53) -* TeX-language-nl-hook: European. (line 53) -* TeX-language-pl-hook: European. (line 53) -* TeX-language-sk-hook: European. (line 53) -* TeX-language-sv-hook: European. (line 53) -* TeX-macro-global <1>: Automatic Global. (line 17) -* TeX-macro-global: Customizing. (line 20) -* TeX-macro-private: Automatic Private. (line 13) -* TeX-master <1>: Multifile. (line 42) -* TeX-master: Starting a Command. (line 16) -* TeX-math-close-double-dollar: Quotes. (line 72) -* TeX-newline-function: Indenting. (line 29) -* TeX-Omega-command: Processor Options. (line 83) -* TeX-one-master: Multifile. (line 57) -* TeX-open-quote: Quotes. (line 22) -* TeX-outline-extra: Outline. (line 14) -* TeX-output-view-style: Starting Viewers. (line 100) -* TeX-parse-self: Parsing Files. (line 38) -* TeX-PDF-mode: Processor Options. (line 15) -* TeX-quote-after-quote: Quotes. (line 30) -* TeX-quote-language-alist: European. (line 124) -* TeX-region: Starting a Command. (line 32) -* TeX-save-query: Multifile. (line 102) -* TeX-show-compilation: Processor Options. (line 110) -* TeX-source-correlate-method: Processor Options. (line 47) -* TeX-source-correlate-mode: Processor Options. (line 36) -* TeX-source-correlate-start-server: I/O Correlation. (line 26) -* TeX-style-global: Automatic Global. (line 20) -* TeX-style-local: Automatic Local. (line 17) -* TeX-style-path: Automatic. (line 39) -* TeX-style-private: Automatic Private. (line 29) -* TeX-trailer-start: Starting a Command. (line 32) -* TeX-view-predicate-list: Starting Viewers. (line 58) -* TeX-view-program-list: Starting Viewers. (line 67) -* TeX-view-program-selection: Starting Viewers. (line 38) -* TeX-view-style: Starting Viewers. (line 109) -* Texinfo-clean-intermediate-suffixes: Cleaning. (line 7) -* Texinfo-clean-output-suffixes: Cleaning. (line 7) - diff --git a/packages/auctex/auctex.info-2 b/packages/auctex/auctex.info-2 deleted file mode 100644 index 87100321e72816376103d25beeb5b655f6d36947..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 27158 zcmd5_S##S)63%0ae`2Td6mN-&DcP~)J*s3Kwqji?N=~+R_W=Y)5@Hab0Z^9m>-Xy! z3=R_L9<3zTvQiX70w212dV2br@x@J)EBqHM!b0DzN6A&Xrsi2XU4(k7CiiL zy46`8rHOjAKH5}QSvqs~;J#>mFt{M3S&%G(m;kTROzm9mUg+P{kM7pdXnpHvd+)}} z(aYh>jp4@V#hMBRc{<1KMHB`F9!odrFvnw*QoHH=K8vnz3iade z3pLu_-dLmeP4oWByuV&k8!umu%sYO?XMB%$`~A;r1AKmCzS%PG+w?wqsSYx&)i}K> zz6P0A2k9c21_iiYQ-?`tpRUxI&Sp_=gaJmcvmha&i&TXmY)wtUNES^Ng;qf_{RwiI zrPJu@UKL=G=vQi*h6}?P@O6eCv?>6atMtnJ&-;^0OUhn(p&>#YMWIe|y=Fl^l>;(b z-&A-=kld>n;>)U$nlC1Cl;7BKq-V6avmiB#e^Fnf;zlJYSiKFh2wbVL4vG7GjlMp> za1_Jc6r+g|x+|bG$<(6Y*LOkqx%uO|QaeTbt5`mLLcb^@!Dbc*kG(+YqeSDTpI-pz-xGZuB_hy%Z5whshyZ8pF2*N1FM@@8<6m3}6!l=+|m=UvitZ7nVUUY!&R==-O zw6$quq-XORfiF;WfXS-Ha~(!k5e$Vza};ec4cA9@%^pKGGp6ve?r$KtSgD5L=rN#aJW zR7eBV)W}Xy4~5M1l?X$tw$uE^u$3|@HQOx#kDjz8P$xsR%6P~qUraoR@))%mh$G5_ zB6wTHr95sL*L(x_(>|8XFoMvw{gdIPMBD+A+@E4EL z?9E!(g}5GZdbDkXy)&7>g^Nry!1!Co0lexNu0q6AnY-3(7@q4}9k4VVq%m2&Cd{%Lx<_?W;>6)ck)c`bE^?4x4(KxM zLx9c#mK77Ha)G{FkLE=^gbuYzwoaffGMqNzFXw^UtN|#(xKU;;*NlvweKp&? z(MEUzL+-Mc&0msClmzl*eRhVzo6iV01a^=`Df#Ya2zf^9Y&EUMYO+x_8GZ>%kG#(A zFCS5vNUj%1_%aMWyNE%@@JJr(=cglv3yaCh$b#nNZh2Y%P`mX*0umR#S{YcV`mzR1 z?b!s&nWZsu`qr$ai=rzLiy{ME)<6NjOF;8`SwyB3*fx7zK&Dv8a^?dh8wnb<=hvP^ zmYJfcDf`ePJ6|3m<~-9H(>bs$F}KI6354n~7OXT`b;TbHl%rzOHEJF}f9Oz*O8Ico zx&(WesJV;Oyj}!h zlvQX223`L5GDQ}snY&qm@yOg%6xrO(Duk6&7ePI&+2CIQVlp=sMJu_R70eZ?mSjXl zztXkrcjq|Q^3_X9x9;gCP~YgYj@-7%B=6}w%%Zs|@AtyMoQajKy(pi@0X2%CdjOpd zol{mR*^dX1?VDIljnxx`>PTi~Xesv6@Hd+#`gv>hRyer!sFgrMj3Sp2-J^2bV=h}i)50YY96zISv@O&MVtqwxc!d~{1t^G3z%$0YrlP#X_^o4J5@i8TUhJi964 z`m@KVrRXxz>Whi@DgtVR@{0Vf(QO>>W-yzvdeP>H|nn%`evYWntXOhh^1#c!N)(z-> zal-uZBN!Srdf5Z3FEcttq~9jF{!Gc+$lC zL3F)9GhxF!>Xi0DoCbxn)rQ#>)(p_9blt_}UmqY7p>>kc07EjF0=c%h+rmcqiN;>@ zlUGh!9F#zm3Jd!K966|I0?mS)5>+(UmRa=xGQ+WaUqd?fqld6<)j>$%snbP4op7A6 zEs#W#T;(ucCer(qd}Pp?msMo7ho5@Px(jSgL2+KKHMLg&8dCErp8)ftNSq*ibDX8< zz!YhXVdKhwvW08{ZS?mddd#(oB4*4e|1hNv+V-?v8nq1F%~K?BgN*UG4u3ku@_<}} zEhJkFXak{Hnx(}mf$XrGzT~{@y6#7mf!^x`o?ooasPj2={n9IlzCdR9`_?pKPF~mE zqpdp-)@uN9PK3=wypPifIBS$kSJ-M%r0fl5*jl4j0-0%B!L53f6>Abuoh;}^^9CXZ zf}_d<=goy(#uw;L(hrm%}8*`Cz)G^!ZLz>I3sy3Z^h(%bLzKi5{io1~zwvfaNZ8lgkLNHN$@QTY5Zz$W`FnayxK-KmuC?_3U&0qm8tY z9zxERmZ@%{qI6qe}g*1WRiGQQmd_rO~%x1KeoXbEK7*5V+f_7XdvpP|EAwa&w$K+0iV&(`b#AmubZE9eP=fXWhAtl8^WU6#ZTXw5VQW7jcG zsGw~%9hK*AK$zy`MUK8G0$UrAX@sWZ?15(da zqCt9g$(&$QrY$&j38d5$pZzB%5qwiI^!EsmPcAOh?{Y{gPXY(TGWHEbY_@4)iK=!g zcCYGkWMcE$WX#!UT~2>jK)h(=^f!RI8j>ruDL=@|)G4xbSBp3n_Cm=Godk3n>90Iz z9`#|j2TUl&%M>{v6Fv3U_Wgkp{go>d%TB7JNSI_*L{P6*OY2nwh?BRw%-Bo^)^bwa z6+}_muTvf};&$@ZYWeN<^q%brv%~#jL70BvK1a2 z++{k`(PF}E%B;3*!fv^-UsfXr)Uc5q3z+M-*uHxOJ~jU12(!@3KoxaR>tq>%k! zGSJ*FXCg0VXDJ;%)*%%dtNO*IOl)c$r&duG5sMLa5#bP>o+O@}xmyA1CQi=WA+Jdm zdsvo}hNc9*8e3oyxiT$VwHCSIAH6guOn@Q+f}(YkQi|!5y`~A{fXaijpkJoxgM~3E zKq1sE6}8gD&eI&c6w+!uql<<)Ss@)oLZ5*@5I;kF=33cTEeTuPs#jVpA&5tMQrayg z9#dcyNuIO>B(OzL&+g>gpj@Oxj@|7Q%R%!>^u7|if3f?QpXRU(n?yXP&xZ~2sh z8p!RFL}7xOjGOt{x8{t@<~L=K`b0TfyU(s9rN?QlY>`cHaP8kU5YtBd04cBfs}(Wk zgO8L8(;-Vu`_ukysUDh$j3On82ML5vb?ECIo4=aMYR>tDyiPptZp%-*cghLqzLZR2Sgq*MISv0D`UpWjb&Ac*P81W z!36&jf<%xx4U244%WNzIVb{5|r;=^wvw8@Mq%H~?HZHqZ0kLzlR0CHyU|91?!FU8g zq(gJ=)Idv8wbEBZhVNU#Mt9Kg3I~zh@eN1cphmH=Wlne|f_|U#)PM;&-$g*PNIV(u z+j2(d-hel5{+ko#nky;|r5&^KluqKT0_u+#WPh;%#LZjzxX&U@Q7sL!H5|>F#`w?; zS6U-X|As!6>Nql|&R+C;_9O=PlD+&(WOh7?xN;Hi^5k&$bWdzxdG@sFCCs#kft790 zC3i-s6L2#~=xf3Jq_YVcM`pacq1)_JB^#1F>hZ|2DKfh#({u2q*In2LA=H CXIgXs diff --git a/packages/auctex/bib-cite.el b/packages/auctex/bib-cite.el deleted file mode 100644 index afd7aa2d5..000000000 --- a/packages/auctex/bib-cite.el +++ /dev/null @@ -1,2622 +0,0 @@ -;;; bib-cite.el --- test -;; bib-cite.el - Display \cite, \ref or \label / Extract refs from BiBTeX file. - -;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2003, 2004, 2005 -;; Free Software Foundation - -;; Author: Peter S. Galbraith -;; Created: 06 July 1994 -;; Version: 3.28 (Feb 23 2005) -;; Keywords: bibtex, cite, auctex, emacs, xemacs - -;;; This file is not part of GNU Emacs. - -;; This package is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This package is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, -;; Boston, MA 02110-1301, USA. - -;; LCD Archive Entry: -;; bib-cite|Peter Galbraith|GalbraithP@dfo-mpo.gc.ca| -;; Display \cite, \ref or \label / Extract refs from BiBTeX file.| -;; 21-May-1997|3.01|~/misc/bib-cite.el.gz| - -;; ---------------------------------------------------------------------------- -;;; Commentary: -;; This minor-mode is used in various TeX modes to display or edit references -;; associated with \cite commands, or matching \ref and \label commands. - -;; New versions of this package (if they exist) may be found at: -;; http://people.debian.org/~psg/elisp/bib-cite.el -;; and in AUCTeX's CVS archive at -;; http://savannah.gnu.org/cgi-bin/viewcvs/auctex/auctex/ - -;; Operating Systems: -;; Works in unix, DOS and OS/2. Developped under Linux. - -;; AUCTeX users: -;; AUCTeX is a super-charged LaTeX mode for emacs. Get it at: -;; -;; ftp://ftp.gnu.org/pub/gnu/auctex/ -;; -;; WWW users may want to check out the AUCTeX page at -;; http://www.gnu.org/software/auctex/ -;; -;; bib-cite.el is included in the AUCTeX distribution. Therefore, if -;; you use AUCTeX and didn't obtained bib-cite.el separately, make sure -;; that you are actually using the more recent version. - -;; RefTeX users: -;; RefTeX is a package with similar functions to bib-cite. -;; http://www.astro.uva.nl/~dominik/Tools/reftex/ -;; RefTeX is bundled and preinstalled with Emacs since version 20.2. -;; It was also bundled with XEmacs 19.16--20.x. -;; -;; I suggest that you use RefTeX to help you type-in text as it's functions -;; are better suited to this task than bib-cite, and use bib-cite's features -;; when you proof-read the text. -;; If you wish bib-cite to use RefTeX's reftex-view-crossref command to -;; display and find \label's and \cite bibliography entries, set the variable -;; bib-cite-use-reftex-view-crossref to t. - -;; MS-DOS users: -;; Multifile documents are supported by bib-cite by using etags (TAGS files) -;; which contains a bug for MSDOS (at least for emacs 19.27 it does). -;; Get the file -;; http://people.debian.org/~psg/elisp/bib-cite.etags-bug-report -;; to see what patches to make to etags.c to fix it. - -;; Description: -;; ~~~~~~~~~~~ -;; This package is used in various TeX modes to display or edit references -;; associated with \cite commands, or matching \eqref, \ref and \label -;; commands (so I actually overstep BiBTeX bounds here...). -;; -;; These are the functions: -;; -;; bib-display bib-display-mouse -;; - Display citation, \ref or \label under point -;; bib-find bib-find-mouse -;; - Edit citation, \ref or \label under point -;; bib-find-next - Find next occurrence of a \ref or \eqref -;; bib-make-bibliography - Make BiBTeX file containing only cite keys used. -;; bib-apropos - Search BiBTeX source files for keywords. -;; bib-etags - Refreshes (or builds) the TAGS files for -;; multi-file documents. -;; bib-create-auto-file - Used in bibtex-mode to create cite key -;; completion .el file for AUCTeX. -;; bib-highlight-mouse - Highlight \cite, \ref and \label commands in -;; green when the mouse is over them. - -;; About Cite Commands and related functions: -;; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -;; Various flavors of \cite commands are allowed (as long as they contain -;; the word `cite') and they may optionally have bracketed [] options. -;; Bibtex Cross-references are displayed, and @string abbreviations are -;; substituted or included. -;; -;; The \cite text is found (by emacs) in the bibtex source files listed in the -;; \bibliography command. The BiBTeX files can be located in a search path -;; defined by an environment variable (typically BIBINPUTS, but you can change -;; this). -;; -;; All citations used in a buffer can also be listed in a new bibtex buffer by -;; using bib-make-bibliography. This is useful to make a bibtex file for a -;; document from a large bibtex database. In this case, cross-references are -;; included, as well as the @string commands used. The @string abbreviations -;; are not substituted. -;; -;; The bibtex files can also be searched for entries matching a regular -;; expression using bib-apropos. - -;; Usage instructions: -;; ~~~~~~~~~~~~~~~~~~ -;; bib-display Bound to Mouse-3 when specially highlighted. -;; In Hyperbole, bound to the Assist key. -;; Bound to `\C-c b d' -;; -;; bib-display will show the bibtex entry or the corresponding label or -;; ref commands from anywhere within a document. -;; With cursor on the \cite command itslef -;; -> display all citations of the cite command from the BiBTeX source. -;; With cursor on a particular cite key within the brackets -;; -> display that citation's text from the BiBTeX source file(s). -;; -;; Example: -;; -;; \cite{Wadhams81,Bourke.et.al87,SchneiderBudeus94} -;; ^Cursor -> Display-all-citations ^Cursor -> Display-this-citation -;; -;; With cursor on a \label command -;; -> Display first matching \ref command in the document -;; With cursor on a \ref command -;; -> Display environment associated with the matching \label command. -;; -;; Finding a ref or label within a multi-file document requires a TAGS file, -;; which is automatically generated for you. This enables you to then use -;; any tags related emacs features. -;; -;; bib-find Bound to Mouse-2 when specially highlighted. -;; In Hyperbole, bound to the Action key. -;; Bound to `\C-c b f' -;; -;; bib-find will select the buffer and move point to the BiBTeX source file -;; at the proper citation for a cite command, or move point to anywhere -;; within a document for a label or ref command. The ref chosen is the -;; first occurrance within a document (using a TAGS file). If point is -;; moved within the same buffer, mark is set before the move and a message -;; stating so is given. If point is moved to another file, this is done in -;; a new window using tag functions. -;; -;; The next occurrence of a \ref or \eqref command may be found by invoking -;; bib-find-next, usually bound to `C-c b n'. -;; -;; For multi-file documents, you must be using AUCTeX (so that bib-cite can -;; find the master file) and all \input and \include commands must be first -;; on a line (not preceeded by any non-white text). -;; -;; bib-make-bibliography: Bound to `\C-c b m' -;; -;; Extract citations used in the current document from the \bibliography{} -;; file(s). Put them into a new suitably-named buffer. In a AUCTeX -;; multi-file document, the .aux files are used to find the cite keys (for -;; speed). You will be warned if these are out of date. -;; -;; This buffer is not saved to a file. It is your job to save it to whatever -;; name you wish. Note that AUCTeX has a unique name space for LaTeX and -;; BiBTeX files, so you should *not* name the bib file associated with -;; example.tex as example.bib! Rather, name it something like -;; example-bib.bib. -;; -;; bib-apropos: Bound to `\C-c b a' -;; -;; Searches the \bibliography{} file(s) for entries containing a keyword and -;; display them in the *help* buffer. You can trim down your search by using -;; bib-apropos in the *Help* buffer after the first invocation. the current -;; buffer is also searched for keyword matches if it is in bibtex-mode. -;; -;; It doesn't display cross-references nor does it substitute or display -;; @string commands used. It could easily be added, but it's faster this -;; way. Drop me a line if this would be a useful addition. -;; -;; If you find yourself entering a cite command and have forgotten which key -;; you want, but have entered a few initial characters as in `\cite{Gal', -;; then invoke bib-apropos. It will take that string (in this case `Gal') as -;; an initial response to the apropos prompt. You are free to edit it, or -;; simply press carriage return. -;; -;; bib-etags: Bound to `\C-c b e' -;; -;; Creates a TAGS file for AUCTeX's multi-file document (or refreshes it). -;; This is used by bib-find when editing multi-file documents. The TAGS file -;; is created automatically, but it isn't refreshed automatically. So if -;; bib-find can't find something, try running bib-etags again. -;; -;; bib-create-auto-file: -;; -;; Use this when editing a BiBTeX buffer to generate the AUCTeX .el file -;; which tell emacs about all its cite keys. I've added this command to -;; bibtex-mode pull-down menu. -;; -;; bib-highlight-mouse: Bound to `\C-c b h' -;; -;; Highlights \cite, \ref and \label commands in green when the mouse is over -;; them. By default, a call to this function is added to LaTeX-mode-hook -;; (via bib-cite-initialize) if you set bib-highlight-mouse-t to true. But -;; you may want to run this command to refresh the highlighting for newly -;; edited text. - -;; Installation instructions: -;; ~~~~~~~~~~~~~~~~~~~~~~~~~ -;; bib-cite is a minor-mode, so you could invoke it in a LaTeX-mode hook. -;; e.g. If you are using AUCTeX (http://www.gnu.org/software/auctex/), you -;; could use: -;; -;; (autoload 'turn-on-bib-cite "bib-cite") -;; (add-hook 'LaTeX-mode-hook 'turn-on-bib-cite) -;; -;; If you are using Emacs' regular LaTeX-mode, use instead: -;; -;; (autoload 'turn-on-bib-cite "bib-cite") -;; (add-hook 'latex-mode-hook 'turn-on-bib-cite) -;; -;; bib-cite can be used with AUCTeX, or stand-alone. If used with AUCTeX on a -;; multi-file document (and AUCTeX's parsing is used), then all \bibliography -;; commands in the document will be found and used. -;; --- -;; The following variable can be unset (like shown) to tell bib-cite to -;; not give advice messages about which commands to use to find the next -;; occurrence of a search: -;; -;; (setq bib-novice nil) -;; --- -;; If you wish bib-cite to use RefTeX's reftex-view-crossref command to -;; display and find \label's and \cite bibliography entries, set the variable -;; bib-cite-use-reftex-view-crossref to t: -;; -;; (setq bib-cite-use-reftex-view-crossref t) -;; --- -;; The following variable determines whether we will attempt to highlight -;; citation, ref and label commands in green when they are under the -;; mouse. When highlighted, the mouse keys work to call bib-display -;; (bound to [mouse-3]) and bib-find (bound to [mouse-2]). If you use a -;; mode other than LaTeX-mode, you'll want to call bib-highlight-mouse with -;; a hook (See how we do this at the end of this file with the add-hook -;; command). -;; -;; (setq bib-highlight-mouse-t nil) -;; --- -;; The variable bib-switch-to-buffer-function sets the function used to -;; select buffers (if they differ from the original) in bib-cite commands -;; bib-make-bibliography, bib-display, bib-find -;; You may use `switch-to-buffer' `switch-to-buffer-other-window' or -;; `switch-to-buffer-other-frame'. -;; --- -;; If you use DOS or OS/2, you may have to set the following variable: -;; -;; (setq bib-dos-or-os2-variable t) -;; -;; if bib-cite.el fails to determine that you are using DOS or OS/2. -;; Try `C-h v bib-dos-or-os2-variable' to see if it needs to be set manually. -;; --- -;; bib-cite needs to call the etags program with its output file option -;; and also with the append option (usually -a). -;; I figured that DOS and OS/2 would use "etags /o=" instead of the unix -;; variant "etags -o ", but users have reported differently. So while the -;; unix notation is used here, you can reset it if you need to like so: -;; -;; (setq bib-etags-command "etags /r='/.*\\\(eq\|page\|[fvF]\)ref.*/' /o=") -;; (setq bib-etags-append-command -;; "etags /r='/.*\\\(eq\|page\|[fvF]\)ref.*/' /a /o=") -;; --- -;; For multi-file documents, a TAGS file is generated by etags. -;; By default, its name is TAGS. You can change this like so: -;; -;; (setq bib-etags-filename "TAGSLaTeX") -;; --- -;; If your environment variable to find BiBTeX files is not BIBINPUTS, then -;; reset it with the following variable (here, assuming it's TEXBIB instead): -;; -;; (setq bib-bibtex-env-variable "TEXBIB") -;; -;; Note that any directory ending in a double slash will cause bib-cite to -;; search recursively through subdirectories for your .bib files. This can -;; be slow, so use this judiciously. -;; e.g. setenv BIBINPUTS .:/home/psg/LaTeX/bibinputs// -;; -> all directories below /home/psg/LaTeX/bibinputs/ will be -;; searched. -;; -;; If your bibtex setup works but Emacs can't see the environment variable -;; correctly (Check `C-h v process-environment'), then customize the -;; variable `bib-cite-inputs' (e.g. `M-x customize-variable bib-cite-imputs') -;; -;; --- -;; If you do not wish bib-display to substitute @string abbreviations, -;; then set the following variable like so: -;; -;; (setq bib-substitute-string-in-display nil) -;; --- -;; Warnings are given when @string abbreviations are not defined in your bib -;; files. The exception is for months, usually defined in style files. If you -;; use other definitions in styles file (e.g. journals), then you may add them -;; to the `bib-substitute-string-in-display' list variable. - -;; If you find circumstances in which this package fails, please let me know. - -;; Things for me to do in later versions: -;; - treat @Strings correctly, not just in isolation. -;; - use `kpsewhich -expand-path='$BIBINPUTS'` instead of BIBINPUTS. -;; - jmv@di.uminho.pt (Jose Manuel Valenca) wants: -;; - prompt for \cite as well as \label and \ref -;; (and use AUCTeX's completion list) -;; - implement string concatenation, with #[ \t\n]*STRING_NAME -;; - Create new command to substitute @string text in any bibtex buffer. -;; ---------------------------------------------------------------------------- -;;; Change log: -;; V3.28 Feb 23 2005 - Ralf Angeli -;; - Some doc fixes in the commentary section. -;; V3.27 Feb 09 2005 - PSG -;; - Patch from Peter Heslin. TeX-master can now have symbol values. -;; V3.26 Aug 06 2004 - Reiner Steib -;; - Changed URL of AUCTeX. Use "AUCTeX", not "auc-tex" (skipped Change log). -;; V3.25 Feb 15 2004 - PSG -;; - Check existence of font-lock-unset-defaults; no longer defined in CVS -;; Emacs. Thanks to Adrian Lanz for reporting the problem. -;; V3.24 Oct 28 2003 - PSG -;; - bib-cite-file-directory-p: new function to replace ff-paths code. -;; V3.23 Oct 09 2003 - PSG -;; - some checkdoc cleanup; not yet complete. -;; V3.22 Sep 17 2003 - PSG -;; - bib-cite-aux-inputs: new defcustom. -;; - minor cleanup for `match-string'. -;; V3.21 Sep 08 2003 - PSG -;; - Ripping out off-topic imenu code. -;; V3.20 Aug 14 2003 - PSG -;; - psg-checkfor-file-list: Allow for relative directoties as entries in -;; BIBINPUTS. -;; - bib-cite-inputs: new defcustom equivalent to BIBINPUTS. -;; - bib-label-help-echo-format: fixed defcustom. -;; - psg-list-env: code cleanup. -;; - trailing whitespace cleanup. -;; V3.19 Apr 06 2003 - PSG -;; Remove code that ran when defcustom not present. -;; Remove hilit19 obsolete code. -;; V3.18 Mar 27 2003 - Bruce Ravel -;; Play well with the varioref and fancyref latex styles (vref, fref, Fref). -;; V3.17 May 01 2001 - (RCS V1.38) -;; - XEmacs has imenu after all. -;; V3.16 Dec 20 99 - (RCS V1.37) -;; - Added customize support. -;; V3.15 Dec 20 99 - (RCS V1.36) -;; - Removed stupid debugging code that I had left in. -;; V3.14 Dec 20 99 - -;; - New variable bib-ref-regexp for \ref regexp to match \label constructs -;; and added \pageref. (RCS V1.34) -;; - Edited bib-etags-command snd bib-etags-append-command to match. -;; V3.13 Dec 20 99 - (RCS V1.32) -;; - License changed to GPL. -;; - Kai Engelhardt bib-master-file takes .ltx extension -;; - imenu--create-LaTeX-index-for-document and bib-document-TeX-files -;; edited to accept .ltx extension. -;; - Michael Steiner added journals to @string -;; abbrevs and contributed `member-cis' to complaces @strings in a -;; case-insensitive manner. -;; V3.12 Dec 10 98 - Bruce Ravel (RCS V1.30) -;; Fixed bib-label-help. -;; V3.11 Oct 06 98 - PSG (RCS V1.29) -;; Quote \ character fot replace-match; -;; Applies to: @String{JGR = "J. Geophys.\ Res."} -;; V3.10 Sep 21 98 - Matt Hodges (RCS V1.28) -;; Removed instance of expand-file-name due to new behaviour in Emacs-20.3. -;; V3.09 Sep 09 98 - PSG (RCS V1.27) -;; Added support for \eqref; Added bib-find-next. -;; V3.08 Aug 20 98 - PSG (RCS V1.26) -;; Fixed imenu bug (prev-pos (point-max)) -;; V3.07 Nov 20 97 - Christoph Wedler (RCS V1.24) -;; bib-ext-list variable made permanent-local, otherwise VC registration -;; would use two extents for each reference etc. This was not a visible bug. -;; V3.06 Nov 12 97 - PSG (RCS V1.23) -;; Support use of reftex's reftex-view-crossref command. -;; V3.05 Nov 12 97 - Vladimir Alexiev (RCS V1.22) -;; regexp-quote the bibliography keys so a key like galbraith+kelley97 works -;; V3.04 Aug 25 97 - Christoph Wedler (RCS V1.20) -;; (bib-highlight-mouse): Would bug out on detached extents, -;; e.g. when killing a whole citation. -;; V3.03 Jul 16 97 - Christoph Wedler (RCS V1.18) -;; turn-on-bib-cite back to non-interactive. -;; V3.02 Jul 11 97 - Christoph Wedler (RCS V1.17) -;; * auctex/bib-cite.el (turn-on-bib-cite): Make interactive. -;; Argument to `bib-cite-minor-mode' is 1. -;; (bib-label-help-echo-format): New variable. -;; (bib-label-help-echo): New function. -;; (bib-label-help): Addition argument format. -;; (bib-highlight-mouse): Set extent property `help-echo' for XEmacs. -;; V3.01 May 22 97 - Diego Calvanese (RCS V1.16) -;; bib-make-bibliography handles commas separated citations in aux files. -;; V3.00 May 16 97 - Peter Galbraith (RCS V1.15) -;; bib-cite is now a minor mode. -;; V2.32 Apr 30 97 - Anders Stenman (RCS V1.14) -;; - Support for balloon-help. -;; V2.31 Mar 20 97 - Christoph Wedler (RCS V1.12) -;; - Better fontification of help buffer as bibtex or latex for XEmacs. -;; V2.30 Feb 10 97 - Peter Galbraith (RCS V1.11) -;; - Better fontification of help buffer as bibtex or latex. -;; V2.29 Jan 29 97 - Peter Galbraith (RCS V1.10) -;; - imenu looks for `\label{stuff}' instead of `\label' -;; V2.28 Jan 22 97 - Peter Galbraith (RCS V1.9) -;; - Bug in bib-create-auto-file. -;; V2.27 Dec 31 96 - Peter Galbraith (RCS V1.8) -;; - allow spaces between cite keys. -;; - Vladimir Alexiev -;; Allow () delimiters as well as {}. -;; Better check on bibtex-menu -;; Erase *bibtex-bibliography* buffer. -;; V2.26 Sep 24 96 - Peter Galbraith (RCS V1.7) -;; imenu bug fix. -;; V2.25 Sep 23 96 - Anders Stenman (RCS V1.6) -;; XEmacs bib-cite-fontify-help-as-latex bug fix. -;; V2.24 Aug 19 96 - Peter Galbraith (RCS V1.3) -;; XEmacs bug fix, minor defvars - Vladimir Alexiev -;; V2.23 Aug 13 96 - Peter Galbraith (RCS V1.2) -;; XEmacs - Add bib-cite entries to bibtex-mode popup menu. -;; V2.22 July 22 96 - Peter Galbraith (RCS V1.1) -;; local-map has `m' for bib-make-bibliography instead of `b' -;; set-buffer-menubar in XEmacs so that menu disappears after use. -;; V2.21 July 12 96 - Peter Galbraith -;; Define `\C-c b' keymap for both plain tex and auctex, in XEmacs and emacs. -;; Separate menu-bar menu in gnu emacs. -;; font-lock support for bib-display'ed citations (bibtex fontification) -;; and for matching \ref{} and \labels (latex fontification). -;; buffer-substring-no-properties in bib-apropos -;; (bug in completing-read with mouse faces) -;; imenu-sort-function made local and nil. -;; imenu--LaTeX-name-and-position fixed for section name containing "\" -;; Various other things... (whitespace within label strings, etc...) -;; V2.20 June 25 96 - Peter Galbraith -;; imenu fixed for emacs-19.31. -;; V2.19 May 13 96 -;; PSG: -;; - @string substitution fixed; bib-edit-citation fixed when buffer exists; -;; Christoph Wedler : -;; - Added bib-switch-to-buffer-function -;; - (setq tags-always-exact nil) for xemacs -;; - removed eval-after-load foe xemacs -;; V2.18 May 06 96 - PSG -;; New eval-after-load from Fred Devernay -;; V2.17 May 03 96 - PSG -;; Fixed bug introduced in V2.16, reported by Dennis Dams -;; V2.16 May 02 96 - Vladimir Alexiev -;; - somewhat compatible with Hyperbole by binding bib-find and bib-display to -;; the Action and Assist keys inside the bib-highlight-mouse-keymap. -;; - makes more liberal provisions for users with a tty. -;; V2.15 Apr 09 96 - -;; - fix "Buffer read-only" error caused by mouse-face text properties -;; patch by Piet van Oostrum -;; - Use tmm non-X menu, patch by Vladimir Alexiev -;; - input{file.txt} would not work. -;; bug report: David Kastrup -;; V2.14 Feb 26 96 - PSG - define eval-after-load for xemacs -;; Frederic Devernay's suggestion. -;; V2.13 Feb 08 96 - Peter Galbraith - Fixed recursive use of bib-apropos. -;; V2.12 Jan 19 96 - Peter Galbraith -;; emacs-19.30's [down-mouse-1] is defined (rather than [mouse-1]), so -;; bib-highlight-mouse-keymap now has [down-mouse-1] defined to override it. -;; V2.11 Nov 21 95 - Peter Galbraith -;; - Fixed bib-create-auto-file when bib file loaded before LaTeX file. -;; - Michal Mnuk's better imenu labels menu -;; - [mouse-1] and [mouse-2] key defs for highlighted regions. -;; - Improve X menus. -;; - Skip over style files in bib-document-TeX-files. -;; - Add menus and mouse highlighting for xemacs -;; Anders Stenman Dima Barsky -;; - Check bib-use-imenu before calling LaTeX-hook-setq-imenu. -;; From: Kurt Hornik -;; - Remove mouse face properties before inserting new ones. -;; From: Peter Whaite -;; V2.10 Aug 17 95 - Peter Galbraith - fatal bugs in bib-make-bibliography. -;; V2.09 Jul 19 95 - Peter Galbraith -;; - Had introduced bug in search-directory-tree. synced with ff-paths.el. -;; V2.08 Jul 13 95 - Peter Galbraith -;; Fred Douglis says etags should be required -;; V2.07 Jul 04 95 - Peter Galbraith -;; - Minor changes with filename manipulations (careful with DOS...) -;; - Problem if auc-tex not already loaded -> LaTeX-mode-map -;; V2.06 Jul 03 95 - Peter Galbraith - Added recursion through BIBINPUTS path. -;; V2.05 Jun 22 95 - Peter Galbraith Bug: Hanno Wirth -;; bib-get-citations would truncate @String{KEY ="J. {\"u} Res."} -;; V2.04 Jun 19 95 - Peter Galbraith - -;; - use bibtex-mode syntax table in bib buffer, else bib-apropos truncates -;; an article if it contains an unbalanced closing parenthesis. -;; - bib-highlight-mouse would mark a buffer modified -;; V2.03 May 16 95 - Peter Galbraith - -;; auc-tec menu compatible with old "AUC TeX" pull-down name -;; V2.02 May 10 95 - Peter Galbraith - -;; bug report by Bodo Huckestein (getenv env) under DOS -;; V2.01 Mar 27 95 - Peter Galbraith - No imenu on xemacs; check BIBINPUT also -;; V2.00 Mar 27 95 - Peter Galbraith -;; - bib-find and bib-display replace bib-edit-citation and -;; bib-display-citation -;; - bib-apropos now take initial guess from start of cite argument at point. -;; - Multi-file support for bib-make-bibliography using .aux files. -;; - \label and \ref functionality for bib-find and bib-display: -;; - \label may appear within an \begin\end or to label a (sub-)section. -;; - Cursor on \label, goto first \ref, set next i-search to pattern. -;; - Cursor on \ref, goto \label or display it's environment or section. -;; - Works on hidden code! -;; V1.08 Jan 16 95 - Peter Galbraith -;; bib-apropos can be used within *Help* buffer to trim a search. -;; V1.07 Dec 13 94 - Peter Galbraith -;; - Fixed: multi-line @string commands in non-inserted display. -;; - Fixed: quoted \ character in @string commands. -;; - BiBTeX comments should not affect bib-cite -;; - Fixed bib-apropos (from Christoph Wedler ) -;; Faster now, and avoids infinite loops. -;; - Added bib-edit-citation to edit a bibtex files about current citation. -;; - Allow space and newlines between citations: \cite{ entry1, entry2} -;; - Added bib-substitute-string-in-display, bib-string-ignored-warning -;; and bib-string-regexp. -;; - bib-display-citation (from Markus Stricker ) -;; Could not find entry with trailing spaces -;; V1.06 Nov 20 94 - Peter Galbraith -;; - Fixed bib-apropos for: -;; hilighting without invoking bibtex mode. -;; display message when no matches found. -;; would search only last bib file listed (forgot to `goto-char 1') -;; - Fixed bib-make-bibliography that would only see first citation in a -;; multi-key \cite command (found by Michail Rozman -;; - bib-make-bibliography didn't see \cite[A-Z]* commands. -;; Found by Richard Stanton -;; ************************************************** -;; - * Completely rewritten code to support crossrefs * -;; ************************************************** -;; - autodetection of OS/2 and DOS for bib-dos-or-os2-variable -;; - Created bib-display-citation-mouse -;; - bib-apropos works in bibtex-mode on the current buffer -;; - bibtex entry may have comma on next line (!) -;; @ARTICLE{Kiryati-91 -;; , YEAR = {1991 } -;; ... -;; V1.05 Nov 02 94 - Peter Galbraith -;; - bug fix by rossmann@TI.Uni-Trier.DE (Jan Rossmann) -;; for (boundp 'TeX-check-path) instead of fboundp. Thanks! -;; - Translate environment variable set by bib-bibtex-env-variable. -;; (suggested by Richard Stanton ) -;; - add bib-dos-or-os2-variable to set environment variable path separator -;; - Add key-defs for any tex-mode and auc-tex menu-bar entries. -;; [in auc-tec TeX-mode-map is common to both TeX and LaTeX at startup -;; (but TeX-mode-map is only copied to LaTeX-mode-map at initilisation) -;; in plain emacs, use tex-mode-map for both TeX and LaTeX.] -;; - Add key def for bibtex-mode to create auc-tex's parsing file. -;; - Fix bugs found by -;; - fix bib-get-citation for options -;; - fix bib-get-citation for commas preceeded citation command -;; - better regexp for citations and their keys. -;; - Added @string support for any entry (not just journal entries). -;; (I had to disallow numbers in @string keys because of years. -;; Is that ok?) -;; - added bib-apropos -;; V1.04 Oct 24 94 - Peter Galbraith -;; - Don't require dired-aux, rather define the function we need from it. -;; - Regexp-quote the re-search for keys. -;; - Name the bib-make-bibliography buffer diffently than LaTeX buffer -;; because auc-tex's parsing gets confused if same name base is used. -;; V1.03 Oct 24 94 - Peter Galbraith - require dired-aux for dired-split -;; V1.02 Oct 19 94 - Peter Galbraith -;; - If using auc-tex with parsing activated, use auc-tex's functions -;; to find all \bibliography files in a multi-file document. -;; - Find bib files in pwd, BIBINPUTS environment variable path and -;; TeX-check-path elisp variable path. -;; - Have the parser ignore \bibliography that is on a commented `%' line. -;; (patched by Karl Eichwalder ) -;; - Allow for spaces between entry type and key in bib files: -;; (e.g @Article{ key} ) -;; (suggested by Nathan E. Doss ) -;; - Allows options in \cite command (e.g. agu++ package \cite[e.g.][]{key}) -;; - Includes @String{} abbreviations for `journal' entries -;; V1.01 July 07 94 - Peter Galbraith - \bibliography command may have list of -;; BibTeX files. All must be readable. -;; V1.00 July 06 94 - Peter Galbraith - Created -;; ---------------------------------------------------------------------------- -;;; Code: - -(eval-when-compile (require 'cl)) - -(defgroup bib-cite nil - "bib-cite, LaTeX minor-mode to display \\cite, \\ref and \\label commands." - :group 'tex) - -(defcustom bib-cite-use-reftex-view-crossref nil - "*Non-nil means, RefTeX will be used to find cross references. -When this variable is non-nil, both `bib-find' and `bib-display' will -call a function in RefTeX to find or display the cross reference of a -\\ref or \\cite macro at point." - :group 'bib-cite - :type 'boolean) - -(defcustom bib-novice t - "*Give advice to novice users about what commands to use next." - :group 'bib-cite - :type 'boolean) - -(defcustom bib-switch-to-buffer-function 'switch-to-buffer - "*Function used to select buffers if they differ from the original. -You may use `switch-to-buffer' `switch-to-buffer-other-window' or -`switch-to-buffer-other-frame'." - :group 'bib-cite - :type '(choice (function-item switch-to-buffer) - (function-item switch-to-buffer-other-window) - (function-item switch-to-buffer-other-frame))) - -(defcustom bib-highlight-mouse-t t - "*Call bib-highlight-mouse from `LaTeX-mode-hook' to add green highlight." - :group 'bib-cite - :type 'boolean) - -(defcustom bib-label-help-echo-format "button2 finds %s, button3 displays %s" - "*Format string for info if the mouse is over LaTeX commands. -If nil, do not display info." - :group 'bib-cite - :type '(radio (const :tag "Don't display info" nil) - string)) - -(defcustom bib-bibtex-env-variable "BIBINPUTS" - "*Environment variable setting the path where BiBTeX input files are found. -BiBTeX 0.99b manual says this should be TEXBIB. -Another version says it should BSTINPUTS. I don't know anymore! - -The colon character (:) is the default path separator in unix, but you may -use semi-colon (;) for DOS or OS/2 if you set bib-dos-or-os2-variable to t." - :group 'bib-cite - :type 'string) - -(defcustom bib-cite-inputs nil - "*List of directories to search for .bib files. -This is in addition to those listed in the environment variable specified by -`bib-bibtex-env-variable'." - :group 'bib-cite - :type '(repeat (file :format "%v"))) - -(defcustom bib-cite-aux-inputs nil - "*List of directories to search for .aux files. -MiKTeX has the LaTeX option -aux-directory to store .aux files in an alternate -directory. You may set this variable to let bib-cite find these .aux files." - :group 'bib-cite - :type '(repeat (file :format "%v"))) - -(defcustom bib-dos-or-os2-variable (or (equal 'emx system-type) - (equal 'ms-dos system-type)) - ;; Under OS/2 system-type equals emx - ;; Under DOS system-type equals ms-dos - "*Whether you use DOS or OS/2 for bib-make-bibliography/bib-display. - -It tells bib-make-bibliography and bib-display to translate -the BIBINPUTS environment variable using the \";\" character as -a path separator and to translate DOS' backslash to slash. - -e.g. Use a path like \"c:\\emtex\\bibinput;c:\\latex\\bibinput\" - -\(You can change the environment variable which is searched by setting the elisp variable bib-bibtex-env-variable)" - :group 'bib-cite - :type 'boolean) - -(defcustom bib-etags-command "etags -r '/.*\\\\\\(eq\\|page\\|[fvF]\\)ref.*/' -o " - "*Variable for the etags command and its output option. -In unix, this is usually \"etags -r '/.*\\\(eq\|page\|[fvF]\)ref.*/' -o \" -\(we use the -r option to tell etags to list AMS-LaTeX's \\eqref command.) -In DOS and OS/2, this *may* be different, e.g. using slashes like \"etags /o=\" -If so, set it this variable." - :group 'bib-cite - :type 'string) - -(defcustom bib-etags-append-command "etags -r '/.*\\\\\\(eq\\|page\\|[fvF]\\)ref.*/' -a -o " - "*Variable for the etags command and its append and output option. -In unix, this is usually \"etags -r '/.*\\\(eq\|page\|[fvF]\)ref.*/' -a -o \" -In DOS and OS/2, this *may* be \"etags /a /o=\" If so, set it this variable." - :group 'bib-cite - :type 'string) - -(defcustom bib-etags-filename "TAGS" - "*Variable for the filename generated by etags, by defaults this TAGS. -but you may want to change this to something like TAGSLaTeX such that it can -coexist with some other tags file in your master file directory." - :group 'bib-cite - :type 'string) - -(defcustom bib-ref-regexp "\\\\\\(eq\\|page\\|[fvF]\\)?ref" - "*Regular expression for \\ref LaTeX commands that have a matching \\label. -without the curly bracket. - -If you change this variable and you use multi-file documents, make sure you -also edit the variables bib-etags-command and bib-etags-append-command." - :group 'bib-cite - :type 'regexp) - -(defcustom bib-substitute-string-in-display t - "*Determines if bib-display will substitute @string definitions. -If t, then the @string text is substituted. -If nil, the text is not substituted but the @string entry is included." - :group 'bib-cite - :type 'boolean) - -(defcustom bib-string-ignored-warning - '("jan" "feb" "mar" "apr" "may" "jun" "jul" "aug" "sep" "sept" "oct" "nov" - "dec" "acmcs" "acta" "cacm" "ibmjrd" "ibmjs" "ieeese" "ieeetcad" - "ieeetc" "ipl" "jacm" "jcss" "scp" "sicomp" "tcs" "tocs" "tods" "tog" - "toms" "toois" "toplas" ) - "*@string abbreviations for which a warning is not given if not defined. -These are usually month abbreviations (or journals) defined in a style file." - :group 'bib-cite - :type '(repeat (string :tag "Entry"))) - -;;<<<<< (prefix-numeric-value arg) 0) - (not bib-cite-minor-mode))) - (cond - (bib-cite-minor-mode ;Setup the minor-mode - ;; Christoph Wedler's suggestion for xemacs - ;; Added for version 2.19 - (if (boundp 'tags-always-exact) - (progn - (make-local-variable 'tags-always-exact) - (setq tags-always-exact nil))) - ;; mouse overlay - (if bib-highlight-mouse-t - (progn - (bib-cite-setup-highlight-mouse-keymap) - (bib-highlight-mouse) - (make-local-hook 'after-change-functions) - (add-hook 'after-change-functions - 'bib-cite-setup-mouse-function nil t))) - (if bib-cite-is-XEmacs - (progn - (or (local-variable-p 'current-menubar (current-buffer)) - (set-buffer-menubar current-menubar)) - (add-submenu nil bib-cite-minor-mode-menu)))) - (t - ;;;Undo the minor-mode - ;; mouse overlay - (cond - (bib-cite-is-XEmacs - (while bib-ext-list - (delete-extent (car bib-ext-list)) - (setq bib-ext-list (cdr bib-ext-list)))) - (t - (remove-hook 'after-change-functions 'bib-cite-setup-mouse-function t) - (let ((before-change-functions) (after-change-functions)) - ;; FIXME This detroys all mouse-faces and local-maps! - ;; FIXME Hope no other package is using them in this buffer! - (remove-text-properties (point-min) (point-max) - '(mouse-face t local-map t))))) - (if bib-cite-is-XEmacs - (delete-menu-item '("BCite")))))) - -;;This must be eval'ed when the LaTeX mode is in use. -;; bib-highlight-mouse-keymap is a local variable so each buffer can have it's -;; own. -(defun bib-cite-setup-highlight-mouse-keymap () - "Set up the bib-cite text in the current buffer to be clickable." - (make-local-variable 'bib-highlight-mouse-keymap) - (setq bib-highlight-mouse-keymap - ;;; First, copy the local keymap so we don't have `disappearing' menus - ;;; when the mouse is moved over a \ref, \label or \cite command. - - ;;; FIXME: Check out (mouse-major-mode-menu) to see how it grabs the local - ;;; menus to display. Maybe on `highlighted' commands we could only - ;;; display the bib-cite stuff (or a subset of it). - (let ((m (copy-keymap (current-local-map)))) - (cond - (bib-cite-is-XEmacs - (set-keymap-name m 'bib-highlight-mouse-keymap) - (cond - ;;action-key stuff from Vladimir Alexiev - ((commandp 'action-key) - ;; for hyperbole. The Right Way is to define implicit buttons - ;; (defib) bib-cite and label-ref instead of overriding - ;; action-key and assist key, so that eg smart key help can - ;; be obtained, but I'm lazy. - (substitute-key-definition 'action-key 'bib-find m global-map) - (substitute-key-definition 'assist-key 'bib-display m global-map) - (substitute-key-definition 'action-key-depress - 'bib-find-mouse m global-map) - (substitute-key-definition 'assist-key-depress - 'bib-display-mouse m global-map) - (substitute-key-definition 'action-mouse-key nil m global-map) - (substitute-key-definition 'assist-mouse-key nil m global-map)) - (t ; xemacs, not hyperbole - (define-key m "\e\r" 'bib-find-mouse) ; bug Fixed in V2.17 - (define-key m "\e\n" 'bib-display-mouse) ;bug Fixed in V2.17 - ;;(define-key m [(shift button1)] 'bib-display-mouse) - (define-key m [button3] 'bib-display-mouse) - (define-key m [button2] 'bib-find-mouse)))) - (t ; emacs 19 - (cond - ((commandp 'action-key) - (substitute-key-definition 'action-key 'bib-find m global-map) - (substitute-key-definition 'assist-key 'bib-display m global-map) - (substitute-key-definition 'action-mouse-key-emacs19 - 'bib-find-mouse m global-map) - (substitute-key-definition 'assist-mouse-key-emacs19 - 'bib-display-mouse m global-map) - (substitute-key-definition 'action-key-depress-emacs19 - nil m global-map) - (substitute-key-definition 'assist-key-depress-emacs19 - nil m global-map)) - (t ; emacs 19, not hyperbole - (define-key m [down-mouse-3] 'bib-display-mouse) - (define-key m [mouse-2] 'bib-find-mouse))))) - m))) - -;;;###autoload -(defun turn-on-bib-cite () - "Unconditionally turn on Bib Cite mode." - (bib-cite-minor-mode 1)) - -(defun bib-cite-setup-mouse-function (beg end old-len) - (save-excursion - (save-match-data - (save-restriction - (narrow-to-region - (progn (goto-char beg) (beginning-of-line) (point)) - (progn (goto-char end) (forward-line 1) (point))) - (bib-highlight-mouse))))) - -(defvar bib-cite-minor-mode-map - (let ((map (make-sparse-keymap))) - (define-key map "\C-cba" 'bib-apropos) - (define-key map "\C-cbb" 'bib-make-bibliography) - (define-key map "\C-cbd" 'bib-display) - (define-key map "\C-cbe" 'bib-etags) - (define-key map "\C-cbf" 'bib-find) - (define-key map "\C-cbn" 'bib-find-next) - (define-key map "\C-cbh" 'bib-highlight-mouse) - map) - "Bib-cite minor-mode keymap.") - -(easy-menu-define - bib-cite-minor-mode-menu bib-cite-minor-mode-map "Menu keymap for bib-cite." - '("BCite" - ["Make BibTeX bibliography buffer" bib-make-bibliography t] - ["Display citation or matching \\ref or \\label" bib-display t] - ["Find BibTeX citation or matching \\ref or \\label" bib-find t] - ["Search apropos BibTeX files" bib-apropos t] - ["Build TAGS file for multi-file document" bib-etags (bib-master-file)] - ["Refresh \\cite, \\ref and \\label mouse highlight" - bib-highlight-mouse t])) - -;; Install ourselves: -(or (assq 'bib-cite-minor-mode minor-mode-alist) - (setq minor-mode-alist - (cons '(bib-cite-minor-mode " BCite") minor-mode-alist))) -(or (assq 'bib-cite-minor-mode minor-mode-map-alist) - (setq minor-mode-map-alist - (cons (cons 'bib-cite-minor-mode bib-cite-minor-mode-map) - minor-mode-map-alist))) - - -;;; Add a menu entry to bibtex.el (Perhaps I should not do this). -(cond - ((and (string-match "XEmacs\\|Lucid" emacs-version) - (or window-system - (fboundp 'smart-menu))) ;text menus by Bob Weiner - ;; - ;; xemacs under X with AUCTeX - ;; - - ;; Add to bibtex.el's popup menu - (defvar bib-cite-xemacs-bibtex-mode-menu - '("---" - "Bib-Cite" - "---" - ["Search apropos BibTeX files" bib-apropos t] - ["Create AUCTeX auto parsing file" bib-create-auto-file t]) - "Submenu of bibtex-mode menu, used by bib-cite.") - - (if (boundp 'bibtex-menu) - ;; Add menu now - (setq bibtex-menu - (append - bibtex-menu - bib-cite-xemacs-bibtex-mode-menu)) - ;; Setup to add menu later - (defun bib-cite-bibtex-mode-hook () - (if (boundp 'bibtex-menu) - (progn - (setq bibtex-menu - (append - bibtex-menu - bib-cite-xemacs-bibtex-mode-menu)) - (remove-hook 'bibtex-mode-hook 'bib-cite-bibtex-mode-hook)))) - (add-hook 'bibtex-mode-hook 'bib-cite-bibtex-mode-hook)) - ) - - ((and (not (string-match "XEmacs\\|Lucid" emacs-version)) - (string-equal "19" (substring emacs-version 0 2)) - (or window-system - (fboundp 'tmm-menubar))) ; 19.30 - Will autoload if necessary - ;; - ;; emacs-19 under X-windows (or non-X with tmm) - ;; - - ;; This *almost* makes me want to switch over to XEmacs... - - ;; to AUCTeX auto file for a bibtex buffer - (eval-after-load - "bibtex" - '(progn - (cond - ((lookup-key bibtex-mode-map [menu-bar move/edit]) - (define-key-after - (lookup-key bibtex-mode-map [menu-bar move/edit]) - [bib-nil] '("---" . nil) '"--") - (define-key-after - (lookup-key bibtex-mode-map [menu-bar move/edit]) - [bib-apropos] '("Search Apropos" . bib-apropos) 'bib-nil) - (define-key-after - (lookup-key bibtex-mode-map [menu-bar move/edit]) - [auc-tex-parse] - '("Create AUCTeX auto parsing file" . bib-create-auto-file) - 'bib-apropos)) - ((lookup-key bibtex-mode-map [menu-bar bibtex-edit]) - (define-key-after - (lookup-key bibtex-mode-map [menu-bar bibtex-edit]) - [bib-nil] '("---" . nil) '"--") - (define-key-after - (lookup-key bibtex-mode-map [menu-bar bibtex-edit]) - [bib-apropos] '("Search Apropos" . bib-apropos) 'bib-nil) - (define-key-after - (lookup-key bibtex-mode-map [menu-bar bibtex-edit]) - [auc-tex-parse] - '("Create AUCTeX auto parsing file" . bib-create-auto-file) - 'bib-apropos))))))) - -;; Following from bibtex.el -(defvar - bib-cite-bibtex-font-lock-keywords - '(("^\\( \\|\t\\)*\\(@[A-Za-z]+\\)[ \t]*[({]\\([][A-Za-z0-9.:;?!`'()/*@_+=|<>-]+\\)?" - (2 font-lock-function-name-face) - (3 font-lock-reference-face nil t)) - ;; reference type and reference label - ("^[ \t]*\\(OPT[^\"#%'(),={} \t\n0-9][^\"#%'(),={} \t\n]*\\)[ \t]*=" - 1 font-lock-comment-face) - ;; optional field names (treated as comments) - ("^[ \t]*\\([^\"#%'(),={} \t\n0-9][^\"#%'(),={} \t\n]*\\)[ \t]*=" - 1 font-lock-variable-name-face) - ;; field names - "Default expressions to fontify in BibTeX mode.")) - -(defvar bib-cite-bibtex-mode-syntax-table - (let ((st (make-syntax-table))) - ;; [alarson:19920214.1004CST] make double quote a string quote - (modify-syntax-entry ?\" "\"" st) - (modify-syntax-entry ?$ "$$ " st) - (modify-syntax-entry ?% "< " st) - (modify-syntax-entry ?' "w " st) - (modify-syntax-entry ?@ "w " st) - (modify-syntax-entry ?\\ "\\" st) - (modify-syntax-entry ?\f "> " st) - (modify-syntax-entry ?\n "> " st) - (modify-syntax-entry ?~ " " st) - st)) -;; Code from bibtex.el ends - -;; @string starts with a letter and does not contain any of ""#%'(),={} -;; Here we do not check that the field contains only one string field and -;; nothing else. -(defvar bib-string-regexp - "^[, \t]*[a-zA-Z]+[ \t]*=[ \t]*\\([a-zA-Z][^#%'(),={}\" \t\n]*\\)" - "Regular expression for field containing a @string.") - -(defun bib-display () - "Display BibTeX citation or matching \\ref or \\label command under point. - -If text under cursor is a \\cite command, then display its BibTeX info from -\\bibliography input file. - Example with cursor located over cite command or arguments: - \cite{Wadhams81,Bourke.et.al87,SchneiderBudeus94} - ^Display-all-citations ^Display-this-citation - -If text under cursor is a \\ref command, then display environment associated -with its matching \\label command. - -If text under cursor is a \\label command, then display the text around -the first matching \\ref command. - -The user is prompted for a \\label or \\ref is nothing suitable is found under -the cursor. The first prompt is for a label. If you answer with an empty -string, a second prompt for a ref will be given. - -A TAGS file is created and used for multi-file documents under auctex." - (interactive) - (let ((cite)(ref)(label)) - (save-excursion - (if (not (looking-at "\\\\")) - (search-backward "\\" nil t)) - (if (looking-at bib-ref-regexpc) - (setq ref t) - (if (looking-at "\\\\label{") - (setq label t) - (setq cite t)))) - (cond - ;; reftex doesn't handle label->ref - ((and bib-cite-use-reftex-view-crossref - (or ref cite)) - ;;;FIXME: reftex doesn't want point on \ref or \cite part, but on keyword - (require 'reftex) - (reftex-view-crossref nil)) - (cite - (bib-display-citation)) - (t - (bib-display-label))))) - -(defun bib-find () - "Edit BibTeX citation or find matching \\ref or \\label command under point. - -For multi-entry cite commands, the cursor should be on the actual cite key -desired (otherwise a random entry will be selected). -e.g.: \cite{Wadhams81,Bourke.et.al87,SchneiderBudeus94} - ^Display-this-citation - -If text under cursor is a \\ref command, then point is moved to its matching -\\label command. - -If text under cursor is a \\label command, then point is moved to the first -matching \\ref command. - -The user is prompted for a \\label or \\ref is nothing suitable is found under -the cursor. The first prompt is for a label. If you answer with an empty -string, a second prompt for a ref will be given. - -A TAGS file is created and used for multi-file documents under auctex." - (interactive) - (let ((cite)(ref)(label)) - (save-excursion - (if (not (looking-at "\\\\")) - (search-backward "\\" nil t)) - (if (looking-at bib-ref-regexpc) - (setq ref t) - (if (looking-at "\\\\label{") - (setq label t) - (setq cite t)))) - (cond - ;; reftex doesn't handle label->ref - ((and bib-cite-use-reftex-view-crossref - (or ref cite)) - (require 'reftex) - (reftex-view-crossref t)) - (cite - (bib-edit-citation)) - (t - (bib-find-label))))) - -(defvar bib-cite-search-ring nil - "Bib-cite intenal variable to hold last \\ref or \\eqref find.") - -(defun bib-find-next (&optional prev-p) - "Find next occurrence of a \ref or \eqref. -This is made necessary because we now use a regexp to find tags in multi-file -documents, and the Emacs command `find-tag' doesn't allow to interactively -find the next occurrence of a regexp." - (interactive "P") - (if (bib-master-file) ;Multi-file document - (if prev-p - (find-tag t '- t) - (find-tag t t t)) - (if bib-cite-search-ring - ;;FIXME: Should first make sure I move off initial \ref{}. - (let ((regexp (concat bib-ref-regexpc bib-cite-search-ring "}"))) - (if prev-p - (if (not (re-search-backward regexp nil t)) - (message "No previous occurrence of reference %s" - bib-cite-search-ring)) - (if (not (re-search-forward regexp nil t)) - (message "No next occurrence of reference %s" - bib-cite-search-ring)))) - (message "Sorry, no previous reference to find. Use bib-find?")))) - -(defun bib-display-mouse (EVENT) - "Display BibTeX citation or matching \\ref or \\label under mouse EVENT. -See bib-display." - (interactive "e") - (mouse-set-point EVENT) - (bib-display)) - -(defun bib-find-mouse (EVENT) - "Edit BibTeX citation or find matching \\ref or \\label under mouse EVENT. -See bib-find." - (interactive "e") - (mouse-set-point EVENT) - (bib-find)) - -(defun bib-apropos () - "Display BibTeX entries containing a keyword from bibliography file. -The files specified in the \\bibliography command are searched unless -the current buffer is in `bibtex-mode' or is the Help buffer. In those -cases, *it* is searched. This allows you to trim down a search further -by using bib-apropos sequentially." - ;;(interactive "sBibTeX apropos: ") - (interactive) - (let* ((keylist (and (boundp 'TeX-auto-update) ;Avoid error in FRAMEPOP - (fboundp 'LaTeX-bibitem-list) ;Use this if using auctex - (LaTeX-bibitem-list))) - (keyword (bib-apropos-keyword-at-point)) - (keyword (completing-read "BiBTeX apropos: " keylist nil nil keyword)) - (the-text)(key-point)(start-point) - (new-buffer-f (and (not (string-match "^bib" mode-name)) - (not (string-equal "*Help*" (buffer-name))))) - (bib-buffer (or (and new-buffer-f (bib-get-bibliography nil)) - (current-buffer)))) - (save-excursion - (set-buffer bib-buffer) - (goto-char (point-min)) - (while (and (re-search-forward "^[ \t]*@" nil t) - (re-search-forward keyword nil t)) - (setq key-point (point)) ;To make sure this is within entry - (re-search-backward "^[ \t]*@" nil t) - (setq start-point (point)) - (forward-list 1) - (if (< (point) key-point) ;And this is that test... - (goto-char key-point) ;Not within entry, skip it. - (setq the-text - (cons (concat (buffer-substring start-point (point)) "\n") - the-text)))) - (if (not the-text) - (message "Sorry, no matches found.") - (with-output-to-temp-buffer "*Help*" - (mapcar 'princ (nreverse the-text))) - (bib-cite-fontify-help-as-bibtex) - (if bib-novice - (message - (substitute-command-keys - (concat "Use \\[bib-apropos] again in the *help* buffer" - " to trim the search"))))) - (if new-buffer-f - (kill-buffer bib-buffer))))) - -(defvar bib-document-citekeys-obarray-warnings nil - "Bib-cite internal variable.") - -(defun bib-make-bibliography () - "Extract citations used in the current document from \bibliography{} file(s). -Put them into a buffer named after the current buffer, with extension .bib. - -In an AUCTeX multi-file document, parsing must be on and the citation keys -are extracted from the .aux files. - -In a plain LaTeX buffer (not multi-file), the cite keys are extracted from -the text itself. Therefore the text need not have been previously processed -by LaTeX. - -This function is useful when you want to share a LaTeX file, and therefore want -to create a bibtex file containing only the references used in the document." - (interactive) - (let* ((the-keys-obarray (or (bib-document-citekeys-obarray) - (bib-buffer-citekeys-obarray))) - ;1st in case of error - (new-buffer - (create-file-buffer - (concat (substring (buffer-name) 0 - (or (string-match "\\." (buffer-name)) - (length (buffer-name)))) - "-bib.bib"))) - (bib-buffer (bib-get-bibliography nil)) - (the-warnings (bib-get-citations the-keys-obarray - bib-buffer - new-buffer - nil))) - (kill-buffer bib-buffer) -;;; (switch-to-buffer new-buffer) - (funcall bib-switch-to-buffer-function new-buffer) - (bibtex-mode) - (if (or bib-document-citekeys-obarray-warnings - the-warnings) - (progn - (cond - ((and bib-document-citekeys-obarray-warnings the-warnings) - (with-output-to-temp-buffer "*Help*" - (princ bib-document-citekeys-obarray-warnings the-warnings))) - (bib-document-citekeys-obarray-warnings - (with-output-to-temp-buffer "*Help*" - (princ bib-document-citekeys-obarray-warnings))) - (the-warnings - (with-output-to-temp-buffer "*Help*" (princ the-warnings)))) - (setq bib-document-citekeys-obarray-warnings nil) ;Reset - (bib-cite-fontify-red))) - (if bib-novice - (message - (substitute-command-keys - "Use \\[save-buffer] to save this buffer to a file."))))) - -(defun bib-cite-fontify-red (&optional limit) - "Fontify *Help* buffer in red-bold up to optional LIMIT." - (if (and window-system ;Not exactly correct for XEmacs - (not (facep 'red-bold))) - (progn - (copy-face 'bold 'red-bold) - (set-face-foreground 'red-bold "red"))) - (save-excursion - (set-buffer "*Help*") - (let ((before-change-functions) (after-change-functions)) - (put-text-property (point-min)(or limit (point-max)) - 'face 'red-bold)))) - -(defun bib-cite-fontify-help-xemacs (defaults) - (if (fboundp 'font-lock-set-defaults-1) ; >= XEmcas 19.14 - (progn - (set-buffer "*Help*") - (setq font-lock-defaults-computed nil - font-lock-keywords nil) - (font-lock-set-defaults-1 - (and defaults (font-lock-find-font-lock-defaults defaults))) - (font-lock-fontify-buffer) - (setq font-lock-defaults-computed nil - font-lock-keywords nil) - (font-lock-set-defaults-1)))) - -(defun bib-cite-fontify-help-as-bibtex () - (save-excursion - (cond - ((not (featurep 'font-lock)) - nil) ;No font-lock! Stop here. - ;; font-lock under Emacs and XEmacs - ((string-match "XEmacs\\|Lucid" emacs-version) - ;; XEmacs - (bib-cite-fontify-help-xemacs 'bibtex-mode)) - (t - ;; Emacs - (set-buffer "*Help*") - (let ((font-lock-defaults - '(bib-cite-bibtex-font-lock-keywords - nil t ((?$ . "\"")(?\" . "."))))) - (if font-lock-mode - (font-lock-mode) - (if (fboundp 'font-lock-unset-defaults) (font-lock-unset-defaults)) - (font-lock-unfontify-buffer)) - (font-lock-fontify-buffer)))))) - -(defun bib-cite-fontify-help-as-latex () - (save-excursion - (cond - ((not (featurep 'font-lock)) - nil) ;No font-lock! Stop here. - ;; font-lock under Emacs and XEmacs - ((string-match "XEmacs\\|Lucid" emacs-version) - ;; XEmacs, not necessary to do s.th. special for font-latex, we do *not* - ;; want the buffer-local faces! - (bib-cite-fontify-help-xemacs 'latex-mode)) - (t - ;; Emacs - (set-buffer "*Help*") - ;; Actually, don't want to `permanently' affect *Help* buffer... - ;;(if (featurep 'font-latex) - ;; (font-latex-setup) - ;; Rather I should deal with this in the `let' form: - ;; (make-local-variable 'font-lock-string-face) - ;; (setq font-lock-string-face font-latex-math-face - ;; font-latex-string-face (default-value 'font-lock-string-face)) - (let ((font-lock-defaults - (if (featurep 'font-latex) - '((font-latex-keywords font-latex-keywords-1 - font-latex-keywords-2) - nil nil ((?\( . ".") (?\) . ".") (?$ . "\"")) nil - (font-lock-comment-start-regexp . "%") - (font-lock-mark-block-function . mark-paragraph)) - '(tex-font-lock-keywords nil nil ((?$ . "\"")))))) - (if font-lock-mode - (font-lock-mode) - (if (fboundp 'font-lock-unset-defaults) (font-lock-unset-defaults)) - (font-lock-unfontify-buffer)) - (font-lock-fontify-buffer)))))) - -(defvar bib-document-TeX-files-warnings nil - "Bib-cite internal variable.") - -(defun bib-etags (&optional masterdir) - "Invoke etags on all tex files of the document in directory MASTERDIR. -Store the TAGS file in the master-directory. -Expect errors if you use this outside of auctex or within a plain -single-file document. Also makes sure that the TAGS buffer is updated. -See variables bib-etags-command and bib-etags-filename" - (interactive) - (require 'etags) - (let* ((the-file-list (bib-document-TeX-files)) - (the-file (car the-file-list)) - (dir (or masterdir (bib-master-directory))) - (the-tags-file (expand-file-name bib-etags-filename dir)) - (the-tags-buffer (get-file-buffer the-tags-file))) - ;; Create TAGS file with first TeX file (master file) - (shell-command (concat bib-etags-command the-tags-file " " the-file)) - (setq the-file-list (cdr the-file-list)) - ;; Append to TAGS file for all other TeX files. - (while the-file-list - (setq the-file (car the-file-list)) - (shell-command - (concat bib-etags-append-command the-tags-file " " the-file)) - (setq the-file-list (cdr the-file-list))) - (if the-tags-buffer ;buffer existed; we must refresh it. - (save-excursion - (set-buffer the-tags-buffer) - (revert-buffer t t))) - - ;; Check value of tags-file-name against the-tags-file - (or (equal the-tags-file tags-file-name) ;make sure it's current - (visit-tags-table the-tags-file)) - - ;(set (make-local-variable 'tags-file-name) the-tags-file)) - ;; above should not be needed - - ;; Weird Bug: - ;; (visit-tags-table-buffer) seems to get called twice when called by - ;; find-tag on an undefined tag. The second time, it's in the TAGS - ;; buffer and returns an error because TAGS buffer does have - ;; tags-file-name set. - ;; To get around this. I'm setting this variable in the TAGS buffer. - ;; Skip this in XEmacs (Changed by Anders Stenman) - (if (and (not (string-match "XEmacs\\|Lucid" emacs-version)) - (get-file-buffer the-tags-file)) - (save-excursion - (set-buffer (get-file-buffer the-tags-file)) - (set (make-local-variable 'tags-file-name) the-tags-file)))) - - - (if bib-document-TeX-files-warnings ;free variable loose in emacs! - (progn - (with-output-to-temp-buffer "*Help*" - (princ bib-document-TeX-files-warnings)) - (setq bib-document-TeX-files-warnings nil) ;Reset - (bib-cite-fontify-red)))) - -(defun bib-Is-hidden () - "Return true is current point is hidden." - (if (not selective-display) - nil ;Not hidden if not using this... - (save-excursion - (if (not (re-search-backward "[\n\^M]" nil t)) - nil ;Play safe - (if (string-equal (match-string 0) "\n") - nil - t))))) - -(defun bib-highlight-mouse () - "Make that nice green highlight when the mouse is over LaTeX commands." - (interactive) -;;;Comment this out. User should be able to use bib-highlight-mouse -;;;to try it out regardless of bib-highlight-mouse-t. -;;;Check bib-highlight-mouse-t only in automated cases. -;;; -;;; (if (and bib-highlight-mouse-t -;;; ;;window-system) ;Do nothing unless under X -;;; ) -;;; *all of code was here* -;;; ) - (save-excursion - (let ((s)(e)(extent)(local-extent-list bib-ext-list) - (inhibit-read-only t) - (modified (buffer-modified-p))) ;put-text-property changing this? - ;; * peta Wed Nov 8 16:27:29 1995 -- better remove the mouse face - ;; properties first. - (setq bib-ext-list nil) ;Reconstructed below... - (if (string-match "XEmacs\\|Lucid" emacs-version) - (while local-extent-list - (setq extent (car local-extent-list)) - (if (or (extent-detached-p extent) - (and (<= (point-min)(extent-start-position extent)) - (>= (point-max)(extent-end-position extent)))) - (delete-extent extent) - (setq bib-ext-list (cons extent bib-ext-list))) - (setq local-extent-list (cdr local-extent-list))) - ;; Remove properties for regular emacs - ;; FIXME This detroys all mouse-faces and local-maps! - ;; FIXME Hope no other package is using them in this buffer! - (let ((before-change-functions) (after-change-functions)) - (remove-text-properties (point-min) (point-max) - '(mouse-face t local-map t)))) - (goto-char (point-min)) - (while - (re-search-forward - (concat - "\\\\\\(" (substring bib-ref-regexp 2) - "\\|label\\|[A-Za-z]*cite[A-Za-z]*\\(\\[.*\\]\\)?\\){[^}]*}") - nil t) - (setq s (match-beginning 0)) - (setq e (match-end 0)) - (cond - ((string-match "XEmacs\\|Lucid" emacs-version) - (setq extent (make-extent s e)) - (setq bib-ext-list (cons extent bib-ext-list)) - (set-extent-property extent 'highlight t) - (set-extent-property extent 'start-open t) - (set-extent-property extent 'balloon-help 'bib-label-help) - (set-extent-property extent 'help-echo 'bib-label-help-echo) - (set-extent-property extent 'keymap bib-highlight-mouse-keymap)) - (t - (let ((before-change-functions) (after-change-functions) - ;;(this-overlay (make-overlay s e)) - ) -;;; Even using overlays doens't help here. If bib-highlight-mouse-keymap -;;; does not include the AucTeX menus, then these disappear when we click -;;; onto a \cite command. Perhaps using bib-cite as a minor mode will fix -;;; this? For now, bib-cite must be loaded after these menus are built. -;;; It must therefore be loaded in a mode-hook. - (put-text-property s e 'local-map bib-highlight-mouse-keymap) - (put-text-property s e 'mouse-face 'highlight) - ;;(overlay-put this-overlay 'local-map bib-highlight-mouse-keymap) - ;;(overlay-put this-overlay 'mouse-face 'highlight) - )))) - (set-buffer-modified-p modified)))) - -(defun bib-toggle-highlight () - "Toggle the enabling of bib-cite entries as clickable things." -;; FIXME: do something about after-change stuff? - (interactive) - (if (setq bib-highlight-mouse-t (not bib-highlight-mouse-t)) - (bib-highlight-mouse) - (let ((modified (buffer-modified-p)) - (inhibit-read-only t)) - (cond - ((string-match "XEmacs\\|Lucid" emacs-version) - (while bib-ext-list - (delete-extent (car bib-ext-list)) - (setq bib-ext-list (cdr bib-ext-list)))) - (t - (let ((before-change-functions) (after-change-functions)) - (remove-text-properties (point-min) (point-max) - '(mouse-face local-map))))) - (set-buffer-modified-p modified)))) - -(defun bib-label-help-echo (object) - (if bib-label-help-echo-format - (bib-label-help object bib-label-help-echo-format))) - -;;; Balloon-help callback. Anders Stenman -;;; Patched by Bruce Ravel -(defun bib-label-help (object &optional format) - (or format (setq format "Use mouse button 2 to find the %s. -Use mouse button 3 to display the %s.")) - (save-match-data - (let* ((string (extent-string object)) - (type (cond ((string-match "^\\\\[A-Za-z]*cite[A-Za-z]*" string) "citation") - ((string-match - (concat "^" bib-ref-regexp) string) "\\label{}") - ((string-match "^\\\\label" string) "\\ref{}") - (t "this (unknown) reference")))) - (format format type type)))) - -;;---------------------------------------------------------------------------- -;; Routines to display or edit a citation's bibliography - -(defun bib-display-citation () - "Do the displaying of cite info. Return t if found cite key, nil otherwise. -Example with cursor located over cite command or arguments: -\cite{Wadhams81,Bourke.et.al87,SchneiderBudeus94} - ^Display-all-citations ^Display-this-citation" - (save-excursion - (let* ((the-keys-obarray (bib-get-citekeys-obarray)) ;1st in case of error - (work-buffer (get-buffer-create "*bibtex-work*")) - (bib-buffer (bib-get-bibliography nil)) - (the-warnings (bib-get-citations - the-keys-obarray - bib-buffer - work-buffer - bib-substitute-string-in-display)) - (the-warn-point)) - (if the-warnings - (progn - (set-buffer work-buffer) - (goto-char 1) - (insert the-warnings) - (setq the-warn-point (point)))) - (with-output-to-temp-buffer - "*Help*" - (set-buffer work-buffer) - (princ (buffer-substring 1 (point-max)))) - (bib-cite-fontify-help-as-bibtex) - (if the-warn-point - (bib-cite-fontify-red the-warn-point)) - (kill-buffer bib-buffer) - (kill-buffer work-buffer)))) - -(defun bib-edit-citation () - "Do the edit of cite info. Return t if found cite key, nil otherwise. -Find and and put edit point in bib file associated with a BibTeX citation -under cursor from \bibliography input file. -In a multi-entry cite command, the cursor should be on the actual cite key -desired (otherwise a random entry will be selected). -e.g.: \cite{Wadhams81,Bourke.et.al87,SchneiderBudeus94} - ^Display-this-citation" - (let ((the-keys-obarray (bib-get-citekeys-obarray)) ;1st in case of error - (bib-buffer (bib-get-bibliography t)) - (the-key)(the-file)) - (save-excursion - (mapatoms ;Do this for each cite-key found... - (lambda (cite-key) - (setq the-key (symbol-name cite-key))) - the-keys-obarray) - (set-buffer bib-buffer) - (goto-char (point-min)) - (if (not (re-search-forward - (concat "@[^{(]+[{(][\t ]*" (regexp-quote the-key) "[ ,\n]") - nil t)) - (progn - (kill-buffer bib-buffer) - (error "Sorry, could not find bib entry for %s" the-key)) - (re-search-backward "%%%Filename: \\([^\n]*\\)" nil t) - (setq the-file (match-string 1)) - (kill-buffer bib-buffer))) -;;; (find-file the-file) - (funcall bib-switch-to-buffer-function (find-file-noselect the-file)) - (goto-char (point-min)) ;V2.19 fix - (re-search-forward (concat "@[^{(]+[{(][\t ]*" - (regexp-quote the-key) - "[ ,\n]") nil t))) - -;;-------------------------------------------------------------------------- -;; Function for bib-apropos - -(defun bib-apropos-keyword-at-point () - "Return the keyword under point for initial input to bib-apropos prompt." - (save-excursion - (let ((here (point))) - (cond - ((and (re-search-backward "[\n{, ]" nil t) - (string-equal "{" (buffer-substring (match-beginning 0) - (match-end 0)))) - (if (fboundp 'buffer-substring-no-properties) - (buffer-substring-no-properties (1+ (point)) here) - (buffer-substring (1+ (point)) here))))))) - -;;-------------------------------------------------------------------------- -;; Functions for Displaying or moving to matching \ref or \label command - -(defun bib-display-label () -"Display environment or first ref associated with a label. -The label or ref name is extracted from the text under the cursor, or the -user is prompted is nothing suitable is found. The first prompt is for a -label. If you answer with an empty string, a second prompt for a ref will -be given." - (let ((the-regexp (bib-guess-or-prompt-for-label))) - (if (not the-regexp) - (message "No name given") - (bib-display-or-find-label the-regexp t)))) - -(defun bib-find-label () - "Move to a label, or the first occurance of a ref. -The label or ref name is extracted from the text under the cursor. -If nothing suitable is found, the user is prompted. The first prompt is for a -label. If you answer with an empty string, a second prompt for a ref will be -given. - -If within a single file document: - You can move back with C-xC-x as the mark is set before moving. - You can search for next occurrances of a ref command with C-sC-s. - -If within a multi-file document (in auctex only) - You can move back with C-xC-x if within the same buffer. If not, just - select your previous buffer. - You can search for next occurrances of a ref command with tag commands: - C-u M-. Find next alternate definition of last tag specified. - C-u - M-. Go back to previous tag found." - (let ((the-regexp (bib-guess-or-prompt-for-label))) - (if (not the-regexp) - (message "No name given") - (bib-display-or-find-label the-regexp nil)))) - -;;-------------------------------------------------------------------------- -;; Functions for Displaying or moving to matching \ref or \label command - -(defun bib-display-or-find-label (the-regexp displayf) -;; work horse for bib-find-label and bib-display-label - (let* ((masterfile (bib-master-file)) - (masterdir (and masterfile - (file-name-directory masterfile))) - (new-point)(new-buffer)) - (save-excursion - ;; Now we are either in a simple file, or with a multi-file document - (cond - (masterfile ;Multi-file document - (cond - (displayf ;Display only - (set-buffer (bib-etags-find-noselect the-regexp masterdir)) - (re-search-forward the-regexp nil t) - ;; ...because tags puts point on beginning of line - (if (string-match "^\\\\\\\\label" the-regexp) - (bib-display-this-environment) ;display the label's environment - (bib-display-this-ref))) ; display the ref's context - (t ;Move to it - (setq new-buffer (bib-etags-find-noselect the-regexp masterdir)) - (if bib-novice - (message - (substitute-command-keys - (concat "Use \\[bib-find-next] to find the next occurrence " - "and C-u \\[bib-find-next] to find previous.")))) - (if (equal new-buffer (current-buffer)) - (setq new-point (point)))))) ;Moving with the same buffer - (t ;Single-file document - (goto-char (point-min)) - (cond - ((re-search-forward the-regexp nil t) - (if displayf - (if (string-match "^\\\\label" the-regexp) - (bib-display-this-environment) ;Display the environment - (bib-display-this-ref)) ; display the ref's context - (setq new-point (match-beginning 0)) ;or move there - (if (string-match "{\\(.*\\)}" the-regexp) - (setq bib-cite-search-ring (match-string 1 the-regexp))) - (if bib-novice - (message - (substitute-command-keys - (concat "Use \\[bib-find-next] to find the next occurrence " - "and C-u \\[bib-find-next] to find previous.")))))) - (t - (message "Sorry, cannot find it (%s)" the-regexp)))))) - (if new-point - (progn - (push-mark (point) t nil) ;We've moving there... push mark - (goto-char new-point)) - (if new-buffer ;We've changing buffer - ;;(switch-to-buffer new-buffer) - (funcall bib-switch-to-buffer-function new-buffer))) - (if (bib-Is-hidden) - (save-excursion - (beginning-of-line) - (show-entry))))) - -(defvar bib-label-prompt-map nil) -(if bib-label-prompt-map - () - (setq bib-label-prompt-map (copy-keymap minibuffer-local-completion-map)) - (define-key bib-label-prompt-map " " 'self-insert-command)) - -(defun bib-guess-or-prompt-for-label () - "Guess from context, or prompt the user for a label command." - (save-excursion - (if (not (looking-at "\\\\")) ;If not on beginning of a command - (re-search-backward "[\\]" - (save-excursion (beginning-of-line)(point)) - t)) - (cond - ((looking-at bib-ref-regexpc) ;On \ref, looking for matching \label - (let ((b (progn (search-forward "{" nil t)(forward-char -1)(point))) - (e (progn (forward-sexp 1)(point)))) - (concat "\\\\label" (regexp-quote (buffer-substring b e))))) - ((looking-at "\\\\label{") ;On \label, looking for matching \ref - (let ((b (progn (search-forward "{" nil t)(forward-char -1)(point))) - (e (progn (forward-sexp 1)(point)))) - (concat bib-ref-regexp (regexp-quote (buffer-substring b e))))) - (t ;Prompt the user - (let* ((minibuffer-local-completion-map bib-label-prompt-map) - (the-alist (create-alist-from-list - (cdr (reverse LaTeX-label-list)))) - ;;; LaTeX-label-list example: - ;;; '(("label3" "label4")("label1" "label2") nil) - ;; so let's get rid of that nil part in embedded list. - (the-name - (if (string-equal "18" (substring emacs-version 0 2)) - (completing-read "Label: " the-alist nil nil nil) - (completing-read "Label: " the-alist nil nil nil - 'LaTeX-find-label-hist-alist)))) - (if (not (equal the-name "")) - (concat "\\\\label{" (regexp-quote the-name) "}") - ;; else try to get a \ref - (if (string-equal "18" (substring emacs-version 0 2)) - (setq the-name (completing-read "Ref: " the-alist nil nil nil)) - (setq the-name (completing-read "Ref: " the-alist nil nil nil - 'LaTeX-find-label-hist-alist))) - (if (not (equal the-name "")) - (concat bib-ref-regexpc (regexp-quote the-name) "}") - nil))))))) - -(defun bib-display-this-ref () - "Display a few lines around current point." - (cond - ((bib-Is-hidden) - (with-output-to-temp-buffer "*BiBTemp*" - (princ - (buffer-substring - (save-excursion - (let ((i 3)) - (while (and (> i 0) - (re-search-backward "[\n\^M]" nil t) - (setq i (1- i))))) - (point)) - (save-excursion - (let ((i 3)) - (while (and (> i 0) - (re-search-forward "[\n\^M]" nil t) - (setq i (1- i))))) - (point))))) - (set-buffer "*BiBTemp*") - (while (search-forward "\^M" nil t) - (replace-match "\n" nil t)) - (goto-char 1) - (if (looking-at "\n") ;Remove first empty line... - (delete-char 1)) - (with-output-to-temp-buffer "*Help*" - (princ (buffer-substring 1 (point-max)))) - (bib-cite-fontify-help-as-latex) - (kill-buffer "*BiBTemp*")) - (t - (with-output-to-temp-buffer ; display the ref's context - "*Help*" - (princ - (buffer-substring (save-excursion (forward-line -2)(point)) - (save-excursion (forward-line 3)(point))))) - (bib-cite-fontify-help-as-latex)))) - -(defun bib-display-this-environment () - "Display the environment associated with a label, or its section name. -Assumes point is already on the label. -Does not save excursion." -;; Bugs: The method used here to detect the environment is *not* foolproof. -;; It will get confused, for example, between two figure environments, -;; picking out both instead of the section label above them. But since -;; users typically puts their labels next to the section declaration, -;; I'm satisfied with this... for now. -;; I could have used the following AUCTeX functions: -;; LaTeX-current-environment -;; Function: Return the name (a string) of the enclosing LaTeX environment. -;; LaTeX-current-section -;; Function: Return the level of the section that contain point. -;; but then this code would only work as part of AUCTeX... - (let ((the-point (point)) - (end-point (point)) - (the-environment)(foundf)) - (while (and (not foundf) - (goto-char end-point) ;Past end of last search - (re-search-forward "\\(^\\|\^M\\)[ \t]*\\\\end{\\([^}]*\\)}" - nil t)) - (setq end-point (point)) - (setq the-environment (match-string 2)) - (and (not (string-match "document" the-environment)) - (re-search-backward (concat "\\(^\\|\^M\\)[ \t]*\\\\begin{" - (regexp-quote the-environment) "}")) - (<= (point) the-point) - (setq foundf t))) - (if foundf ;A good environment - (progn - (cond ((bib-Is-hidden) ;Better way is: replace-within-string - (with-output-to-temp-buffer "*BiBTemp*" - (princ (buffer-substring (point) end-point))) - (set-buffer "*BiBTemp*") - (while (search-forward "\^M" nil t) - (replace-match "\n" nil t)) - (goto-char 1) - (if (looking-at "\n") ;Remove first empty line... - (delete-char 1)) - (with-output-to-temp-buffer "*Help*" - (princ (buffer-substring 1 (point-max)))) - (kill-buffer "*BiBTemp*")) - (t - (with-output-to-temp-buffer "*Help*" - (princ (buffer-substring (point) end-point))))) - (bib-cite-fontify-help-as-latex)) - ;; Just find the section declaration - (goto-char the-point) - (if (re-search-backward -;;; "\\(^\\|\^M\\)[ \t]*\\\\\\(sub\\)*section{\\([^}]*\\)}" nil t) -;;; Michael Steiner patch - "\\(^\\|\^M\\)[ \t]*\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*?\ -{\\([^}]*\\)}" - nil t) - (message (match-string 0)) - (error - "Sorry, could not find an environment or section declaration"))))) - -(defvar LaTeX-find-label-hist-alist nil "History list for LaTeX-find-label.") -(defvar LaTeX-label-list nil "Used by AUCTeX to store label names.") - - -(defun create-alist-from-list (the-list) - "Return a single list from a THE-LIST that may contain either items or lists. -e.g. turns -'((\"label3\" \"label4\")(\"label1\" \"label2\") \"label\") -into -'((\"label3\") (\"label4\") (\"label1\") (\"label2\") (\"label\"))" - (mapcar 'list (bib-cite-mh-list-to-string the-list))) - -;;; -;;; Following two functions from mh-utils.el (part of GNU emacs) -;;; I have changed the names in case these functions change what they do. -;;; - -(defun bib-cite-mh-list-to-string (l) - "Flattens the list L and make every element of the new list into a string." - (nreverse (bib-cite-mh-list-to-string-1 l))) - -(defun bib-cite-mh-list-to-string-1 (l) - (let ((new-list nil)) - (while l - (cond ((null (car l))) - ((symbolp (car l)) - (setq new-list (cons (symbol-name (car l)) new-list))) - ((numberp (car l)) - (setq new-list (cons (int-to-string (car l)) new-list))) - ((equal (car l) "")) - ((stringp (car l)) (setq new-list (cons (car l) new-list))) - ((listp (car l)) - (setq new-list (nconc (bib-cite-mh-list-to-string-1 (car l)) - new-list))) - (t (error "Bad element in mh-list-to-string: %s" (car l)))) - (setq l (cdr l))) - new-list)) - -;; ------------------------------------------------------------------------- -;; Routines to extract cite keys from text - -;; ... is truly remarkable, as shown in \citeN{Thomson77,Test56}. Every -;; \cite[{\it e.g.}]{Thomson77,Test56} - -(defun bib-get-citations (keys-obarray bib-buffer new-buffer substitute) - "Put citations of KEYS-OBARRAY from BIB-BUFFER into NEW-BUFFER. -Substitute strings if SUBSTITUTE is t -Return the-warnings as text." - (let ((the-warnings) ;The only variable to remember... - (case-fold-search t)) ;All other results go into new-buffer - ;; bibtex is not case-sensitive for keys. - (save-excursion - (let ((the-text)) - (set-buffer bib-buffer) - (mapatoms ;Do this for each cite-key found... - (lambda (cite-key) - (goto-char (point-min)) - (if (re-search-forward - (concat "@[^{(]+[{(][\t ]*" - (regexp-quote (symbol-name cite-key)) - "\\([, ]\\\|$\\)") - ;; ^^ ^ comma, space or end-of-line - nil t) - (setq the-text (concat the-text - (buffer-substring - (progn (beginning-of-line)(point)) - (progn (forward-sexp 2)(point))) - "\n\n")) - (setq the-warnings (concat the-warnings - "Cannot find entry for: " - (symbol-name cite-key) "\n")))) - keys-obarray) - (if (not the-text) - (error "Sorry, could not find any of the references")) - ;; Insert the citations in the new buffer - (set-buffer new-buffer) - (insert the-text) - (goto-char 1)) - - ;; We are at beginning of new-buffer. - ;; Now handle crossrefs - (let ((crossref-obarray (make-vector 201 0))) - (while (re-search-forward - "[, \t]*crossref[ \t]*=[ \t]*\\(\"\\|\{\\)" nil t) - ;;handle {text} or "text" cases - (if (string-equal "{" (match-string 1)) - (re-search-forward "[^\}]+" nil t) - (re-search-forward "[^\"]+" nil t)) - (intern (match-string 0) crossref-obarray)) - ;; Now find the corresponding keys, - ;; but add them only if not already in `keys-obarray' - (set-buffer bib-buffer) - (goto-char 1) - (let ((the-text)) - (mapatoms ;Do this for each crossref key found... - (lambda (crossref-key) - (if (not (intern-soft (symbol-name crossref-key) keys-obarray)) - (progn - ;; Not in keys-obarray, so not yet displayed. - (goto-char (point-min)) - (if (re-search-forward - (concat "@[^{(]+[{(][\t ]*" - (regexp-quote (symbol-name crossref-key)) - "\\(,\\|$\\)") - nil t) - (setq the-text - (concat the-text - (buffer-substring - (progn (beginning-of-line)(point)) - (progn (forward-sexp 2)(point))) - "\n\n")) - (setq the-warnings - (concat the-warnings - "Cannot find crossref entry for: " - (symbol-name crossref-key) "\n")))))) - crossref-obarray) - ;; Insert the citations in the new buffer - (set-buffer new-buffer) - (goto-char (point-max)) - (if the-text - (insert the-text))) - (goto-char 1)) - - ;; Now we have all citations in new-buffer, collect all used @String keys - ;; Ex: journal = JPO, - (let ((strings-obarray (make-vector 201 0))) - (while (re-search-forward bib-string-regexp nil t) - (intern (match-string 1) strings-obarray)) - ;; Now find the corresponding @String commands - ;; Collect either the @string commands, or the string to substitute - (set-buffer bib-buffer) - (goto-char 1) - (let ((string-alist) - (the-text)) - (mapatoms ;Do this for each string-key found... - (lambda (string-key) - (goto-char (point-min)) - ;; search for @string{ key = {text}} or @string{ key = "text"} - (if (re-search-forward - (concat "^[ \t]*@string[{(]" - (regexp-quote (symbol-name string-key)) - "[\t ]*=[\t ]*\\(\"\\|\{\\)") - nil t) - (let ((the-string-start (1- (match-end 1))) ;catch bracket - ;;handle {text} or "text" cases - (the-string-end - (cond - ((string-equal "\"" (match-string 1)) - (re-search-forward "[^\\]\"" nil t) - (point)) - (t - (forward-char -1) - (forward-list 1) - (point))))) - (if substitute ;Collect substitutions - (setq string-alist - (append - string-alist - (list - (cons (symbol-name string-key) - ;(regexp-quote - (buffer-substring the-string-start - the-string-end)))));) - ;;Collect the strings command themseves - (setq the-text - (concat the-text - (buffer-substring - (progn (forward-char 1)(point)) - (re-search-backward "^[ \t]*@string[{(]" - nil t)) - "\n")))) - ;; @string entry not found - (if (not (member-cis (symbol-name string-key) - bib-string-ignored-warning)) - (setq the-warnings - (concat the-warnings - "Cannot find @String entry for: " - (symbol-name string-key) "\n"))))) - strings-obarray) - ;; Now we have `the-text' of @string commands, - ;; or the `string-alist' to substitute. - (set-buffer new-buffer) - (if substitute - (while string-alist - (goto-char 1) - (let* ((the-key (car (car string-alist))) - (the-string (cdr (car string-alist))) - (slashed-string ; "J. of Geo.\" -> "J. of Geo.\\\\" - (dired-replace-in-string - "\\\\" "\\\\" the-string))) - - (while (re-search-forward - (concat "\\(^[, \t]*[a-zA-Z]+[ \t]*=[ \t]*\\)" - (regexp-quote the-key) - "\\([, \t\n]\\)") - nil t) - (replace-match (concat "\\1" slashed-string "\\2") t nil))) - (setq string-alist (cdr string-alist))) - ;; substitute is nil; Simply insert text of @string commands - (goto-char 1) - (if the-text - (insert the-text "\n"))) - (goto-char 1)))) - - ;; We are done! - ;; Return the warnings... - the-warnings)) - -;;; Following contributed by Michael Steiner The -;; @string abbreviation are not case-sensitive, so we replaced the `member' -;; test above with `member-cis' defined here: -(defun member-cis (ELT LIST) - "Return non-nil if ELT is an element of LIST. -All elements should be strings. -Comparison is case-insensitive." - ;; If list is exhausted, - (if (null LIST) - nil ;; if null then we haven't found the element ... - ;; else split list and ... - (let((listelt (car LIST))(listrest (cdr LIST))) - ;; see if car is equal to ELT - (if (string-equal (downcase ELT) (downcase listelt)) - t ;; if so return true - ;; else recurse for rest of list - (member-cis ELT listrest))))) - -(defun bib-get-citekeys-obarray () - "Return obarray of citation key (within curly brackets) under cursor." - (save-excursion - ;; First find *only* a key *within a cite command - (let ((the-point (point)) - (keys-obarray (make-vector 201 0))) - ;; First try to match a cite command - (if (and (skip-chars-backward "a-zA-Z") ;Stops on \ or { - (looking-at "[a-zA-Z]*cite[a-zA-Z]*")) - (progn - ;;skip over any optional arguments to \cite[][]{key} command - (skip-chars-forward "a-zA-Z") - (while (looking-at "\\[") - (forward-list 1)) - (re-search-forward "{[ \n]*\\([^,} \n]+\\)" nil t) - (intern (match-string 1) keys-obarray) - (while (and (skip-chars-forward " \n") ;no effect on while - (looking-at ",")) - (forward-char 1) - ;;The following re-search skips over leading spaces - (re-search-forward "\\([^,} \n]+\\)" nil t) - (intern (match-string 1) keys-obarray))) - ;; Assume we are on the keyword - (goto-char the-point) - (let ((the-start (re-search-backward "[\n{, ]" nil t)) - (the-end (progn (goto-char the-point) - (re-search-forward "[\n}, ]" nil t)))) - (if (and the-start the-end) - (intern (buffer-substring (1+ the-start) (1- the-end)) - keys-obarray) - ;; Neither... - (error "Sorry, can't find a reference here")))) - keys-obarray))) - -(defun bib-buffer-citekeys-obarray () - "Extract citations keys used in the current buffer." - (let ((keys-obarray (make-vector 201 0))) - (save-excursion - (goto-char (point-min)) - ;; Following must allow for \cite[e.g.][]{key} !!! - ;; regexp for \cite{key1,key2} was "\\\\[a-Z]*cite[a-Z]*{\\([^,}]+\\)" - (while (re-search-forward "\\\\[a-zA-Z]*cite[a-zA-Z]*\\(\\[\\|{\\)" - nil t) - (backward-char 1) - (while (looking-at "\\[") ; ...so skip all bracketted options - (forward-sexp 1)) - ;; then lookup first key - (if (looking-at "{[ \n]*\\([^,} \n]+\\)") - (progn - (intern (match-string 1) keys-obarray) - (goto-char (match-end 1)) - (while (and (skip-chars-forward " \n") - (looking-at ",")) - (forward-char 1) - (re-search-forward "\\([^,} \n]+\\)" nil t) - (intern (match-string 1) keys-obarray))))) - (if keys-obarray - keys-obarray - (error "Sorry, could not find any citation keys in this buffer"))))) - -;;--------------------------------------------------------------------------- -;; Multi-file document programming requirements: -;; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -;; bib-make-bibliography -;; bib-document-citekeys-obarray needs the master .aux file to extract -;; citation keys. -;; Included .aux files (corresponding to \include'd LaTeX files) are -;; then specified relative to the master-file-directory. -;; -;; bib-get-bibliography (used by interactive commands to extract bib sources) -;; -;; bibtex source filenames are returned from (LaTeX-bibliography-list) -;; unformatted. Since only a single \bibliogragrphy command is allowed -;; by BiBTeX in a document, it is safe to assume that their path is -;; relative to the master file's directory (since the path is relative -;; to where the BiBTeX program is actually ran). -;; - -;; (See TeX-check-files, used in TeX-save-document. All documents related -;; files are returned by (TeX-style-list) and stored in TeX-active-styles. -;; Original idea was to search TeX-check-path for files listed in -;; TeX-active-styles (with possible relative or full paths) that end in .tex.) - -(defun bib-master-directory () - "Return the directory associated with the master file. -If no master file, then return current default." - (let ((masterfile (bib-master-file))) - (if masterfile - (file-name-directory (expand-file-name (TeX-master-file))) - default-directory))) - -(defun bib-master-file () - "Return master file full path, or nil if not a multi-file document." -;; I wish there were a better way to tell about non multi-file documents... - (let ((master - (cond - ((not (boundp 'TeX-master)) - ;; This buffer doesn't know what a master file is, so return now. - nil) - ((and TeX-master ;Set, but not to t - (not (symbolp TeX-master))) ; then we have an actual name - (expand-file-name TeX-master)) - ((and (eq TeX-master 't) ;Test if master file itself - (progn ;But also require at least one \include - (save-excursion - (goto-char 1) ;Too bad I have to do this search... - ;; Require that user uses \input{file} - ;; rather than \input file - (re-search-forward "^[ \t]*\\\\\\(include\\|input\\){" - nil t)))) - (buffer-file-name)) - (t - nil)))) - (cond - ((not master) - nil) - ((string-match ".\\(tex\\|ltx\\)$" master) - master) - ((file-readable-p (concat master ".ltx")) - (concat master ".ltx")) - (t - (concat master ".tex"))))) - -;; I don't use this one because files are not returned in order... -;; (defun bib-document-TeX-files () -;; ;; Return all tex input files associated with a known multi-file document. -;; (let ((master-directory (bib-master-directory)) -;; (the-list (cons (file-name-nondirectory (TeX-master-file)) -;; (TeX-style-list))) -;; ;; TeX-style-list returns "../master" for the main file if TeX-master -;; ;; was set like that. "../master" would not be found relative -;; ;; to the master-directory! So let's add it to the list w/o directory. -;; (the-result) -;; (the-file)) -;; (while the-list -;; (setq the-file (expand-file-name (car the-list) master-directory)) -;; (setq the-list (cdr the-list)) -;; (and (not (string-match ".tex$" the-file)) -;; (setq the-file (concat the-file ".tex"))) -;; (and (file-readable-p the-file) -;; (not (member the-file the-result)) ;listed already? -;; (setq the-result (cons the-file the-result)))) -;; the-result)) - -(defun bib-document-TeX-files () - "Return all tex input files associated with a *known* multi-file document. -For a multi-file document in auctex only. -No checking is done that this is a real multi-file document. -Sets global variable bib-document-TeX-files-warnings." - (setq bib-document-TeX-files-warnings nil) - (let* ((masterfile (bib-master-file)) - (dir (and masterfile (file-name-directory masterfile))) - (tex-buffer (get-buffer-create "*tex-document*")) - (the-list (list masterfile)) - (the-file)) - (if (not masterfile) - (progn - (kill-buffer tex-buffer) - (error - "Sorry, but this is not a multi-file document (Try C-u C-c C-n if using auctex)"))) - (save-excursion - (set-buffer tex-buffer) - ;; set its directory so relative includes work without expanding - (setq default-directory dir) - (insert-file-contents masterfile) - (goto-char (point-min)) - (while (re-search-forward "^[ \t]*\\\\\\(input\\|include\\){\\(.*\\)}" - nil t) - (let ((the-file (match-string 2))) - (if (string-match ".sty$" the-file) ;Skip over style files! - nil - (if (and (not (file-readable-p (expand-file-name the-file dir))) - (not (string-match ".ltx$" the-file)) - (file-readable-p - (expand-file-name (concat the-file ".ltx") dir))) - (setq the-file (concat the-file ".ltx"))) - (if (and (not (file-readable-p (expand-file-name the-file dir))) - (not (string-match ".tex$" the-file))) - (setq the-file (concat the-file ".tex"))) - (setq the-file (expand-file-name the-file dir)) - (if (not (file-readable-p the-file)) - (setq bib-document-TeX-files-warnings - (concat - bib-document-TeX-files-warnings - (format "Warning: File not found: %s" the-file))) - (setq the-list (cons (expand-file-name the-file dir) the-list)) - (end-of-line)(insert "\n") - (insert-file-contents the-file)))))) - (kill-buffer tex-buffer) - (nreverse the-list))) - -(defun bib-document-citekeys-obarray () - "Return cite keys obarray for multi-file document. -Return nil if not a multi-file document. -This is a AUCTeX supported feature only. -Also, see bib-buffer-citekeys-obarray. -Sets global variable bib-document-citekeys-obarray-warnings." - (setq bib-document-citekeys-obarray-warnings nil) - (let ((master-tex (bib-master-file)) - (master-aux)) - (if (not master-tex) - nil ;Not a multifile document. No need... - (setq master-aux (bib-return-aux-file-from-tex master-tex "aux")) - (or (file-readable-p master-aux) - (error "Sorry, cannot read file %s" master-aux)) - (and (file-newer-than-file-p master-tex master-aux) - (setq bib-document-citekeys-obarray-warnings - (format "Warning: %s is out of date relative to %s.\n" - master-aux master-tex))) - (let ((work-buffer (get-buffer-create "*bib-cite-work*")) - (keys-obarray (make-vector 201 0))) - (save-excursion - (set-buffer work-buffer) - (insert-file-contents master-aux) - ;; Because we will be looking for \input statements, we need to set - ;; the default directory to that of the master file. - (setq default-directory (file-name-directory master-tex)) - ;; bib-make-bibliography will need this also to find .bib files - ;; look for \@input{chap1/part1.aux} - (while (re-search-forward "^\\\\@input{\\(.*\\)}$" nil t) - (let* ((auxfile (match-string 1)) - (texfile (bib-return-aux-file-from-tex auxfile "tex"))) - (if (not (file-readable-p auxfile)) - (setq bib-document-citekeys-obarray-warnings - (concat - bib-document-citekeys-obarray-warnings - (format "Warning: %s is not found or readable.\n" - auxfile))) - (if (file-newer-than-file-p texfile auxfile) - (setq bib-document-citekeys-obarray-warnings - (concat - bib-document-citekeys-obarray-warnings - (format - "Warning: %s is out of date relative to %s.\n" - auxfile texfile)))) - (end-of-line)(insert "\n") - (insert-file-contents auxfile)))) - (goto-char 1) - -;;; Patched by calvanes@dis.uniroma1.it (Diego Calvanese) -;;; ;; look for \citation{gertsenshtein59} -;;; (while (re-search-forward "^\\\\citation{\\(.*\\)}$" nil t) -;;; (intern (buffer-substring (match-beginning 1)(match-end 1)) -;;; keys-obarray)) - ;; look for \citation{gertsenshtein59,vardi88,...,ullmann90} - ;; comma-separation generated by certain LaTeX styles. - (while (re-search-forward "^\\\\citation{\\(.*\\)}$" nil t) - (let ((string (match-string 1)) - (start 0)) - (while (string-match "\\([^,\n]+\\)" string start) - (intern (substring string (match-beginning 1) (match-end 1)) - keys-obarray) - (setq start (match-end 0)))))) - (kill-buffer work-buffer) - keys-obarray)))) - -(defun bib-return-aux-file-from-tex (texname ext) - "Given name.name.XXX in TEXNAME return name.name.EXT." -;; FIXME: Check if in ./, else search - (let* ((filename (if (string-match "\\(.*\\)\\.[^\\.]+" texname) - (concat (match-string 1 texname) "." ext) - (concat texname "." ext))) - (sansdir (file-name-nondirectory filename))) - (if (file-exists-p filename) - filename - ;; Search bib-cite-aux-inputs path - (let ((filename (psg-checkfor-file-list sansdir bib-cite-aux-inputs))) - (if (and filename (file-exists-p filename)) - filename - (error "Could not find file %s" sansdir)))))) - -(defun bib-etags-find-noselect (tag &optional masterdir) - "Returns a buffer with point on TAG. -Buffer is not selected. -Makes sure TAGS file exists, etc." - (require 'etags) - (let* ((master (or masterdir (bib-master-directory))) - (the-buffer (current-buffer)) - (new-buffer) - (the-tags-file-name (expand-file-name bib-etags-filename master))) - (or (file-exists-p the-tags-file-name) ;make sure TAGS exists - (bib-etags master)) - (or (equal the-tags-file-name tags-file-name) ;make sure it's current - (visit-tags-table the-tags-file-name)) - ;; find-tag-noselect should set the TAGS file for the new buffer - ;; that's what C-h f visit-tags-table says... - (cond - ((string-match "XEmacs\\|Lucid" emacs-version) - (find-tag tag) - (setq new-buffer (current-buffer)) - (set-buffer the-buffer)) - (t - (setq new-buffer (find-tag-noselect tag nil t)) - ; -> Seems to set buffer to TAGS - (set-buffer the-buffer))) - new-buffer)) - -;; -------------------------------------------------------------------------- -;; The following routines make a temporary bibliography buffer -;; holding all bibtex files found. - -(defun bib-get-bibliography (include-filenames-f) - "Returns a new bibliography buffer holding all bibtex files in the document. - -If using AUCTeX, and either TeX-parse-self is set or C-c C-n is used to -parse the document, then the entire multifile document will be searched -for \bibliography commands. - -If this fails, the current buffer is searched for the first \bibliography -command. - -If include-filenames-f is true, include as a special header the filename -of each bib file. - -Puts the buffer in text-mode such that forward-sexp works with german \" -accents embeded in bibtex entries." - (let ((bib-list (or (and (fboundp 'LaTeX-bibliography-list) - (boundp 'TeX-auto-update) - (LaTeX-bibliography-list)) -;; LaTeX-bibliography-list (if bound) returns an unformatted list of -;; bib files used in the document, but only if parsing is turned on -;; or C-c C-n was used. - (bib-bibliography-list))) - (bib-buffer (get-buffer-create "*bibtex-bibliography*")) - ;; Path is relative to the master directory - (default-directory (bib-master-directory)) - (the-name)(the-warnings)(the-file)) - (save-excursion - ;; such that forward-sexp works with embeeded \" in german, - ;; and unbalanced () - (set-buffer bib-buffer) - (erase-buffer) - (set-syntax-table text-mode-syntax-table) -;; (if (boundp 'bibtex-mode-syntax-table) -;; (set-syntax-table bibtex-mode-syntax-table) -;; (text-mode)) - ) - ;;We have a list of bib files - ;;Search for them, include them, list those not readable - (while bib-list - (setq the-name (car (car bib-list))) ;Extract the string only - (setq bib-list (cdr bib-list)) - (setq the-name - (substring the-name - (string-match "[^ ]+" the-name) ;remove leading spaces - (string-match "[ ]+$" the-name))) ;remove trailing space - (if (not (string-match "\\.bib$" the-name)) - (setq the-name (concat the-name ".bib"))) - (setq the-file - (or (and (file-readable-p the-name) the-name) - (psg-checkfor-file-list - the-name (psg-list-env bib-bibtex-env-variable)) - ;; Check for BIBINPUT env variable as well (by popular demand!) - (psg-checkfor-file-list the-name (psg-list-env "BIBINPUT")) - (and bib-cite-inputs - (psg-checkfor-file-list the-name bib-cite-inputs)) - (and (boundp 'TeX-check-path) - (psg-checkfor-file-list the-name TeX-check-path)))) - (if the-file - (progn - (save-excursion - (set-buffer bib-buffer) - (goto-char (point-max)) - (if include-filenames-f - (insert "%%%Filename: " the-file "\n")) - (insert-file-contents the-file nil) - (goto-char 1))) - (setq the-warnings - (concat the-warnings "Could not read file: " the-name "\n")))) - (if the-warnings - (progn - (with-output-to-temp-buffer "*Help*" - (princ the-warnings)) - (kill-buffer bib-buffer) - (error - "Sorry, can't find all bibtex files in \\bibliography command")) - bib-buffer))) - -(defun bib-bibliography-list () - "Return list of bib files listed in first \\bibliography command in buffer. -Similar output to AUCTeX's LaTeX-bibliography-list -The first element may contain trailing whitespace (if there was any in input) -although BiBTeX doesn't allow it!" - (save-excursion - (goto-char 1) - (if (not (re-search-forward "^[ \t]*\\\\bibliography{[ \t]*\\([^},]+\\)" - nil t)) - (error "Sorry, can't find \\bibliography command anywhere") - (let ((the-list (list (match-string 1))) - (doNext t)) - (while doNext - (if (looking-at ",") - (setq the-list - (append the-list - (list (buffer-substring - (progn (skip-chars-forward ", ")(point)) - (progn (re-search-forward "[,}]" nil t) - (backward-char 1) - (skip-chars-backward ", ") - (point)))))) - (setq doNext nil))) - (mapcar 'list the-list))))) - -;; BibTeX-mode key def to create AUCTeX's parsing file. -(defun bib-create-auto-file () - "Force the creation of the AUCTeX auto file for a bibtex buffer." - (interactive) - (if (not (require 'latex)) - (error "Sorry, This is only useful if you have AUCTeX")) - (let ((TeX-auto-save t) - (TeX-auto-update t) - (TeX-auto-regexp-list BibTeX-auto-regexp-list)) - ;; TeX-auto-write - ;; -> calls TeX-auto-store - ;; -> calls TeX-auto-parse - ;; clears LaTeX-auto-bibtem (temporary holding space for bibitems) - ;; searches buffer using regexp in TeX-auto-regexp-list - ;; -> if LaTeX-auto-bibtem (the temporary holding space for bibitems) - ;; holds stuffs like - ;; ("Zimmermann:1991" "Anger_et_al:1993") - ;; as determined by - ;; (member nil (mapcar 'TeX-auto-entry-clear-p TeX-auto-parser)) - ;; then it creates the auto file. - - ;; TeX-auto-write may call TeX-master-file which may fail if - ;; TeX-header-end is unset (by LaTeX-common-initialization in latex-mode) - (if (not TeX-header-end) - (setq TeX-header-end LaTeX-header-end)) - - (TeX-auto-write))) - -;; -------------------------------------------------------------------------- -;; The following routines are also defined in other packages... - -(defun psg-checkfor-file-list (filename list) - "Check for presence of FILENAME in directory LIST. Return 1st found path." - ;;USAGE: (psg-checkfor-file-list "gri" (psg-list-env "PATH")) - ;;USAGE: (psg-checkfor-file-list "gri-mode.el" load-path) - ;;USAGE: (psg-checkfor-file-list "gri.cmd" (psg-translate-ff-list "gri.tmp")) - (let ((the-list list) - (filespec)) - (while the-list - (if (not (car the-list)) ; it is nil - (setq filespec (expand-file-name filename)) - (setq filespec - (concat - (expand-file-name (file-name-as-directory (car the-list))) - filename))) - (if (file-exists-p filespec) - (setq the-list nil) - (setq filespec nil) - (setq the-list (cdr the-list)))) - (if filespec - filespec - ;; If I have not found a file yet, then check if some directories - ;; ended in // and recurse through them. - (let ((the-list list)) - (while the-list - (if (not (string-match "//$" (car the-list))) nil - (setq filespec (car - (search-directory-tree - (substring (car the-list) 0 (match-beginning 0)) - (concat "^" filename "$") - t - t))) - (if filespec ;Success! - (setq the-list nil))) - (setq the-list (cdr the-list))) - filespec)))) - - -(defun search-directory-tree (directories extension-regexp recurse first-file) - "Return a list of all reachable files in DIRECTORIES ending with EXTENSION. -DIRECTORIES is a list or a single-directory string -EXTENSION-REGEXP is actually (any) regexp, usually \\\\.bib$ -If RECURSE is t, then we will recurse into the directory tree, - nil, we will only search the list given. -If FIRST-FILE is t, stop after first file is found." - (or (listp directories) - (setq directories (list directories))) - - (let (match) - (while directories - (let* ((directory (file-name-as-directory (car directories))) - (content (and directory - (file-readable-p directory) - (file-directory-p directory) - (directory-files directory)))) - (setq directories (cdr directories)) - (while content - (let ((file (expand-file-name (car content) directory))) - (cond ((string-match "[.]+$" (car content))) ;This or parent dir - ((not (file-readable-p file))) - ((and recurse - (file-directory-p file)) - (setq directories - (cons (file-name-as-directory file) directories))) - ((string-match extension-regexp - (file-name-nondirectory file)) - (and first-file - (setq content nil - directories nil)) - (setq match (cons file match))))) - (setq content (cdr content))))) - - match)) - -;;; (defun psg-checkfor-file-list (filename list) -;;; (let ((the-list list) -;;; (filespec)) -;;; (while the-list -;;; (if (not (car the-list)) ; it is nil -;;; (setq filespec (concat "~/" filename)) -;;; (setq filespec -;;; (concat (file-name-as-directory (car the-list)) filename))) -;;; (if (file-exists-p filespec) -;;; (setq the-list nil) -;;; (setq filespec nil) -;;; (setq the-list (cdr the-list)))) -;;; filespec)) - -(or (fboundp 'dired-replace-in-string) - ;; This code is part of GNU emacs - (defun dired-replace-in-string (regexp newtext string) - ;; Replace REGEXP with NEWTEXT everywhere in STRING and return result. - ;; NEWTEXT is taken literally---no \\DIGIT escapes will be recognized. - (let ((result "") (start 0) mb me) - (while (string-match regexp string start) - (setq mb (match-beginning 0) - me (match-end 0) - result (concat result (substring string start mb) newtext) - start me)) - (concat result (substring string start))))) - - -;; Could use fset here to equal TeX-split-string to dired-split if only -;; dired-split is defined. That would eliminate a check in psg-list-env. -(and (not (fboundp 'TeX-split-string)) - (not (fboundp 'dired-split)) - ;; This code is part of AUCTeX - (defun TeX-split-string (char string) - "Returns a list of strings. given REGEXP the STRING is split into -sections which in string was seperated by REGEXP. - -Examples: - - (TeX-split-string \"\:\" \"abc:def:ghi\") - -> (\"abc\" \"def\" \"ghi\") - - (TeX-split-string \" *\" \"dvips -Plw -p3 -c4 testfile.dvi\") - - -> (\"dvips\" \"-Plw\" \"-p3\" \"-c4\" \"testfile.dvi\") - -If CHAR is nil, or \"\", an error will occur." - - (let ((regexp char) - (start 0) - (result '())) - (while (string-match regexp string start) - (let ((match (string-match regexp string start))) - (setq result (cons (substring string start match) result)) - (setq start (match-end 0)))) - (setq result (cons (substring string start nil) result)) - (nreverse result)))) - -(defun bib-cite-file-directory-p (file) - "Like default `file-directory-p' but allow FILE to end in // for ms-windows." - (save-match-data - (if (string-match "\\(.*\\)//$" file) - (file-directory-p (match-string 1 file)) - (file-directory-p file)))) - -(defun psg-list-env (env) - "Return a list of directory elements in ENV variable (w/o leading $) -argument may consist of environment variable plus a trailing directory, e.g. -HOME or HOME/bin (trailing directory not supported in dos or OS/2). - -bib-dos-or-os2-variable affects: - path separator used (: or ;) - whether backslashes are converted to slashes" - (if (not (getenv env)) - nil ;Because dired-replace-in-string fails - (let* ((value (if bib-dos-or-os2-variable - (dired-replace-in-string "\\\\" "/" (getenv env)) - (getenv env))) - (sep-char (or (and bib-dos-or-os2-variable ";") ":")) - (entries (and value - (or (and (fboundp 'TeX-split-string) - (TeX-split-string sep-char value)) - (dired-split sep-char value))))) - (loop for x in entries if (bib-cite-file-directory-p x) collect x)))) - -(provide 'bib-cite) -;;; bib-cite.el ends here diff --git a/packages/auctex/context-en.el b/packages/auctex/context-en.el deleted file mode 100644 index c331cc821..000000000 --- a/packages/auctex/context-en.el +++ /dev/null @@ -1,212 +0,0 @@ -;;; context-en.el --- Support for the ConTeXt english interface. - -;; Copyright (C) 2003, 2004 Free Software Foundation, Inc. - -;; Maintainer: Berend de Boer -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file is loaded by context.el when required. - -;;; Code: - -;; Build upon ConTeXt -(require 'context) - -;;; ConText macro names - -;;; Code: -(defvar ConTeXt-environment-list-en - '("alignment" "appendices" - "background" "backmatter" "bodymatter" "bodypart" "buffer" - "code" "color" "columns" "combination" - "encoding" "extroductions" - "fact" "formula" "framedcode" "framedtext" "frontmatter" - "helptext" "hiding" - "itemize" - "legend" "line" "linecorrection" "linenumbering" "lines" - "localenvironment" "localfootnotes" - "makeup" "mapping" "marginblock" "marginedge" "marginrule" "mode" - "narrower" "notmode" - "opposite" - "packed" "pagecomment" "pagefigure" "positioning" "postponing" - "quotation" - "raster" "register" - "standardmakeup" - "table" "tabulate" "TEXpage" "text" "textbackground" "typing" - "unpacked" - ;; project structure - "component" "environment" "product" "project" - ;; flowcharts, if you have loaded this module - "FLOWcell" "FLOWchart" - ;; typesetting computer languages - "EIFFEL" "JAVA" "JAVASCRIPT" "MP" "PASCAL" "PERL" "SQL" "TEX" "XML" - ;; some metapost environments - "MPpositiongraphic" "useMPgraphic" "MPcode" "reusableMPgraphic" - "uniqueMPgraphic") - "List of the ConTeXt en interface start/stop pairs.") - -(defvar ConTeXt-define-list-en - '("accent" - "background" "blank" "block" "blocks" "bodyfont" "bodyfontenvironment" - "buffer" - "casemap" "character" "color" "colorgroup" "combinedlist" "command" - "description" "enumeration" - "float" "font" "fontsynonym" "framedtext" "head" - "indenting" "label" - "logo" "overlay" - "palet" "program" "startstop" "type" "typing") - "List of the names of ConTeXt en interface macro's that define things.") - -(defvar ConTeXt-setup-list-en - '("align" "arranging" "background" "backgrounds" "blackrules" - "blank" "block" "bodyfont" "bodyfontenvironment" "bottom" - "bottomtexts" "buffer" "capitals" "caption" "captions" "color" - "colors" "columns" "combinations" "combinedlist" "descriptions" - "enumerations" "externalfigures" "fillinlines" "fillinrules" "float" - "floats" "footer" "footertexts" "footnodedefinition" "footnotes" - "framed" "framedtexts" "head" "header" "headertexts" "headnumber" - "heads" "headtext" "hyphenmark" "indentations" "indenting" "inmargin" - "interlinespace" "itemize" "items" "labeltext" "language" "layout" - "linenumbering" "lines" "list" "makeup" "marginblocks" - "marginrules" "marking" "narrower" "oppositeplacing" - "pagecomment" "pagenumber" "pagenumbering" "palet" "papersize" "paragraphs" - "quote" "referencing" "register" - "screens" "section" "sectionblock" "sorting" "spacing" - "subpagenumber" "synonyms" "text" "textrules" "texttexts" "thinrules" - "tolerance" "top" "toptexts" "type" "typing" "underbar" "whitespace") - "List of the names of ConTeXt en interface macro's that setup things.") - -;; referencing in ConTeXt -(defvar ConTeXt-referencing-list-en - '("in" "at" "about" "pagereference" "textreference" "reference") - "List of ConTeXt en macro's that are used for referencing." -) - -;; lists some place macro's as well, should perhaps be under separate menu -(defvar ConTeXt-other-macro-list-en - '("abbreviation" "adaptlayout" "at" "combinepages" "copypages" - "externalfigure" "framed" "from" "input" "insertpages" "filterpages" - "getbuffer" "goto" - "hideblocks" "keepblocks" - "leftaligned" "midaligned" - "obeyspaces" - "page" - "placecontent" "placeexternalfigure" "placefigure" "placelogos" "placetable" - "processblocks" "protect" - "raggedcenter" "rightaligned" "rotate" - "scale" "selectblocks" "showexternalfigures" "slicepages" - "useexternalfigure" "unprotect" "url" "useblocks" "usemodule" "useURL" - "version") - "List of ConTeXt en interface macro's that are not an environment nor a setup.") - -(defun ConTeXt-define-command-en (what) - "The ConTeXt en interface way of creating a define command." - (concat "define" what)) - -(defun ConTeXt-setup-command-en (what) - "The ConTeXt en interface way of creating a setup command." - (concat "setup" what)) - -(defvar ConTeXt-project-structure-list-en - '("project" "environment" "product" "component") - "List of the names of ConTeXt project structure elements for its en interface. List should be in logical order.") - -(defvar ConTeXt-section-block-list-en - '("frontmatter" "bodymatter" "appendices" "backmatter") - "List of the names of ConTeXt section blocks for its en interface. List should be in logical order.") - - -;; TODO: -;; ConTeXt has alternative sections like title and subject. Currently -;; the level is used to find the section name, so the alternative -;; names are never found. Have to start using the section name instead -;; of the number. -(defvar ConTeXt-section-list-en - '(("part" 0) - ("chapter" 1) - ("section" 2) - ("subsection" 3) - ("subsubsection" 4)) - ;; ("title" 1) - ;; ("subject" 2) - ;; ("subsubject" 3) - ;; ("subsubsubject" 4) - "List of the names of ConTeXt sections for its en interface.") - -(defvar ConTeXt-text-en "text" - "The ConTeXt en interface body text group.") - -(defvar ConTeXt-item-list-en - '("item" "its" "mar" "ran" "sub" "sym") - "The ConTeXt macro's that are variants of item.") - -(defcustom ConTeXt-default-environment-en "itemize" - "*The default environment when creating new ones with `ConTeXt-environment'." - :group 'ConTeXt-en-environment - :type 'string) - - -;; Emacs en menu names and labels should go here -;; to be done - - -;;; Mode - -(defun ConTeXt-en-mode-initialization () - "ConTeXt english interface specific initialization." - (mapc 'ConTeXt-add-environments (reverse ConTeXt-environment-list-en)) - - (TeX-add-symbols - '("but" ConTeXt-arg-define-ref (TeX-arg-literal " ")) - '("item" ConTeXt-arg-define-ref (TeX-arg-literal " ")) - '("items" [ConTeXt-arg-setup] (TeX-arg-string "Comma separated list")) - '("its" ConTeXt-arg-define-ref (TeX-arg-literal " ")) - '("nop" (TeX-arg-literal " ")) - '("ran" TeX-arg-string (TeX-arg-literal " ")) - '("sub" ConTeXt-arg-define-ref (TeX-arg-literal " ")) - '("sym" (TeX-arg-string "Symbol") (TeX-arg-literal " ")))) - -;;;###autoload -(defun context-en-mode () - "Major mode for editing files for ConTeXt using its english interface. - -Special commands: -\\{ConTeXt-mode-map} - -Entering `context-mode' calls the value of `text-mode-hook', -then the value of TeX-mode-hook, and then the value -of context-mode-hook." - (interactive) - ;; set the ConTeXt interface - (setq ConTeXt-current-interface "en") - - ;; initialization - (ConTeXt-mode-common-initialization) - (ConTeXt-en-mode-initialization) - - ;; set mode line - (setq TeX-base-mode-name "ConTeXt-en") - (TeX-set-mode-name)) - -(provide 'context-en) - -;;; context-en.el ends here diff --git a/packages/auctex/context-nl.el b/packages/auctex/context-nl.el deleted file mode 100644 index 9369d0ee3..000000000 --- a/packages/auctex/context-nl.el +++ /dev/null @@ -1,187 +0,0 @@ -;;; context-nl.el --- Support for the ConTeXt dutch interface. - -;; Copyright (C) 2003, 2004 Free Software Foundation, Inc. - -;; Maintainer: Berend de Boer -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file is loaded by context.el when required. - -;;; Code: - -;; Build upon ConTeXt -(require 'context) - -;;; ConText macro names - -(defvar ConTeXt-environment-list-nl - '("achtergrond" "alinea" "bloktekst" "buffer" "citaat" "combinatie" - "commentaar" "deelomgeving" "document" "doordefinitie" - "doornummering" "figuur" "formule" "gegeven" "interactiemenu" - "kadertekst" "kantlijn" "kleur" "kolommen" "legenda" "lokaal" - "lokalevoetnoten" "margeblok" "naamopmaak" "naast" - "opelkaar" "opmaak" "opsomming" "overlay" "overzicht" - "paginafiguur" "positioneren" "profiel" - "regel" "regelcorrectie" "regelnummeren" "regels" - "smaller" "symboolset" "synchronisatie" - "tabel" "tabellen" "tabulatie" "tekstlijn" "typen" - "uitlijnen" "uitstellen" "vanelkaar" "verbergen" "versie" - ;; project structure - "omgeving" "onderdeel" "produkt" "project" - ;; flowcharts, if you have loaded this module - "FLOWcell" "FLOWchart" - ;; typesetting computer languages - "EIFFEL" "JAVA" "JAVASCRIPT" "MP" "PASCAL" "PERL" "SQL" "TEX" "XML" - ;; some metapost environments - "MPpositiongraphic" "useMPgraphic" "MPcode" "reusableMPgraphic" - "uniqueMPgraphic") - "List of the ConTeXt nl interface start/stop pairs.") - -(defvar ConTeXt-define-list-nl - '("achtergrond" "startstop" "typen") - "List of ConTeXt nl interface macro's that define things.") - -(defvar ConTeXt-setup-list-nl - '("achtergronden" "achtergrond" "alineas" "arrangeren" "blanko" - "blok" "blokjes" "blokkopje" "blokkopjes" "boven" "boventeksten" - "brieven" "buffer" "buttons" "citeren" "clip" "combinaties" - "commentaar" "doordefinieren" "doornummeren" "doorspringen" - "dunnelijnen" "externefiguren" "formules" "formulieren" - "hoofd" "hoofdteksten" "inmarge" "inspringen" "interactiebalk" - "interactie" "interactiemenu" "interactiescherm" "interlinie" - "invullijnen" "invulregels" "items" "kaderteksten" "kantlijn" - "kapitalen" "kleuren" "kleur" "kolommen" "kop" "kopnummer" - "koppelteken" "koppen" "koptekst" "korps" "korpsomgeving" - "labeltekst" "layout" "legenda" "lijndikte" "lijn" "lijst" - "margeblokken" "markering" "naastplaatsen" "nummeren" "omlijnd" - "onder" "onderstrepen" "onderteksten" "opmaak" "opsomming" - "paginanummer" "paginanummering" "paginaovergangen" "palet" - "papierformaat" "papier" "paragraafnummeren" "plaatsblok" - "plaatsblokken" "plaatsblokkensplitsen" "positioneren" "profielen" - "programmas" "publicaties" "rasters" "referentielijst" "refereren" - "regelnummeren" "regels" "register" "roteren" "samengesteldelijst" - "sectieblok" "sectie" "sheets" "smaller" "sorteren" "spatiering" - "stickers" "strut" "strut" "subpaginanummer" "symboolset" - "synchronisatiebalk" "synchronisatie" "synoniemen" "systeem" - "taal" "tabellen" "tab" "tabulatie" "tekst" "tekstlijnen" - "tekstpositie" "tekstteksten" "tekstvariabele" "tolerantie" "type" - "typen" "uitlijnen" "uitvoer" "url" "velden" "veld" "versies" - "voet" "voetnootdefinitie" "voetnoten" "voetteksten" "witruimte") - "List of the names of ConTeXt nl interface macro's that setup things.") - -(defvar ConTeXt-other-macro-list-nl - '("regellinks" "regelmidden" "regelrechts" "toonexternefiguren") - "List of ConTeXt nl interface macro's that are not an environment nor a setup.") - -(defun ConTeXt-define-command-nl (what) - "The ConTeXt nl interface way of creating a define command." - (concat "definieer" what)) - -(defun ConTeXt-setup-command-nl (what) - "The ConTeXt nl interface way of creating a setup command." - (concat "stel" what "in")) - -(defvar ConTeXt-project-structure-list-nl - '("project" "omgeving" "produkt" "onderdeel") - "List of the names of ConTeXt project structure elements for its nl interface. List should be in logical order.") - -(defvar ConTeXt-section-block-list-nl - '("inleidingen" "hoofdteksten" "bijlagen" "uitleidingen") - "List of the names of ConTeXt section blocks for its nl interface. List should be in logical order.") - - -;; TODO: -;; ConTeXt has alternative sections like title and subject. Currently -;; the level is used to find the section name, so the alternative -;; names are never found. Have to start using the section name instead -;; of the number. -(defvar ConTeXt-section-list-nl - '(("deel" 0) - ("hoofdstuk" 1) - ("paragraaf" 2) - ("subparagraaf" 3) - ("subsubparagraaf" 4)) - ;; ("title" 1) - ;; ("subject" 2) - ;; ("subsubject" 3) - ;; ("subsubsubject" 4) - "List of the names of ConTeXt sections for its nl interface.") - -(defvar ConTeXt-text-nl "tekst" - "The ConTeXt nl interface body text group.") - -(defvar ConTeXt-item-list-nl - '("som" "its" "mar" "ran" "sub" "sym") - "The ConTeXt macro's that are variants of item.") - -(defcustom ConTeXt-default-environment-nl "opsomming" - "*The default environment when creating new ones with `ConTeXt-environment'." - :group 'ConTeXt-nl-environment - :type 'string) - - -;; Emacs en menu names and labels should go here -;; to be done - - -;;; Mode - -(defun ConTeXt-nl-mode-initialization () - "ConTeXt dutch interface specific initialization." - (mapc 'ConTeXt-add-environments (reverse ConTeXt-environment-list-nl)) - - (TeX-add-symbols - '("but" ConTeXt-arg-define-ref (TeX-arg-literal " ")) - '("som" ConTeXt-arg-define-ref (TeX-arg-literal " ")) - '("items" [ConTeXt-arg-setup] (TeX-arg-string "Comma separated list")) - '("its" ConTeXt-arg-define-ref (TeX-arg-literal " ")) - '("nop" (TeX-arg-literal " ")) - '("ran" TeX-arg-string (TeX-arg-literal " ")) - '("sub" ConTeXt-arg-define-ref (TeX-arg-literal " ")) - '("sym" (TeX-arg-string "Symbol") (TeX-arg-literal " ")))) - -;;;###autoload -(defun context-nl-mode () - "Major mode for editing files for ConTeXt using its dutch interface. - -Special commands: -\\{ConTeXt-mode-map} - -Entering `context-mode' calls the value of `text-mode-hook', -then the value of TeX-mode-hook, and then the value -of context-mode-hook." - (interactive) - - ;; set the ConTeXt interface - (setq ConTeXt-current-interface "nl") - - ;; initialization - (ConTeXt-mode-common-initialization) - (ConTeXt-nl-mode-initialization) - - ;; set mode line - (setq TeX-base-mode-name "ConTeXt-nl") - (TeX-set-mode-name)) - -(provide 'context-nl) - -;;; context-nl.el ends here diff --git a/packages/auctex/context.el b/packages/auctex/context.el deleted file mode 100644 index f7042a69f..000000000 --- a/packages/auctex/context.el +++ /dev/null @@ -1,1653 +0,0 @@ -;;; context.el --- Support for ConTeXt documents. - -;; Copyright (C) 2003, 2004, 2005, 2006, 2008 Free Software Foundation, Inc. - -;; Maintainer: Berend de Boer -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This is in progress ConTeXt support for AUCTeX. Please report -;; anomalies or things you believe should be added. - -;; AUCTeX is closely interwoven with LaTeX. We have to split up -;; things without breaking 'em. - -;; some parts are stolen from latex.el and adapted to ConTeXt. - -;; TODO -;; 1. indentation still bad. -;; 2. paragraph refilling doesn't work 100%, and is very slow. -;; 4. Remove dependency on LaTeX by moving LaTeX commands to TeX. -;; 5. Most ConTeXt macro's don't currently have lisp code to query for -;; arguments. As ConTeXt arguments are quite complex, the LaTeX way -;; of querying for arguments just doesn't cut it. -;; 6. Check auto-parsing: does it detect % interface=nl for example? -;; 7. Complete adding ConTeXt macro's. Perhaps parse cont-en.xml and -;; generate the interfaces? -;; 8. Add to menu: make TeX hash (mktexlsr), context format and metapost format. - -;; TODO Documentation -;; 1. multifile done differently with ConTeXt - -;;; Code: - -(require 'tex-buf) -(require 'tex) -;; need functions like TeX-look-at and LaTeX-split-long-menu -(require 'latex) - -(defgroup ConTeXt-macro nil - "Special support for ConTeXt macros in AUCTeX." - :prefix "TeX-" - :group 'ConTeXt - :group 'TeX-macro) - - -;;; variables - -;; globals used in certain macro's. -(defvar done-mark nil - "Position of point afterwards, default nil (meaning end).") - -(defvar reference nil - "Set by `ConTeXt-section-ref', used by `ConTeXt-section-section'.") - -(defvar title nil - "Set by `ConTeXt-section-title', used by `ConTeXt-section-section'.") - - -;; others - -(defvar ConTeXt-known-interfaces '("cz" "de" "en" "it" "nl" "ro" "uk")) - -(defcustom ConTeXt-default-interface "en" - "Default interface to be used when running ConTeXt." - :group 'ConTeXt - :type 'string) - -(defvar ConTeXt-current-interface "en" - "Interface to be used for inserting macros and ConTeXt run.") -(make-variable-buffer-local 'ConTeXt-current-interface) - -(defvar ConTeXt-menu-changed nil) -;; Need to update ConTeXt menu. -(make-variable-buffer-local 'ConTeXt-menu-changed) - -(defvar ConTeXt-largest-level nil - "Largest sectioning level within current document.") -(make-variable-buffer-local 'ConTeXt-largest-level) - -(defun ConTeXt-largest-level () - (TeX-update-style) - ConTeXt-largest-level) - - -;;; Syntax - -(defvar ConTeXt-optop "[" - "The ConTeXt optional argument opening character.") - -(defvar ConTeXt-optcl "]" - "The ConTeXt optional argument closing character.") - - -;; Define a ConTeXt macro - -(defvar ConTeXt-define-list () - "Calls ConTeXt-XX-define-list where XX is the current interface.") - -(defun ConTeXt-define-command (what) - "The ConTeXt macro to define WHAT." - (funcall - (intern (concat "ConTeXt-define-command-" ConTeXt-current-interface)) what)) - -(defun ConTeXt-insert-define (define) - "Insert the ConTeXt define macro DEFINE." - (insert TeX-esc (ConTeXt-define-command define)) - (newline) - (indent-according-to-mode) - (ConTeXt-arg-setup nil)) - - -;; Setup a ConTeXt macro - -(defvar ConTeXt-setup-list () - "Calls ConTeXt-XX-setup-list where XX is the current interface.") - -(defun ConTeXt-setup-command (what) - "The ConTeXt macro to setup WHAT." - (funcall - (intern (concat "ConTeXt-setup-command-" ConTeXt-current-interface)) what)) - -(defun ConTeXt-insert-setup (setup) - "Insert the ConTeXt setup macro SETUP." - (insert TeX-esc (ConTeXt-setup-command setup)) - (newline) - (indent-according-to-mode) - (ConTeXt-arg-setup nil)) - - -;; Referencing ConTeXt macro's - -(defvar ConTeXt-referencing-list () - "Calls ConTeXt-XX-other-macro-list where XX is the current interface.") - -(defun ConTeXt-referencing-command (what) - "The ConTeXt macro to call WHAT is itself, no interface specific calls." - what) - -(defun ConTeXt-insert-referencing (what) - "Insert the ConTeXt referencing SETUP." - (insert TeX-esc (ConTeXt-referencing-command what)) - (newline) - (indent-according-to-mode) - (ConTeXt-arg-setup nil)) - - -;; Other ConTeXt macro's - -(defvar ConTeXt-other-macro-list () - "Calls ConTeXt-XX-other-macro-list where XX is the current interface.") - -(defun ConTeXt-other-macro-command (what) - "The ConTeXt macro to call WHAT is itself, no interface specific calls." - what) - -(defun ConTeXt-insert-other-macro (other-macro) - "Insert the ConTeXt other macro's macro SETUP." - (insert TeX-esc (ConTeXt-other-macro-command other-macro)) - (newline) - (indent-according-to-mode) - (ConTeXt-arg-setup nil)) - - -;;; Project structure - -(defvar ConTeXt-project-structure-list () - "Calls ConTeXt-XX-project-structure where XX is the current interface.") - -(defun ConTeXt-project-structure (N) - "Insert a ConTeXt project structure where N is in index into `ConTeXt-project-structure-list'." - (funcall (intern(concat - "ConTeXt-project-" - (nth N ConTeXt-project-structure-list) - "-insert")))) - -(defun ConTeXt-project-project-insert () - "Insert a basic template for a new ConTeXt project." - (save-excursion - (insert "% The following names are examples only\n") - (insert TeX-esc (ConTeXt-environment-start-name) (nth 0 ConTeXt-project-structure-list) " myproject") - (newline 2) - (insert TeX-esc (nth 1 ConTeXt-project-structure-list) " myenvironment") - (newline 2) - (insert TeX-esc (nth 2 ConTeXt-project-structure-list) " myproduct1") - (newline 2) - (insert TeX-esc (nth 2 ConTeXt-project-structure-list) " myproduct2") - (newline 2) - (insert TeX-esc (ConTeXt-environment-stop-name) (nth 0 ConTeXt-project-structure-list)))) - -(defun ConTeXt-project-environment-insert () - "Insert a basic template for the environment of a ConTeXt project." - (save-excursion - (insert "% The name 'myenvironment' is an example only.\n" - "% It must match the name in your project file.\n") - (insert TeX-esc (ConTeXt-environment-start-name) - (nth 1 ConTeXt-project-structure-list) " myenvironment\n\n") - (insert "% Put environment charateristics that must be defined at the " - "highest level here\n\n") - (insert TeX-esc (ConTeXt-environment-stop-name) - (nth 1 ConTeXt-project-structure-list)))) - -(defun ConTeXt-project-product-insert () - "Insert a basic template for a product of a ConTeXt project." - (save-excursion - (insert "% The following names are examples only\n") - (insert TeX-esc (ConTeXt-environment-start-name) - (nth 2 ConTeXt-project-structure-list) " myproduct1") - (newline 2) - (insert TeX-esc (nth 0 ConTeXt-project-structure-list) " myproject") - (newline 2) - (insert "% Components are optional. " - "You can also just start your document here.\n") - (insert TeX-esc (nth 3 ConTeXt-project-structure-list) " mycomponent1") - (newline 2) - (insert TeX-esc (nth 3 ConTeXt-project-structure-list) " mycomponent2") - (newline 2) - (insert TeX-esc (ConTeXt-environment-stop-name) - (nth 2 ConTeXt-project-structure-list)))) - -(defun ConTeXt-project-component-insert () - "Insert a basic template for a component of a ConTeXt project." - (save-excursion - (insert "% The following names are examples only\n") - (insert TeX-esc (ConTeXt-environment-start-name) - (nth 3 ConTeXt-project-structure-list) " mycomponent1") - (newline 2) - (insert TeX-esc (nth 0 ConTeXt-project-structure-list) " myproject\n") - (insert TeX-esc (nth 2 ConTeXt-project-structure-list) " myproduct1") - (newline 2) - (insert "% ... text here ...") - (newline 2) - (insert TeX-esc (ConTeXt-environment-stop-name) - (nth 3 ConTeXt-project-structure-list)))) - - -;;; Section blocks - -(defvar ConTeXt-section-block-list () - "Calls ConTeXt-XX-section-list where XX is the current interface.") - -(defun ConTeXt-section-block (section-block) - "Insert the ConTeXt section block SECTION-BLOCK." - (ConTeXt-environment-menu section-block)) - - -;;; Sections - -(defun ConTeXt-section (arg) - "Insert a template for a ConTeXt section. -Determinate the type of section to be inserted, by the argument ARG. - -If ARG is nil or missing, use the current level. -If ARG is a list (selected by \\[universal-argument]), go downward one level. -If ARG is negative, go up that many levels. -If ARG is positive or zero, use absolute level: - - 0 : part - 1 : chapter - 2 : section - 3 : subsection - 4 : subsubsection - 5 : subsubsubsection - -Or: - - 0 : title - 1 : subject - 2 : subsubject - 3 : subsubsubject - -The following variables can be set to customize: - -`ConTeXt-section-hook' Hooks to run when inserting a section. -`ConTeXt-section-ref' Prefix to all section references." - - (interactive "*P") - (let* ((val (prefix-numeric-value arg)) - (level (cond ((null arg) - (ConTeXt-current-section)) - ((listp arg) - (ConTeXt-down-section)) - ((< val 0) - (ConTeXt-up-section (- val))) - (t val))) - (name (ConTeXt-section-name level)) - (toc nil) - (title "") - (done-mark (make-marker))) - (newline) - (run-hooks 'ConTeXt-section-hook) - (newline) - (if (marker-position done-mark) - (goto-char (marker-position done-mark))) - (set-marker done-mark nil))) - -;; LaTeX has a max function here, which makes no sense. -;; I think you want to insert a section that is max ConTeXt-largest-level -(defun ConTeXt-current-section () - "Return the level of the section that contain point. -See also `ConTeXt-section' for description of levels." - (save-excursion - (min (ConTeXt-largest-level) - (if (re-search-backward outline-regexp nil t) - (+ 1 (- (ConTeXt-outline-level) (ConTeXt-outline-offset))) - (ConTeXt-largest-level))))) - -(defun ConTeXt-down-section () - "Return the value of a section one level under the current. -Tries to find what kind of section that have been used earlier in the -text, if this fail, it will just return one less than the current -section." - (save-excursion - (let ((current (ConTeXt-current-section)) - (next nil) - (regexp outline-regexp)) - (if (not (re-search-backward regexp nil t)) - (1+ current) - (while (not next) - (cond - ((eq (ConTeXt-current-section) current) - (if (re-search-forward regexp nil t) - (if (<= (setq next (ConTeXt-current-section)) current) ;Wow! - (setq next (1+ current))) - (setq next (1+ current)))) - ((not (re-search-backward regexp nil t)) - (setq next (1+ current))))) - next)))) - -(defun ConTeXt-up-section (arg) - "Return the value of the section ARG levels above this one." - (save-excursion - (if (zerop arg) - (ConTeXt-current-section) - (let ((current (ConTeXt-current-section))) - (while (and (>= (ConTeXt-current-section) current) - (re-search-backward outline-regexp - nil t))) - (ConTeXt-up-section (1- arg)))))) - -(defvar ConTeXt-section-list () - "ConTeXt-XX-section-list where XX is the current interface.") - -(defun ConTeXt-section-name (level) - "Return the name of the section corresponding to LEVEL." - (let ((entry (TeX-member level ConTeXt-section-list - (function (lambda (a b) (equal a (nth 1 b))))))) - (if entry - (nth 0 entry) - nil))) - -(defun ConTeXt-section-level (name) - "Return the level of the section NAME." - (let ((entry (TeX-member name ConTeXt-section-list - (function (lambda (a b) (equal a (nth 0 b))))))) - - (if entry - (nth 1 entry) - nil))) - - -;;; Section Hooks. - -(defcustom ConTeXt-section-hook - '(ConTeXt-section-heading - ConTeXt-section-title - ConTeXt-section-ref - ConTeXt-section-section) - "List of hooks to run when a new section is inserted. - -The following variables are set before the hooks are run - -level - numeric section level, see the documentation of `ConTeXt-section'. -name - name of the sectioning command, derived from `level'. -title - The title of the section, default to an empty string. -`done-mark' - Position of point afterwards, default nil (meaning end). - -The following standard hook exist - - -ConTeXt-section-heading: Query the user about the name of the -sectioning command. Modifies `level' and `name'. - -ConTeXt-section-title: Query the user about the title of the -section. Modifies `title'. - -ConTeXt-section-section: Insert ConTeXt section command according to -`name', `title', and `reference'. If `title' is an empty string, -`done-mark' will be placed at the point they should be inserted. - -ConTeXt-section-ref: Insert a reference for this section command. - -To get a full featured `ConTeXt-section' command, insert - - (setq ConTeXt-section-hook - '(ConTeXt-section-heading - ConTeXt-section-title - ConTeXt-section-section - ConTeXt-section-ref)) - -in your .emacs file." - :group 'ConTeXt-macro - :type 'hook - :options - '(ConTeXt-section-heading - ConTeXt-section-title - ConTeXt-section-ref - ConTeXt-section-section)) - -(defun ConTeXt-section-heading () - "Hook to prompt for ConTeXt section name. -Insert this hook into `ConTeXt-section-hook' to allow the user to change -the name of the sectioning command inserted with `\\[ConTeXt-section]'." - (let ((string (completing-read - (concat "Select level: (default " name ") ") - ConTeXt-section-list - nil nil nil))) - ;; Update name - (if (not (zerop (length string))) - (setq name string)))) - -(defun ConTeXt-section-title () - "Hook to prompt for ConTeXt section title. -Insert this hook into `ConTeXt-section-hook' to allow the user to change -the title of the section inserted with `\\[ConTeXt-section]." - (setq title (read-string "What title: "))) - -(defun ConTeXt-section-section () - "Hook to insert ConTeXt section command into the file. -Insert this hook into `ConTeXt-section-hook' after those hooks which sets -the `name', `title', and `reference' variables, but before those hooks which -assumes the section already is inserted." - (insert TeX-esc name) - (cond ((null reference)) - ((zerop (length reference)) - (insert ConTeXt-optop) - (set-marker done-mark (point)) - (insert ConTeXt-optcl)) - (t - (insert ConTeXt-optop reference ConTeXt-optcl))) - (insert TeX-grop) - (if (zerop (length title)) - (set-marker done-mark (point))) - (insert title TeX-grcl) - (newline) - ;; If RefTeX is available, tell it that we've just made a new section - (and (fboundp 'reftex-notice-new-section) - (funcall (symbol-function 'reftex-notice-new-section)))) - -(defun ConTeXt-section-ref () - "Hook to insert a reference after the sectioning command. -Insert this hook into `ConTeXt-section-hook' to prompt for a label to be -inserted after the sectioning command." - - (setq reference (completing-read - (TeX-argument-prompt t nil - "Comma separated list of references") - (LaTeX-label-list) nil nil)) - ;; No reference or empty string entered? - (if (string-equal "" reference) - (setq reference nil))) - - -;; Various -(defun TeX-ConTeXt-sentinel (process name) - "Cleanup TeX output buffer after running ConTeXt." - (cond ((TeX-TeX-sentinel-check process name)) - ((save-excursion - ;; in a full ConTeXt run there will multiple texutil - ;; outputs. Just looking for "another run needed" would - ;; find the first occurence - (goto-char (point-max)) - (re-search-backward "TeXUtil " nil t) - (re-search-forward "another run needed" nil t)) - (message (concat "You should run ConTeXt again " - "to get references right, " - (TeX-current-pages))) - (setq TeX-command-next TeX-command-default)) - ((re-search-forward "removed files :" nil t) - (message "sucessfully cleaned up")) - ((re-search-forward "^ ?TeX\\(Exec\\|Util\\)" nil t) ;; strange regexp --pg - (message (concat name ": successfully formatted " - (TeX-current-pages))) - (setq TeX-command-next TeX-command-Show)) - (t - (message (concat name ": problems after " - (TeX-current-pages))) - (setq TeX-command-next TeX-command-default)))) - - -;;; Environments - -(defgroup ConTeXt-environment nil - "Environments in AUCTeX." - :group 'ConTeXt-macro) - -;; TODO: interface awareness -(defcustom ConTeXt-default-environment "itemize" - "*The default environment when creating new ones with `ConTeXt-environment'." - :group 'ConTeXt-environment - :type 'string) -(make-variable-buffer-local 'ConTeXt-default-environment) - -(TeX-auto-add-type "environment" "ConTeXt") - -(fset 'ConTeXt-add-environments-auto - (symbol-function 'ConTeXt-add-environments)) -(defun ConTeXt-add-environments (&rest environments) - "Add ENVIRONMENTS to the list of known environments." - (apply 'ConTeXt-add-environments-auto environments) - (setq ConTeXt-menu-changed t)) - -;; (defvar ConTeXt-environment-list () -;; "ConTeXt-environment-list-XX where XX is the current interface.") - -(defvar ConTeXt-environment-history nil) - -(defun ConTeXt-environment-start-name () - "Return the \\start translated to the language in current interface." - ;; it is "inizia", others are "start" - (cond ((equal ConTeXt-current-interface "it") - "inizia") - ((member ConTeXt-current-interface ConTeXt-known-interfaces) - "start") - (t - ;; this should not happen - (error "Unknown interface: %s" ConTeXt-current-interface)))) - -(defun ConTeXt-environment-stop-name () - "Return the \\stop translated to the language in current interface." - ;; it is "termina", others are "stop" - (cond ((equal ConTeXt-current-interface "it") - "termina") - ((member ConTeXt-current-interface ConTeXt-known-interfaces) - "stop") - (t - ;; this should not happen - (error "Unknown interface: %s" ConTeXt-current-interface)))) - - -(defun ConTeXt-environment (arg) - "Make ConTeXt environment (\\start...-\\stop... pair). -With optional ARG, modify current environment." - (interactive "*P") - (let ((environment ( - completing-read (concat "Environment type: (default " - (if (TeX-near-bobp) - "text" - ConTeXt-default-environment) - ") ") - ConTeXt-environment-list - nil nil nil - 'ConTeXt-environment-history) - )) - ;; Get default - (cond ((and (zerop (length environment)) - (TeX-near-bobp)) - (setq environment "text")) - ((zerop (length environment)) - (setq environment ConTeXt-default-environment)) - (t - (setq ConTeXt-default-environment environment))) - - (let ((entry (assoc environment ConTeXt-environment-list))) - (when (null entry) - (ConTeXt-add-environments (list environment))) - (if arg - (ConTeXt-modify-environment environment) - (ConTeXt-environment-menu environment))))) - -(defun ConTeXt-modify-environment (environment) - "Modify current environment." - (save-excursion - (ConTeXt-find-matching-stop) - (re-search-backward (concat (regexp-quote TeX-esc) - (ConTeXt-environment-stop-name) - " *\\([a-zA-Z]*\\)") - (save-excursion (beginning-of-line 1) (point))) - (replace-match - (concat TeX-esc (ConTeXt-environment-stop-name) environment) t t) - (beginning-of-line 1) - (ConTeXt-find-matching-start) - (re-search-forward (concat (regexp-quote TeX-esc) - (ConTeXt-environment-start-name) - " *\\([a-zA-Z]*\\)") - (save-excursion (end-of-line 1) (point))) - (replace-match - (concat TeX-esc (ConTeXt-environment-start-name) environment) t t))) - - -(defun ConTeXt-environment-menu (environment) - "Insert ENVIRONMENT around point or region." - (let ((entry (assoc environment ConTeXt-environment-list))) - (cond ((not (and entry (nth 1 entry))) - (ConTeXt-insert-environment environment)) - ((numberp (nth 1 entry)) - (let ((count (nth 1 entry)) - (args "")) - (while (> count 0) - (setq args (concat args TeX-grop TeX-grcl)) - (setq count (- count 1))) - (ConTeXt-insert-environment environment args))) - ((stringp (nth 1 entry)) - (let ((prompts (cdr entry)) - (args "")) - (while prompts - (setq args (concat args - TeX-grop - (read-from-minibuffer - (concat (car prompts) ": ")) - TeX-grcl)) - (setq prompts (cdr prompts))) - (ConTeXt-insert-environment environment args))) - (t - (apply (nth 1 entry) environment (nthcdr 2 entry)))))) - -(defun ConTeXt-close-environment () - "Insert \\stop... to match the current environment." - (interactive "*") - (beginning-of-line) - (let ((empty-line (looking-at "[ \t]*$"))) - (end-of-line) - (if (not empty-line) - (newline))) - (insert TeX-esc (ConTeXt-environment-stop-name) - (ConTeXt-current-environment)) - ;; indent broken, so don't do it. - ;;(indent-according-to-mode) - (end-of-line) - (newline)) - -(defun ConTeXt-insert-environment (environment &optional extra) - "Insert ENVIRONMENT, with optional argument EXTRA." - (if (and (TeX-active-mark) - (not (eq (mark) (point)))) - (save-excursion - (if (< (mark) (point)) - (exchange-point-and-mark)) - (insert TeX-esc (ConTeXt-environment-start-name) environment) - (newline) - (forward-line -1) - (indent-according-to-mode) - (if extra (insert extra)) - (goto-char (mark)) - (or (TeX-looking-at-backward "^[ \t]*") - (newline)) - (insert TeX-esc (ConTeXt-environment-stop-name) environment) - (newline) - (forward-line -1) - (indent-according-to-mode) - ;;(goto-char (point)) - ) - (or (TeX-looking-at-backward "^[ \t]*") - (newline)) - (insert TeX-esc (ConTeXt-environment-start-name) environment) - (indent-according-to-mode) - (if extra (insert extra)) - (end-of-line) - (newline-and-indent) - (newline) - (insert TeX-esc (ConTeXt-environment-stop-name) environment) - (or (looking-at "[ \t]*$") - (save-excursion (newline-and-indent))) - (indent-according-to-mode) - (end-of-line 0))) - - -;; with the following we can call a function on an environment. Say -;; you have metapost stuff within your TeX file, go to the environment -;; and run ConTeXt-work-on-environment (suggested Key: C-c !). AUCTeX -;; sees that you are inside e.g. \startMPpage....\stopMPpage and -;; looks in ConTeXt-environment-helper for a function to be called. - -;; % so pressing C-c ! inside the following ... -;;\startuseMPgraphic{Logo}{Scale} -;; % Top rectangle -;; filldraw (0,0)--(2cm,0)--(2cm,1cm)--(0,1cm)--cycle withcolor blue ; -;; % Bottom black rectangle -;; drawfill (0,0)--(2cm,0)--(2cm,-1cm)--(0,-1cm)--cycle withcolor black; -;; % White Text -;; draw btex \bf AB etex withcolor white ; -;; % resize to size -;; currentpicture := currentpicture scaled \MPvar{Scale} ; -;; \stopuseMPgraphic - -;; % ...should give you a "new buffer" (currently narrowed to region -;; % and switched to metapost-mode and recursive-edit) - -;; % Top rectangle -;; filldraw (0,0)--(2cm,0)--(2cm,1cm)--(0,1cm)--cycle withcolor blue ; -;; % Bottom black rectangle -;; drawfill (0,0)--(2cm,0)--(2cm,-1cm)--(0,-1cm)--cycle withcolor black; -;; % White Text -;; draw btex \bf AB etex withcolor white ; -;; % resize to size -;; currentpicture := currentpicture scaled \MPvar{Scale} ; - - -(defvar ConTeXt-environment-helper - '(("useMPgraphic" . ConTeXt-mp-region) - ("MPpage" . ConTeXt-mp-region)) - "Alist that holds functions to call for working on regions. -An entry looks like: (\"environment\" . function)") - -(defun ConTeXt-mp-region () - "Edit region in `metapost-mode'." - (ConTeXt-mark-environment t) - (narrow-to-region (mark) (point)) - (metapost-mode) - (message "Type `M-x exit-recursive-edit' to get back") - (recursive-edit) - (context-mode) - (widen)) - -;; find smarter name. Suggestions welcome -(defun ConTeXt-work-on-environment () - "Takes current environment and does something on it (todo: documentation)." - (interactive) - (let ((fun (cdr (assoc (ConTeXt-current-environment) - ConTeXt-environment-helper)))) - (when (functionp fun) - (funcall fun)))) - -(defun ConTeXt-current-environment () - "Return the name of the current environment." - ;; don't make this interactive. - (let ((beg)) - (save-excursion - (ConTeXt-last-unended-start) - (setq beg (+ (point) (length (ConTeXt-environment-start-name)) 1)) - (goto-char (match-end 0)) - (skip-chars-forward "a-zA-Z") - (buffer-substring beg (point))))) - -(defun ConTeXt-last-unended-start () - "Leave point at the beginning of the last `\\start...' that is unstopped looking from the current cursor." - (while (and (re-search-backward "\\\\start[a-zA-Z]*\\|\\\\stop[a-zA-Z]*") - (looking-at "\\\\stop[a-zA-Z]*")) - (ConTeXt-last-unended-start))) - -(defun ConTeXt-mark-environment (&optional inner) - "Set mark to end of current environment (\\start...-\\stop...) and -point to the matching begin. -If optional INNER is not nil, include \\start... and \\stop, otherwise only -the contents." - (interactive) - (let ((cur (point))) - (ConTeXt-find-matching-stop inner) - (set-mark (point)) - (goto-char cur) - (ConTeXt-find-matching-start inner) - (TeX-activate-region))) - -(defun ConTeXt-find-matching-stop (&optional inner) - "Find end of current \\start...\\stop-Pair. -If INNER is non-nil, go to the point just past before -\\stop... macro. Otherwise goto the point just past \\stop..." - (interactive) - (let ((regexp (concat (regexp-quote TeX-esc) - "\\(" - (ConTeXt-environment-start-name) - "\\|" - (ConTeXt-environment-stop-name) - "\\)" - )) - (level 1) - (pos)) - ;;jump over the \start... when at the beginning of it. - (when (looking-at (concat (regexp-quote TeX-esc) - (ConTeXt-environment-start-name))) - (re-search-forward regexp nil t)) - (while (and (> level 0) - (re-search-forward regexp nil t) - (goto-char (1- (match-beginning 1))) - (cond ((looking-at (concat (regexp-quote TeX-esc) - (ConTeXt-environment-start-name))) - (re-search-forward regexp nil t) - (setq level (1+ level))) - ((looking-at (concat (regexp-quote TeX-esc) - (ConTeXt-environment-stop-name))) - (re-search-forward regexp nil t) - (setq level (1- level)))))) - ;; now we have to look if we want to start behind the \start... macro - (if inner - (beginning-of-line) - (skip-chars-forward "a-zA-Z")))) - -(defun ConTeXt-find-matching-start (&optional inner) - "Find beginning of current \\start...\\stop-Pair. -If INNER is non-nil, go to the point just past the \\start... macro." - (interactive) - (let ((regexp (concat (regexp-quote TeX-esc) - "\\(" - (ConTeXt-environment-start-name) - "\\|" - (ConTeXt-environment-stop-name) - "\\)" - )) - (level 1) - (pos)) - (while (and (> level 0) - (re-search-backward regexp nil t) - (cond ((looking-at (concat (regexp-quote TeX-esc) - (ConTeXt-environment-stop-name))) - (setq level (1+ level))) - ((looking-at (concat (regexp-quote TeX-esc) - (ConTeXt-environment-start-name))) - (setq level (1- level)))))) - ;; now we have to look if we want to start behind the \start... macro - (when inner - ;; \startfoo can have 0 or more {} and [] pairs. I assume that - ;; skipping all those parens will be smart enough. It fails when - ;; the first part in the \start-\stop-environment is { or [, like - ;; in \startquotation {\em important} \stopquotation. There is - ;; yet another pitfall: \startsetups SomeSetup foo bar - ;; \stopsetups will use SomeSetup as the argument and the - ;; environment - (skip-chars-forward "\\\\a-zA-Z") - (save-excursion - (while (progn - (skip-chars-forward "\t\n ") - (forward-comment 1) - (skip-chars-forward "\t\n ") - (looking-at "\\s\(")) - (forward-list 1) - (setq pos (point)))) - (when pos - (goto-char pos)) - (unless (bolp) - (forward-line))))) - -;;; items - -(defun ConTeXt-insert-item () - "Insert a new item." - (interactive "*") - (or (TeX-looking-at-backward "^[ \t]*") - (newline)) - (TeX-insert-macro "item") - (indent-according-to-mode)) - - -;;; Macro Argument Hooks - -(defun ConTeXt-optional-argument-insert (arg &optional prefix) - "Insert ARG surrounded by square brackets." - (insert ConTeXt-optop) - (insert arg) - (insert ConTeXt-optcl)) - -(defun ConTeXt-required-argument-insert (arg &optional prefix) - "Insert ARG surrounded by curly braces." - (insert TeX-grop) - (insert arg) - (insert TeX-grcl)) - -(defun ConTeXt-argument-insert (arg optional &optional prefix) - "Insert ARG surrounded by curly braces. - -If OPTIONAL, only insert it if not empty, and then use square brackets." - (if optional - (if - (not (string-equal arg "")) - (ConTeXt-optional-argument-insert arg prefix)) - (ConTeXt-required-argument-insert arg prefix))) - -(defun ConTeXt-arg-ref (optional &optional prompt definition) - "Prompt for a reference completing with known references." - (let ((ref (completing-read (TeX-argument-prompt optional prompt "ref") - (LaTeX-label-list)))) - (if (and definition (not (string-equal "" ref))) - (LaTeX-add-labels ref)) - (ConTeXt-argument-insert ref optional))) - -(defun ConTeXt-arg-define-ref (&optional prompt) - "Prompt for an optional reference completing with known references." - (ConTeXt-arg-ref t prompt t)) - -(defun ConTeXt-arg-setup (optional &optional prompt) - "Prompt for setup arguments." - (let ((setup (read-from-minibuffer - (TeX-argument-prompt optional prompt "Setup")))) - (ConTeXt-argument-insert setup t))) - - -;; paragraph (re)-formatting - -(defvar ConTeXt-item-list () - "List of macro's considered items.") - -(defvar ConTeXt-extra-paragraph-commands - '("crlf" "par") - "List of ConTeXt macros that should have their own line besides the section(-block) commands.") - -(defun ConTeXt-paragraph-commands-regexp () - "Return a regexp matching macros that should have their own line." - (concat - (regexp-quote TeX-esc) "\\(" - "[][]\\|" ; display math delimitors (is this applicable to ConTeXt??) - (ConTeXt-environment-start-name) "\\|" - (ConTeXt-environment-stop-name) "\\|" - (mapconcat 'car ConTeXt-section-list "\\b\\|") "\\b\\|" - (mapconcat 'identity ConTeXt-extra-paragraph-commands "\\b\\|") - "\\b\\|" - (mapconcat 'identity ConTeXt-item-list "\\b\\|") "\\b\\)")) - - -;; Outline support - -(defun ConTeXt-environment-full-start-name (environment) - "Return the ConTeXt macro name that starts ENVIRONMENT. -It is interface aware" - (concat (ConTeXt-environment-start-name) environment)) - -(defun ConTeXt-outline-regexp (&optional anywhere) - "Return regexp for ConTeXt section blocks and sections. - -If optional argument ANYWHERE is not nil, do not require that the -header is at the start of a line." - (concat - (if anywhere "" "^") - "[ \t]*" - (regexp-quote TeX-esc) - "\\(" - (mapconcat 'ConTeXt-environment-full-start-name ConTeXt-section-block-list "\\|") "\\|" - (mapconcat 'car ConTeXt-section-list "\\|") - "\\)\\b" - (if TeX-outline-extra - "\\|" - "") - (mapconcat 'car TeX-outline-extra "\\|") - "\\|" (ConTeXt-header-end) "\\b" - "\\|" (ConTeXt-trailer-start) "\\b")) - -(defvar ConTeXt-text "Name of ConTeXt macro that begins the text body.") - -(defun ConTeXt-header-end () - "Default end of header marker for ConTeXt documents." - (concat - (regexp-quote TeX-esc) - (ConTeXt-environment-start-name) - ConTeXt-text)) - -(defun ConTeXt-trailer-start () - "Default start of trailer marker for ConTeXt documents." - (concat - (regexp-quote TeX-esc) - (ConTeXt-environment-stop-name) - ConTeXt-text)) - -(defun ConTeXt-outline-offset () - "Offset to add to `ConTeXt-section-list' levels to get outline level." - (- 4 (ConTeXt-largest-level))) - -(defun ConTeXt-start-environment-regexp (list) - "Regular expression that matches a start of all environments mentioned in LIST." - (concat - "start\\(" - (mapconcat 'identity list "\\|") - "\\)\\b")) - -;; The top headings are \starttext, \startfrontmatter, \startbodymatter etc. -;; \part, \chapter etc. are children of that. -(defun ConTeXt-outline-level () - "Find the level of current outline heading in an ConTeXt document." - (cond ((looking-at (concat (ConTeXt-header-end) "\\b")) 1) - ((looking-at (concat (ConTeXt-trailer-start) "\\b")) 1) - ((TeX-look-at TeX-outline-extra) - (max 1 (+ (TeX-look-at TeX-outline-extra) - (ConTeXt-outline-offset)))) - (t - (save-excursion - (skip-chars-forward " \t") - (forward-char 1) - (cond ((looking-at (ConTeXt-start-environment-regexp - ConTeXt-section-block-list)) 1) - ((TeX-look-at ConTeXt-section-list) - (max 1 (+ (TeX-look-at ConTeXt-section-list) - (ConTeXt-outline-offset)))) - (t - (error "Unrecognized header"))))))) - - -;;; Fonts - -(defcustom ConTeXt-font-list '((?\C-b "{\\bf " "}") - (?\C-c "{\\sc " "}") - (?\C-e "{\\em " "}") - (?\C-i "{\\it " "}") - (?\C-r "{\\rm " "}") - (?\C-s "{\\sl " "}") - (?\C-t "{\\tt " "}") - (?\C-d "" "" t)) - "List of fonts used by `TeX-font'. - -Each entry is a list. -The first element is the key to activate the font. -The second element is the string to insert before point, and the third -element is the string to insert after point. -If the fourth and fifth element are strings, they specify the prefix and -suffix to be used in math mode. -An optional fourth (or sixth) element means always replace if t." - :group 'TeX-macro - :type '(repeat - (group - :value (?\C-a "" "") - (character :tag "Key") - (string :tag "Prefix") - (string :tag "Suffix") - (option (group - :inline t - (string :tag "Math Prefix") - (string :tag "Math Suffix"))) - (option (sexp :format "Replace\n" :value t))))) - - -;; Imenu support - -(defun ConTeXt-outline-name () - "Guess a name for the current header line." - (save-excursion - (if (re-search-forward "{\\([^\}]*\\)}" (point-at-eol) t) - (match-string 1) - (buffer-substring-no-properties (point) (point-at-eol))))) - -;; This imenu also includes commented out chapters. Perhaps a feature -;; for LaTeX, not sure we want or need that for ConTeXt. - -(defun ConTeXt-imenu-create-index-function () - "Imenu support function for ConTeXt." - (TeX-update-style) - (let (entries level (regexp (ConTeXt-outline-regexp))) - (goto-char (point-max)) - (while (re-search-backward regexp nil t) - (let* ((name (ConTeXt-outline-name)) - (level (make-string (1- (ConTeXt-outline-level)) ?\ )) - (label (concat level level name)) - (mark (make-marker))) - (set-marker mark (point)) - (set-text-properties 0 (length label) nil label) - (setq entries (cons (cons label mark) entries)))) - entries)) - - -;; Indentation, copied from Berend's context mode. -;; TODO: doesn't work great. - -(defvar ConTeXt-indent-allhanging t) -(defvar ConTeXt-indent-arg 2) -(defvar ConTeXt-indent-basic 2) -(defvar ConTeXt-indent-item ConTeXt-indent-basic) -(defvar ConTeXt-indent-item-re "\\\\\item\\>") - -(defvar ConTeXt-indent-syntax-table (make-syntax-table TeX-mode-syntax-table) - "Syntax table used while computing indentation.") - -(progn - (modify-syntax-entry ?$ "." ConTeXt-indent-syntax-table) - (modify-syntax-entry ?\( "." ConTeXt-indent-syntax-table) - (modify-syntax-entry ?\) "." ConTeXt-indent-syntax-table)) - -(defun ConTeXt-indent-line (&optional arg) - (with-syntax-table ConTeXt-indent-syntax-table - ;; TODO: Rather than ignore $, we should try to be more clever about it. - (let ((indent - (save-excursion - (beginning-of-line) - (ConTeXt-find-indent)))) - (if (< indent 0) (setq indent 0)) - (if (<= (current-column) (current-indentation)) - (indent-line-to indent) - (save-excursion (indent-line-to indent)))))) - -(defun ConTeXt-find-indent (&optional virtual) - "Find the proper indentation of text after point. -VIRTUAL if non-nil indicates that we're only trying to find the -indentation in order to determine the indentation of something -else. There might be text before point." - (save-excursion - (skip-chars-forward " \t") - (or - ;; Trust the current indentation, if such info is applicable. - (and virtual (>= (current-indentation) (current-column)) - (current-indentation)) - ;; Put leading close-paren where the matching open brace would be. - (condition-case nil - (and (eq (char-syntax (char-after)) ?\)) - (save-excursion - (skip-syntax-forward " )") - (backward-sexp 1) - (ConTeXt-find-indent 'virtual))) - (error nil)) - ;; Default (maybe an argument) - (let ((pos (point)) - (char (char-after)) - (indent 0) - up-list-pos) - ;; Look for macros to be outdented - (cond ((looking-at (concat (regexp-quote TeX-esc) - (ConTeXt-environment-stop-name))) - (setq indent (- indent ConTeXt-indent-basic))) - ((looking-at ConTeXt-indent-item-re) - (setq indent (- indent ConTeXt-indent-item)))) - ;; Find the previous point which determines our current indentation. - (condition-case err - (progn - (backward-sexp 1) - (while (> (current-column) (current-indentation)) - (backward-sexp 1))) - (scan-error - (setq up-list-pos (nth 2 err)))) - (cond - ((= (point-min) pos) 0) ; We're really just indenting the first line. - ((integerp up-list-pos) - ;; Have to indent relative to the open-paren. - (goto-char up-list-pos) - (if (and (not ConTeXt-indent-allhanging) - (> pos (progn (down-list 1) - (forward-comment (point-max)) - (point)))) - ;; Align with the first element after the open-paren. - (current-column) - ;; We're the first element after a hanging brace. - (goto-char up-list-pos) - (+ indent ConTeXt-indent-basic (ConTeXt-find-indent 'virtual)))) - ;; We're now at the "beginning" of a line. - ((not (and (not virtual) (eq (char-after) ?\\))) - ;; Nothing particular here: just keep the same indentation. - (+ indent (current-column))) - ;; We're now looking at an item. - ((looking-at ConTeXt-indent-item-re) - ;; Indenting relative to an item, have to re-add the outdenting. - (+ indent (current-column) ConTeXt-indent-item)) - ;; We're looking at an environment starter. - ((and (looking-at (concat (regexp-quote TeX-esc) - (ConTeXt-environment-start-name))) - (not (looking-at (concat (regexp-quote TeX-esc) - (ConTeXt-environment-start-name) - ConTeXt-text)))) ; other environments? - (+ indent (current-column) ConTeXt-indent-basic)) - (t - (let ((col (current-column))) - (if (not (and char (eq (char-syntax char) ?\())) - ;; If the first char was not an open-paren, there's - ;; a risk that this is really not an argument to the - ;; macro at all. - (+ indent col) - (forward-sexp 1) - (if (< (line-end-position) - (save-excursion (forward-comment (point-max)) - (point))) - ;; we're indenting the first argument. - (min (current-column) (+ ConTeXt-indent-arg col)) - (skip-syntax-forward " ") - (current-column)))))))))) - - -;; XML inside ConTeXt support - -(defun ConTeXt-last-unended-start-xml () - "Leave point at the beginning of the last `tag' that is unstopped." - (while (and (re-search-backward "<[_A-Za-z][-:._A-Za-z0-9]*\\([ \t\r\n]\\|[_A-Za-z][-:._A-Za-z0-9]*\=\"[^\"]*\"\\)*>\\|") - (looking-at "")) - (ConTeXt-last-unended-start-xml))) - -(defun ConTeXt-close-xml-tag () - "Create an to match the last unclosed <...>. Not fool-proof." - (interactive "*") - (let ((new-line-needed (bolp)) text indentation) - (save-excursion - (condition-case nil - (ConTeXt-last-unended-start-xml) - (error (error "Couldn't find unended XML tag"))) - (setq indentation (current-column)) - (re-search-forward "<\\([_A-Za-z][-:._A-Za-z0-9]*\\)") - (setq text (buffer-substring (match-beginning 1) (match-end 1)))) - (indent-to indentation) - (insert "") - (if new-line-needed (insert ?\n)))) - - -;; Key bindings - -(defvar ConTeXt-mode-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map TeX-mode-map) - - (define-key map "\e\C-a" 'ConTeXt-find-matching-start) - (define-key map "\e\C-e" 'ConTeXt-find-matching-stop) - ;; likely to change in the future - (define-key map "\C-c!" 'ConTeXt-work-on-environment) - (define-key map "\C-c\C-e" 'ConTeXt-environment) - (define-key map "\C-c\n" 'ConTeXt-insert-item) - (or (key-binding "\e\r") - (define-key map "\e\r" 'ConTeXt-insert-item)) ;*** Alias - (define-key map "\C-c]" 'ConTeXt-close-environment) - (define-key map "\C-c\C-s" 'ConTeXt-section) - ;; XML in ConTeXt support - (define-key map "\C-c/" 'ConTeXt-close-xml-tag) - map) - "Keymap used in `ConTeXt-mode'.") - - -;;; Menu building - -;; functions to create menu entries - -;; ConTeXt \start... \stop... pairs -;; (Choose a different name than the one in LaTeX mode. Otherwise the -;; contents of the "Insert Environment" and "Change Environment" menus -;; will not be updated correctly upon loading and switching between -;; LaTeX and ConTeXt files. AFAICS this is due to a bug in -;; easymenu.el not returning the correct keymap when -;; `easy-menu-change' (and therefore `easy-menu-get-map') is called. -;; It just sees an entry with a matching name and returns this first -;; match.) -(defvar ConTeXt-environment-menu-name "Insert Environment (C-c C-e)") - -(defun ConTeXt-environment-menu-entry (entry) - "Create an entry for the environment menu." - (vector (car entry) (list 'ConTeXt-environment-menu (car entry)) t)) - -(defvar ConTeXt-environment-modify-menu-name "Change Environment (C-u C-c C-e)") - -(defun ConTeXt-environment-modify-menu-entry (entry) - "Create an entry for the change environment menu." - (vector (car entry) (list 'ConTeXt-modify-environment (car entry)) t)) - -;; ConTeXt define macros -(defvar ConTeXt-define-menu-name "Define") - -(defun ConTeXt-define-menu-entry (entry) - "Create an entry for the define menu." - (vector entry (list 'ConTeXt-define-menu entry))) - -(defun ConTeXt-define-menu (define) - "Insert DEFINE from menu." - (ConTeXt-insert-define define)) - -;; ConTeXt setup macros -(defvar ConTeXt-setup-menu-name "Setup") - -(defun ConTeXt-setup-menu-entry (entry) - "Create an entry for the setup menu." - (vector entry (list 'ConTeXt-setup-menu entry))) - -(defun ConTeXt-setup-menu (setup) - "Insert SETUP from menu." - (ConTeXt-insert-setup setup)) - -;; ConTeXt referencing macros -(defvar ConTeXt-referencing-menu-name "Referencing") - -(defun ConTeXt-referencing-menu-entry (entry) - "Create an entry for the referencing menu." - (vector entry (list 'ConTeXt-referencing-menu entry))) - -(defun ConTeXt-referencing-menu (referencing) - "Insert REFERENCING from menu." - (ConTeXt-insert-referencing referencing)) - -;; ConTeXt other macros -(defvar ConTeXt-other-macro-menu-name "Other macro") - -(defun ConTeXt-other-macro-menu-entry (entry) - "Create an entry for the other macro menu." - (vector entry (list 'ConTeXt-other-macro-menu entry))) - -(defun ConTeXt-other-macro-menu (other-macro) - "Insert OTHER MACRO from menu." - (ConTeXt-insert-other-macro other-macro)) - - -;; meta-structure project structure menu entries - -(defvar ConTeXt-project-structure-menu-name "Project Structure") - -(defun ConTeXt-project-structure-menu (project-structure) - "Insert project structure from menu." - (ConTeXt-project-structure - (let ((l ConTeXt-project-structure-list)) - (- (length l) (length (member project-structure l)))))) - -(defun ConTeXt-project-structure-menu-entry (entry) - "Create an ENTRY for the project structure menu." - (vector entry (list 'ConTeXt-project-structure-menu entry))) - - -;; meta-structure section blocks menu entries - -(defvar ConTeXt-section-block-menu-name "Section Block") - -(defun ConTeXt-section-block-menu (section-block) - "Insert section block from menu." - (ConTeXt-section-block section-block)) - -(defun ConTeXt-section-block-menu-entry (entry) - "Create an ENTRY for the section block menu." - (vector entry (list 'ConTeXt-section-block-menu entry))) - - -;; section menu entries - -(defvar ConTeXt-section-menu-name "Section (C-c C-s)") - -(defun ConTeXt-section-enable-symbol (level) - "Symbol used to enable section LEVEL in the menu bar." - (intern (concat "ConTeXt-section-" (int-to-string level) "-enable"))) - -(defun ConTeXt-section-enable (entry) - "Enable or disable section ENTRY from `ConTeXt-section-list'." - (let ((level (nth 1 entry))) - (set (ConTeXt-section-enable-symbol level) - (>= level ConTeXt-largest-level)))) - -(defun ConTeXt-section-menu (level) - "Insert section from menu." - (let ((ConTeXt-section-hook (delq 'ConTeXt-section-heading - (copy-sequence ConTeXt-section-hook)))) - (ConTeXt-section level))) - -(defun ConTeXt-section-menu-entry (entry) - "Create an ENTRY for the section menu." - (let ((enable (ConTeXt-section-enable-symbol (nth 1 entry)))) - (set enable t) - (vector (car entry) (list 'ConTeXt-section-menu (nth 1 entry)) enable))) - - -;; etexshow support - -(defun ConTeXt-etexshow () - "Call etexshow, if available, to show the definition of a ConText macro." - (interactive) - (if (fboundp 'etexshow) - (let () - (require 'etexshow) - (funcall (symbol-function 'etexshow-cmd))) - (error "etexshow is not installed. Get it from http://levana.de/emacs/"))) - -;; menu itself - -(easy-menu-define ConTeXt-mode-command-menu - ConTeXt-mode-map - "Command menu used in ConTeXt mode." - (TeX-mode-specific-command-menu 'context-mode)) - -;; it seems the menu is evaluated at compile/load-time -;; we don't have ConTeXt-current-interface at that time -;; so make sure to do updates based on that variable in -;; ConTeXt-menu-update -(easy-menu-define ConTeXt-mode-menu - ConTeXt-mode-map - "Menu used in ConTeXt mode." - (TeX-menu-with-help - `("ConTeXt" - (,ConTeXt-project-structure-menu-name) - (,ConTeXt-section-block-menu-name) - (,ConTeXt-section-menu-name) - ["Add Table of Contents to Emacs Menu" (imenu-add-to-menubar "TOC") t] - "-" - ["Macro ..." TeX-insert-macro - :help "Insert a macro and possibly arguments"] - ["Complete" TeX-complete-symbol - :help "Complete the current macro or environment name"] - ["Show ConTeXt Macro Definition" ConTeXt-etexshow] - "-" - (,ConTeXt-environment-menu-name) - (,ConTeXt-environment-modify-menu-name) - ["Item" ConTeXt-insert-item - :help "Insert a new \\item into current environment"] - (,ConTeXt-define-menu-name) - (,ConTeXt-setup-menu-name) - (,ConTeXt-other-macro-menu-name) - "-" - ("Insert Font" - ["Emphasize" (TeX-font nil ?\C-e) :keys "C-c C-f C-e"] - ["Bold" (TeX-font nil ?\C-b) :keys "C-c C-f C-b"] - ["Typewriter" (TeX-font nil ?\C-t) :keys "C-c C-f C-t"] - ["Small Caps" (TeX-font nil ?\C-c) :keys "C-c C-f C-c"] - ["Sans Serif" (TeX-font nil ?\C-f) :keys "C-c C-f C-f"] - ["Italic" (TeX-font nil ?\C-i) :keys "C-c C-f C-i"] - ["Slanted" (TeX-font nil ?\C-s) :keys "C-c C-f C-s"] - ["Roman" (TeX-font nil ?\C-r) :keys "C-c C-f C-r"] - ["Calligraphic" (TeX-font nil ?\C-a) :keys "C-c C-f C-a"]) - ("Replace Font" - ["Emphasize" (TeX-font t ?\C-e) :keys "C-u C-c C-f C-e"] - ["Bold" (TeX-font t ?\C-b) :keys "C-u C-c C-f C-b"] - ["Typewriter" (TeX-font t ?\C-t) :keys "C-u C-c C-f C-t"] - ["Small Caps" (TeX-font t ?\C-c) :keys "C-u C-c C-f C-c"] - ["Sans Serif" (TeX-font t ?\C-f) :keys "C-u C-c C-f C-f"] - ["Italic" (TeX-font t ?\C-i) :keys "C-u C-c C-f C-i"] - ["Slanted" (TeX-font t ?\C-s) :keys "C-u C-c C-f C-s"] - ["Roman" (TeX-font t ?\C-r) :keys "C-u C-c C-f C-r"] - ["Calligraphic" (TeX-font t ?\C-a) :keys "C-u C-c C-f C-a"]) - ["Delete Font" (TeX-font t ?\C-d) :keys "C-c C-f C-d"] - "-" - ["Comment or Uncomment Region" - TeX-comment-or-uncomment-region - :help "Make the selected region outcommented or active again"] - ["Comment or Uncomment Paragraph" - TeX-comment-or-uncomment-paragraph - :help "Make the current paragraph outcommented or active again"] - ,TeX-fold-menu - "-" . ,TeX-common-menu-entries))) - -(defun ConTeXt-menu-update (&optional menu) - "Update entries on AUCTeX menu." - (or (not (memq major-mode '(context-mode))) - (null ConTeXt-menu-changed) - (not (fboundp 'easy-menu-change)) - (progn - (TeX-update-style) - (setq ConTeXt-menu-changed nil) - (message "Updating section menu...") - (mapc 'ConTeXt-section-enable ConTeXt-section-list) - (message "Updating environment menu...") - (easy-menu-change '("ConTeXt") ConTeXt-environment-menu-name - (LaTeX-split-long-menu - (mapcar 'ConTeXt-environment-menu-entry - (ConTeXt-environment-list)))) - (message "Updating modify environment menu...") - (easy-menu-change '("ConTeXt") ConTeXt-environment-modify-menu-name - (LaTeX-split-long-menu - (mapcar 'ConTeXt-environment-modify-menu-entry - (ConTeXt-environment-list)))) - (message "Updating define menu...") - (easy-menu-change '("ConTeXt") ConTeXt-define-menu-name - (LaTeX-split-long-menu - (mapcar 'ConTeXt-define-menu-entry - ConTeXt-define-list))) - (message "Updating setup menu...") - (easy-menu-change '("ConTeXt") ConTeXt-setup-menu-name - (LaTeX-split-long-menu - (mapcar 'ConTeXt-setup-menu-entry - ConTeXt-setup-list))) - (message "Updating referencing menu...") - (easy-menu-change '("ConTeXt") ConTeXt-referencing-menu-name - (LaTeX-split-long-menu - (mapcar 'ConTeXt-referencing-menu-entry - ConTeXt-referencing-list))) - (message "Updating other macro's menu...") - (easy-menu-change '("ConTeXt") ConTeXt-other-macro-menu-name - (LaTeX-split-long-menu - (mapcar 'ConTeXt-other-macro-menu-entry - ConTeXt-other-macro-list))) - (message "Updating project structure menu...") - (easy-menu-change '("ConTeXt") ConTeXt-project-structure-menu-name - (LaTeX-split-long-menu - (mapcar 'ConTeXt-project-structure-menu-entry - ConTeXt-project-structure-list))) - (message "Updating section block menu...") - (easy-menu-change '("ConTeXt") ConTeXt-section-block-menu-name - (LaTeX-split-long-menu - (mapcar 'ConTeXt-section-block-menu-entry - ConTeXt-section-block-list))) - (message "Updating section menu...") - (easy-menu-change '("ConTeXt") ConTeXt-section-menu-name - (LaTeX-split-long-menu - (mapcar 'ConTeXt-section-menu-entry - ConTeXt-section-list))) - (message "Updating...done") - (and menu (easy-menu-return-item ConTeXt-mode-menu menu)) - ))) - -;;; Option expander - -(defvar ConTeXt-texexec-option-nonstop "--nonstop " - "Command line option for texexec to use nonstopmode.") - -(defun ConTeXt-expand-options () - "Expand options for texexec command." - (concat - (let ((engine (nth 4 (assq TeX-engine (TeX-engine-alist))))) - (when engine - (format "--engine=%s " engine))) - (unless (eq ConTeXt-current-interface "en") - (format "--interface=%s " ConTeXt-current-interface)) - (when TeX-source-correlate-mode - (format "--passon=\"%s\" " - (if (eq TeX-source-correlate-method-active 'synctex) - TeX-synctex-tex-flags - TeX-source-specials-tex-flags))) - (unless TeX-interactive-mode - ConTeXt-texexec-option-nonstop))) - -;;; Mode - -;; ConTeXt variables that are interface aware -;; They are mapped to interface specific variables - -(defvar ConTeXt-language-variable-list - '(ConTeXt-define-list ConTeXt-setup-list ConTeXt-referencing-list ConTeXt-other-macro-list - ConTeXt-project-structure-list - ConTeXt-section-block-list ConTeXt-section-list - ConTeXt-text ConTeXt-item-list)) - -(defcustom ConTeXt-clean-intermediate-suffixes - ;; See *suffixes in texutil.pl. - '("\\.tui" "\\.tup" "\\.ted" "\\.tes" "\\.top" "\\.log" "\\.tmp" "\\.run" - "\\.bck" "\\.rlg" "\\.mpt" "\\.mpx" "\\.mpd" "\\.mpo" "\\.tuo" "\\.tub" - "\\.top" "-mpgraph\\.mp" "-mpgraph\\.mpd" "-mpgraph\\.mpo" "-mpgraph\\.mpy" - "-mprun\\.mp" "-mprun\\.mpd" "-mprun\\.mpo" "-mprun\\.mpy") - "List of regexps matching suffixes of files to be deleted. -The regexps will be anchored at the end of the file name to be matched, -i.e. you do _not_ have to cater for this yourself by adding \\\\' or $." - :type '(repeat regexp) - :group 'TeX-command) - -(defcustom ConTeXt-clean-output-suffixes - '("\\.dvi" "\\.pdf" "\\.ps") - "List of regexps matching suffixes of files to be deleted. -The regexps will be anchored at the end of the file name to be matched, -i.e. you do _not_ have to cater for this yourself by adding \\\\' or $." - :type '(repeat regexp) - :group 'TeX-command) - -(defun ConTeXt-mode-common-initialization () - "Initialization code that is common for all ConTeXt interfaces." - ;; `plain-TeX-common-initialization' kills all local variables, but - ;; we need to keep ConTeXt-current-interface, so save and restore - ;; it. - (let (save-ConTeXt-current-interface) - (setq save-ConTeXt-current-interface ConTeXt-current-interface) - (plain-TeX-common-initialization) - (setq ConTeXt-current-interface save-ConTeXt-current-interface)) - (setq major-mode 'context-mode) - - ;; Make language specific variables buffer local - (dolist (symbol ConTeXt-language-variable-list) - (make-variable-buffer-local symbol)) - - (require (intern (concat "context-" ConTeXt-current-interface))) - (dolist (symbol ConTeXt-language-variable-list) - (set symbol (symbol-value (intern (concat (symbol-name symbol) "-" - ConTeXt-current-interface))))) - - - ;; What's the deepest level at we can collapse a document? - ;; set only if user has not set it. Need to be set before menu is created. - ;; level 2 is "section" - (or ConTeXt-largest-level - (setq ConTeXt-largest-level 2)) - - ;; keybindings - (use-local-map ConTeXt-mode-map) - - ;; Indenting - (set (make-local-variable 'indent-line-function) 'ConTeXt-indent-line) - (set (make-local-variable 'fill-indent-according-to-mode) t) - - ;; Paragraph formatting - (set (make-local-variable 'LaTeX-syntactic-comments) nil) - (set (make-local-variable 'LaTeX-paragraph-commands-regexp) - (ConTeXt-paragraph-commands-regexp)) - (set (make-local-variable 'paragraph-ignore-fill-prefix) t) - (set (make-local-variable 'fill-paragraph-function) 'LaTeX-fill-paragraph) - (set (make-local-variable 'adaptive-fill-mode) nil) - (setq paragraph-start - (concat - "[ \t]*\\(" - (ConTeXt-paragraph-commands-regexp) "\\|" - "\\$\\$\\|" ; Plain TeX display math - "$\\)")) - (setq paragraph-separate - (concat - "[ \t]*\\(" - "\\$\\$" ; Plain TeX display math - "\\|$\\)")) - - ;; Keybindings and menu - (use-local-map ConTeXt-mode-map) - (easy-menu-add ConTeXt-mode-menu ConTeXt-mode-map) - (easy-menu-add ConTeXt-mode-command-menu ConTeXt-mode-map) - (setq ConTeXt-menu-changed t) - - (if (= emacs-major-version 20) - (make-local-hook 'activate-menubar-hook)) - (add-hook 'activate-menubar-hook 'ConTeXt-menu-update nil t) - - ;; Outline support - (require 'outline) - (set (make-local-variable 'outline-level) 'ConTeXt-outline-level) - (set (make-local-variable 'outline-regexp) (ConTeXt-outline-regexp t)) - ;;(make-local-variable 'outline-heading-end-regexp) - (setq TeX-header-end (ConTeXt-header-end) - TeX-trailer-start (ConTeXt-trailer-start)) - - ;; font switch support - (set (make-local-variable 'TeX-font-list) ConTeXt-font-list) - - ;; imenu support - (set (make-local-variable 'imenu-create-index-function) - 'ConTeXt-imenu-create-index-function) - - ;; run hooks - (setq TeX-command-default "ConTeXt") - (setq TeX-sentinel-default-function 'TeX-ConTeXt-sentinel) - (TeX-run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'ConTeXt-mode-hook)) - -(defun context-guess-current-interface () - "Guess what ConTeXt interface the current buffer is using." - (interactive) - (save-excursion - (goto-char (point-min)) - (setq ConTeXt-current-interface - (cond ((re-search-forward "%.*?interface=en" (+ 512 (point)) t) - "en") - ((re-search-forward "%.*?interface=nl" (+ 512 (point)) t) - "nl") - ((re-search-forward "\\\\starttext" (+ 1024 (point)) t) - "en") - ((re-search-forward "\\\\starttekst" (+ 1024 (point)) t) - "nl") - (t - ConTeXt-default-interface))))) - -;;;###autoload -(defalias 'ConTeXt-mode 'context-mode) - -;;;###autoload -(defun context-mode () - "Major mode in AUCTeX for editing ConTeXt files. - -Special commands: -\\{ConTeXt-mode-map} - -Entering `context-mode' calls the value of `text-mode-hook', -then the value of `TeX-mode-hook', and then the value -of context-mode-hook." - (interactive) - (context-guess-current-interface) - (require (intern (concat "context-" ConTeXt-current-interface))) - (funcall (intern (concat "context-" ConTeXt-current-interface "-mode")))) - -(provide 'context) - -;;; context.el ends here diff --git a/packages/auctex/dir b/packages/auctex/dir deleted file mode 100644 index 0b85f603a..000000000 --- a/packages/auctex/dir +++ /dev/null @@ -1,25 +0,0 @@ -This is the file .../info/dir, which contains the -topmost node of the Info hierarchy, called (dir)Top. -The first time you invoke Info you start off looking at this node. - -File: dir, Node: Top This is the top of the INFO tree - - This (the Directory node) gives a menu of major topics. - Typing "q" exits, "?" lists all Info commands, "d" returns here, - "h" gives a primer for first-timers, - "mEmacs" visits the Emacs manual, etc. - - In Emacs, you can click mouse button 2 on a menu item or cross reference - to select it. - -* Menu: - -Emacs -* AUCTeX: (auctex). A sophisticated TeX environment for Emacs. -* preview-latex: (preview-latex). - Preview LaTeX fragments in Emacs - -TeX -* AUCTeX: (auctex). A sophisticated TeX environment for Emacs. -* preview-latex: (preview-latex). - Preview LaTeX fragments in Emacs diff --git a/packages/auctex/doc/auctex.texi b/packages/auctex/doc/auctex.texi deleted file mode 100644 index 848cf8fd8..000000000 --- a/packages/auctex/doc/auctex.texi +++ /dev/null @@ -1,4257 +0,0 @@ -\input texinfo -@comment %**start of header -@setfilename auctex.info -@include version.texi -@settitle AUCTeX @value{VERSION} -@c footnotestyle separate -@c paragraphindent 2 -@comment %**end of header -@include macros.texi -@copying -This manual is for @AUCTeX{} -(version @value{VERSION} from @value{UPDATED}), -a sophisticated TeX environment for Emacs. - -Copyright @copyright{} 1992, 1993, 1994, 1995, 2001, 2002, 2004, 2005, -2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. - -@quotation -Permission is granted to copy, distribute and/or modify this document -under the terms of the GNU Free Documentation License, Version 1.3 or -any later version published by the Free Software Foundation; with no -Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. A -copy of the license is included in the section entitled ``GNU Free -Documentation License.'' -@end quotation -@end copying - -@dircategory Emacs -@direntry -* AUCTeX: (auctex). A sophisticated TeX environment for Emacs. -@end direntry -@dircategory TeX -@direntry -* AUCTeX: (auctex). A sophisticated TeX environment for Emacs. -@end direntry - -@iftex -@tolerance 10000 @emergencystretch 3em -@end iftex - -@finalout -@titlepage -@title @AUCTeX{} -@subtitle A sophisticated @TeX{} environment for Emacs -@subtitle Version @value{VERSION}, @value{UPDATED} -@author Kresten Krab Thorup -@author Per Abrahamsen -@author David Kastrup and others -@page -@vskip 0pt plus 1filll -@insertcopying -@end titlepage - -@c Use @ifinfo _and_ @ifhtml here because Texinfo 3 cannot cope with -@c @ifnottex around a top node. -@ifinfo -@node top -@top @AUCTeX{} - -This manual may be copied under the conditions spelled out in -@ref{Copying this Manual}. - -@end ifinfo -@ifhtml -@node top -@top @AUCTeX{} -@insertcopying -@end ifhtml - -@contents - -@iftex -@unnumbered Executive Summary -@end iftex - -@AUCTeX{} is an integrated environment for editing @LaTeX{}, @ConTeXt{}, -doc@TeX{}, Texinfo, and @TeX{} files. - -Although @AUCTeX{} contains a large number of features, there are no -reasons to despair. You can continue to write @TeX{} and @LaTeX{} -documents the way you are used to, and only start using the multiple -features in small steps. @AUCTeX{} is not monolithic, each feature -described in this manual is useful by itself, but together they provide -an environment where you will make very few @LaTeX{} errors, and makes it -easy to find the errors that may slip through anyway. - -It is a good idea to make a printout of @AUCTeX{}'s reference card -@file{tex-ref.tex} or one of its typeset versions. - -If you want to make @AUCTeX{} aware of style files and multi-file -documents right away, insert the following in your @file{.emacs} file. - -@lisp -(setq TeX-auto-save t) -(setq TeX-parse-self t) -(setq-default TeX-master nil) -@end lisp - -Another thing you should enable is Ref@TeX{}, a comprehensive solution -for managing cross references, bibliographies, indices, document -navigation and a few other things. (@pxref{Installation,,,reftex,The -Ref@TeX{} manual}) - -For detailed information about the @previewlatex{} subsystem of -@AUCTeX{}, see @ref{Top,,Introduction,preview-latex,The @previewlatex{} -Manual}. - -There is a mailing list for general discussion about @AUCTeX{}: write a -mail with ``subscribe'' in the subject to -@email{auctex-request@@gnu.org} to join it. Send contributions to -@email{auctex@@gnu.org}. - -Bug reports should go to @email{bug-auctex@@gnu.org}, suggestions for -new features, and pleas for help should go to either -@email{auctex-devel@@gnu.org} (the @AUCTeX{} developers), or to -@email{auctex@@gnu.org} if they might have general interest. Please use -the command @kbd{M-x TeX-submit-bug-report RET} to report bugs if -possible. You can subscribe to a low-volume announcement list by -sending ``subscribe'' in the subject of a mail to -@email{info-auctex-request@@gnu.org}. - -@menu -* Copying:: Copying -* Introduction:: Introduction to @AUCTeX{} -* Editing:: Editing the Document Source -* Display:: Controlling Screen Display -* Processing:: Starting Processors, Viewers and Other Programs -* Customization:: Customization and Extension -* Appendices:: Copying, Changes, Development, FAQ -* Indices:: Indices - -@detailmenu - --- The Detailed Node Listing --- - -Introduction - -* Summary:: Overview of @AUCTeX{} -* Installation:: Installing @AUCTeX{} -* Quick Start:: Quick Start - -Editing the Document Source - -* Quotes:: Inserting double quotes -* Font Specifiers:: Inserting Font Specifiers -* Sectioning:: Inserting chapters, sections, etc. -* Environments:: Inserting Environment Templates -* Mathematics:: Entering Mathematics -* Completion:: Completion of macros -* Commenting:: Commenting text -* Indenting:: Reflecting syntactic constructs with whitespace -* Filling:: Automatic and manual line breaking - -Inserting Environment Templates - -* Equations:: Equations -* Floats:: Floats -* Itemize-like:: Itemize-like Environments -* Tabular-like:: Tabular-like Environments -* Customizing Environments:: Customizing Environments - -Controlling Screen Display - -* Font Locking:: Font Locking -* Folding:: Folding Macros and Environments -* Outline:: Outlining the Document - -Font Locking - -* Fontification of macros:: Fontification of macros -* Fontification of quotes:: Fontification of quotes -* Fontification of math:: Fontification of math constructs -* Verbatim content:: Verbatim macros and environments -* Faces:: Faces used by font-latex - -Starting Processors, Viewers and Other Programs - -* Commands:: Invoking external commands. -* Viewing:: Invoking external viewers. -* Debugging:: Debugging @TeX{} and @LaTeX{} output. -* Checking:: Checking the document. -* Control:: Controlling the processes. -* Cleaning:: Cleaning intermediate and output files. -* Documentation:: Documentation about macros and packages. - -Viewing the Formatted Output - -* Starting Viewers:: Starting viewers -* I/O Correlation:: Forward and inverse search - -Customization and Extension - -* Multifile:: Multifile Documents -* Parsing Files:: Automatic Parsing of @TeX{} Files -* Internationalization:: Language Support -* Automatic:: Automatic Customization -* Style Files:: Writing Your Own Style Support - -Language Support - -* European:: Using @AUCTeX{} with European Languages -* Japanese:: Using @AUCTeX{} with Japanese - -Automatic Customization - -* Automatic Global:: Automatic Customization for the Site -* Automatic Private:: Automatic Customization for a User -* Automatic Local:: Automatic Customization for a Directory - -Writing Your Own Style Support - -* Simple Style:: A Simple Style File -* Adding Macros:: Adding Support for Macros -* Adding Environments:: Adding Support for Environments -* Adding Other:: Adding Other Information -* Hacking the Parser:: Automatic Extraction of New Things - -Copying, Changes, Development, FAQ - -* Copying this Manual:: -* Changes:: -* Development:: -* FAQ:: - -Copying this Manual - -* GNU Free Documentation License:: License for copying this manual. - -Indices - -* Key Index:: -* Function Index:: -* Variable Index:: -* Concept Index:: - -@end detailmenu -@end menu - -@node Copying -@unnumbered Copying -@cindex Copying -@cindex Copyright -@cindex GPL -@cindex General Public License -@cindex License -@cindex Free -@cindex Free software -@cindex Distribution -@cindex Right -@cindex Warranty - -@c This text adapted from the Texinfo 2.16 distribution. - -@AUCTeX{} primarily consists of Lisp files for Emacs (and XEmacs), but -there are also installation scripts and files and @TeX{} support files. -All of those are @dfn{free}; this means that everyone is free to use -them and free to redistribute them on a free basis. The files of -@AUCTeX{} are not in the public domain; they are copyrighted and there -are restrictions on their distribution, but these restrictions are -designed to permit everything that a good cooperating citizen would want -to do. What is not allowed is to try to prevent others from further -sharing any version of these programs that they might get from you. - -Specifically, we want to make sure that you have the right to give away -copies of the files that constitute @AUCTeX{}, that you receive source -code or else can get it if you want it, that you can change these files -or use pieces of them in new free programs, and that you know you can do -these things. - -To make sure that everyone has such rights, we have to forbid you to -deprive anyone else of these rights. For example, if you distribute -copies of parts of @AUCTeX{}, you must give the recipients all the -rights that you have. You must make sure that they, too, receive or can -get the source code. And you must tell them their rights. - -Also, for our own protection, we must make certain that everyone finds -out that there is no warranty for @AUCTeX{}. If any parts are modified -by someone else and passed on, we want their recipients to know that -what they have is not what we distributed, so that any problems -introduced by others will not reflect on our reputation. - -The precise conditions of the licenses for the files currently being -distributed as part of @AUCTeX{} are found in the General Public -Licenses that accompany them. This manual specifically is covered by -the GNU Free Documentation License (@pxref{Copying this Manual}). - -@node Introduction -@chapter Introduction - -@menu -* Summary:: Overview of @AUCTeX{} -* Installation:: Installing @AUCTeX{} -* Quick Start:: Quick Start -@end menu - -@lowersections -@include intro.texi - -@include install.texi - -@include quickstart.texi -@raisesections - -@node Editing -@chapter Editing the Document Source - -The most commonly used commands/macros of @AUCTeX{} are those which -simply insert templates for often used @TeX{}, @LaTeX{}, or @ConTeXt{} -constructs, like font changes, handling of environments, etc. These -features are very simple, and easy to learn, and help you avoid mistakes -like mismatched braces, or @samp{\begin@{@}}-@samp{\end@{@}} pairs. - -Apart from that this chapter contains a description of some features for -entering more specialized sorts of text, for formatting the source by -indenting and filling and for navigating through the document. - -@menu -* Quotes:: Inserting double quotes -* Font Specifiers:: Inserting Font Specifiers -* Sectioning:: Inserting chapters, sections, etc. -* Environments:: Inserting Environment Templates -* Mathematics:: Entering Mathematics -* Completion:: Completion of macros -* Commenting:: Commenting text -* Indenting:: Reflecting syntactic constructs with whitespace -* Filling:: Automatic and manual line breaking -@end menu - -@node Quotes -@section Insertion of Quotes, Dollars, and Braces - -@cindex Quotes -@cindex Double quotes -@cindex Braces -@cindex Brackets -@cindex Dollars -@cindex Math mode delimiters -@cindex Matching dollar signs -@cindex Display math mode - -@subheading Quotation Marks - -In @TeX{}, literal double quotes @samp{"like this"} are seldom used, -instead two single quotes are used @samp{``like this''}. To help you -insert these efficiently, @AUCTeX{} allows you to continue to press -@kbd{"} to insert two single quotes. To get a literal double quote, -press @kbd{"} twice. - -@deffn Command TeX-insert-quote @var{count} -@kindex " -(@kbd{"}) Insert the appropriate quote marks for @TeX{}. - -Inserts the value of @code{TeX-open-quote} (normally @samp{``}) or -@code{TeX-close-quote} (normally @samp{''}) depending on the context. -With prefix argument, always inserts @samp{"} characters. -@end deffn - -@defopt TeX-open-quote -String inserted by typing @kbd{"} to open a quotation. -(@xref{European}, for language-specific quotation mark insertion.) -@end defopt - -@defopt TeX-close-quote -String inserted by typing @kbd{"} to close a quotation. -(@xref{European}, for language-specific quotation mark insertion.) -@end defopt - -@defopt TeX-quote-after-quote -Determines the behavior of @kbd{"}. If it is non-nil, typing @kbd{"} -will insert a literal double quote. The respective values of -@code{TeX-open-quote} and @code{TeX-close-quote} will be inserted -after typing @kbd{"} once again. -@end defopt - -The @samp{babel} package provides special support for the requirements -of typesetting quotation marks in many different languages. If you use -this package, either directly or by loading a language-specific style -file, you should also use the special commands for quote insertion -instead of the standard quotes shown above. @AUCTeX{} is able to -recognize several of these languages and will change quote insertion -accordingly. @xref{European}, for details about this feature and how to -control it. - -@vindex LaTeX-csquotes-open-quote -@vindex LaTeX-csquotes-close-quote -@vindex LaTeX-csquotes-quote-after-quote -In case you are using the @samp{csquotes} package, you should customize -@code{LaTeX-csquotes-open-quote}, @code{LaTeX-csquotes-close-quote} and -@code{LaTeX-csquotes-quote-after-quote}. The quotation characters will -only be used if both variables---@code{LaTeX-csquotes-open-quote} and -@code{LaTeX-csquotes-close-quote}---are non-empty strings. But then the -@samp{csquotes}-related values will take precedence over the -language-specific ones. - -@subheading Dollar Signs - -In @AUCTeX{}, dollar signs should match like they do in @TeX{}. This -has been partially implemented, we assume dollar signs always match -within a paragraph. The first @samp{$} you insert in a paragraph will -do nothing special. The second @samp{$} will match the first. This -will be indicated by moving the cursor temporarily over the first dollar -sign. - -@deffn Command TeX-insert-dollar @var{arg} -@kindex $ -(@kbd{$}) Insert dollar sign. - -Show matching dollar sign if this dollar sign end the @TeX{} math mode. -Ensure double dollar signs match up correctly by inserting extra dollar -signs when needed if @code{TeX-math-close-double-dollar} is non-nil. - -With optional @var{arg}, insert that many dollar signs. -@end deffn - -@defopt TeX-math-close-double-dollar -Control the insertion of double dollar signs for delimiting display -math. (Note that you should not use double dollar signs in @LaTeX{} -because this practice can lead to wrong spacing in typeset documents.) -If the variable is non-nil and you enter a dollar sign that matches a -double dollar sign @samp{$$} @AUCTeX{} will automatically insert two -dollar signs. -@end defopt - -@subheading Braces - -To avoid unbalanced braces, it is useful to insert them pairwise. You -can do this by typing @kbd{C-c @{}. - -@deffn Command TeX-insert-braces -@kindex C-c @{ -(@kbd{C-c @{}) Make a pair of braces and position the cursor -to type inside of them. If there is an active region, put braces around -it and leave point after the closing brace. -@end deffn - -@node Font Specifiers -@section Inserting Font Specifiers - -@cindex Fonts -@cindex Font macros -@cindex Changing font -@cindex Specifying a font - -Perhaps the most used keyboard commands of @AUCTeX{} are the short-cuts -available for easy insertion of font changing macros. - -If you give an argument (that is, type @kbd{C-u}) to the font command, -the innermost font will be replaced, i.e. the font in the @TeX{} group -around point will be changed. The following table shows the available -commands, with @code{@point{}} indicating the position where the text -will be inserted. - -@table @kbd -@item C-c C-f C-b -@kindex C-c C-f C-b -@cindex @code{\textbf} -Insert @b{bold face} @samp{\textbf@{@point{}@}} text. - -@item C-c C-f C-i -@kindex C-c C-f C-i -@cindex @code{\textit} -Insert @i{italics} @samp{\textit@{@point{}@}} text. - -@item C-c C-f C-e -@kindex C-c C-f C-e -@cindex @code{\emph} -Insert @i{emphasized} @samp{\emph@{@point{}@}} text. - -@item C-c C-f C-s -@kindex C-c C-f C-s -@cindex @code{\textsl} -Insert @i{slanted} @samp{\textsl@{@point{}@}} text. - -@item C-c C-f C-r -@kindex C-c C-f C-r -@cindex @code{\textrm} -Insert roman @r{\textrm@{@point{}@}} text. - -@item C-c C-f C-f -@kindex C-c C-f C-f -@cindex @code{\textsf} -Insert @sans{sans serif} @samp{\textsf@{@point{}@}} text. - -@item C-c C-f C-t -@kindex C-c C-f C-t -@cindex @code{\texttt} -Insert @t{typewriter} @samp{\texttt@{@point{}@}} text. - -@item C-c C-f C-c -@kindex C-c C-f C-c -@cindex @code{\textsc} -Insert @sc{small caps} @samp{\textsc@{@point{}@}} text. - -@item C-c C-f C-d -@kindex C-c C-f C-c -@cindex Deleting fonts -Delete the innermost font specification containing point. - -@end table - -@deffn Command TeX-font replace what -@kindex C-c C-f -(@kbd{C-c C-f}) Insert template for font change command. - -If @var{replace} is not nil, replace current font. @var{what} -determines the font to use, as specified by @code{TeX-font-list}. -@end deffn - -@defopt TeX-font-list -List of fonts used by @code{TeX-font}. - -Each entry is a list with three elements. The first element is the -key to activate the font. The second element is the string to insert -before point, and the third element is the string to insert after -point. An optional fourth element means always replace if not nil. -@end defopt - -@defopt LaTeX-font-list -List of fonts used by @code{TeX-font} in LaTeX mode. It has the same -structure as @code{TeX-font-list}. -@end defopt - -@node Sectioning -@section Inserting chapters, sections, etc. -@cindex Sectioning -@cindex Sections -@cindex Chapters -@cindex @code{\chapter} -@cindex @code{\section} -@cindex @code{\subsection} -@cindex @code{\label} - -Insertion of sectioning macros, that is @samp{\chapter}, -@samp{\section}, @samp{\subsection}, etc. and accompanying -@samp{\label}'s may be eased by using @kbd{C-c C-s}. This command is -highly customizable, the following describes the default behavior. - -When invoking you will be asked for a section macro to insert. An -appropriate default is automatically selected by @AUCTeX{}, that is -either: at the top of the document; the top level sectioning for that -document style, and any other place: The same as the last occurring -sectioning command. - -Next, you will be asked for the actual name of that section, and -last you will be asked for a label to be associated with that section. -The label will be prefixed by the value specified in -@code{LaTeX-section-hook}. - -@deffn Command LaTeX-section @var{arg} -@kindex C-c C-s -(@kbd{C-c C-s}) Insert a sectioning command. - -Determine the type of section to be inserted, by the argument -@var{arg}. - -@itemize @bullet -@item -If @var{arg} is nil or missing, use the current level. -@item -If @var{arg} is a list (selected by C-u), go downward one level. -@item -If @var{arg} is negative, go up that many levels. -@item -If @var{arg} is positive or zero, use absolute level: -@itemize + -@item -0 : part -@item -1 : chapter -@item -2 : section -@item -3 : subsection -@item -4 : subsubsection -@item -5 : paragraph -@item -6 : subparagraph -@end itemize -@end itemize - -The following variables can be set to customize the function. - -@vtable @code -@item LaTeX-section-hook -Hooks to be run when inserting a section. -@item LaTeX-section-label -Prefix to all section references. -@end vtable - -@end deffn - -The precise behavior of @code{LaTeX-section} is defined by the contents -of @code{LaTeX-section-hook}. - -@defopt LaTeX-section-hook -List of hooks to run when a new section is inserted. - -The following variables are set before the hooks are run - -@table @var -@item level -Numeric section level, default set by prefix arg to @code{LaTeX-section}. -@item name -Name of the sectioning command, derived from @var{level}. -@item title -The title of the section, default to an empty string. -@item toc -Entry for the table of contents list, default nil. -@item done-mark -Position of point afterwards, default nil meaning after the inserted -text. -@end table - -A number of hooks are already defined. Most likely, you will be able to -get the desired functionality by choosing from these hooks. - -@ftable @code -@item LaTeX-section-heading -Query the user about the name of the sectioning command. Modifies -@var{level} and @var{name}. -@item LaTeX-section-title -Query the user about the title of the section. Modifies @var{title}. -@item LaTeX-section-toc -Query the user for the toc entry. Modifies @var{toc}. -@item LaTeX-section-section -Insert @LaTeX{} section command according to @var{name}, @var{title}, -and @var{toc}. If @var{toc} is nil, no toc entry is inserted. If -@var{toc} or @var{title} are empty strings, @var{done-mark} will be -placed at the point they should be inserted. -@item LaTeX-section-label -Insert a label after the section command. Controlled by the variable -@code{LaTeX-section-label}. -@end ftable - -To get a full featured @code{LaTeX-section} command, insert - -@lisp -(setq LaTeX-section-hook - '(LaTeX-section-heading - LaTeX-section-title - LaTeX-section-toc - LaTeX-section-section - LaTeX-section-label)) -@end lisp - -in your @file{.emacs} file. -@end defopt - -The behavior of @code{LaTeX-section-label} is determined by the -variable @code{LaTeX-section-label}. - -@defopt LaTeX-section-label -Default prefix when asking for a label. - -If it is a string, it is used unchanged for all kinds of sections. -If it is nil, no label is inserted. -If it is a list, the list is searched for a member whose car is equal -to the name of the sectioning command being inserted. The cdr is then -used as the prefix. If the name is not found, or if the cdr is nil, -no label is inserted. - -@cindex Prefix for labels -@cindex Label prefix -@cindex Labels -By default, chapters have a prefix of @samp{cha:} while sections and -subsections have a prefix of @samp{sec:}. Labels are not automatically -inserted for other types of sections. -@end defopt - -@node Environments -@section Inserting Environment Templates -@cindex Environments -@cindex @samp{\begin} -@cindex @samp{\end} - -A large apparatus is available that supports insertions of environments, -that is @samp{\begin@{@}} --- @samp{\end@{@}} pairs. - -@AUCTeX{} is aware of most of the actual environments available in a -specific document. This is achieved by examining your -@samp{\documentclass} command, and consulting a precompiled list of -environments available in a large number of styles. - -You insert an environment with @kbd{C-c C-e}, and select an environment -type. Depending on the environment, @AUCTeX{} may ask more questions -about the optional parts of the selected environment type. With -@kbd{C-u C-c C-e} you will change the current environment. - -@deffn Command LaTeX-environment @var{arg} -@kindex C-c C-e -(@kbd{C-c C-e}) @AUCTeX{} will prompt you for an environment -to insert. At this prompt, you may press @key{TAB} or @key{SPC} to -complete a partially written name, and/or to get a list of available -environments. After selection of a specific environment @AUCTeX{} may -prompt you for further specifications. - -If the optional argument @var{arg} is not-nil (i.e. you have given a -prefix argument), the current environment is modified and no new -environment is inserted. -@end deffn - -As a default selection, @AUCTeX{} will suggest the environment last -inserted or, as the first choice the value of the variable -@code{LaTeX-default-environment}. - -@defopt LaTeX-default-environment -Default environment to insert when invoking @samp{LaTeX-environment} -first time. -@end defopt - -If the document is empty, or the cursor is placed at the top of the -document, @AUCTeX{} will default to insert a `document' environment. - -Most of these are described further in the following sections, and you -may easily specify more. @xref{Customizing Environments}. - -@menu -* Equations:: Equations -* Floats:: Floats -* Itemize-like:: Itemize-like Environments -* Tabular-like:: Tabular-like Environments -* Customizing Environments:: Customizing Environments -@end menu - -You can close the current environment with @kbd{C-c ]}, but we suggest -that you use @kbd{C-c C-e} to insert complete environments instead. - -@deffn Command LaTeX-close-environment -@kindex C-c ] -(@kbd{C-c ]}) Insert an @samp{\end} that matches the current environment. -@end deffn - -@node Equations -@subsection Equations -@cindex Equations -@cindex Equation -@cindex Eqnarray -@cindex amsmath - -When inserting equation-like environments, the @samp{\label} will have a -default prefix, which is controlled by the following variables: - -@defopt LaTeX-equation-label -Prefix to use for `equation' labels. -@end defopt - -@defopt LaTeX-eqnarray-label -Prefix to use for `eqnarray' labels. -@end defopt - -@defopt LaTeX-amsmath-label -Prefix to use for amsmath equation labels. Amsmath equations include -@samp{align}, @samp{alignat}, @samp{xalignat}, @samp{aligned}, -@samp{flalign} and @samp{gather}. -@end defopt - -@node Floats -@subsection Floats -@cindex Floats -@cindex Figures -@cindex Figure environment -@cindex Tables -@cindex Table environment - -Figures and tables (i.e., floats) may also be inserted using @AUCTeX{}. -After choosing either `figure' or `table' in the environment list -described above, you will be prompted for a number of additional things. - -@table @var -@item float position -This is the optional argument of float environments that controls how -they are placed in the final document. In @LaTeX{} this is a sequence -of the letters @samp{htbp} as described in the @LaTeX{} manual. The -value will default to the value of @code{LaTeX-float}. -@vindex LaTeX-float - -@item caption -This is the caption of the float. The default is to insert the caption -at the bottom of the float. You can specify floats where the caption -should be placed at the top with @code{LaTeX-top-caption-list}. -@vindex LaTeX-top-caption-list - -@item label -The label of this float. The label will have a default prefix, which is -controlled by the variables @code{LaTeX-figure-label} and -@code{LaTeX-table-label}. -@vindex LaTeX-figure-label -@vindex LaTeX-table-label -@cindex Prefix for labels -@cindex Label prefix -@cindex Labels -@end table - -Moreover, you will be asked if you want the contents of the float -environment to be horizontally centered. Upon a positive answer a -@samp{\centering} macro will be inserted at the beginning of the float -environment. - -@defopt LaTeX-float -Default placement for floats. -@end defopt - -@defopt LaTeX-figure-label -Prefix to use for figure labels. -@end defopt - -@defopt LaTeX-table-label -Prefix to use for table labels. -@end defopt - -@defopt LaTeX-top-caption-list -List of float environments with top caption. -@end defopt - -@node Itemize-like -@subsection Itemize-like Environments -@cindex Itemize -@cindex Enumerates -@cindex Descriptions -@cindex Items -@cindex \item - -In an itemize-like environment, nodes (i.e., @samp{\item}s) may be -inserted using @kbd{C-c @key{LFD}}. - -@deffn Command LaTeX-insert-item -@kindex C-c @key{LFD} -(@kbd{C-c @key{LFD}}) Close the current item, move to the next line and -insert an appropriate @samp{\item} for the current environment. That is, -`itemize' and `enumerate' will have @samp{\item } inserted, while -`description' will have @samp{\item[]} inserted. -@end deffn - -@node Tabular-like -@subsection Tabular-like Environments - -When inserting Tabular-like environments, that is, `tabular' `array' -etc., you will be prompted for a template for that environment. -Related variables: - -@defopt LaTeX-default-format -Default format string for array and tabular environments. -@end defopt - -@defopt LaTeX-default-position -Default position string for array and tabular environments. If nil, -act like the empty string is given, but don't prompt for a position. -@end defopt - -@node Customizing Environments -@subsection Customizing Environments - -@xref{Adding Environments}, for how to customize the list of known -environments. - -@node Mathematics -@section Entering Mathematics -@cindex Mathematics -@cindex Symbols -@cindex Abbreviations - -@TeX{} is written by a mathematician, and has always contained good -support for formatting mathematical text. @AUCTeX{} supports this -tradition, by offering a special minor mode for entering text with many -mathematical symbols. You can enter this mode by typing @kbd{C-c -~}. - -@deffn Command LaTeX-math-mode -@kindex C-c ~ -(@kbd{C-c ~}) Toggle LaTeX Math mode. This is a minor mode rebinding -the key @code{LaTeX-math-abbrev-prefix} to allow easy typing of -mathematical symbols. @kbd{`} will read a character from the keyboard, -and insert the symbol as specified in @code{LaTeX-math-default} and -@code{LaTeX-math-list}. If given a prefix argument, the symbol will be -surrounded by dollar signs. -@end deffn - -You can use another prefix key (instead of @kbd{`}) by setting the -variable @code{LaTeX-math-abbrev-prefix}. - -To enable LaTeX Math mode by default, add the following in your -@file{.emacs} file: -@lisp -(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode) -@end lisp - -@defopt LaTeX-math-abbrev-prefix -A string containing the prefix of @code{LaTeX-math-mode} commands; This -value defaults to @kbd{`}. - -The string has to be a key or key sequence in a format understood by the -@code{kbd} macro. This corresponds to the syntax usually used in the -manuals for Emacs Emacs Lisp. -@end defopt - -The variable @code{LaTeX-math-list} allows you to add your own mappings. - -@defopt LaTeX-math-list -A list containing user-defined keys and commands to be used in LaTeX -Math mode. Each entry should be a list of two to four elements. - -First, the key to be used after @code{LaTeX-math-abbrev-prefix} for -macro insertion. If it is nil, the symbol has no associated -keystroke (it is available in the menu, though). - -Second, a string representing the name of the macro (without a leading -backslash.) - -Third, a string representing the name of a submenu the command should be -added to. Use a list of strings in case of nested menus. - -Fourth, the position of a Unicode character to be displayed in the menu -alongside the macro name. This is an integer value. -@end defopt - -@defopt LaTeX-math-menu-unicode -Whether the LaTeX menu should try using Unicode for effect. Your Emacs -built must be able to display include Unicode characters in menus for -this feature. -@end defopt - -@AUCTeX{}'s reference card @file{tex-ref.tex} includes a list of all -math mode commands. - -@AUCTeX{} can help you write subscripts and superscripts in math -constructs by automatically inserting a pair of braces after typing -@key{_} or @key{^} respectively and putting point between the braces. -In order to enable this feature, set the variable -@code{TeX-electric-sub-and-superscript} to a non-nil value. - -@defopt TeX-electric-sub-and-superscript -If non-nil, insert braces after typing @key{^} and @key{_} in math mode. -@end defopt - -@node Completion -@section Completion -@cindex Completion -@cindex Expansion -@cindex Macro expansion -@cindex Macro completion -@cindex Macro arguments -@cindex Arguments to @TeX{} macros - -Emacs lisp programmers probably know the @code{lisp-complete-symbol} -command, usually bound to @kbd{M-@key{TAB}}. Users of the wonderful -ispell mode know and love the @code{ispell-complete-word} command from -that package. Similarly, @AUCTeX{} has a @code{TeX-complete-symbol} -command, by default bound to @kbd{M-@key{TAB}} which is equivalent to -@kbd{M-C-i}. Using @code{TeX-complete-symbol} makes it easier to type -and remember the names of long @LaTeX{} macros. - -In order to use @code{TeX-complete-symbol}, you should write a backslash -and the start of the macro. Typing @kbd{M-@key{TAB}} will now complete -as much of the macro, as it unambiguously can. For example, if you type -`@samp{\renewc}' and then @kbd{M-@key{TAB}}, it will expand to -`@samp{\renewcommand}'. - -@deffn Command TeX-complete-symbol -@kindex M-@key{TAB} -(@kbd{M-@key{TAB}}) Complete @TeX{} symbol before point. -@end deffn - -A more direct way to insert a macro is with @code{TeX-insert-macro}, -bound to @kbd{C-c C-m} which is equivalent to @kbd{C-c @key{RET}}. It -has the advantage over completion that it knows about the argument of -most standard @LaTeX{} macros, and will prompt for them. It also knows -about the type of the arguments, so it will for example give completion -for the argument to @samp{\include}. Some examples are listed below. - -@deffn Command TeX-insert-macro -@kindex C-c C-m -(@kbd{C-c C-m} or @kbd{C-c @key{RET}}) Prompt (with completion) for the -name of a @TeX{} macro, and if @AUCTeX{} knows the macro, prompt for -each argument. -@end deffn - -As a default selection, @AUCTeX{} will suggest the macro last inserted -or, as the first choice the value of the variable -@code{TeX-default-macro}. - -@defopt TeX-insert-macro-default-style -Specifies whether @code{TeX-insert-macro} will ask for all optional -arguments. - -If set to the symbol @code{show-optional-args}, @code{TeX-insert-macro} -asks for optional arguments of @TeX{} macros. If set to -@code{mandatory-args-only}, @code{TeX-insert-macro} asks only for -mandatory arguments. When @code{TeX-insert-macro} is called with prefix -argument (@kbd{C-u}), it's the other way round. - -Note that for some macros, there are special mechanisms, e.g. -@code{LaTeX-includegraphics-options-alist}. - -@end defopt - - -@defopt TeX-default-macro -Default macro to insert when invoking @code{TeX-insert-macro} first time. -@end defopt - -A faster alternative is to bind the function @code{TeX-electric-macro} -to @samp{\}. This can be done by setting the variable -@code{TeX-electric-escape} - -@defopt TeX-electric-escape -If this is non-nil when @AUCTeX{} is loaded, the @TeX{} escape -character @samp{\} will be bound to @code{TeX-electric-macro} -@end defopt - -The difference between @code{TeX-insert-macro} and -@code{TeX-electric-macro} is that space will complete and exit from the -minibuffer in @code{TeX-electric-macro}. Use @key{TAB} if you merely -want to complete. - -@deffn Command TeX-electric-macro -Prompt (with completion) for the name of a @TeX{} macro, -and if @AUCTeX{} knows the macro, prompt for each argument. -Space will complete and exit. -@end deffn - -By default @AUCTeX{} will put an empty set braces @samp{@{@}} after a -macro with no arguments to stop it from eating the next whitespace. -This can be stopped by entering @code{LaTeX-math-mode}, -@pxref{Mathematics}, or by setting @code{TeX-insert-braces} to nil. - -@defopt TeX-insert-braces -If non-nil, append a empty pair of braces after inserting a macro. -@end defopt - -Completions work because @AUCTeX{} can analyze @TeX{} files, and store -symbols in Emacs Lisp files for later retrieval. @xref{Automatic}, for -more information. - -@cindex \cite, completion of -@cindex Bib@TeX{}, completion -@cindex cite, completion of -@cindex bibliography, completion -@cindex citations, completion of -@cindex \label, completion -@cindex \ref, completion -@cindex labels, completion of -@AUCTeX{} will also make completion for many macro arguments, for -example existing labels when you enter a @samp{\ref} macro with -@code{TeX-insert-macro} or @code{TeX-electric-macro}, and Bib@TeX{} -entries when you enter a @samp{\cite} macro. For this kind of -completion to work, parsing must be enabled as described in -@pxref{Parsing Files}. For @samp{\cite} you must also make sure that -the Bib@TeX{} files have been saved at least once after you enabled -automatic parsing on save, and that the basename of the Bib@TeX{} file -does not conflict with the basename of one of @TeX{} files. - -@node Commenting -@section Commenting - -It is often necessary to comment out temporarily a region of @TeX{} or -@LaTeX{} code. This can be done with the commands @kbd{C-c ;} and -@kbd{C-c %}. @kbd{C-c ;} will comment out all lines in the current -region, while @kbd{C-c %} will comment out the current paragraph. -Type @kbd{C-c ;} again to uncomment all lines of a commented region, -or @kbd{C-c %} again to uncomment all comment lines around point. -These commands will insert or remove a single @samp{%} respectively. - -@deffn Command TeX-comment-or-uncomment-region -@kindex C-c ; -(@kbd{C-c ;}) Add or remove @samp{%} from the beginning of each line -in the current region. Uncommenting works only if the region encloses -solely commented lines. If @AUCTeX{} should not try to guess if the -region should be commented or uncommented the commands -@code{TeX-comment-region} and @code{TeX-uncomment-region} can be used -to explicitly comment or uncomment the region in concern. -@end deffn - -@deffn Command TeX-comment-or-uncomment-paragraph -@kindex C-c % -(@kbd{C-c %}) Add or remove @samp{%} from the beginning of each line -in the current paragraph. When removing @samp{%} characters the -paragraph is considered to consist of all preceding and succeeding -lines starting with a @samp{%}, until the first non-comment line. -@end deffn - -@node Indenting -@section Indenting -@cindex Formatting -@cindex Indenting -@cindex Indentation -@cindex Reformatting -@cindex Reindenting - -Indentation means the addition of whitespace at the beginning of lines -to reflect special syntactical constructs. This makes it easier to see -the structure of the document, and to catch errors such as a missing -closing brace. Thus, the indentation is done for precisely the same -reasons that you would indent ordinary computer programs. - -Indentation is done by @LaTeX{} environments and by @TeX{} groups, that -is the body of an environment is indented by the value of -@code{LaTeX-indent-level} (default 2). Also, items of an `itemize-like' -environment are indented by the value of @code{LaTeX-item-indent}, -default @minus{}2. (Items are identified with the help of -@code{LaTeX-item-regexp}.) If more environments are nested, they are -indented `accumulated' just like most programming languages usually are -seen indented in nested constructs. -@vindex LaTeX-indent-level -@vindex LaTeX-item-indent -@vindex LaTeX-item-regexp - -You can explicitely indent single lines, usually by pressing @key{TAB}, -or marked regions by calling @code{indent-region} on it. If you have -@code{auto-fill-mode} enabled and a line is broken while you type it, -Emacs automatically cares about the indentation in the following line. -If you want to have a similar behavior upon typing @key{RET}, you can -customize the variable @code{TeX-newline-function} and change the -default of @code{newline} which does no indentation to -@code{newline-and-indent} which indents the new line or -@code{reindent-then-newline-and-indent} which indents both the current -and the new line. -@vindex TeX-newline-function - -There are certain @LaTeX{} environments which should be indented in a -special way, like @samp{tabular} or @samp{verbatim}. Those environments -may be specified in the variable @code{LaTeX-indent-environment-list} -together with their special indentation functions. Taking the -@samp{verbatim} environment as an example you can see that -@code{current-indentation} is used as the indentation function. This -will stop @AUCTeX{} from doing any indentation in the environment if you -hit @key{TAB} for example. -@vindex LaTeX-indent-environment-list - -There are environments in @code{LaTeX-indent-environment-list} which do -not bring a special indentation function with them. This is due to the -fact that first the respective functions are not implemented yet and -second that filling will be disabled for the specified environments. -This shall prevent the source code from being messed up by accidently -filling those environments with the standard filling routine. If you -think that providing special filling routines for such environments -would be an appropriate and challenging task for you, you are invited to -contribute. (@xref{Filling}, for further information about the filling -functionality) -@vindex LaTeX-indent-environment-list - -The check for the indentation function may be enabled or disabled by -customizing the variable @code{LaTeX-indent-environment-check}. -@vindex LaTeX-indent-environment-check - -As a side note with regard to formatting special environments: Newer -Emacsen include @file{align.el} and therefore provide some support for -formatting @samp{tabular} and @samp{tabbing} environments with the -function @code{align-current} which will nicely align columns in the -source code. - -@AUCTeX{} is able to format commented parts of your code just as any -other part. This means @LaTeX{} environments and @TeX{} groups in -comments will be indented syntactically correct if the variable -@code{LaTeX-syntactic-comments} is set to t. If you disable it, -comments will be filled like normal text and no syntactic indentation -will be done. -@vindex LaTeX-syntactic-comments - -Following you will find a list of most commands and variables related -to indenting with a small summary in each case: - -@table @kbd -@item @key{TAB} -@kindex @key{TAB} -@findex LaTeX-indent-line -@code{LaTeX-indent-line} will indent the current line. - -@item @key{LFD} -@kindex @key{LFD} -@code{newline-and-indent} inserts a new line (much like @key{RET}) and -moves the cursor to an appropriate position by the left margin. - -Most keyboards nowadays lack a linefeed key and @kbd{C-j} may be tedious -to type. Therefore you can customize @AUCTeX{} to perform indentation -upon typing @key{RET} as well. The respective option is called -@code{TeX-newline-function}. - -@item C-j -@kindex C-j -Alias for @key{LFD} -@end table - -@defopt LaTeX-indent-environment-list -List of environments with special indentation. The second element in -each entry is the function to calculate the indentation level in -columns. - -The filling code currently cannot handle tabular-like environments -which will be completely messed-up if you try to format them. This is -why most of these environments are included in this customization -option without a special indentation function. This will prevent that -they get filled. -@end defopt - -@defopt LaTeX-indent-level -Number of spaces to add to the indentation for each @samp{\begin} not -matched by a @samp{\end}. -@end defopt - -@defopt LaTeX-item-indent -Number of spaces to add to the indentation for @samp{\item}'s in list -environments. -@end defopt - -@defopt TeX-brace-indent-level -Number of spaces to add to the indentation for each @samp{@{} not -matched by a @samp{@}}. -@end defopt - -@defopt LaTeX-syntactic-comments -If non-nil comments will be filled and indented according to @LaTeX{} -syntax. Otherwise they will be filled like normal text. -@end defopt - -@defopt TeX-newline-function -Used to specify the function which is called when @key{RET} is pressed. -This will normally be @code{newline} which simply inserts a new line. -In case you want to have @AUCTeX{} do indentation as well when you press -@key{RET}, use the built-in functions @code{newline-and-indent} or -@code{reindent-then-newline-and-indent}. The former inserts a new line -and indents the following line, i.e. it moves the cursor to the right -position and therefore acts as if you pressed @key{LFD}. The latter -function additionally indents the current line. If you choose -@samp{Other}, you can specify your own fancy function to be called when -@key{RET} is pressed. -@end defopt - - -@node Filling -@section Filling -@cindex Filling -@cindex Formatting -@cindex Reformatting -@cindex Refilling - -Filling deals with the insertion of line breaks to prevent lines from -becoming wider than what is specified in @code{fill-column}. The -linebreaks will be inserted automatically if @code{auto-fill-mode} is -enabled. In this case the source is not only filled but also indented -automatically as you write it. - -@code{auto-fill-mode} can be enabled for @AUCTeX{} by calling -@code{turn-on-auto-fill} in one of the hooks @AUCTeX{} is running. -@xref{Modes and Hooks}. As an example, if you want to enable -@code{auto-fill-mode} in @code{LaTeX-mode}, put the following into your -init file: - -@lisp -(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill) -@end lisp - -You can manually fill explicitely marked regions, paragraphs, -environments, complete sections, or the whole buffer. (Note that manual -filling in @AUCTeX{} will indent the start of the region to be filled in -contrast to many other Emacs modes.) - -There are some syntactical constructs which are handled specially with -regard to filling. These are so-called code comments and paragraph -commands. - -Code comments are comments preceded by code or text in the same line. -Upon filling a region, code comments themselves will not get filled. -Filling is done from the start of the region to the line with the code -comment and continues after it. In order to prevent overfull lines in -the source code, a linebreak will be inserted before the last -non-comment word by default. This can be changed by customizing -@code{LaTeX-fill-break-before-code-comments}. If you have overfull -lines with code comments you can fill those explicitely by calling -@code{LaTeX-fill-paragraph} or pressing @kbd{M-q} with the cursor -positioned on them. This will add linebreaks in the comment and indent -subsequent comment lines to the column of the comment in the first line -of the code comment. In this special case @kbd{M-q} only acts on the -current line and not on the whole paragraph. - -Lines with @samp{\par} are treated similarly to code comments, -i.e. @samp{\par} will be treated as paragraph boundary which should not -be followed by other code or text. But it is not treated as a real -paragraph boundary like an empty line where filling a paragraph would -stop. - -Paragraph commands like @samp{\section} or @samp{\noindent} (the list of -commands is defined by @code{LaTeX-paragraph-commands}) are often to be -placed in their own line(s). This means they should not be consecuted -with any preceding or following adjacent lines of text. @AUCTeX{} will -prevent this from happening if you do not put any text except another -macro after the end of the last brace of the respective macro. If -there is other text after the macro, @AUCTeX{} regards this as a sign -that the macro is part of the following paragraph. -@vindex LaTeX-paragraph-commands - -Here are some examples: - -@example -\begin@{quote@} - text text text text -@end example - -@example -\begin@{quote@}\label@{foo@} - text text text text -@end example - -If you press @kbd{M-q} on the first line in both examples, nothing will -change. But if you write - -@example -\begin@{quote@} text - text text text text -@end example - -and press @kbd{M-q}, you will get - -@example -\begin@{quote@} text text text text text -@end example - -Besides code comments and paragraph commands, another speciality of -filling in @AUCTeX{} involves commented lines. You should be aware that -these comments are treated as islands in the rest of the @LaTeX{} code -if syntactic filling is enabled. This means, for example, if you try to -fill an environment with @code{LaTeX-fill-environment} and have the -cursor placed on a commented line which does not have a surrounding -environment inside the comment, @AUCTeX{} will report an error. -@findex LaTeX-fill-environment - -The relevant commands and variables with regard to filling are: - -@table @kbd -@item C-c C-q C-p -@kindex C-c C-q C-p -@findex LaTeX-fill-paragraph -@code{LaTeX-fill-paragraph} will fill and indent the current paragraph. - -@item M-q -@kindex M-q -Alias for @kbd{C-c C-q C-p} - -@item C-c C-q C-e -@kindex C-c C-q C-e -@findex LaTeX-fill-environment -@code{LaTeX-fill-environment} will fill and indent the current -environment. This may e.g. be the `document' environment, in which case -the entire document will be formatted. - -@item C-c C-q C-s -@kindex C-c C-q C-s -@findex LaTeX-fill-section -@code{LaTeX-fill-section} will fill and indent the current logical -sectional unit. - -@item C-c C-q C-r -@kindex C-c C-q C-r -@findex LaTeX-fill-region -@code{LaTeX-fill-region} will fill and indent the current region. -@end table - -@defopt LaTeX-fill-break-at-separators -List of separators before or after which respectively linebreaks will -be inserted if they do not fit into one line. The separators can be -curly braces, brackets, switches for inline math (@samp{$}, @samp{\(}, -@samp{\)}) and switches for display math (@samp{\[}, @samp{\]}). Such -formatting can be useful to make macros and math more visible or to -prevent overfull lines in the @LaTeX{} source in case a package for -displaying formatted @TeX{} output inside the Emacs buffer, like -preview-latex, is used. -@end defopt - -@defopt LaTeX-fill-break-before-code-comments -Code comments are comments preceded by some other text in the same line. -When a paragraph containing such a comment is to be filled, the comment -start will be seen as a border after which no line breaks will be -inserted in the same line. If the option -@code{LaTeX-fill-break-before-code-comments} is enabled (which is the -default) and the comment does not fit into the line, a line break will -be inserted before the last non-comment word to minimize the chance that -the line becomes overfull. -@end defopt - -@node Display -@chapter Controlling Screen Display - -It is often desirable to get visual help of what markup code in a text -actually does whithout having to decipher it explicitely. For this -purpose Emacs and @AUCTeX{} provide font locking (also known as syntax -highlighting) which visually sets off markup code like macros or -environments by using different colors or fonts. For example text to be -typeset in italics can be displayed with an italic font in the editor as -well, or labels and references get their own distinct color. - -While font locking helps you grasp the purpose of markup code and -separate markup from content, the markup code can still be distracting. -@AUCTeX{} lets you hide those parts and show them again at request with -its built-in support for hiding macros and environments which we call -folding here. - -Besides folding of macros and environments, @AUCTeX{} provides support -for Emacs' outline mode which lets you narrow the buffer content to -certain sections of your text by hiding the parts not belonging to these -sections. - -@menu -* Font Locking:: Font Locking -* Folding:: Folding Macros and Environments -* Outline:: Outlining the Document -@end menu - -@node Font Locking -@section Font Locking -@cindex Font Locking -@cindex Syntax Highlighting -@cindex font-latex - -Font locking is supposed to improve readability of the source code by -highlighting certain keywords with different colors or fonts. It -thereby lets you recognize the function of markup code to a certain -extent without having to read the markup command. For general -information on controlling font locking with Emacs' Font Lock mode, see -@ref{Font Lock, , Font Lock Mode, emacs, GNU Emacs Manual}. - -@defopt TeX-install-font-lock -Once font locking is enabled globally or for the major modes provided by -@AUCTeX{}, the font locking patterns and functionality of @fontlatex{} -are activated by default. You can switch to a different font locking -scheme or disable font locking in @AUCTeX{} by customizing the variable -@code{TeX-install-font-lock}. - -Besides @fontlatex{} @AUCTeX{} ships with a scheme which is derived -from Emacs' default @LaTeX{} mode and activated by choosing -@code{tex-font-setup}. Be aware that this scheme is not coupled with -@AUCTeX{}'s style system and not the focus of development. Therefore -and due to @fontlatex{} being much more feature-rich the following -explanations will only cover @fontlatex{}. - -In case you want to hook in your own fontification scheme, you can -choose @code{other} and insert the name of the function which sets up -your font locking patterns. If you want to disable fontification in -@AUCTeX{} completely, choose @code{ignore}. -@end defopt - -@fontlatex{} provides many options for customization which are -accessible with @kbd{M-x customize-group RET font-latex RET}. For this -description the various options are explained in conceptional groups. - -@menu -* Fontification of macros:: Fontification of macros -* Fontification of quotes:: Fontification of quotes -* Fontification of math:: Fontification of math constructs -* Verbatim content:: Verbatim macros and environments -* Faces:: Faces used by font-latex -* Known problems:: Known fontification problems -@end menu - -@node Fontification of macros -@subsection Fontification of macros - -Highlighting of macros can be customized by adapting keyword lists which -can be found in the customization group @code{font-latex-keywords}. - -Three types of macros can be handled differently with respect to -fontification: - -@enumerate -@item -Commands of the form @samp{\foo[bar]@{baz@}} which consist of the macro -itself, optional arguments in square brackets and mandatory arguments in -curly braces. For the command itself the face -@code{font-lock-keyword-face} will be used and for the optional -arguments the face @code{font-lock-variable-name-face}. The face -applied to the mandatory argument depends on the macro class represented -by the respective built-in variables. -@item -Declaration macros of the form @samp{@{\foo text@}} which consist of the -macro which may be enclosed in a @TeX{} group together with text to be -affected by the macro. In case a @TeX{} group is present, the macro -will get the face @code{font-lock-keyword-face} and the text will get -the face configured for the respective macro class. If no @TeX{} group -is present, the latter face will be applied to the macro itself. -@item -Simple macros of the form @samp{\foo} which do not have any arguments or -groupings. The respective face will be applied to the macro itself. -@end enumerate - -Customization variables for @samp{\foo[bar]@{baz@}} type macros allow -both the macro name and the sequence of arguments to be specified. The -latter is done with a string which can contain the characters -@table @samp -@item * -indicating the existence of a starred variant for the macro, -@item [ -for optional arguments in brackets, -@item @{ -for mandatory arguments in braces, -@item \ -for mandatory arguments consisting of a single macro and -@item | -as a prefix indicating that two alternatives are following. -@end table -For example the specifier for @samp{\documentclass} would be @samp{[@{} -because the macro has one optional followed by one mandatory argument. -The specifier for @samp{\newcommand} would be @samp{*|@{\[[@{} because -there is a starred variant, the mandatory argument following the macro -name can be a macro or a @TeX{} group which can be followed by two -optional arguments and the last token is a mandatory argument in braces. - -Customization variables for the @samp{@{\foo text@}} and @samp{\foo} -types are simple lists of strings where each entry is a macro name -(without the leading backslash). - -@subheading General macro classes - -@fontlatex{} provides keyword lists for different macro classes which -are described in the following table: - -@vindex font-latex-match-function-keywords -@vindex font-latex-match-reference-keywords -@vindex font-latex-match-textual-keywords -@vindex font-latex-match-variable-keywords -@vindex font-latex-match-warning-keywords -@table @code -@item font-latex-match-function-keywords -Keywords for macros defining or related to functions, like -@samp{\newcommand}.@* -Type: @samp{\macro[...]@{...@}}@* -Face: @code{font-lock-function-name-face} - -@item font-latex-match-reference-keywords -Keywords for macros defining or related to references, like -@samp{\ref}.@* -Type: @samp{\macro[...]@{...@}}@* -Face: @code{font-lock-constant-face} - -@item font-latex-match-textual-keywords -Keywords for macros specifying textual content, like @samp{\caption}.@* -Type: @samp{\macro[...]@{...@}}@* -Face: @code{font-lock-type-face} - -@item font-latex-match-variable-keywords -Keywords for macros defining or related to variables, like -@samp{\setlength}.@* -Type: @samp{\macro[...]@{...@}}@* -Face: @code{font-lock-variable-name-face} - -@item font-latex-match-warning-keywords -Keywords for important macros, e.g. affecting line or page break, like -@samp{\clearpage}.@* -Type: @samp{\macro}@* -Face: @code{font-latex-warning-face} -@end table - -@subheading Sectioning commands -@cindex Sectioning commands, fontification of - -Sectioning commands are macros like @samp{\chapter} or @samp{\section}. -For these commands there are two fontification schemes which may be -selected by customizing the variable @code{font-latex-fontify-sectioning}. - -@defopt font-latex-fontify-sectioning -@c Is @vindex correct? -@vindex font-latex-sectioning-0-face -@vindex font-latex-sectioning-1-face -@vindex font-latex-sectioning-2-face -@vindex font-latex-sectioning-3-face -@vindex font-latex-sectioning-4-face -@vindex font-latex-sectioning-5-face -Per default sectioning commands will be shown in a larger, proportional -font, which corresponds to a number for this variable. The font size -varies with the sectioning level, e.g. @samp{\part} -(@code{font-latex-sectioning-0-face}) has a larger font than -@samp{\paragraph} (@code{font-latex-sectioning-5-face}). Typically, -values from 1.05 to 1.3 for @code{font-latex-fontify-sectioning} give -best results, depending on your font setup. If you rather like to use -the base font and a different color, set the variable to the symbol -@samp{color}. In this case the face @code{font-lock-type-face} will be -used to fontify the argument of the sectioning commands. -@end defopt - -@vindex font-latex-match-sectioning-0-keywords -@vindex font-latex-match-sectioning-1-keywords -@vindex font-latex-match-sectioning-2-keywords -@vindex font-latex-match-sectioning-3-keywords -@vindex font-latex-match-sectioning-4-keywords -@vindex font-latex-match-sectioning-5-keywords -You can make @fontlatex{} aware of your own sectioning commands be -adding them to the keyword lists: -@code{font-latex-match-sectioning-0-keywords} -(@code{font-latex-sectioning-0-face}) @dots{} -@code{font-latex-match-sectioning-5-keywords} -(@code{font-latex-sectioning-5-face}). - -@vindex font-latex-slide-title-face -@vindex font-latex-match-slide-title-keywords -Related to sectioning there is special support for slide titles which -may be fontified with the face @code{font-latex-slide-title-face}. You -can add macros which should appear in this face by customizing the -variable @code{font-latex-match-slide-title-keywords}. - -@subheading Commands for changing fonts - -@LaTeX{} provides various macros for changing fonts or font attributes. -For example, you can select an italic font with @samp{\textit@{...@}} or -bold with @samp{\textbf@{...@}}. An alternative way to specify these -fonts is to use special macros in @TeX{} groups, like @samp{@{\itshape -...@}} for italics and @samp{@{\bfseries ...@}} for bold. As mentioned -above, we call the former variants commands and the latter -declarations. - -Besides the macros for changing fonts provided by @LaTeX{} there is an -infinite number of other macros---either defined by yourself for logical -markup or defined by macro packages---which affect the font in the -typeset text. While @LaTeX{}'s built-in macros and macros of packages -known by @AUCTeX{} are already handled by @fontlatex{}, different -keyword lists per type style and macro type are provided for entering -your own macros which are listed in the table below. - -@vindex font-latex-match-bold-command-keywords -@vindex font-latex-match-italic-command-keywords -@vindex font-latex-match-math-command-keywords -@vindex font-latex-match-type-command-keywords -@vindex font-latex-match-bold-declaration-keywords -@vindex font-latex-match-italic-declaration-keywords -@vindex font-latex-match-type-declaration-keywords -@table @code -@item font-latex-match-bold-command-keywords -Keywords for commands specifying a bold type style.@* -Face: @code{font-latex-bold-face} -@item font-latex-match-italic-command-keywords -Keywords for commands specifying an italic font.@* -Face: @code{font-latex-italic-face} -@item font-latex-match-math-command-keywords -Keywords for commands specifying a math font.@* -Face: @code{font-latex-math-face} -@item font-latex-match-type-command-keywords -Keywords for commands specifying a typewriter font.@* -Face: @code{font-lock-type-face} -@item font-latex-match-bold-declaration-keywords -Keywords for declarations specifying a bold type style.@* -Face: @code{font-latex-bold-face} -@item font-latex-match-italic-declaration-keywords -Keywords for declarations specifying an italic font.@* -Face: @code{font-latex-italic-face} -@item font-latex-match-type-declaration-keywords -Keywords for declarations specifying a typewriter font.@* -Face: @code{font-latex-type-face} -@end table - -@subheading Deactivating defaults of built-in keyword classes - -@vindex font-latex-deactivated-keyword-classes -@fontlatex{} ships with predefined lists of keywords for the classes -described above. You can disable these defaults per class by -customizing the variable @code{font-latex-deactivated-keyword-classes}. -This is a list of strings for keyword classes to be deactivated. Valid -entries are "warning", "variable", "reference", "function" , -"sectioning-0", "sectioning-1", "sectioning-2", "sectioning-3", -"sectioning-4", "sectioning-5", "textual", "bold-command", -"italic-command", "math-command", "type-command", "bold-declaration", -"italic-declaration", "type-declaration". - -You can also get rid of certain keywords only. For example if you want -to remove highlighting of footnotes as references you can put the -following stanza into your init file: - -@lisp -(eval-after-load "font-latex" - '(setq-default - font-latex-match-reference-keywords-local - (remove "footnote" font-latex-match-reference-keywords-local))) -@end lisp - -But note that this means fiddling with @fontlatex{}'s internals and is -not guaranteed to work in future versions of @fontlatex{}. - -@subheading User-defined keyword classes - -In case the customization options explained above do not suffice for -your needs, you can specify your own keyword classes by customizing the -variable @code{font-latex-user-keyword-classes}. - -@defopt font-latex-user-keyword-classes -Every keyword class consists of four parts, a name, a list of keywords, -a face and a specifier for the type of macros to be highlighted. - -When adding new entries, you have to use unique values for the class -names, i.e. they must not clash with names of the built-in keyword -classes or other names given by you. Additionally the names must not -contain spaces. - -The list of keywords defines which commands and declarations should be -covered by the keyword class. A keyword can either be a simple command -name omitting the leading backslash or a list consisting of the command -name and a string specifying the sequence of arguments for the command. - -The face argument can either be an existing face or font specifications -made by you. (The latter option is not available on XEmacs.) - -There are three alternatives for the type of keywords---``Command with -arguments'', ``Declaration inside @TeX{} group'' and ``Command without -arguments''---which correspond with the macro types explained above. -@end defopt - -@node Fontification of quotes -@subsection Fontification of quotes -@cindex Quotes, fontification of - -Text in quotation marks is displayed with the face -@code{font-latex-string-face}. Besides the various forms of opening and -closing double and single quotation marks, so-called guillemets (<<, >>) -can be used for quoting. Because there are two styles of using -them---French style: << text >>; German style: >>text<<---you can -customize the variable @code{font-latex-quotes} to tell @fontlatex{} -which type you are using if the correct value cannot be derived from -document properties. - -@defopt font-latex-quotes -The default value of @code{font-latex-quotes} is @samp{auto} which means -that @fontlatex{} will try to derive the correct type of quotation mark -matching from document properties like the language option supplied to -the babel @LaTeX{} package. - -If the automatic detection fails for you and you mostly use one specific -style you can set it to a specific language-dependent value as well. -Set the value to @samp{german} if you are using >>German quotes<< and to -@samp{french} if you are using << French quotes >>. @fontlatex{} will -recognize the different ways these quotes can be given in your source -code, i.e. (@samp{"<}, @samp{">}), (@samp{<<}, @samp{>>}) and the -respective 8-bit variants. - -If you set @code{font-latex-quotes} to nil, quoted content will not be -fontified. -@end defopt - - -@node Fontification of math -@subsection Fontification of mathematical constructs -@cindex Math, fontification of -@cindex Subscript, fontification of -@cindex Superscript, fontification of - -@vindex font-latex-match-math-command-keywords -@vindex font-latex-math-environments -In @LaTeX{} mathematics can be indicated by a variety of different -methods: toggles (like dollar signs), macros and environments. Math -constructs known by @fontlatex{} are displayed with the face -@code{font-latex-math-face}. Support for dollar signs and shorthands -like @samp{\(...\)} or @samp{\[...\]} is built-in and not customizable. -Support for other math macros and environments can be adapted by -customizing the variables @code{font-latex-match-math-command-keywords} -and @code{font-latex-math-environments} respectively. - -In order to make math constructs more readable, @fontlatex{} displays -subscript and superscript parts in a smaller font and raised or lowered -respectively. This fontification feature can be controlled with the -variables @code{font-latex-fontify-script} and -@code{font-latex-script-display}. - -@defopt font-latex-fontify-script -If non-nil, fontify subscript and superscript strings. - -Note that this feature is not available on XEmacs, for which it is -disabled per default. In GNU Emacs raising and lowering is not enabled -for versions 21.3 and before due to it working not properly. -@end defopt - -@defopt font-latex-script-display -Display specification for subscript and superscript content. The car is -used for subscript, the cdr is used for superscript. The feature is -implemented using so-called display properties. For information on what -exactly to specify for the values, see @ref{Other Display Specs, , Other -Display Specifications, elisp, GNU Emacs Lisp Reference Manual}. -@end defopt - -@node Verbatim content -@subsection Verbatim macros and environments -@cindex Verbatim, fontification of - -Usually it is not desirable to have content to be typeset verbatim -highlighted according to @LaTeX{} syntax. Therefore this content will -be fontified uniformly with the face @code{font-latex-verbatim-face}. - -@vindex LaTeX-verbatim-macros-with-delims -@vindex LaTeX-verbatim-macros-with-braces -@vindex LaTeX-verbatim-environments -@fontlatex{} differentiates three different types of verbatim -constructs for fontification. Macros with special characters like | as -delimiters, macros with braces, and environments. Which macros and -environments are recognized is controlled by the variables -@code{LaTeX-verbatim-macros-with-delims}, -@code{LaTeX-verbatim-macros-with-braces}, and -@code{LaTeX-verbatim-environments} respectively. - -@node Faces -@subsection Faces used by @fontlatex{} -@cindex Faces - -In case you want to change the colors and fonts used by @fontlatex{} -please refer to the faces mentioned in the explanations above and use -@kbd{M-x customize-face RET RET}. All faces defined by -@fontlatex{} are accessible through a customization group by typing -@kbd{M-x customize-group RET font-latex-highlighting-faces RET}. - -@node Known problems -@subsection Known fontification problems -@cindex Dollar signs, color bleed with -@cindex Math, fontification problems with - -In certain cases the fontification machinery fails to interpret buffer -contents correctly. This can lead to color bleed, i.e. large parts of a -buffer get fontified with an inappropriate face. A typical situation -for this to happen is the use of a dollar sign (@samp{$}) in a verbatim -macro or environment. If @fontlatex{} is not aware of the verbatim -construct, it assumes the dollar sign to be a toggle for mathematics and -fontifies the following buffer content with the respective face until it -finds a closing dollar sign or till the end of the buffer. - -As a remedy you can make the verbatim construct known to @fontlatex{}, -@pxref{Verbatim content}. If this is not possible, you can insert a -commented dollar sign (@samp{%$}) at the next suitable end of line as a -quick workaround. -@c As a last resort one can set `font-lock-keywords-only', but we should -@c probably not advise users to do this. - - -@node Folding -@section Folding Macros and Environments -@cindex Outlining -@cindex Folding -@cindex Reveal -@cindex Auto-Reveal -@cindex Hide Macros - -A popular complaint about markup languages like @TeX{} and @LaTeX{} is -that there is too much clutter in the source text and that one cannot -focus well on the content. There are macros where you are only -interested in the content they are enclosing, like font specifiers where -the content might already be fontified in a special way by font locking. -Or macros the content of which you only want to see when actually -editing it, like footnotes or citations. Similarly you might find -certain environments or comments distracting when trying to concentrate -on the body of your document. - -With @AUCTeX{}'s folding functionality you can collapse those items and -replace them by a fixed string, the content of one of their arguments, -or a mixture of both. If you want to make the original text visible -again in order to view or edit it, move point sideways onto the -placeholder (also called display string) or left-click with the mouse -pointer on it. (The latter is currently only supported on Emacs.) The -macro or environment will unfold automatically, stay open as long as -point is inside of it and collapse again once you move point out of it. -(Note that folding of environments currently does not work in every -@AUCTeX{} mode.) - -In order to use this feature, you have to activate @code{TeX-fold-mode} -which will activate the auto-reveal feature and the necessary commands -to hide and show macros and environments. You can activate the mode in -a certain buffer by typing the command @kbd{M-x TeX-fold-mode RET} or -using the keyboard shortcut @kbd{C-c C-o C-f}. If you want to use it -every time you edit a @LaTeX{} document, add it to a hook: -@findex TeX-fold-mode -@kindex C-c C-o C-f - -@lisp -(add-hook 'LaTeX-mode-hook (lambda () - (TeX-fold-mode 1))) -@end lisp - -If it should be activated in all @AUCTeX{} modes, use -@code{TeX-mode-hook} instead of @code{LaTeX-mode-hook}. - -Once the mode is active there are several commands available to hide -and show macros, environments and comments: - -@deffn Command TeX-fold-buffer -@kindex C-c C-o C-b -(@kbd{C-c C-o C-b}) Hide all foldable items in the current buffer -according to the setting of @code{TeX-fold-type-list}. - -If you want to have this done automatically every time you open a file, -add it to a hook and make sure the function is called after font locking -is set up for the buffer. The following code should accomplish this: - -@lisp -(add-hook 'find-file-hook 'TeX-fold-buffer t) -@end lisp - -The command can be used any time to refresh the whole buffer and fold -any new macros and environments which were inserted after the last -invocation of the command. -@end deffn - -@defopt TeX-fold-type-list -List of symbols determining the item classes to consider for folding. -This can be macros, environments and comments. Per default only macros -and environments are folded. -@end defopt - -@defopt TeX-fold-force-fontify -In order for all folded content to get the right faces, the whole buffer -has to be fontified before folding is carried out. -@code{TeX-fold-buffer} therefore will force fontification of unfontified -regions. As this will prolong the time folding takes, you can prevent -forced fontification by customizing the variable -@code{TeX-fold-force-fontify}. -@end defopt - -@defopt TeX-fold-preserve-comments -By default items found in comments will be folded. If your comments -often contain unfinished code this might lead to problems. Give this -variable a non-nil value and foldable items in your comments will be -left alone. -@end defopt - -@deffn Command TeX-fold-region -@kindex C-c C-o C-r -(@kbd{C-c C-o C-r}) Hide all configured macros in the marked region. -@end deffn - -@deffn Command TeX-fold-paragraph -@kindex C-c C-o C-p -(@kbd{C-c C-o C-p}) Hide all configured macros in the paragraph -containing point. -@end deffn - -@deffn Command TeX-fold-macro -@kindex C-c C-o C-m -(@kbd{C-c C-o C-m}) Hide the macro on which point currently is located. -If the name of the macro is found in @code{TeX-fold-macro-spec-list}, -the respective display string will be shown instead. If it is not -found, the name of the macro in sqare brackets or the default string for -unspecified macros (@code{TeX-fold-unspec-macro-display-string}) will be -shown, depending on the value of the variable -@code{TeX-fold-unspec-use-name}. -@end deffn - -@deffn Command TeX-fold-env -@kindex C-c C-o C-e -(@kbd{C-c C-o C-e}) Hide the environment on which point currently is -located. The behavior regarding the display string is analogous to -@code{TeX-fold-macro} and determined by the variables -@code{TeX-fold-env-spec-list} and -@code{TeX-fold-unspec-env-display-string} respectively. -@end deffn - -@deffn Command TeX-fold-math -Hide the math macro on which point currently is located. If the name of -the macro is found in @code{TeX-fold-math-spec-list}, the respective -display string will be shown instead. If it is not found, the name of -the macro in sqare brackets or the default string for unspecified macros -(@code{TeX-fold-unspec-macro-display-string}) will be shown, depending -on the value of the variable @code{TeX-fold-unspec-use-name}. -@end deffn - -@deffn Command TeX-fold-comment -@kindex C-c C-o C-c -(@kbd{C-c C-o C-c}) Hide the comment point is located on. -@end deffn - -@deffn Command TeX-fold-clearout-buffer -@kindex C-c C-o b -(@kbd{C-c C-o b}) Permanently unfold all macros and environments in the -current buffer. -@end deffn - -@deffn Command TeX-fold-clearout-region -@kindex C-c C-o r -(@kbd{C-c C-o r}) Permanently unfold all macros and environments in the -marked region. -@end deffn - -@deffn Command TeX-fold-clearout-paragraph -@kindex C-c C-o p -(@kbd{C-c C-o p}) Permanently unfold all macros and environments in the -paragraph containing point. -@end deffn - -@deffn Command TeX-fold-clearout-item -@kindex C-c C-o i -(@kbd{C-c C-o i}) Permanently show the macro or environment on which -point currently is located. In contrast to temporarily opening the -macro when point is moved sideways onto it, the macro will be -permanently unfolded and will not collapse again once point is leaving -it. -@end deffn - -@deffn Command TeX-fold-dwim -@kindex C-c C-o C-o -(@kbd{C-c C-o C-o}) Hide or show items according to the current context. -If there is folded content, unfold it. If there is a marked region, -fold all configured content in this region. If there is no folded -content but a macro or environment, fold it. -@end deffn - -@vindex TeX-fold-command-prefix -In case you want to use a different prefix than @kbd{C-c C-o} for these -commands you can customize the variable @code{TeX-fold-command-prefix}. -(Note that this will not change the key binding for activating the -mode.) - -The commands above will only take macros or environments into -consideration which are specified in the variables -@code{TeX-fold-macro-spec-list} or @code{TeX-fold-env-spec-list} -respectively. - -@defopt TeX-fold-macro-spec-list -List of replacement specifiers and macros to fold. The specifier can be -a string, an integer or a function symbol. - -If you specify a string, it will be used as a display replacement for -the whole macro. Numbers in braces, brackets, parens or angle brackets -will be replaced by the respective macro argument. For example -@samp{@{1@}} will be replaced by the first mandatory argument of the -macro. One can also define alternatives within the specifier which are -used if an argument is not found. Alternatives are separated by -@samp{||}. They are most useful with optional arguments. As an -example, the default specifier for @samp{\item} is @samp{[1]:||*} which -means that if there is an optional argument, its value is shown followed -by a colon. If there is no optional argument, only an asterisk is used -as the display string. - -If you specify a number as the first element, the content of the -respective mandatory argument of a @LaTeX{} macro will be used as the -placeholder. - -If the first element is a function symbol, the function will be called -with all mandatory arguments of the macro and the result of the function -call will be used as a replacement for the macro. - -The placeholder is made by copying the text from the buffer together with -its properties, i.e. its face as well. If fontification has not -happened when this is done (e.g. because of lazy font locking) the -intended fontification will not show up. As a workaround you can leave -Emacs idle a few seconds and wait for stealth font locking to finish -before you fold the buffer. Or you just re-fold the buffer with -@code{TeX-fold-buffer} when you notice a wrong fontification. -@end defopt - -@defopt TeX-fold-env-spec-list -List of display strings or argument numbers and environments to fold. -Argument numbers refer to the @samp{\begin} statement. That means if -you have e.g. @samp{\begin@{tabularx@}@{\linewidth@}@{XXX@} ... -\end@{tabularx@}} and specify 3 as the argument number, the resulting -display string will be ``XXX''. -@end defopt - -@defopt TeX-fold-math-spec-list -List of display strings and math macros to fold. -@end defopt - -@vindex LaTeX-fold-macro-spec-list -@vindex LaTeX-fold-env-spec-list -@vindex LaTeX-fold-math-spec-list -The variables @code{TeX-fold-macro-spec-list}, -@code{TeX-fold-env-spec-list}, and @code{TeX-fold-math-spec-list} apply -to any @AUCTeX{} mode. If you want to make settings which are only -applied to @LaTeX{} mode, you can use the mode-specific variables -@code{LaTeX-fold-macro-spec-list}, @code{LaTeX-fold-env-spec-list}, and -@code{LaTeX-fold-math-spec-list} - -@defopt TeX-fold-unspec-macro-display-string -Default display string for macros which are not specified in -@code{TeX-fold-macro-spec-list}. -@end defopt - -@defopt TeX-fold-unspec-env-display-string -Default display string for environments which are not specified in -@code{TeX-fold-env-spec-list}. -@end defopt - -@defopt TeX-fold-unspec-use-name -If non-nil the name of the macro or environment surrounded by square -brackets is used as display string, otherwise the defaults specified in -@code{TeX-fold-unspec-macro-display-string} or -@code{TeX-fold-unspec-env-display-string} respectively. -@end defopt - -When you hover with the mouse pointer over folded content, its original -text will be shown in a tooltip or the echo area depending on Tooltip -mode being activate. In order to avoid exorbitantly big tooltips and to -cater for the limited space in the echo area the content will be cropped -after a certain amount of characters defined by the variable -@code{TeX-fold-help-echo-max-length}. - -@defopt TeX-fold-help-echo-max-length -Maximum length of original text displayed in a tooltip or the echo area -for folded content. Set it to zero in order to disable this feature. -@end defopt - - -@node Outline -@section Outlining the Document -@cindex Outlining -@cindex Headers -@cindex Sections -@cindex Overview -@cindex Folding - -@AUCTeX{} supports the standard outline minor mode using -@LaTeX{}/@ConTeXt{} sectioning commands as header lines. @xref{Outline -Mode, , Outline Mode, emacs, GNU Emacs Manual}. - -You can add your own headings by setting the variable -@code{TeX-outline-extra}. - -@defvar TeX-outline-extra -List of extra @TeX{} outline levels. - -Each element is a list with two entries. The first entry is the regular -expression matching a header, and the second is the level of the header. -A @samp{^} is automatically prepended to the regular expressions in the -list, so they must match text at the beginning of the line. - -See @code{LaTeX-section-list} or @code{ConTeXt-INTERFACE-section-list} -for existing header levels. -@end defvar - -The following example add @samp{\item} and @samp{\bibliography} headers, -with @samp{\bibliography} at the same outline level as @samp{\section}, -and @samp{\item} being below @samp{\subparagraph}. - -@lisp -(setq TeX-outline-extra - '(("[ \t]*\\\\\\(bib\\)?item\\b" 7) - ("\\\\bibliography\\b" 2))) -@end lisp - -You may want to check out the unbundled @file{out-xtra} package for even -better outline support. It is available from your favorite emacs lisp -archive. - -@node Processing -@chapter Starting Processors, Viewers and Other Programs - -The most powerful features of @AUCTeX{} may be those allowing you to run -@TeX{}, @LaTeX{}, @ConTeXt{} and other external commands like Bib@TeX{} -and @code{makeindex} from within Emacs, viewing and printing the -results, and moreover allowing you to @emph{debug} your documents. - -@cindex tool bar, toolbar -@vindex LaTeX-enable-toolbar -@vindex plain-TeX-enable-toolbar -@AUCTeX{} comes with a special tool bar for @TeX{} and @LaTeX{} which -provides buttons for the most important commands. You can enable or -disable it by customizing the options @code{plain-TeX-enable-toolbar} -and @code{LaTeX-enable-toolbar} in the @code{TeX-tool-bar} customization -group. - -@menu -* Commands:: Invoking external commands. -* Viewing:: Invoking external viewers. -* Debugging:: Debugging @TeX{} and @LaTeX{} output. -* Checking:: Checking the document. -* Control:: Controlling the processes. -* Cleaning:: Cleaning intermediate and output files. -* Documentation:: Documentation about macros and packages. -@end menu - -@node Commands -@section Executing Commands -@cindex Formatting -@cindex Running @LaTeX{} -@cindex Running @TeX{} -@cindex @LaTeX{} -@cindex @TeX{} -@cindex Running commands -@cindex Default command -@cindex Header -@cindex Trailer -@cindex Setting the header -@cindex Setting the trailer -@cindex Region -@cindex Region file -@cindex Setting the default command -@cindex Commands -@cindex External Commands -@cindex Indexing -@cindex Making an index -@cindex Running @code{makeindex} -@cindex @code{makeindex} -@cindex Bib@TeX{} -@cindex Bibliography -@cindex Literature -@cindex Running Bib@TeX{} -@cindex Making a bibliography -@cindex Printing -@cindex Writing to a printer - -Formatting the document with @TeX{}, @LaTeX{} or @ConTeXt{}, viewing -with a previewer, printing the document, running Bib@TeX{}, making an -index, or checking the document with @command{lacheck} or -@command{chktex} all require running an external command. - -@menu -* Starting a Command:: Starting a Command on a Document or Region -* Selecting a Command:: Selecting and Executing a Command -* Processor Options:: Options for @TeX{} Processors -@end menu - -@node Starting a Command -@subsection Starting a Command on a Document or Region - -There are two ways to run an external command, you can either run it on -the current document with @code{TeX-command-master}, or on the current -region with @code{TeX-command-region}. A special case of running @TeX{} -on a region is @code{TeX-command-buffer} which differs from -@code{TeX-command-master} if the current buffer is not its own master -file. - -@deffn Command TeX-command-master -@kindex C-c C-c -(@kbd{C-c C-c}) Query the user for a command, and run it on the master -file associated with the current buffer. The name of the master file is -controlled by the variable @code{TeX-master}. The available commands are -controlled by the variable @code{TeX-command-list}. -@vindex TeX-master -@vindex TeX-command-list -@end deffn - -@deffn Command TeX-command-region -@kindex C-c C-r -(@kbd{C-c C-r}) Query the user for a command, and run it on the contents -of the selected region. The region contents are written into the region -file, after extracting the header and trailer from the master file. If -mark is inactive (which can happen with Transient Mark mode), use the -old region. See also the command @code{TeX-pin-region} about how to fix -a region. - -The name of the region file is controlled by the variable -@code{TeX-region}. The name of the master file is controlled by the -variable @code{TeX-master}. The header is all text up to the line -matching the regular expression @code{TeX-header-end}. The trailer is -all text from the line matching the regular expression -@code{TeX-trailer-start}. The available commands are controlled by the -variable @code{TeX-command-list}. -@vindex TeX-region -@vindex TeX-header-end -@vindex TeX-trailer-start -@vindex TeX-master -@vindex TeX-command-list -@end deffn - -@deffn Command TeX-command-buffer -@kindex C-c C-b -(@kbd{C-c C-b}) Query the user for a command, and apply it to the -contents of the current buffer. The buffer contents are written into -the region file, after extracting the header and trailer from the master -file. The command is then actually run on the region file. See above -for details. -@end deffn - -@defopt TeX-region -The name of the file for temporarily storing the text when formatting -the current region. -@end defopt - -@defopt TeX-header-end -A regular expression matching the end of the header. By default, this -is @samp{\begin@{document@}} in @LaTeX{} mode and @samp{%**end of -header} in @TeX{} mode. -@end defopt - -@defopt TeX-trailer-start -A regular expression matching the start of the trailer. By default, -this is @samp{\end@{document@}} in @LaTeX{} mode and @samp{\bye} in -@TeX{} mode. -@end defopt - -If you want to change the values of @code{TeX-header-end} and -@code{TeX-trailer-start} you can do this for all files by setting the -variables in a mode hook or per file by specifying them as file -variables (@pxref{File Variables,,,emacs,The Emacs Editor}). - -@deffn Command TeX-pin-region -@kindex C-c C-t C-r -(@kbd{C-c C-t C-r}) If you don't have a mode like Transient Mark mode -active, where marks get disabled automatically, the region would need to -get properly set before each call to @code{TeX-command-region}. If you -fix the current region with @kbd{C-c C-t C-r}, then it will get used for -more commands even though mark and point may change. An explicitly -activated mark, however, will always define a new region when calling -@code{TeX-command-region}. -@end deffn - -@AUCTeX{} will allow one process for each document, plus one process -for the region file to be active at the same time. Thus, if you are -editing @var{n} different documents, you can have @var{n} plus one -processes running at the same time. If the last process you started was -on the region, the commands described in @ref{Debugging} and -@ref{Control} will work on that process, otherwise they will work on the -process associated with the current document. - -@node Selecting a Command -@subsection Selecting and Executing a Command - -Once you started the command selection with @kbd{C-c C-c}, @kbd{C-c C-s} -or @kbd{C-c C-b} you will be prompted for the type of command. -@AUCTeX{} will try to guess which command is appropriate in the given -situation and propose it as default. Usually this is a processor like -@samp{TeX} or @samp{LaTeX} if the document was changed or a viewer if -the document was just typeset. Other commands can be selected in the -minibuffer with completion support by typing @key{TAB}. - -@vindex TeX-command-list -@vindex TeX-expand-list -The available commands are defined by the variable -@code{TeX-command-list}. Per default it includes commands for -typesetting the document (e.g. @samp{LaTeX}), for viewing the output -(@samp{View}), for printing (@samp{Print}), for generating an index -(@samp{Index}) or for spell checking (@samp{Spell}) to name but a few. -You can also add your own commands by adding entries to -@code{TeX-command-list}. Refer to its doc string for information about -its syntax. You might also want to look at @code{TeX-expand-list} to -learn about the expanders you can use in @code{TeX-command-list}. - -Note that the default of the variable occasionally changes. Therefore -it is advisable to add to the list rather than overwriting it. You can -do this with a call to @code{add-to-list} in your init file. For -example, if you wanted to add a command for running a program called -@samp{foo} on the master or region file, you could do this with the -following form. - -@lisp -(eval-after-load "tex" - '(add-to-list 'TeX-command-list - '("Foo" "foo %s" TeX-run-command t t :help "Run foo") t)) -@end lisp - -As mentioned before, @AUCTeX{} will try to guess what command you want -to invoke. If you want to use another command than @samp{TeX}, -@samp{LaTeX} or whatever processor @AUCTeX{} thinks is appropriate for -the current mode, set the variable @code{TeX-command-default}. You can -do this for all files by setting it in a mode hook or per file by -specifying it as a file variable (@pxref{File Variables,,,emacs,The -Emacs Editor}). - -@defopt TeX-command-default -The default command to run in this buffer. Must be an entry in -@code{TeX-command-list}. -@end defopt - -After confirming a command to execute, @AUCTeX{} will try to save any -buffers related to the document, and check if the document needs to be -reformatted. If the variable @code{TeX-save-query} is non-nil, -@AUCTeX{} will query before saving each file. By default @AUCTeX{} will -check emacs buffers associated with files in the current directory, in -one of the @code{TeX-macro-private} directories, and in the -@code{TeX-macro-global} directories. You can change this by setting the -variable @code{TeX-check-path}. - -@defopt TeX-check-path -Directory path to search for dependencies. - -If nil, just check the current file. -Used when checking if any files have changed. -@end defopt - -@node Processor Options -@subsection Options for @TeX{} Processors - -There are some options you can customize affecting which processors are -invoked or the way this is done and which output they produce as a -result. These options control if @acronym{DVI} or @acronym{PDF} output -should be produced, if @TeX{} should be started in interactive or -nonstop mode, if source specials or a Sync@TeX{} file should be produced -for making inverse and forward search possible or which @TeX{} engine -should be used instead of regular @TeX{}, like PDF@TeX{}, Omega or -Xe@TeX{}. - -@deffn Command TeX-PDF-mode -@kindex C-c C-t C-p -@vindex TeX-PDF-mode -@cindex PDF mode -(@kbd{C-c C-t C-p}) -This command toggles the @acronym{PDF} mode of @AUCTeX{}, a buffer-local -minor mode. You can customize @code{TeX-PDF-mode} to give it a -different default. The default is used when @AUCTeX{} does not have -additional clue about what a document might want. This option usually -results in calling either PDF@TeX{} or ordinary @TeX{}. -@end deffn - -@defopt TeX-DVI-via-PDFTeX -If this is set, @acronym{DVI} will also be produced by calling -PDF@TeX{}, setting @code{\pdfoutput=0}. This makes it possible to use -PDF@TeX{} features like character protrusion even when producing -@acronym{DVI} files. Contemporary @TeX{} distributions do this anyway, -so that you need not enable the option within @AUCTeX{}. -@end defopt - -@deffn Command TeX-interactive-mode -@kindex C-c C-t C-i -@vindex TeX-interactive-mode -(@kbd{C-c C-t C-i}) This command toggles the interactive mode of -@AUCTeX{}, a global minor mode. You can customize -@code{TeX-interactive-mode} to give it a different default. In -interactive mode, @TeX{} will pause with an error prompt when errors are -encountered and wait for the user to type something. -@end deffn - -@cindex I/O correlation -@cindex SyncTeX -@cindex Source specials -@cindex PDFSync -@deffn Command TeX-source-correlate-mode -@kindex C-c C-t C-s -@vindex TeX-source-correlate-mode -(@kbd{C-c C-t C-s}) Toggles support for forward and inverse search. -Forward search refers to jumping to the place in the previewed document -corresponding to where point is located in the document source and -inverse search to the other way round. @xref{I/O Correlation}. - -You can permanently activate @code{TeX-source-correlate-mode} by -customizing the variable @code{TeX-source-correlate-mode}. There is a -bunch of customization options for the mode, use @kbd{M-x -customize-group @key{RET} TeX-view @key{RET}} to find out more. - -@vindex TeX-source-correlate-method -@AUCTeX{} is aware of three different means to do I/O correlation: -source specials (only DVI output), the pdfsync @LaTeX{} package (only -PDF output) and Sync@TeX{}. The choice between source specials and -Sync@TeX{} can be controlled with the variable -@code{TeX-source-correlate-method}. - -Should you use source specials it has to be stressed @emph{very} -strongly however, that source specials can cause differences in page -breaks and spacing, can seriously interfere with various packages and -should thus @emph{never} be used for the final version of a document. -In particular, fine-tuning the page breaks should be done with source -specials switched off. -@end deffn - -@AUCTeX{} also allows you to easily select different @TeX{} engines for -processing, either by using the entries in the @samp{TeXing Options} -submenu below the @samp{Command} menu or by calling the function -@code{TeX-engine-set}. These eventually set the variable -@code{TeX-engine} which you can also modify directly. - -@defopt TeX-engine -This variable allows you to choose which @TeX{} engine should be used -for typesetting the document, i.e. the executables which will be used -when you invoke the @samp{TeX} or @samp{LaTeX} commands. The value -should be one of the symbols defined in @code{TeX-engine-alist-builtin} -or @code{TeX-engine-alist}. The symbols @samp{default}, @samp{xetex}, -@samp{luatex} and @samp{omega} are available from the built-in list. -@end defopt - -Note that @code{TeX-engine} is buffer-local, so setting the variable -directly or via the above mentioned menu or function will not take -effect in other buffers. If you want to activate an engine for all -@AUCTeX{} modes, set @code{TeX-engine} in your init file, e.g. by using -@kbd{M-x customize-variable }. If you want to activate it for a -certain @AUCTeX{} mode only, set the variable in the respective mode -hook. If you want to activate it for certain files, set it through file -variables (@pxref{File Variables,,,emacs,The Emacs Editor}). - -@vindex TeX-command -@vindex LaTeX-command -@vindex TeX-Omega-command -@vindex LaTeX-Omega-command -@vindex ConTeXt-engine -@vindex ConTeXt-Omega-engine -@vindex TeX-engine-alist -@vindex TeX-engine-alist-builtin -Should you need to change the executable names related to the different -engine settings, there are some variables you can tweak. Those are -@code{TeX-command}, @code{LaTeX-command}, @code{TeX-Omega-command}, -@code{LaTeX-Omega-command}, @code{ConTeXt-engine} and -@code{ConTeXt-Omega-engine}. The rest of the executables is defined -directly in @code{TeX-engine-alist-builtin}. If you want to override an -entry from that, add an entry to @code{TeX-engine-alist} that starts -with the same symbol as that the entry in the built-in list and specify -the executables you want to use instead. You can also add entries to -@code{TeX-engine-alist} in order to add support for engines not covered -per default. - -@defopt TeX-engine-alist -Alist of TeX engines and associated commands. Each entry is a list with -a maximum of five elements. The first element is a symbol used to -identify the engine. The second is a string describing the engine. The -third is the command to be used for plain TeX. The fourth is the -command to be used for LaTeX. The fifth is the command to be used for -the @samp{--engine} parameter of ConTeXt's @samp{texexec} program. Each -command can either be a variable or a string. An empty string or nil -means there is no command available. -@end defopt - -You can customize @AUCTeX{} to show the processor output as it is -produced. - -@defopt TeX-show-compilation -If non-nil, the output of @TeX{} compilation is shown in another window. -@end defopt - -@node Viewing -@section Viewing the Formatted Output -@cindex Viewing -@cindex Previewing -@cindex Starting a previewer - -@AUCTeX{} allows you to start external programs for previewing the -formatted output of your document. - -@menu -* Starting Viewers:: Starting viewers -* I/O Correlation:: Forward and inverse search -@end menu - -@node Starting Viewers -@subsection Starting Viewers - -Viewers are normally invoked by pressing @kbd{C-c C-c} once the document -is formatted, which will propose the View command, or by activating the -respective entry in the Command menu. Alternatively you can type -@kbd{C-c C-v} which calls the function @code{TeX-view}. - -@deffn Command TeX-view -@kindex C-c C-v -(@kbd{C-c C-v}) Start a viewer without confirmation. The viewer is -started either on a region or the master file, depending on the last -command issued. This is especially useful for jumping to the location -corresponding to point in the viewer when using -@code{TeX-source-correlate-mode}. -@end deffn - -@AUCTeX{} will try to guess which type of viewer (@acronym{DVI}, -PostScript or @acronym{PDF}) has to be used and what options are to be -passed over to it. This decision is based on the output files present -in the working directory as well as the class and style options used in -the document. For example, if there is a @acronym{DVI} file in your -working directory, a @acronym{DVI} viewer will be invoked. In case of a -@acronym{PDF} file it will be a @acronym{PDF} viewer. If you specified -a special paper format like @samp{a5paper} or use the @samp{landscape} -option, this will be passed to the viewer by the appropriate options. -Especially some @acronym{DVI} viewers depend on this kind of information -in order to display your document correctly. In case you are using -@samp{pstricks} or @samp{psfrag} in your document, a @acronym{DVI} -viewer cannot display the contents correctly and a PostScript viewer -will be invoked instead. - -The association between the tests for the conditions mentioned above and -the viewers is made in the variable @code{TeX-view-program-selection}. -Therefore this variable is the starting point for customization if you -want to use other viewers than the ones suggested by default. - -@defopt TeX-view-program-selection -This is a list of predicates and viewers which is evaluated from front -to back in order to find out which viewer to call under the given -conditions. In the first element of each list item you can reference -one or more predicates defined in @code{TeX-view-predicate-list} or -@code{TeX-view-predicate-list-builtin}. In the second element you can -reference a viewer defined in @code{TeX-view-program-list} or -@code{TeX-view-program-list-builtin}. The viewer of the first item with -a positively evaluated predicate is selected. -@end defopt - -So @code{TeX-view-program-selection} only contains references to the -actual implementations of predicates and viewer commands respectively -which can be found elsewhere. @AUCTeX{} comes with a set of -preconfigured predicates and viewer commands which are stored in the -variables @code{TeX-view-predicate-list-builtin} and -@code{TeX-view-program-list-builtin} respectively. If you are not -satisfied with those and want to overwrite one of them or add your own -definitions, you can do so via the variables -@code{TeX-view-predicate-list} and @code{TeX-view-program-list}. - -@defopt TeX-view-predicate-list -This is a list of predicates for viewer selection and invocation. The -first element of each list item is a symbol and the second element a -Lisp form to be evaluated. The form should return nil if the predicate -is not fulfilled. - -A built-in predicate from @code{TeX-view-predicate-list-builtin} can be -overwritten by defining a new predicate with the same symbol. -@end defopt - -@defopt TeX-view-program-list -This is a list of viewer specifications each consisting of a symbolic -name and either a command line or a function to be invoked when the -viewer is called. If a command line is used, parts of it can be -conditionalized by prefixing them with predicates from -@code{TeX-view-predicate-list} or -@code{TeX-view-predicate-list-builtin}. (See the doc string for the -exact format to use.) The command line can also contain placeholders as -defined in @code{TeX-expand-list} which are expanded before the viewer -is called. - -A built-in viewer spec from @code{TeX-view-program-list-builtin} can be -overwritten by defining a new viewer spec with the same name. -@end defopt - -Note that the viewer selection and invocation as described above will -only work if certain default settings in @AUCTeX{} are intact. For one, -the whole viewer selection machinery will only be triggered if the -@samp{%V} expander in @code{TeX-expand-list} is unchanged. So if you -have trouble with the viewer invocation you might check if there is an -older customization of the variable in place. In addition, the use of a -function in @code{TeX-view-program-list} only works if the View command -in @code{TeX-command-list} makes use of the hook -@code{TeX-run-discard-or-function}. - -Note also that the implementation described above replaces an older one -which was less flexible. This old implementation works with the -variables @code{TeX-output-view-style} and @code{TeX-view-style} which -are used to associate file types and style options with viewers. If -desired you can reactivate it by using the placeholder @samp{%vv} for -the View command in @code{TeX-command-list}. Note however, that it is -bound to be removed from @AUCTeX{} once the new implementation proved to -be satisfactory. For the time being, find a short description of the -mentioned customization options below. - -@defopt TeX-output-view-style -List of output file extensions, style options and view options. Each -item of the list consists of three elements. If the first element (a -regular expression) matches the output file extension, and the second -element (a regular expression) matches the name of one of the style -options, any occurrence of the string @code{%V} in a command in -@code{TeX-command-list} will be replaced with the third element. -@end defopt - -@defopt TeX-view-style -List of style options and view options. This is the predecessor of -@code{TeX-output-view-style} which does not provide the possibility to -specify output file extensions. It is used as a fallback in case none -of the alternatives specified in @code{TeX-output-view-style} match. In -case none of the entries in @code{TeX-view-style} match either, no -suggestion for a viewer is made. -@end defopt - -@node I/O Correlation -@subsection Forward and Inverse Search -@cindex Inverse search -@cindex Forward search -@cindex I/O correlation -@cindex Source specials -@cindex SyncTeX -@cindex PDFSync - -Forward and inverse search refer to the correlation between the document -source in the editor and the typeset document in the viewer. Forward -search allows you to jump to the place in the previewed document -corresponding to a certain line in the document source and inverse -search vice versa. - -@findex TeX-source-correlate-mode -@AUCTeX{} supports three methods for forward and inverse search: source -specials (only DVI output), the pdfsync @LaTeX{} package (only PDF -output) and Sync@TeX{} (any type of output). If you want to make use of -forward and inverse searching with source specials or Sync@TeX{}, switch -on @code{TeX-source-correlate-mode}. @xref{Processor Options}, on how -to do that. The use of the pdfsync package is detected automatically if -document parsing is enabled. - -@findex TeX-view -Forward search happens automatically upon calling the viewer, e.g. by -typing @kbd{C-c C-v} (@code{TeX-view}). This will open the viewer or -bring it to front and display the output page corresponding to the -position of point in the source file. @AUCTeX{} will automatically pass -the necessary command line options to the viewer for this to happen. - -@vindex TeX-source-correlate-start-server -Upon opening the viewer you will be asked if you want to start a server -process (Gnuserv or Emacs server) which is necessary for inverse search. -This happens only if there is no server running already. You can -customize the variable @code{TeX-source-correlate-start-server} to -inhibit the question and always or never start the server respectively. - -@defopt TeX-source-correlate-start-server -If @code{TeX-source-correlate-mode} is active and a viewer is invoked, -the default behavior is to ask if a server process should be started. -Set this variable to @code{t} if the question should be inhibited and -the server should always be started. Set it to @code{nil} if the server -should never be started. Inverse search will not be available in the -latter case. -@end defopt - -Inverse search, i.e. jumping to the part of your document source in -Emacs corresponding to a certain position in the viewer, is triggered -from the viewer, typically by a mouse click. Refer to the documentation -of your viewer to find out how it has to be configured and what you have -to do exactly. In xdvi you normally have to use @kbd{C-down-mouse-1}. - -@node Debugging -@section Catching the errors -@cindex Debugging -@cindex Errors -@cindex Parsing errors -@cindex Parsing TeX output -@cindex Next error -@cindex Parsing @LaTeX{} errors -@cindex Overfull boxes -@cindex Bad boxes -@cindex Underfull boxes - -Once you've formatted your document you may `debug' it, i.e. browse -through the errors (La)@TeX{} reported. - -@deffn Command TeX-next-error -@kindex C-c ` -(@kbd{C-c `}) Go to the next error reported by @TeX{}. The view will -be split in two, with the cursor placed as close as possible to the -error in the top view. In the bottom view, the error message will be -displayed along with some explanatory text. -@end deffn - -Normally @AUCTeX{} will only report real errors, but you may as well -ask it to report `bad boxes' and warnings as well. - -@deffn Command TeX-toggle-debug-bad-boxes -@kindex C-c C-t C-b -(@kbd{C-c C-t C-b}) Toggle whether @AUCTeX{} should stop at bad boxes -(i.e. overfull and underfull boxes) as well as normal errors. -@end deffn - -@deffn Command TeX-toggle-debug-warnings -@kindex C-c C-t C-w -(@kbd{C-c C-t C-w}) Toggle whether @AUCTeX{} should stop at warnings as -well as normal errors. -@end deffn - -As default, @AUCTeX{} will display a special help buffer containing the -error reported by @TeX{} along with the documentation. There is however -an `expert' option, which allows you to display the real @TeX{} output. - -@defopt TeX-display-help -If t @AUCTeX{} will automatically display a help text whenever an error -is encountered using @code{TeX-next-error} (@kbd{C-c `}). If nil a -terse information about the error is displayed in the echo area. If -@code{expert} @AUCTeX{} will display the output buffer with the raw -@TeX{} output. -@end defopt - -@node Checking -@section Checking for problems -@cindex Checking -@cindex @code{lacheck} -@cindex @code{chktex} -@cindex Finding errors -@cindex Running @code{lacheck} -@cindex Running @code{chktex} -@cindex Style -@cindex Problems - -Running @TeX{} or @LaTeX{} will only find regular errors in the -document, not examples of bad style. Furthermore, description of the -errors may often be confusing. The utility @code{lacheck} can be used -to find style errors, such as forgetting to escape the space after an -abbreviation or using @samp{...} instead of @samp{\ldots} and many other -problems like that. You start @code{lacheck} with @kbd{C-c C-c Check -@key{RET}}. The result will be a list of errors in the -@samp{*compilation*} buffer. You can go through the errors with -@kbd{C-x `} (@code{next-error}, @pxref{Compilation,,,emacs,The Emacs -Editor}), which will move point to the location of the next error. - -Another newer program which can be used to find errors is @code{chktex}. -It is much more configurable than @code{lacheck}, but doesn't find all -the problems @code{lacheck} does, at least in its default configuration. -You must install the programs before using them, and for @code{chktex} -you may also need modify @code{TeX-command-list} unless you use its -@code{lacheck} compatibility wrapper. You can get @code{lacheck} from -@file{} or -alternatively @code{chktex} from -@file{}. - -@node Control -@section Controlling the output -@cindex Controlling the output -@cindex Output -@cindex Redisplay output -@cindex Processes -@cindex Killing a process -@cindex Finding the master file -@cindex Master file -@cindex Stopping a process -@cindex Current file -@cindex Finding the current file - -A number of commands are available for controlling the output of an -application running under @AUCTeX{} - -@deffn Command TeX-kill-job -@kindex C-c C-k -(@kbd{C-c C-k}) Kill currently running external application. -This may be either of @TeX{}, @LaTeX{}, previewer, Bib@TeX{}, etc. -@end deffn - -@deffn Command TeX-recenter-output-buffer -@kindex C-c C-l -(@kbd{C-c C-l}) Recenter the output buffer so that the bottom line is -visible. -@end deffn - -@deffn Command TeX-home-buffer -@kindex C-c ^ -(@kbd{C-c ^}) Go to the `master' file in the document associated with -the current buffer, or if already there, to the file where the current -process was started. -@end deffn - -@node Cleaning -@section Cleaning intermediate and output files -@cindex Cleaning - -@deffn Command TeX-clean -@vindex plain-TeX-clean-intermediate-suffixes -@vindex plain-TeX-clean-output-suffixes -@vindex LaTeX-clean-intermediate-suffixes -@vindex LaTeX-clean-output-suffixes -@vindex docTeX-clean-intermediate-suffixes -@vindex docTeX-clean-output-suffixes -@vindex Texinfo-clean-intermediate-suffixes -@vindex Texinfo-clean-output-suffixes -@vindex ConTeXt-clean-intermediate-suffixes -@vindex ConTeXt-clean-output-suffixes -Remove generated intermediate files. In case a prefix argument is -given, remove output files as well. - -Canonical access to the function is provided by the @samp{Clean} and -@samp{Clean All} entries in @code{TeX-command-list}, invokable with -@kbd{C-c C-c} or the Command menu. - -The patterns governing which files to remove can be adapted separately -for each @AUCTeX{} mode by means of the variables -@code{plain-TeX-clean-intermediate-suffixes}, -@code{plain-TeX-clean-output-suffixes}, -@code{LaTeX-clean-intermediate-suffixes}, -@code{LaTeX-clean-output-suffixes}, -@code{docTeX-clean-intermediate-suffixes}, -@code{docTeX-clean-output-suffixes}, -@code{Texinfo-clean-intermediate-suffixes}, -@code{Texinfo-clean-output-suffixes}, -@code{ConTeXt-clean-intermediate-suffixes} and -@code{ConTeXt-clean-output-suffixes}. -@end deffn - -@defopt TeX-clean-confirm -Control if deletion of intermediate and output files has to be confirmed -before it is actually done. If non-nil, ask before deleting files. -@end defopt - -@node Documentation -@section Documentation about macros and packages -@cindex Documentation - -@deffn Command TeX-doc -@kindex C-c ? -(@kbd{C-c ?}) Get documentation about macros, packages or @TeX{} & -Co. in general. The function will prompt for the name of a command or -manual, providing a list of available keywords for completion. If point -is on a command or word with available documentation, this will be -suggested as default. - -In case no documentation could be found, a prompt for querying the -@samp{texdoc} program is shown, should the latter be available. - -The command can be invoked by the key binding mentioned above as well as -the @samp{Find Documentation...} entry in the mode menu. -@end deffn - -@node Customization -@chapter Customization and Extension - -@menu -* Modes and Hooks:: Modes and Hooks -* Multifile:: Multifile Documents -* Parsing Files:: Automatic Parsing of @TeX{} Files -* Internationalization:: Language Support -* Automatic:: Automatic Customization -* Style Files:: Writing Your Own Style Support -@end menu - -@node Modes and Hooks -@section Modes and Hooks - -@AUCTeX{} supports a wide variety of derivatives and extensions of -@TeX{}. Besides plain @TeX{} those are @LaTeX{}, AMS-@TeX{}, -@ConTeXt{}, Texinfo and doc@TeX{}. For each of them there is a separate -major mode in @AUCTeX{} and each major mode runs @code{text-mode-hook}, -@code{TeX-mode-hook} as well as a hook special to the mode in this -order. The following table provides an overview of the respective mode -functions and hooks. - -@multitable {Plain @TeX{}} {@code{plain-TeX-mode}} {@code{plain-TeX-mode-hook}} -@headitem Type @tab Mode function @tab Hook -@item Plain @TeX{} @tab @code{plain-TeX-mode} @tab @code{plain-TeX-mode-hook} -@item @LaTeX{} @tab @code{LaTeX-mode} @tab @code{LaTeX-mode-hook} -@item AMS-@TeX{} @tab @code{ams-tex-mode} @tab @code{AmS-TeX-mode-hook} -@item @ConTeXt{} @tab @code{ConTeXt-mode} @tab @code{ConTeXt-mode-hook} -@item Texinfo @tab @code{Texinfo-mode} @tab @code{Texinfo-mode-hook} -@item Doc@TeX{} @tab @code{docTeX-mode} @tab @code{docTeX-mode-hook} -@end multitable - -If you need to make a customization via a hook which is only relevant -for one of the modes listed above, put it into the respective mode hook, -if it is relevant for any @AUCTeX{} mode, add it to @code{TeX-mode-hook} -and if it is relevant for all text modes, append it to -@code{text-mode-hook}. - -@node Multifile -@section Multifile Documents -@cindex Multifile Documents -@cindex Documents -@cindex Documents with multiple files -@cindex Multiple Files -@cindex Many Files -@cindex Including -@cindex \include -@cindex Inputing -@cindex \input -@cindex Master file - -You may wish to spread a document over many files (as you are likely to do if -there are multiple authors, or if you have not yet discovered the power -of the outline commands (@pxref{Outline})). This can be done by having a -``master'' file in which you include the various files with the @TeX{} -macro @samp{\input} or the @LaTeX{} macro @samp{\include}. These -files may also include other files themselves. However, to format the -document you must run the commands on the top level master file. - -When you, for example, ask @AUCTeX{} to run a command on the master file, -it has no way of knowing the name of the master file. By default, -it will assume that the current file is the master file. If you insert -the following in your @file{.emacs} file @AUCTeX{} will use a more -advanced algorithm. - -@lisp -(setq-default TeX-master nil) ; Query for master file. -@end lisp - -If @AUCTeX{} finds the line indicating the end of the header in a master -file (@code{TeX-header-end}), it can figure out for itself that this is -a master file. Otherwise, it will ask for the name of the master file -associated with the buffer. To avoid asking you again, @AUCTeX{} will -automatically insert the name of the master file as a file variable -(@pxref{File Variables,,,emacs,The Emacs Editor}). You can also insert -the file variable yourself, by putting the following text at the end of -your files. -@findex TeX-header-end - -@example -%%% Local Variables: -%%% TeX-master: "master" -%%% End: -@end example - -You should always set this variable to the name of the top level document. If -you always use the same name for your top level documents, you can set -@code{TeX-master} in your @file{.emacs} file. - -@lisp -(setq-default TeX-master "master") ; All master files called "master". -@end lisp - -@defopt TeX-master -The master file associated with the current buffer. If the file being -edited is actually included from another file, then you can tell @AUCTeX{} -the name of the master file by setting this variable. If there are -multiple levels of nesting, specify the top level file. - -If this variable is @code{nil}, @AUCTeX{} will query you for the -name. - -If the variable is @code{t}, then @AUCTeX{} will assume the file is a master -file itself. - -If the variable is @code{shared}, then @AUCTeX{} will query for the name, -but will not change the file. -@end defopt - -@defopt TeX-one-master -Regular expression matching ordinary @TeX{} files. - -You should set this variable to match the name of all files, for which -it is a good idea to append a @code{TeX-master} file variable entry -automatically. When @AUCTeX{} adds the name of the master file as a -file variable, it does not need to ask next time you edit the file. - -If you dislike @AUCTeX{} automatically modifying your files, you can -set this variable to @samp{""}. By default, @AUCTeX{} will modify -any file with an extension of @samp{.tex}. -@end defopt - -@deffn Command TeX-master-file-ask -@kindex C-c _ -(@kbd{C-c _}) Query for the name of a master file and add the respective -File Variables (@pxref{File Variables,,,emacs,The Emacs Editor}) to the -file for setting this variable permanently. - -@AUCTeX{} will not ask for a master file when it encounters existing -files. This function shall give you the possibility to insert the -variable manually. -@end deffn - -@AUCTeX{} keeps track of macros, environments, labels, and style -files that are used in a given document. For this to work with -multifile documents, @AUCTeX{} has to have a place to put the -information about the files in the document. This is done by having an -@file{auto} subdirectory placed in the directory where your document is -located. Each time you save a file, @AUCTeX{} will write information -about the file into the @file{auto} directory. When you load a file, -@AUCTeX{} will read the information in the @file{auto} directory -about the file you loaded @emph{and the master file specified by -@code{TeX-master}}. Since the master file (perhaps indirectly) includes -all other files in the document, @AUCTeX{} will get information from -all files in the document. This means that you will get from each file, -for example, completion for all labels defined anywhere in the document. - -@AUCTeX{} will create the @file{auto} directory automatically if -@code{TeX-auto-save} is non-nil. Without it, the files in the document -will not know anything about each other, except for the name of the -master file. @xref{Automatic Local}. - -@deffn Command TeX-save-document -@kindex C-c C-d -(@kbd{C-c C-d}) Save all buffers known to belong to the current document. -@end deffn - -@defopt TeX-save-query -If non-nil, then query the user before saving each file with -@code{TeX-save-document}. -@end defopt - - -@node Parsing Files -@section Automatic Parsing of @TeX{} Files -@cindex Parsing @TeX{} -@cindex Automatic Parsing -@cindex Tabs -@cindex Tabify -@cindex Untabify - -@AUCTeX{} depends heavily on being able to extract information from the -buffers by parsing them. Since parsing the buffer can be somewhat slow, -the parsing is initially disabled. You are encouraged to enable them by -adding the following lines to your @file{.emacs} file. - -@lisp -(setq TeX-parse-self t) ; Enable parse on load. -(setq TeX-auto-save t) ; Enable parse on save. -@end lisp - -The latter command will make @AUCTeX{} store the parsed information in -an @file{auto} subdirectory in the directory each time the @TeX{} files -are stored, @pxref{Automatic Local}. If @AUCTeX{} finds the pre-parsed -information when loading a file, it will not need to reparse the buffer. -The information in the @file{auto} directory is also useful for -multifile documents, @pxref{Multifile}, since it allows each file to -access the parsed information from all the other files in the document. -This is done by first reading the information from the master file, and -then recursively the information from each file stored in the master -file. - -The variables can also be done on a per file basis, by changing the file -local variables. - -@example -%%% Local Variables: -%%% TeX-parse-self: t -%%% TeX-auto-save: t -%%% End: -@end example - -Even when you have disabled the automatic parsing, you can force the -generation of style information by pressing @kbd{C-c C-n}. This is -often the best choice, as you will be able to decide when it is -necessary to reparse the file. - -@defopt TeX-parse-self -Parse file after loading it if no style hook is found for it. -@end defopt - -@defopt TeX-auto-save -Automatically save style information when saving the buffer. -@end defopt - -@deffn Command TeX-normal-mode @var{arg} -@kindex C-c C-n -(@kbd{C-c C-n}) Remove all information about this buffer, and apply the -style hooks again. Save buffer first including style information. With -optional argument, also reload the style hooks. -@end deffn - -When @AUCTeX{} saves your buffer, it can optionally convert all tabs in -your buffer into spaces. -Tabs confuse @AUCTeX{}'s error message parsing and so should generally be -avoided. However, tabs are significant in some environments, and so by -default @AUCTeX{} does not remove them. -To convert tabs to spaces when saving a buffer, insert the -following in your @file{.emacs} file: - -@lisp -(setq TeX-auto-untabify t) -@end lisp - -@defopt TeX-auto-untabify -Automatically remove all tabs from a file before saving it. -@end defopt - -Instead of disabling the parsing entirely, you can also speed it -significantly up by limiting the information it will search for (and -store) when parsing the buffer. You can do this by setting the default -values for the buffer local variables @code{TeX-auto-regexp-list} and -@code{TeX-auto-parse-length} in your @file{.emacs} file. - -@lisp -;; Only parse LaTeX class and package information. -(setq-default TeX-auto-regexp-list 'LaTeX-auto-minimal-regexp-list) -;; The class and package information is usually near the beginning. -(setq-default TeX-auto-parse-length 2000) -@end lisp - -This example will speed the parsing up significantly, but @AUCTeX{} -will no longer be able to provide completion for labels, macros, -environments, or bibitems specified in the document, nor will it know -what files belong to the document. - -These variables can also be specified on a per file basis, by changing -the file local variables. - -@example -%%% Local Variables: -%%% TeX-auto-regexp-list: TeX-auto-full-regexp-list -%%% TeX-auto-parse-length: 999999 -%%% End: -@end example - -@defopt TeX-auto-regexp-list -List of regular expressions used for parsing the current file. -@end defopt - -@defopt TeX-auto-parse-length -Maximal length of @TeX{} file that will be parsed. -@end defopt - -The pre-specified lists of regexps are defined below. You can use these -before loading @AUCTeX{} by quoting them, as in the example above. - -@defvr Constant TeX-auto-empty-regexp-list -Parse nothing -@end defvr - -@defvr Constant LaTeX-auto-minimal-regexp-list -Only parse @LaTeX{} class and packages. -@end defvr - -@defvr Constant LaTeX-auto-label-regexp-list -Only parse @LaTeX{} labels. -@end defvr - -@defvr Constant LaTeX-auto-regexp-list -Parse common @LaTeX{} commands. -@end defvr - -@defvr Constant plain-TeX-auto-regexp-list -Parse common plain @TeX{} commands. -@end defvr - -@defvr Constant TeX-auto-full-regexp-list -Parse all @TeX{} and @LaTeX{} commands that @AUCTeX{} can use. -@end defvr - -@node Internationalization -@section Language Support -@cindex Internationalization -@cindex Language Support -@cindex Character set -@cindex National letters -@cindex CJK language -@cindex MULE -@cindex C@TeX{} -@cindex China@TeX{} -@cindex p@TeX{} -@cindex ASCII p@TeX{} -@cindex j@TeX{} -@cindex NTT j@TeX{} -@cindex k@TeX{} -@cindex H@LaTeX{} -@cindex CJK-@LaTeX{} -@cindex UNICODE -@cindex MULE-UCS - -@TeX{} and Emacs are usable for European (Latin, Cyrillic, Greek) based -languages. Some @LaTeX{} and EmacsLisp packages are available for easy -typesetting and editing documents in European languages. - -@c Some Texinfo macros are not used because they require quite recent -@c texinfo versions (2005-03-05): -@c Second arg of @acronym is available with 4.7, @comma is available in -@c 4.7, @abbr is available in 4.8. -@c -> @abbr{MULE, MULtilingual Enhancement to GNU Emacs} -@c -> @acronym{CJK, Chinese@comma{} Japanese@comma{} and Korean} - -For @acronym{CJK} (Chinese, Japanese, and Korean) languages, Emacs or -XEmacs with @acronym{MULE} (MULtilingual Enhancement to GNU Emacs) -support is required. @acronym{MULE} is part of Emacs by default since -Emacs 20. XEmacs has to be configured with the @samp{--with-mule} -option. Special versions of @TeX{} are needed for @acronym{CJK} -languages: C@TeX{} and China@TeX{} for Chinese, ASCII p@TeX{} and NTT -j@TeX{} for Japanese, H@LaTeX{} and k@TeX{} for Korean. The -@acronym{CJK}-@LaTeX{} package is required for supporting multiple -@acronym{CJK} scripts within a single document. - -Note that Unicode is not fully supported in Emacs 21 and XEmacs 21. -@acronym{CJK} characters are not usable. Please use the -@acronym{MULE}-@acronym{UCS} EmacsLisp package or Emacs 22 (not released -yet) if you need @acronym{CJK}. - -@c FIXME: We need more information for CTeX, ChinaTeX, KTeX, and HLaTeX. - -@menu -* European:: Using @AUCTeX{} with European Languages -* Japanese:: Using @AUCTeX{} with Japanese -@end menu - -@node European -@subsection Using @AUCTeX{} with European Languages -@cindex Europe -@cindex European Characters -@cindex ISO 8859 Latin 1 -@cindex Latin 1 -@cindex ISO 8859 Latin 2 -@cindex Latin 2 -@cindex ANSI - -@subsubsection Typing and Displaying Non-ASCII Characters - -First you will need a way to write non-ASCII characters. You can either -use macros, or teach @TeX{} about the ISO character sets. I prefer the -latter, it has the advantage that the usual standard emacs word -movement and case change commands will work. - -With @LaTeX{}2e, just add @samp{\usepackage[latin1]@{inputenc@}}. Other -languages than Western European ones will probably have other encoding -needs. - -To be able to display non-ASCII characters you will need an appropriate -font and a version of GNU Emacs capable of displaying 8-bit characters -(e.g. Emacs 21). The manner in which this is supported differs between -Emacsen, so you need to take a look at your respective documentation. - -A compromise is to use an European character set when editing the file, -and convert to @TeX{} macros when reading and writing the files. - -@table @file -@item iso-cvt.el -@cindex @file{iso-cvt.el} -Much like @file{iso-tex.el} but is bundled with Emacs 19.23 and later. - -@item x-compose.el -@cindex @file{x-compose.el} -Similar package bundled with new versions of XEmacs. - -@item X-Symbol -@cindex X-Symbol -a much more complete package for both Emacs and XEmacs that can also -handle a lot of mathematical characters and input methods. -@end table - -@subsubsection Style Files for Different Languages - -@cindex ispell -@AUCTeX{} supports style files for several languages. Each style file -may modify @AUCTeX{} to better support the language, and will run -a language specific hook that will allow you to for example change -ispell dictionary, or run code to change the keyboard remapping. The -following will for example choose a Danish dictionary for documents -including @samp{\usepackage[danish]@{babel@}}. -This requires parsing to be enabled, @pxref{Parsing Files}. - -@lisp -(add-hook 'TeX-language-dk-hook - (lambda () (ispell-change-dictionary "danish"))) -@end lisp - -The following style files are recognized: - -@c In alphabetic order of the hooks: -@vindex TeX-language-bg-hook -@vindex TeX-language-cz-hook -@vindex TeX-language-dk-hook -@vindex TeX-language-nl-hook -@vindex TeX-language-de-hook -@vindex TeX-language-it-hook -@vindex TeX-language-is-hook -@vindex TeX-language-pl-hook -@vindex TeX-language-sk-hook -@vindex TeX-language-sv-hook -@cindex Bulgarian -@cindex Czech -@cindex Italian -@cindex Danish -@cindex Dutch -@cindex German -@cindex Polish -@cindex Slovak -@cindex Swedish -@table @file -@item bulgarian -Runs style hook @code{TeX-language-bg-hook}. Gives @samp{"} word -syntax, makes the @key{"} key insert a literal @samp{"}. Typing @key{"} -twice will insert insert @samp{"`} or @samp{"'} depending on context. -Typing @key{-} twice will insert @samp{"=}, three times @samp{--}. - -@item czech -Runs style hook @code{TeX-language-cz-hook}. Pressing @key{"} will -insert @samp{\uv@{} and @samp{@}} depending on context. - -@c Is the difference between dk and danish really intented? -@item danish -Runs style hook @code{TeX-language-dk-hook}. Pressing @key{"} will -insert @samp{"`} and @samp{"'} depending on context. Typing @key{-} -twice will insert @samp{"=}, i.e. a hyphen string allowing hyphenation -in the composing words. -@c dk.sty seems to be obsolete, so we don't want to encourage using it. -@c @item dk -@c Runs style hook @code{TeX-language-dk-hook}. - -@item dutch -Runs style hook @code{TeX-language-nl-hook}. - -@item german -@itemx ngerman -Runs style hook @code{TeX-language-de-hook}. Gives @samp{"} word -syntax, makes the @key{"} key insert a literal @samp{"}. Pressing the -key twice will give you opening or closing German quotes (@samp{"`} or -@samp{"'}). Typing @key{-} twice will insert @samp{"=}, three times -@samp{--}. - -@item frenchb -@itemx francais -Runs style hook @code{TeX-language-fr-hook}. Pressing @key{"} will -insert @samp{\\og} and @samp{\\fg} depending on context. Note that the -language name for customizing @code{TeX-quote-language-alist} is -@samp{french}. - -@item icelandic -Runs style hook @code{TeX-language-is-hook}. Gives @samp{"} word -syntax, makes the @key{"} key insert a literal @samp{"}. Typing @key{"} -twice will insert insert @samp{"`} or @samp{"'} depending on context. -Typing @key{-} twice will insert @samp{"=}, three times @samp{--}. - -@item italian -Runs style hook @code{TeX-language-it-hook}. Pressing @key{"} will -insert @samp{"<} and @samp{">} depending on context. - -@item polish -Runs style hook @code{TeX-language-pl-hook}. Gives @samp{"} word syntax -and makes the @key{"} key insert a literal @samp{"}. Pressing @key{"} -twice will insert @samp{"`} or @samp{"'} depending on context. - -@item polski -Runs style hook @code{TeX-language-pl-hook}. Makes the @key{"} key -insert a literal @samp{"}. Pressing @key{"} twice will insert @samp{,,} -or @samp{''} depending on context. - -@item slovak -Runs style hook @code{TeX-language-sk-hook}. Pressing @key{"} will -insert @samp{\uv@{} and @samp{@}} depending on context. - -@item swedish -Runs style hook @code{TeX-language-sv-hook}. Pressing @key{"} will -insert @samp{''}. Typing @key{-} twice will insert @samp{"=}, three -times @samp{--}. -@end table - -Replacement of language-specific hyphen strings like @samp{"=} with -dashes does not require to type @key{-} three times in a row. You can -put point after the hypen string anytime and trigger the replacement by -typing @key{-}. - -In case you are not satisfied with the suggested behavior of quote and -hyphen insertion you can change it by customizing the variables -@code{TeX-quote-language-alist} and -@code{LaTeX-babel-hyphen-language-alist} respectively. - -@defopt TeX-quote-language-alist -Used for overriding the default language-specific quote insertion -behavior. This is an alist where each element is a list consisting of -four items. The first item is the name of the language in concern as a -string. See the list of supported languages above. The second item is -the opening quotation mark. The third item is the closing quotation -mark. Opening and closing quotation marks can be specified directly as -strings or as functions returning a string. The fourth item is a -boolean controlling quote insertion. It should be non-nil if if the -special quotes should only be used after inserting a literal @samp{"} -character first, i.e. on second key press. -@end defopt - -@defopt LaTeX-babel-hyphen-language-alist -Used for overriding the behavior of hyphen insertion for specific -languages. Every element in this alist is a list of three items. The -first item should specify the affected language as a string. The second -item denotes the hyphen string to be used as a string. The third item, -a boolean, controls the behavior of hyphen insertion and should be -non-nil if the special hyphen should be inserted after inserting a -literal @samp{-} character, i.e. on second key press. -@end defopt - -The defaults of hyphen insertion are defined by the variables -@code{LaTeX-babel-hyphen} and @code{LaTeX-babel-hyphen-after-hyphen} -respectively. - -@defopt LaTeX-babel-hyphen -String to be used when typing @key{-}. This usually is a hyphen -alternative or hyphenation aid provided by @samp{babel} and the related -language style files, like @samp{"=}, @samp{"~} or @samp{"-}. - -Set it to an empty string or nil in order to disable language-specific -hyphen insertion. -@end defopt - -@defopt LaTeX-babel-hyphen-after-hyphen -Control insertion of hyphen strings. If non-nil insert normal hyphen on -first key press and swap it with the language-specific hyphen string -specified in the variable @code{LaTeX-babel-hyphen} on second key press. -If nil do it the other way round. -@end defopt - -@node Japanese -@subsection Using @AUCTeX{} with Japanese @TeX{} -@cindex Japan -@cindex Japanese -@cindex Nippon -@cindex MULE -@cindex NTT j@TeX{} -@cindex j@TeX{} -@cindex j@LaTeX{} -@cindex ASCII p@TeX{} -@cindex p@TeX{} -@cindex p@LaTeX{} -@cindex @file{tex-jp.el} -@vindex TeX-default-mode -@vindex japanese-TeX-command-default -@vindex japanese-LaTeX-command-default -@vindex japanese-LaTeX-default-style - -To write Japanese text with @AUCTeX{}, you need to have versions of -@TeX{} and Emacs that support Japanese. There exist at least two -variants of @TeX{} for Japanese text (NTT j@TeX{} and ASCII p@TeX{}). -@AUCTeX{} can be used with @acronym{MULE, MULtilingual Enhancement to GNU -Emacs} supported Emacsen. - -To use the Japanese @TeX{} variants, simply activate -@code{japanese-plain-tex-mode} or @code{japanese-latex-mode} and -everything should work. If not, send mail to Masayuki Ataka -@samp{}, who kindly donated the code for -supporting Japanese in @AUCTeX{}. None of the primary @AUCTeX{} -maintainers understand Japanese, so they cannot help you. - -If you usually use @AUCTeX{} in Japanese, setting the following -variables is useful. - -@defopt TeX-default-mode -Mode to enter for a new file when it cannott be determined whether the -file is plain @TeX{} or @LaTeX{} or what. - -If you want to enter Japanese @LaTeX{} mode whenever this may happen, -set the variable like this: -@lisp -(setq TeX-default-mode 'japanese-latex-mode) -@end lisp -@end defopt - -@defopt japanese-TeX-command-default -The default command for @code{TeX-command} in Japanese @TeX{} mode. - -The default value is @samp{"pTeX"}. -@end defopt - -@defopt japanese-LaTeX-command-default -The default command for @code{TeX-command} in Japanese @LaTeX{} mode. - -The default value is @samp{"LaTeX"}. -@end defopt - -@defopt japanese-LaTeX-default-style -The default style/class when creating a new Japanese @LaTeX{} document. - -The default value is @samp{"jarticle"}. -@end defopt - -See @file{tex-jp.el} for more information. - -@node Automatic -@section Automatic Customization -@cindex Automatic Customization -@cindex Extracting @TeX{} symbols -@cindex Automatic -@cindex @file{auto} directories. -@cindex Parsing @TeX{} -@cindex @TeX{} parsing -@cindex Generating symbols - -Since @AUCTeX{} is so highly customizable, it makes sense that it is able -to customize itself. The automatic customization consists of scanning -@TeX{} files and extracting symbols, environments, and things like that. - -The automatic customization is done on three different levels. The -global level is the level shared by all users at your site, and consists -of scanning the standard @TeX{} style files, and any extra styles added -locally for all users on the site. The private level deals with those -style files you have written for your own use, and use in different -documents. You may have a @file{~/lib/TeX/} directory where you store -useful style files for your own use. The local level is for a specific -directory, and deals with writing customization for the files for your -normal @TeX{} documents. - -If compared with the environment variable @code{TEXINPUTS}, the -global level corresponds to the directories built into @TeX{}. The -private level corresponds to the directories you add yourself, except for -@file{.}, which is the local level. - -@menu -* Automatic Global:: Automatic Customization for the Site -* Automatic Private:: Automatic Customization for a User -* Automatic Local:: Automatic Customization for a Directory -@end menu - -By default @AUCTeX{} will search for customization files in all the -global, private, and local style directories, but you can also set the -path directly. This is useful if you for example want to add another -person's style hooks to your path. Please note that all matching files -found in @code{TeX-style-path} are loaded, and all hooks defined in the -files will be executed. - -@defopt TeX-style-path -List of directories to search for @AUCTeX{} style files. -Each must end with a slash. -@end defopt - -By default, when @AUCTeX{} searches a directory for files, it will -recursively search through subdirectories. - -@defopt TeX-file-recurse -Whether to search @TeX{} directories recursively: nil means do not -recurse, a positive integer means go that far deep in the directory -hierarchy, t means recurse indefinitely. -@end defopt - -By default, @AUCTeX{} will ignore files name @file{.}, @file{..}, -@file{SCCS}, @file{RCS}, and @file{CVS}. - -@defopt TeX-ignore-file -Regular expression matching file names to ignore. - -These files or directories will not be considered when searching for -@TeX{} files in a directory. -@end defopt - -@node Automatic Global -@subsection Automatic Customization for the Site -@cindex Global style hook directory -@cindex Global macro directory -@cindex Site macro directory -@cindex Global @TeX{} macro directory -@cindex Site @TeX{} macro directory -@cindex Global directories -@cindex Site information - -Assuming that the automatic customization at the global level was done -when @AUCTeX{} was installed, your choice is now: will you use it? If -you use it, you will benefit by having access to all the symbols and -environments available for completion purposes. The drawback is slower -load time when you edit a new file and perhaps too many confusing -symbols when you try to do a completion. - -You can disable the automatic generated global style hooks by setting -the variable @code{TeX-auto-global} to nil. - -@defopt TeX-macro-global -Directories containing the site's @TeX{} style files. -@end defopt - -@defopt TeX-style-global -Directory containing hand generated @TeX{} information. -Must end with a slash. - -These correspond to @TeX{} macros shared by all users of a site. -@end defopt - -@defopt TeX-auto-global -Directory containing automatically generated information. - -For storing automatic extracted information about the @TeX{} macros -shared by all users of a site. -@end defopt - -@node Automatic Private -@subsection Automatic Customization for a User -@cindex Private style hook directory -@cindex Private macro directory -@cindex Personal macro directory -@cindex Private @TeX{} macro directory -@cindex Personal @TeX{} macro directory -@cindex Private directories -@cindex Personal information - -You should specify where you store your private @TeX{} macros, so -@AUCTeX{} can extract their information. The extracted information will -go to the directories listed in @code{TeX-auto-private} - -Use @kbd{M-x TeX-auto-generate @key{RET}} to extract the information. - -@defopt TeX-macro-private -Directories where you store your personal @TeX{} macros. The value -defaults to the directories listed in the @samp{TEXINPUTS} and -@samp{BIBINPUTS} environment variables or to the respective directories -in @code{$TEXMFHOME} if no results can be obtained from the environment -variables. -@end defopt - -@defopt TeX-auto-private -List of directories containing automatically generated @AUCTeX{} style -files. These correspond to the personal @TeX{} macros. -@end defopt - -@deffn Command TeX-auto-generate @var{TEX} @var{AUTO} -(@kbd{M-x TeX-auto-generate @key{RET}}) Generate style hook for -@var{TEX} and store it in @var{AUTO}. If @var{TEX} is a directory, -generate style hooks for all files in the directory. -@end deffn - -@defopt TeX-style-private -List of directories containing hand generated @AUCTeX{} style files. -These correspond to the personal @TeX{} macros. -@end defopt - -@node Automatic Local -@subsection Automatic Customization for a Directory -@cindex Local style hooks -@cindex Updating style hooks -@cindex Automatic updating style hooks -@cindex Local style hooks -@cindex Local style directory - -@AUCTeX{} can update the style information about a file each time you -save it, and it will do this if the directory @code{TeX-auto-local} -exist. @code{TeX-auto-local} is by default set to @samp{"auto"}, so -simply creating an @file{auto} directory will enable automatic saving of -style information. - -The advantage of doing this is that macros, labels, etc. defined in any -file in a multifile document will be known in all the files in the -document. The disadvantage is that saving will be slower. To disable, -set @code{TeX-auto-local} to nil. - -@defopt TeX-style-local -Directory containing hand generated @TeX{} information. -Must end with a slash. - -These correspond to @TeX{} macros found in the current directory. -@end defopt - -@defopt TeX-auto-local -Directory containing automatically generated @TeX{} information. -Must end with a slash. - -These correspond to @TeX{} macros found in the current directory. -@end defopt - -@node Style Files -@section Writing Your Own Style Support -@cindex Style files -@cindex Style hooks -@cindex @file{style} - -@xref{Automatic}, for a discussion about automatically generated global, -private, and local style files. The hand generated style files are -equivalent, except that they by default are found in @file{style} -directories instead of @file{auto} directories. - -@menu -* Simple Style:: A Simple Style File -* Adding Macros:: Adding Support for Macros -* Adding Environments:: Adding Support for Environments -* Adding Other:: Adding Other Information -* Hacking the Parser:: Automatic Extraction of New Things -@end menu - -If you write some useful support for a public @TeX{} style file, please -send it to us. - -@node Simple Style -@subsection A Simple Style File -@cindex @file{book.el} -@cindex Sample style file -@cindex Style file -@cindex Example of a style file. -@cindex Style hook -@cindex Adding a style hook - -Here is a simple example of a style file. - -@lisp -;;; book.el - Special code for book style. - -(TeX-add-style-hook - "book" - (lambda () - (LaTeX-largest-level-set "chapter"))) -@end lisp - -This file specifies that the largest kind of section in a @LaTeX{} document -using the book document style is chapter. The interesting thing to -notice is that the style file defines an (anonymous) function, and adds it -to the list of loaded style hooks by calling @code{TeX-add-style-hook}. - -The first time the user indirectly tries to access some style specific -information, such as the largest sectioning command available, the style -hooks for all files directly or indirectly read by the current document -is executed. The actual files will only be evaluated once, but the -hooks will be called for each buffer using the style file. - -@defun TeX-add-style-hook @var{style} @var{hook} -Add @var{hook} to the list of functions to run when we use the @TeX{} -file @var{style}. -@end defun - -@node Adding Macros -@subsection Adding Support for Macros -@cindex Adding macros -@cindex Macros, adding -@cindex Defining macros in style hooks - -The most common thing to define in a style hook is new symbols (@TeX{} -macros). Most likely along with a description of the arguments to the -function, since the symbol itself can be defined automatically. - -Here are a few examples from @file{latex.el}. - -@lisp -(TeX-add-style-hook - "latex" - (lambda () - (TeX-add-symbols - '("arabic" TeX-arg-counter) - '("label" TeX-arg-define-label) - '("ref" TeX-arg-label) - '("newcommand" TeX-arg-define-macro [ "Number of arguments" ] t) - '("newtheorem" TeX-arg-define-environment - [ TeX-arg-environment "Numbered like" ] - t [ TeX-arg-counter "Within counter" ])))) -@end lisp - -@defun TeX-add-symbols @var{symbol} @dots{} -Add each @var{symbol} to the list of known symbols. -@end defun - -Each argument to @code{TeX-add-symbols} is a list describing one symbol. -The head of the list is the name of the symbol, the remaining elements -describe each argument. - -If there are no additional elements, the symbol will be inserted with -point inside braces. Otherwise, each argument of this function should -match an argument of the @TeX{} macro. What is done depends on the argument -type. - -If a macro is defined multiple times, @AUCTeX{} will chose the one with -the longest definition (i.e. the one with the most arguments). - -Thus, to overwrite -@example - '("tref" 1) ; one argument -@end example -you can specify -@example - '("tref" TeX-arg-label ignore) ; two arguments -@end example - -@code{ignore} is a function that does not do anything, so when you -insert a @samp{tref} you will be prompted for a label and no more. - -You can use the following types of specifiers for arguments: - -@table @code -@item string -Use the string as a prompt to prompt for the argument. - -@item number -Insert that many braces, leave point inside the first. - -@item nil -Insert empty braces. - -@item t -Insert empty braces, leave point between the braces. - -@item other symbols -Call the symbol as a function. You can define your -own hook, or use one of the predefined argument hooks. - -@item list -If the car is a string, insert it as a prompt and the next -element as initial input. Otherwise, call the car of the list with -the remaining elements as arguments. - -@item vector -Optional argument. If it has more than one element, parse it -as a list, otherwise parse the only element as above. Use square -brackets instead of curly braces, and is not inserted on empty user -input. -@end table - -A lot of argument hooks have already been defined. The first argument to -all hooks is a flag indicating if it is an optional argument. It is up -to the hook to determine what to do with the remaining arguments, if -any. Typically the next argument is used to overwrite the default -prompt. - -@ftable @code -@item TeX-arg-conditional -Implements if EXPR THEN ELSE. If EXPR evaluates to true, parse THEN as an -argument list, else parse ELSE as an argument list. - -@item TeX-arg-literal -Insert its arguments into the buffer. Used for specifying extra syntax -for a macro. - -@item TeX-arg-free -Parse its arguments but use no braces when they are inserted. - -@item TeX-arg-eval -Evaluate arguments and insert the result in the buffer. - -@item TeX-arg-label -Prompt for a label completing with known labels. - -@item TeX-arg-macro -Prompt for a @TeX{} macro with completion. - -@item TeX-arg-environment -Prompt for a @LaTeX{} environment with completion. - -@item TeX-arg-cite -Prompt for a Bib@TeX{} citation. - -@item TeX-arg-counter -Prompt for a @LaTeX{} counter. - -@item TeX-arg-savebox -Prompt for a @LaTeX{} savebox. - -@item TeX-arg-file -Prompt for a filename in the current directory, and use it without the -extension. - -@item TeX-arg-input-file -Prompt for the name of an input file in @TeX{}'s search path, and use it -without the extension. Run the style hooks for the file. - -@item TeX-arg-define-label -Prompt for a label completing with known labels. Add label to list of -defined labels. - -@item TeX-arg-define-macro -Prompt for a @TeX{} macro with completion. Add macro to list of defined -macros. - -@item TeX-arg-define-environment -Prompt for a @LaTeX{} environment with completion. Add environment to -list of defined environments. - -@item TeX-arg-define-cite -Prompt for a Bib@TeX{} citation. - -@item TeX-arg-define-counter -Prompt for a @LaTeX{} counter. - -@item TeX-arg-define-savebox -Prompt for a @LaTeX{} savebox. - -@item TeX-arg-corner -Prompt for a @LaTeX{} side or corner position with completion. - -@item TeX-arg-lr -Prompt for a @LaTeX{} side with completion. - -@item TeX-arg-tb -Prompt for a @LaTeX{} side with completion. - -@item TeX-arg-pagestyle -Prompt for a @LaTeX{} pagestyle with completion. - -@item TeX-arg-verb -Prompt for delimiter and text. - -@item TeX-arg-pair -Insert a pair of numbers, use arguments for prompt. The numbers are -surrounded by parentheses and separated with a comma. - -@item TeX-arg-size -Insert width and height as a pair. No arguments. - -@item TeX-arg-coordinate -Insert x and y coordinates as a pair. No arguments. -@end ftable - -If you add new hooks, you can assume that point is placed directly after -the previous argument, or after the macro name if this is the first -argument. Please leave point located after the argument you are -inserting. If you want point to be located somewhere else after all -hooks have been processed, set the value of @code{exit-mark}. It will -point nowhere, until the argument hook sets it. - -@node Adding Environments -@subsection Adding Support for Environments -@cindex Adding environments -@cindex Environments, adding -@cindex Defining environments in style hooks - -Adding support for environments is very much like adding support for -@TeX{} macros, except that each environment normally only takes one -argument, an environment hook. The example is again a short version of -@file{latex.el}. - -@lisp -(TeX-add-style-hook - "latex" - (lambda () - (LaTeX-add-environments - '("document" LaTeX-env-document) - '("enumerate" LaTeX-env-item) - '("itemize" LaTeX-env-item) - '("list" LaTeX-env-list)))) -@end lisp - -It is completely up to the environment hook to insert the environment, -but the function @code{LaTeX-insert-environment} may be of some help. -The hook will be called with the name of the environment as its first -argument, and extra arguments can be provided by adding them to a list -after the hook. - -For simple environments with arguments, for example defined with -@samp{\newenvironment}, you can make @AUCTeX{} prompt for the arguments -by giving the prompt strings in the call to -@code{LaTeX-add-environments}. The fact that an argument is optional -can be indicated by wrapping the prompt string in a vector. - -For example, if you have defined a @code{loop} environment with the -three arguments @var{from}, @var{to}, and @var{step}, you can add -support for them in a style file. - -@example -%% loop.sty - -\newenvironment@{loop@}[3]@{...@}@{...@} -@end example - -@lisp -;; loop.el - -(TeX-add-style-hook - "loop" - (lambda () - (LaTeX-add-environments - '("loop" "From" "To" "Step")))) -@end lisp - -If an environment is defined multiple times, @AUCTeX{} will choose the -one with the longest definition. Thus, if you have an enumerate style -file, and want it to replace the standard @LaTeX{} enumerate hook above, -you could define an @file{enumerate.el} file as follows, and place it in -the appropriate style directory. - -@lisp -(TeX-add-style-hook - "latex" - (lambda () - (LaTeX-add-environments - '("enumerate" LaTeX-env-enumerate foo)))) - -(defun LaTeX-env-enumerate (environment &optional ignore) ...) -@end lisp - -The symbol @code{foo} will be passed to @code{LaTeX-env-enumerate} as -the second argument, but since we only added it to overwrite the -definition in @file{latex.el} it is just ignored. - -@defun LaTeX-add-environments @var{env} @dots{} -Add each @var{env} to list of loaded environments. -@end defun - -@defun LaTeX-insert-environment @var{env} [ @var{extra} ] -Insert environment of type @var{env}, with optional argument @var{extra}. -@end defun - -Following is a list of available hooks for -@code{LaTeX-add-environments}: - -@ftable @code -@item LaTeX-env-item -Insert the given environment and the first item. - -@item LaTeX-env-figure -Insert the given figure-like environment with a caption and a label. - -@item LaTeX-env-array -Insert the given array-like environment with position and column -specifications. - -@item LaTeX-env-label -Insert the given environment with a label. - -@item LaTeX-env-list -Insert the given list-like environment, a specifier for the label and -the first item. - -@item LaTeX-env-minipage -Insert the given minipage-like environment with position and width -specifications. - -@item LaTeX-env-tabular* -Insert the given tabular*-like environment with width, position and -column specifications. - -@item LaTeX-env-picture -Insert the given environment with width and height specifications. - -@item LaTeX-env-bib -Insert the given environment with a label for a bibitem. - -@item LaTeX-env-contents -Insert the given environment with a filename as its argument. - -@item LaTeX-env-args -Insert the given environment with arguments. You can use this as a hook -in case you want to specify multiple complex arguments just like in -elements of @code{TeX-add-symbols}. This is most useful if the -specification of arguments to be prompted for with strings and strings -wrapped in a vector as described above is too limited. - -Here is an example from @file{listings.el} which calls a function with -one argument in order to prompt for a key=value list to be inserted as -an optional argument of the @samp{lstlisting} environment: - -@lisp -(LaTeX-add-environments - `("lstlisting" LaTeX-env-args - [TeX-arg-key-val ,LaTeX-listings-key-val-options])) -@end lisp -@end ftable - -@node Adding Other -@subsection Adding Other Information -@cindex Adding bibliographies -@cindex Bibliographies, adding -@cindex Defining bibliographies in style hooks -@cindex Adding labels -@cindex Labels, adding -@cindex Defining labels in style hooks -@cindex Adding other information -@cindex Other information, adding -@cindex Defining other information in style hooks - -You can also specify bibliographical databases and labels in the style -file. This is probably of little use, since this information will -usually be automatically generated from the @TeX{} file anyway. - -@defun LaTeX-add-bibliographies @var{bibliography} @dots{} -Add each @var{bibliography} to list of loaded bibliographies. -@end defun - -@defun LaTeX-add-labels @var{label} @dots{} -Add each @var{label} to the list of known labels. -@end defun - -@node Hacking the Parser -@subsection Automatic Extraction of New Things -@cindex Parsing new macros -@cindex @file{macro.tex} -@cindex @file{macro.el} -@cindex Changing the parser - -The automatic @TeX{} information extractor works by searching for -regular expressions in the @TeX{} files, and storing the matched -information. You can add support for new constructs to the parser, -something that is needed when you add new commands to define symbols. - -For example, in the file @file{macro.tex} I define the following macro. - -@example -\newcommand@{\newmacro@}[5]@{% -\def#1@{#3\index@{#4@@#5~cite@{#4@}@}\nocite@{#4@}@}% -\def#2@{#5\index@{#4@@#5~cite@{#4@}@}\nocite@{#4@}@}% -@} -@end example - -@AUCTeX{} will automatically figure out that @samp{newmacro} is a macro -that takes five arguments. However, it is not smart enough to -automatically see that each time we use the macro, two new macros are -defined. We can specify this information in a style hook file. - -@lisp -;;; macro.el --- Special code for my own macro file. - -;;; Code: - -(defvar TeX-newmacro-regexp - '("\\\\newmacro@{\\\\\\([a-zA-Z]+\\)@}@{\\\\\\([a-zA-Z]+\\)@}" - (1 2) TeX-auto-multi) - "Matches \newmacro definitions.") - -(defvar TeX-auto-multi nil - "Temporary for parsing \\newmacro definitions.") - -(defun TeX-macro-cleanup () - "Move symbols from `TeX-auto-multi' to `TeX-auto-symbol'." - (mapcar (lambda (list) - (mapcar (lambda (symbol) - (setq TeX-auto-symbol - (cons symbol TeX-auto-symbol))) - list)) - TeX-auto-multi)) - -(defun TeX-macro-prepare () - "Clear `Tex-auto-multi' before use." - (setq TeX-auto-multi nil)) - -(add-hook 'TeX-auto-prepare-hook 'TeX-macro-prepare) -(add-hook 'TeX-auto-cleanup-hook 'TeX-macro-cleanup) - -(TeX-add-style-hook - "macro" - (lambda () - (TeX-auto-add-regexp TeX-newmacro-regexp) - (TeX-add-symbols '("newmacro" - TeX-arg-macro - (TeX-arg-macro "Capitalized macro: \\") - t - "BibTeX entry: " - nil)))) - -;;; macro.el ends here -@end lisp - -When this file is first loaded, it adds a new entry to -@code{TeX-newmacro-regexp}, and defines a function to be called before -the parsing starts, and one to be called after the parsing is done. It -also declares a variable to contain the data collected during parsing. -Finally, it adds a style hook which describes the @samp{newmacro} macro, -as we have seen it before. - -So the general strategy is: Add a new entry to @code{TeX-newmacro-regexp}. -Declare a variable to contain intermediate data during parsing. Add hook -to be called before and after parsing. In this case, the hook before -parsing just initializes the variable, and the hook after parsing -collects the data from the variable, and adds them to the list of symbols -found. - -@defvar TeX-auto-regexp-list -List of regular expressions matching @TeX{} macro definitions. - -The list has the following format ((REGEXP MATCH TABLE) @dots{}), that -is, each entry is a list with three elements. - -REGEXP. Regular expression matching the macro we want to parse. - -MATCH. A number or list of numbers, each representing one -parenthesized subexpression matched by REGEXP. - -TABLE. The symbol table to store the data. This can be a function, in -which case the function is called with the argument MATCH. Use -@code{TeX-match-buffer} to get match data. If it is not a function, it -is presumed to be the name of a variable containing a list of match -data. The matched data (a string if MATCH is a number, a list of -strings if MATCH is a list of numbers) is put in front of the table. -@end defvar - -@defvar TeX-auto-prepare-hook nil -List of functions to be called before parsing a @TeX{} file. -@end defvar - -@defvar TeX-auto-cleanup-hook nil -List of functions to be called after parsing a @TeX{} file. -@end defvar - -@node Appendices -@appendix Copying, Changes, Development, FAQ - -@menu -* Copying this Manual:: -* Changes:: -* Development:: -* FAQ:: -@end menu - -@node Copying this Manual -@appendixsec Copying this Manual - -@ifinfo -The copyright notice for this manual is: - -@insertcopying -@end ifinfo - -The full license text can be read here: - -@menu -* GNU Free Documentation License:: License for copying this manual. -@end menu - -@lowersections -@include fdl.texi -@raisesections - -@node Changes -@appendixsec Changes and New Features - -@lowersections -@include changes.texi -@raisesections - -@subheading Older versions -See the file @file{history.texi} for older changes. - -@node Development -@appendixsec Future Development - -@lowersections -@include todo.texi -@raisesections - -@node FAQ -@appendixsec Frequently Asked Questions - -@lowersections -@include faq.texi -@raisesections - -@node Indices -@unnumbered Indices - -@menu -* Key Index:: -* Function Index:: -* Variable Index:: -* Concept Index:: -@end menu - -@node Key Index -@unnumberedsec Key Index - -@printindex ky - -@node Function Index -@unnumberedsec Function Index - -@printindex fn - -@node Variable Index -@unnumberedsec Variable Index - -@printindex vr - -@node Concept Index -@unnumberedsec Concept Index - -@printindex cp - -@bye diff --git a/packages/auctex/doc/changes.texi b/packages/auctex/doc/changes.texi deleted file mode 100644 index 0f429271b..000000000 --- a/packages/auctex/doc/changes.texi +++ /dev/null @@ -1,800 +0,0 @@ -@c This is part of the AUCTeX manual. -@c Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -@c 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. -@c See file auctex.texi for copying conditions. -@include macros.texi -@ifset rawfile -@chapheading Changes and New Features in @AUCTeX{} - -@end ifset - -@heading News in 11.86 - -@itemize @bullet -@item -Parsing of @LaTeX{} output was improved. It is now less likely that -@AUCTeX{} opens a non-existent file upon calling @code{TeX-next-error}; -a problem for example encountered when using MiK@TeX{} 2.8. In addition -quoted file names as emitted by MiK@TeX{} are now supported. - -@item -A new framework for the definition and selection of viewers was -implemented. If you have customizations regarding viewers you will have -to redo them in this new framework or reenable the old one. -@ifset rawfile -See the section on viewers in the manual for details. -@end ifset -@ifclear rawfile -@xref{Starting Viewers}, for details. -@end ifclear - -@item -Comprehensive editing support for PSTricks was added. - -@item -Support for various @LaTeX{} packages was added, e.g. @samp{tabularx}, -@samp{CJK}, and @samp{hyperref}. - -@item -An easy way to switch between @TeX{} engines (PDF@TeX{}, Lua@TeX{}, -Xe@TeX{}, Omega) was added. - -@item -Support for Sync@TeX{} was added. This involves the command line -options for @LaTeX{} and the viewer. - -@item -Folding can now be customized to use macro arguments as replacement -text. - -@item -@samp{preview.sty} now works with Xe@TeX{}. - -@item -A lot of smaller and larger bugs have been squashed. -@end itemize - -@heading News in 11.85 - -@itemize @bullet - -@item -Font locking has been improved significantly. It is now less prone to -color bleeding which could lead to high resource usage. In addition it -now includes information about @LaTeX{} macro syntax and can indicate -syntactically incorrect macros in @LaTeX{} mode. - -@item -The license was updated to GPLv3. - -@item -Support for the nomencl, flashcards and comment @LaTeX{} packages as -well as the Icelandic language option of babel were added. - -@item -Support for folding of math macros was added. - -@item -Lots of minor bugs in features and documentation fixed. -@end itemize - -@heading News in 11.84 - -@itemize @bullet - -@item -There have been problems with the @samp{-without-texmf-dir} option to -@samp{configure} when the value of @samp{-with-kpathsea-sep} was set or -determined for an installation system with a default different from that -of the runtime system. @code{with-kpathsea-sep} has been removed; the -setting is now usually determined at runtime. - -Due to this and other problems, preview-latex in the released XEmacs -package failed under Windows or with anything except recent 21.5 -XEmacsen. - -@item -@AUCTeX{} and @previewlatex{} have been changed in order to accommodate -file names containing spaces. @previewlatex{} now tolerates bad -PostScript code polluting the stack (like some Omega fonts). - -@item -@samp{preview.sty} had in some cases failed to emit PostScript header -specials. - -@item -Support for folding of comments was added. - -@item -The @code{polish} language option of the babel LaTeX package as well as -the polski LaTeX package are now supported. Most notably this means -that AUCTeX will help to insert quotation marks as defined by polish.sty -(@code{"`..."'}) and polski.sty (@code{,,...''}). - -@item -The @TeX{} tool bar is now available and enabled by default in plain -@TeX{} mode. -@ifclear rawfile -@xref{Processing Facilities}. -@end ifclear - -@item -Bug fix in the display of math subscripts and superscripts. - -@item -Bug fix @code{TeX-doc} for Emacs 21. - -@item -There has been quite a number of other bug fixes to various features and -documentation across the board. - -@end itemize - -@heading News in 11.83 - -@itemize @bullet -@item -The new function @code{TeX-doc} provides easy access to documentation -about commands and packages or information related to @TeX{} and friends -in general. -@ifset rawfile -It is accessible with the key binding @kbd{C-c ?} or the -@samp{Find Documentation...} entry in the mode menus. -@end ifset -@ifclear rawfile -@xref{Documentation}. -@end ifclear - -@item -You can now get rid of generated intermediate and output files by means -of the new @samp{Clean} and @samp{Clean All} entries in -@code{TeX-command-list} accessible with @kbd{C-c C-c} or the Command -menu. -@ifclear rawfile -@xref{Cleaning}. -@end ifclear - -@item -Support for forward search with PDF files was added. That means you can -jump to a place in the output file corresponding to the position in the -source file. -@ifset rawfile -Currently this only works if you use the pdfsync @LaTeX{} package and -xpdf as your PDF viewer. The accuracy is in the range of +/-1 page. -@end ifset -@ifclear rawfile -@xref{Viewing}. -@end ifclear - -Adding support for this feature required the default value of the -variable @code{TeX-output-view-style} to be changed. Please make sure -you either remove any customizations overriding the new default or -incorporate the changes into your customizations if you want to use this -feature. - -@item -@TeX{} error messages of the @code{-file-line-error} kind are now -understood in @AUCTeX{} and @previewlatex{} (parsers are still -separate). - -@item -Bug fix in XyM@TeX{} support. - -@item -The @LaTeX{} tool bar is now enabled by default. -@ifclear rawfile -@xref{Processing Facilities}. -@end ifclear - -@end itemize - -@heading News in 11.82 - -@itemize @bullet -@item -Support for the MinionPro LaTeX package was added. - -@item -Warnings and underfull/overfull boxes are now being indicated in the -echo area after a @LaTeX{} run, if the respective debugging options are -activated with @code{TeX-toggle-debug-warnings} (@kbd{C-c C-t C-w}) or -@code{TeX-toggle-debug-bad-boxes} (@kbd{C-c C-t C-b}). In this case -@code{TeX-next-error} will find these warnings in addition to normal -errors. - -The key binding @kbd{C-c C-w} for @code{TeX-toggle-debug-bad-boxes} -(which was renamed from @code{TeX-toggle-debug-boxes}) now is -deprecated. - -@item -@AUCTeX{} now can automatically insert a pair of braces after typing -@key{_} or @key{^} in math constructs if the new variable -@code{TeX-electric-sub-and-superscript} is set to a non-nil value. - -@item -Some language-specific support for French was added. There now is -completion support for the commands provided by the @samp{frenchb} (and -@samp{francais}) options of the babel @LaTeX{} package and easier input -of French quotation marks (@code{\\og ...\\fg}) which can now be -inserted by typing @key{"}. - -@item -Completion support for options of some LaTeX packages was added. - -@item -@cindex @file{auctex.el} -@cindex @file{tex-site.el} -Already in version 11.81 the way to activate @AUCTeX{} changed -substantially. This should now be done with @code{(load "auctex.el" nil -t t)} instead of the former @code{(require 'tex-site)}. Related to this -change @file{tex-mik.el} does not load @file{tex-site.el} anymore. That -means if you used only @code{(require 'tex-mik)} in order to activate -@AUCTeX{}, you have to add @code{(load "auctex.el" nil t t)} before the -latter statement. -@ifset rawfile -More detailed information can be found in the installation instructions -(file INSTALL). -@end ifset -@ifclear rawfile -@xref{Loading the package}. -@end ifclear - -@item -Handling of verbatim constructs was consolidated across AUCTeX. This -resulted in the @fontlatex{}-specific variables -@code{font-latex-verb-like-commands}, @code{font-latex-verbatim-macros}, -and @code{font-latex-verbatim-environments} being removed and the more -general variables @code{LaTeX-verbatim-macros-with-delims}, -@code{LaTeX-verbatim-macros-with-braces}, and -@code{LaTeX-verbatim-environments} being added. - -@item -The output of a Bib@TeX{} run is now checked for warnings and errors, -which are reported in the echo area. - -@item -The aliases for @code{font-latex-title-fontify} were removed. Use -@code{font-latex-fontify-sectioning} instead. - -@item -The problem that Japanese macros where broken across lines was fixed. - -@item -Various bug fixes. -@end itemize - -@heading News in 11.81 - -@itemize @bullet -@item -@code{LaTeX-mark-section} now marks subsections of a given section as -well. The former behavior is available via the prefix argument. - -@item -@previewlatex{} which was previously available separately became a -subsystem of @AUCTeX{}. There is no documented provision for building -or installing @previewlatex{} separately. It is still possible to use -and install @AUCTeX{} without @previewlatex{}, however. - -@item -The installation procedures have been overhauled and now also install -startup files as part of the process (those had to be copied manually -previously). You are advised to remove previous installations of -@AUCTeX{} and @previewlatex{} before starting the installation -procedure. A standard installation from an unmodified tarball no longer -requires Makeinfo or Perl. - -Also note that the way @AUCTeX{} is supposed to be activated changed. -Instead of @code{(require 'tex-site)} you should now use @code{(load -"auctex.el" nil t t)}. While the former method may still work, the new -method has the advantage that you can deactivate a preactivated -@AUCTeX{} with the statement @code{(unload-feature 'tex-site)} before -any of its modes have been used. This may be important especially for -site-wide installations. - -@item -Support for the babel @LaTeX{} package was added. - -@item -Folding a buffer now ensures that the whole buffer is fontified before -the actual folding is carried out. If this results in unbearably long -execution times, you can fall back to the old behavior of relying on -stealth font locking to do this job in the background by customizing the -variable @code{TeX-fold-force-fontify}. - -@item -Folded content now reveals part of its original text in a tooltip or the -echo area when hovering with the mouse pointer over it. - -@item -The language-specific insertion of quotation marks was generalized. The -variables @code{LaTeX-german-open-quote}, -@code{LaTeX-german-close-quote}, @code{LaTeX-german-quote-after-quote}, -@code{LaTeX-italian-open-quote}, @code{LaTeX-italian-close-quote}, and -@code{LaTeX-italian-quote-after-quote} are now obsolete. If you are not -satisfied with the default settings, you should customize -@code{TeX-quote-language-alist} instead. - -@item -Similar to language-specific quote insertion, @AUCTeX{} now helps you -with hyphens in different languages as well. -@ifclear rawfile -@xref{European}, for details. -@end ifclear - -@item -Fill problems in Japanese text introduced in @AUCTeX{} 11.55 were fixed. -@AUCTeX{} tries not to break lines between 1-byte and 2-byte chars. -These features will work in Chinese text, too. - -@item -The scaling factor of the fontification of sectioning commands can now -be customized using the variable @code{font-latex-fontify-sectioning}. -This variable was previously called @code{font-latex-title-fontify}; In -this release we provide an alias but this will disappear in one of the -the next releases. The faces for the sectioning commands are now called -@code{font-latex-sectioning-@var{N}-face} (@var{N}=0@dots{}5) instead of -@code{font-latex-title-@var{N}-face} (@var{N}=1@dots{}4). Analogously -the names of the variables holding the related keyword lists were -changed from @code{font-latex-title-@var{N}-keywords} to -@code{font-latex-sectioning-@var{N}-keywords}. -@ifclear rawfile -@xref{Font Locking}, for details. -@end ifclear -Make sure to adjust your customizations. - -@item -Titles in beamer slides marked by the ``\frametitle'' command are know -displayed with the new face @code{font-latex-slide-title-face}. You can -add macros to be highlighted with this face to -@code{font-latex-match-slide-title-keywords}. - -@item -Of course a lot of bugs have been fixed. -@end itemize - -@heading News in 11.55 - -@itemize @bullet -@item -A bug was fixed which lead to the insertion of trailing whitespace -during filling. In particular extra spaces were added to sentence -endings at the end of lines. You can make this whitespace visible by -setting the variable @code{show-trailing-whitespace} to @code{t}. If -you want to delete all trailing whitespace in a buffer, type @kbd{M-x -delete-trailing-whitespace RET}. - -@item -A bug was fixed which lead to a @samp{*Compile-Log*} buffer popping up -when the first @LaTeX{} file was loaded in an Emacs session. - -@item -On some systems the presence of an outdated Emacspeak package lead to -the error message @samp{File mode specification error: (error "Variable -binding depth exceeds max-specpdl-size")}. Precautions were added which -prevent this error from happening. But nevertheless, it is advised to -upgrade or uninstall the outdated Emacspeak package. - -@item -The value of @code{TeX-macro-global} is not determined during -configuration anymore but at load time of @AUCTeX{}. Consequently the -associated configuration option @samp{--with-tex-input-dirs} was -removed. - -@item -Support for the @LaTeX{} Japanese classes @samp{jsarticle} and -@samp{jsbook} was added. -@end itemize - -@heading News in 11.54 - -@itemize @bullet -@item -The parser (used e.g. for @code{TeX-auto-generate-global}) was extended -to recognize keywords common in @LaTeX{} packages and classes, like -``\DeclareRobustCommand'' or ``\RequirePackage''. Additionally a bug -was fixed which led to duplicate entries in @AUCTeX{} style files. - -@item -Folding can now be done for paragraphs and regions besides single -constructs and the whole buffer. With the new @code{TeX-fold-dwim} -command content can both be hidden and shown with a single key binding. -In course of these changes new key bindings for unfolding commands where -introduced. The old bindings are still present but will be phased out -in future releases. - -@item -Info files of the manual now have a .info extension. - -@item -There is an experimental tool bar support now. It is not activated by -default. If you want to use it, add -@lisp -(add-hook 'LaTeX-mode-hook 'LaTeX-install-toolbar) -@end lisp -to your init file. - -@item -The manual now contains a new chapter ``Quick Start''. It explains the -main features and how to use them, and should be enough for a new user -to start using @AUCTeX{}. - -@item -A new section ``Font Locking'' was added to the manual which explains -syntax highlighting in @AUCTeX{} and its customization. Together with -the sections related to folding and outlining, the section is part of -the new chapter ``Display''. - -@item -Keywords for syntax highlighting of @LaTeX{} constructs to be typeset in -bold, italic or typewriter fonts may now be customized. Besides the -built-in classes, new keyword classes may be added by customizing the -variable @samp{font-latex-user-keyword-classes}. The customization -options can be found in the customization group -@samp{font-latex-keywords}. - -@item -Verbatim content is now displayed with the @samp{fixed-pitch} face. (GNU -Emacs only) - -@item -Syntax highlighting should not spill out of verbatim content -anymore. (GNU Emacs only) - -@item -Verbatim commands like @samp{\verb|...|} will not be broken anymore -during filling. - -@item -You can customize the completion for graphic files with -@code{LaTeX-includegraphics-read-file}. - -@item -Support for the @LaTeX{} packages @samp{url}, @samp{listings}, -@samp{jurabib} and @samp{csquotes} was added with regard to command -completion and syntax highlighting. - -@item -Performance of fontification and filling was improved. - -@item -Insertion of nodes in Texinfo mode now supports completion of existing -node names. - -@item -Setting the variable @code{LaTeX-float} to @code{nil} now means that you -will not be prompted for the float position of figures and tables. You -can get the old behaviour of @code{nil} by setting the variable to -@code{""}, i.e. an empty string. -@ifclear rawfile -See also @ref{Floats}. -@end ifclear - -@item -The XEmacs-specific bug concerning @code{overlays-at} was fixed. - -@item -Lots of bug fixes. -@end itemize - -@heading News in 11.53 - -@itemize @bullet -@item -The @LaTeX{} math menu can include Unicode characters if your Emacs -built supports it. See the variable -@ifset rawfile -@code{LaTeX-math-menu-unicode}. -@end ifset -@ifclear rawfile -@code{LaTeX-math-menu-unicode}, @ref{Mathematics}. -@end ifclear - -@item -Bug fixes for XEmacs. - -@c The following items weren't present at release time of 11.53: -@item -Completion for graphic files in the TeX search path has been added. - -@item -@command{start} is used for the viewer for MiK@TeX{} and fp@TeX{}. - -@item -The variable @code{TeX-fold-preserve-comments} can now be customized to -deactivate folding in comments. -@end itemize - -@heading News in 11.52 -@c Not present at release time of 11.52. - -@itemize @bullet -@item -Installation and menus under XEmacs work again (maybe for the first -time). - -@item -Fontification of subscripts and superscripts is now disabled when the -fontification engine is not able to support it properly. - -@item -Bug fixes in the build process. -@end itemize - -@heading News in 11.51 -@c Not present at release time of 11.51. - -@itemize @bullet -@item -PDFTeX and Source Special support did not work with ConTeXt, -this has been fixed. Similar for Source Special support under Windows. - -@item -Omega support has been added. - -@item -Bug fixes in the build process. - -@item -@code{TeX-fold} now supports folding of environments in Texinfo mode. -@end itemize - -@heading News in 11.50 - -@itemize @bullet -@item -The use of source specials when processing or viewing the document can -now be controlled with the new @code{TeX-source-specials} minor mode -which can be toggled via an entry in the Command menu or the key binding -@kbd{C-c C-t C-s}. If you have customized the variable -@code{TeX-command-list}, you have to re-initialize it for this to work. -This means to open a customization buffer for the variable by typing -@code{M-x customize-variable RET TeX-command-list RET}, selecting -``Erase Customization'' and do your customization again with the new -default. - -@item -The content of the command menu now depends on the mode (plain @TeX{}, -@LaTeX{}, @ConTeXt{} etc.). Any former customization of the variable -@code{TeX-command-list} has to be erased. Otherwise the command menu -and the customization will not work correctly. - -@item -Support for hiding and auto-revealing macros, e.g. footnotes or -citations, and environments in a buffer was -@ifset rawfile -added. -@end ifset -@ifclear rawfile -added, @ref{Folding}. -@end ifclear - -@item -You can now control if indentation is done upon typing @key{RET} by -customizing the variable -@ifset rawfile -@code{TeX-newline-function}. -@end ifset -@ifclear rawfile -@code{TeX-newline-function}, @ref{Indenting}. -@end ifclear - -@item -Limited support for @code{doc.sty} and @code{ltxdoc.cls} (@samp{dtx} -files) was added. The new doc@TeX{} mode provides functionality for -editing documentation parts. This includes formatting (indenting and -filling), adding and completion of macros and environments while staying -in comments as well as syntax highlighting. (Please note that the mode -is not finished yet. For example syntax highlighting does not work yet -in XEmacs.) - -@item -For macro completion in doc@TeX{} mode the @AUCTeX{} style files -@file{doc.el}, @file{ltxdoc.el} and @file{ltx-base.el} were included. -The latter provides general support for low-level @LaTeX{} macros and -may be used with @LaTeX{} class and style files as well. It is -currently not loaded automatically for those files. - -@item -Support for @ConTeXt{} with a separate @ConTeXt{} mode is now included. -Macro definitions for completion are available in Dutch and English. - -@item -The filling and indentation code was overhauled and is now able to -format commented parts of the source syntactically correct. Newly -available functionality and customization options are explained in the -manual. - -@item -Filling and indentation in XEmacs with preview-latex and activated -previews lead to the insertion of whitespace before multi-line previews. -@AUCTeX{} now contains facilities to prevent this problem. - -@item -If @code{TeX-master} is set to @code{t}, @AUCTeX{} will now query for a -master file only when a new file is opened. Existing files will be left -alone. The new function @code{TeX-master-file-ask} (bound to @kbd{C-c -_} is provided for adding the variable manually. - -@item -Sectioning commands are now shown in a larger font on display devices -which support such fontification. The variable -@code{font-latex-title-fontify} can be customized to restore the old -appearance, i.e. the usage of a different color instead of a change in -size. - -@item -Support for @code{alphanum.sty}, @code{beamer.cls}, @code{booktabs.sty}, -@code{captcont.sty}, @code{emp.sty}, @code{paralist.sty}, -@code{subfigure.sty} and @code{units.sty}/@code{nicefrac.sty} was added. -Credits go to the authors mentioned in the respective @AUCTeX{} style -files. - -@item -Inserting graphics with @kbd{C-c RET \includegraphics RET} was improved. -See the variable @code{LaTeX-includegraphics-options-alist}. -@c FIXME: Document this in the main part of the manual - -@item -If @code{LaTeX-default-position} is @code{nil}, don't prompt for -position arguments in Tabular-like -@ifset rawfile -environments. -@end ifset -@ifclear rawfile -environments, see @ref{Tabular-like}. -@end ifclear - -@item -Completion for available packages when using @kbd{C-c RET \usepackage -RET} was improved on systems using the kpathsea library. - -@item -The commenting functionality was fixed. The separate functions for -commenting and uncommenting were unified in one function for paragraphs -and regions respectively which do both. - -@item -Syntax highlighting can be customized to fontify quotes delimited by -either >>German<< or <> quotation marks by changing the variable -@code{font-latex-quotes}. - -@item -Certain @TeX{}/@LaTeX{} keywords for functions, references, variables -and warnings will now be fontified specially. You may add your own -keywords by customizing the variables -@code{font-latex-match-function-keywords}, -@code{font-latex-match-reference-keywords}, -@code{font-latex-match-variable-keywords} and -@code{font-latex-match-warning-keywords}. - -@item -If you include the style files @file{german} or @file{ngerman} in a -document (directly or via the @samp{babel} package), you should now -customize @code{LaTeX-german-open-quote}, -@code{LaTeX-german-close-quote} and -@code{LaTeX-german-quote-after-quote} instead of @code{TeX-open-quote}, -@code{TeX-close-quote} and @code{TeX-quote-after-quote} if you want to -influence the type of quote insertion. - -@item -Upon viewing an output file, the right viewer and command line options -for it are now determined automatically by looking at the extension of -the output file and certain options used in the source file. The -behavior can be adapted or extended respectively by customizing the -variable @code{TeX-output-view-style}. - -@item -You can control whether @code{TeX-insert-macro} (@kbd{C-c RET}) ask for -all optional arguments by customizing the variable -@ifset rawfile -@code{TeX-insert-macro-default-style}. -@end ifset -@ifclear rawfile -@code{TeX-insert-macro-default-style}, @ref{Completion}. -@end ifclear - -@item -@code{TeX-run-discard} is now able to completely detach a process that -it started. - -@item -The build process was enhanced and is now based on @code{autoconf} -making installing AUC@TeX{} a mostly automatic process. See -@ifset rawfile -the files @file{INSTALL} and @file{INSTALL.windows} -@end ifset -@ifclear rawfile -@ref{Installation} and @ref{Installation under MS Windows} -@end ifclear -for details. -@end itemize - -@heading News in 11.14 - -@itemize @bullet -@item -Many more LaTeX and LaTeX2e commands are supported. -Done by Masayuki Ataka -@end itemize - -@heading News in 11.12 - -@itemize @bullet -@item -Support for the KOMA-Script classes. -Contributed by Mark Trettin . -@end itemize - -@heading News in 11.11 - -@itemize @bullet -@item -Support for @file{prosper.sty}, see @url{http://prosper.sourceforge.net/}. -Contributed by Phillip Lord . -@end itemize - -@heading News in 11.10 - -@itemize @bullet -@item -@code{comment-region} now inserts @t{%%} by default. -Suggested by "Davide G. M. Salvetti" . -@end itemize - -@heading News in 11.06 - -@itemize @bullet -@item -You can now switch between using the @file{font-latex} (all emacsen), -the @file{tex-font} (Emacs 21 only) or no special package for font -locking. Customize @code{TeX-install-font-lock} for this. -@end itemize - -@heading News in 11.04 - -@itemize @bullet -@item -Now use @t{-t landscape} by default when landscape option appears. -Suggested by Erik Frisk . -@end itemize - -@heading News in 11.03 - -@itemize @bullet -@item -Use @file{tex-fptex.el} for fpTeX support. -Contributed by Fabrice Popineau . -@end itemize - -@heading News in 11.02 - -@itemize @bullet -@item -New user option @code{LaTeX-top-caption-list} specifies environments -where the caption should go at top. -Contributed by ataka@@milk.freemail.ne.jp (Masayuki Ataka). - -@item -Allow explicit dimensions in @file{graphicx.sty}. -Contributed by ataka@@milk.freemail.ne.jp (Masayuki Ataka). - -@item -Limited support for @file{verbatim.sty}. -Contributed by ataka@@milk.freemail.ne.jp (Masayuki Ataka). - -@item -Better support for asmmath items. -Patch by ataka@@milk.freemail.ne.jp (Masayuki Ataka). - -@item -More accurate error parsing. -Added by David Kastrup . -@end itemize - -@heading News in 11.01 - -@itemize @bullet -@item -Bug fixes. -@end itemize diff --git a/packages/auctex/doc/copying.texi b/packages/auctex/doc/copying.texi deleted file mode 100644 index b273df136..000000000 --- a/packages/auctex/doc/copying.texi +++ /dev/null @@ -1,48 +0,0 @@ -@include macros.texi -@c ----------------------- -@cindex Copying -@cindex Copyright -@cindex GPL -@cindex General Public License -@cindex License -@c @cindex Free -@c @cindex Free software -@c @cindex Distribution -@c @cindex Right -@cindex Warranty - -(This text is stolen from the Texinfo manual, Edition 4.0). - -The programs currently being distributed that relate to @previewlatex{} -include lisp files for Emacs and style files for @LaTeX{}. These -programs are @dfn{free}; this means that everyone is free to use them -and free to redistribute them on a free basis. The @previewlatex{} -related programs are not in the public domain; they are copyrighted and -there are restrictions on their distribution, but these restrictions are -designed to permit everything that a good cooperating citizen would want -to do. What is not allowed is to try to prevent others from further -sharing any version of these programs that they might get from you. - -Specifically, we want to make sure that you have the right to give away -copies of the programs that relate to @previewlatex{}, that you receive -source code or else can get it if you want it, that you can change these -programs or use pieces of them in new free programs, and that you know -you can do these things. - -To make sure that everyone has such rights, we have to forbid you to -deprive anyone else of these rights. For example, if you distribute -copies of the @previewlatex{} related programs, you must give the -recipients all the rights that you have. You must make sure that they, -too, receive or can get the source code. And you must tell them their -rights. - -Also, for our own protection, we must make certain that everyone finds -out that there is no warranty for the programs that relate to -@previewlatex{}. If these programs are modified by someone else and -passed on, we want their recipients to know that what they have is not -what we distributed, so that any problems introduced by others will not -reflect on our reputation. - -The precise conditions of the licenses for the programs currently being -distributed that relate to @previewlatex{} are found in the General Public -Licenses that accompany them. diff --git a/packages/auctex/doc/faq.texi b/packages/auctex/doc/faq.texi deleted file mode 100644 index 60484325d..000000000 --- a/packages/auctex/doc/faq.texi +++ /dev/null @@ -1,148 +0,0 @@ -@ifset rawfile -@include macros.texi -@chapheading Frequently Asked Questions about @AUCTeX{} -@end ifset - -@c We should switch to sectioning commands instead of items when this -@c list grows. Keep in mind to formulate short questions because -@c section headings will not be broken in contrast to items. -@enumerate -@item -Something is not working correctly. What should I do? - -Well, you might have guessed it, the first place to look is in the -available documentation packaged with @AUCTeX{}. This could be the -release notes (in the @file{RELEASE} file) or the news section of the -manual in case you are experiencing problems after an upgrade, the -@file{INSTALL} file in case you are having problems with the -installation, the section about bugs in the manual in case you -encountered a bug or the relevant sections in the manual for other -related problems. - -If this did not help, you can send a bug report to the @AUCTeX{} bug -reporting list by using the command @kbd{M-x TeX-submit-bug-report RET}. -But before you do this, you can try to get more information about the -problem at hand which might also help you locate the cause of the error -yourself. - -First, you can try to generate a so-called backtrace which shows -functions involved in a program error. In order to do this, start Emacs -with the command line @samp{emacs --debug-init} and/or put the line - -@lisp -(setq debug-on-error t) -@end lisp - -as the first line into your init file. XEmacs users might want to add -@code{(setq stack-trace-on-error t)} as well. After Emacs has started, -you can load a file which triggers the error and a new window should pop -up showing the backtrace. If you get such a backtrace, please include -it in the bug report. - -Second, you can try to figure out if something in your personal or site -configuration triggers the error by starting Emacs without such -customizations. You can do this by invoking Emacs with the command line -@samp{emacs -q -no-site-file}. Once Emacs is running, copy the line - -@lisp -(load "auctex.el" nil t t) -@end lisp - -into the @samp{*scratch*} buffer and type @kbd{M-x eval-buffer RET}. -This makes sure that @AUCTeX{} will be used for the file types it -supports. After you have done so, you can load the file triggering the -error. If everything is working now, you know that you have to search -either in the site configuration file or your personal init file for -statements related to the problem. - -@item -What versions of Emacs and XEmacs are supported? - -@AUCTeX{} was tested with @w{Emacs 21} and @w{XEmacs 21.4.15}. Older -versions may work but are unsupported. Older versions of XEmacs might -possibly made to work by updating the @file{xemacs-base} package through -the XEmacs package system. If you are looking for a recommendation, it -would appear that the smoothest working platform on all operating -systems at the current point of time would be @w{Emacs 22.1}. At the -time of this writing, however, it has not been released and is still -under development. The quality of the development version is quite -solid, so we recommend giving it a try. With a developer version, of -course, you have to be prepared to update in case you managed to get -your snapshot at a bad time. The second best choice would be the latest -released @w{Emacs 21.4}. However, Unicode support is less good, there -is no version for the popular GTK toolkit, and the native versions for -Windows and MacOS don't offer toolbar and @previewlatex{} support. - -Our success with XEmacs has been less than convincing. Under the -Windows operating system, nominally the only option for a released, -stable Emacs variant supporting toolbars and @previewlatex{} would be -@w{XEmacs 21.4}. However, code for core functionality like formatting -and syntax highlighting tends to be different and often older than even -@w{Emacs 21.4}, and Unicode support as delivered is problematic at best, -missing on Windows. Both @AUCTeX{} and XEmacs developers don't hear -much from active users of the combination. Partly for that reason, -problems tend to go unnoticed for long amounts of time and are often -found, if at all, after releases. No experiences or recommendations can -be given for beta or developer versions of XEmacs. - -@item -What should I do when @code{./configure} does not find programs like latex? - -This is problem often encountered on Windows. Make sure that the -@env{PATH} environment variable includes the directories containing the -relevant programs, as described in -@ifset rawfile -the file @file{INSTALL.windows} -@end ifset -@ifclear rawfile -@ref{Installation under MS Windows,,,auctex,the @AUCTeX{} manual}. -@end ifclear - -@item -Why doesn't the completion, style file, or multi-file stuff work? - -It must be enabled first, insert this in your init file: - -@lisp -(setq-default TeX-master nil) -(setq TeX-parse-self t) -(setq TeX-auto-save t) -@end lisp - -Read also the chapters about parsing and multifile documents in the -manual. - -@item -Why doesn't @code{TeX-save-document} work? - -@code{TeX-check-path} has to contain "./" somewhere. - -@item -Why is the information in @file{foo.tex} forgotten when I save -@file{foo.bib}? - -For various reasons, @AUCTeX{} ignores the extension when it stores -information about a file, so you should use unique base names for your -files. E.g. rename @file{foo.bib} to @file{foob.bib}. - -@item -Why doesn't @AUCTeX{} signal when processing a document is done? - -If the message in the minibuffer stays "Type `C-c C-l' to display -results of compilation.", you probably have a misconfiguration in your -init file (@file{.emacs}, @file{init.el} or similar). To track this -down either search in the @samp{*Messages*} buffer for an error message -or put @code{(setq debug-on-error t)} as the first line into your init -file, restart Emacs and open a @LaTeX{} file. Emacs will complain -loudly by opening a debugging buffer as soon as an error occurs. The -information in the debugging buffer can help you find the cause of the -error in your init file. - -@item -What does AUC stand for? - -@AUCTeX{} came into being at Aalborg University in Denmark. Back then -the Danish name of the university was Aalborg Universitetscenter; AUC -for short. - -@end enumerate diff --git a/packages/auctex/doc/fdl.texi b/packages/auctex/doc/fdl.texi deleted file mode 100644 index ca185626b..000000000 --- a/packages/auctex/doc/fdl.texi +++ /dev/null @@ -1,506 +0,0 @@ -@node GNU Free Documentation License -@appendixsec GNU Free Documentation License - -@cindex FDL, GNU Free Documentation License -@center Version 1.3, 3 November 2008 - -@display -Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software -Foundation, Inc. @uref{http://fsf.org/} - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. -@end display - -@enumerate 0 -@item -PREAMBLE - -The purpose of this License is to make a manual, textbook, or other -functional and useful document @dfn{free} in the sense of freedom: to -assure everyone the effective freedom to copy and redistribute it, -with or without modifying it, either commercially or noncommercially. -Secondarily, this License preserves for the author and publisher a way -to get credit for their work, while not being considered responsible -for modifications made by others. - -This License is a kind of ``copyleft'', which means that derivative -works of the document must themselves be free in the same sense. It -complements the GNU General Public License, which is a copyleft -license designed for free software. - -We have designed this License in order to use it for manuals for free -software, because free software needs free documentation: a free -program should come with manuals providing the same freedoms that the -software does. But this License is not limited to software manuals; -it can be used for any textual work, regardless of subject matter or -whether it is published as a printed book. We recommend this License -principally for works whose purpose is instruction or reference. - -@item -APPLICABILITY AND DEFINITIONS - -This License applies to any manual or other work, in any medium, that -contains a notice placed by the copyright holder saying it can be -distributed under the terms of this License. Such a notice grants a -world-wide, royalty-free license, unlimited in duration, to use that -work under the conditions stated herein. The ``Document'', below, -refers to any such manual or work. Any member of the public is a -licensee, and is addressed as ``you''. You accept the license if you -copy, modify or distribute the work in a way requiring permission -under copyright law. - -A ``Modified Version'' of the Document means any work containing the -Document or a portion of it, either copied verbatim, or with -modifications and/or translated into another language. - -A ``Secondary Section'' is a named appendix or a front-matter section -of the Document that deals exclusively with the relationship of the -publishers or authors of the Document to the Document's overall -subject (or to related matters) and contains nothing that could fall -directly within that overall subject. (Thus, if the Document is in -part a textbook of mathematics, a Secondary Section may not explain -any mathematics.) The relationship could be a matter of historical -connection with the subject or with related matters, or of legal, -commercial, philosophical, ethical or political position regarding -them. - -The ``Invariant Sections'' are certain Secondary Sections whose titles -are designated, as being those of Invariant Sections, in the notice -that says that the Document is released under this License. If a -section does not fit the above definition of Secondary then it is not -allowed to be designated as Invariant. The Document may contain zero -Invariant Sections. If the Document does not identify any Invariant -Sections then there are none. - -The ``Cover Texts'' are certain short passages of text that are listed, -as Front-Cover Texts or Back-Cover Texts, in the notice that says that -the Document is released under this License. A Front-Cover Text may -be at most 5 words, and a Back-Cover Text may be at most 25 words. - -A ``Transparent'' copy of the Document means a machine-readable copy, -represented in a format whose specification is available to the -general public, that is suitable for revising the document -straightforwardly with generic text editors or (for images composed of -pixels) generic paint programs or (for drawings) some widely available -drawing editor, and that is suitable for input to text formatters or -for automatic translation to a variety of formats suitable for input -to text formatters. A copy made in an otherwise Transparent file -format whose markup, or absence of markup, has been arranged to thwart -or discourage subsequent modification by readers is not Transparent. -An image format is not Transparent if used for any substantial amount -of text. A copy that is not ``Transparent'' is called ``Opaque''. - -Examples of suitable formats for Transparent copies include plain -@sc{ascii} without markup, Texinfo input format, La@TeX{} input -format, @acronym{SGML} or @acronym{XML} using a publicly available -@acronym{DTD}, and standard-conforming simple @acronym{HTML}, -PostScript or @acronym{PDF} designed for human modification. Examples -of transparent image formats include @acronym{PNG}, @acronym{XCF} and -@acronym{JPG}. Opaque formats include proprietary formats that can be -read and edited only by proprietary word processors, @acronym{SGML} or -@acronym{XML} for which the @acronym{DTD} and/or processing tools are -not generally available, and the machine-generated @acronym{HTML}, -PostScript or @acronym{PDF} produced by some word processors for -output purposes only. - -The ``Title Page'' means, for a printed book, the title page itself, -plus such following pages as are needed to hold, legibly, the material -this License requires to appear in the title page. For works in -formats which do not have any title page as such, ``Title Page'' means -the text near the most prominent appearance of the work's title, -preceding the beginning of the body of the text. - -The ``publisher'' means any person or entity that distributes copies -of the Document to the public. - -A section ``Entitled XYZ'' means a named subunit of the Document whose -title either is precisely XYZ or contains XYZ in parentheses following -text that translates XYZ in another language. (Here XYZ stands for a -specific section name mentioned below, such as ``Acknowledgements'', -``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title'' -of such a section when you modify the Document means that it remains a -section ``Entitled XYZ'' according to this definition. - -The Document may include Warranty Disclaimers next to the notice which -states that this License applies to the Document. These Warranty -Disclaimers are considered to be included by reference in this -License, but only as regards disclaiming warranties: any other -implication that these Warranty Disclaimers may have is void and has -no effect on the meaning of this License. - -@item -VERBATIM COPYING - -You may copy and distribute the Document in any medium, either -commercially or noncommercially, provided that this License, the -copyright notices, and the license notice saying this License applies -to the Document are reproduced in all copies, and that you add no other -conditions whatsoever to those of this License. You may not use -technical measures to obstruct or control the reading or further -copying of the copies you make or distribute. However, you may accept -compensation in exchange for copies. If you distribute a large enough -number of copies you must also follow the conditions in section 3. - -You may also lend copies, under the same conditions stated above, and -you may publicly display copies. - -@item -COPYING IN QUANTITY - -If you publish printed copies (or copies in media that commonly have -printed covers) of the Document, numbering more than 100, and the -Document's license notice requires Cover Texts, you must enclose the -copies in covers that carry, clearly and legibly, all these Cover -Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on -the back cover. Both covers must also clearly and legibly identify -you as the publisher of these copies. The front cover must present -the full title with all words of the title equally prominent and -visible. You may add other material on the covers in addition. -Copying with changes limited to the covers, as long as they preserve -the title of the Document and satisfy these conditions, can be treated -as verbatim copying in other respects. - -If the required texts for either cover are too voluminous to fit -legibly, you should put the first ones listed (as many as fit -reasonably) on the actual cover, and continue the rest onto adjacent -pages. - -If you publish or distribute Opaque copies of the Document numbering -more than 100, you must either include a machine-readable Transparent -copy along with each Opaque copy, or state in or with each Opaque copy -a computer-network location from which the general network-using -public has access to download using public-standard network protocols -a complete Transparent copy of the Document, free of added material. -If you use the latter option, you must take reasonably prudent steps, -when you begin distribution of Opaque copies in quantity, to ensure -that this Transparent copy will remain thus accessible at the stated -location until at least one year after the last time you distribute an -Opaque copy (directly or through your agents or retailers) of that -edition to the public. - -It is requested, but not required, that you contact the authors of the -Document well before redistributing any large number of copies, to give -them a chance to provide you with an updated version of the Document. - -@item -MODIFICATIONS - -You may copy and distribute a Modified Version of the Document under -the conditions of sections 2 and 3 above, provided that you release -the Modified Version under precisely this License, with the Modified -Version filling the role of the Document, thus licensing distribution -and modification of the Modified Version to whoever possesses a copy -of it. In addition, you must do these things in the Modified Version: - -@enumerate A -@item -Use in the Title Page (and on the covers, if any) a title distinct -from that of the Document, and from those of previous versions -(which should, if there were any, be listed in the History section -of the Document). You may use the same title as a previous version -if the original publisher of that version gives permission. - -@item -List on the Title Page, as authors, one or more persons or entities -responsible for authorship of the modifications in the Modified -Version, together with at least five of the principal authors of the -Document (all of its principal authors, if it has fewer than five), -unless they release you from this requirement. - -@item -State on the Title page the name of the publisher of the -Modified Version, as the publisher. - -@item -Preserve all the copyright notices of the Document. - -@item -Add an appropriate copyright notice for your modifications -adjacent to the other copyright notices. - -@item -Include, immediately after the copyright notices, a license notice -giving the public permission to use the Modified Version under the -terms of this License, in the form shown in the Addendum below. - -@item -Preserve in that license notice the full lists of Invariant Sections -and required Cover Texts given in the Document's license notice. - -@item -Include an unaltered copy of this License. - -@item -Preserve the section Entitled ``History'', Preserve its Title, and add -to it an item stating at least the title, year, new authors, and -publisher of the Modified Version as given on the Title Page. If -there is no section Entitled ``History'' in the Document, create one -stating the title, year, authors, and publisher of the Document as -given on its Title Page, then add an item describing the Modified -Version as stated in the previous sentence. - -@item -Preserve the network location, if any, given in the Document for -public access to a Transparent copy of the Document, and likewise -the network locations given in the Document for previous versions -it was based on. These may be placed in the ``History'' section. -You may omit a network location for a work that was published at -least four years before the Document itself, or if the original -publisher of the version it refers to gives permission. - -@item -For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve -the Title of the section, and preserve in the section all the -substance and tone of each of the contributor acknowledgements and/or -dedications given therein. - -@item -Preserve all the Invariant Sections of the Document, -unaltered in their text and in their titles. Section numbers -or the equivalent are not considered part of the section titles. - -@item -Delete any section Entitled ``Endorsements''. Such a section -may not be included in the Modified Version. - -@item -Do not retitle any existing section to be Entitled ``Endorsements'' or -to conflict in title with any Invariant Section. - -@item -Preserve any Warranty Disclaimers. -@end enumerate - -If the Modified Version includes new front-matter sections or -appendices that qualify as Secondary Sections and contain no material -copied from the Document, you may at your option designate some or all -of these sections as invariant. To do this, add their titles to the -list of Invariant Sections in the Modified Version's license notice. -These titles must be distinct from any other section titles. - -You may add a section Entitled ``Endorsements'', provided it contains -nothing but endorsements of your Modified Version by various -parties---for example, statements of peer review or that the text has -been approved by an organization as the authoritative definition of a -standard. - -You may add a passage of up to five words as a Front-Cover Text, and a -passage of up to 25 words as a Back-Cover Text, to the end of the list -of Cover Texts in the Modified Version. Only one passage of -Front-Cover Text and one of Back-Cover Text may be added by (or -through arrangements made by) any one entity. If the Document already -includes a cover text for the same cover, previously added by you or -by arrangement made by the same entity you are acting on behalf of, -you may not add another; but you may replace the old one, on explicit -permission from the previous publisher that added the old one. - -The author(s) and publisher(s) of the Document do not by this License -give permission to use their names for publicity for or to assert or -imply endorsement of any Modified Version. - -@item -COMBINING DOCUMENTS - -You may combine the Document with other documents released under this -License, under the terms defined in section 4 above for modified -versions, provided that you include in the combination all of the -Invariant Sections of all of the original documents, unmodified, and -list them all as Invariant Sections of your combined work in its -license notice, and that you preserve all their Warranty Disclaimers. - -The combined work need only contain one copy of this License, and -multiple identical Invariant Sections may be replaced with a single -copy. If there are multiple Invariant Sections with the same name but -different contents, make the title of each such section unique by -adding at the end of it, in parentheses, the name of the original -author or publisher of that section if known, or else a unique number. -Make the same adjustment to the section titles in the list of -Invariant Sections in the license notice of the combined work. - -In the combination, you must combine any sections Entitled ``History'' -in the various original documents, forming one section Entitled -``History''; likewise combine any sections Entitled ``Acknowledgements'', -and any sections Entitled ``Dedications''. You must delete all -sections Entitled ``Endorsements.'' - -@item -COLLECTIONS OF DOCUMENTS - -You may make a collection consisting of the Document and other documents -released under this License, and replace the individual copies of this -License in the various documents with a single copy that is included in -the collection, provided that you follow the rules of this License for -verbatim copying of each of the documents in all other respects. - -You may extract a single document from such a collection, and distribute -it individually under this License, provided you insert a copy of this -License into the extracted document, and follow this License in all -other respects regarding verbatim copying of that document. - -@item -AGGREGATION WITH INDEPENDENT WORKS - -A compilation of the Document or its derivatives with other separate -and independent documents or works, in or on a volume of a storage or -distribution medium, is called an ``aggregate'' if the copyright -resulting from the compilation is not used to limit the legal rights -of the compilation's users beyond what the individual works permit. -When the Document is included in an aggregate, this License does not -apply to the other works in the aggregate which are not themselves -derivative works of the Document. - -If the Cover Text requirement of section 3 is applicable to these -copies of the Document, then if the Document is less than one half of -the entire aggregate, the Document's Cover Texts may be placed on -covers that bracket the Document within the aggregate, or the -electronic equivalent of covers if the Document is in electronic form. -Otherwise they must appear on printed covers that bracket the whole -aggregate. - -@item -TRANSLATION - -Translation is considered a kind of modification, so you may -distribute translations of the Document under the terms of section 4. -Replacing Invariant Sections with translations requires special -permission from their copyright holders, but you may include -translations of some or all Invariant Sections in addition to the -original versions of these Invariant Sections. You may include a -translation of this License, and all the license notices in the -Document, and any Warranty Disclaimers, provided that you also include -the original English version of this License and the original versions -of those notices and disclaimers. In case of a disagreement between -the translation and the original version of this License or a notice -or disclaimer, the original version will prevail. - -If a section in the Document is Entitled ``Acknowledgements'', -``Dedications'', or ``History'', the requirement (section 4) to Preserve -its Title (section 1) will typically require changing the actual -title. - -@item -TERMINATION - -You may not copy, modify, sublicense, or distribute the Document -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense, or distribute it is void, and -will automatically terminate your rights under this License. - -However, if you cease all violation of this License, then your license -from a particular copyright holder is reinstated (a) provisionally, -unless and until the copyright holder explicitly and finally -terminates your license, and (b) permanently, if the copyright holder -fails to notify you of the violation by some reasonable means prior to -60 days after the cessation. - -Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - -Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, receipt of a copy of some or all of the same material does -not give you any rights to use it. - -@item -FUTURE REVISIONS OF THIS LICENSE - -The Free Software Foundation may publish new, revised versions -of the GNU Free Documentation License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. See -@uref{http://www.gnu.org/copyleft/}. - -Each version of the License is given a distinguishing version number. -If the Document specifies that a particular numbered version of this -License ``or any later version'' applies to it, you have the option of -following the terms and conditions either of that specified version or -of any later version that has been published (not as a draft) by the -Free Software Foundation. If the Document does not specify a version -number of this License, you may choose any version ever published (not -as a draft) by the Free Software Foundation. If the Document -specifies that a proxy can decide which future versions of this -License can be used, that proxy's public statement of acceptance of a -version permanently authorizes you to choose that version for the -Document. - -@item -RELICENSING - -``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any -World Wide Web server that publishes copyrightable works and also -provides prominent facilities for anybody to edit those works. A -public wiki that anybody can edit is an example of such a server. A -``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the -site means any set of copyrightable works thus published on the MMC -site. - -``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0 -license published by Creative Commons Corporation, a not-for-profit -corporation with a principal place of business in San Francisco, -California, as well as future copyleft versions of that license -published by that same organization. - -``Incorporate'' means to publish or republish a Document, in whole or -in part, as part of another Document. - -An MMC is ``eligible for relicensing'' if it is licensed under this -License, and if all works that were first published under this License -somewhere other than this MMC, and subsequently incorporated in whole -or in part into the MMC, (1) had no cover texts or invariant sections, -and (2) were thus incorporated prior to November 1, 2008. - -The operator of an MMC Site may republish an MMC contained in the site -under CC-BY-SA on the same site at any time before August 1, 2009, -provided the MMC is eligible for relicensing. - -@end enumerate - -@page -@heading ADDENDUM: How to use this License for your documents - -To use this License in a document you have written, include a copy of -the License in the document and put the following copyright and -license notices just after the title page: - -@smallexample -@group - Copyright (C) @var{year} @var{your name}. - Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU Free Documentation License, Version 1.3 - or any later version published by the Free Software Foundation; - with no Invariant Sections, no Front-Cover Texts, and no Back-Cover - Texts. A copy of the license is included in the section entitled ``GNU - Free Documentation License''. -@end group -@end smallexample - -If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, -replace the ``with@dots{}Texts.'' line with this: - -@smallexample -@group - with the Invariant Sections being @var{list their titles}, with - the Front-Cover Texts being @var{list}, and with the Back-Cover Texts - being @var{list}. -@end group -@end smallexample - -If you have Invariant Sections without Cover Texts, or some other -combination of the three, merge those two alternatives to suit the -situation. - -If your document contains nontrivial examples of program code, we -recommend releasing these examples in parallel under your choice of -free software license, such as the GNU General Public License, -to permit their use in free software. - -@c Local Variables: -@c ispell-local-pdict: "ispell-dict" -@c End: - diff --git a/packages/auctex/doc/history.texi b/packages/auctex/doc/history.texi deleted file mode 100644 index 0595bb651..000000000 --- a/packages/auctex/doc/history.texi +++ /dev/null @@ -1,1918 +0,0 @@ -@include macros.texi -@section News in 10.0 - -@itemize @bullet - -@item -Disabled @code{LaTeX-hide-environment}. -Suggested by Christopher Allen . - -@item -Changed default to lazy evaluation of @code{TeX-view-style} and -@code{LaTeX-command-style}. -Suggested by Peter Neergaard . - -@item -Backindent when brace is at the start of a line. -Patch by Masashi Shimbo . - -@item -Added Emacs 21 font lock support. - -@item -@kbd{,} and @kbd{.} no longer removes italic correction. - -@item -@code{graphicx} and @code{graphics} style support. -Donated by Ryuichi Arafune . - -@item -@code{LaTeX-math-abbrev-prefix} now accepts vector value. -Reported by Jan Vroonhof . - -@item -Improved Texinfo support(more environments and html). -Patch by Akim Demaille . - -@item -@code{danish} quotes support. -Suggested by arne@@daimi.au.dk (Arne Joergensen). - -@item -Some PDF support. - -@item -New @file{tex-mik.el} file for MiK@TeX{} support. - -@item -Some commands now have their own history. -Suggested by Werner LEMBERG . - -@item -Use @code{\centering} instead of center environment in figures. -Patch by Stefan Monnier . - -@item -New @code{dwim} setting for @code{TeX-master} attempts to guess -a default master for new files. -Patch by Stefan Monnier . - -@item -@code{ngerman} style support. -Just a copy of the german style support. - -@item -Removed support for Emacs 18 and 19. - -@item @code{mdwlist} support. -Patch by Stephen Heilbronner . - -@item -Fixed various bugs with the babel package. - -@item @code{amsart} and @code{amsbook} now loads @code{amsthm} by default. -Patch by Rune Kleveland . - -@item Fixed bug with file searching. -Reported by Berwin Turlach . - -@item Finalized index support, added index-related style files. -Patch by Carsten Dominik . - -@item New style files for @file{varioref.sty} and @file{fancyref.sty}. -Patch by Carsten Dominik . - -@item @code{texmathp} recognizes additional macros like @code{\fbox}. -Patch by Ulrik Vieth . - -@end itemize - -@section News in 9.9 - -@itemize @bullet -@item Bug fix in JLATEX recognition. Patch by -Tsutomu OKUMURA . - -@item Bug fix in foils package sypport. -Suggested by Bernt Guldbrandtsen . - -@item Made @code{make install-contrib} compile the contributed lisp -files. -Suggested by Nils Ackermann . - -@item In @code{texinfo-mode}, @kbd{C-c C-f C-d} now deletes the current -font, while @kbd{C-u C-c C-f @var{key}} changes it. @samp{@@dfn} moved -to @kbd{C-c C-f d}. Suggested by Christoph Wedler -. - -@item Fixed some custom types. -Patch by Markus Rost . - -@item Support loading byte compiled files, even if -@code{TeX-byte-compile} is nil. -Patch by Christoph Wedler . - -@item The command to replace a LaTeX2e font should work more reliably -now. Patch by Christoph Wedler . - -@item Minor XEmacs packaging changes. -Patch by Christoph Wedler . - -@item @code{TeX-file-recurse} now accepts an integer value, max depth of -recursion. Patch by Alastair Burt . - -@item Simple imenu support for @LaTeX{}. - -@item Workaround for 20.3 bugs. - -@item The `Spell' command now works on all open buffers in the -document. Patch by Jason Stewart . - -@item @kbd{C-c C-m} now puts content of region inside first empty brackets -in the macro, if any. Patch by Peter Thiemann . - -@item Update of @file{natbib.el} style file by Carsten Dominik -. - -@item Much better detection of @TeX{} math mode. Patch by Carsten Dominik -. - -@item New @samp{%n} escape in @code{TeX-command-list} for entering the -current line number. Suggested by "Lee, Sang-Min" -. - -@item Doc fixes in manual. Patch by Gustavo Chaves -. - -@item Better reftex support for sections. Patch by Carsten Dominik -. - -@item Bug fixes in math card. Reported by "Ron Smith" -. - -@item Better multifile support. Patch by Soren Dayton -. - -@item Don't expand abbreviations when @code{abbrev-mode} is nil. -Suggested by Alastair Burt . - -@item @samp{direntry} support in manual, by SL Baur -. -@end itemize - -@section News in 9.8 - -@itemize @bullet -@item Added @code{natbib.el} to support natbib.sty by Patrick W. Daly. -Submitted by Berwin A. Turlach @samp{}. - -@item -More @LaTeX{}2e support by Jan Vroonhof -@samp{}.@refill - -@item Make @code{TeX-master} a local variable in Bib@TeX{} mode and set -it to true. This seems to be necessary to enable auto-parsing of a .bib -file. Patch by Berwin A. Turlach @samp{}. - -@item Support for Harvard style updated by Berwin A. Turlach -@samp{}. - -@item -Support for `natbib' package. -By Berwin Turlach @samp{}. - -@item -Finer control of automatic parsing of @TeX{} files: new variables -@code{TeX-auto-x-parse-length} and @code{TeX-auto-x-regexp-list}. -By Christoph Wedler @samp{}. - -@item -Finer control of indentation: new variables @code{LaTeX-document-regexp}, -@code{LaTeX-verbatim-regexp}, @code{LaTeX-begin-regexp}, -@code{LaTeX-end-regexp} and @code{LaTeX-indent-comment-start-regexp}. -By Christoph Wedler @samp{}. - -@item -When running @LaTeX{} on a region, do not complain about undefined -citations. See variable @code{TeX-region-extra}. -By Christoph Wedler @samp{}. - -@item -Split menu for LaTeX environments into submenus if number of -environments is larger than the value of the new variable -@code{LaTeX-menu-max-items}. -By Christoph Wedler @samp{}. - -@item -More reftex support with new @code{TeX-arg-ref} function. -By Soren Dayton @samp{}, with @file{amsmath} -support by Carsten Dominik @samp{}. - -@item -Minimal parser now recognize @code{usepackage}. -By Carsten Dominik @samp{}. - -@item -More amstex styles recognized. -By Carsten Dominik @samp{}. - -@item -Czech and Slovak support. -By Milan Zamazal @samp{}. - -@end itemize - - -@section News in 9.7 - -@itemize @bullet -@item -Added support for customize. - -@item -Added minimal support for @code{sentence-end-double-space}. - -@end itemize - -@section News in 9.6 - -@itemize @bullet -@item -NT installation instructions added. - -@item -@file{func-doc.el} unbundled, as @file{word-help.el} will be added to -the standard Emacs distribution. See @url{http://www.ifi.uio.no/~jensthi/}. - -@item -@samp{$} is now of the syntax class `matched pair', suggested by Mats -Bengtsson @samp{}. - -@item -Now use @kbd{,} to enter multiple arguments to a @samp{\cite} or -@samp{\bibliography} command instead of @kbd{@key{ret}}. - -@item -Installation procedure is changed, read the @file{INSTALLATION} file. - -@item -LaCheck is unbundled. You can get @code{lacheck} from -@file{} or alternatively -@code{chktex} from -@file{}. Search for -`chktex' in @file{tex.el} to see how to switch between them.@refill - -@item -Insert @code{(require 'font-latex)} to get better font lock support. - -@item -Bug fixes. - -@item -Better handling of subdirectories, suggested by Frederic Devernay -@samp{} and many others. -@end itemize - -@section News in 9.5 - -@itemize @bullet -@item Use the @file{func-doc.el} package to get context senstive help. -This is not autoloaded, you must load it explicitly with: - -@lisp -(require 'func-doc) -@end lisp - -@item -Bug fixes. - -@end itemize - -@section News in 9.4 - -@itemize @bullet -@item There is now a menu in @code{LaTeX-math-minor-mode}. - -@item -Bug fixes. -@end itemize - -@section News in 9.3 - -@itemize @bullet -@item -Bug fixes. -@end itemize - -@section News in 9.2 - -@itemize @bullet -@item -Bug fixes. - -@item -New file @file{bib-cite.el} contributed by Peter S. Galbraith -@samp{}. This file is not installed -or enabled by default and is not part of the basic AUC @TeX{} -package. If you have problems, questions, or suggestions, please direct -them to Peter. - -@item -New file @file{hilit-LaTeX.el} contributed by Peter S. Galbraith -@samp{}. This file is not installed -or enabled by default and is not part of the basic AUC @TeX{} -package. If you have problems, questions, or suggestions, please direct -them to Peter. - -@item -AUC @TeX{} is now less likely to suggest running Bib@TeX{} when it is -not needed. - -@item -Press @kbd{M-x LaTeX-209-to-2e @key{ret}} to make a stab at converting a -@LaTeX{} 2.09 header to @LaTeX{}2e. - -@item -@kbd{C-c C-m input @key{ret}} should be faster now on second try. - -@item -New variable @code{LaTeX-left-right-indent-level} controls the -indentation added by @samp{\left}. - -@item -@samp{\begin}, @samp{\end}, @samp{\left}, and @samp{\right} no longer -need to be at the beginning of the line to take effect. - -@item -You can now delete and replace @LaTeX{}2e style fonts. - -@item -Moved external commands to new menu. - -@item -@kbd{C-c C-m cite @key{ret}} will prompt for multiple keys. - -@item -Better handling of @samp{"} with @file{german.sty}. - -@item -New variable @code{LaTeX-paragraph-commands} lists @LaTeX{} commands -that shouldn't be formatted as part of a paragraph. - -@item -Older news moved to @file{HISTORY}. It is not @TeX{}info able, but you -can get a plaintext version with @samp{make HISTORY}. - -@item -See the new @file{ChangeLog} file for a more detailed list of changes. -The history section will now only contain user level changes. If you -send me a patch, please also provide a ChangeLog entry. -@end itemize - -@node Version 9.1 -@section News in 9.1 - -Coordinater: Per Abrahamsen, 1994. - -Alpha testers (in order of appearance): -Bernt Guldbrandtsen @samp{}, -Kevin Scott @samp{}, -Lawrence R. Dodd @samp{}, -Michelangelo Grigni @samp{}, -David Aspinall @samp{}, -Frederic Devernay @samp{}, -Robert Estes @samp{}, -Peter Whaite @samp{}, -Karl Eichwalder @samp{}, -John Interrante @samp{}, -James A. Robinson @samp{}, -Tim Carlson @samp{}, -Michelangelo Grigni @samp{}, -Manoj Srivastava @samp{}, -Richard Stanton @samp{}, -Kobayashi Shinji @samp{}, -and probably more.@refill - -@itemize @bullet -@item -@LaTeX{}2e is now default. Set @code{LaTeX-version} to @samp{"2"} to -disable this. - -@item -Better handling of @samp{*TeX background*} buffer. Suggested by John -Interrante @samp{}. - -@item -Parser did not recognise the use of @samp{\def} to create @LaTeX{} -environments. Reported by Frederic Devernay -@samp{}. - -@item -Minor cleanup in some error messages. - -@item -Fixed bug in @code{TeX-comment-paragraph} when called with a negative -argument. Reported by Markus Kramer @samp{}. - -@item -Don't move point in master file when running a command on the region in -an included file. Thanks to Karl Wilhelm Langenberger -@samp{} for the patch. - -@item -@code{LaTeX-math-mode} no longer works on Emacs 18 or older Lucid -versions. This change allowed me to unbundle @file{min-map.el}. - -@item -Made @kbd{C-c C-e} more robust, especially when applied on an empty -active region. Reported by Andrew Senior @samp{}. - -@item -@kbd{C-c C-m section RET} and @kbd{M-@key{tab}} should work now in -@TeX{}info mode. @kbd{C-c C-b} and @kbd{C-c C-r} removed, since they -did not work. Reported by Karl Eichwalder -@samp{}. - -@item -Made @kbd{M-q} skip block comments. Sugested by Peter Whaite -@samp{}. - -@item -Code cleanup: Renamed @samp{-format-} functions to @samp{-fill-}. - -@item -Made @kbd{,} and @kbd{.} remove any preceding italic correction. - -@item -Changes in math mode: @samp{setminus} moved to @key{\}, @samp{not} moved -to @key{/}, and @samp{wedge}, @samp{vee}, and @samp{neg} installed on -@key{&}, @kbd{|}, and @kbd{!} to make writing logic easier for C -programmers. - -@item -Renamed @file{auc-tex.el} to @file{auc-old.el} to make it less likely -that new users load it by mistake. - -@item -Changed name of @file{easymenu.el} to @file{auc-menu.el} to avoid -conflict with RMS's version. Updated it to handle the Lucid -@code{:keys} keyword argument. Defines a popup menu for both FSF and -Lucid emacs, although it is only installed in Lucid Emacs. Added David -Aspinall's @samp{} patch to handle an empty -menu bar under Lucid Emacs. The interface is still a superset of -@file{easymenu.el}. This version should no longer prevent the sharing -of byte compiled files between FSF and Lucid emacs. - -@item -Marking a section or environment now highlight it in Lucid Emacs. It -already worked in GNU Emacs. Thanks to Andreas Ernst -@samp{ernst_a@@maths.uwa.edu.au}. - -@item -Font support for @LaTeX{}2e. Many people suggested this. -Automatically activated for all documents defined with -@samp{\documentclass}. - -@item -Outline support for @LaTeX{}2e fixed by Robert Estes -@samp{}. - -@item -@samp{bibliography} macro now works. Thanks to Frederic Devernay -@samp{}. - -@item -Fixes to @file{psfig} support by Thomas Graichen -@samp{}. - -@item -Fixed position of @samp{\label} in environments. Reported by Richard -Stanton @samp{}. - -@item -Made the name of the AUC @TeX{} menu mode specific. - -@item -More reliable guesses with @kbd{C-c C-r}. Thanks to Lawrence R. Dodd -@samp{}. - -@item -Insert newline before inserting local variable section. Thanks to -Rajeev Gore' @samp{}. - -@item -Fixes to Japanese version. Thanks to Kobayashi Shinji -@samp{}. - -@item -Fixed bug in @samp{put} and @samp{multiput} macros. Thanks to Kobayashi -Shinji @samp{} and Masayuki Kuwada -. - -@item -Display number of pages after end of @LaTeX{} compilation. Thanks to -Lawrence R. Dodd @samp{}. - -@item -Only update section and environment menus when the lists have changed. - -@item -New variables @code{LaTeX-header-end} and @code{LaTeX-trailer-start}. - -@item -Some Emacs 18 compatibility changes. Thanks to Fran E. Burstall -@samp{}. - -@item -Use nonrecursive function to determine the current environment. This -should solve problems with exceeding lisp max depth. Contributed by -David Aspinall @samp{}. - -@item -Fixed documentation for @kbd{` ~} in @file{math-ref.tex}. Thanks to -Morten Welinder @samp{}. - -@item -Made @code{LaTeX-math-mode} work better with FSF Emacs 19 in the case -where you press something undefined, in particular function keys. -Requested by several. - -@item -Inserting an itemize environment around the active region now insert the -first item inside the environment. Thanks to Berwin A. Turlach -@samp{} for reporting this. - -@item -Fixed bug in right button menu under Lucid. Reported by Frederic -Devernay @samp{}. -@end itemize - -@node Version 9.0 -@section News in 9.0 - -Coordinator: Per Abrahamsen, 1994. - -Alpha testers (in order of appearance): -Volker Dobler @samp{}, -Piet van Oostrum @samp{}, -Frederic Devernay @samp{}, -Robert Estes @samp{}, -Berwin Turlach @samp{}, -Tim Carlson @samp{}, -Peter Thiemann @samp{}, -Kevin Scott @samp{}, -Lawrence R. Dodd @samp{}, -Johan Van Biesen @samp{}, -Marc Gemis @samp{}, -Michelangelo Grigni @samp{}, -Kevin Scott @samp{}, -Peter Paris @samp{}, -Peter Barth @samp{}, -Andy Piper @samp{}, -Richard Stanton @samp{}, -Christoph Wedler @samp{}, -Graham Gough @samp{}, -and probably more.@refill - -@itemize @bullet -@item -Fixed problem with @file{filladapt} defeating @LaTeX{} mode's own -indentation algorithm. Thanks to Piet van Oostrum -@samp{}. - -@item -Made environments and sections selectable from the menu bar. - -@item -Support Emacs comment conventions. Comments starting with a single -@samp{%} are indented at @code{comment-column}. Comments starting with -@samp{%%%} are indented at column 0. Comments starting with -@samp{%%} are indented like ordinary text. You can set the variables -@code{LaTeX-right-comment-regexp} and @code{LaTeX-left-comment-regexp} -to nil to disable this. See also @code{LaTeX-ignore-comment-regexp}. -Rewrote it from Christoph Wedler @samp{} from -original code. - -@item -@key{tab} and @key{lfd} will not indent code in @samp{verbatim} -environment if you set @code{LaTeX-indent-environment-check} to non-nil. -This was also first implemented by Christoph Wedler -@samp{}. - -@item -You can now get get custom indentation for various environments. See -@code{LaTeX-indent-environment-list}. - -@item -@kbd{C-c C-m left @key{ret}} new automatically inserts a matching -@samp{\right}. See variables @code{TeX-left-right-braces}, -@code{TeX-braces-default-association}, and -@code{TeX-braces-user-association}. This feature was suggested by Jesse -@samp{} and implemented by Berwin Turlach -@samp{}. - -@item -Don't automatically display the compilation buffer unless -@code{TeX-show-compilation} in non-nil. Suggested by Stefan Schoef -@samp{Stefan.Schoef@@arbi.informatik.uni-oldenburg.de}. - -@item -Bundled @file{ltx-help.el}. Press @kbd{C-h C-l} to get the -documentation for a LaTeX command. - -@item -Fixed indentation of @samp{\left} and @samp{\right}. Thanks to -Christoph Wedler @samp{}. - -@item -Installation procedure changed. @file{tex-site.el} is now intended to -survive AUC @TeX{} upgraded. The distribution version only contains -autoloads (eliminating the need for @file{tex-load.el} , the -customization variables are moved to @file{tex.el}. You should copy -those variables you need to customize from @file{tex.el} to -@file{tex-site.el}. - -@item -Made it possible to use absolute paths when including bibliographies or -style files. - -@item -Fixed problem with parsing errors after running @LaTeX{} on the region -from the menu. Thanks to Peter Barth @samp{} for -finding this one. - -@item -The file @file{doc/ref-card.texi} has been renamed to -@file{doc/tex-ref.texi} to avoid confusion with the reference card for -GNU Emacs. Suggested by Michelangelo Grigni @samp{}. - -@item -The @file{README}, @file{CHANGES} and @file{INSTALLATION} files are now -generated from chapters of this manual, to ensure they stay in sync. - -@item -@kbd{M-@key{tab}} will now complete some macro arguments in addition to -macro names. In particular, if you press @kbd{M-@key{tab}} after -@samp{\cite@{} or @samp{\ref@{} you will get completion for bibitems and -labels, respectively. - -@item -Merged a number of files. The major files are now @file{tex.el} for -plain @TeX{} and common support, @file{tex-buf.el} for running external -commands, and @file{latex.el} for @LaTeX{} support. - -@item -Unbundled @file{outln-18.el}. Users of Emacs 18 or Lucid Emacs 19.9 or -earlier must get @file{outln-18.el} and install it as @file{outline.el} -if they want the outline commands to work. - -@item -No longer bind @kbd{C-c @key{tab}} to @code{TeX-complete-symbol}. Use -@kbd{M-@key{tab}} instead. - -@item -Cleaned up the parser and parameterizedd it. Now you can add now types -of information to be maintained by the parser simply by calling -@code{TeX-auto-add-type}. You still need to install the regexps with -@code{TeX-auto-add-regexp}. - -@item -Disable the automatic insertion of empty braces after macros with no -arguments in @code{LaTeX-math-mode}. Added a variable -@code{TeX-insert-braces} to disable it everywhere. - -@item -Now complete with existing labels when asking for a label in a @LaTeX{} -environment. Suggested by Berwin Turlach -@samp{}. - -@item -The variables @code{TeX-private-macro}, @code{TeX-private-auto}, and -@code{TeX-private-style} are now initialized from the @samp{TEXINPUTS} -and @samp{BIBINPUTS} environment variables. - -@item -@kbd{C-c C-f} and @kbd{C-c C-e} will now put the template around the -region if the region is active. - -@item -Fixed @kbd{C-u C-c C-e} to handle environments ending with a star -(@samp{*}). Reported by Berwin Turlach -@samp{}. - -@item -Don't use @code{with-output-to-temp-buffer} for compilation buffer. -Fixed by Frederic Devernay @samp{}. - -@item -New function @code{TeX-command-buffer} (@kbd{C-c C-b}) to run a command -on the (visible part of) the current buffer. Requested by several -people. - -@item -Bundled the latest @file{reporter.el}, added -@code{TeX-submit-bug-report} to menus. - -@item -@code{TeX-insert-braces} now takes an argument like -@code{insert-parentheses}. Thanks to Lawrence R. Dodd -@samp{}. - -@item -Fixed bug in @samp{\put} and @samp{\multiput} macros. Thanks to Kevin -Scott @samp{}. - -@item -Deleted @code{ams-latex-mode}, @code{slitex-mode}, and -@code{foiltex-mode}. Instead, use @code{LaTeX-command-style} to -determine the name of the external command to use. - -@item -Deleted @code{latex2e-mode}. Instead set the @code{LaTeX-version} -variable. This may be done automatically if you use -@samp{\documentclass} in the future. - -@item -Fixed Lucid Emacs menu for @TeX{}info mode. Thanks to Frederic Devernay -@samp{}, - -@item -Added support for @file{harvard.sty} by Berwin Turlach -@samp{}. - -@item -Filling will not let display math equations @samp{\[ ... \]} be on a -line by themselves. Reported by Matthew Morley -@samp{}. - -@item -Made @code{words-include-escapes} default to nil. - -@item -Made @code{TeX-expand-list} expansions case sensitive. Thanks to Havard -Rue @samp{}. - -@item -Fixed error in calculating indentation for lines starting with a brace. -Thanks to Piet van Oostrum @samp{}. - -@item -Fixed bug in the @samp{addcontentsline}, @samp{newtheorem}, and -@samp{pagenumbering} macros reported by Berwin Turlach -@samp{}. - -@item -Doc fixes by Lawrence R. Dodd @samp{}. - -@item -Indentation no longer fooled by @samp{\\@{}, Thanks to Peter Thiemann -@samp{}. - -@item -Bind @kbd{M-C-e} and @kbd{M-c-a} to @code{LaTeX-find-matching-end} and -@code{LaTeX-find-matching-begin}. Suggested by Lawrence R. Dodd -@samp{}. - -@item -Added variable @code{TeX-quote-after-quote} which causes -@code{TeX-insert-quote} to insert literal @samp{"} except when after -another @samp{"}, in which case it will expand to @code{TeX-open-quote} -or @code{TeX-close-quote}. This code was contributed by Piotr Filip -Sawicki @samp{}. - -@item -Added support for Polish style files @file{plfonts.sty} and -@file{plhb.sty}, contributed by Piotr Filip -Sawicki @samp{}. - -@item -Added section with suggestions for how to handle European -character sets. - -@item -Created workaround for bug in the regexp handler in some Emacs 18 -versions and older versions of Lucid Emacs. The workaround -means you cannot use space in the documentstyle command in Emacs and -Lucid Emacs earlier than version 19.9. - -@item -@file{powerkey.el} is removed since the functionality is integrated in -GNU Emacs - -@item -@kbd{C-u "} now inserts four literal @samp{"}, not just one. To insert -a single @samp{"} either press @key{"} twice or use @kbd{C-q "}. - -@item -Allow non-string value for @code{outline-minor-map-prefix}. Reported by -David Smith @samp{}. - -@item -Make the use of @code{write-file-hooks} more safe, and use -@code{local-write-file-hooks} when possible. Suggested by David Smith -@samp{}. - -@item -Don't indent @samp{\begin@{verbatim@}} and @samp{\end@{verbatim@}}, -since any space before @samp{\end@{verbatim@}} is significant. Thanks to -Peter Thiemann @samp{} for the -patch. - -@item -Show available fonts when you try to insert an non-existing font. -Suggested by David Smith @samp{}. - -@item -The @code{member} function in @file{tex-18.el} does not depend on -@code{TeX-member} now. Thanks to Piet van Oostrum -@samp{}. - -@item -Do not overwrite any global binding of @kbd{M-@kbd{ret}}. Suggested by -Jens Petersen @samp{}. - -@item -Major modes for writing text are supposed to rebind @kbd{M-@kbd{tab}} to -@code{ispell-complete-word}. Reported by Jens Petersen -@samp{}. - -@item -Fixed problems with @TeX{}info menus. Thanks to David Smith -@samp{} for reporting this. - -@item -Code cleanup. Removed the @file{format} directory, as it did not make -it easier to add new @TeX{} modes, quite the contrary. - -@item -Fixed name conflict in @file{auc-tex.el}, reported by Rik Faith -@samp{}. - -@item -Fixed some spelling errors. Thanks to Lawrence R. Dodd -@samp{}. - -@item -Fixed bug prohibiting non-standard file extensions. Now recognize -@file{.ltx} by default. Suggested by Lawrence R. Dodd -@samp{}. - -@item -Name of the AUC @TeX{} info files changes once again to be usable under -DOS. This time simply to @file{auctex}. - -@item -Documented @code{TeX-outline-extra}. - -@item -Could not select command on region from the menu before loading -@file{tex-buf}. Reported by Uwe Bonnes -@samp{}. - -@item -Make the hilit19 interface more robust. Thanks to William Dean Norris -II @samp{}. - -@item -More OS/2 Makefile fixes by Bodo Huckestein -@samp{}. - -@item -Reimplemented comment support on top of @code{comment-region}, giving -slightly different semantics. -@end itemize - - -@node Version 8.0 -@comment node-name, next, previous, up -@section News in 8.0 - -Coordinator: Per Abrahamsen, 1993. - -Alpha testers (in order of appearance): Marc Gemis -@samp{}, Shinji Kobayashi -@samp{}, Philippe Defert -@samp{}, Richard Stanton -@samp{}, Norbert Kiesel -@samp{}, Roberto Cecchini -@samp{}, Hanno Wirth @samp{}, -Tim Carlson @samp{}, John Daschbach -@samp{}, Bob Fields -@samp{}, Peter Whaite -@samp{}, Volker Dobler -@samp{}, Phil Austin -@samp{}, Martin Maechler -@samp{}, Havard Rue -@samp{}, Tim Geisler -@samp{}, Tim Carlson -@samp{}, Sridhar Anandakrishnan -@samp{}, Peter Thiemann -@samp{}, Pedro Quaresma -@samp{}, Christian Lynbech -@samp{}, Kevin Scott -@samp{}, Bodo Huckestein -@samp{}, Cengiz Alaettinoglu -@samp{}, Jakob Schiotz -@samp{}, and probably more.@refill - -@itemize @bullet -@item -New variable @code{LaTeX-letter-sender-address} contains default address -for use with the letter style. Set it to the address of your -organization in @file{tex-site.el}. Thanks to Sridhar Anandakrishnan -@samp{}. - -@item -Makefile now works under OS/2 with GNU Make. Thanks to Bodo Huckestein -@samp{bodo@@eu10.mpi-hd.mpg.de}. - -@item -Made it possible to install global auto files without having Bib@TeX{} -mode installed. Thanks to Christian Lynbech -@samp{}. - -@item -Minor documentation fixes. Thanks to Martin Maechler -@samp{}. - -@item -Added support for @samp{eqref} for the @samp{amsart} style. Thanks to -Peter Whaite @samp{}. - -@item -Use @samp{-c} as the default shell command option under @samp{emx}. -Eberhard Mattes @samp{} says -it is better than @samp{/c}. - -@item -Made powerkey in the menus work better under OS/2. Thanks to Eberhard -Mattes @samp{}. - -@item -Made the reference cards print correctly on US letter format paper. -Thanks to Magnus Nordborg @samp{}. - -@item -@code{LaTeX-dead-mode} removed. Read the file `ISO-TEX' for alternative -solutions. - -@item -All minor modes unbundled. You can find them from ftp at -@samp{ftp.iesd.auc.dk} in the directory @file{/pub/emacs-lisp}. Removed -information about minor modes from this document. - -@item -New hooks for changing ispell directory, see @file{tex-site.el} for -details. - -@item -@LaTeX{}2e mode now supported. Insert - -@lisp - (setq TeX-default-mode 'latex2e-mode) -@end lisp - -in your @file{.emacs} file to get documentclass instead of documentstyle -per default. The parser recognizes documentclass, usepackage, and -newcommand with a default argument. There are also templates for all of -them. - -@item -Added Jakob Schiotz's @samp{} help file for -installing AUC @TeX{} on OEMACS. It will probably also be of interest -for DEMACS users. - -@item -Minor changes to be more friendly for OEMACS, thanks to Jakob Schiotz -@samp{}. - -@item -The control key bindings in @code{LaTeX-math-mode} now works, thanks to -Frederic Devernay @samp{}. - -@item -@LaTeX{} outlines no longer matches @samp{\partial} or other commands -with a sectioning command as prefix. Thanks to Jakob Schiotz -@samp{}. - -@item -@code{LaTeX-fill-paragraph} now handles the case where the previous line -both contain an @samp{\item} and an unmatched open brace. Thanks to -Piet van Oostrum @samp{}. - -@item -Use abbreviated file name for @TeX{} output buffers in Emacs 19. Thanks -to Jens Gustedt @samp{}. - -@item -Added lowercase alias for @code{LaTeX-math-mode} for use with Emacs file -mode commands. Thanks to Olaf Burkart -@samp{}. - -@item -Added code to reuse old region in @code{TeX-command-region} if mark is -not active. Thanks to Cengiz Alaettinoglu @samp{}. - -@item -Now get keyboard accelerators on all menus rather than only AUC @TeX{} -menus, thanks to the @file{powerkey.el} file by Lars Lindberg -@samp{}. - -@item -Added @code{TeX-electric-macro} for faster completion of @TeX{} macros. -@xref{Completion}. - -@item -Comparing printer names are now case incentive. Thanks to Richard -Stanton @samp{}. - -@item -Default shell fixed for OS/2. Thanks to Richard Stanton -@samp{}. - -@item -Added functions to hide (@code{LaTeX-hide-environment}) and show -(@code{LaTeX-show-environment}) the current environment. - -@item -@kbd{C-u C-c C-e} will now modify the current environment instead of -inserting a new environment. This is like the optional argument to the -font commands. - -@item -Added nabla to LaTeX Math Mode. Suggested by Bill Reynolds -@samp{}. - -@item -Added commands for running @TeX{} and @LaTeX{} interactively. Thanks to -David Carlisle @samp{}. - -@item -The external commands will now insert there output @emph{before} point -in the output buffers. This allows you to follow the progress by -putting point at the end of the file. Suggested by Jak Kirman -@samp{}. - -@item -When invoking an external command from a menu, the document will be -automatically saved. - -@item -There are now a printer menu for emacs 19. - -@item -Redesigned dependency checking. Now only checks dependencies for files -loaded in the current emacs session. This is much faster, but will not -catch files that are edited outside this emacs session, or files edited -in killed buffers. @strong{@code{TeX-check-path} must at least contain -@file{.} for saving to work}. If you have set @samp{TeX-check-path} -in your @file{.emacs} file, remove it. The default value is fast enough -now. - -@item -New variable @code{TeX-save-query} control if AUC @TeX{} will query you -for each modified buffer when you save the document. Set it to nil to -get rid of these questions. Setting this variable also affect the -automatic saving of the document that happens each time you start an -external command. - -@item -New command @code{TeX-save-document} will save all files in the current -document, i.e. the document associated with the current buffer. - -@item -Cleaned up all minor modes, also made them use @file{min-map.el} or -@file{min-mode.el} instead of @file{min-bind.el}. - -@item -Cleaned up release management. - -@item -AUC TeX will not longer be confused when you rewrite a file under a new -name. - -@item -Lots of code cleanup, involving reformatting the source and renaming all -@samp{-hook} variables and functions to conform with the Emacs 19 -guidelines. - -@item -Can now parse Japanese characters in labels and macros when you use -Japanese @TeX{}. Thanks to Shinji Kobayashi -@samp{}. - -@item -Made it safe to quit when AUC @TeX{} asks for the name of the master -file. It will simply assume the file itself is the master, and continue -without inserting any file local variables. - -@item -Support for @code{epsf} and @code{psfig} style files. Thanks to Marc -Gemis @samp{}. - -@item -Support for @LaTeX{}info. Thanks to Marc Gemis -@samp{}. - -@item -Only examine the first 10000 bytes to find out what @TeX{} mode to use. - -@item -Added @code{TeX-submit-bug-report} command to submit bug reports. It -uses the @file{reporter.el} distributed with SuperCite, so it may not be -available in some Emacs 18 installations. - -@item -Speeded up parsing significantly by using a simpler regexp. - -@item -Added variable @code{TeX-auto-untabify}. Set it to nil to prevent -untabifying the buffer when it is saved. Several people wanted this. - -@item -Changed defaults to @emph{not} do any automatic parsing, nor prompt for -a master file. @xref{Parsing Files}, @ref{Multifile}, for information -about how ot correct this. In short, insert the following in your -@file{.emacs} file. - -@lisp -(setq TeX-auto-save t) -(setq TeX-parse-self t) -(setq-default TeX-master nil) -@end lisp - -@item -Some grammatical fixes to the @file{PROBLEMS} file. Thanks to Lawrence -R. Dodd @samp{}. - -@item -No longer install a separate @code{outline-minor-mode} by default, as -the FSF Emacs 19.19 @code{outline-minor-mode} is adequate. The included -file @file{outln-18.el} emulates the FSF Emacs 19.19 mode under Emacs 18. - -The FSF Emacs 19.19 @code{outline-minor-mode} use the @kbd{C-c} prefix -instead of @kbd{C-c C-o} by default, and does not bind as many keys as -the @code{outline-minor-mode} distributed with earlier versions of AUC -@TeX{} did. You can get the keybindings back together with other -goodies by inserting -@example -(require 'out-xtra) -@end example -in your @file{.emacs} file. @file{out-xtra.el} will probably be -unbundled from AUC @TeX{} in the future. - -@item -Some fixes to AmS-@TeX{} mode by Ulf Juergens -@samp{}. - -@item -Make @samp{plain-TeX-mode-menu} work in Lucid Emacs. Thanks to Anthony -Rossini @samp{rossini@@hsph.harvard.edu} for reporting this. - -@item -First cut on a @TeX{}info mode. - -@item -More strict about parsing @samp{\bibitem}'s and Bib@TeX{} entries. - -@item -Made it easier to write style files for environments that takes -arguments and documented it. Suggested by Martin -Wunderli @samp{}. - -@item -Parse optional argument to @samp{\newenvironment}. Suggested by Martin -Wunderli @samp{}. - -@item -Fixed @samp{parbox} macro. Thanks to Shinji Kobayashi -@samp{}. - -@item -Made the parser work better in outline minor mode. Thanks to Salvador -Pinto Abreu @samp{}. - -@item -Also save style information with @code{TeX-normal-mode} when buffer not -modified. - -@item -Use @code{$(MAKE)} instead of @samp{make} to invoke @code{make} from the -@file{Makefile}. Thanks to John Interrante -@samp{}. - -@item -Make last value default for @code{TeX-insert-macro}. Suggested by Matt -Fairtlough @samp{}. - -@item -Renamed info file to @samp{auc-info} in order to fill DOS file limits. -Please remember to update your @file{dir} file to reflect this change. - -@item -Delete auto file instead of saving an empty file. -@end itemize - -@node Version 7.3 -@comment node-name, next, previous, up -@section News in 7.3 - -Coordinator: Per Abrahamsen, 1993. - -@itemize @bullet -@item -More robust installation, especially for Lucid Emacs (I hope). Many -people reported problems with this. - -@item -Make `easymenu' work when byte-compiled. Many people reported this -bug. - -@item -Minimally updated the @file{README} file from version 6.0 (sigh). -Thanks to Boris Goldowsky @samp{} for reporting -this. - -@item -Added @samp{@@finalout} to manual. Reported by Henrik Drabol -@samp{}. - -@item -Fixed @kbd{M-q} to work after an @samp{\end@{@dots{}@}}. It will not -work at the end of the buffer, but there are usually the local variables -so it should (hopefully) not matter. Thanks to Shinji Kobayashi -@samp{} again. - -@item -New variables @code{TeX-open-quote} and @code{TeX-close-quote} determine -what is inserted by @code{TeX-insert-quote}. The @file{german} style -file now use those variables instead of changing the keymap. - -@item -Changes to the default settings in @file{tex-site.el}, in particular a -@samp{Queue} command is added to display the print queue. Thanks to -John Interrante @samp{} for code, and -other members of the @samp{auc-tex@@iesd.auc.dk} mailing list for -ideas. - -@item -Make sure all outline mode commands are bound in -@code{outline-minor-mode}. - -@item -Added autoload for @code{TeX-command}. Thanks to Hanno Wirth -@samp{} for reporting this. - -@item -Added support for AmS@TeX{} and AmSLa@TeX{}. Currently they are -identical to @TeX{} and @LaTeX{} except for another default command. - -@item -Added Vor@TeX{} style matching of dollar sign. The style is guaranteed -to be Vor@TeX{}, since I lifted the code directly from Vor@TeX{}. -Thanks to Pehong Chen @samp{} for writing the -Vor@TeX{} code. Thanks to Jak Kirman @samp{} for -pointing out this nice Vor@TeX{} feature. - -@item -Added information about AUC @TeX{} mail addresses to the manual. Thanks -to Dave Smith @samp{}. - -@item -Added menu to for plain @TeX{}. Suggested by Tim Carlson -@samp{}. - -@item -Made the menus depend on @code{TeX-command-list}. - -@item -Made it possible to specify @code{TeX-auto-regexp-list} in the local -variable section of each file. - -@item -Added variable @code{TeX-auto-parse-length} to specify maximal length of -text that will be parsed. - -@item -Added automatic parsing of Bib@TeX{} files and @samp{bibitem} entries in -order to get completion in @samp{cite}. This was inspired by an add on -made by Sridhar Anandakrishnan @samp{}. - -@item -Added variable @code{TeX-byte-compile} to disable automatic byte -compilation of style files when loaded. This is needed when using -different Emacs versions. - -@item -Added variable @code{TeX-translate-location-hook} to translate file and -line information before showing an error, as requested by Thorbjoern -Ravn Andersen @samp{}. - -@item -Added variable @code{TeX-auto-save} to allow disabling the automatic -saving of style information, either per file in the file local -variables, or globally by using @code{setq-default}. Use -@code{TeX-normal-mode} to force style information to be saved. - -@item -Try to create @file{auto} directory if it does not exists. - -@item -Added chapter describing how to tune the @TeX{} parsing. - -@item -Allow (but do not encourage) a string value for -@code{LaTeX-default-options}. - -@item -Give @samp{"} word syntax when german.sty is loaded. Suggested by Tim -Geisler @samp{}. - -@item -Many corrections to the grammar in the manual. Thanks to Manfred -Weichel @samp{}. - -@item -Bind @code{TeX-home-buffer} to @kbd{C-c ^} instead of @kbd{C-c C-h} -which are reserved in Emacs 19. Suggested by Chris Moore -@samp{}. -@end itemize - -@node Version 7.2 -@comment node-name, next, previous, up -@section News in 7.2 - -Coordinator: Per Abrahamsen, 1993. - -@itemize @bullet -@item -@code{LaTeX-dead-mode} works again. Thanks to Patrick O'Callaghan -@samp{} for fixing it. - -@item -Minor fixes to the documentation. Thanks to Shinji Kobayashi -@samp{}. - -@item -Add @samp{Compiling} to the mode line of all buffers, while there is a -AUC @TeX{} compilation process running. This is similar to the behavior -of @code{compile} in Emacs 19. - -@item -@code{TeX-normal-mode} will now save the buffer first to make sure it -gets reparsed. - -@item -Labels with underscores are now recognized. Thanks to Wolfgang Franzki -@samp{} - -@item -Fix to `ghostview' printer specification. Thanks to Masayuki Kuwada -@samp{}. - -@item -Recognize @samp{abstract}, @samp{center}, @samp{titlepage}, -@samp{verse}, and @samp{theindex} environments. Thanks to Masayuki Kuwada -@samp{}. - -@item -Fix to @samp{newsavebox} macro. Thanks to Shinji Kobayashi -@samp{} for reporting this. - -@item -Menu support for GNU Emacs 19 and Lucid Emacs. Thanks to Alastair Burt -@samp{} for the initial Lucid Emacs version. - -@item -@kbd{C-c C-f C-d} now deletes the current font. The current font is -defined to be the innermost @TeX{} group starting with a @TeX{} macro -that is terminated by a space. - -@item -Giving @kbd{C-c C-f} a prefix argument will replace the current font, -i.e. @kbd{C-u C-c C-f C-b} will change the current font to bold. - -The old functionality (putting the font around the region) has been -removed. To make the region bold, type @kbd{C-w C-c C-f C-b C-y} -instead. - -@item -Chapter recognized as largest heading in the report style. Thanks to -Shinji Kobayashi @samp{} for reporting -this. - -@item -More support for Japanese style files. Thanks to Shinji Kobayashi -@samp{}. - -@item -No longer put @samp{Outline} in the mode line whenever -@code{selective-display} is set. Thanks to Lawrence R. Dodd -@samp{} for reporting this. - -@item -Support for inserting calligraphic letters in @code{TeX-math-mode} with -@kbd{` c @key{letter}}. Thanks to Olaf Burkart -@samp{}. - -@item -@code{set-docstring} in @file{tex-math.el} should work better now. -Thanks to Alastair Burt @samp{} and Olaf Burkart -@samp{}. - -@item -Support for dviout preview on PC-9801. Thanks to Shinji Kobayashi -@samp{}. - -@item -Inserting environment in empty buffer should work now. Thanks to -Alastair Burt @samp{}. - -@item -Default float for figures changed from @samp{tbp} to @samp{htbp}. - -@item -@code{LaTeX-format-environment} may work now. Thanks to Shinji -Kobayashi @samp{}. - -@item -Better @code{LaTeX-close-environment}. Thanks to Thorbjoern Hansen -@samp{}. - -@item -Some support for Ispell 4.0. - -@item -Bib@TeX{} in Emacs 19 need @code{tex-insert-quote}, make it autoload -from AUC @TeX{} instead of the standard @code{tex-mode}. - -@item -@code{TeX-auto-generate} failed when repeated. Thanks to Peter Whaite -@samp{} for reporting this. -@end itemize - -@node Version 7.1 -@comment node-name, next, previous, up -@section News in 7.1 - -Coordinator: Per Abrahamsen, 1993. - -@itemize @bullet -@item -Allow multiple @samp{%p} in print commands. - -Suggested by Cliff Krumvieda @samp{}. - -@item -Improved backward compatibility in @file{auc-tex.el}. Thanks to Ralf -Handl @samp{}. - -@item -New style hook for @file{german.sty}. - -Disable smart quotes. Press @kbd{C-c C-n} to make it take effect. - -@item -Allow files to have other extensions than ``tex''. - -But no longer allow files to have multiple dots. Sigh. - -@item -Will no longer parse the buffer if it can use the saved state. - -@item -New variable @code{TeX-parse-self}. - -Set it to nil if you never want to parse the buffer when you load it. - -@item -Only offer to save files that belongs to the document. - -When you format the document with @kbd{C-c C-c}, AUC @TeX{} will no -longer offer to save your @file{RMAIL}, @file{.newsrc}, or other files -that does not belong to the document. Suggested by Jim Hetrick -@samp{}. - -@item -Foil@TeX{} support. - -Thanks to Sven Mattisson @samp{} - -@item -Smarter about when you need to reformat. - -Thanks to Chris Callsen @samp{}. - -@item -Japanese @TeX{} - -Now supports Japanese @TeX{}. Thanks to Shinji Kobayashi -@samp{}. - -@item -Works again under OS/2 and other case insensitive file systems. - -@item -DEMACS support. - -Thanks to Shinji Kobayashi @samp{}. - -@item -Better @code{LaTeX-close-environment}. - -Thanks to Piet van Oostrum @samp{}. - -@item -Ispell support. - -Thanks to Piet van Oostrum @samp{}. - -@item -Support for Russian letters. - -Thanks to Justin R. Smith @samp{}. - -@item -Sli@TeX{} fixes. - -Many people. - -@item -Fixes for spelling errors. - -Many people. - -@end itemize - -@node Version 7.0 -@comment node-name, next, previous, up -@section Version 7.0 - -Coordinator: Per Abrahamsen, 1993. - -Alpha testers (in order of appearance): Piet van Oostrum -@samp{}, Sven Mattisson @samp{}, Tim -Geisler @samp{}, Fran E. -Burstall @samp{}, Alastair Burt -@samp{}, Sridhar Anandakrishnan -@samp{}, Kjell Gustafsson -@samp{}, Uffe Kjaerulff -@samp{}, Kurt Swanson @samp{Kurt.Swanson@@dna.lth.se}, -Mark Utting @samp{}, Per Norman Oma -@samp{perno@@itk.unit.no}, Naji Mouawad -@samp{}, Bo Nygaard Bai -@samp{}, and probably more. - -@itemize @bullet -@item -New keymap. - -The keymap has been changed in order to make it more intuitive to new -users, and because the old bindings did not work well with the new -buffer manipulation commands in tex-buf.el. To use the new bindings, -load @file{tex-init.el} instead of @file{auc-tex.el}. - -The file @file{auc-tex.el} is still available and implements the old -keybindings on top of the new code. - -Print out the reference card (@file{doc/tex-ref.tex}) to see the new -bindings. - -@item -Completely redesigned the buffer handling. - -No part of the interface or the customization variables remain the same, -unless you use the compatibility functions in @file{auc-tex.el}. In -that case the interactive commands remain similar in spirit, but the -customization interface is still changed. - -The file @file{tex-buf.el} has been completely rewritten, and there are -major cleanup in @file{tex-dbg.el}, however the basic functionality -remains the same in this file. The code for both @file{tex-buf.el} and -@file{tex-dbg.el} should be much simpler now and easier to extent. - -@file{auc-tex.el} and @file{tex-site.el} was updated to support the new -interface. I actually believe the moral equivalent to @code{TeX-region} -to work now @t{:-)}, at least I understand the code now. - -The two major functions are now @code{TeX-command-master} and -@code{TeX-command-region}. Each function will prompt you for the -command to execute. AUC @TeX{} will make an educated guess on what -command you want to run, and make that the default. The available -commands are defined in the variable @code{TeX-command-list}. - -@code{TeX-command-master} will run the specified command on the buffers -master file. You can have one command running for each master file. -@code{TeX-command-region} will run the specified command on the current -region, getting the header on trailer from the master file. - -You can have exactly one region command running, independent on how many -master file commands that are running. Commands that operate on the -active process (like @code{TeX-next-error}) will chose the process -associated with buffers master file, unless the last region process is -more recent than all master file processes. - -AUC @TeX{} now insist on knowing the master file for a buffer. If you -do not specify it in the file variable section, and it is not obviously -a master file itself, it will ask you. It will also add the master file -name to the file variables, unless you disable this feature by setting -@code{TeX-add-local} to nil. Furthermore, it will convert @samp{%% -Master:} lines to file variables, unless you disable it by setting -@code{TeX-convert-master} to nil. -@vindex TeX-convert-master - -Functionality removed (for now, it might appear again latter) include -all other functions to start a command (e.g. @code{LaTeX-BibTeX}), and -alternative ways to specify headers and trailers. The only place to get -the header and trailer is from the master file (I can easily change -that, if anyone have such needs). - -@item -Style specific code isolated. - -You can now add style specific information to AUC TeX by writing a -style file somewhere in TeX-style-path. - -The main code is now organized around this principle. - -@item -Automatically generate style files. - -AUC @TeX{} can now automatically extract information from a @TeX{} file, -and will do this when you save a buffer. - -@item -Sli@TeX{} mode. - -Just like @LaTeX{} mode, except that the default command to format run -on the buffer is @samp{slitex}. - -@item -@code{LaTeX-section} completely general. - -Rewrote @file{ltx-sec.el}. - -@itemize @minus -@item -Sectioning level, toc, and title queries can be individually turned off. -@item -Label query can be turned on or off for selected sectioning levels. -@item -Label prefix can be different for different sectioning levels. -@item -If the title (or toc) is empty, point will be positioned there. -@item -Users can add new hooks -@end itemize - -@item -@code{TeX-insert-macro} much smarter. - -It will now prompt for the symbol with completions, and for many symbols -it will also prompt for each argument. There are also completion on -some of the arguments. - -@item -Fixed center in figure environment. - -Thanks to Thomas Koenig @samp{}. - -@item -Changed @code{\M-} to @code{\e} in all keybindings in order to better -support 8-bit input on some GNU Emacs. Thanks to Peter Dalgaard -@samp{}. - -Please, implementors of 8-bit input extensions to GNU Emacs. -@code{\M-x} does @emph{not} means @dfn{@kbd{x} with the 8-bit set}. It -means @dfn{pressing @kbd{x} while holding down the @key{meta} key}. -Some systems (such as X11) are able to tell the different. Thus, even -if you implement 256 byte keymaps, @code{\M-x} should still expand -@code{meta-prefix-char} followed by an @kbd{x} in the keymap. This -allows you to distinguish pressing @kbd{x} while holding down the -@key{meta} key from entering a literal 8-bit character. - -@item -Made the outline commands aware of the document style. - -That is, if the document style is @samp{article}, @samp{\section} will -be one level below the @samp{\documentstyle}, while if the style is -@samp{book}, @samp{\section} will be three levels below -@samp{\documentstyle}. This will make @code{show-children} work better -at the top level. - -@item -The makefiles are closer to GNU coding standard. - -They now understand `prefix' and some other macros. - -@item -Added hooks to be run after list of environments or list of completion -names are updated, and also added a hook to be called after each file -has been loaded. Thanks to Piet van Oostrum @samp{}. - -@item -Added @samp{*} to lot of @code{(interactive)} declarations. - -@item -The outline commands are now always accessible from @LaTeX{} mode. - -@item -Generalized the keyboard remapping and double modes. - -These are found in the file @file{min-key.el}. - -@item -Smart Comments. - -Not really, but there are now two comment functions which use their -arguments to determine what to do, instead of four functions ignoring -their arguments. - -@item -Add outline headers. - -It is now possible to add extra outline headers, by setting the variable -@code{TeX-outline-extra}. - -@item -Smart quotes even smarter. - -If you press @kbd{"} twice, it will insert an real double quote instead -of two (or four) single quotes. This is consistent with how remapping -in @file{min-key.el} is done. - -@item -Automatically untabify buffer when you save it. - -Hands up, everyone who have produced a `last revision' paper containing -an unreadable list of data in the back, because @TeX{} does not -understands tabs. - -@item -Call show-all when you change major mode. - -Thanks to Inge Frick's @samp{} @file{kill-fix.el} -enhancement, outline minor mode can now guarantee that all text is shown -when you leave the minor mode, even if you leave the minor mode by -changing the major mode. - -@item -Updated documentation for 7.0. - -Also added key, variable, function, and concept indexes, as well as this -history section and a new chapter on multifile documents -(@pxref{Multifile}).@refill - -@end itemize - -@node Version 6.1 -@comment node-name, next, previous, up -@section Version 6.1 - -Coordinator: Per Abrahamsen, 1992. - -@itemize @bullet -@item -@code{TeX-region} might work now (heard that before?). - -Many people reported this one. Especially thanks to Fran Burstall -@samp{} and Bill Schworm -@samp{}.@refill - -@item -The specification format for the @TeX{} command is more general. - -See the documentation for @code{LaTeX-command} and -@code{plain-TeX-command}. - -@item -The specification format for the preview commands is more general. - -See their respective documentation. - -@item -The specification format for the print command is more general. - -See the documentation for @code{TeX-print-command}. - -@item -@code{TeX-args} is marked as obsolete. - -@item -The @samp{"Emergency stop ..."} error. - -Some users of old @TeX{} installations got might might be fixed now. -Thanks to Philip Sterne @samp{}. - -@item -It is now possible to change the preview command. - -@dots{} without loading TeX-site first. Thanks to Tim Bradshaw -@samp{}. - -@item -New variable TeX-smart-quotes. - -Allow @file{german.sty} users (and others) to disable the mapping of -double quote (@kbd{"} to @samp{``} or @samp{''}). Thanks to Daniel -Hernandez @samp{}. - -@item -Many minor corrections to the documentation. - -Thanks to Mainhard E. Mayer @samp{}. - -@item -Make test for @code{HOSTTYPE} case insensitive. - -Thanks to Gisli Ottarsson @samp{}. - -@item -@code{TeX-force-default-mode} - -Set to avoid AUC @TeX{}'s attempts to infer the mode of the file by -itself. - -@end itemize - -@node Version 6.0 -@comment node-name, next, previous, up -@section Version 6.0 - -Coordinator: Kresten Krab Thorup, 1992. - -Preliminary documentation is available in the directory @file{doc}. It -isn't very well written, but I believe it covers most interesting points. -Comments, suggestions, or even rewrites of sections are VERY -WELCOME@dots{} - -LaCheck has been incorporated in the package. The source code for it is -available in the directory @file{lacheck} along with the documentation -for it. Lacheck may also be used from the command line. It is bound to -@kbd{C-c $}. - -Some minor changes in: - -@table @code -@item TeX-region -Should work better with @samp{Master:} option. - -@item LaTeX-environment -Numerous new hooks added by Masayuki Kuwada. - -@item TeX-command-on-region -Removed. @kbd{C-c C-o} used for @code{outline-minor-mode} instead. - -@end table - -And some additional minor fixes... - -@node Ancient History -@comment node-name, next, previous, up -@section Ancient History - -The origin of AUC @TeX{} is @file{tex-mode.el} from Emacs 16. Lars -Peter Fischer @samp{} wrote the first functions to -insert font macros and Danish characters back in 1986. Per Abrahamsen -@samp{} wrote the functions to insert environments -and sections, to indent the text, and the outline minor mode in 1987. -Kresten Krab Thorup @samp{} wrote the buffer handling -and debugging functions, the macro completion, and much more, including -much improved indentation and text formatting functions. He also made -the first public release in 1991, and was the main author and -coordinator of every release up to and including 6.0. - -Thanks should also go to all the people who have been a great help -developing the AUC @TeX{} system. Especially all the people on the -@samp{auc-tex} mailing list, who have been very helpful commenting and -pointing out weak points and errors. - -Some of the contributors are listed below. Others are mentioned in the -lisp files or in the History section. - -@table @samp -@item -Denys Duchier -@item -George Ferguson -@item -Martin Simons -@item -Michael Smith -@item -Per Hagen -@item -Ralf Handl -@item -Sven Mattisson -@item -Masayuki Kuwada -@item -Terrence Brannon -@item -Leonard Roseman -@end table - -Special thanks to Leslie Lamport for supplying the source for the LaTeX -error messages in the @file{tex-dbg.el} file. - diff --git a/packages/auctex/doc/install.texi b/packages/auctex/doc/install.texi deleted file mode 100644 index f13798bbf..000000000 --- a/packages/auctex/doc/install.texi +++ /dev/null @@ -1,576 +0,0 @@ -@c This is part of the AUCTeX Manual. -@c Copyright (C) 1994, 1996, 2003, 2004, 2005, 2006, 2007 -@c Free Software Foundation, Inc. -@c See the file auctex.texi for copying conditions. -@ifset rawfile -@include macros.texi -@node Installation,,(dir),(dir) -@top Installing @AUCTeX{} -@end ifset - -@ifclear rawfile -@node Installation -@chapter Installing @AUCTeX{} -@end ifclear - -Installing @AUCTeX{} should be simple: merely @command{./configure}, -@command{make}, and @code{make install} for a standard site-wide -installation (most other installations can be done by specifying a -@option{--prefix=@dots{}} option). - -On many systems, this will already activate the package, making its -modes the default instead of the built-in modes of Emacs. If this is -not the case, consult @ref{Loading the package}. Please read through -this document fully before installing anything. The installation -procedure has changed as compared to earlier versions. Users of @w{MS -Windows} are asked to consult -@ifset rawfile -the file @file{INSTALL.windows}. -@end ifset -@ifclear rawfile -@xref{Installation under MS Windows}. -@end ifclear - -@ifclear rawfile -@menu -* Prerequisites:: -* Configure:: -* Build/install:: -* Loading the package:: -* Advice for package providers:: -* Advice for non-privileged users:: -* Installation under MS Windows:: -* Customizing:: -@end menu -@end ifclear - -@ifset rawfile -@menu -* Prerequisites:: -* Configure:: -* Build/install:: -* Loading the package:: -* Advice for package providers:: -* Advice for non-privileged users:: -* Customizing:: -@end menu -@end ifset - -@ifset rawfile -@node Prerequisites -@chapter Prerequisites -@raisesections -@end ifset - -@ifclear rawfile -@node Prerequisites -@section Prerequisites -@end ifclear - -@itemize @bullet -@item A recent version of Emacs, alternatively XEmacs - -@w{Emacs 20} is no longer supported, and neither is XEmacs with a -version of @code{xemacs-base} older than 1.84 (released in sumo from -02/02/2004). Using @previewlatex{} requires a version of Emacs compiled -with image support. While the X11 version of @w{Emacs 21} will likely -work, @w{Emacs 22} and later is the preferred platform. - -@table @b -@item Windows -Precompiled versions are available from -@uref{ftp://ftp.gnu.org/gnu/emacs/windows/}. -@item Mac OS X -For an overview of precompiled versions of Emacs for Mac OS X see for -example @uref{http://www.emacswiki.org/cgi-bin/wiki/EmacsForMacOS}. -@item GNU/Linux -Most GNU/Linux distributions nowadays provide a variant of Emacs 22 or -later via their package repositories. -@item Self-compiled -Compiling Emacs yourself requires a C compiler and a number of tools and -development libraries. Details are beyond the scope of this manual. -Instructions for checking out the source code can be found at -@uref{https://savannah.gnu.org/bzr/?group=emacs}. -@end table - -If you really need to use @w{Emacs 21} on platforms where this implies -missing image support, you should disable the installation of -@previewlatex{} (see below). - -While XEmacs (version 21.4.15, 21.4.17 or later) is supported, doing -this in a satisfactory manner has proven to be difficult. This is -mostly due to technical shortcomings and differing API's which are hard -to come by. If @AUCTeX{} is your main application for XEmacs, you are -likely to get better results and support by switching to Emacs. Of -course, you can improve support for your favorite editor by giving -feedback in case you encounter bugs. - -@item A working @TeX{} installation - -Well, @AUCTeX{} would be pointless without that. Processing -documentation requires @TeX{}, @LaTeX{} and Texinfo during installation. -@previewlatex{} requires Dvips for its operation in @acronym{DVI} mode. -The default configuration of @AUCTeX{} is tailored for te@TeX{} or -@TeX{}live-based distributions, but can be adapted easily. - -@item A recent Ghostscript - -This is needed for operation of @previewlatex{} in both @acronym{DVI} -and @acronym{PDF} mode. Most versions of Ghostscript nowadays in use -should work fine (version 7.0 and newer). If you encounter problems, -check -@ifset rawfile -the @file{PROBLEMS} file. -@end ifset -@ifclear rawfile -@ref{Problems with Ghostscript,,,preview-latex,the @previewlatex{} manual}. -@end ifclear - -@item The @code{texinfo} package - -Strictly speaking, you can get away without it if you are building -from the distribution tarball, have not modified any files and don't -need a printed version of the manual: the pregenerated info file is -included in the tarball. At least @w{version 4.0} is required. - -@end itemize - -For some known issues with various software, see -@ifset rawfile -the @file{PROBLEMS} file. -@end ifset -@ifclear rawfile -@ref{Known problems,,,preview-latex,the @previewlatex{} manual}. -@end ifclear - -@node Configure -@section Configure - -The first step is to configure the source code, telling it where -various files will be. To do so, run - -@example -./configure @var{options} -@end example - -(Note: if you have fetched @AUCTeX{} from @acronym{CVS} rather than -a regular release, you will have to first follow the instructions in -@file{README.CVS}). - -On many machines, you will not need to specify any options, but if -@command{configure} cannot determine something on its own, you'll need to -help it out with one of these options: - -@table @code -@item --prefix=@file{/usr/local} -All automatic placements for package components will be chosen from -sensible existing hierarchies below this: directories like @file{man}, -@file{share} and @file{bin} are supposed to be directly below -@var{prefix}. - -Only if no workable placement can be found there, in some cases an -alternative search will be made in a prefix deduced from a suitable -binary. - -@file{/usr/local} is the default @var{prefix}, intended to be suitable -for a site-wide installation. If you are packaging this as an -operating system component for distribution, the setting @file{/usr} -will probably be the right choice. If you are planning to install the -package as a single non-priviledged user, you will typically set -@var{prefix} to your home directory. - -@item --with-emacs[=@var{/path/to/emacs}] -If you are using a pretest which isn't in your @code{$PATH}, or -@command{configure} is not finding the right Emacs executable, you can -specify it with this option. - -@item --with-xemacs[=@var{/path/to/xemacs}] -Configure for generation under XEmacs (Emacs is the default). Again, -the name of the right XEmacs executable can be specified, complete with -path if necessary. - -@item --with-packagedir=@var{/dir} -This XEmacs-only option configures the directory for XEmacs packages. A -typical user-local setting would be @file{~/.xemacs/xemacs-packages}. -If this directory exists and is below @var{prefix}, it should be -detected automatically. This will install and activate the package. - -@item --without-packagedir -This XEmacs-only option switches the detection of a package directory -and corresponding installation off. Consequently, the Emacs -installation scheme will be used. This might be appropriate if you are -using a different package system/installer than the XEmacs one and want -to avoid conflicts. - -The Emacs installation scheme has the following options: - -@item --with-lispdir=@var{/dir} -This Emacs-only option specifies the location of the @file{site-lisp} -directory within @samp{load-path} under which the files will get -installed (the bulk will get installed in a subdirectory). -@file{./configure} should figure this out by itself. - -@item --with-auctexstartfile=@file{auctex.el} -@itemx --with-previewstartfile=@file{preview-latex.el} -This is the name of the respective startup files. If @var{lispdir} -contains a subdirectory @file{site-start.d}, the start files are -placed there, and @file{site-start.el} should -load them automatically. Please be aware that you must not move the -start files after installation since other files are found -@emph{relative} to them. - -@item --with-packagelispdir=@file{auctex} -This is the directory where the bulk of the package gets located. The -startfile adds this into @var{load-path}. - -@item --with-auto-dir=@var{/dir} -You can use this option to specify the directory containing -automatically generated information. It is not necessary for most -@TeX{} installs, but may be used if you don't like the directory that -configure is suggesting. - -@item --help -This is not an option specific to @AUCTeX{}. A number of standard -options to @command{configure} exist, and we do not have the room to -describe them here; a short description of each is available, using -@code{--help}. If you use @samp{--help=recursive}, then also -@previewlatex{}-specific options will get listed. - -@item --disable-preview -This disables configuration and installation of @previewlatex{}. This -option is not actually recommended. If your Emacs does not support -images, you should really upgrade to a newer version. Distributors -should, if possible, refrain from distributing @AUCTeX{} and -@previewlatex{} separately in order to avoid confusion and upgrade -hassles if users install partial packages on their own. - -@item --with-texmf-dir=@var{/dir}@*--without-texmf-dir -@cindex preview-install-styles -This option is used for specifying a @acronym{TDS}-compliant directory -hierarchy. Using @code{--with-texmf-dir=@var{/dir}} you can specify -where the @TeX{} @acronym{TDS} directory hierarchy resides, and the -@TeX{} files will get installed in -@file{@var{/dir}/tex/latex/preview/}. - -If you use the @code{--without-texmf-dir} option, the @TeX{}-related -files will be kept in the Emacs Lisp tree, and at runtime the -@env{TEXINPUTS} environment variable will be made to point there. You -can install those files into your own @TeX{} tree at some later time -with @kbd{M-x preview-install-styles RET}. - -@item --with-tex-dir=@var{/dir} -If you want to specify an exact directory for the preview @TeX{} files, -use @code{--with-tex-dir=@var{/dir}}. In this case, the files will be -placed in @file{@var{/dir}}, and you'll also need the following option: - -@item --with-doc-dir=@var{/dir} -This option may be used to specify where the @TeX{} documentation goes. -It is to be used when you are using @code{--with-tex-dir=@var{/dir}}, -but is normally not necessary otherwise. -@end table - -@node Build/install -@section Build/install - -@cindex Installation -@cindex Make - -Once @command{configure} has been run, simply enter - -@example -make -@end example - -@noindent -at the prompt to byte-compile the lisp files, extract the @TeX{} files -and build the documentation files. To install the files into the -locations chosen earlier, type - -@example -make install -@end example - -You may need special privileges to install, e.g., if you are installing -into system directories. - -@node Loading the package -@section Loading the package -@cindex @file{.emacs} - -You can detect the successful activation of @AUCTeX{} and -@previewlatex{} in the menus after loading a @LaTeX{} file like -@file{preview/circ.tex}: @AUCTeX{} then gives you a @samp{Command} menu, -and @previewlatex{} gives you a @samp{Preview} menu. - -For XEmacs, if the installation occured into a valid package directory -(which is the default), then this should work out of the box. - -@cindex @file{auctex.el} -@cindex @file{tex-site.el} -With Emacs (or if you explicitly disabled use of the package system), -the startup files @file{auctex.el} and @file{preview-latex.el} may -already be in a directory of the @file{site-start.d/} variety if your -Emacs installation provides it. In that case they should be -automatically loaded on startup and nothing else needs to be done. If -not, they should at least have been placed somewhere in your -@code{load-path}. You can then load them by placing the lines - -@example -(load "auctex.el" nil t t) -(load "preview-latex.el" nil t t) -@end example - -into your init file. - -If you explicitly used @code{--with-lispdir}, you may need to add the -specified directory into Emacs' @code{load-path} variable by adding -something like - -@example -(add-to-list 'load-path "~/elisp") -@end example - -before the above lines into your Emacs startup file. - -For site-wide activation in GNU Emacs, see -@ifset rawfile -below. -@end ifset -@ifclear rawfile -@xref{Advice for package providers}. -@end ifclear - -Once activated, the modes provided by @AUCTeX{} are used per default for -all supported file types. If you want to change the modes for which it -is operative instead of the default, use -@example -@kbd{M-x customize-variable @key{RET} TeX-modes @key{RET}} -@end example - -If you want to remove a preinstalled @AUCTeX{} completely before any of -its modes have been used, -@example -(unload-feature 'tex-site) -@end example -should accomplish that. - -@node Advice for package providers -@section Providing @AUCTeX{} as a package - -As a package provider, you should make sure that your users will be -served best according to their intentions, and keep in mind that a -system might be used by more than one user, with different -preferences. - -There are people that prefer the built-in Emacs modes for editing -@TeX{} files, in particular plain @TeX{} users. There are various -ways to tell @AUCTeX{} even after auto-activation that it should -not get used, and they are described in -@ifset rawfile -the @file{README} file. -@end ifset -@ifclear rawfile -@ref{Introduction,,Introduction to @AUCTeX{}}. -@end ifclear - -So if you have users that don't want to use the preinstalled @AUCTeX{}, -they can easily get rid of it. Activating @AUCTeX{} by default is -therefore a good choice. - -If the installation procedure did not achieve this already by placing -@file{auctex.el} and @file{preview-latex.el} into a possibly existing -@file{site-start.d} directory, you can do this by placing - -@example -(load "auctex.el" nil t t) -(load "preview-latex.el" nil t t) -@end example - -@noindent in the system-wide @file{site-start.el}. - -If your package is intended as an XEmacs package or to accompany a -precompiled version of Emacs, you might not know which @TeX{} system -will be available when @previewlatex{} gets used. In this case you -should build using the @code{--without-texmf-dir} option described -previously. This can also be convenient for systems that are intended -to support more than a single TeX distribution. Since more often than -not @TeX{} packages for operating system distributions are either much -more outdated or much less complete than separately provided systems -like @w{@TeX{} Live}, this method may be generally preferable when -providing packages. - -The following package structure would be adequate for a typical fully -supported Unix-like installation: - -@table @samp -@item preview-tetex -Style files and documentation for @file{preview.sty}, placed into a -@TeX{} tree where it is accessible from the te@TeX{} executables usually -delivered with a system. If there are other commonly used @TeX{} system -packages, it might be appropriate to provide separate packages for -those. -@item auctex-emacs-tetex -This package will require the installation of @samp{preview-tetex} and -will record in @samp{TeX-macro-global} where to find the @TeX{} tree. -It is also a good idea to run -@example -emacs -batch -f TeX-auto-generate-global -@end example -when either @AUCTeX{} or te@TeX{} get installed or upgraded. If your -users might want to work with a different @TeX{} distribution (nowadays -pretty common), instead consider the following: -@item auctex-emacs -This package will be compiled with @samp{--without-texmf-dir} and will -consequently contain the @samp{preview} style files in its private -directory. It will probably not be possible to initialize -@samp{TeX-macro-global} to a sensible value, so running -@samp{TeX-auto-generate-global} does not appear useful. This package -would neither conflict with nor provide @samp{preview-tetex}. -@item auctex-xemacs-tetex -@itemx auctex-xemacs -Those are the obvious XEmacs equivalents. For XEmacs, there is the -additional problem that the XEmacs sumo package tree already possibly -provides its own version of @AUCTeX{}, and the user might even have used -the XEmacs package manager to updating this package, or even installing -a private @AUCTeX{} version. So you should make sure that such a -package will not conflict with existing XEmacs packages and will be -at an appropriate place in the load order (after site-wide and -user-specific locations, but before a distribution-specific sumo package -tree). Using the @code{--without-packagedir} option might be one idea -to avoid conflicts. Another might be to refrain from providing an -XEmacs package and just rely on the user or system administrator to -instead use the XEmacs package system. -@end table - -@node Advice for non-privileged users -@section Installation for non-privileged users - -Often people without system administration privileges want to install -software for their private use. In that case you need to pass more -options to the @command{configure} script. For XEmacs users, this is -fairly easy, because the XEmacs package system has been designed to make -this sort of thing practical: but GNU Emacs users (and XEmacs users for -whom the package system is for some reason misbehaving) may need to do a -little more work. - -The main expedient is using the @option{--prefix} option to the -@file{configure} script, and let it point to the personal home -directory. In that way, resulting binaries will be installed under the -@file{bin} subdirectory of your home directory, manual pages under -@file{man} and so on. It is reasonably easy to maintain a bunch of -personal software, since the prefix argument is supported by most -@file{configure} scripts. - -You'll have to add something like -@file{/home/myself/share/emacs/site-lisp} to your @code{load-path} -variable, if it isn't there already. - -XEmacs users can achieve the same end by pointing @command{configure} at an -appropriate package directory (normally -@option{--with-packagedir=~/.xemacs/xemacs-packages} will serve). The -package directory stands a good chance at being detected automatically -as long as it is in a subtree of the specified @var{prefix}. - -Now here is another thing to ponder: perhaps you want to make it easy -for other users to share parts of your personal Emacs configuration. In -general, you can do this by writing @samp{~myself/} anywhere where you -specify paths to something installed in your personal subdirectories, -not merely @samp{~/}, since the latter, when used by other users, will -point to non-existent files. - -For yourself, it will do to manipulate environment variables in your -@file{.profile} resp.@: @file{.login} files. But if people will be -copying just Elisp files, their copies will not work. While it would -in general be preferable if the added components where available from -a shell level, too (like when you call the standalone info reader, or -try using @file{preview.sty} for functionality besides of Emacs -previews), it will be a big help already if things work from inside -of Emacs. - -Here is how to do the various parts: - -@subheading Making the Elisp available - -In GNU Emacs, it should be sufficient if people just do - -@lisp -(load "~myself/share/emacs/site-lisp/auctex.el" nil t t) -(load "~myself/share/emacs/site-lisp/preview-latex.el" nil t t) -@end lisp - -where the path points to your personal installation. The rest of the -package should be found relative from there without further ado. - -In XEmacs, you should ask the other users to add symbolic links in the -subdirectories @file{lisp}, @file{info} and @file{etc} of their -@file{~/.xemacs/xemacs-packages/} directory. (Alas, there is presently -no easy programmatic way to do this, except to have a script do the -symlinking for them.) - -@subheading Making the Info files available - -For making the info files accessible from within Elisp, something like -the following might be convenient to add into your or other people's -startup files: - -@lisp -(eval-after-load 'info - '(add-to-list 'Info-directory-list "~myself/info")) -@end lisp - -In XEmacs, as long as XEmacs can see the package, there should be no -need to do anything at all; the info files should be immediately -visible. However, you might want to set @env{INFOPATH} anyway, for the -sake of standalone readers outside of XEmacs. (The info files in XEmacs -are normally in @file{~/.xemacs/xemacs-packages/info}.) - -@subheading Making the @LaTeX{} style available - -If you want others to be able to share your installation, you should -configure it using @samp{--without-texmf-dir}, in which case things -should work as well for them as for you. - -@ifclear rawfile -@node Installation under MS Windows -@section Installation under MS Windows -@include wininstall.texi -@end ifclear - -@node Customizing -@section Customizing -@cindex Site initialization -@cindex Initialization -@cindex @file{tex-site.el} -@cindex Personal customization -@cindex Site customization -@cindex Customization -@cindex Customization, personal -@cindex Customization, site -Most of the site-specific customization should already have happened -during configuration of @AUCTeX{}. Any further customization can be -done with customization buffers directly in Emacs. Just type @kbd{M-x -customize-group RET AUCTeX RET} to open the customization group for -@AUCTeX{} or use the menu entries provided in the mode menus. Editing -the file @file{tex-site.el} as suggested in former versions of @AUCTeX{} -should not be done anymore because the installation routine will -overwrite those changes. - -You might check some variables with a special significance. They are -accessible directly by typing @kbd{M-x customize-variable RET -RET}. - -@defopt TeX-macro-global -Directories containing the site's @TeX{} style files. -@end defopt - -Normally, @AUCTeX{} will only allow you to complete macros and -environments which are built-in, specified in @AUCTeX{} style files or -defined by yourself. If you issue the @kbd{M-x -TeX-auto-generate-global} command after loading @AUCTeX{}, you will be -able to complete on all macros available in the standard style files -used by your document. To do this, you must set this variable to a list -of directories where the standard style files are located. The -directories will be searched recursively, so there is no reason to list -subdirectories explicitly. Automatic configuration will already have -set the variable for you if it could use the program @samp{kpsewhich}. -In this case you normally don't have to alter anything. diff --git a/packages/auctex/doc/intro.texi b/packages/auctex/doc/intro.texi deleted file mode 100644 index 0a23200b5..000000000 --- a/packages/auctex/doc/intro.texi +++ /dev/null @@ -1,106 +0,0 @@ -@include macros.texi -@ifset rawfile -@paragraphindent none -This is the README file for the AUCTeX distribution. - -@quotation -Copyright (C) 2008 Free Software Foundation, Inc. - -Copying and distribution of this file, with or without modification, are -permitted in any medium without royalty provided the copyright notice -and this notice are preserved. -@end quotation - -@chapheading Introduction to @AUCTeX{} -@end ifset - -@ifclear rawfile -@node Summary -@chapter Overview of @AUCTeX{} -@end ifclear - -@ifset rawfile -This file gives a brief overview of what @AUCTeX{} is. It is -@strong{not} an attempt to document @AUCTeX{}. Real documentation for -@AUCTeX{} is available in the manual, which should be available as an -info file after installation. -@end ifset - -@AUCTeX{} is a comprehensive customizable integrated environment for -writing input files for @TeX{}, @LaTeX{}, @ConTeXt{}, Texinfo, and -doc@TeX{} using Emacs or XEmacs. - -It supports you in the insertion of macros, environments, and sectioning -commands by providing completion alternatives and prompting for -parameters. It automatically indents your text as you type it and lets -you format a whole file at once. The outlining and folding facilities -provide you with a focused and clean view of your text. - -@AUCTeX{} lets you process your source files by running @TeX{} and -related tools (such as output filters, post processors for generating -indices and bibliographies, and viewers) from inside Emacs. @AUCTeX{} -lets you browse through the errors @TeX{} reported, while it moves the -cursor directly to the reported error, and displays some documentation -for that particular error. This will even work when the document is -spread over several files. - -One component of @AUCTeX{} that @LaTeX{} users will find attractive is -@previewlatex{}, a combination of folding and in-source previewing -that provides true ``What You See Is What You Get'' experience in your -sourcebuffer, while letting you retain full control. -@ifset rawfile -For more information, see further below. -@end ifset - -More detailed information about the features and usage of @AUCTeX{} can -be found in the -@ifset rawfile -@AUCTeX{} manual. You can access it from within Emacs by typing -@kbd{C-h i d m auctex @key{RET}}. If you prefer the standalone info -reader, issue the command @code{info auctex} in a terminal. -@end ifset -@ifclear rawfile -remainder of this manual. -@end ifclear - -@AUCTeX{} is written entirely in Emacs Lisp, and hence you can easily -add new features for your own needs. It is a GNU project and -distributed under the `GNU General Public License Version 3'. - -The most recent version is always available at -@url{http://ftp.gnu.org/pub/gnu/auctex/}. - -WWW users may want to check out the @AUCTeX{} page at -@url{http://www.gnu.org/software/auctex/}. - -For comprehensive information about how to install @AUCTeX{} -@ifset rawfile -read the file @file{INSTALL} or @file{INSTALL.windows}, respectively. -@end ifset -@ifclear rawfile -@xref{Installation}, or @ref{Installation under MS Windows}, -respectively. -@end ifclear - -If you are considering upgrading @AUCTeX{}, the recent changes are -described in -@ifset rawfile -the @file{CHANGES} file. -@end ifset -@ifclear rawfile -@ref{Changes}. -@end ifclear - -If you want to discuss @AUCTeX{} with other users or its developers, -there are several mailing lists you can use. - -Send a mail with the subject ``subscribe'' to -@email{auctex-request@@gnu.org} in order to join the general discussion -list for @AUCTeX{}. Articles should be sent to @email{auctex@@gnu.org}. -In a similar way, you can subscribe to the @email{info-auctex@@gnu.org} -list for just getting important announcements about @AUCTeX{}. The list -@email{bug-auctex@@gnu.org} is for bug reports which you should usually -file with the @kbd{M-x TeX-submit-bug-report @key{RET}} command. If you -want to address the developers of @AUCTeX{} themselves with technical -issues, they can be found on the discussion list -@email{auctex-devel@@gnu.org}. diff --git a/packages/auctex/doc/macros.texi b/packages/auctex/doc/macros.texi deleted file mode 100644 index 36938ff39..000000000 --- a/packages/auctex/doc/macros.texi +++ /dev/null @@ -1,82 +0,0 @@ -@ifclear macros -@set macros -@ifnottex -@macro AUCTeX {} -AUC@TeX{} -@end macro -@macro ConTeXt {} -Con@TeX{}t -@end macro -@macro LaTeX {} -La@TeX{} -@end macro -@macro previewlatex {} -preview-latex -@end macro -@macro fontlatex {} -font-latex -@end macro -@ifset no-acronym -@clear no-acronym -@macro acronym {text} -@sc{\text\} -@end macro -@end ifset -@ifset no-env -@clear no-env -@macro env {text} -@code{\text\} -@end macro -@end ifset -@ifset no-option -@clear no-option -@macro option {text} -@samp{\text\} -@end macro -@end ifset -@ifset no-command -@clear no-command -@macro command {text} -@samp{\text\} -@end macro -@end ifset -@end ifnottex -@macro sans {text}@c -@iftex -{@textsf \text\}@c -@end iftex -@ifnottex -\text\@c -@end ifnottex -@end macro -@tex -\global\let\savedTeX\TeX -\gdef\TeX#1{\savedTeX#1} -\gdef\LaTeX{% - L\kern-.36em\raise.3ex\hbox{\sc{a}}\kern-.15em\TeX} -\gdef\previewlatex#1{% - {\sf preview-latex}#1} -\gdef\fontlatex#1{% - {\sf font-latex}#1} -\gdef\AUCTeX{AUC\TeX} -\gdef\ConTeXt#1{% - Con\TeX t#1} -\toks0\expandafter{\indexnofonts - \def\TeX#1{TeX#1}% - \def\LaTeX#1{LaTeX#1}\def\previewlatex#1{preview-latex#1}} -\xdef\indexnofonts{\the\toks0} -\toks0\expandafter{\commondummies - \def\TeX#1{TeX#1}% - \def\LaTeX#1{LaTeX#1}\def\previewlatex#1{preview-latex#1}} -\xdef\commondummies{\the\toks0} -\ifx\acronym\undefined \gdef\acronym#1{{\smallcaps \lowercase{#1}}} \fi -\ifx\env\undefined \global\let\env=\code \fi -\ifx\option\undefined \global\let\option=\samp \fi -\ifx\command\undefined \global\let\command=\samp \fi -%Bug fix for texinfo.tex: -\gdef\cslet#1#2{% -\expandafter\let -\csname#1\expandafter\endcsname -\csname#2\endcsname} -@end tex -@end ifclear diff --git a/packages/auctex/doc/preview-dtxdoc.texi b/packages/auctex/doc/preview-dtxdoc.texi deleted file mode 100644 index a6cd64950..000000000 --- a/packages/auctex/doc/preview-dtxdoc.texi +++ /dev/null @@ -1,488 +0,0 @@ -The main purpose of this package is the extraction of certain -environments (most notably displayed formulas) from @LaTeX{} sources -as graphics. This works with @acronym{DVI} files postprocessed by either -Dvips and Ghostscript or dvipng, but it also works when you are -using PDF@TeX{} for generating PDF files (usually also postprocessed -by Ghostscript). - -Current uses of the package include the @previewlatex{} package for -WYSIWYG functionality in the @AUCTeX{} editing environment, -generation of previews in LyX, as part of the operation of the -ps4pdf package, the tbook XML system and some other tools. - -Producing @acronym{EPS} files with Dvips and its derivatives using the -@option{-E} option is not a good alternative: People make do by -fiddling around with @code{\thispagestyle@{empty@}} and hoping for the best -(namely, that the specified contents will indeed fit on single -pages), and then trying to guess the baseline of the resulting code -and stuff, but this is at best dissatisfactory. The preview package -provides an easy way to ensure that exactly one page per request -gets shipped, with a well-defined baseline and no page decorations. -While you still can use the preview package with the `classic' - -@example -dvips -E -i -@end example - -@noindent -invocation, there are better ways available that don't rely on Dvips -not getting confused by PostScript specials. - -For most applications, you'll want to make use of the @code{tightpage} -option. This will embed the page dimensions into the PostScript or -PDF code, obliterating the need to use the @code{-E -i} options to Dvips. -You can then produce all image files with a single run of -Ghostscript from a single PDF or PostScript (as opposed to @acronym{EPS}) -file. - -Various options exist that will pass @TeX{} dimensions and other -information about the respective shipped out material (including -descender size) into the log file, where external applications might -make use of it. - -The possibility for generating a whole set of graphics with a single -run of Ghostscript (whether from @LaTeX{} or PDF@LaTeX{}) increases -both speed and robustness of applications. It is also feasible to -use dvipng on a @acronym{DVI} file with the options - -@example --picky -noghostscript -@end example - -@noindent -to omit generating any image file that requires Ghostscript, then -let a script generate all missing files using Dvips/Ghostscript. -This will usually speed up the process significantly. - -@menu -* Package options:: -* Provided commands:: -@end menu - -@node Package options, Provided commands, The LaTeX style file, The LaTeX style file -@subsection Package options -The package is included with the customary - -@example -\usepackage[@var{options}]@{preview@} -@end example - -@noindent -You should usually load this package as the last one, since it -redefines several things that other packages may also provide. - -The following options are available: - -@table @w -@item @code{active} -is the most essential option. If this option is not -specified, the @code{preview} package will be inactive and the document -will be typeset as if the @code{preview} package were not loaded, -except that all declarations and environments defined by the -package are still legal but have no effect. This allows defining -previewing characteristics in your document, and only activating -them by calling @LaTeX{} as - -@example -latex '\PassOptionsToPackage@{active@}@{preview@} \input@{@var{filename}@}' -@end example - -@item @code{noconfig} -Usually the file @file{prdefault.cfg} gets loaded -whenever the @code{preview} package gets activated. @file{prdefault.cfg} is -supposed to contain definitions that can cater for otherwise bad -results, for example, if a certain document class would otherwise -lead to trouble. It also can be used to override any settings -made in this package, since it is loaded at the very end of it. -In addition, there may be configuration files specific for certain -@code{preview} options like @code{auctex} which have more immediate needs. -The @code{noconfig} option suppresses loading of those option files, -too. -@item @code{psfixbb} -Dvips determines the bounding boxes from the -material in the @acronym{DVI} file it understands. Lots of PostScript -specials are not part of that. Since the @TeX{} boxes do not make -it into the @acronym{DVI} file, but merely characters, rules and specials -do, Dvips might include far too small areas. The option @code{psfixbb} -will include @file{/dev/null} as a graphic file in the ultimate upper -left and lower right corner of the previewed box. This will make -Dvips generate an appropriate bounding box. -@item @code{dvips} -If this option is specified as a class option or to -other packages, several packages pass things like page size -information to Dvips, or cause crop marks or draft messages -written on pages. This seriously hampers the usability of -previews. If this option is specified, the changes will be undone -if possible. -@item @code{pdftex} -If this option is set, PDF@TeX{} is assumed as the -output driver. This mainly affects the @code{tightpage} option. -@item @code{xetex} -If this option is set, Xe@TeX{} is assumed as the -output driver. This mainly affects the @code{tightpage} option. -@item @code{displaymath} -will make all displayed math environments -subject to preview processing. This will typically be the most -desired option. -@item @code{floats} -will make all float objects subject to preview -processing. If you want to be more selective about what floats to -pass through to a preview, you should instead use the -@code{\PreviewSnarfEnvironment} command on the floats you want to -have previewed. -@item @code{textmath} -will make all text math subject to previews. -Since math mode is used throughly inside of @LaTeX{} even for other -purposes, this works by redefining @code{\(}, @code{\)} -and @code{$} and the @code{math} environment (apparently some people use -that). Only occurences of these text math delimiters in later -loaded packages and in the main document will thus be affected. -@item @code{graphics} -will subject all @code{\includegraphics} commands -to a preview. -@item @code{sections} -will subject all section headers to a preview. -@item @code{delayed} -will delay all activations and redefinitions the -@code{preview} package makes until @code{\}@code{begin@{document@}}. The purpose -of this is to cater for documents which should be subjected to the -@code{preview} package without having been prepared for it. You can -process such documents with - -@example -latex '\RequirePackage[active,delayed,@var{options}]@{preview@} -\input@{@var{filename}@}' -@end example - -@noindent -This relaxes the requirement to be loading the @code{preview} package -as last package. -@item @var{driver} -loads a special driver file -@file{pr@var{driver}.def}. The remaining options are implemented -through the use of driver files. -@item @code{auctex} -This driver will produce fake error messages at the -start and end of every preview environment that enable the Emacs -package @previewlatex{} in connection with @AUCTeX{} to pinpoint -the exact source location where the previews have originated. -Unfortunately, there is no other reliable means of passing the -current @TeX{} input position @emph{in} a line to external -programs. In order to make the parsing more robust, this option -also switches off quite a few diagnostics that could be -misinterpreted. - -You should not specify this option manually, since it will only be -needed by automated runs that want to parse the pseudo error -messages. Those runs will then use @code{\PassOptionsToPackage} in -order to effect the desired behaviour. In addition, -@file{prauctex.cfg} will get loaded unless inhibited by the @code{noconfig} -option. This caters for the most frequently encountered -problematic commands. -@item @code{showlabels} -During the editing process, some people like to -see the label names in their equations, figures and the like. Now -if you are using Emacs for editing, and in particular -@previewlatex{}, I'd strongly recommend that you check out the -Ref@TeX{} package which pretty much obliterates the need for this -kind of functionality. If you still want it, standard @LaTeX{} -provides it with the @code{showkeys} package, and there is also the -less encompassing @code{showlabels} package. Unfortunately, since -those go to some pain not to change the page layout and spacing, -they also don't change @code{preview}'s idea of the @TeX{} dimensions of -the involved boxes. So if you are using @code{preview} for determing -bounding boxes, those packages are mostly useless. The option -@code{showlabels} offers a substitute for them. -@item @code{tightpage} -It is not uncommon to want to use the results of -@code{preview} as graphic images for some other application. One -possibility is to generate a flurry of @acronym{EPS} files with - -@example -dvips -E -i -Pwww -o @var{outputfile}.000 @var{inputfile} -@end example - -@noindent -However, in case those are to be processed further into graphic -image files by Ghostscript, this process is inefficient since all -of those files need to be processed one by one. In addition, it -is necessary to extract the bounding box comments from the @acronym{EPS} -files and convert them into page dimension parameters for -Ghostscript in order to avoid full-page graphics. This is not -even possible if you wanted to use Ghostscript in a@w{ }@emph{single} -run for generating the files from a single PostScript file, since -Dvips will in that case leave no bounding box information -anywhere. - -The solution is to use the @code{tightpage} option. That way a single -command line like - -@example -@option{gs -sDEVICE=png16m -dTextAlphaBits=4 -r300 --dGraphicsAlphaBits=4 -dSAFER -q -dNOPAUSE --sOutputFile=@var{outputfile}%d.png @var{inputfile}.ps} -@end example - -@noindent -will be able to produce tight graphics from a single PostScript -file generated with Dvips @emph{without} use of the options -@code{-E -i}, in a single run. - -The @code{tightpage} option actually also works when using the @code{pdftex} -option and generating PDF files with PDF@TeX{}. The resulting PDF -file has separate page dimensions for every page and can directly -be converted with one run of Ghostscript into image files. - -If neither @code{dvips} or @code{pdftex} have been specified, the -corresponding option will get autodetected and invoked. - -If you need this in a batch environment where you don't want to -use @code{preview}'s automatic extraction facilities, no problem: just -don't use any of the extraction options, and wrap everything to be -previewed into @code{preview} environments. This is how LyX does its -math previews. - -If the pages under the @code{tightpage} option are just too tight, you -can adjust by setting the length @code{\PreviewBorder} to a different -value by using @code{\setlength}. The default value is -@file{0.50001bp}, which is half of a usual PostScript point, rounded -up. If you go below this value, the resulting page size may drop -below @code{1bp}, and Ghostscript does not seem to like that. If you -need finer control, you can adjust the bounding box dimensions -individually by changing the macro @code{\PreviewBbAdjust} with the -help of @code{\renewcommand}. Its default value is - -@example -\newcommand \PreviewBbAdjust -@{-\PreviewBorder -\PreviewBorder -\PreviewBorder \PreviewBorder@} -@end example - -@noindent -This adjusts the left, lower, right and upper borders by the given -amount. The macro must contain 4@w{ }@TeX{} dimensions after another, -and you may not omit the units if you specify them explicitly -instead of by register. PostScript points have the unit@w{ }@code{bp}. -@item @code{lyx} -This option is for the sake of LyX developers. It will -output a few diagnostics relevant for the sake of LyX' preview -functionality (at the time of writing, mostly implemented for math -insets, in versions of LyX starting with 1.3.0). -@item @code{counters} -This writes out diagnostics at the start and the -end of previews. Only the counters changed since the last output -get written, and if no counters changed, nothing gets written at -all. The list consists of counter name and value, both enclosed -in @code{@{@}} braces, followed by a space. The last such pair is -followed by a colon (@code{:}) if it is at the start of the preview -snippet, and by a period (@file{.}) if it is at the end. The order of -different diagnostics like this being issued depends on the order -of the specification of the options when calling the package. - -Systems like @previewlatex{} use this for keeping counters accurate -when single previews are regenerated. -@item @code{footnotes} -This makes footnotes render as previews, and only -as their footnote symbol. A convenient editing feature inside of -Emacs. -@end table - -The following options are just for debugging purposes of the package -and similar to the corresponding @TeX{} commands they allude to: - -@table @w -@item @code{tracingall} -causes lots of diagnostic output to appear in -the log file during the preview collecting phases of @TeX{}'s -operation. In contrast to the similarly named @TeX{} command, it -will not switch to @code{\errorstopmode}, nor will it change the -setting of @code{\tracingonline}. -@item @code{showbox} -This option will show the contents of the boxes -shipped out to the @acronym{DVI} files. It also sets @code{\showboxbreadth} and -@code{\showboxdepth} to their maximum values at the end of loading this -package, but you may reset them if you don't like that. -@end table - -@node Provided commands, ,Package options, The LaTeX style file -@subsection Provided commands - -@table @code -@item \begin@{preview@}@dots{}\end@{preview@} -The @code{preview} environment causes its contents -to be set as a single preview image. Insertions like figures and -footnotes (except those included in minipages) will typically lead -to error messages or be lost. In case the @code{preview} package has not -been activated, the contents of this environment will be typeset -normally. - -@item \begin@{nopreview@}@dots{}\end@{nopreview@} -The @code{nopreview} environment will cause its -contents not to undergo any special treatment by the @code{preview} -package. When @code{preview} is active, the contents will be discarded -like all main text that does not trigger the @code{preview} hooks. When -@code{preview} is not active, the contents will be typeset just like the -main text. - -Note that both of these environments typeset things as usual when -preview is not active. If you need something typeset conditionally, -use the @code{\ifPreview} conditional for it. - -@item \PreviewMacro -If you want to make a macro like -@findex \PreviewMacro -@code{\includegraphics} (actually, this is what is done by the -@code{graphics} option to @code{preview}) produce a preview image, you put a -declaration like - -@example -\PreviewMacro[*[[!]@{\includegraphics@} -@end example - -@noindent -or, more readable, - -@example -\PreviewMacro[@{*[][]@{@}@}]@{\includegraphics@} -@end example - -@noindent -into your preamble. The optional argument to @code{\PreviewMacro} -specifies the arguments @code{\includegraphics} accepts, since this -is necessary information for properly ending the preview box. Note -that if you are using the more readable form, you have to enclose -the argument in a @code{[@{} and @code{@}]} pair. The inner braces are -necessary to stop any included @code{[]} pairs from prematurely ending -the optional argument, and to make a single @code{@{@}} -denoting an optional argument not get stripped away by @TeX{}'s -argument parsing. - -The letters simply mean - -@table @w -@item @code{*} -indicates an optional @code{*} modifier, as in -@code{\includegraphics*}. -@item @code{[} -^^A] -indicates an optional argument in brackets. This syntax -is somewhat baroque, but brief. -@item @code{[]} -also indicates an optional argument in brackets. Be -sure to have encluded the entire optional argument specification -in an additional pair of braces as described above. -@item @code{!} -indicates a mandatory argument. -@item @code{@{@}} -indicates the same. Again, be sure to have -that additional level of braces around the whole argument -specification. -@item @code{?}@var{delimiter}@{@var{true case}@}@{@var{false case}@} -is a -conditional. The next character is checked against being equal to -@var{delimiter}. If it is, the specification @var{true case} is -used for the further parsing, otherwise @var{false case} will be -employed. In neither case is something consumed from the input, -so @{@var{true case}@} will still have to deal with the upcoming -delimiter. -@item @code{@@}@{@var{literal sequence}@} -will insert the given sequence -literally into the executed call of the command. -@item @code{-} -will just drop the next token. It will probably be most -often used in the true branch of a @code{?} specification. -@item @code{#}@{@var{argument}@}@{@var{replacement}@} -is a transformation -rule that calls a macro with the given argument and replacement -text on the rest of the argument list. The replacement is used in -the executed call of the command. This can be used for parsing -arbitrary constructs. For example, the @code{[]} option could manually -be implemented with the option string @code{?[@{#@{[#1]@}@{[@{#1@}]@}@}@{@}}. -PStricks users might enjoy this sort of flexibility. -@item @code{:}@{@var{argument}@}@{@var{replacement}@} -is again a -transformation rule. As opposed to @code{#}, however, the result of -the transformation is parsed again. You'll rarely need this. -@end table - - -There is a second optional argument in brackets that can be used to -declare any default action to be taken instead. This is mostly for -the sake of macros that influence numbering: you would want to keep -their effects in that respect. The default action should use @code{#1} -for referring to the original (not the patched) command with the -parsed options appended. Not specifying a second optional argument -here is equivalent to specifying@w{ }@code{[#1]}. - -@item \PreviewMacro* -A similar invocation -@code{\PreviewMacro*} simply throws the macro and all of its -arguments declared in the manner above away. This is mostly useful -for having things like @code{\footnote} not do their magic on their -arguments. More often than not, you don't want to declare any -arguments to scan to @code{\PreviewMacro*} since you would want the -remaining arguments to be treated as usual text and typeset in that -manner instead of being thrown away. An exception might be, say, -sort keys for @code{\cite}. - -A second optional argument in brackets can be used to declare any -default action to be taken instead. This is for the sake of macros -that influence numbering: you would want to keep their effects in -that respect. The default action might use @code{#1} for referring to -the original (not the patched) command with the parsed options -appended. Not specifying a second optional argument here is -equivalent to specifying@w{ }@code{[]} since the command usually gets thrown -away. - -As an example for using this argument, you might want to specify - -@example -\PreviewMacro*\footnote[@{[]@}][#1@{@}] -@end example - -@noindent -This will replace a footnote by an empty footnote, but taking any -optional parameter into account, since an optional paramter changes -the numbering scheme. That way the real argument for the footnote -remains for processing by @previewlatex{}. - -@item \PreviewEnvironment -The macro -@findex \PreviewEnvironment -@code{\PreviewEnvironment} works just as @code{\PreviewMacro} does, -only for environments. @item \PreviewEnvironment* -And the -same goes for @code{\PreviewEnvironment*} as compared to -@code{\PreviewMacro*}. - -@item \PreviewSnarfEnvironment -This macro does not typeset -the original environment inside of a preview box, but instead -typesets just the contents of the original environment inside of the -preview box, leaving nothing for the original environment. This has -to be used for figures, for example, since they would - -@enumerate -@item produce insertion material that cannot be extracted to the -preview properly, -@item complain with an error message about not being in outer par -mode. -@end enumerate - - -@item \PreviewOpen -@item \PreviewClose -Those Macros form a matched preview pair. This is for macros that -behave similar as @code{\begin} and @code{\end} of an environment. It -is essential for the operation of @code{\PreviewOpen} that the macro -treated with it will open an additional group even when the preview -falls inside of another preview or inside of a @code{nopreview} -environment. Similarly, the macro treated with @code{PreviewClose} -will close an environment even when inactive. - -@item \ifPreview -In case you need to know whether -@code{preview} is active, you can use the conditional @code{\ifPreview} -together with @code{\else} and @code{\fi}. - -@end table diff --git a/packages/auctex/doc/preview-faq.texi b/packages/auctex/doc/preview-faq.texi deleted file mode 100644 index 7e23b4b46..000000000 --- a/packages/auctex/doc/preview-faq.texi +++ /dev/null @@ -1,340 +0,0 @@ -@c This is part of the preview-latex manual. -@c Copyright (C) 2002, 2003, 2004, 2005, 2006, 2009 Free Software -@c Foundation, Inc. -@c See file preview-latex.texi for copying conditions. -@ifset rawfile -@include macros.texi - -@node Frequently Asked Questions, Introduction to FAQ, (dir), (dir) -@top Frequently Asked Questions about @previewlatex{} - -@contents - -@end ifset - -@menu -* Introduction to FAQ:: -* Requirements:: -* Installation Trouble:: -* Customization:: -* Troubleshooting:: -* Other formats:: -@end menu - -@comment we need at least one chapter, or the numbers disappear in the -@comment plain version of the FAQ. - -@ifset rawfile -@node Introduction to FAQ, Requirements, Frequently Asked Questions, Frequently Asked Questions -@chapter Introduction -@raisesections -@end ifset -@ifclear rawfile -@node Introduction to FAQ, Requirements, Frequently Asked Questions, Frequently Asked Questions -@section Introduction -@end ifclear - -@subsection How can I contribute to the FAQ? - -Send an email with the subject: -@example -Preview FAQ -@end example -to @email{auctex-devel@@gnu.org}. - -@node Requirements, Installation Trouble, Introduction to FAQ, Frequently Asked Questions -@section Requirements - -@subsection Which version of (X)Emacs is needed? -See also the table at the end of the section. - -@previewlatex{} nominally requires @w{GNU Emacs} with a version of at -least 21.1. However, @w{Emacs 22} (currently under development) offers -superior performance and wider platform support, and is even now the -recommended platform to use. - -While recent versions of @w{XEmacs 21.4} are supported, doing this in a -satisfactory manner has proven to be difficult due to technical -shortcomings and differing API's which are hard to come by. If -@previewlatex{} is an important part of your editing workflow, you are -likely to get better results and support by switching to Emacs. Of -course, you can improve support for your favorite editor by giving -feedback in case you encounter bugs. - -@subsection Which versions of Ghostscript and @AUCTeX{} are needed? - -We recommend to use GNU or AFPL Ghostscript with a version of at least -7.07. - -@previewlatex{} has been distributed as part of @AUCTeX{} since version -11.80. If your version of @AUCTeX{} is older than that, or if it does -not contain a working copy of @previewlatex{}, complain to wherever you -got it from. - -@subsection I have trouble with the display format... -We recommend keeping the variable @code{preview-image-type} set to -@code{dvipng} (if you have it installed) or @code{png}. This is the -default and can be set via the Preview/Customize menu. - -All other formats are known to have inconveniences, either in file size -or quality. There are some Emacs versions around not supporting -@acronym{PNG}; the proper way to deal with that is to complain to your -Emacs provider. Short of that, checking out @acronym{PNM} or -@acronym{JPEG} formats might be a good way to find out whether the lack -of @acronym{PNG} format support might be the only problem with your -Emacs. - -@subsection For which OS does preview work? - -It is known to work under the X Window System for Linux and for several -flavors of Unix: we have reports for HP and Solaris. - -There are several development versions of Emacs around for native MacOS -Carbon, and @previewlatex{} is working with them, too. - -With Windows, Cygwin and native ports of XEmacs should work. -@previewlatex{} will not work with any native version 21 of Emacs under -Windows: you need to get a hold of @w{Emacs 22} which is at the time of -this writing not released but available as a developer snapshot. - -The entry "X11/Unix" currently means Linux, Solaris or HP/UX, as well as -the X-specific version for Mac/OSX. - -@multitable {Win9x native} {Emacs version} {XEmacs version} -@item OS @tab Emacs version @tab XEmacs version -@item X11/Unix @tab 21.1 @tab 21.4.9 -@item Win9x cygwin @tab 21.3.50? @tab 21.4.8 -@item Win9x native @tab 22.1 @tab 21.4.8 -@item MacOSX native @tab 22.1 @tab -- -@end multitable - -@node Installation Trouble, Customization, Requirements, Frequently Asked Questions -@section Installation Trouble - -@subsection I just get @samp{LaTeX found no preview images}. - -The reason for this is that @LaTeX{} found no preview images in the -document in question. - -One reason might be that there are no previews to be seen. If you have -not used @previewlatex{} before, you might not know its manner of -operation. One sure-fire way to test if you just have a document where -no previews are to be found is to use the provided example document -@file{circ.tex} (you will have to copy it to some directory where you -have write permissions). If the symptom persists, you have a problem, -and the problem is most likely a @LaTeX{} problem. Here are possible -reasons: - -@table @asis - -@item Filename database not updated -Various @TeX{} distributions have their own ways of knowing where the -files are without actually searching directories. The normal -@previewlatex{} installation should detect common tools for that purpose -and use them. If this goes wrong, or if the files get installed into a -place where they are not looked for, the @LaTeX{} run will fail. - -@item An incomplete manual installation -This should not happen if you followed installation instructions. -Unfortunately, people know better all the time. If only -@file{preview.sty} gets installed without a set of supplementary files -also in the @file{latex} subdirectory, @previewlatex{} runs will not -generate any errors, but they will not produce any previews, either. - -@item An outdated @file{preview} installation -The @file{preview.sty} package is useful for more than just -@previewlatex{}. For example, it is part of @TeX{}live. So you have -to make sure that @previewlatex{} does not get to work with outdated -style and configuration files: some newer features will not work with -older @TeX{} style files, and really old files will make -@previewlatex{} fail completely. There usual is a local @file{texmf} -tree, or even a user-specific tree that are searched before the default -tree. Make sure that the first version of those files that gets found -is the correct one. -@end table - -@subsection I have problems with the XEmacs installation -Please note that the XEmacs installation is different, since XEmacs has -a package system that gets used here. Please make sure that you read -and follow the installation instructions for XEmacs. - -@node Customization, Troubleshooting, Installation Trouble, Frequently Asked Questions -@section Customization - -@subsection Why don't I get balloon help like in the screen shots? - -Some users have reported problems with their XEmacs version, so balloon -help is no longer switched on by default. Use the Preview/Customize -menu or @kbd{@key{M-x} customize-variable} in order to customize -@code{preview-use-balloon-help} to `On'. This only concerns XEmacs: -tooltips under @w{GNU Emacs} are enabled by default and unproblematic. - -@subsection How to include additional environments like @code{enumerate} - -By default, @previewlatex{} is intended mainly for displaying -mathematical formulas, so environments like @code{enumerate} or -@code{tabular} (except where contained in a float) are not included. -You can include them however manually by adding the lines: - -@example -\usepackage[displaymath,textmath,sections,graphics,floats]@{preview@} -\PreviewEnvironment@{enumerate@} -@end example - -in your document header, that is before - -@example -\begin@{document@} -@end example -@noindent -In general, @file{preview} should be loaded as the last thing before -the start of document. - -Be aware that - -@example -\PreviewEnvironment@{...@} -@end example - -does not accept a comma separated -list! Also note that by putting more and more - -@example -\PreviewEnvironment@{...@} -@end example - -in your document, it will look more and more like a @acronym{DVI} file -preview when running @previewlatex{}. Since each preview is treated as -one large monolithic block by Emacs, one should really restrict -previews to those elements where the improvement in visual -representation more than makes up for the decreased editability. - -@subsection What if I don't want to change the document? -The easiest way is to generate a configuration file in the current -directory. You can basically either create @file{prdefault.cfg} which -is used for any use of the @samp{preview} package, or you can use -@file{prauctex.cfg} which only applies to the use from with Emacs. Let -us assume you use the latter. In that case you should write something like - -@example -\InputIfFileExists@{preview/prauctex.cfg@}@{@}@{@} -\PreviewEnvironment@{enumerate@} -@end example - -in it. The first line inputs the system-wide default configuration -(the file name should match that, but not your own -@file{prauctex.cfg}), then you add your own stuff. - -@subsection Suddenly I get gazillions of ridiculous pages?!? - -When @previewlatex{} works on extracting its stuff, it typesets each -single preview on a page of its own. This only happens when actual -previews get generated. Now if you want to configure @previewlatex{} in -your document, you need to add your own @code{\usepackage} call to -@samp{preview} so that it will be able to interpret its various -definition commands. It is an error to add the @code{active} option to -this invocation: you don't want the package to be active unless -@previewlatex{} itself enables the previewing operation (which it will). - -@subsection Does @previewlatex{} work with presentation classes? - -@previewlatex{} should work with most presentation classes. However, -since those classes often have macros or pseudo environments -encompassing a complete slide, you will need to use the customization -facilities of @file{preview.sty} to tell it how to resolve this, whether -you want no previews, previews of whole slides or previews of inner -material. - -@node Troubleshooting, Other formats, Customization, Frequently Asked Questions -@section Troubleshooting - -@subsection Preview causes all sort of strange error messages - -When running @previewlatex{} and taking a look at either log file or -terminal output, lots of messages like - -@example -! Preview: Snippet 3 started. -<-><-> - -l.52 \item Sie lassen sich als Funktion $ - y = f(x)$ darstellen. -! Preview: Snippet 3 ended.(491520+163840x2494310). -<-><-> - -l.52 \item Sie lassen sich als Funktion $y = f(x)$ - darstellen. -@end example - -appear (previous versions generated messages looking even more like -errors). Those are not real errors (as will be noted in the log -file). Or rather, while they @strong{are} really @TeX{} error -messages, they are intentional. This currently is the only reliable -way to pass the information from the @LaTeX{} run of @previewlatex{} to -its Emacs part about where the previews originated in the source text. -Since they are actual errors, you will also get @AUCTeX{} to state -@example -Preview-LaTeX exited as expected with code 1 at Wed Sep 4 17:03:30 -@end example -after the @LaTeX{} run in the run buffer. This merely indicates that -errors were present, and errors will always be present when -@previewlatex{} is operating. There might be also real errors, so in -case of doubt, look for them explicitly in either run buffer or the -resulting @file{.log} file. - -@subsection Why do my @acronym{DVI} and @acronym{PDF} output files vanish? - -In order to produce the preview images @previewlatex{} runs @LaTeX{} on -the master or region file. The resulting @acronym{DVI} or @acronym{PDF} -file can happen to have the same name as the output file of a regular -@LaTeX{} run. So the regular output file gets overwritten and is -subsequently deleted by @previewlatex{}. - -@subsection My output file suddenly only contains preview images?! - -As mentioned in the previews @acronym{FAQ} entry, @previewlatex{} might -use the file name of the original output file for the creation of -preview images. If the original output file is being displayed with a -viewer when this happens, you might see strange effects depending on the -viewer, e.g. a message about the file being corrupted or the display of -all the preview images instead of your typeset document. (Also -@xref{Customization}.) - - -@node Other formats, , Troubleshooting, Frequently Asked Questions -@section @previewlatex{} when not using @LaTeX{} - -@subsection Does @previewlatex{} work with PDF@LaTeX{}? - -Yes, as long as you use @AUCTeX{}'s own PDF@LaTeX{} mode and have not -messed with @samp{TeX-command-list}. - -@subsection Does @previewlatex{} work with @samp{elatex}? - -No problem here. If you configure your @AUCTeX{} to use @samp{elatex}, -or simply have @samp{latex} point to @samp{elatex}, this will work fine. -Modern @TeX{} distributions use e@TeX{} for @LaTeX{}, anyway. - -@subsection Does @previewlatex{} work with @ConTeXt{}? - -In short, no. The @samp{preview} package is -@LaTeX{}-dependent. Adding support for other formats requires -volunteers. - -@subsection Does @previewlatex{} work with plain TeX? - -Again, no. Restructuring the @samp{preview} package for @samp{plain} -operation would be required. Volunteers welcome. - -In some cases you might get around by making a wrapper pseudo-Master -file looking like the following: - -@example -\documentclass@{article@} -\usepackage@{plain@} -\begin@{document@} -\begin@{plain@} -\input myplainfile -\end@{plain@} -\end@{document@} -@end example diff --git a/packages/auctex/doc/preview-latex.texi b/packages/auctex/doc/preview-latex.texi deleted file mode 100644 index 35085be8b..000000000 --- a/packages/auctex/doc/preview-latex.texi +++ /dev/null @@ -1,840 +0,0 @@ -\input texinfo -@comment %**start of header -@setfilename preview-latex.info -@include version.texi -@settitle preview-latex @value{VERSION} -@comment %**end of header -@include macros.texi -@copying -This manual is for preview-latex, a @LaTeX{} preview mode for @AUCTeX{} -(version @value{VERSION} from @value{UPDATED}). - -Copyright @copyright{} 2001, 2002, 2003, -2004, 2005, 2006 Free Software Foundation, Inc. - -@quotation -Permission is granted to copy, distribute and/or modify this document -under the terms of the GNU Free Documentation License, Version 1.3 or -any later version published by the Free Software Foundation; with no -Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. A -copy of the license is included in the section entitled ``GNU Free -Documentation License.'' -@end quotation -@end copying - -@dircategory Emacs -@direntry -* preview-latex: (preview-latex). Preview LaTeX fragments in Emacs -@end direntry -@dircategory TeX -@direntry -* preview-latex: (preview-latex). Preview LaTeX fragments in Emacs -@end direntry -@c footnotestyle separate -@c paragraphindent 2 -@syncodeindex vr cp -@syncodeindex ky cp -@syncodeindex fn cp - -@iftex -@tolerance 10000 @emergencystretch 3em -@end iftex - -@finalout -@titlepage -@title @previewlatex{} -@subtitle A @LaTeX{} preview mode for @AUCTeX{} in Emacs. -@subtitle Version @value{VERSION}, @value{UPDATED} -@author Jan-@AA{}ke Larsson -@author David Kastrup and others -@page -@vskip 0pt plus 1filll -@insertcopying -@end titlepage - -@c @summarycontents -@contents - -@c Use @ifinfo _and_ @ifhtml here because Texinfo 3 cannot cope with -@c @ifnottex around a top node. -@ifinfo -@node top, , (dir), (dir) -@top @previewlatex{} - -This manual may be copied under the conditions spelled out in -@ref{Copying this Manual}. - -@end ifinfo -@ifhtml -@node top, Copying, (dir), (dir) -@top @previewlatex{} -@insertcopying -@end ifhtml - -@contents - -@iftex -@unnumbered @previewlatex{} -@end iftex - -@previewlatex{} is a package embedding preview fragments into Emacs -source buffers under the @AUCTeX{} editing environment for @LaTeX{}. It -uses @file{preview.sty} for the extraction of certain environments (most -notably displayed formulas). Other applications of this style file are -possible and exist. - -The name of the package is really @samp{preview-latex}, all in -lowercase letters, with a hyphen. If you typeset it, you can use a -sans-serif font to visually offset it. - -@menu -* Copying:: Copying -* Introduction:: Getting started. -* Installation:: Make Install. -* Keys and lisp:: Key bindings and user-level lisp functions. -* Simple customization:: To make it fit in. -* Known problems:: When things go wrong. -* For advanced users:: Internals and more customizations. -* ToDo:: Future development. -* Frequently Asked Questions:: All about @previewlatex{} -* Copying this Manual:: GNU Free Documentation License -* Index:: A menu of many topics. -@end menu - -@node Copying, Introduction, top, top -@unnumbered Copying -@cindex Copying -@cindex Copyright -@cindex GPL -@cindex General Public License -@cindex License -@cindex Free -@cindex Free software -@cindex Distribution -@cindex Right -@cindex Warranty - -For the conditions for copying parts of @previewlatex{}, see the General -Public Licenses referres to in the copyright notices of the files, the -General Public Licenses accompanying them and the explanatory section in -@ref{Copying,,,auctex,the @AUCTeX{} manual}. - -This manual specifically is covered by the GNU Free Documentation -License (@pxref{Copying this Manual}). - -@node Introduction, Installation, Copying, top -@c Used as @file{README} as well: in separate file -@chapter Introduction -@include preview-readme.texi - -@node Installation, Keys and lisp, Introduction, top -@chapter Installation -Installation is now being covered in -@ref{Installation,,,auctex,the @AUCTeX{} manual}. - -@node Keys and lisp, Simple customization, Installation, top -@chapter Key bindings and user-level lisp functions - -@cindex Menu entries -@previewlatex{} adds key bindings starting with @kbd{C-c C-p} to the -supported modes of @AUCTeX{} (@inforef{Key Index,,auctex}). It will -also add its own @samp{Preview} menu in the menu bar, as well as an icon -in the toolbar. - -The following only describes the interactive use: view the documentation -strings with @kbd{C-h f} if you need the Lisp information. - -@table @w -@item @kbd{C-c C-p C-p} -@itemx @code{preview-at-point} -@itemx Preview/Generate previews (or toggle) at point -If the cursor is positioned on or inside of a preview area, this -toggles its visibility, regenerating the preview if necessary. If not, -it will run the surroundings through preview. The surroundings include -all areas up to the next valid preview, unless invalid previews occur -before, in which case the area will include the last such preview in -either direction. And overriding any other -action, if a region is active (@code{transient-mark-mode} or -@code{zmacs-regions}), it is run through @code{preview-region}. -@kindex @kbd{C-c C-p C-p} -@findex preview-at-point - -@item @kbd{} -The middle mouse button has a similar action bound to it as -@code{preview-at-point}, only that it knows which preview to apply it to -according to the position of the click. You can click either anywhere -on a previewed image, or when the preview is opened and showing the -source text, you can click on the icon preceding the source text. In -other areas, the usual mouse key action (typically: paste) is not -affected. - -@item @kbd{} -The right mouse key pops up a context menu with several options: -toggling the preview, regenerating it, removing it (leaving the -unpreviewed text), copying the text inside of the preview, and copying -it in a form suitable for copying as an image into a mail or news -article. This is a one-image variant of the following command: - -@item @kbd{C-c C-p C-w} -@itemx @code{preview-copy-region-as-mml} -@itemx Copy a region as MML -@kindex @kbd{C-c C-p C-w} -@findex preview-copy-region-as-mml -This command is also available as a variant in the context menu on the -right mouse button (where the region is the preview that has been -clicked on). It copies the current region into the kill buffer in a -form suitable for copying as a text including images into a mail or news -article using mml-mode (@pxref{Composing,,Composing,emacs-mime,Emacs -MIME}). - -If you regenerate or otherwise kill the preview in its source buffer -before the mail or news gets posted, this will fail. Also you should -generate images you want to send with @code{preview-transparent-border} -@vindex preview-transparent-border -set to @code{nil}, or the images will have an ugly border. -@previewlatex{} detects this condition and asks whether to regenerate -the region with borders switched off. As this is an asynchronous -operation running in the background, you'll need to call this command -explicitly again to get the newly generated images into the kill ring. - -Preview your articles with @code{mml-preview} (on @kbd{M-m P}, or -@kbd{C-c C-m P} in @w{Emacs 22}) -@kindex @kbd{M-m P} -@kindex @kbd{C-c C-m P} -to make sure they look fine. - -@item @kbd{C-c C-p C-e} -@itemx @code{preview-environment} -@itemx Preview/Generate previews for environment -Run preview on @LaTeX{} environment. The environments in -@code{preview-inner-environments} are treated as inner levels so that -for instance, the @code{split} environment in -@code{\begin@{equation@}\begin@{split@}@dots{}\end@{split@}\end@{equation@}} -is properly displayed. If called with a numeric argument, the -corresponding number of outward nested environments is treated as inner -levels. -@kindex @kbd{C-c C-p C-e} -@findex preview-environment - -@item @kbd{C-c C-p C-s} -@itemx @code{preview-section} -@itemx Preview/Generate previews for section -Run preview on this @LaTeX{} section. -@kindex @kbd{C-c C-p C-s} -@findex preview-section - -@item @kbd{C-c C-p C-r} -@itemx @code{preview-region} -@itemx Preview/Generate previews for region -Run preview on current region. -@kindex @kbd{C-c C-p C-r} -@findex preview-region - -@item @kbd{C-c C-p C-b} -@itemx @code{preview-buffer} -@itemx Preview/Generate previews for buffer -Run preview on the current buffer. -@kindex @kbd{C-c C-p C-b} -@findex preview-buffer - -@item @kbd{C-c C-p C-d} -@itemx @code{preview-document} -@itemx Preview/Generate previews for document -Run preview on the current document. -@kindex @kbd{C-c C-p C-d} -@findex preview-document - -@item @kbd{C-c C-p C-c C-p} -@itemx @code{preview-clearout-at-point} -@itemx Preview/Remove previews at point -@kindex @kbd{C-c C-p C-c C-p} -@findex preview-clearout-at-point -Clear out (remove) the previews that are immediately adjacent to point. - -@item @kbd{C-c C-p C-c C-s} -@itemx @code{preview-clearout-section} -@itemx Preview/Remove previews from section -@kindex @kbd{C-c C-p C-c C-s} -@findex preview-clearout-document -Clear out all previews in current section. - -@item @kbd{C-c C-p C-c C-r} -@itemx @code{preview-clearout} -@itemx Preview/Remove previews from region -@kindex @kbd{C-c C-p C-c C-r} -@findex preview-clearout -Clear out all previews in the current region. - -@item @kbd{C-c C-p C-c C-b} -@itemx @code{preview-clearout-buffer} -@itemx Preview/Remove previews from buffer -@kindex @kbd{C-c C-p C-c C-b} -@findex preview-clearout-buffer -Clear out all previews in current buffer. This makes the current buffer -lose all previews. - -@item @kbd{C-c C-p C-c C-d} -@itemx @code{preview-clearout-document} -@itemx Preview/Remove previews from document -@kindex @kbd{C-c C-p C-c C-d} -@findex preview-clearout-document -Clear out all previews in current document. The document consists of -all buffers that have the same master file as the current buffer. This -makes the current document lose all previews. - -@item @kbd{C-c C-p C-f} -@itemx @code{preview-cache-preamble} -@itemx Preview/Turn preamble cache on -@kindex @kbd{C-c C-p C-f} -@findex preview-cache-preamble -Dump a pregenerated format file. For the rest of the session, this file -is used when running on the same master file. Use this if you know your -@LaTeX{} takes a long time to start up, the speedup will be most -noticeable when generating single or few previews. If you change your -preamble, do this again. @previewlatex{} will try to detect the -necessity of that automatically when editing changes to the preamble are -done from within Emacs, but it will not notice if the preamble -effectively changes because some included file or style file is -tampered with. - -@item @kbd{C-c C-p C-c C-f} -@itemx @code{preview-cache-preamble-off} -@itemx Preview/Turn preamble cache off -@kindex @kbd{C-u C-c C-p C-f} -@findex preview-cache-preamble-off -Clear the pregenerated format file and stop using preambles for the -current document. If the caching gives you problems, use this. - -@item @kbd{C-c C-p C-i} -@itemx @code{preview-goto-info-page} -@itemx Preview/Read Documentation -@kindex @kbd{C-c C-p C-i} -@findex preview-goto-info-page -Read -@ifinfo -this -@end ifinfo -@ifnotinfo -the -@end ifnotinfo -info manual. - -@item @kbd{M-x preview-report-bug @key{RET}} -@itemx @code{preview-report-bug} -@itemx Preview/Report Bug -@kindex @kbd{M-x preview-report-bug @key{RET}} -@findex preview-report-bug -@cindex Report a bug -This is the preferred way of reporting bugs as it will fill in what -version of @previewlatex{} you are using as well as versions of -relevant other software, and also some of the more important -settings. Please use this method of reporting, if at all possible and -before reporting a bug, have a look at @ref{Known problems}. - -@item @kbd{C-c C-k} -@itemx LaTeX/TeX Output/Kill Job -@kindex @kbd{C-c C-k} -@cindex Kill preview-generating process -Kills the preview-generating process. This is really an @AUCTeX{} -keybinding, but it is included here as a hint. If you are generating -a preview and then make a change to the buffer, @previewlatex{} may be -confused and place the previews wrong. -@end table - -@node Simple customization, Known problems, Keys and lisp, top -@chapter Simple customization - -Customization options can be found by typing @kbd{M-x customize-group -@key{RET} preview @key{RET}}. Remember to set the option when you have -changed it. The list of suggestions can be made very long (and is -covered in detail in @ref{For advanced users}), but some are: - -@itemize @bullet -@item Change the color of the preview background - -If you use a non-white background in Emacs, you might have color -artifacts at the edges of your previews. Playing around with the option -@code{preview-transparent-color} in the @code{Preview Appearance} group -might improve things. With some settings, the cursor may cover the -whole background of a preview, however. - -This option is specific to the display engine in use. Its default is -different in @w{Emacs 21} and @w{Emacs 22}, and it is not available in -XEmacs. - -@item Showing @code{\label}s -@cindex Showing @code{\label}s - -When using @previewlatex{}, the @code{\label}s are hidden by the -previews. It is possible to make them visible in the output -by using the @LaTeX{} package @code{showkeys} alternatively -@code{showlabels}. However, the boxes of these labels will be outside -the region @previewlatex{} considers as the preview image. To enable a -similar mechanism internal to @previewlatex{}, enable the -@code{showlabels} option in the variable -@code{preview-default-option-list} in the @code{Preview Latex} group. - -It must be noted, however, that a much better idea may be to use the -Ref@TeX{} package for managing references. @xref{RefTeX in a -Nutshell,,RefTeX in a Nutshell,reftex,The Ref@TeX{} Manual}. - -@item Open previews automatically - -The current default is to open previews automatically when you enter -them with cursor left/right motions. Auto-opened previews will close -again once the cursor leaves them again (this is also done when doing -incremental search, or query-replace operations), unless you changed -anything in it. In that case, you will have to regenerate the preview -(via e.g., @kbd{C-c C-p C-p}). Other options for -@code{preview-auto-reveal} are available via @code{customize}. - -@item Automatically cache preambles - -Currently @previewlatex{} asks you whether you want to cache the -document preamble (everything before @code{\begin@{document@}}) before -it generates previews for a buffer the first time. Caching the preamble -will significantly speed up regeneration of previews. The larger your -preamble is, the more this will be apparent. Once a preamble is cached, -@previewlatex{} will try to keep track of when it is changed, and dump -a fresh format in that case. If you experience problems with this, or -if you want it to happen without asking you the first time, you can -customize the variable @code{preview-auto-cache-preamble}. -@vindex preview-auto-cache-preamble -@cindex Caching a preamble - -@item Attempt to keep counters accurate when editing - -@vindex preview-preserve-counters -@vindex preview-required-option-list -Since @previewlatex{} frequently runs only small regions through -@LaTeX{}, values like equation counters are not consistent from run to -run. If this bothers you, customize the variable -@code{preview-preserve-counters} to @code{t} (this is consulted by -@code{preview-required-option-list}). @LaTeX{} will then output a load -of counter information during compilation, and this information will be -used on subsequent updates to keep counters set to useful values. The -additional information takes additional time to analyze, but this is -relevant mostly only when you are regenerating all previews at once, and -maybe you will be less tempted to do so when counters appear more or -less correct. - -@item Preview your favourite @LaTeX{} constructs - -If you have a certain macro or environment that you want to preview, -first check if it can be chosen by cutomizing -@code{preview-default-options-list} in the @code{Preview Latex} group. - -If it is not available there, you can add it to -@code{preview-default-preamble} also in the @code{Preview Latex} group, -by adding a @code{\PreviewMacro} or @code{\PreviewEnvironment} entry -(@pxref{Provided commands}) @emph{after} the @code{\RequirePackage} -line. For example, if you want to preview the @code{center} -environment, press the @key{Show} button and the last @key{INS} button, -then add - -@example -\PreviewEnvironment@{center@} -@end example -@noindent -in the space that just opened. Note that since @code{center} is a -generic formatting construct of @LaTeX{}, a general configuration like -that is not quite prudent. You better to do this on a per-document -base so that it is easy to disable this behavior when you find this -particular entry gives you trouble. - -One possibility is to save such settings in the corresponding file-local -variable instead of your global configuration (@pxref{File -Variables,,Local Variables in Files,emacs,GNU Emacs Manual}). A perhaps -more convenient place for such options would be in a configuration file -in the same directory with your project (@pxref{Package options}). - -The usual file for @previewlatex{} preconfiguration is -@file{prauctex.cfg}. If you also want to keep the systemwide defaults, -you should add a line - -@example -\InputIfFileExists@{preview/prauctex.cfg@}@{@}@{@} -@end example -@noindent -to your own version of @file{prauctex.cfg} (this is assuming that -global files relating to the @code{preview} package are installed in a -subdirectory @file{preview}, the default behavior). - -@item Don't preview inline math -@cindex Inline math - -If you have performance problems because your document is full of inline -math (@code{$@dots{}$}), or if your usage of @code{$} conflicts with -@previewlatex{}'s, you can turn off inline math previews. In the -@code{Preview Latex} group, remove @code{textmath} from -@code{preview-default-option-list} by customizing this variable. -@end itemize - -@node Known problems, For advanced users, Simple customization, top -@chapter Known problems -@c also used as PROBLEMS file -@include preview-problems.texi - -@node For advanced users, ToDo, Known problems, top -@chapter For advanced users - -This package consists of two parts: a @LaTeX{} style that splits the -output into appropriate parts with one preview object on each page, and -an Emacs-lisp part integrating the thing into Emacs (aided by -@AUCTeX{}). - -@menu -* The LaTeX style file:: -* The Emacs interface:: -* The preview images:: -* Misplaced previews:: -@end menu - -@node The LaTeX style file, The Emacs interface, For advanced users, For advanced users -@section The @LaTeX{} style file -@c Autogenerated from ../preview.dtx -@include preview-dtxdoc.texi - -@node The Emacs interface, The preview images, The LaTeX style file, For advanced users -@section The Emacs interface - -You can use @kbd{M-x customize-group @key{RET} preview-latex @key{RET}} -in order to customize these variables, or use the menus for it. We -explain the various available options together with explaining how they -work together in making @previewlatex{} work as intended. - -@vtable @code -@item preview-LaTeX-command -When you generate previews on a buffer or a region, the command in -@code{preview-LaTeX-command} gets run (that variable should only be -changed with Customize since its structure is somewhat peculiar, though -expressive). As usual with @AUCTeX{}, you can continue working while -this is going on. It is not a good idea to change the file until after -@previewlatex{} has established where to place the previews which it can -only do after the @LaTeX{} run completes. This run produces a host of -pseudo-error messages that get parsed by @previewlatex{} at the end of -the @LaTeX{} run and give it the necessary information about where in -the source file the @LaTeX{} code for the various previews is located -exactly. The parsing takes a moment and will render Emacs busy. - -@item preview-LaTeX-command-replacements -This variable specifies transformations to be used before calling the -configured command. One possibility is to have @samp{\pdfoutput=0 } -appended to every command starting with @samp{pdf}. This particular -setting is available as the shortcut -@samp{preview-LaTeX-disable-pdfoutput}. Since @previewlatex{} can work -with @acronym{PDF} files by now, there is little incentive for using -this option, anymore (for projects not requiring @acronym{PDF} output, -the added speed of @samp{dvipng} might make this somewhat attractive). - -@item preview-required-option-list -@code{preview-LaTeX-command} uses @code{preview-required-option-list} in -order to pass options such as @option{auctex}, @option{active} and -@option{dvips} to the @file{preview} package. This means that the user -need (and should) not supply these in the document itself in case he -wants to be able to still compile his document without it turning into -an incoherent mass of little pictures. These options even get passed -in when the user loads @file{preview} explicitly in his document. - -The default includes an option @code{counters} that is controlled by the -boolean variable - -@item preview-preserve-counters -This option will cause the @file{preview} package to emit information -that will assist in keeping things like equation counters and section -numbers reasonably correct even when you are regenerating only single -previews. - -@item preview-default-option-list -@itemx preview-default-preamble -If the document does not call in the package @code{preview} itself (via -@code{\usepackage}) in the preamble, the preview package is loaded using -default options from @code{preview-default-option-list} and additional -commands specified in @code{preview-default-preamble}. - -@item preview-fast-conversion -This is relevant only for @acronym{DVI} mode. It defaults to `On' and -results in the whole document being processed as one large PostScript -file from which the single images are extracted with the help of parsing -the PostScript for use of so-called @acronym{DSC} comments. The -bounding boxes are extracted with the help of @TeX{} instead of getting -them from Dvips. If you are experiencing bounding box problems, try -setting this option to `Off'. - -@item preview-prefer-TeX-bb -If this option is `On', it tells @previewlatex{} never to try to extract -bounding boxes from the bounding box comments of @acronym{EPS} files, -but rather rely on the boxes it gets from @TeX{}. If you activated -@code{preview-fast-conversion}, this is done, anyhow, since there are no -@acronym{EPS} files from which to read this information. The option -defaults to `Off', simply because about the only conceivable reason to -switch off @code{preview-fast-conversion} would be that you have some -bounding box problem and want to get Dvips' angle on that matter. - -@item preview-scale-function -@itemx preview-reference-face -@itemx preview-document-pt-list -@itemx preview-default-document-pt -@code{preview-scale-function} determines by what factor -images should be scaled when appearing on the screen. If you specify a -numerical value here, the physical size on the screen will be that of -the original paper output scaled by the specified factor, at least if -Emacs' information about screen size and resolution are correct. The -default is to let @code{preview-scale-from-face} determine the scale -function. This function determines the scale factor by making the -size of the default font in the document match that of the on-screen -fonts. - -The size of the screen fonts is deduced from the font -@code{preview-reference-face} (usually the default face used for -display), the size of the default font for the document is determined -by calling @code{preview-document-pt}. -@findex preview-document-pt -This function consults the members of @code{preview-document-pt-list} in -turn until it gets the desired information. The default consults first -@code{preview-parsed-font-size}, -@vindex preview-parsed-font-size -then calls @code{preview-auctex-font-size} -@findex preview-auctex-font-size -which asks @AUCTeX{} about any size specification like @option{12pt} to -the documentclass that it might have detected when parsing the document, and -finally reverts to just assuming @code{preview-default-document-pt} as -the size used in the document (defaulting to 10pt). - -If you find that the size of previews and the other Emacs display -clashes, something goes wrong. @code{preview-parsed-font-size} is -determined at @code{\begin@{document@}} time; if the default font size -changes after that, it will not get reported. If you have an outdated -version of @file{preview.sty} in your path, the size might not be -reported at all. If in this case @AUCTeX{} is unable to find a size -specification, and if you are using a document class with a different -default value (like KomaScript), the default fallback assumption will -probably be wrong and @previewlatex{} will scale up things too large. -So better specify those size options even when you know that @LaTeX{} -does not need them: @previewlatex{} might benefit from them. Another -possibility for error is that you have not enabled @AUCTeX{}'s document -parsing options. The fallback method of asking @AUCTeX{} about the size -might be disabled in future versions of @previewlatex{} since in -general it is more reliable to get this information from the @LaTeX{} -run itself. - -@item preview-fast-dvips-command -@itemx preview-dvips-command -The regular command for turning a @acronym{DVI} file into a single -PostScript file is @code{preview-fast-dvips-command}, while -@code{preview-dvips-command} is used for cranking out a @acronym{DVI} -file where every preview is in a separate @acronym{EPS} file. Which of -the two commands gets used depends on the setting of -@code{preview-fast-conversion}. The printer specified here by default -is @option{-Pwww} by default, which will usually get you scalable fonts -where available. If you are experiencing problems, you might want to try -playing around with Dvips options (@inforef{Command-line options,,dvips}). - -The conversion of the previews into PostScript or @acronym{EPS} files -gets started after the @LaTeX{} run completes when Emacs recognizes the -first image while parsing the error messages. When Emacs has finished -parsing the error messages, it activates all detected previews. This -entails throwing away any previous previews covering the same areas, and -then replacing the text in its visual appearance by a placeholder -looking like a roadworks sign. - -@item preview-nonready-icon-specs -This is the roadworks sign displayed while previews are being prepared. -You may want to customize the font sizes at which @previewlatex{} -switches over between different icon sizes, and the ascent ratio which -determines how high above the base line the icon gets placed. - -@item preview-error-icon-specs -@itemx preview-icon-specs -Those are icons placed before the source code of an opened preview and, -respectively, the image specs to be used for PostScript errors, and a -normal open preview in text representation. - -@item preview-inner-environments -This is a list of environments that are regarded as inner levels of an -outer environment when doing @code{preview-environment}. One example -when this is needed is in -@code{\begin@{equation@}\begin@{split@}@dots{}\end@{split@}\end@{equation@}}, and -accordingly @code{split} is one entry in -@code{preview-inner-environments}. - -@item preview-use-balloon-help -If you turn this XEmacs-only option `on', then moving the mouse over -previews and icons will show appropriate help texts. This works by -switching on @code{balloon-help-mode} in the buffer if it is not already -enabled. The default now is `off' since some users reported problems -with their version of XEmacs. @w{GNU Emacs} has its corresponding -@code{tooltip-mode} enabled by default and in usable condition. - -@end vtable - -@node The preview images, Misplaced previews, The Emacs interface, For advanced users -@section The preview images - -@vtable @code -@item preview-image-type -@itemx preview-image-creators -@itemx preview-gs-image-type-alist -What happens when @LaTeX{} is finished depends on the configuration of -@code{preview-image-type}. What to do for each of the various settings -is specified in the variable @code{preview-image-creators}. The options -to pass into Ghostscript and what Emacs image type to use is specified -in @code{preview-gs-image-type-alist}. - -@code{preview-image-type} defaults to @code{png}. For this to work, -your version of Ghostscript needs to support the @option{png16m} device. -If you are experiencing problems here, you might want to reconfigure -@code{gs-image-type-alist} or @code{preview-image-type}. Reconfiguring -@code{preview-image-creators} is only necessary for adding additional -image types. - -Most devices make @previewlatex{} start up a single Ghostscript process -for the entire preview run (as opposed to one per image) and feed it -either sections of a @acronym{PDF} file (if PDF@LaTeX{} was used), or -(after running Dvips) sections of a single PostScript file or separate -@acronym{EPS} files in sequence for conversion into @acronym{PNG} format -which can be displayed much faster by Emacs. Actually, not in sequence -but backwards since you are most likely editing at the end of the -document. And as an added convenience, any preview that happens to be -on-screen is given higher priority so that @previewlatex{} will first -cater for the images that are displayed. There are various options -customizable concerning aspects of that operation, see the customization -group @code{Preview Gs} for this. - -Another noteworthy setting of @code{preview-image-type} is -@samp{dvipng}: in this case, the @samp{dvipng}@pindex{dvipng} program -will get run on @acronym{DVI} output (see below for @acronym{PDF}). -This is in general much faster than Dvips and Ghostscript. In that -case, the option - -@item preview-dvipng-command -will get run for doing the conversion, and it is expected that - -@item preview-dvipng-image-type -images get produced (@samp{dvipng} might be configured for other image -types as well). You will notice that @code{preview-gs-image-type-alist} -contains an entry for @code{dvipng}: this actually has nothing to with -@samp{dvipng} itself but specifies the image type and Ghostscript device -option to use when @samp{dvipng} can't be used. This will obviously be -the case for @acronym{PDF} output by PDF@LaTeX{}, but it will also happen -if the @acronym{DVI} file contains PostScript specials in which case the -affected images will get run through Dvips and Ghostscript once -@samp{dvipng} finishes. - -@item preview-gs-options -Most interesting to the user perhaps is the setting of this variable. -It contains the default antialiasing settings @option{-dTextAlphaBits=4} -and @option{-dGraphicsAlphaBits=4}. Decreasing those values to 2 @w{or -1} might increase Ghostscript's performance if you find it lacking. -@end vtable - -Running and feeding Ghostscript from @previewlatex{} happens -asynchronously again: you can resume editing while the images arrive. -While those pretty pictures filling in the blanks on screen tend to -make one marvel instead of work, rendering the non-displayed images -afterwards will not take away your attention and will eventually -guarantee that jumping around in the document will encounter only -prerendered images. - -@node Misplaced previews, , The preview images, For advanced users -@section Misplaced previews - -If you are reading this section, the first thing is to check that your -problem is not caused by x-symbol in connection with an installation not -supporting 8-bit characters (@pxref{x-symbol interoperation}). If not, -here's the beef: - -As explained previously, Emacs uses pseudo-error messages generated by -the @samp{preview} package in order to pinpoint the exact source -location where a preview originated. This works in running text, but -fails when preview material happens to lie in macro arguments, like the -contents of @code{\emph}. Those macros first read in their entire -argument, munge it through, perhaps transform it somehow, process it and -perhaps then typeset something. When they finally typeset something, -where is the location where the stuff originated? @TeX{}, having read in -the entire argument before, does not know and actually there would be no -sane way of defining it. - -For previews contained inside such a macro argument, the default -behaviour of @previewlatex{} is to use a position immediately after the -closing brace of the argument. All the previews get placed there, all at -a zero-width position, which means that Emacs displays it in an order -that @previewlatex{} cannot influence (currently in Emacs it is even -possible that the order changes between runs). And since the placement -of those previews is goofed up, you will not be able to regenerate them -by clicking on them. The default behaviour is thus somewhat undesirable. - -The solution (like with other preview problems) is to tell the @LaTeX{} -@samp{preview} package how to tackle this problem (@pxref{The LaTeX -style file}). Simply, you don't need @code{\emph} do anything at all -during previews! You only want the text math previewed, so the solution -is to use @code{\PreviewMacro*\emph} in the preamble of your document -which will make @LaTeX{} ignore @code{\emph} completely as long as it is -not part of a larger preview (in which case it gets typeset as -usual). Its argument thus becomes ordinary text and gets treated like -ordinary text. - -Note that it would be a bad idea to declare -@code{\PreviewMacro*[@{@{@}@}]\emph} since then both @code{\emph} as -well as its argument would be ignored instead of previewed. For -user-level macros, this is almost never wanted, but there may be -internal macros where you might want to ignore internal arguments. - -The same mechanism can be used for a number of other text-formatting -commands like @code{\textrm}, @code{\textit} and the like. While they -all use the same internal macro @code{\text@@command}, it will not do to -redefine just that, since they call it only after having read their -argument in, and then it already is too late. So you need to disable -every of those commands by hand in your document preamble. - -Actually, we wrote all of the above just to scare you. At least all of -the above mentioned macros and a few more are already catered for by a -configuration file @file{prauctex.cfg} that gets loaded by default -unless the @samp{preview} package gets loaded with the @option{noconfig} -option. You can make your own copy of this file in a local directory -and edit it in case of need. You can also add loading of a file of your -liking to @code{preview-default-preamble}, -@vindex preview-default-preamble -or alternatively do the -manual disabling of your favorite macro in -@code{preview-default-preamble}, -@vindex preview-default-preamble -which is customizable in the Preview Latex group. - -@node ToDo, Frequently Asked Questions, For advanced users, top -@c Also used as TODO: in separate file -@appendix ToDo -@include preview-todo.texi - -@node Frequently Asked Questions, Copying this Manual, ToDo, top -@c Also used as TODO: in separate file -@appendix Frequently Asked Questions -@include preview-faq.texi - -@node Copying this Manual, Index, Frequently Asked Questions, top -@c Not to be changed often, I think: in separate file. -@appendix Copying this Manual - -@ifinfo -The copyright notice for this manual is: - -@insertcopying -@end ifinfo - -The full license text can be read here: - -@menu -* GNU Free Documentation License:: License for copying this manual. -@end menu - -@include fdl.texi - -@c @node Credits, Index, Internals, top -@c @appendix Credits - -@node Index, , Copying this Manual, top -@unnumbered Index - -@printindex cp - -@bye diff --git a/packages/auctex/doc/preview-problems.texi b/packages/auctex/doc/preview-problems.texi deleted file mode 100644 index a0393517c..000000000 --- a/packages/auctex/doc/preview-problems.texi +++ /dev/null @@ -1,242 +0,0 @@ -@include macros.texi -@ifset rawfile -@c documentencoding is used by makeinfo in our --no-headers output. -@documentencoding ISO-8859-1 -@node Known problems,,(dir),(dir) -@top Known problems - -@end ifset -@c ----------------------- -@c @cindex @kbd{M-x preview-report-bug @key{RET}} -@c @cindex @code{preview-report-bug} -@c @cindex Report a bug -A number of issues are known concerning the interoperation with various -other software. Some of the known problems can be solved by moving to -newer versions of the problematic software or by simple patches. - -@menu -* Problems with Ghostscript:: -* Font problems with Dvips:: -* Emacs problems:: -* Too small bounding boxes:: -* x-symbol interoperation:: -* Middle-clicks paste instead of toggling:: -@end menu - -If you find something not mentioned here, please send a bug report using -@kbd{M-x preview-report-bug @key{RET}}, which will fill in a lot of -information interesting to us and send it to the -@email{bug-auctex@@gnu.org} list. Please use the bug reporting commands -if at all possible. - -@ifset rawfile -@node Problems with Ghostscript -@chapter Problems with Ghostscript -@raisesections -@end ifset -@ifclear rawfile -@node Problems with Ghostscript -@section Problems with Ghostscript -@end ifclear - -Most of the problems encountered come from interaction with Ghostscript. -It is a good idea to have a fairly recent version of Ghostscript -installed. One problem occurs if you have specified the wrong -executable under Windows: the command line version of Ghostscript is -called @file{GSWIN32C.EXE}, not @file{GSWIN32.EXE}. - -When Ghostscript fails, the necessary information and messages from -Ghostscript go somewhere. If Ghostscript fails before starting to -process images, you'll find the information at the end of the process -buffer you can see with @kbd{C-c C-l}. If Ghostscript fails while -processing a particular image, this image will be tagged with clickable -buttons for the error description and for the corresponding source file. - -The default options configurable with - -@display -@kbd{M-x customize-variable @key{RET} preview-gs-options @key{RET}} -@end display -@vindex preview-gs-options -@noindent -include the options @option{-dTextAlphaBits=4} and -@option{-dGraphicsAlphaBits=4}. These options have been reported to -make Ghostscript 5.50 fail, but should work under Ghostscript 6.51 and -later. If you are experiencing problems, it might help to customize -them away. Of course, this also takes away the joy of antialiasing, so -upgrading Ghostscript might not be the worst idea after all. - -The device names have changed over time, so when using an old -Ghostscript, you may have problems with the devices demanded by the -customizable variable @code{preview-image-creators}. -@vindex preview-image-creators -In that case, make sure they fit your version of Ghostscript, at least -the entry corresponding to the current value of -@code{preview-image-type}. -@vindex preview-image-type -While not being best in file size and image quality, setting -@code{preview-image-creators} to @code{jpeg} should probably be one of -the best bets for the purpose of checking basic operation, since that -device name has not changed in quite some time. But @acronym{JPEG} is -not intended for text, but for photographic images. On a more -permanent time scale, the best choice is to use @acronym{PNG} and -complain to your suppliers if either Emacs or Ghostscript fail to -properly accommodate this format. - -@node Font problems with Dvips -@section Font problems with Dvips -Some fonts have been reported to produce wrong characters with -@previewlatex{}. @previewlatex{} calls Dvips by default with the option -@option{-Pwww} in order to get scalable fonts for nice results. If you -are using antialiasing, however, the results might be sufficiently nice -with bitmapped fonts, anyway. You might try @option{-Ppdf} for another -stab at scalable fonts, or other printer definitions. Use - -@display -@kbd{M-x customize-variable @key{RET} preview-fast-dvips-command @key{RET}} -@end display -@noindent -and -@display -@kbd{M-x customize-variable @key{RET} preview-dvips-command @key{RET}} -@end display -@noindent -in order to customize this. - -One particular problem is that several printer setup files (typically in -a file called @file{/usr/share/texmf/dvips/config/config.pdf} if you are -using the @option{-Ppdf} switch) contain the @option{G} option for -`character shifting'. This option will result in @samp{fi} being -rendered as @samp{@pounds{}} (British Pounds sign) in several fonts, -unless your version of Dvips has a long-standing bug in its -implementation fixed (only very recent versions of Dvips have). - -@node Emacs problems -@section Emacs problems - -@itemize @bullet -@item GNU Emacs versions - -Don't use Emacsen older than 21.3 on X11-based systems. On most other -systems, you'll need at least @w{Emacs 22.1} or one of the developer -versions leading up to it. Details can be found in -@ifset rawfile -in the @file{INSTALL} file. -@end ifset -@ifclear rawfile -@ref{Prerequisites,,,auctex,the @AUCTeX{} manual}. -@end ifclear - -@item Emacsen on Windows operating systems - -For @w{Emacs 21}, no image support is available in Emacs under Windows. -Without images, @previewlatex{} is useless. The current @acronym{CVS} -version of Emacs available from -@uref{http://savannah.gnu.org/projects/emacs} now supports images -including the @acronym{PNG} format, so @w{Emacs 22} should work out of -the box once it is released. Precompiled versions are available from -@uref{http://crasseux.com/emacs} and @uref{http://nqmacs.sf.net}. - -For detailed installation instructions for Windows, see -@ifset rawfile -the file @file{INSTALL.windows} -@end ifset -@ifclear rawfile -@ref{Installation under MS Windows,,,auctex,the @AUCTeX{} manual}. -@end ifclear - -@item XEmacs - -There is are two larger problems known with older XEmacs releases. One -leads to seriously mispositioned baselines and previews hanging far -above other text on the same line. This should be fixed as of -XEmacs-21.4.9. - -The other core bug causes a huge delay when XEmacs's idea of the state of -processes (like ghostscript) is wrong, and can lead to nasty spurious -error messages. It should be fixed in version 21.4.8. - -Previews will only remain from one session to the next if you have -version 1.81 or above of the @file{edit-utils} package, first released -in the 2002-03-12 sumo tarball. -@end itemize - -@node Too small bounding boxes -@section Too small bounding boxes -The bounding box of a preview is determined by the @LaTeX{} package -using the pure @TeX{} bounding boxes. If there is material extending -outside of the @TeX{} box, that material will be missing from the -preview image. This happens for the label-showing boxes from -the @code{showkeys} package. This particular problem can be -circumvented by using the @code{showlabels} option of the preview -package. - -In general, you should try to fix the problem in the @TeX{} code, like -avoiding drawing outside of the picture with PSTricks. - -One possible remedy is to set -@code{preview-fast-conversion} to `Off' -@ifset rawfile -(see the manual). -@end ifset -@ifclear rawfile -(@pxref{The Emacs interface}). -@end ifclear -The conversion will take more time, but will then use the bounding boxes -from @acronym{EPS} files generated by Dvips. - -Dvips generally does not miss things, but it does not understand -PostScript constructs like @code{\resizebox} or @code{\rotate} commands, -so will generate rather wrong boxes for those. Dvips can be helped with -the @code{psfixbb} package option to preview -@ifset rawfile -(see the manual), -@end ifset -@ifclear rawfile -(@pxref{The LaTeX style file}), -@end ifclear -which will tag the corners of the included @TeX{} box. This will mostly -be convenient for @emph{pure} PostScript stuff like that created by -PSTricks, which Dvips would otherwise reserve no space for. - -@node x-symbol interoperation -@section x-symbol interoperation - -Thanks to the work of Christoph Wedler, starting with version -@samp{4.0h/beta} of x-symbol, the line parsing of @AUCTeX{} and -@previewlatex{} is fully supported. Earlier versions exhibit problems. -However, versions before 4.2.2 will cause a drastic slowdown of -@previewlatex{}'s parsing pass, so we don't recommend to use versions -earlier than that. - -If you wonder what x-symbol is, it is a package that transforms various -tokens and subscripts to a more readable form while editing and offers a -few input methods handy especially for dealing with math. Take a look at -@uref{http://x-symbol.sourceforge.net}. - -x-symbol versions up to 4.5.1-beta at least require an 8bit-clean @TeX{} -implementation (meaning that its terminal output should not use -@samp{^^}-started escape sequences) for cooperation with -@previewlatex{}. Later versions may get along without it, like -@previewlatex{} does now. - -If you experience problems with @file{circ.tex} in connection with both -x-symbol and Latin-1 characters, you may need to change your language -environment or, as a last resort, customize the variable -@code{LaTeX-command-style} by replacing the command @code{latex} with -@code{latex -translate-file=cp8bit}. - -@node Middle-clicks paste instead of toggling -@section Middle-clicks paste instead of toggling - -This is probably the fault of your favorite package. @file{flyspell.el} -and @file{mouse-drag.el} are known to be affected in versions before -@w{Emacs 21.3}. Upgrade to the most recent version. What version of -XEmacs might contain the fixes is unknown. - -@file{isearch.el} also shows this effect while searches are in progress, -but the code is such a complicated mess that no patch is in sight. -Better just end the search with @kbd{@key{RET}} before toggling and -resume with @kbd{C-s C-s} or similar afterwards. Since previews over -the current match will auto-open, anyway, this should not be much of a -problem in practice. diff --git a/packages/auctex/doc/preview-readme.texi b/packages/auctex/doc/preview-readme.texi deleted file mode 100644 index 4f67e0410..000000000 --- a/packages/auctex/doc/preview-readme.texi +++ /dev/null @@ -1,230 +0,0 @@ -@include macros.texi -@ifset rawfile -@node Introduction, What use is it?, (dir), (dir) -@top @previewlatex{} in a nutshell -@paragraphindent none -@end ifset -@c ----------------------- -@cindex Readme -Does your neck hurt from turning between previewer windows and the -source too often? This @AUCTeX{} component will render your displayed -@LaTeX{} equations right into the editing window where they belong. - -The purpose of @previewlatex{} is to embed @LaTeX{} environments such as -display math or figures into the source buffers and switch conveniently -between source and image representation. - -@menu -* What use is it?:: -* Activating preview-latex:: -* Getting started:: -* Basic modes of operation:: -* More documentation:: -* Availability:: -* Contacts:: -@end menu - -@ifset rawfile -@node What use is it?, Activating preview-latex, Introduction, Introduction -@chapter What use is it? -@raisesections -@end ifset -@ifclear rawfile -@node What use is it?, Activating preview-latex, Introduction, Introduction -@section What use is it? -@end ifclear -@cindex Philosophy of @previewlatex{} -@acronym{WYSIWYG} (what you see is what you get) sometimes is considered -all the rage, sometimes frowned upon. Do we really want it? Wrong -question. The right question is @emph{what} we want from it. Except -when finetuning the layout, we don't want to use printer fonts for -on-screen text editing. The low resolution and contrast of a computer -screen render all but the coarsest printer fonts (those for low-quality -newsprint) unappealing, and the margins and pagination of the print are -not wanted on the screen, either. On the other hand, more complex -visual compositions like math formulas and tables can't easily be taken -in when seen only in the source. @previewlatex{} strikes a balance: it -only uses graphic renditions of the output for certain, configurable -constructs, does this only when told, and then right in the source code. -Switching back and forth between the source and preview is easy and -natural and can be done for each image independently. Behind the scenes -of @previewlatex{}, a sophisticated framework of other programs like -@samp{dvipng}, Dvips and Ghostscript are employed together with a -special @LaTeX{} style file for extracting the material of interest in -the background and providing fast interactive response. - -@node Activating preview-latex, Getting started, What use is it?, Introduction -@section Activating @previewlatex{} -@cindex Activation -After installation, the package may need to be activated (and remember -to activate @AUCTeX{} too). In XEmacs, and in any prepackaged versions -worth their salt, activation should be automatic upon installation. If -this seems not the case, complain to your installation provider. - -The usual activation (if it is not done automatically) would be - -@example -(load "preview-latex.el" nil t t) -@end example - -If you still don't get a ``Preview'' menu in @LaTeX{} mode in spite -of @AUCTeX{} showing its ``Command'', your installation is broken. One -possible cause are duplicate Lisp files that might be detectable with -@kbd{@key{M-x} list-load-path-shadows @key{RET}}. - -@node Getting started, Basic modes of operation, Activating preview-latex, Introduction -@section Getting started - -Once activated, @previewlatex{} and its documentation will be accessible -via its menus (note that @previewlatex{} requires @AUCTeX{} to be -loaded). When you have loaded a @LaTeX{} document (a -sample document @file{circ.tex} is included in the distribution, but -most documents including math and/or figures should do), you can use -its menu or @kbd{C-c C-p C-d} (for @samp{Preview/Document}). -Previews will now be generated for various objects in your document. -You can use the time to take a short look at the other menu entries and -key bindings in the @samp{Preview} menu. You'll see the previewed -objects change into a roadworks sign when @previewlatex{} has determined -just what it is going to preview. Note that you can freely navigate the -buffer while this is going on. When the process is finished you will -see the objects typeset in your buffer. - -It is a bad idea, however, to edit the buffer before the roadworks signs -appear, since that is the moment when the correlation between the -original text and the buffer locations gets established. If the buffer -changes before that point of time, the previews will not be placed where -they belong. If you do want to change some obvious error you just -spotted, we recommend you stop the background process by pressing -@kbd{C-c C-k}. - -To see/edit the @LaTeX{} code for a specific object, put the point (the -cursor) on it and press @kbd{C-c C-p C-p} (for @samp{Preview/at point}). -It will also do to click with the middle mouse button on the preview. -Now you can edit the code, and generate a new preview by again pressing -@kbd{C-c C-p C-p} (or by clicking with the middle mouse button on the -icon before the edited text). - -If you are using the @code{desktop} package, previews will remain from -one session to the next as long as you don't kill your buffer. If you -are using XEmacs, you will probably need to upgrade the package to -the newest one; things are being fixed just as I am writing this. - -@node Basic modes of operation, More documentation, Getting started, Introduction -@section Basic modes of operation - -@previewlatex{} has a number of methods for generating its graphics. -Its default operation is equivalent to using the `@LaTeX{}' command from -@AUCTeX{}. If this happens to be a call of PDF@LaTeX{} generating -@acronym{PDF} output (you need at least @w{@AUCTeX{} 11.51} for this), -then Ghostscript will be called directly on the resulting @acronym{PDF} -file. If a @acronym{DVI} file gets produced, first Dvips and then -Ghostscript get called by default. - -The image type to be generated by Ghostscript can be configured with - -@example -@kbd{M-x} customize-variable @kbd{RET} preview-image-type @kbd{RET} -@end example -@vindex preview-image-type - -@noindent -The default is @samp{png} (the most efficient image type). A special -setting is @samp{dvipng} in case you have the @samp{dvipng} -@cindex Using dvipng -@pindex dvipng -program installed. In this case, @samp{dvipng} will be used for -converting @acronym{DVI} files and Ghostscript (with a @samp{PNG} -device) for converting @acronym{PDF} files. @samp{dvipng} is much -faster than the combination of Dvips and Ghostscript. You can get -downloads, access to its @acronym{CVS} archive and further information -from its @uref{http://savannah.nongnu.org/projects/dvipng, project -site}. - -@node More documentation, Availability, Basic modes of operation, Introduction -@section More documentation -After the installation, documentation in the form of -@ifinfo -@ifclear rawfile -this -@end ifclear -@ifset rawfile -an -@end ifset -@end ifinfo -@ifnotinfo -an -@end ifnotinfo -info manual will be available. You can access it with the standalone -info reader with - -@example -info preview-latex -@end example - -@noindent -or by pressing @kbd{C-h i d m preview-latex @key{RET}} in Emacs. Once -@previewlatex{} is activated, you can instead use @kbd{C-c C-p -@key{TAB}} (or the menu entry @samp{Preview/Read documentation}). - -Depending on your installation, -@ifnottex -a printable -@end ifnottex -@iftex -this printed -@end iftex -manual may also be available in the form of @file{preview-latex.dvi} or -@file{preview-latex.ps}. - -Detailed documentation for the @LaTeX{} style used for extracting the -preview images is placed in @file{preview.dvi} in a suitable directory -during installation; on typical teTeX-based systems, - -@example -texdoc preview -@end example - -@noindent -will display it. - -@node Availability, Contacts, More documentation, Introduction -@section Availability -@cindex Download -@cindex @sc{cvs} access - -The @previewlatex{} project is now part of @AUCTeX{} and accessible as -part of the @uref{http://savannah.gnu.org/projects/auctex,@AUCTeX{} -project page}. You can get its files from the -@uref{ftp://ftp.gnu.org/pub/gnu/auctex,@AUCTeX{} download area}. As of -@w{@AUCTeX{} 11.81}, @previewlatex{} should already be integrated into -@AUCTeX{}, so no separate download will be necessary. - -You will also find @file{.rpm} files there for Fedora and possibly -SuSE. Anonymous @acronym{CVS} is available as well. - -@node Contacts, , Availability, Introduction -@section Contacts -@cindex Contacts -@cindex Mailing list - -Bug reports should be sent by using @kbd{M-x preview-report-bug -@key{RET}}, as this will fill in a lot of information interesting to -us. If the installation fails (but this should be a rare event), report -bugs to @email{bug-auctex@@gnu.org}. - -There is a general discussion list for @AUCTeX{} which also -covers @previewlatex{}, look at -@uref{http://lists.gnu.org/mailman/listinfo/auctex}. For more -information on the mailing list, send a message with just the word -``help'' as subject or body to @email{auctex-request@@gnu.org}. For the -developers, there is the @email{auctex-devel@@gnu.org} list; it would -probably make sense to direct feature requests and questions about -internal details there. There is a low-volume read-only announcement -list available to which you can subscribe by sending a mail with -``subscribe'' in the subject to @email{info-auctex-request@@gnu.org}. - -Offers to support further development will be appreciated. If you want -to show your appreciation with a donation to the main developer, you can -do so via PayPal to @email{dak@@gnu.org}, and of course you can arrange -for service contracts or for added functionality. Take a look at the -@file{TODO} list for suggestions in that area. diff --git a/packages/auctex/doc/preview-todo.texi b/packages/auctex/doc/preview-todo.texi deleted file mode 100644 index f39618fb0..000000000 --- a/packages/auctex/doc/preview-todo.texi +++ /dev/null @@ -1,118 +0,0 @@ -@ifset rawfile -@include macros.texi -@chapheading Future Development of @previewlatex{} -@end ifset - -@itemize @bullet - -@item Support other formats than just @LaTeX{} - -plain @TeX{} users and Con@TeX{}t users should not have to feel left -out. While Con@TeX{}t is not supported yet by released versions of -@AUCTeX{}, at least supporting plain would help people, and be a start -for Con@TeX{}t as well. There are plain-based formats like MusiX@TeX{} -that could benefit a lot from @previewlatex{}. The main part of the -difficulties here is to adapt @file{preview.dtx} to produce stuff not -requiring @LaTeX{}. - -@item Support nested snippets - -Currently you can't have both a footnote (which gets displayed as just -its footnote number) and math inside of a footnote rendered as an image: -such nesting might be achieved by rerunning @previewlatex{} on the -footnote contents when one opens the footnote for editing. - -@item Support other text properties than just images - -Macros like @samp{\textit} can be rendered as images, but the resulting -humungous blob is not suitable for editing, in particular since the -line filling from LaTeX does not coincide with that of Emacs. It would -be much more useful if text properties just switched the relevant font -to italics rather than replacing the whole text with an image. It -would also make editing quite easier. Then there are things like -footnotes that are currently just replaced by their footnote number. -While editing is not a concern here (the number is not in the original -text, anyway), it would save a lot of conversion time if no images were -generated, but Emacs just displayed a properly fontified version of the -footnote number. Also, this might make @previewlatex{} useful even on -text terminals. - -@item Find a way to facilitate Source Specials - -Probably in connection with adding appropriate support to -@code{dvipng}, it would be nice if clicking on an image from a larger -piece of source code would place the cursor at the respective source -code location. - -@item Make @file{preview.dtx} look reasonable in @AUCTeX{} - -It is a bit embarrassing that @file{preview.dtx} is written in a manner -that will not give either good syntax highlighting or good indentation -when employing @AUCTeX{}. - -@item Web page work - -Currently, @previewlatex{}'s web page is not structured at all. Better -navigation would be desirable, as well as separate News and Errata eye -catchers. - -@item Manual improvements - -@itemize @minus -@item Pepper the manual with screen shots and graphics - -This will be of interest for the @acronym{HTML} and @TeX{} renditions -of the texinfo manual. Since Texinfo now supports images as well, this -could well be nice to have. - -@item Fix duplicates - -Various stuff appears several times. - -@end itemize - -@item Implement rendering pipelines for Emacs - -The current @file{gs.el} interface is fundamentally flawed, not only -because of a broken implementation. A general batchable and -daemonizable rendering infrastructure that can work on all kinds of -preview images for embedding into buffers is warranted. The current -implementation has a rather adhoc flavor and is not easily extended. -It will not work outside of AUCTeX, either. - -@item Integrate into Ref@TeX{} - -When referencing to equations and the like, the preview-images of the -source rather than plain text should be displayed. If the preview in -question covers labels, those should appear in the bubble help and/or a -context menu. Apropos: - -@item Implement @LaTeX{} error indicators - -Previews on erroneous @LaTeX{} passages might gain a red border or similar. - -@item Pop up relevant online documentation for frequent errors - -A lot of errors are of the "badly configured" variety. Perhaps the -relevant info pages should be delivered in addition to the error -message. - -@item Implement a table editing mode where every table cell gets output -as a separate preview. Alternatively, output the complete table -metrics in a way that lets people click on individual cells for editing -purposes. - -@item Benchmark and kill Emacs inefficiencies - -Both the @LaTeX{} run under Emacs control as well as actual image -insertion in Emacs could be faster. CVS Emacs has improved in that -respect, but it still is slower than desirable. - -@item Improve image support under Emacs - -The general image and color handling in Emacs is inefficient and partly -defective. This is still the case in CVS. One option would be to -replace the whole color and image handling with @acronym{GDK} routines -when this library is available, since it has been optimized for it. - -@end itemize diff --git a/packages/auctex/doc/quickstart.texi b/packages/auctex/doc/quickstart.texi deleted file mode 100644 index ceec41c49..000000000 --- a/packages/auctex/doc/quickstart.texi +++ /dev/null @@ -1,299 +0,0 @@ -@include macros.texi - -@node Quick Start -@chapter Quick Start - -@AUCTeX{} is a powerful program offering many features and configuration -options. If you are new to @AUCTeX{} this might be deterrent. -Fortunately you do not have to learn everything at once. This Quick -Start Guide will give you the knowledge of the most important commands -and enable you to prepare your first @LaTeX{} document with @AUCTeX{} -after only a few minutes of reading. - -In this introduction, we assume that @AUCTeX{} is already installed on -your system. If this is not the case, you should read the file -@file{INSTALL} in the base directory of the unpacked distribution -tarball. These installation instructions are available in this manual -as well, @ref{Installation}. We also assume that you are familiar with -the way keystrokes are written in Emacs manuals. If not, have a look at -the Emacs Tutorial in the Help menu. - -If @AUCTeX{} is installed, you might still need to activate it, by -inserting - -@lisp -(load "auctex.el" nil t t) -@end lisp - -in your user init file.@footnote{This usually is a file in your home -directory called @file{.emacs} if you are utilizing GNU Emacs or -@file{.xemacs/init.el} if you are using XEmacs.} In order to get -support for many of the @LaTeX{} packages you will use in your -documents, you should enable document parsing as well, which can be -achieved by putting - -@lisp -(setq TeX-auto-save t) -(setq TeX-parse-self t) -@end lisp - -into your init file. Finally, if you often use @code{\include} or -@code{\input}, you should make @AUCTeX{} aware of the multi-file -document structure. You can do this by inserting - -@lisp -(setq-default TeX-master nil) -@end lisp - -into your init file. Each time you open a new file, @AUCTeX{} will then -ask you for a master file. - -@menu -* Editing Facilities:: Functions for editing TeX files -* Processing Facilities:: Creating and viewing output, debugging -@end menu - -@iftex -This Quick Start Guide covers two main topics: First we explain how -@AUCTeX{} helps you in editing your input file for @TeX{}, @LaTeX{}, and -some other formats. Then we describe the functions that @AUCTeX{} -provides for processing the input files with @LaTeX{}, Bib@TeX{}, etc., -and for viewing and debugging. -@end iftex - -@node Editing Facilities -@section Functions for editing TeX files - -@subsection Making your @TeX{} code more readable - -@AUCTeX{} can do syntax highlighting of your source code, that means -commands will get special colors or fonts. You can enable it locally by -typing @kbd{M-x font-lock-mode RET}. If you want to have font locking -activated generally, enable @code{global-font-lock-mode}, e.g. with -@kbd{M-x customize-variable RET global-font-lock-mode RET}. - -@AUCTeX{} will indent new lines to indicate their syntactical -relationship to the surrounding text. For example, the text of a -@code{\footnote} or text inside of an environment will be indented -relative to the text around it. If the indenting has gotten wrong after -adding or deleting some characters, use @key{TAB} to reindent the line, -@kbd{M-q} for the whole paragraph, or @kbd{M-x LaTeX-fill-buffer RET} -for the whole buffer. - -@subsection Entering sectioning commands -@cindex Sectioning -@cindex Sections -@cindex Chapters -@cindex @code{\chapter} -@cindex @code{\section} -@cindex @code{\subsection} -@cindex @code{\label} - -Insertion of sectioning macros, that is @samp{\chapter}, -@samp{\section}, @samp{\subsection}, etc. and accompanying @samp{\label} -commands may be eased by using @kbd{C-c C-s}. You will be asked for the -section level. As nearly everywhere in @AUCTeX{}, you can use the -@key{TAB} or @key{SPC} key to get a list of available level names, and -to auto-complete what you started typing. Next, you will be asked for -the printed title of the section, and last you will be asked for a label -to be associated with the section. - -@subsection Inserting environments - -Similarly, you can insert environments, that is -@samp{\begin@{@}}--@samp{\end@{@}} pairs: Type @kbd{C-c C-e}, and select -an environment type. Again, you can use @key{TAB} or @key{SPC} to get a -list, and to complete what you type. Actually, the list will not only -provide standard @LaTeX{} environments, but also take your -@samp{\documentclass} and @samp{\usepackage} commands into account if -you have parsing enabled by setting @code{TeX-parse-self} to @code{t}. -If you use a couple of environments frequently, you can use the up and -down arrow keys (or @kbd{M-p} and @kbd{M-n}) in the minibuffer to get -back to the previously inserted commands. - -Some environments need additional arguments. Often, @AUCTeX{} knows about -this and asks you to enter a value. - -@subsection Inserting macros - -@kbd{C-c C-m}, or simply @kbd{C-c RET} will give you a prompt that asks -you for a @LaTeX{} macro. You can use @key{TAB} for completion, or the -up/down arrow keys (or @kbd{M-p} and @kbd{M-n}) to browse the command -history. In many cases, @AUCTeX{} knows which arguments a macro needs -and will ask you for that. It even can differentiate between mandatory -and optional arguments---for details, see @ref{Completion}. - -An additional help for inserting macros is provided by the possibility -to complete macros right in the buffer. With point at the end of a -partially written macro, you can complete it by typing @kbd{M-TAB}. - -@subsection Changing the font - -@AUCTeX{} provides convenient keyboard shortcuts for inserting macros -which specify the font to be used for typesetting certain parts of the -text. They start with @kbd{C-c C-f}, and the last @kbd{C-} combination -tells @AUCTeX{} which font you want: - -@table @kbd -@item C-c C-f C-b -@kindex C-c C-f C-b -@cindex @code{\textbf} -Insert @b{bold face} @samp{\textbf@{@point{}@}} text. - -@item C-c C-f C-i -@kindex C-c C-f C-i -@cindex @code{\textit} -Insert @i{italics} @samp{\textit@{@point{}@}} text. - -@item C-c C-f C-e -@kindex C-c C-f C-e -@cindex @code{\emph} -Insert @i{emphasized} @samp{\emph@{@point{}@}} text. - -@item C-c C-f C-s -@kindex C-c C-f C-s -@cindex @code{\textsl} -Insert @i{slanted} @samp{\textsl@{@point{}@}} text. - -@item C-c C-f C-r -@kindex C-c C-f C-r -@cindex @code{\textrm} -Insert roman @r{\textrm@{@point{}@}} text. - -@item C-c C-f C-f -@kindex C-c C-f C-f -@cindex @code{\textsf} -Insert @sans{sans serif} @samp{\textsf@{@point{}@}} text. - -@item C-c C-f C-t -@kindex C-c C-f C-t -@cindex @code{\texttt} -Insert @t{typewriter} @samp{\texttt@{@point{}@}} text. - -@item C-c C-f C-c -@kindex C-c C-f C-c -@cindex @code{\textsc} -Insert @sc{small caps} @samp{\textsc@{@point{}@}} text. - -@item C-c C-f C-d -@kindex C-c C-f C-c -@cindex Deleting fonts -Delete the innermost font specification containing point. - -@end table - -If you want to change font attributes of existing text, mark it as a -region, and then invoke the commands. If no region is selected, the -command will be inserted with empty braces, and you can start typing the -changed text. - -Most of those commands will also work in math mode, but then macros like -@code{\mathbf} will be inserted. - - -@subsection Other useful features - -@AUCTeX{} also tries to help you when inserting the right ``quote'' -signs for your language, dollar signs to typeset math, or pairs of -braces. It offers shortcuts for commenting out text (@kbd{C-c ;} for -the current region or @kbd{C-c %} for the paragraph you are in). The -same keystrokes will remove the % signs, if the region or paragraph is -commented out yet. With @code{TeX-fold-mode}, you can hide certain -parts (like footnotes, references etc.) that you do not edit currently. -Support for Emacs' outline mode is provided as well. And there's more, -but this is beyond the scope of this Quick Start Guide. - - - -@node Processing Facilities -@section Creating and viewing output, debugging - -@subsection One Command for @LaTeX{}, helpers, viewers, and printing - -If you have typed some text and want to run @LaTeX{} (or @TeX{}, or -other programs---see below) on it, type @kbd{C-c C-c}. If applicable, -you will be asked whether you want to save changes, and which program -you want to invoke. In many cases, the choice that @AUCTeX{} suggests -will be just what you want: first @command{latex}, then a viewer. If a -@command{latex} run produces or changes input files for -@command{makeindex}, the next suggestion will be to run that program, -and @AUCTeX{} knows that you need to run @command{latex} again -afterwards---the same holds for Bib@TeX{}. - -When no processor invocation is necessary anymore, @AUCTeX{} will -suggest to run a viewer, or you can chose to create a PostScript file -using @command{dvips}, or to directly print it. - -At this place, a warning needs to be given: First, although @AUCTeX{} is -really good in detecting the standard situations when an additional -@command{latex} run is necessary, it cannot detect it always. Second, -the creation of PostScript files or direct printing currently only works -when your output file is a @acronym{DVI} file, not a @acronym{PDF} file. - -Ah, you didn't know you can do both? That brings us to the next topic. - -@subsection Choosing an output format - -From a @LaTeX{} file, you can produce @acronym{DVI} output, or a -@acronym{PDF} file directly @i{via} @command{pdflatex}. You can switch -on source specials for easier navigation in the output file, or tell -@command{latex} to stop after an error (usually @code{\noninteractive} -is used, to allow you to detect all errors in a single run). - -These options are controlled by toggles, the keystrokes should be easy -to memorize: - -@table @kbd -@item @kbd{C-c C-t C-p} -This command toggles between @acronym{DVI} and @acronym{PDF} output - -@item @kbd{C-c C-t C-i} -toggles interactive mode - -@item @kbd{C-c C-t C-s} -toggles source specials support - -@item @kbd{C-c C-t C-o} -toggles usage of Omega/lambda. - -@end table - -@subsection Debugging @LaTeX{} - -When @AUCTeX{} runs a program, it creates an output buffer in which it -displays the output of the command. If there is a syntactical error in -your file, @command{latex} will not complete successfully. @AUCTeX{} -will tell you that, and you can get to the place where the first error -occured by pressing @kbd{C-c `} (the last character is a backtick). The -view will be split in two windows, the output will be displayed in the -lower buffer, and both buffers will be centered around the place where -the error ocurred. You can then try to fix it in the document buffer, -and use the same keystrokes to get to the next error. This procedure -may be repeated until all errors have been dealt with. By pressing -@kbd{C-c C-w} (@code{TeX-toggle-debug-boxes}) you can toggle whether -@AUCTeX{} should notify you of overfull and underfull boxes in addition -to regular errors. - -If a command got stuck in a seemingly infinite loop, or you want to stop -execution for other reasons, you can use @kbd{C-c C-k} (for ``kill''). -Similar to @kbd{C-l}, which centers the buffer you are in around your -current position, @kbd{C-c C-l} centers the output buffer so that the -last lines added at the bottom become visible. - -@subsection Running @LaTeX{} on parts of your document - -If you want to check how some part of your text looks like, and do not -want to wait until the whole document has been typeset, then mark it as -a region and use @kbd{C-c C-r}. It behaves just like @kbd{C-c C-c}, but -it only uses the document preamble and the region you marked. - -If you are using @code{\include} or @code{\input} to structure your -document, try @kbd{C-c C-b} while you are editing one of the included -files. It will run @command{latex} only on the current buffer, using the -preamble from the master file. -@c does this also work with input? why not? - -@c Local Variables: -@c mode: texinfo -@c TeX-master: "auctex" -@c End: diff --git a/packages/auctex/doc/todo.texi b/packages/auctex/doc/todo.texi deleted file mode 100644 index 5ac6703a2..000000000 --- a/packages/auctex/doc/todo.texi +++ /dev/null @@ -1,345 +0,0 @@ -@c This is part of the AUCTeX Manual. -@c Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. -@c See the file auctex.texi for copying conditions. -@ifset rawfile -@include macros.texi -@node Development,,(dir),(dir) -@top Future Development of @AUCTeX{} -@end ifset - -The following sections describe future development of @AUCTeX{}. -Besides mid-term goals, bug reports and requests we cannot fix or honor -right away are being gathered here. If you have some time for Emacs -Lisp hacking, you are encouraged to try to provide a solution to one of -the following problems. If you don't know Lisp, you may help us to -improve the documentation. It might be a good idea to discuss proposed -changes on the mailing list of @AUCTeX{} first. - -@menu -* Mid-term Goals:: -* Wishlist:: -* Bugs:: -@end menu - -@ifset rawfile -@node Mid-term Goals -@chapter Mid-term Goals -@raisesections -@end ifset - -@ifclear rawfile -@node Mid-term Goals -@section Mid-term Goals -@end ifclear - -@itemize @bullet -@item Integration of @previewlatex{} into @AUCTeX{} - -As of @AUCTeX{} 11.81 @previewlatex{} is a part of @AUCTeX{} in the -sense that the installation routines were merged and @previewlatex{} is -being packaged with @AUCTeX{}. - -Further integration will happen at the backend. This involves folding -of error parsing and task management of both packages which will ease -development efforts and avoid redundant work. - -@item More flexible option and command handling - -The current state of command handling with @code{TeX-command-list} is -not very flexible because there is no distinction between executables -and command line options to be passed to them. - -Customization of @code{TeX-command-list} by the user will interfere with -updates of @AUCTeX{}. - -@item Error help catalogs - -Currently, the help for errors is more or less hardwired into -@file{tex.el}. For supporting error help in other languages, it would -be sensible to instead arrange error messages in language-specific -files, make a common info file from all such catalogs in a given -language and look the error texts up in an appropriate index. The user -would then specify a preference list of languages, and the errors would -be looked up in the catalogs in sequence until they were identified. - -@item Combining @samp{docTeX} with RefTeX - -Macro cross references should also be usable for document navigation -using RefTeX. - - -@end itemize - -@node Wishlist -@section Wishlist - -@itemize @bullet -@item Documentation lookup for macros - -A parser could gather information about which macros are defined in -which @LaTeX{} packages and store the information in a hashtable which -can be used in a backend for @code{TeX-doc} in order to open the -matching documentation for a given macro. The information could also be -used to insert an appropriate @samp{\usepackage} statement if the user -tries to insert a macro for which the respective package has not been -requested yet. - -@item Spell checking of macros - -A special ispell dictionary for macros could be nice to have. - -@item Quick error overviews - -An error overview window (extract from the log file with just the error -lines, clickable like a ``grep'' buffer) and/or fringe indicators for -errors in the main text would be nice. - -@item A math entry grid - -A separate frame with a table of math character graphics to click on in -order to insert the respective sequence into the buffer (cf. the -``grid'' of x-symbol). - -@item Crossreferencing support - -It would be nice if you could index process your favorite collection of -@file{.dtx} files (such as the LaTeX source), just call a command on -arbitrary control sequence, and get either the DVI viewer opened right -at the definition of that macro (using Source Specials), or the source -code of the @file{.dtx} file. - -@item Better plain TeX support - -For starters, @code{LaTeX-math-mode} is not very @LaTeX{}-specific in -the first place, and similar holds for indentation and formatting. - -@item Poor man's Source Specials -In particular in PDF mode (and where Source Specials cause problems), -alternatives would be desirable. One could implement inverse search by -something like Heiko Oberdiek's @file{vpe.sty}, and forward search by -using the @file{.aux} file info to correlate labels in the text -(possibly in cooperation with Ref@TeX{}) with previewer pages. - -In @AUCTeX{} 11.83, support for forward search with PDF files was added. -Currently this only works if you use the pdfsync @LaTeX{} package and -xpdf as your PDF viewer. -@ifclear rawfile -@xref{Viewing}. -@end ifclear - - -@item -Page count when compiling should (optionally) go to modeline of the -window where the compilation command was invoked, instead of the output -window. Suggested by Karsten Tinnefeld -. - -@item -Command to insert a macrodefinition in the preamble, without moving -point from the current location. Suggested by -"Jeffrey C. Ely" . - -@item -A database of all commands defined in all stylefiles. When a command or -environment gets entered that is provided in one of the styles, insert -the appropriate @code{\usepackage} in the preamble. - -@item -A way to add and overwrite math mode entries in style files, and to -decide where they should be. Suggested by Remo Badii . - -@item -Create template for (first) line of tabular environment. - -@item -@c Already fixed? -I think prompting for the master is the intended behaviour. It -corresponds to a `shared' value for TeX-master. - -There should probably be a `none' value which wouldn't query for the -master, but instead disable all features that relies on TeX-master. - -This default value for TeX-master could then be controled with mapping -based on the extension. - -@item -Multiple argument completion for @samp{\bibliography}. In general, I -ought to make @kbd{,} special for these kind of completions. - -@item -Suggest @samp{makeindex} when appropriate. - -@item -Use index files (when available) to speed up @kbd{C-c C-m include -@key{RET}}. - -@item -Option not to calculate very slow completions like for -@kbd{C-c C-m include @key{RET}}. - -@item -Font menu should be created from @code{TeX-font-list}. - -@item -Installation procedure written purely in emacs lisp. - -@item -Included PostScript files should also be counted as part of the -document. - -@item -A nice hierarchical by-topic organization of all officially documented -LaTeX macros, available from the menu bar. - -@item -@code{TeX-command-default} should be set from the master file, if not -set locally. Suggested by Peter Whaite @samp{}. - -@item -Make @AUCTeX{} work with @samp{crypt++}. Suggested by Chris Moore -@samp{}. - -@item -Make @AUCTeX{} work with @samp{longlines}. This would also apply to -@previewlatex{}, though it might make sense to unify error processing -before attempting this. - -@item -The @samp{Spell} command should apply to all files in a document. Maybe -it could try to restrict to files that have been modified since last -spell check? Suggested by Ravinder Bhumbla @samp{}. - -@item -Make @key{.} check for abbreviations and sentences ending with capital -letters. - -@item -Use Emacs 19 minibuffer history to choose between previewers, and other -stuff. Suggested by John Interrante -@samp{}. - -@item -Make features. - -A new command @code{TeX-update} (@kbd{C-c C-u}) could be used to create -an up-to-date dvi file by repeatedly running Bib@TeX{}, MakeIndex and -(La)@TeX{}, until an error occurs or we are done. - -An alternative is to have an @samp{Update} command that ensures the -@samp{dvi} file is up to date. This could be called before printing and -previewing. - -@item -Documentation of variables that can be set in a style hook. - -We need a list of what can safely be done in an ordinary style hook. -You can not set a variable that @AUCTeX{} depends on, unless @AUCTeX{} -knows that it has to run the style hooks first. - -Here is the start of such a list. -@table @code - -@item LaTeX-add-environments - -@item TeX-add-symbols - -@item LaTeX-add-labels - -@item LaTeX-add-bibliographies - -@item LaTeX-largest-level - -@end table - -@item -Completion for counters and sboxes. - -@item -Outline should be (better) supported in @TeX{} mode. - -At least, support headers, trailers, as well as TeX-outline-extra. - -@item -@code{TeX-header-start} and @code{TeX-trailer-end}. - -We might want these, just for fun (and outlines) - -@item -Plain @TeX{} and @LaTeX{} specific header and trailer expressions. - -We should have a way to globally specify the default value of the header -and trailer regexps. - -@item -Get closer to original @code{TeX-mode} keybindings. - -A third initialization file (@file{tex-mode.el}) containing an emulator -of the standard @code{TeX-mode} would help convince some people to -change to @AUCTeX{}. - -@item -Make @code{TeX-next-error} parse ahead and store the results in a list, -using markers to remember buffer positions in order to be more robust -with regard to line numbers and changed files. This is what -@code{next-error} does. (Or did, until Emacs 19). - -@item -Finish the Texinfo mode. For one thing, many Texinfo mode commands do -not accept braces around their arguments. - -@item -Hook up the letter environment with @file{bbdb.el}. - -@end itemize - -@node Bugs -@section Bugs - -@c FIXME: Are those bugs still present? - -@itemize @bullet -@item The parsed files and style hooks for @file{example.dtx}, -@file{example.sty}, @file{example.drv} and @file{example.bib} all -clash. Bad. - -@item -@kbd{C-c `} should always stay in the current window, also when it finds -a new file. - -@item -Do not overwrite emacs warnings about existing auto-save files when -loading a new file. - -@item -Maybe the regexp for matching a TeX symbol during parsing should be -@samp{"\\\\\\([a-zA-Z]+\\|.\\)"} --- -@samp{} Peter Thiemann. - -@item -@AUCTeX{} should not parse verbatim environments. - -@item -Make @samp{`} check for math context in @code{LaTeX-math-mode}. and -simply self insert if not in a math context. - -@item -Make @code{TeX-insert-dollar} more robust. Currently it can be fooled -by @samp{\mbox}'es and escaped double dollar for example. - -@item -Correct indentation for tabular, tabbing, table, math, and array -environments. - -@item -No syntactic font locking of verbatim macros and environments. (XEmacs -only) - -@item -Font locking inside of verbatim macros and environments is not -inhibited. This may result in syntax highlighting of unbalanced dollar -signs and the like spilling out of the verbatim content. (XEmacs only) - -@item -Folding of @LaTeX{} constructs spanning more than one line may result in -overfull lines. (XEmacs only) -@end itemize diff --git a/packages/auctex/doc/version.texi b/packages/auctex/doc/version.texi deleted file mode 100644 index 70eb7271f..000000000 --- a/packages/auctex/doc/version.texi +++ /dev/null @@ -1,2 +0,0 @@ -@set VERSION 11.86 -@set UPDATED 2010-02-21 diff --git a/packages/auctex/doc/wininstall.texi b/packages/auctex/doc/wininstall.texi deleted file mode 100644 index 3aa93b23e..000000000 --- a/packages/auctex/doc/wininstall.texi +++ /dev/null @@ -1,391 +0,0 @@ -@c This is part of the AUCTeX Manual. -@c Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009 -@c Free Software Foundation, Inc. -@c See the file auctex.texi for copying conditions. -@ifset rawfile -@include macros.texi -@end ifset - -@subheading In a Nutshell - -The following are brief installation instructions for the impatient. In -case you don't understand some of this, run into trouble of some sort, -or need more elaborate information, refer to the detailed instructions -further below. - -@enumerate -@item -Install the prerequisites, i.e. Emacs or XEmacs, MSYS or Cygwin, a -@TeX{} system, and Ghostscript. - -@item -Open the MSYS shell or a Cygwin shell and change to the directory -containing the unzipped file contents. - -@item -Configure @AUCTeX{}: - -For Emacs: Many people like to install @AUCTeX{} into the pseudo file -system hierarchy set up by the Emacs installation. Assuming Emacs is -installed in @file{C:/Program Files/Emacs} and the directory for local -additions of your @TeX{} system, e.g. MiK@TeX{}, is -@file{C:/localtexmf}, you can do this by typing the following statement -at the shell prompt: - -@example -./configure --prefix='C:/Program Files/Emacs' \ - --infodir='C:/Program Files/Emacs/info' \ - --with-texmf-dir='C:/localtexmf' -@end example - -For XEmacs: You can install @AUCTeX{} as an XEmacs package. Assuming -XEmacs is installed in @file{C:/Program Files/XEmacs} and the directory -for local additions of your @TeX{} system, e.g. MiK@TeX{}, is -@file{C:/localtexmf}, you can do this by typing the following command at -the shell prompt: - -@example -./configure --with-xemacs='C:/Program Files/XEmacs/bin/xemacs' \ - --with-texmf-dir='C:/localtexmf' -@end example - -The commands above are examples for common usage. More on configuration -options can be found in the detailed installation instructions below. - -If the configuration script failed to find all required programs, make -sure that these programs are in your system path and add directories -containing the programs to the @env{PATH} environment variable if -necessary. Here is how to do that in W2000/XP: - -@enumerate -@cindex Adding to @env{PATH} in Windows -@cindex @env{PATH} in Windows -@item -On the desktop, right click ``My Computer'' and select properties. -@item -Click on ``Advanced'' in the ``System Properties'' window. -@item -Select ``Environment Variables''. -@item -Select ``path'' in ``System Variables'' and click ``edit''. Move to the -front in the line (this might require scrolling) and add the missing -path including drive letter, ended with a semicolon. -@end enumerate - -@item -If there were no further error messages, type - -@example -make -@end example - -In case there were, please refer to the detailed description below. - -@item -Finish the installation by typing - -@example -make install -@end example -@end enumerate - -@subheading Detailed Installation Instructions - -Installation of @AUCTeX{} under Windows is in itself not more -complicated than on other platforms. However, meeting the prerequisites -might require more work than on some other platforms, and feel less -natural. - -If you are experiencing any problems, even if you think they are of your -own making, be sure to report them to @email{auctex-devel@@gnu.org} so -that we can explain things better in future. - -Windows is a problematic platform for installation scripts. The main -problem is that the installation procedure requires consistent file -names in order to find its way in the directory hierarchy, and Windows -path names are a mess. - -The installation procedure tries finding stuff in system search paths -and in Emacs paths. For that to succeed, you have to use the same -syntax and spelling and case of paths everywhere: in your system search -paths, in Emacs' @code{load-path} variable, as argument to the scripts. -If your path names contain spaces or other `shell-unfriendly' -characters, most notably backslashes for directory separators, place the -whole path in @samp{"double quote marks"} whenever you specify it on a -command line. - -Avoid `helpful' magic file names like @samp{/cygdrive/c} and -@samp{C:\PROGRA~1\} like the plague. It is quite unlikely that the -scripts will be able to identify the actual file names involved. Use -the full paths, making use of normal Windows drive letters like -@samp{ 'C:/Program Files/Emacs' } where required, and using the same -combination of upper- and lowercase letters as in the actual files. -File names containing shell-special characters like spaces or -backslashes (if you prefer that syntax) need to get properly quoted to -the shell: the above example used single quotes for that. - -Ok, now here are the steps to perform: - -@enumerate -@item -You need to unpack the @AUCTeX{} distribution (which you seemingly have -done since you are reading this). It must be unpacked in a separate -installation directory outside of your Emacs file hierarchy: the -installation will later copy all necessary files to their final -destination, and you can ultimately remove the directory where you -unpacked the files. - -Line endings are a problem under Windows. The distribution contains -only text files, and theoretically most of the involved tools should get -along with that. However, the files are processed by various utilities, -and it is conceivable that not all of them will use the same line ending -conventions. If you encounter problems, it might help if you try -unpacking (or checking out) the files in binary mode, if your tools -allow that. - -If you don't have a suitable unpacking tool, skip to the next step: this -should provide you with a working @samp{unzip} command. - -@item -The installation of @AUCTeX{} will require the MSYS tool set from -@uref{http://www.mingw.org/} or the Cygwin tool set from -@uref{http://cygwin.com/}. The latter is slower and larger (the download -size of the base system is about 15 MB) but comes with a package manager -that allows for updating the tool set and installing additional packages -like, for example, the spell checker @w{aspell}. - -If Cygwin specific paths like @samp{/cygdrive/c} crop up in the course -of the installation, using a non-Cygwin Emacs could conceivably cause -trouble. Using Cygwin either for everything or nothing might save -headaches, @emph{if} things don't work out. - -@item -Install a current version of XEmacs from @uref{http://www.xemacs.org/} -or @w{Emacs} from @uref{ftp://ftp.gnu.org/gnu/emacs/windows/}. -@w{Emacs} is the recommended choice because it is currently the primary -platform for @AUCTeX{} development. - -@item -You need a working @TeX{} installation. One popular installation under -Windows is @uref{http://www.miktex.org,MiK@TeX{}}. Another much more -extensive system is @uref{http://www.tug.org/texlive,@w{@TeX{} Live}} -which is rather close to its Unix cousins. - -@item -A working copy of @uref{http://www.cs.wisc.edu/~ghost/,Ghostscript} is -required for @previewlatex{} operation. Examining the output from -@example -gswin32c -h -@end example -on a Windows command line should tell you whether your Ghostscript -supports the @code{png16m} device needed for @acronym{PNG} support. -MiKTeX apparently comes with its own Ghostscript called @samp{mgs.exe}. - -@item -@uref{http://www.perl.org,Perl} is needed for rebuilding the -documentation if you are working with a copy from @acronym{CVS} or have -touched documentation source files in the @previewlatex{} part. If the -line endings of the file @file{preview/latex/preview.dtx} don't -correspond with what Perl calls @code{\n} when reading text files, -you'll run into trouble. - -@item -Now the fun stuff starts. If you have not yet done so, unpack the -@AUCTeX{} distribution into a separate directory after rereading the -instructions for unpacking above. - -@item -Ready for takeoff. Start some shell (typically @command{bash}) capable of -running @command{configure}, change into the installation directory and -call @command{./configure} with appropriate options. - -Typical options you'll want to specify will be -@table @code -@item --prefix=@var{drive:/path/to/emacs-hierarchy} -which tells @file{configure} where to perform the installation. It may -also make @file{configure} find Emacs or XEmacs automatically; if this -doesn't happen, try one of @samp{--with-emacs} or @samp{--with-xemacs} -as described below. All automatic detection of files and directories -restricts itself to directories below the @var{prefix} or in the same -hierarchy as the program accessing the files. Usually, directories like -@file{man}, @file{share} and @file{bin} will be situated right under -@var{prefix}. - -This option also affects the defaults for placing the Texinfo -documentation files (see also @samp{--infodir} below) and automatically -generated style hooks. - -If you have a central directory hierarchy (not untypical with Cygwin) -for such stuff, you might want to specify its root here. You stand a -good chance that this will be the only option you need to supply, as -long as your @TeX{}-related executables are in your system path, which -they better be for @AUCTeX{}'s operation, anyway. - -@item --with-emacs -if you are installing for a version of Emacs. You can use -@samp{--with-emacs=@var{drive:/path/to/emacs}} to specify the name of the -installed Emacs executable, complete with its path if necessary (if -Emacs is not within a directory specified in your @env{PATH} environment -setting). - -@item --with-xemacs -if you are installing for a version of XEmacs. Again, you can use -@samp{--with-xemacs=@var{drive:/path/to/xemacs}} to specify the name of the -installed XEmacs executable complete with its path if necessary. It may -also be necessary to specify this option if a copy of Emacs is found in -your @env{PATH} environment setting, but you still would like to install -a copy of @AUCTeX{} for XEmacs. - -@item --with-packagedir=@var{drive:/dir} -is an XEmacs-only option giving the location of the package directory. -This will install and activate the package. Emacs uses a different -installation scheme: - -@item --with-lispdir=@var{drive:/path/to/site-lisp} -This Emacs-only option tells a place in @code{load-path} below which the -files are situated. The startup files @file{auctex.el} and -@file{preview-latex.el} will get installed here unless a subdirectory -@file{site-start.d} exists which will then be used instead. The other -files from @AUCTeX{} will be installed in a subdirectory called -@file{auctex}. - -If you think that you need a different setup, please refer to the full -installation instructions in -@ifset rawfile -the @file{INSTALL} file. -@end ifset -@ifclear rawfile -@ref{Configure}. -@end ifclear - -@item --infodir=@var{drive:/path/to/info/directory} -If you are installing into an Emacs directory, info files have to be put -into the @file{info} folder below that directory. The configuration -script will usually try to install into the folder @file{share/info}, so -you have to override this by specifying something like -@samp{--infodir='C:/Program Files/info'} for the configure call. - -@item --with-auto-dir=@var{drive:/dir} -Directory containing automatically generated information. You should -not normally need to set this, as @samp{--prefix} should take care of -this. - -@item --disable-preview -Use this option if your Emacs version is unable to support image -display. This will be the case if you are using a native variant of -@w{Emacs 21}. - -@item --with-texmf-dir=@var{drive:/dir} -This will specify the directory where your @TeX{} installation sits. If -your @TeX{} installation does not conform to the TDS (@TeX{} directory -standard), you may need to specify more options to get everything in -place. -@end table - -For more information about any of the above and additional options, see -@ifset rawfile -the `Configure' section in the @file{INSTALL} file. -@end ifset -@ifclear rawfile -@ref{Configure}. -@end ifclear - -Calling -@file{./configure --help=recursive} -will tell about other options, but those are almost never required. - -Some executables might not be found in your path. That is not a good -idea, but you can get around by specifying environment variables to -@file{configure}: -@example -GS="@var{drive:/path/to/gswin32c.exe}" ./configure @dots{} -@end example -should work for this purpose. @file{gswin32c.exe} is the usual name for -the required @emph{command line} executable under Windows; in contrast, -@file{gswin32.exe} is likely to fail. - -As an alternative to specifying variables for the @file{configure} call -you can add directories containing the required executables to the -@env{PATH} variable of your Windows system. This is especially a good -idea if Emacs has trouble finding the respective programs later during -normal operation. - -@item -Run @command{make} in the installation directory. - -@item -Run @code{make install} in the installation directory. - -@item -With XEmacs, @AUCTeX{} and @previewlatex{} should now be active by -default. With Emacs, activation depends on a working -@file{site-start.d} directory or similar setup, since then the startup -files @file{auctex.el} and @file{preview-latex.el} will have been placed -there. If this has not been done, you should be able to load the -startup files manually with -@example -(load "auctex.el" nil t t) -(load "preview-latex.el" nil t t) -@end example -in either a site-wide @file{site-start.el} or your personal startup file -(usually accessible as @file{~/.emacs} from within Emacs and -@file{~/.xemacs/init.el} from within XEmacs). - -@cindex @file{tex-mik.el} -@cindex @file{tex-fptex.el} -The default configuration of @AUCTeX{} is probably not the best fit for -Windows systems. You might want to add -@example -(require 'tex-mik) -@end example -or -@example -(require 'tex-fptex) -@end example -in order to get more appropriate values for MiK@TeX{} and fp@TeX{}, -respectively after loading @file{auctex.el} and @file{preview-latex.el}. - -You can always use - -@example -@kbd{M-x customize-group RET AUCTeX RET} -@end example - -in order to customize more stuff, or use the @samp{Customize} menu. - -@item -Load @file{preview/circ.tex} into Emacs or XEmacs and see if you get the -@samp{Command} menu. Try using it to @LaTeX{} the file. - -@item -Check whether the @samp{Preview} menu is available in this file. Use it -to generate previews for the document. - -If this barfs and tells you that image type @samp{png} is not supported, -you can either add @acronym{PNG} support to your Emacs installation or -choose another image format to be used by @previewlatex{}. - -Adding support for an image format usually involves the installation of -a library, e.g. from @uref{http://gnuwin32.sf.net/}. If you got your -Emacs from @uref{gnu.org} you might want to check its -@uref{ftp://ftp.gnu.org/gnu/emacs/windows/README,README file} for -details. - -A different image format can be chosen by setting the variable -@code{preview-image-type}. While it is recommended to keep the -@samp{dvipng} or @samp{png} setting, you can temporarily select a -different format like @samp{pnm} to check if the lack of @acronym{PNG} -support is the only problem with your Emacs installation. - -Try adding the line - -@example -(setq preview-image-type 'pnm) -@end example - -to your init file for a quick test. You should remove the line after -the test again, because @acronym{PNM} files take away @strong{vast} -amounts of disk space, and thus also of load/save time. -@end enumerate - -Well, that about is all. Have fun! diff --git a/packages/auctex/font-latex.el b/packages/auctex/font-latex.el deleted file mode 100644 index 2b146c7a6..000000000 --- a/packages/auctex/font-latex.el +++ /dev/null @@ -1,1958 +0,0 @@ -;;; font-latex.el --- LaTeX fontification for Font Lock mode. - -;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, -;; 2004, 2005, 2006, 2007, 2008 Free Software Foundation. - -;; Authors: Peter S. Galbraith -;; Simon Marshall -;; Maintainer: auctex-devel@gnu.org -;; Created: 06 July 1996 -;; Keywords: tex, wp, faces - -;;; This file is not part of GNU Emacs. - -;; This package is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This package is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, -;; Boston, MA 02110-1301, USA. - -;;; Commentary: -;; -;; This package enhances font-lock fontification patterns for LaTeX. -;; font-lock mode is a minor mode that causes your comments to be -;; displayed in one face, strings in another, reserved words in -;; another, and so on. -;; -;; ** Infinite loops !? ** -;; If you get an infinite loop, send a bug report! -;; Then set the following in your ~/.emacs file to keep on working: -;; (setq font-latex-do-multi-line nil) - -;;; Code: - -(require 'font-lock) -(require 'tex) - -(eval-when-compile - (require 'cl)) - -(defgroup font-latex nil - "Font-latex text highlighting package." - :prefix "font-latex-" - :group 'faces - :group 'tex - :group 'AUCTeX) - -(defgroup font-latex-keywords nil - "Keywords for highlighting text in font-latex." - :prefix "font-latex-" - :group 'font-latex) - -(defgroup font-latex-highlighting-faces nil - "Faces for highlighting text in font-latex." - :prefix "font-latex-" - :group 'font-latex) - -(defvar font-latex-multiline-boundary 5000 - "Size of region to search for the start or end of a multiline construct.") - -(defvar font-latex-quote-regexp-beg nil - "Regexp used to find quotes.") -(make-variable-buffer-local 'font-latex-quote-regexp-beg) - -(defvar font-latex-quote-list '(("``" "''") ("<<" ">>" french) ("«" "»" french)) - "List of quote specifiers for quotation fontification. - -Each element of the list is either a list consisting of two -strings to be used as opening and closing quotation marks -independently of the value of `font-latex-quotes' or a list with -three elements where the first and second element are strings for -opening and closing quotation marks and the third element being -either the symbol 'german or 'french describing the order of -quotes. - -If `font-latex-quotes' specifies a different state, order of the -added quotes will be reversed for fontification. For example if -'(\"\\\"<\" \"\\\">\" french) is given but `font-latex-quotes' -specifies 'german, quotes will be used like \">foo\"< for -fontification.") - -(defvar font-latex-quotes-control nil - "Internal variable for keeping track if `font-latex-quotes' changed.") -(make-variable-buffer-local 'font-latex-quotes-control) - -(defvar font-latex-quotes-internal nil - "Internal variable for tracking outcome of automatic detection. -If automatic detection is not enabled, it is assigned the value -of `font-latex-quotes'.") -(make-variable-buffer-local 'font-latex-quotes-internal) - -(defvar font-latex-quotes-fallback 'french - "Fallback value for `font-latex-quotes' if automatic detection fails.") - -(defvar font-latex-quote-style-list-french - '("french" "frenchb" "frenchle" "frenchpro" "francais" "canadien" - "acadian" "italian") - "List of styles for which French-style quote matching should be activated.") - -(defvar font-latex-quote-style-list-german - '("austrian" "german" "germanb" "naustrian" "ngerman") - "List of styles for which German-style quote matching should be activated.") - -(defcustom font-latex-quotes 'auto - "Whether to fontify << French quotes >> or >>German quotes<<. -Also selects \" versus \">quote\"<. - -If value `auto' is chosen, an attempt is being made in deriving -the type of quotation mark matching from document settings like -the language option supplied to the babel package. - -If nil, quoted content will not be fontified." - :type '(choice (const auto) (const french) (const german) (const nil)) - :group 'font-latex) -(put 'font-latex-quotes 'safe-local-variable - '(lambda (x) (memq x '(auto french german nil)))) - -(defun font-latex-add-quotes (quotes) - "Add QUOTES to `font-latex-quote-list'. -QUOTES has to be a list adhering to the format of an element of -`font-latex-quote-list'." - (setq font-latex-quotes-control nil) - (make-local-variable 'font-latex-quote-list) - (add-to-list 'font-latex-quote-list quotes)) - -(defun font-latex-quotes-set-internal () - "Set `font-latex-quotes-internal' according to `font-latex-quotes'. -If `font-latex-quotes' is set to `auto', try to derive the -correct value from document properties." - (setq font-latex-quotes-internal - (if (eq font-latex-quotes 'auto) - (or (when (TeX-elt-of-list-member - font-latex-quote-style-list-french TeX-active-styles) - 'french) - (when (TeX-elt-of-list-member - font-latex-quote-style-list-german TeX-active-styles) - 'german) - font-latex-quotes-fallback) - font-latex-quotes))) -;; Update the value of `font-latex-quotes-internal' when the list of -;; styles changes. -(add-hook 'TeX-update-style-hook 'font-latex-quotes-set-internal) - -;; The definitions of the title faces were originally taken from -;; info.el (Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 97, 98, 99, -;; 2000, 2001 Free Software Foundation, Inc.) and adapted to the needs -;; of font-latex.el. - -(defconst font-latex-sectioning-max 5 - "Highest number for font-latex-sectioning-N-face") -(defface font-latex-sectioning-5-face - (if (featurep 'xemacs) - '((((type tty pc) (class color) (background light)) - (:foreground "blue4" :bold t)) - (((type tty pc) (class color) (background dark)) - (:foreground "yellow" :bold t)) - (((class color) (background light)) - (:bold t :foreground "blue4" :family "helvetica")) - (((class color) (background dark)) - (:bold t :foreground "yellow" :family "helvetica")) - (t (:bold t :family "helvetica"))) - '((((type tty pc) (class color) (background light)) - (:foreground "blue4" :weight bold)) - (((type tty pc) (class color) (background dark)) - (:foreground "yellow" :weight bold)) - (((class color) (background light)) - (:weight bold :inherit variable-pitch :foreground "blue4")) - (((class color) (background dark)) - (:weight bold :inherit variable-pitch :foreground "yellow")) - (t (:weight bold :inherit variable-pitch)))) - "Face for sectioning commands at level 5." - :group 'font-latex-highlighting-faces) - -(defun font-latex-update-sectioning-faces (&optional max height-scale) - "Update sectioning commands faces." - (unless height-scale - (setq height-scale (if (numberp font-latex-fontify-sectioning) - font-latex-fontify-sectioning - 1.1))) - (unless max - (setq max font-latex-sectioning-max)) - (dotimes (num max) - (let* (;; reverse for XEmacs: - (num (- max (1+ num))) - (face-name (intern (format "font-latex-sectioning-%s-face" num)))) - (unless (get face-name 'saved-face) ; Do not touch customized faces. - (if (featurep 'xemacs) - (let ((size - ;; Multiply with .9 because `face-height' returns a value - ;; slightly larger than the actual font size. - ;; `make-face-size' takes numeric points according to Aidan - ;; Kehoe in <16989.15536.613916.678965@parhasard.net> (not - ;; documented). - (round (* 0.9 - (face-height 'default) - (expt height-scale (- max 1 num)))))) - ;; (message "%s - %s" face-name size) - (make-face-size face-name size)) - (set-face-attribute face-name nil :height height-scale)))))) - -(defcustom font-latex-fontify-sectioning 1.1 - "Whether to fontify sectioning macros with varying height or a color face. - -If it is a number, use varying height faces. The number is used -for scaling starting from `font-latex-sectioning-5-face'. Typically -values from 1.05 to 1.3 give best results, depending on your font -setup. If it is the symbol `color', use `font-lock-type-face'. - -Caveats: Customizing the scaling factor applies to all sectioning -faces unless those face have been saved by customize. Setting -this variable directly does not take effect unless you call -`font-latex-update-sectioning-faces' or restart Emacs. - -Switching from `color' to a number or vice versa does not take -effect unless you call \\[font-lock-fontify-buffer] or restart -Emacs." - ;; Possibly add some words about XEmacs here. :-( - :type '(choice (number :tag "Scale factor") - (const color)) - :initialize 'custom-initialize-default - :set (lambda (symbol value) - (set-default symbol value) - (unless (eq value 'color) - (font-latex-update-sectioning-faces font-latex-sectioning-max value))) - :group 'font-latex) - -(defun font-latex-make-sectioning-faces (max &optional height-scale) - "Build the faces used to fontify sectioning commands." - (unless max (setq max font-latex-sectioning-max)) - (unless height-scale - (setq height-scale (if (numberp font-latex-fontify-sectioning) - font-latex-fontify-sectioning - 1.1))) - (dotimes (num max) - (let* (;; reverse for XEmacs: - (num (- max (1+ num))) - (face-name (intern (format "font-latex-sectioning-%s-face" num))) - (f-inherit (intern (format "font-latex-sectioning-%s-face" (1+ num)))) - (size (when (featurep 'xemacs) - (round (* 0.9 (face-height 'default) - (expt height-scale (- max 1 num))))))) - (eval - `(defface ,face-name - (if (featurep 'xemacs) - '((t (:size ,(format "%spt" size)))) - '((t (:height ,height-scale :inherit ,f-inherit)))) - (format "Face for sectioning commands at level %s. - -Probably you don't want to customize this face directly. Better -change the base face `font-latex-sectioning-5-face' or customize the -variable `font-latex-fontify-sectioning'." num) - :group 'font-latex-highlighting-faces)) - (when (and (featurep 'xemacs) - ;; Do not touch customized faces. - (not (get face-name 'saved-face))) - (set-face-parent face-name f-inherit) - ;; Explicitely set the size again to code around the bug that - ;; `set-face-parent' overwrites the original face size. - (make-face-size face-name size))))) - -(font-latex-make-sectioning-faces font-latex-sectioning-max) - - -;;; Keywords - -(defvar font-latex-keywords-1 nil - "Subdued level highlighting for LaTeX modes.") - -(defvar font-latex-keywords-2 nil - "High level highlighting for LaTeX modes.") - -(defvar font-latex-built-in-keyword-classes - '(("warning" - ("nopagebreak" "pagebreak" "newpage" "clearpage" "cleardoublepage" - "enlargethispage" "nolinebreak" "linebreak" "newline" "-" "\\" "\\*" - "appendix" "displaybreak" "allowdisplaybreaks" "include") - 'font-latex-warning-face 1 noarg) - ("variable" - (("setlength" "|{\\{") ("settowidth" "|{\\{") ("setcounter" "{|{\\") - ("addtolength" "|{\\{") ("addtocounter" "{|{\\")) - 'font-lock-variable-name-face 2 command) - ("reference" - (("nocite" "{") ("cite" "[{") ("label" "{") ("pageref" "{") - ("vref" "{") ("eqref" "{") ("ref" "{") ("include" "{") - ("input" "{") ("bibliography" "{") ("index" "{") ("glossary" "{") - ("footnote" "[{") ("footnotemark" "[") ("footnotetext" "[{")) - 'font-lock-constant-face 2 command) - ("function" - (("begin" "{") ("end" "{") ("pagenumbering" "{") - ("thispagestyle" "{") ("pagestyle" "{") ("nofiles" "") - ("includeonly" "{") ("bibliographystyle" "{") ("documentstyle" "[{") - ("documentclass" "[{") ("newenvironment" "*{[[{{") - ("newcommand" "*|{\\[[{") ("newlength" "|{\\") - ("newtheorem" "{[{[") - ("newcounter" "{[") ("renewenvironment" "*{[{{") - ("renewcommand" "*|{\\[[{") ("renewtheorem" "{[{[") - ("usepackage" "[{") ("fbox" "{") ("mbox" "{") ("sbox" "{") - ("vspace" "*{") ("hspace" "*{") ("thinspace" "") ("negthinspace" "") - ;; XXX: Should macros without arguments rather be listed in a - ;; separate category with 'noarg instead of 'command handling? - ("enspace" "") ("enskip" "") ("quad" "") ("qquad" "") ("nonumber" "") - ("centering" "") ("TeX" "") ("LaTeX" "")) - 'font-lock-function-name-face 2 command) - ("sectioning-0" - (("part" "*[{")) - (if (eq font-latex-fontify-sectioning 'color) - 'font-lock-type-face - 'font-latex-sectioning-0-face) - 2 command) - ("sectioning-1" - (("chapter" "*[{")) - (if (eq font-latex-fontify-sectioning 'color) - 'font-lock-type-face - 'font-latex-sectioning-1-face) - 2 command) - ("sectioning-2" - (("section" "*[{")) - (if (eq font-latex-fontify-sectioning 'color) - 'font-lock-type-face - 'font-latex-sectioning-2-face) - 2 command) - ("sectioning-3" - (("subsection" "*[{")) - (if (eq font-latex-fontify-sectioning 'color) - 'font-lock-type-face - 'font-latex-sectioning-3-face) - 2 command) - ("sectioning-4" - (("subsubsection" "*[{")) - (if (eq font-latex-fontify-sectioning 'color) - 'font-lock-type-face - 'font-latex-sectioning-4-face) - 2 command) - ("sectioning-5" - (("paragraph" "*[{") ("subparagraph" "*[{") - ("subsubparagraph" "*[{")) - (if (eq font-latex-fontify-sectioning 'color) - 'font-lock-type-face - 'font-latex-sectioning-5-face) - 2 command) - ("slide-title" () 'font-latex-slide-title-face 2 command) - ("textual" - (("item" "[") ("title" "{") ("author" "{") ("date" "{") - ("thanks" "{") ("address" "{") ("caption" "[{") - ("textsuperscript" "{")) - 'font-lock-type-face 2 command) - ("bold-command" - (("textbf" "{") ("textsc" "{") ("textup" "{") ("boldsymbol" "{") - ("pmb" "{")) - 'font-latex-bold-face 1 command) - ("italic-command" - (("emph" "{") ("textit" "{") ("textsl" "{")) - 'font-latex-italic-face 1 command) - ("math-command" - (("ensuremath" "|{\\")) - 'font-latex-math-face 1 command) - ("type-command" - (("texttt" "{") ("textsf" "{") ("textrm" "{") ("textmd" "{")) - 'font-lock-type-face 1 command) - ("bold-declaration" - ("bf" "bfseries" "sc" "scshape" "upshape") - 'font-latex-bold-face 1 declaration) - ("italic-declaration" - ("em" "it" "itshape" "sl" "slshape") - 'font-latex-italic-face 1 declaration) - ("type-declaration" - ("tt" "ttfamily" "sf" "sffamily" "rm" "rmfamily" "mdseries" - "tiny" "scriptsize" "footnotesize" "small" "normalsize" - "large" "Large" "LARGE" "huge" "Huge") - 'font-lock-type-face 1 declaration)) - "Built-in keywords and specifications for font locking. - -The first element of each item is the name of the keyword class. - -The second element is a list of keywords (macros without an -escape character) to highlight or, if the fifth element is the -symbol 'command, a list of lists where the first element of each -item is a keyword and the second a string specifying the macro -syntax. It can contain \"*\" if the macro has a starred variant, -\"[\" for an optional argument, \"{\" for a mandatory argument, -and \"\\\" for a macro. A \"|\" means the following two tokens -should be regarded as alternatives. - -The third element is the symbol of a face to be used or a Lisp -form returning a face symbol. - -The fourth element is the fontification level. - -The fifth element is the type of construct to be matched. It can -be one of 'noarg which will match simple macros without -arguments (like \"\\foo\"), 'declaration which will match macros -inside a TeX group (like \"{\\bfseries foo}\"), or 'command which -will match macros of the form \"\\foo[bar]{baz}\".") - -(defcustom font-latex-deactivated-keyword-classes nil - "List of strings for built-in keyword classes to be deactivated. - -Valid entries are \"warning\", \"variable\", \"reference\", -\"function\" , \"sectioning-0\", \"sectioning-1\", \"sectioning-2\", -\"sectioning-3\", \"sectioning-4\", \"sectioning-5\", \"textual\", -\"bold-command\", \"italic-command\", \"math-command\", \"type-command\", -\"bold-declaration\", \"italic-declaration\", \"type-declaration\". - -You have to restart Emacs for a change of this variable to take effect." - :group 'font-latex-keywords - :type `(set ,@(mapcar - (lambda (spec) - `(const :tag ,(concat - ;; Name of the keyword class - (let ((name (split-string (car spec) "-"))) - (setcar name (capitalize (car name))) - (mapconcat 'identity name " ")) - " keywords in `" - ;; Name of the face - (symbol-name (eval (nth 2 spec))) "'.\n" - ;; List of keywords - (with-temp-buffer - (insert " Keywords: " - (mapconcat (lambda (x) - (if (listp x) - (car x) - x)) - (nth 1 spec) ", ")) - (fill-paragraph nil) - (buffer-substring-no-properties - (point-min) (point-max)))) - ,(car spec))) - font-latex-built-in-keyword-classes))) - -(defun font-latex-make-match-defun (prefix name face type) - "Return a function definition for keyword matching. -The variable holding the keywords to match are determined by the -strings PREFIX and NAME. The type of matcher is determined by -the symbol TYPE. - -This is a helper function for `font-latex-make-built-in-keywords' -and `font-latex-make-user-keywords' and not intended for general -use." - ;; Note: The functions are byte-compiled at the end of font-latex.el. - ;; FIXME: Is the cond-clause possible inside of the defun? - - ;; In an earlier version of font-latex the type could be a list like - ;; (command 1). This indicated a macro with one argument. Provide - ;; a match function in this case but don't actually support it. - (cond ((or (eq type 'command) (listp type)) - (eval `(defun ,(intern (concat prefix name)) (limit) - ,(concat "Fontify `" prefix name "' up to LIMIT. - -Generated by `font-latex-make-match-defun'.") - (when ,(intern (concat prefix name)) - (font-latex-match-command-with-arguments - ,(intern (concat prefix name)) - (append - (when (boundp ',(intern (concat prefix name - "-keywords-local"))) - ,(intern (concat prefix name "-keywords-local"))) - ,(intern (concat prefix name "-keywords"))) - ;; `face' can be a face symbol, a form returning - ;; a face symbol, or a list of face attributes. - (if (and (listp ,face) (functionp (car ,face))) - (eval ,face) - ,face) - limit))))) - ((eq type 'declaration) - (eval `(defun ,(intern (concat prefix name)) (limit) - ,(concat "Fontify `" prefix name "' up to LIMIT. - -Generated by `font-latex-make-match-defun'.") - (when ,(intern (concat prefix name)) - (font-latex-match-command-in-braces - ,(intern (concat prefix name)) limit))))) - ((eq type 'noarg) - (eval `(defun ,(intern (concat prefix name)) (limit) - ,(concat "Fontify `" prefix name "' up to LIMIT. - -Generated by `font-latex-make-match-defun'.") - (when ,(intern (concat prefix name)) - (re-search-forward - ,(intern (concat prefix name)) limit t))))))) - -(defun font-latex-keyword-matcher (prefix name face type) - "Return a matcher and highlighter as required by `font-lock-keywords'. -PREFIX and NAME are strings which are concatenated to form the -respective match function. FACE is a face name or a list of text -properties that will be applied to the respective part of the -match returned by the match function. TYPE is the type of -construct to be highlighted. Currently the symbols 'command, -'sectioning, 'declaration and 'noarg are valid. - -This is a helper function for `font-latex-make-built-in-keywords' -and `font-latex-make-user-keywords' and not intended for general -use." - ;; In an earlier version of font-latex the type could be a list like - ;; (command 1). This indicated a macro with one argument. Provide - ;; a matcher in this case but don't actually support it. - (cond ((or (eq type 'command) (listp type)) - `(,(intern (concat prefix name)) - (0 (font-latex-matched-face 0) append t) - (1 (font-latex-matched-face 1) append t) - (2 (font-latex-matched-face 2) append t) - (3 (font-latex-matched-face 3) append t) - (4 (font-latex-matched-face 4) append t) - (5 (font-latex-matched-face 5) append t) - (6 (font-latex-matched-face 6) append t) - (7 (font-latex-matched-face 7) append t))) - ((eq type 'noarg) - `(,(intern (concat prefix name)) - (0 ,face))) - ((eq type 'declaration) - `(,(intern (concat prefix name)) - (0 'font-latex-warning-face t t) - (1 'font-lock-keyword-face append t) - (2 ,face append t))))) - -(defun font-latex-make-built-in-keywords () - "Build defuns, defvars and defcustoms for built-in keyword fontification." - (dolist (item font-latex-built-in-keyword-classes) - (let ((prefix "font-latex-match-") - (name (nth 0 item)) - (keywords (nth 1 item)) - (face (nth 2 item)) - (level (nth 3 item)) - (type (nth 4 item))) - - ;; defvar font-latex-match-*-keywords-local - (eval `(defvar ,(intern (concat prefix name "-keywords-local")) - ',keywords - ,(concat "Buffer-local keywords to add to `" - prefix name "-keywords'. - -This must be a list where each element is a list consisting of a -keyword string \(not a regular expression\) omitting the leading -backslash and a format specifier as. The options for the format -specifier are described in the doc string of -`font-latex-user-keyword-classes'. - -This is an internal variable which should not be set directly. -Use `font-latex-add-keywords' instead. - -Generated by `font-latex-make-built-in-keywords'."))) - (eval `(make-variable-buffer-local - ',(intern (concat prefix name "-keywords-local")))) - - ;; defun font-latex-match-*-make - ;; Note: The functions are byte-compiled at the end of font-latex.el. - (eval `(defun ,(intern (concat prefix name "-make")) () - ,(concat "Make or remake the variable `" prefix name "'. - -Generated by `font-latex-make-built-in-keywords'.") - (let ((keywords - (append - (unless (member ,name - font-latex-deactivated-keyword-classes) - ,(intern (concat prefix name "-keywords-local"))) - ,(intern (concat prefix name "-keywords")))) - multi-char-macros single-char-macros) - (dolist (elt keywords) - (let ((keyword (if (listp elt) (car elt) elt))) - (if (string-match "^[A-Za-z]" keyword) - (add-to-list 'multi-char-macros keyword) - (add-to-list 'single-char-macros keyword)))) - (when (or multi-char-macros single-char-macros) - (setq ,(intern (concat prefix name)) - (concat - "\\\\\\(" - (when multi-char-macros - (concat - "\\(?:" (regexp-opt multi-char-macros) "\\)\\>")) - (when single-char-macros - (concat - (when multi-char-macros "\\|") - "\\(?:" (regexp-opt single-char-macros) "\\)")) - "\\)")))))) - - ;; defcustom font-latex-match-*-keywords - (eval `(defcustom ,(intern (concat prefix name "-keywords")) nil - ,(concat "List of keywords " - (when (eq type 'command) "and formats ") - "for " name " face.\n" - (if (eq type 'command) - "\ -Each element has to be a list consisting of the name of a macro -omitting the leading backslash and a format specifier as -described in the doc string of `font-latex-user-keyword-classes'." - "\ -Each element has to be the name of a macro as a string, omitting -the leading backslash.") - "\n\n\ -Setting this variable directly does not take effect; restart -Emacs. - -Generated by `font-latex-make-built-in-keywords'.") - :type '(repeat (string :tag "Keyword")) - :type '(repeat ,(if (eq type 'command) - '(list (string :tag "Keyword") - (string :tag "Format")) - '(string :tag "Keyword"))) - :set (lambda (symbol value) - (set-default symbol value) - (funcall ',(intern (concat prefix name "-make")))) - :group 'font-latex-keywords)) - - ;; defvar font-latex-match-* - (eval `(defvar ,(intern (concat prefix name)) - ,(intern (concat prefix name "-keywords")))) - (eval `(make-variable-buffer-local - ',(intern (concat prefix name)))) - - ;; defun font-latex-match-* - (font-latex-make-match-defun prefix name face type) - - ;; Add matchers and highlighters to `font-latex-keywords-{1,2}'. - (let ((keywords-entry (font-latex-keyword-matcher - prefix name face type))) - (add-to-list (intern (concat "font-latex-keywords-" - (number-to-string level))) - keywords-entry t) - (when (= level 1) - (add-to-list (intern (concat "font-latex-keywords-2")) - keywords-entry t)))))) -(font-latex-make-built-in-keywords) - -(defcustom font-latex-user-keyword-classes nil - "List of user-defined keyword classes for font locking. - -Every keyword class consists of four parts, a name, a list of -keywords, a face and a specifier for the type of macro to be -highlighted. - -When adding new entries, you have to use unique values for the -class names, i.e. they must not clash with names of the built-in -keyword classes or other names given by you. Additionally the -names must not contain spaces. - -The list of keywords defines which commands and declarations -should be covered by the keyword class. A keyword can either be -a simple command name omitting the leading backslash or a list -consisting of the command name and a string specifying the syntax -of the command. The latter is useful if you want to match LaTeX -macros with arguments (see below). You can specify the occurence -and order of optional (\"[\") and mandatory (\"{\") arguments for -each keyword. For example for \"documentclass\" you'd use \"[{\" -because the macro has one optional followed by one mandatory -argument. Optionally starred macros can be indicated with \"*\". -In case an argument is an unbraced macro, use \"\\\". You can -also specify two alternative arguments by prefixing them with -\"|\". As an example, the specifier for \\newcommand is -\"*|{\\=\\[[{\". - -The face argument can either be an existing face or a font -specification. (The latter option is not available in XEmacs.) - -There are three alternatives for the class type: - -A value of `command' indicates commands with arguments -\(\"\\foo[bar]{baz}\"). The mandatory arguments in curly braces -will get the face you specified. - -A value of `declaration' indicates declarations inside of TeX -groups (\"{\\foo bar}\"). The content inside the braces, -excluding the command, will get the face you specified. In case -the braces are missing, the face will be applied to the command -itself. - -A value of `noarg' indicates commands without arguments -\(\"\\foo\"). The command itself will get the face you -specified. - -Setting this variable directly does not take effect; -use \\[customize] or restart Emacs." - :group 'font-latex-keywords - :type `(repeat (list (string :tag "Name") - (choice (repeat :tag "Keywords" (string :tag "Keyword")) - (repeat - :tag "Keywords with specs" - (group (string :tag "Keyword") - (string :tag "Format specifier")))) - ,(if (featurep 'xemacs) - '(face :tag "Face name") - '(choice (custom-face-edit :tag "Face attributes") - (face :tag "Face name"))) - (choice :tag "Type" - ;; Maps to - ;;`font-latex-match-command-with-arguments' - (const :tag "Command with arguments" - command) - ;; Maps to - ;;`font-latex-match-command-in-braces' - (const :tag "Declaration inside TeX group" - declaration) - ;; Maps to `re-search-forward' - (const :tag "Command without arguments" - noarg)))) - :set (lambda (symbol value) - (dolist (item value) - (when (string-match " " (car item)) - (error "No spaces allowed in name"))) - (let (names names-uniq) - (dolist (item (append font-latex-built-in-keyword-classes value)) - (setq names (append names (list (car item))))) - (setq names (TeX-sort-strings names)) - (setq names-uniq (TeX-delete-duplicate-strings names)) - (dotimes (i (safe-length names-uniq)) - (unless (string= (nth i names) (nth i names-uniq)) - (error "Name %S already exists" (nth i names))))) - (set-default symbol value) - (let ((prefix "font-latex-match-")) - (dolist (elt value) - (unless (boundp (intern (concat prefix (car elt)))) - ;; defvar font-latex-match-* - (eval `(defvar ,(intern (concat prefix (car elt))) nil))) - (let ((keywords (nth 1 elt)) - single-char-macro-flag) - (setq keywords (if (listp (car keywords)) - (mapcar 'car keywords) - keywords)) - (catch 'single-char - (dolist (keyword keywords) - (unless (string-match "^[A-Za-z]" keyword) - (setq single-char-macro-flag t) - (throw 'single-char nil)))) - (set (intern (concat prefix (car elt))) - (when (> (safe-length keywords) 0) - (concat "\\\\" (let ((max-specpdl-size 1000)) - (regexp-opt keywords t)) - (unless single-char-macro-flag "\\>"))))))))) - -(defun font-latex-make-user-keywords () - "Build defuns and defvars for user keyword fontification." - (let ((keyword-specs font-latex-user-keyword-classes)) - (dolist (item keyword-specs) - (let ((prefix "font-latex-match-") - (name (nth 0 item)) - (keywords (nth 1 item)) - (face (nth 2 item)) - (type (nth 3 item))) - - ;; defvar font-latex-match-*-keywords - (eval `(defvar ,(intern (concat prefix name "-keywords")) ',keywords - ,(concat "Font-latex keywords for " name " face. - -Generated by `font-latex-make-user-keywords'."))) - - ;; defun font-latex-match-* - (eval `(font-latex-make-match-defun prefix name '',face type)) - - ;; Add the matcher to `font-latex-keywords-2'. - (add-to-list 'font-latex-keywords-2 - (font-latex-keyword-matcher prefix name face type) t)))) - - ;; Add the "fixed" matchers and highlighters. - (dolist (item - '(("\\(^\\|[^\\]\\)\\(&+\\)" 2 'font-latex-warning-face) - ("\\$\\$\\([^$]+\\)\\$\\$" 1 'font-latex-math-face) - (font-latex-match-quotation - (0 'font-latex-string-face append) - (1 'font-latex-warning-face)) - ;; Hack to remove the verbatim face from the \ in - ;; \end{verbatim} and similar. The same hack is used in - ;; tex-mode.el. - ("^[ \t]*\\(\\\\\\)end" - (1 (get-text-property (match-end 1) 'face) t)))) - (add-to-list 'font-latex-keywords-1 item) - (add-to-list 'font-latex-keywords-2 item)) - (dolist (item - '((font-latex-match-math-env - (0 'font-latex-warning-face t t) - (1 'font-latex-math-face append t)) - (font-latex-match-math-envII - (0 'font-latex-math-face append t)) - (font-latex-match-simple-command - (0 'font-latex-sedate-face append)) - (font-latex-match-script - (1 (font-latex-script (match-beginning 0)) append)))) - (add-to-list 'font-latex-keywords-2 item t))) -(font-latex-make-user-keywords) - -(defun font-latex-add-keywords (keywords class) - "Add KEYWORDS to CLASS. -KEYWORDS is a list of keywords or keywords with syntax specs. -CLASS corresponds to a keyword class and can be one of the -symbols 'warning, 'variable, 'reference, 'function, sectioning-0, -'sectioning-1, 'sectioning-2, 'sectioning-3, 'sectioning-4, -'sectioning-5, 'slide-title, 'textual, 'bold-command, -'italic-command, 'math-command, 'type-command, 'bold-declaration, -'italic-declaration or 'type-declaration. - -The keywords will be added to the buffer-local list of keywords -of the respective keyword class and necessary updates of the font -locking machinery will be triggered." - (let* ((class (symbol-name class)) - (list (intern (format "font-latex-match-%s-keywords-local" class)))) - (dolist (elt keywords) - (add-to-list list elt)) - (funcall (intern (format "font-latex-match-%s-make" class))) - (setq font-lock-set-defaults nil) - (font-lock-set-defaults))) - -(defvar font-latex-keywords font-latex-keywords-1 - "Default expressions to highlight in TeX mode.") - - -;;; Subscript and superscript - -(defcustom font-latex-fontify-script (not (featurep 'xemacs)) - "If non-nil, fontify subscript and superscript strings. -This feature does not work in XEmacs." - :type 'boolean - :group 'font-latex) -(put 'font-latex-fontify-script 'safe-local-variable 'TeX-booleanp) - -(defcustom font-latex-script-display '((raise -0.3) . (raise 0.3)) - "Display specification for subscript and superscript content. -The car is used for subscript, the cdr is used for superscripts." - :group 'font-latex - :type '(cons (choice (sexp :tag "Subscript form") - (const :tag "No lowering" nil)) - (choice (sexp :tag "Superscript form") - (const :tag "No raising" nil)))) - - -;;; Syntactic keywords - -(defvar font-latex-syntactic-keywords nil - "Syntactic keywords used by `font-latex'.") -(make-variable-buffer-local 'font-latex-syntactic-keywords) - -(defvar font-latex-syntactic-keywords-extra nil - "List of syntactic keywords to add to `font-latex-syntactic-keywords'. -The form should be the same as in `font-lock-syntactic-keywords'.") -(make-variable-buffer-local 'font-latex-syntactic-keywords-extra) - -(defun font-latex-set-syntactic-keywords () - "Set the variable `font-latex-syntactic-keywords'. -This function can be used to refresh the variable in case other -variables influencing its value, like `LaTeX-verbatim-environments', -have changed." - ;; Checks for non-emptiness of lists added in order to cater for - ;; installations where `(regexp-opt-group nil)' would enter a loop. - (let ((verb-envs (and (fboundp 'LaTeX-verbatim-environments) - (LaTeX-verbatim-environments))) - (verb-macros-with-delims - (and (fboundp 'LaTeX-verbatim-macros-with-delims) - (LaTeX-verbatim-macros-with-delims))) - (verb-macros-with-braces - (and (fboundp 'LaTeX-verbatim-macros-with-braces) - (LaTeX-verbatim-macros-with-braces)))) - (setq verb-envs (and verb-envs (regexp-opt verb-envs)) - verb-macros-with-delims (and verb-macros-with-delims - (regexp-opt verb-macros-with-delims)) - verb-macros-with-braces (and verb-macros-with-braces - (regexp-opt verb-macros-with-braces)) - font-latex-syntactic-keywords nil) - (unless (= (length verb-envs) 0) - (add-to-list 'font-latex-syntactic-keywords - `(,(concat "^[ \t]*\\\\begin *{\\(?:" verb-envs - "\\)}.*\\(\n\\)") - (1 "|" t))) - (add-to-list 'font-latex-syntactic-keywords - ;; Using the newline character for the syntax - ;; property often resulted in fontification - ;; problems when text was inserted at the end of - ;; the verbatim environment. That's why we now use - ;; the starting backslash of \end. There is a hack - ;; in `font-latex-make-user-keywords' to remove the - ;; spurious fontification of the backslash. - `(,(concat "^[ \t]*\\(\\\\\\)end *{\\(?:" verb-envs "\\)}") - (1 "|" t)))) - (unless (= (length verb-macros-with-delims) 0) - (add-to-list 'font-latex-syntactic-keywords - `(,(concat "\\\\\\(?:" verb-macros-with-delims "\\)" - ;; An opening curly brace as delimiter - ;; is valid, but allowing it might screw - ;; up fontification of stuff like - ;; "\url{...} foo \textbf{<--!...}". - "\\([^a-z@*\n\f{]\\).*?" - ;; Give an escape char at the end of the - ;; verbatim construct punctuation syntax. - ;; Prevents wrong fontification of stuff - ;; like "\verb|foo\|". - "\\(" (regexp-quote TeX-esc) "*\\)\\(\\1\\)") - (1 "\"") (2 ".") (3 "\"")))) - (unless (= (length verb-macros-with-braces) 0) - (add-to-list 'font-latex-syntactic-keywords - `(,(concat "\\\\\\(?:" verb-macros-with-braces "\\)" - "\\({\\).*?[^\\]\\(?:\\\\\\\\\\)*\\(}\\)") - (1 "|") (2 "|"))))) - (when font-latex-syntactic-keywords-extra - (nconc font-latex-syntactic-keywords font-latex-syntactic-keywords-extra)) - ;; Cater for docTeX mode. - (setq font-latex-doctex-syntactic-keywords - (append font-latex-syntactic-keywords - ;; For docTeX comment-in-doc. - `(("\\(\\^\\)\\^A" (1 (font-latex-doctex-^^A))))))) - - -;;; Syntactic fontification - -;; Copy and adaptation of `tex-font-lock-syntactic-face-function' in -;; `tex-mode.el' of CVS Emacs (March 2004) -(defun font-latex-syntactic-face-function (state) - (let ((char (nth 3 state))) - (cond - ((not char) 'font-lock-comment-face) - ((eq char ?$) 'font-latex-math-face) - (t - (when (char-valid-p char) - ;; This is a \verb?...? construct. Let's find the end and mark it. - (save-excursion - (skip-chars-forward (string ?^ char)) ;; Use `end' ? - (when (eq (char-syntax (preceding-char)) ?/) - (put-text-property (1- (point)) (point) 'syntax-table '(1))) - (unless (eobp) - (put-text-property (point) (1+ (point)) 'syntax-table '(7))))) - 'font-latex-verbatim-face)))) - - -;;; Faces - -(defface font-latex-bold-face - (let ((font (cond ((assq :inherit custom-face-attributes) '(:inherit bold)) - ((assq :weight custom-face-attributes) '(:weight bold)) - (t '(:bold t))))) - `((((class grayscale) (background light)) - (:foreground "DimGray" ,@font)) - (((class grayscale) (background dark)) - (:foreground "LightGray" ,@font)) - (((class color) (background light)) - (:foreground "DarkOliveGreen" ,@font)) - (((class color) (background dark)) - (:foreground "OliveDrab" ,@font)) - (t (,@font)))) - "Face used to highlight text to be typeset in bold." - :group 'font-latex-highlighting-faces) - -(defface font-latex-italic-face - (let ((font (cond ((assq :inherit custom-face-attributes) '(:inherit italic)) - ((assq :slant custom-face-attributes) '(:slant italic)) - (t '(:italic t))))) - `((((class grayscale) (background light)) - (:foreground "DimGray" ,@font)) - (((class grayscale) (background dark)) - (:foreground "LightGray" ,@font)) - (((class color) (background light)) - (:foreground "DarkOliveGreen" ,@font)) - (((class color) (background dark)) - (:foreground "OliveDrab" ,@font)) - (t (,@font)))) - "Face used to highlight text to be typeset in italic." - :group 'font-latex-highlighting-faces) - -(defface font-latex-math-face - (let ((font (cond ((assq :inherit custom-face-attributes) - '(:inherit underline)) - (t '(:underline t))))) - `((((class grayscale) (background light)) - (:foreground "DimGray" ,@font)) - (((class grayscale) (background dark)) - (:foreground "LightGray" ,@font)) - (((class color) (background light)) - (:foreground "SaddleBrown")) - (((class color) (background dark)) - (:foreground "burlywood")) - (t (,@font)))) - "Face used to highlight math." - :group 'font-latex-highlighting-faces) - -(defface font-latex-sedate-face - '((((class grayscale) (background light)) (:foreground "DimGray")) - (((class grayscale) (background dark)) (:foreground "LightGray")) - (((class color) (background light)) (:foreground "DimGray")) - (((class color) (background dark)) (:foreground "LightGray")) - ;;;(t (:underline t)) - ) - "Face used to highlight sedate stuff." - :group 'font-latex-highlighting-faces) - -(defface font-latex-string-face - (let ((font (cond ((assq :inherit custom-face-attributes) '(:inherit italic)) - ((assq :slant custom-face-attributes) '(:slant italic)) - (t '(:italic t))))) - `((((type tty) (class color)) - (:foreground "green")) - (((class grayscale) (background light)) - (:foreground "DimGray" ,@font)) - (((class grayscale) (background dark)) - (:foreground "LightGray" ,@font)) - (((class color) (background light)) - (:foreground "RosyBrown")) - (((class color) (background dark)) - (:foreground "LightSalmon")) - (t (,@font)))) - "Face used to highlight strings." - :group 'font-latex-highlighting-faces) - -(defface font-latex-warning-face - (let ((font (cond ((assq :inherit custom-face-attributes) '(:inherit bold)) - ((assq :weight custom-face-attributes) '(:weight bold)) - (t '(:bold t))))) - `((((class grayscale)(background light)) - (:foreground "DimGray" ,@font)) - (((class grayscale)(background dark)) - (:foreground "LightGray" ,@font)) - (((class color)(background light)) - (:foreground "red" ,@font)) - (((class color)(background dark)) - (:foreground "red" ,@font)) - (t (,@font)))) - "Face for important keywords." - :group 'font-latex-highlighting-faces) - -(defface font-latex-verbatim-face - (let ((font (if (and (assq :inherit custom-face-attributes) - (if (featurep 'xemacs) - (find-face 'fixed-pitch) - (facep 'fixed-pitch))) - '(:inherit fixed-pitch) - '(:family "courier")))) - `((((class grayscale) (background light)) - (:foreground "DimGray" ,@font)) - (((class grayscale) (background dark)) - (:foreground "LightGray" ,@font)) - (((class color) (background light)) - (:foreground "SaddleBrown" ,@font)) - (((class color) (background dark)) - (:foreground "burlywood" ,@font)) - (t (,@font)))) - "Face used to highlight TeX verbatim environments." - :group 'font-latex-highlighting-faces) - -(defface font-latex-superscript-face - '((t (:height 0.8))) - "Face used for superscripts." - :group 'font-latex-highlighting-faces) - -(defface font-latex-subscript-face - '((t (:height 0.8))) - "Face used for subscripts." - :group 'font-latex-highlighting-faces) - -(defface font-latex-slide-title-face - (let* ((scale 1.2) - (size (when (featurep 'xemacs) - (round (* 0.9 (face-height 'default) scale))))) - (if (featurep 'xemacs) - `((t (:bold t :family "helvetica" :size ,size))) - `((t (:inherit (variable-pitch font-lock-type-face) - :weight bold :height ,scale))))) - "Face for slide titles." - :group 'font-latex-highlighting-faces) -(when (featurep 'xemacs) - (set-face-parent 'font-latex-slide-title-face 'font-lock-type-face - nil nil 'append)) - - -;;; Setup - -(defvar font-lock-comment-start-regexp nil - "Regexp to match the start of a comment.") - -(defvar font-latex-extend-region-functions nil - "List of functions extending the region for multiline constructs. - -Each function should accept two arguments, the begin and end of -the region to be fontified, and return the new region start. If -no extension is necessary, the original region start should be -returned. - -All specified functions will be called and the region extended -backwards to the minimum over their return values.") - -(defvar font-latex-syntax-alist - ;; Use word syntax for @ because we use \> for matching macros and - ;; we don't want \foo@bar to be found if we search for \foo. - '((?\( . ".") (?\) . ".") (?$ . "\"") (?@ . "w")) - "List of specifiers for the syntax alist of `font-lock-defaults'.") - -(defun font-latex-add-to-syntax-alist (list) - "Activate syntactic font locking for the entries in LIST. -The entries are added to `font-latex-syntax-alist' and eventually -end up in `font-lock-defaults'. Each entry in LIST should be a -cons pair as expected by `font-lock-defaults'. The function also -triggers Font Lock to recognize the change." - (make-local-variable 'font-latex-syntax-alist) - (nconc font-latex-syntax-alist list) -;; FIXME: Are there situations where we need to alter `font-lock-defaults' -;; directly? -;; (dolist (entry list) -;; (setcar (cdddr font-lock-defaults) -;; (cons entry (cadddr font-lock-defaults)))) - ;; Tell font-lock about the update. - (setq font-lock-set-defaults nil) - (font-lock-set-defaults)) - -;;;###autoload -(defun font-latex-setup () - "Setup this buffer for LaTeX font-lock. Usually called from a hook." - (font-latex-set-syntactic-keywords) - ;; Trickery to make $$ fontification be in `font-latex-math-face' while - ;; strings get whatever `font-lock-string-face' has been set to. - (when (fboundp 'built-in-face-specifiers) - ;; Cool patch from Christoph Wedler... - (let (instance) - (mapc (lambda (property) - (setq instance - (face-property-instance 'font-latex-math-face property - nil 0 t)) - (if (numberp instance) - (setq instance - (face-property-instance 'default property nil 0))) - (or (numberp instance) - (set-face-property 'font-lock-string-face property - instance (current-buffer)))) - (built-in-face-specifiers)))) - - ;; Activate multi-line fontification facilities if available. - (when (boundp 'font-lock-multiline) - (set (make-local-variable 'font-lock-multiline) t)) - - ;; Functions for extending the region. - (dolist (elt '(font-latex-extend-region-backwards-command-with-args - font-latex-extend-region-backwards-command-in-braces - font-latex-extend-region-backwards-quotation - font-latex-extend-region-backwards-math-env - font-latex-extend-region-backwards-math-envII)) - (add-to-list 'font-latex-extend-region-functions elt)) - - ;; Tell Font Lock about the support. - (make-local-variable 'font-lock-defaults) - ;; The test for `major-mode' currently only works with docTeX mode - ;; because `TeX-install-font-lock' is called explicitely in - ;; `doctex-mode'. In case other modes have to be distinguished as - ;; well, remove the call to `TeX-install-font-lock' from - ;; `VirTeX-common-initialization' and place it in the different - ;; `xxx-mode' calls instead, but _after_ `major-mode' is set. - (let ((defaults - `((font-latex-keywords font-latex-keywords-1 font-latex-keywords-2) - nil nil ,font-latex-syntax-alist nil)) - (variables - '((font-lock-comment-start-regexp . "%") - (font-lock-mark-block-function . mark-paragraph) - (font-lock-fontify-region-function - . font-latex-fontify-region) - (font-lock-unfontify-region-function - . font-latex-unfontify-region)))) - ;; Add the mode-dependent stuff to the basic variables defined above. - (if (eq major-mode 'doctex-mode) - (progn - (setcar defaults (append (car defaults) - '(font-latex-doctex-keywords))) - (setq variables - (append variables - '((font-lock-syntactic-face-function - . font-latex-doctex-syntactic-face-function) - (font-lock-syntactic-keywords - . font-latex-doctex-syntactic-keywords))))) - (setq variables - (append variables - '((font-lock-syntactic-face-function - . font-latex-syntactic-face-function) - (font-lock-syntactic-keywords - . font-latex-syntactic-keywords))))) - ;; Cater for the idiosyncrasies of Emacs and XEmacs. - (if (featurep 'xemacs) - (progn - ;; XEmacs does not set these variables via `font-lock-defaults' - ;; but requires them to be set explicitely. - (mapc (lambda (alist) - (set (car alist) (cdr alist))) variables) - ;; Has to be set to t as otherwise syntax properties will not be - ;; be picked up during fontification. - (set (make-local-variable 'lookup-syntax-properties) t)) - (setq defaults (append defaults variables))) - ;; Set the defaults. - (setq font-lock-defaults defaults))) - -(defun font-latex-jit-lock-force-redisplay (buf start end) - "Compatibility for Emacsen not offering `jit-lock-force-redisplay'." - (if (fboundp 'jit-lock-force-redisplay) - (jit-lock-force-redisplay buf start end) - ;; The following block is an expansion of `jit-lock-force-redisplay' - ;; and involved macros taken from CVS Emacs on 2007-04-28. - (with-current-buffer buf - (let ((modified (buffer-modified-p))) - (unwind-protect - (let ((buffer-undo-list t) - (inhibit-read-only t) - (inhibit-point-motion-hooks t) - (inhibit-modification-hooks t) - deactivate-mark - buffer-file-name - buffer-file-truename) - (put-text-property start end 'fontified t)) - (unless modified - (restore-buffer-modified-p nil))))))) - -(defun font-latex-fontify-region (beg end &optional loudly) - "Fontify region from BEG to END. -If optional argument is non-nil, print status messages." - (let ((extend-list (delq nil (mapcar (lambda (fun) (funcall fun beg end)) - font-latex-extend-region-functions)))) - (when extend-list - (let ((orig-beg beg)) - (setq beg (apply 'min extend-list)) - (when (featurep 'jit-lock) - ;; Stolen from `jit-lock-fontify-now' (2007-04-27) and - ;; adapted. Without this stanza only the line in which a - ;; change happened will refontified. The rest will only be - ;; refontified upon redisplay. - (run-with-timer 0 nil 'font-latex-jit-lock-force-redisplay - (current-buffer) beg orig-beg)))) - (font-lock-default-fontify-region beg end loudly))) - -;; Copy and adaption of `tex-font-lock-unfontify-region' from -;; tex-mode.el in GNU Emacs on 2004-08-04. -;; (XEmacs passes a third argument to the function.) -(defun font-latex-unfontify-region (beg end &rest ignored) - "Unfontify region from BEG to END." - (font-lock-default-unfontify-region beg end) - ;; XEmacs does not provide `font-lock-extra-managed-props', so - ;; remove the `font-latex-multiline' property manually. (The - ;; property is only added if `font-lock-multiline' is bound.) - (unless (boundp 'font-lock-multiline) - (remove-text-properties beg end '(font-latex-multiline))) - (while (< beg end) - (let ((next (next-single-property-change beg 'display nil end)) - (prop (get-text-property beg 'display))) - (if (and (eq (car-safe prop) 'raise) - (member (car-safe (cdr prop)) - (list (nth 1 (car font-latex-script-display)) - (nth 1 (cdr font-latex-script-display)))) - (null (cddr prop))) - (put-text-property beg next 'display nil)) - (setq beg next)))) - -(defadvice font-lock-after-change-function (before font-latex-after-change - activate) - "Extend region for fontification of multiline constructs. -This is only necessary if the editor does not provide multiline -fontification facilities like `font-lock-multiline' itself." - (unless (boundp 'font-lock-multiline) - (let ((ad-beg (ad-get-arg 0)) - (ad-end (ad-get-arg 1))) - (save-excursion - (goto-char ad-beg) - (beginning-of-line) - (when (get-text-property (point) 'font-latex-multiline) - (setq ad-beg (previous-single-property-change (point) - 'font-latex-multiline)) - (when (numberp ad-beg) - (ad-set-arg 0 ad-beg))) - (goto-char ad-end) - (end-of-line) - (when (get-text-property (point) 'font-latex-multiline) - (setq ad-end (next-single-property-change (point) - 'font-latex-multiline)) - (when (numberp ad-end) - (ad-set-arg 1 ad-end))))))) - - -;;; Utility functions - -(defun font-latex-find-matching-close (openchar closechar) - "Skip over matching pairs of OPENCHAR and CLOSECHAR. -OPENCHAR is the opening character and CLOSECHAR is the closing -character. Character pairs are usually { } or [ ]. Comments are -ignored during the search." - (let ((parse-sexp-ignore-comments - (not (eq major-mode 'doctex-mode))) ; scan-sexps ignores comments - (init-point (point)) - (mycount 1) - (esc-char (or (and (boundp 'TeX-esc) TeX-esc) "\\")) - ;; XXX: Do not look up syntax-table properties since they may - ;; be misleading, e.g. in the case of "{foo}^^A" where the - ;; closing brace gets a comment end syntax. - (parse-sexp-lookup-properties nil)) - (or - (condition-case nil - (progn - (goto-char (with-syntax-table - (TeX-search-syntax-table openchar closechar) - (scan-sexps (point) 1))) - ;; No error code. See if closechar is unquoted - (save-excursion - (backward-char 1) - (zerop (mod (skip-chars-backward (regexp-quote esc-char)) 2)))) - (error nil)) - (save-match-data - (goto-char (1+ init-point)) - (while (and (> mycount 0) - (re-search-forward - (string ?\[ - ;; closechar might be ] - ;; and therefor must be first in regexp - closechar openchar - ?\]) - nil t)) - (cond - ((font-latex-commented-outp) - (forward-line 1)) - ((save-excursion - (backward-char 1) - (zerop (mod (skip-chars-backward (regexp-quote esc-char)) - 2))) - (setq mycount (+ mycount - (if (= (preceding-char) openchar) 1 -1))))))) - (if (= mycount 0) - t - (goto-char init-point) - nil)))) - -(defun font-latex-commented-outp () - "Return t if comment character is found between bol and point." - (save-excursion - (let ((limit (point)) - (esc-char (if (and (boundp 'TeX-esc) TeX-esc) TeX-esc "\\"))) - (forward-line 0) - (if (and (eq (char-after) ?\%) - (not (font-latex-faces-present-p 'font-latex-verbatim-face))) - (not (eq major-mode 'doctex-mode)) - (catch 'found - (while (progn (skip-chars-forward "^%" limit) - (< (point) limit)) - (when (and (save-excursion - (zerop (mod (skip-chars-backward - (regexp-quote esc-char)) 2))) - (not (font-latex-faces-present-p - 'font-latex-verbatim-face))) - (throw 'found t)) - (forward-char))))))) - -(defun font-latex-faces-present-p (faces &optional pos) - "Return t if FACES are present at position POS. -FACES may be a single face or a list of faces. -If POS is omitted, the current position of point is used." - (let* ((faces (if (listp faces) faces (list faces))) - (pos (or pos (point))) - (prop (get-text-property pos 'face)) - (prop-list (if (listp prop) prop (list prop)))) - (catch 'member - (dolist (item prop-list) - (when (memq item faces) - (throw 'member t)))))) - -(defun font-latex-forward-comment () - "Like `forward-comment' but with special provisions for docTeX mode. -In docTeX mode \"%\" at the start of a line will be treated as whitespace." - (if (eq major-mode 'doctex-mode) - ;; XXX: We should probably cater for ^^A as well. - (progn - (while (progn (if (bolp) (skip-chars-forward "%")) - (> (skip-chars-forward " \t\n") 0))) - (when (eq (char-after) ?%) - (beginning-of-line 2) - t)) - (forward-comment 1))) - -(defun font-latex-put-multiline-property-maybe (beg end) - "Add a multiline property if no equivalent is provided by the editor. -The text property is used to find the start or end of a multiline -construct when unfontifying a region. Emacs adds such a text -property automatically if `font-lock-multiline' is set to t and -extends the region to be unfontified automatically as well. -XEmacs does not do this at the time of this writing." - (unless (boundp 'font-lock-multiline) - (put-text-property beg end 'font-latex-multiline t))) - - -;;; Match functions - -(defvar font-latex-matched-faces nil - "List of faces corresponding to matches in match data.") - -(defun font-latex-matched-face (pos) - "Return face at position POS in `font-latex-matched-faces'." - (nth pos font-latex-matched-faces)) - -(defvar font-latex-command-with-args-default-spec nil ; "*[{" - "Default specifier for keywords without syntax description. -Set this to nil if verification of command syntax is unwanted.") - -(defvar font-latex-command-with-args-opt-arg-delims - '((?[ . ?]) (?< . ?>) (?\( . ?\))) - "List character pairs used as delimiters for optional arguments.") - -(defvar font-latex-syntax-error-modes '(latex-mode) - "List of modes where syntax errors in macros should be indicated.") - -(defun font-latex-match-command-with-arguments (regexp keywords face limit) - "Search for regexp command KEYWORDS[opt]{arg} before LIMIT. -Returns nil if none of KEYWORDS is found." - (setq font-latex-matched-faces nil) - (catch 'match - (while (re-search-forward regexp limit t) - (unless (font-latex-faces-present-p '(font-lock-comment-face - font-latex-verbatim-face) - (match-beginning 0)) - (let* ((beg (match-beginning 0)) - end ; Used for multiline text property. - match-data match-beg syntax-error alternative spec - error-indicator-pos - (spec-list (string-to-list - (or (cadr (assoc (match-string 1) keywords)) - font-latex-command-with-args-default-spec))) - (parse-sexp-ignore-comments t)) ; scan-sexps ignores comments - (add-to-list 'match-data beg) - (goto-char (match-end 0)) - ;; Check for starred macro if first spec is an asterisk. - (when (eq (car spec-list) ?*) - (setq spec-list (cdr spec-list)) - (skip-chars-forward "*" (1+ (point)))) - ;; Add current point to match data and use keyword face for - ;; region from start to point. - (add-to-list 'match-data (point) t) - (add-to-list 'font-latex-matched-faces 'font-lock-keyword-face) - (setq end (point)) - (catch 'break - ;; Walk the list of specs. - (while spec-list - (setq spec (pop spec-list) - error-indicator-pos beg) - (while (and (not (eobp)) (font-latex-forward-comment))) - ;; Alternative - (when (eq spec ?|) - (setq alternative t) - (setq spec (pop spec-list))) - (cond - ;; Macros: \foo - ((eq spec ?\\) - (if (eq (char-after) spec) - (progn - (nconc match-data - (list (point) - (progn - (forward-char) - (if (zerop (skip-chars-forward "A-Za-z@")) - (forward-char) ; Single-char macro. - (skip-chars-forward "*")) - (point)))) - (nconc font-latex-matched-faces (list face)) - (setq end (max end (point))) - (when alternative (pop spec-list))) - (setq syntax-error t) - (throw 'break nil))) - ;; Mandatory arguments: {...} - ((eq spec ?{) - (if (and (eq (char-after) spec) - (setq match-beg (point)) - (font-latex-find-matching-close ?{ ?})) - (progn - (nconc match-data (list (1+ match-beg) (1- (point)))) - (nconc font-latex-matched-faces (list face)) - (setq end (max end (1- (point)))) - (when alternative (pop spec-list))) - (unless alternative - (setq syntax-error t) - (when (and match-beg (= match-beg (point))) - (setq error-indicator-pos match-beg)) - (throw 'break nil)))) - ;; Optional arguments: [...] and others - ((eq (char-after) spec) - (setq match-beg (point)) - (if (font-latex-find-matching-close - spec (cdr (assq - spec - font-latex-command-with-args-opt-arg-delims))) - (progn - (nconc match-data (list (1+ match-beg) (1- (point)))) - (nconc font-latex-matched-faces - (list 'font-lock-variable-name-face)) - (setq end (max end (1- (point))))) - (setq syntax-error t - error-indicator-pos match-beg) - (throw 'break nil)))) - (setq alternative nil))) - (when (and syntax-error (memq major-mode - font-latex-syntax-error-modes)) - ;; Add the warning face at the front of the list because - ;; the matcher uses 'append and the face would otherwise - ;; be overridden by the keyword face. - (setq match-data (append (list error-indicator-pos - (1+ error-indicator-pos)) - match-data)) - (push 'font-latex-warning-face font-latex-matched-faces)) - (font-latex-put-multiline-property-maybe beg end) - (store-match-data match-data) - (throw 'match t)))))) - -(defun font-latex-extend-region-backwards-command-with-args (beg end) - "Return position to extend region backwards for commands with args. -Return nil if region does not have to be extended for a multiline -macro to fit in. The region between the positions BEG and END -marks boundaries for searching for macro ends." - (save-excursion - (goto-char end) - (catch 'extend - (while (TeX-search-backward-unescaped "}" beg t) - (let ((macro-start (TeX-find-macro-start - (max (point-min) - (- beg font-latex-multiline-boundary))))) - (when (and macro-start - (< macro-start beg)) - (throw 'extend macro-start)))) - nil))) - -(defun font-latex-match-command-in-braces (keywords limit) - "Search for command like {\\bfseries fubar} before LIMIT. -Sets `match-data' so that: - subexpression 0 is a warning indicator, - subexpression 1 is the keyword, and - subexpression 2 is the rest in the TeX group. -Returns nil if no command is found." - (catch 'match - (while (re-search-forward keywords limit t) - (unless (font-latex-faces-present-p '(font-lock-comment-face - font-latex-verbatim-face) - (match-beginning 0)) - (let ((kbeg (match-beginning 0)) (kend (match-end 1)) - (beg (match-end 0)) - end cbeg cend - (parse-sexp-ignore-comments t)) ; scan-sexps ignores comments - (goto-char kbeg) - (if (not (eq (preceding-char) ?\{)) - ;; Fontify only the keyword (no argument found). - (progn - (setq cbeg kbeg cend kend) - (goto-char (match-end 0)) - (store-match-data (list (point) (point) - (point) (point) - cbeg cend)) - (throw 'match t)) - ;; There's an opening bracket - (save-restriction - ;; Restrict to LIMIT. - (narrow-to-region (point-min) limit) - (forward-char -1) ; Move on the opening bracket - (if (font-latex-find-matching-close ?\{ ?\}) - (progn - (font-latex-put-multiline-property-maybe beg (1- (point))) - (store-match-data (list kbeg kbeg - kbeg kend - beg (1- (point))))) - (goto-char kend) - (store-match-data (list (1- kbeg) kbeg - kbeg kend - kend kend))) - (throw 'match t)))))))) - -(defun font-latex-extend-region-backwards-command-in-braces (beg end) - "Return position to extend region backwards for commands in braces. -Return nil if region does not have to be extended for a multiline -group to fit in. The region between the positions BEG and END -marks boundaries for searching for group ends." - (save-excursion - (goto-char end) - (catch 'extend - (while (TeX-search-backward-unescaped "}" beg t) - (let ((group-start (TeX-find-opening-brace - nil (max (point-min) - (- beg font-latex-multiline-boundary))))) - (when group-start - ;; XXX: Actually we'd have to check if any of the - ;; declaration-type macros can be found right after the - ;; brace. If we don't do this (like now) large regions - ;; may be refontified for no good reason. For checking - ;; the built-in `font-latex-match-*' variables for - ;; declaration-type macros as well as the respective - ;; user-defined variables could be concatenated. - (goto-char group-start) - (when (< group-start beg) - (throw 'extend group-start))))) - nil))) - -(defun font-latex-match-simple-command (limit) - "Search for command like \\foo before LIMIT." - (TeX-re-search-forward-unescaped "\\\\[@A-Za-z]+" limit t)) - -(defun font-latex-match-math-env (limit) - "Match math pattern up to LIMIT. -Used for patterns like: -\\( F = ma \\) -\\[ F = ma \\] but not \\\\ [len]" - (catch 'match - (while (re-search-forward "\\(\\\\(\\)\\|\\(\\\\\\[\\)" limit t) - (unless (save-excursion - (goto-char (match-beginning 0)) - ;; \\[ does not start a math environment - (/= (mod (skip-chars-backward "\\\\") 2) 0)) - (let ((beg (match-beginning 0)) - (open-tag (if (match-beginning 1) "\\(" "\\[")) - (close-tag (if (match-beginning 1) "\\)" "\\]"))) - ;; Search for both opening and closing tags in order to be - ;; able to avoid erroneously matching stuff like "\(foo \(bar\)". - (if (and (re-search-forward (concat "[^\\]\\(?:\\\\\\\\\\)*\\(" - (regexp-quote open-tag) "\\|" - (regexp-quote close-tag) "\\)") - limit 'move) - (string= (match-string 1) close-tag)) - ;; Found closing tag. - (progn - (font-latex-put-multiline-property-maybe beg (point)) - (store-match-data (list beg beg beg (point)))) - ;; Did not find closing tag. - (goto-char (+ beg 2)) - (store-match-data (list beg (point) (point) (point)))) - (throw 'match t)))))) - -(defun font-latex-extend-region-backwards-math-env (beg end) - "Return position to extend region backwards for math environments. -Return nil if region does not have to be extended for a multiline -environment to fit in. The region between the positions BEG and -END marks boundaries for searching for environment ends." - (save-excursion - (goto-char end) - (catch 'extend - (while (re-search-backward "\\(\\\\)\\)\\|\\(\\\\]\\)" beg t) - (when (and (zerop (mod (skip-chars-backward "\\\\") 2)) - (re-search-backward - (concat "[^\\]\\(?:\\\\\\\\\\)*\\(" - (regexp-quote (if (match-beginning 1) "\\(" "\\[")) - "\\)") - (- beg font-latex-multiline-boundary) t) - (goto-char (match-beginning 1)) - (< (point) beg)) - (throw 'extend (point)))) - nil))) - -(defcustom font-latex-math-environments - '("display" "displaymath" "equation" "eqnarray" "gather" "multline" - "align" "alignat" "xalignat") - "List of math environment names for font locking." - :type '(repeat string) - :group 'font-latex) - -(defun font-latex-match-math-envII (limit) - "Match math patterns up to LIMIT. -Used for patterns like: -\\begin{equation} - fontified stuff -\\end{equation} -The \\begin{equation} and \\end{equation} are not fontified here." - (when (re-search-forward (concat "\\\\begin[ \t]*{" - (regexp-opt font-latex-math-environments t) - "\\*?}") - limit t) - (let ((beg (match-end 0)) end) - (if (re-search-forward (concat "\\\\end[ \t]*{" - (regexp-quote - (buffer-substring-no-properties - (match-beginning 1) - (match-end 0)))) - ;; XXX: Should this rather be done by - ;; extending the region to be fontified? - (+ limit font-latex-multiline-boundary) 'move) - (setq end (match-beginning 0)) - (goto-char beg) - (setq end beg)) - (font-latex-put-multiline-property-maybe beg end) - (store-match-data (list beg end)) - t))) - -(defun font-latex-extend-region-backwards-math-envII (beg end) - "Return position to extend region backwards for math environments. -Return nil if region does not have to be extended for a multiline -environment to fit in. The region between the positions BEG and -END marks boundaries for searching for environment ends." - (save-excursion - (goto-char end) - (catch 'extend - (while (re-search-backward - (concat "\\\\end[ \t]*{" - (regexp-opt font-latex-math-environments t) - "\\*?}") beg t) - (when (and (re-search-backward (concat "\\\\begin[ \t]*{" - (buffer-substring-no-properties - (match-beginning 1) - (match-end 0))) - (- beg font-latex-multiline-boundary) t) - (< (point) beg)) - (throw 'extend (point)))) - nil))) - -(defun font-latex-update-quote-list () - "Update quote list and regexp if value of `font-latex-quotes' changed." - (unless (eq font-latex-quotes-control font-latex-quotes) - (setq font-latex-quotes-control font-latex-quotes) - (font-latex-quotes-set-internal) - ;; Set order of each entry in `font-latex-quote-list' according to - ;; setting of `font-latex-quotes-internal'. - (let ((tail font-latex-quote-list) - elt) - (while tail - (setq elt (car tail)) - (when (and (> (safe-length elt) 2) - (not (eq (nth 2 elt) font-latex-quotes-internal))) - (setcar tail (list (nth 1 elt) (nth 0 elt) - font-latex-quotes-internal))) - (setq tail (cdr tail)))) - (setq font-latex-quote-regexp-beg - (regexp-opt (mapcar 'car font-latex-quote-list) t)))) - -(defun font-latex-match-quotation (limit) - "Match quote patterns up to LIMIT. -Used for patterns like: -``this is a normal quote'' and these are multilingual quoted strings: -\"< french \"> and \"`german\"' quotes. -The quotes << french >> and 8-bit french are used if `font-latex-quotes' is -set to french, and >>german<< (and 8-bit) are used if set to german." - (when font-latex-quotes - (font-latex-update-quote-list) - ;; Search for matches. - (catch 'match - (while (TeX-re-search-forward-unescaped - font-latex-quote-regexp-beg limit t) - (unless (font-latex-faces-present-p '(font-lock-comment-face - font-latex-verbatim-face - font-latex-math-face) - (match-beginning 0)) - (let* ((beg (match-beginning 0)) - (after-beg (match-end 0)) - (opening-quote (match-string 0)) - (closing-quote - (nth 1 (assoc (if (fboundp 'string-make-multibyte) - (string-make-multibyte (match-string 0)) - (match-string 0)) - font-latex-quote-list))) - (nest-count 0) - (point-of-surrender (+ beg font-latex-multiline-boundary))) - ;; Find closing quote taking nested quotes into account. - (while (progn - (re-search-forward - (concat opening-quote "\\|" closing-quote) - point-of-surrender 'move) - (when (and (< (point) point-of-surrender) (not (eobp))) - (if (string= (match-string 0) opening-quote) - (setq nest-count (1+ nest-count)) - (when (/= nest-count 0) - (setq nest-count (1- nest-count))))))) - ;; If no closing quote was found, set the second match which - ;; will be marked with warning color, if one was found, set - ;; the first match which will be marked with string color. - (if (or (= (point) point-of-surrender) (eobp)) - (progn - (goto-char after-beg) - (store-match-data (list after-beg after-beg beg after-beg))) - (font-latex-put-multiline-property-maybe beg (point)) - (store-match-data (list beg (point) (point) (point)))) - (throw 'match t))))))) - -(defun font-latex-extend-region-backwards-quotation (beg end) - "Return position to extend region backwards for quotations. -Return nil if region does not have to be extended for a multiline -quotation to fit in. The region between the positions BEG and -END marks boundaries for searching for quotation ends." - (if font-latex-quotes - (progn - (font-latex-update-quote-list) - (let ((regexp-end (regexp-opt (mapcar 'cadr font-latex-quote-list) t))) - (save-excursion - (goto-char end) - (catch 'extend - (while (re-search-backward regexp-end beg t) - (let ((closing-quote (match-string 0)) - (nest-count 0) - (point-of-surrender (- beg font-latex-multiline-boundary)) - opening-quote) - (catch 'found - (dolist (elt font-latex-quote-list) - (when (string= (cadr elt) closing-quote) - (setq opening-quote (car elt)) - (throw 'found nil)))) - ;; Find opening quote taking nested quotes into account. - (while (progn - (re-search-backward (concat opening-quote "\\|" - closing-quote) - point-of-surrender 'move) - (when (and (> (point) point-of-surrender) - (not (bobp))) - (if (string= (match-string 0) closing-quote) - (setq nest-count (1+ nest-count)) - (when (/= nest-count 0) - (setq nest-count (1- nest-count))))))) - (when (< (point) beg) - (throw 'extend (point))))) - nil)))) - nil)) - -(defun font-latex-match-script (limit) - "Match subscript and superscript patterns up to LIMIT." - (when (and font-latex-fontify-script - (re-search-forward "[_^] *\\([^\n\\{}]\\|\ -\\\\\\([a-zA-Z@]+\\|[^ \t\n]\\)\\|\\({\\)\\)" limit t)) - (if (font-latex-faces-present-p '(font-latex-subscript-face - font-latex-superscript-face)) - ;; Apply subscript and superscript highlighting only once in - ;; order to prevent the font size becoming too small. We set - ;; an empty match to do that. - (let ((point (point))) - (store-match-data (list point point point point))) - (when (match-end 3) - (let ((beg (match-beginning 3)) - (end (TeX-find-closing-brace - ;; Don't match groups spanning more than one line - ;; in order to avoid visually wrong indentation in - ;; subsequent lines. - nil (line-end-position)))) - (store-match-data (if end - (list (match-beginning 0) end beg end) - (list beg beg beg beg)))))) - t)) - -;; Copy and adaption of `tex-font-lock-suscript' from tex-mode.el in -;; GNU Emacs on 2004-07-07. -(defun font-latex-script (pos) - "Return face and display spec for subscript and superscript content." - (when (and (font-latex-faces-present-p 'font-latex-math-face pos) - (not (font-latex-faces-present-p '(font-lock-constant-face - font-lock-builtin-face - font-lock-comment-face - font-latex-verbatim-face) pos)) - ;; Check for backslash quoting - (not (let ((odd nil) - (pos pos)) - (while (eq (char-before pos) ?\\) - (setq pos (1- pos) odd (not odd))) - odd))) - ;; Adding other text properties than `face' is supported by - ;; `font-lock-apply-highlight' in CVS Emacsen since 2001-10-28. - ;; With the introduction of this feature the variable - ;; `font-lock-extra-managed-props' was introduced and serves here - ;; for feature checking. XEmacs (CVS and 21.4.15) currently - ;; (2004-08-18) does not support this feature. - (let ((extra-props-flag (boundp 'font-lock-extra-managed-props))) - (if (eq (char-after pos) ?_) - (if extra-props-flag - `(face font-latex-subscript-face display - ,(car font-latex-script-display)) - 'font-latex-subscript-face) - (if extra-props-flag - `(face font-latex-superscript-face display - ,(cdr font-latex-script-display)) - 'font-latex-superscript-face))))) - - -;;; docTeX - -(defvar font-latex-doctex-preprocessor-face - 'font-latex-doctex-preprocessor-face - "Face used to highlight preprocessor directives in docTeX mode.") - -(defface font-latex-doctex-preprocessor-face - '((t (:inherit (font-latex-doctex-documentation-face - font-lock-builtin-face ; Emacs 21 does not provide - ; the preprocessor face. - font-lock-preprocessor-face)))) - "Face used to highlight preprocessor directives in docTeX mode." - :group 'font-latex-highlighting-faces) - -(defvar font-latex-doctex-documentation-face - 'font-latex-doctex-documentation-face - "Face used to highlight the documentation in docTeX mode.") - -(defface font-latex-doctex-documentation-face - '((((class mono)) (:inverse-video t)) - (((class grayscale) (background dark)) (:background "#333")) - (((class color) (background dark)) (:background "#333")) - (t (:background "#eeeeee"))) - "Face used to highlight the documentation parts in docTeX mode." - :group 'font-latex-highlighting-faces) - -(defvar font-latex-doctex-keywords - (append font-latex-keywords-2 - '(("^%<[^>]*>" (0 font-latex-doctex-preprocessor-face t))))) - -;; Set and updated in `font-latex-set-syntactic-keywords'. -(defvar font-latex-doctex-syntactic-keywords nil) - -;; Copy and adaptation of `doctex-font-lock-^^A' in `tex-mode.el' of -;; CVS Emacs (March 2004) -(defun font-latex-doctex-^^A () - (if (eq (char-after (line-beginning-position)) ?\%) - (progn - (put-text-property - (1- (match-beginning 1)) (match-beginning 1) 'syntax-table - (if (= (1+ (line-beginning-position)) (match-beginning 1)) - ;; The `%' is a single-char comment, which Emacs - ;; syntax-table can't deal with. We could turn it - ;; into a non-comment, or use `\n%' or `%^' as the comment. - ;; Instead, we include it in the ^^A comment. - ;; COMPATIBILITY for Emacs 20 and XEmacs - (eval-when-compile (if (fboundp 'string-to-syntax) - (string-to-syntax "< b") - '(2097163))) - ;; COMPATIBILITY for Emacs 20 and XEmacs - (eval-when-compile (if (fboundp 'string-to-syntax) - (string-to-syntax ">") - '(12))))) - (let ((end (line-end-position))) - (if (< end (point-max)) - (put-text-property end (1+ end) 'syntax-table - ;; COMPATIBILITY for Emacs 20 and XEmacs - (eval-when-compile - (if (fboundp 'string-to-syntax) - (string-to-syntax "> b") - '(2097164)))))) - ;; COMPATIBILITY for Emacs 20 and XEmacs - (eval-when-compile (if (fboundp 'string-to-syntax) - (string-to-syntax "< b") - '(2097163)))))) - -;; Copy and adaptation of `doctex-font-lock-syntactic-face-function' -;; in `tex-mode.el' of CVS Emacs (March 2004) -(defun font-latex-doctex-syntactic-face-function (state) - ;; Mark docTeX documentation, which is parsed as a style A comment - ;; starting in column 0. - (if (or (nth 3 state) (nth 7 state) - (not (memq (char-before (nth 8 state)) - '(?\n nil)))) - ;; Anything else is just as for LaTeX. - (font-latex-syntactic-face-function state) - font-latex-doctex-documentation-face)) - - -;;; Installation in non-AUCTeX LaTeX mode - -(add-hook 'latex-mode-hook 'font-latex-setup) -;; If font-latex is loaded using a latex-mode-hook, then the add-hook above -;; won't be called this time around. Check for this now: -(if (eq major-mode 'latex-mode) - (font-latex-setup)) - - -;;; Byte-compilation of generated functions - -(when (byte-code-function-p - (symbol-function 'font-latex-make-built-in-keywords)) - (dolist (elt font-latex-built-in-keyword-classes) - (let ((name (nth 0 elt))) - (byte-compile (intern (concat "font-latex-match-" name))) - (byte-compile (intern (concat "font-latex-match-" name "-make")))))) - - -;; Provide ourselves: -(provide 'font-latex) - -;; Local Variables: -;; coding: iso-8859-1 -;; End: - -;;; font-latex.el ends here diff --git a/packages/auctex/images/amstex.xpm b/packages/auctex/images/amstex.xpm deleted file mode 100644 index dbb3cc0b6..000000000 --- a/packages/auctex/images/amstex.xpm +++ /dev/null @@ -1,207 +0,0 @@ -/* XPM */ -static char * amstex_xpm[] = { -"24 24 180 2", -" c None s backgroundToolBarColor", -". c #3E9543", -"+ c #409644", -"@ c #3D9D45", -"# c #3F9B42", -"$ c #4C2A1F", -"% c #4E3124", -"& c #727E51", -"* c #598A4E", -"= c #5B6647", -"- c #88624F", -"; c #89383B", -"> c #8B343B", -", c #6D5852", -"' c #506D48", -") c #4C843E", -"! c #648752", -"~ c #B8A789", -"{ c #80624D", -"] c #7D6951", -"^ c #FFFFC1", -"/ c #94A676", -"( c #8F8668", -"_ c #977567", -": c #A86660", -"< c #986C6A", -"[ c #758660", -"} c #708C60", -"| c #6A6C4E", -"1 c #C3C599", -"2 c #988167", -"3 c #5A3125", -"4 c #561E1C", -"5 c #958066", -"6 c #BEA384", -"7 c #68372B", -"8 c #672124", -"9 c #5B392F", -"0 c #94917B", -"a c #AFAC91", -"b c #B8B39C", -"c c #BDBCA0", -"d c #B39073", -"e c #582522", -"f c #712E2B", -"g c #6F292C", -"h c #83826F", -"i c #908F88", -"j c #F8FFFD", -"k c #686C8D", -"l c #D7DBB8", -"m c #716D76", -"n c #7B7B92", -"o c #D5D5B3", -"p c #DBBD9A", -"q c #81463B", -"r c #691A19", -"s c #838270", -"t c #888791", -"u c #6462D0", -"v c #2C2B87", -"w c #DAD9C7", -"x c #868394", -"y c #716DDC", -"z c #2F2C94", -"A c #C7C6B7", -"B c #D2AF8D", -"C c #84473C", -"D c #6D1E1F", -"E c #6E262C", -"F c #BDBDAB", -"G c #878593", -"H c #909095", -"I c #C0BEAF", -"J c #A09EAD", -"K c #A6A5A9", -"L c #C19978", -"M c #7C3D33", -"N c #641C1F", -"O c #662633", -"P c #DBDCB8", -"Q c #B4B492", -"R c #E5D9AA", -"S c #9F755A", -"T c #50231F", -"U c #672424", -"V c #8E3B4B", -"W c #E4E3BC", -"X c #A5A28D", -"Y c #D2D1B5", -"Z c #E7E5C1", -"` c #E3DFC0", -" . c #E4CCA2", -".. c #894E3A", -"+. c #461715", -"@. c #632524", -"#. c #95404E", -"$. c #777776", -"%. c #C0B396", -"&. c #AAAB90", -"*. c #463F31", -"=. c #665E46", -"-. c #7C7968", -";. c #B3AF92", -">. c #D4BD97", -",. c #804B37", -"'. c #461F19", -"). c #42201F", -"!. c #5A4F43", -"~. c #504334", -"{. c #979183", -"]. c #DCD8B5", -"^. c #D0BC9D", -"/. c #C8A487", -"(. c #82493F", -"_. c #3F1310", -":. c #401613", -"<. c #664B46", -"[. c #DCD9BC", -"}. c #B8B59D", -"|. c #8C8977", -"1. c #E9E7C0", -"2. c #A2897B", -"3. c #AE8872", -"4. c #CFB89A", -"5. c #A6715F", -"6. c #4B1D19", -"7. c #68272E", -"8. c #6E2933", -"9. c #453E37", -"0. c #767361", -"a. c #7F8170", -"b. c #7B7B6C", -"c. c #8E897E", -"d. c #827F6E", -"e. c #83876F", -"f. c #847E70", -"g. c #9C7964", -"h. c #662F2A", -"i. c #5D2D2E", -"j. c #783C3F", -"k. c #87826E", -"l. c #B3B99A", -"m. c #D1D1AB", -"n. c #DFDDB9", -"o. c #C3B191", -"p. c #826453", -"q. c #6D2B2A", -"r. c #884144", -"s. c #772B2F", -"t. c #702F34", -"u. c #AEA28C", -"v. c #C1C3A2", -"w. c #AEA07E", -"x. c #C8C09F", -"y. c #C4C6A3", -"z. c #B6886B", -"A. c #774237", -"B. c #7E3E3D", -"C. c #854748", -"D. c #78373B", -"E. c #6A2932", -"F. c #5F343C", -"G. c #7C474A", -"H. c #815655", -"I. c #7F534F", -"J. c #8A5C54", -"K. c #74504B", -"L. c #8C615F", -"M. c #7E2C29", -"N. c #8C4240", -"O. c #7C322F", -"P. c #703634", -"Q. c #6D1B27", -"R. c #975F59", -"S. c #631D22", -"T. c #65101D", -"U. c #000000", -"V. c #868686", -"W. c #AFAEAE", -" . + @ # $ ", -" % & * = - ; > , ' ) ! ~ { ", -" ] ^ / ( _ : < [ } | 1 2 3 4 ", -" 5 ^ ^ ^ ^ ^ ^ ^ ^ ^ 6 7 8 ", -" 9 ^ 0 a ^ b 0 c ^ ^ d e f g ", -" h i j k l m j n o ^ p q r ", -" s t u v w x y z A ^ B C D E ", -" ] F G H ^ I J K ^ ^ L M N O ", -" ] ^ P Q ^ ^ ^ ^ ^ ^ R S T U V ", -" ] ^ W X Y Z ` ^ ^ ^ ^ ...+.@.#. ", -" $.$.%.%.&.*.=.-.;.%.%.%.^ >.,.'.). ", -" %.%.^ ^ !.~.{.].^ ^ ^ ^./.(._.:. ", -" $.$.<.[.^ }.|.1.^ 2.3.4.^ 5.6.7.8. ", -" 9.0.a.b.c.d.e.f.^ ^ g.h.i.j. ", -" k.^ l.^ ^ m.n.^ o.p.q.r.s.t. ", -" u.v.%.w.x.y.z.A.B.C.D.E.F. ", -" G.H.I.J.K.L.M.N.O.P. ", -" Q.R. S. T. ", -" ", -" U.U. V.U.U.W. ", -" U. U. U.U.V.U.V. U. ", -" U. U. U. U. U. V.U.U.V. ", -" U.U.U.U. U. U. U. U. ", -" U.V. U. U. U. U. U.U.U.V. "}; diff --git a/packages/auctex/images/bibtex.xpm b/packages/auctex/images/bibtex.xpm deleted file mode 100644 index 7400f0966..000000000 --- a/packages/auctex/images/bibtex.xpm +++ /dev/null @@ -1,82 +0,0 @@ -/* XPM */ -static char * bibtex14_xpm[] = { -"24 24 55 1", -" c None s backgroundToolBarColor", -". c #353535", -"+ c #877D55", -"@ c #B9AD74", -"# c #606060", -"$ c #878585", -"% c #A89C6A", -"& c #726A49", -"* c #070705", -"= c #9A9A9A", -"- c #59533A", -"; c #938960", -"> c #C9C7BF", -", c #7C7C7C", -"' c #3D3928", -") c #AFA379", -"! c #AFAEA8", -"~ c #938A63", -"{ c #3F3B2A", -"] c #8E865E", -"^ c #B6AA72", -"/ c #424242", -"( c #373737", -"_ c #4E4C41", -": c #565344", -"< c #746D4E", -"[ c #7E7652", -"} c #8E845A", -"| c #B0A46E", -"1 c #775E5E", -"2 c #F5F4F3", -"3 c #D7D5D0", -"4 c #BCB8AC", -"5 c #A39F94", -"6 c #817E71", -"7 c #605D4F", -"8 c #8A8058", -"9 c #92885C", -"0 c #826A6A", -"a c #CACACA", -"b c #FFFFFF", -"c c #E6E6E5", -"d c #D0D0D0", -"e c #CCCCCC", -"f c #C4C2B8", -"g c #B5B2A5", -"h c #918F84", -"i c #59564C", -"j c #F6F6F6", -"k c #F3F2F0", -"l c #AEAEAE", -"m c #727272", -"n c #909090", -"o c #DCDCDC", -"p c #A3A3A3", -" ", -" ", -" .............. ", -" .+@@@@@@@@@@@+# ", -" $.@@@@@@@@@@@+. ", -" .%&*@@@@@@@@@.= ", -" .+@--@@*@-;@@+.> ", -" $.@-*@@@@;*@@@.=>, ", -" .%@*@*@*@'*@@+.>>..", -" .+@*;--&&&*)*@.=>!, ", -" $.@@@*-@*@*~~*@.>>,= ", -" .%@@@@@@@@@{{@.=>!. ", -" .+@@@@@@@@@@@@+.>>,= ", -" $.]^@@@@@@@@@@@.=>!. ", -" /(_:<[}|@@@@@@+.>>,= ", -" /12234567:<[89.>>!. ", -" /0abbb2cdefghi>>>,= ", -" $#$ajbbbbbkcc>>!. ", -" l=mnajbbbbbo>,= ", -" l=mnajbbc>. ", -" l=mnac,= ", -" l=m. ", -" p ", -" "}; diff --git a/packages/auctex/images/dropdown.xpm b/packages/auctex/images/dropdown.xpm deleted file mode 100644 index adf0e61d6..000000000 --- a/packages/auctex/images/dropdown.xpm +++ /dev/null @@ -1,30 +0,0 @@ -/* XPM */ -static char * dropdown_xpm[] = { -"10 24 3 1", -" c None s backgroundToolBarColor", -". c #292C29", -"+ c #B3B3B3", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" . . ", -" ... ... ", -" ...... ", -" .... ", -" .. ", -" ++ ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/packages/auctex/images/dvipdf.xpm b/packages/auctex/images/dvipdf.xpm deleted file mode 100644 index 1b2a76108..000000000 --- a/packages/auctex/images/dvipdf.xpm +++ /dev/null @@ -1,65 +0,0 @@ -/* XPM */ -static char * dvipdf4_xpm[] = { -"24 24 38 1", -" c None s backgroundToolBarColor", -". c #4C4C4C", -"+ c #000000", -"@ c #7C7C7C", -"# c #577A4D", -"$ c #4C6B43", -"% c #37452B", -"& c #76996C", -"* c #9BB594", -"= c #648C58", -"- c #DAE3D6", -"; c #445636", -"> c #67865E", -", c #A7BDA0", -"' c #8EAB86", -") c #526741", -"! c #425D3A", -"~ c #4C603C", -"{ c #566B43", -"] c #5A7046", -"^ c #295E29", -"/ c #5ABD5A", -"( c #D37F71", -"_ c #CE918A", -": c #D4897A", -"< c #67102D", -"[ c #488148", -"} c #C47474", -"| c #D69788", -"1 c #4CA14C", -"2 c #4D904D", -"3 c #CB8984", -"4 c #D79C8D", -"5 c #C8807D", -"6 c #4FA64F", -"7 c #5A5A5A", -"8 c #B50000", -"9 c #AA7979", -" .+. ++++ ", -" @+##$+@ +++%++ ", -" +&**&=+ + +%+ ", -" .#*-*&=$. +;+ ", -" +>,*'==$+ +)+ ", -" .#&&==#!. ++))~++ ", -" +#==#$+ +{]{+ ", -" @+!$!+@ +)+ ", -" .+. + ", -" ", -" + ", -"^^^/ ^ ^ ^ +(+ ", -"^ ^ ^ ^ ^ +_:<+ ", -"^ ^ [ [ ^ +}_|<<+ ", -"^ ^ 1221 ^ +}3_4<<<+ ", -"^ ^ [[ ^ +}53_4<<<<+", -"^^^/ 66 ^ +}53_|<<<+ ", -" 7+}5:<<+ ", -" 7+(<+ ", -"8889 8889 8889 ++ ", -"8 8 8 8 8 ", -"8889 8 8 889 ", -"8 8 8 8 ", -"8 8889 8 "}; diff --git a/packages/auctex/images/dvips.xpm b/packages/auctex/images/dvips.xpm deleted file mode 100644 index 7d58e2d5e..000000000 --- a/packages/auctex/images/dvips.xpm +++ /dev/null @@ -1,89 +0,0 @@ -/* XPM */ -static char * dvips66_xpm[] = { -"24 24 62 1", -" c None s backgroundToolBarColor", -". c #4C4C4C", -"+ c #000000", -"@ c #7C7C7C", -"# c #577A4D", -"$ c #4C6B43", -"% c #37452B", -"& c #76996C", -"* c #9BB594", -"= c #648C58", -"- c #DAE3D6", -"; c #445636", -"> c #67865E", -", c #A7BDA0", -"' c #8EAB86", -") c #526741", -"! c #425D3A", -"~ c #4C603C", -"{ c #566B43", -"] c #5A7046", -"^ c #869CB4", -"/ c #00244C", -"( c #002248", -"_ c #0050A9", -": c #006FEB", -"< c #0066D9", -"[ c #00336D", -"} c #295E29", -"| c #5ABD5A", -"1 c #001070", -"2 c #004BA2", -"3 c #0078FF", -"4 c #0075FC", -"5 c #004DB6", -"6 c #00072F", -"7 c #0047FF", -"8 c #006DFF", -"9 c #0042CA", -"0 c #00169E", -"a c #000A45", -"b c #488148", -"c c #0024FF", -"d c #0027FF", -"e c #0056ED", -"f c #001FA7", -"g c #00179F", -"h c #4CA14C", -"i c #4D904D", -"j c #001DCE", -"k c #4FA64F", -"l c #000B4C", -"m c #0023F5", -"n c #001492", -"o c #000E65", -"p c #00010B", -"q c #001AB9", -"r c #0022F0", -"s c #001387", -"t c #000942", -"u c #0037C4", -"v c #6C84B7", -"w c #000C57", -" .+. ++++ ", -" @+##$+@ +++%++ ", -" +&**&=+ + +%+ ", -" .#*-*&=$. +;+ ", -" +>,*'==$+ +)+ ", -" .#&&==#!. ++))~++ ", -" +#==#$+ +{]{+ ", -" @+!$!+@ +)+ ", -" .+. + ", -" ", -" ^/ ", -" ^(_:<[ ", -"}}}| } } } 12:333456", -"} } } } } 17833390a", -"} } b b } 1cd7efg0a", -"} } hiih } 1cccj000a", -"} } bb } 1cccj000a", -"}}}| kk } lmccj0nop", -" lqrjst ", -" uuuv vuuv 1w ", -" u u u ", -" uuuv vuuv ", -" u u ", -" u vuuv "}; diff --git a/packages/auctex/images/error.xpm b/packages/auctex/images/error.xpm deleted file mode 100644 index 6dab4fa39..000000000 --- a/packages/auctex/images/error.xpm +++ /dev/null @@ -1,35 +0,0 @@ -/* XPM */ -static char * error22_xpm[] = { -"24 24 8 1", -" c None s backgroundToolBarColor", -". c #847000", -"+ c #000000", -"@ c #F0C900", -"# c #AB9100", -"$ c #887821", -"% c #AA9629", -"& c #51470D", -" ", -" ", -" .++. ", -" +@@@@+ ", -" #.@@@@.# ", -" +@@@@@@+ ", -" #.@@@@@@.# ", -" +@@@++@@@+ ", -" #.@@@++@@@.# ", -" +@@@@++@@@@+ ", -" #.@@@@++@@@@.# ", -" +@@@@@++@@@@@+ ", -" #.@@@@@++@@@@@.# ", -" +@@@@@@$$@@@@@@+ ", -" #.@@@@@@%%@@@@@@.# ", -" +@@@@@@@@@@@@@@@@+ ", -" .#@@@@@@@++@@@@@@@#. ", -" &@@@@@@@@++@@@@@@@@& ", -" &@@@@@@@@@@@@@@@@@@& ", -" +@@@@@@@@@@@@@@@@+ ", -" .++++++++++++++. ", -" ", -" ", -" "}; diff --git a/packages/auctex/images/exec.xpm b/packages/auctex/images/exec.xpm deleted file mode 100644 index 9ad3ade3b..000000000 --- a/packages/auctex/images/exec.xpm +++ /dev/null @@ -1,68 +0,0 @@ -/* XPM */ -static char * exec6_xpm[] = { -"24 24 41 1", -" c None s backgroundToolBarColor", -". c #9F9D96", -"+ c #3A3A3A", -"@ c #B3B3B1", -"# c #000000", -"$ c #807D74", -"% c #3C3C3C", -"& c #76746B", -"* c #5D5C55", -"= c #6D6B63", -"- c #65635C", -"; c #8C8B89", -"> c #E4E3E1", -", c #E2E2E2", -"' c #484641", -") c #888781", -"! c #B0AFAD", -"~ c #A8A7A1", -"{ c #908E86", -"] c #97958E", -"^ c #595854", -"/ c #605E57", -"( c #898883", -"_ c #464542", -": c #4A4947", -"< c #43423E", -"[ c #E2E2E1", -"} c #B6B5AF", -"| c #494847", -"1 c #434242", -"2 c #464644", -"3 c #E6E6E4", -"4 c #484846", -"5 c #DFDEDC", -"6 c #B0AFA9", -"7 c #D5D4D1", -"8 c #93918B", -"9 c #D6D5D2", -"0 c #ABA9A3", -"a c #494943", -"b c #464540", -" ", -" . ++ @ ", -" #@#..#.# ", -" .@...$$$%. ", -" #..&$*=# ", -" +..&##@--+ ", -" +.$$#;@-%+ ", -" #$*@@$%# ", -" @.$=--%%%. ", -" #%#-%#%# ", -" . ++ . %%% ", -" %% %>% %% ", -" %,@%'.'%)%% ", -" %!~...{]$'% ", -" %..^/($&% ", -" %%'./_:<.='%% ", -" %[}.^|123$-/% ", -" %%'.(<4;5-'%% ", -" %6$}378-%% ", -" %90.$$&&*'% ", -" %%^%'&'%a%% ", -" %% %b%*%% ", -" %%% ", -" "}; diff --git a/packages/auctex/images/execbibtex.xpm b/packages/auctex/images/execbibtex.xpm deleted file mode 100644 index 27bca498a..000000000 --- a/packages/auctex/images/execbibtex.xpm +++ /dev/null @@ -1,127 +0,0 @@ -/* XPM */ -static char * execbibtex8_xpm[] = { -"24 24 100 2", -" c None s backgroundToolBarColor", -". c #1F1D12", -"+ c #222017", -"@ c #211F15", -"# c #211F14", -"$ c #0C0B07", -"% c #5E5737", -"& c #B7AB72", -"* c #BFB480", -"= c #BAAF77", -"- c #B9AD74", -"; c #9A9061", -"> c #545144", -", c #AFA98C", -"' c #776F4F", -") c #C0B684", -"! c #625C3D", -"~ c #767675", -"{ c #A79D6F", -"] c #BEB37E", -"^ c #93895C", -"/ c #59574E", -"( c #A3A3A2", -"_ c #807A59", -": c #BCB17E", -"< c #B9AE75", -"[ c #B8AC73", -"} c #7E7650", -"| c #5B5B5B", -"1 c #ACACAA", -"2 c #202120", -"3 c #60593A", -"4 c #BAAE76", -"5 c #A39966", -"6 c #363635", -"7 c #B4B4B3", -"8 c #82857F", -"9 c #171816", -"0 c #8A825C", -"a c #B9AD75", -"b c #6D6748", -"c c #6A6A6A", -"d c #A9AAA6", -"e c #363735", -"f c #95948C", -"g c #A39C82", -"h c #7A7356", -"i c #BBB079", -"j c #BBAF78", -"k c #20201C", -"l c #B3B3B2", -"m c #767774", -"n c #20211F", -"o c #1A1112", -"p c #5D413D", -"q c #555540", -"r c #7C7A58", -"s c #4D4830", -"t c #8B8A89", -"u c #ADADAB", -"v c #4F514E", -"w c #1E1616", -"x c #BA9797", -"y c #DCD6D3", -"z c #CDCDCA", -"A c #575651", -"B c #1B1A19", -"C c #ABABA9", -"D c #777775", -"E c #080808", -"F c #1B1212", -"G c #846666", -"H c #A5A09E", -"I c #D4D2C6", -"J c #E7E6DF", -"K c #F1F0EC", -"L c #A9AAA8", -"M c #4F514D", -"N c #585442", -"O c #6D6D66", -"P c #DEDBCA", -"Q c #EAE9E4", -"R c #BEC0B9", -"S c #878A84", -"T c #000000", -"U c #47453A", -"V c #50504D", -"W c #999474", -"X c #363731", -"Y c #020201", -"Z c #3A3A3A", -"` c #65635C", -" . c #9F9D96", -".. c #807D74", -"+. c #3C3C3C", -"@. c #76746B", -"#. c #5D5C55", -"$. c #6D6B63", -"%. c #B3B3B1", -"&. c #8C8B89", -" ", -" . + @ # # # # $ ", -" % & * = - - - ; > ", -" , ' ) = - - - - ! ~ ", -" % { ] - - - - ^ / ( ", -" , _ : < - - - [ } | 1 2 ", -" 3 ] 4 - - - - 5 6 7 8 9 ", -" % 0 ] a - - - - b c d e f ", -" g h i j - - - - - k l m n ", -" o p q r ; 5 - - s t u v f ", -" w x y z u ~ A q B C D E ", -" F G H I J K K K z L M f ", -" v M N O f P Q R S T ", -" ( D U V W X f ", -" ( v Y Z Z ", -" T ` T . .T ` T ", -" ` . . .......+. ", -" T . .@...#.$.T ", -" Z . .@.T T %.` ` Z ", -" Z .....T &.%.` +.Z ", -" T ..#.%.%...+.T ", -" ` ..$.` ` +.+.+. ", -" T +.T ` +.T +.T ", -" Z Z "}; diff --git a/packages/auctex/images/execdvips.xpm b/packages/auctex/images/execdvips.xpm deleted file mode 100644 index 5166e8395..000000000 --- a/packages/auctex/images/execdvips.xpm +++ /dev/null @@ -1,52 +0,0 @@ -/* XPM */ -static char * execdvips36_xpm[] = { -"24 24 25 1", -" c None s backgroundToolBarColor", -". c #295E29", -"+ c #5ABD5A", -"@ c #488148", -"# c #818181", -"$ c #4CA14C", -"% c #4D904D", -"& c #ADADAD", -"* c #4FA64F", -"= c #6E6E6E", -"- c #545454", -"; c #999999", -"> c #3A3A3A", -", c #000000", -"' c #65635C", -") c #9F9D96", -"! c #0037C4", -"~ c #6C84B7", -"{ c #807D74", -"] c #3C3C3C", -"^ c #76746B", -"/ c #5D5C55", -"( c #6D6B63", -"_ c #B3B3B1", -": c #8C8B89", -" ", -" ...+ . . . ", -" . . . . . ", -" . . . . . ", -" . . @ @ . ", -" # . . $%%$ . ", -" #& . . @@ . ", -" #& ...+ ** . ", -" = ", -" - ", -" # ", -" - ; ", -" ;- ", -" ;-- ", -" >> ", -" ,',)),', ", -" !!!~ ~!!~ '))){{{] ", -" ! ! ! ! ,))^{/(, ", -" ! ! ! >))^,,_''>", -" !!!~ ~!!~ >){{,:_']>", -" ! ! ,{/__{], ", -" ! ! ! '{('']]] ", -" ! ~!!~ ,],'],], ", -" >> "}; diff --git a/packages/auctex/images/execerror.xpm b/packages/auctex/images/execerror.xpm deleted file mode 100644 index 6a77ea363..000000000 --- a/packages/auctex/images/execerror.xpm +++ /dev/null @@ -1,49 +0,0 @@ -/* XPM */ -static char * execerror12_xpm[] = { -"24 24 22 1", -" c None s backgroundToolBarColor", -". c #B09400", -"+ c #605000", -"@ c #9C8400", -"# c #FFD906", -"$ c #FED90A", -"% c #957F0D", -"& c #DEBD0E", -"* c #6F5D00", -"= c #8F7900", -"- c #655500", -"; c #3A3A3A", -"> c #000000", -", c #65635C", -"' c #9F9D96", -") c #807D74", -"! c #3C3C3C", -"~ c #76746B", -"{ c #5D5C55", -"] c #6D6B63", -"^ c #B3B3B1", -"/ c #8C8B89", -" ", -" ", -" .++. ", -" @##@. ", -" +$###+ ", -" ..#++#.. ", -" +$#++#$+ ", -" ..##++##.. ", -" +$##%%##$+ ", -" ..###&&###.. ", -" +####**###$+ ", -" +##########+ ", -" =--------= ", -" ", -" ;; ", -" >,>''>,> ", -" ,''')))! ", -" >''~){]> ", -" ;''~>>^,,;", -" ;'))>/^,!;", -" >){^^)!> ", -" ,)],,!!! ", -" >!>,!>!> ", -" ;; "}; diff --git a/packages/auctex/images/execpdftex.xpm b/packages/auctex/images/execpdftex.xpm deleted file mode 100644 index c5ef5b57f..000000000 --- a/packages/auctex/images/execpdftex.xpm +++ /dev/null @@ -1,205 +0,0 @@ -/* XPM */ -static char * execpdftex11_xpm[] = { -"24 24 178 2", -" c None s backgroundToolBarColor", -". c #3E9543", -"+ c #409644", -"@ c #3D9D45", -"# c #3F9B42", -"$ c #4C2A1F", -"% c #4E3124", -"& c #727E51", -"* c #598A4E", -"= c #5B6647", -"- c #88624F", -"; c #89383B", -"> c #8B343B", -", c #6D5852", -"' c #506D48", -") c #4C843E", -"! c #648752", -"~ c #B8A789", -"{ c #80624D", -"] c #7D6951", -"^ c #FFFFC1", -"/ c #94A676", -"( c #8F8668", -"_ c #977567", -": c #A86660", -"< c #986C6A", -"[ c #758660", -"} c #708C60", -"| c #6A6C4E", -"1 c #C3C599", -"2 c #988167", -"3 c #5A3125", -"4 c #958066", -"5 c #BEA384", -"6 c #68372B", -"7 c #672124", -"8 c #5B392F", -"9 c #94917B", -"0 c #AFAC91", -"a c #B8B39C", -"b c #BDBCA0", -"c c #B39073", -"d c #582522", -"e c #712E2B", -"f c #83826F", -"g c #908F88", -"h c #F8FFFD", -"i c #686C8D", -"j c #D7DBB8", -"k c #716D76", -"l c #7B7B92", -"m c #D5D5B3", -"n c #DBBD9A", -"o c #81463B", -"p c #691A19", -"q c #838270", -"r c #888791", -"s c #6462D0", -"t c #2C2B87", -"u c #DAD9C7", -"v c #868394", -"w c #716DDC", -"x c #2F2C94", -"y c #C7C6B7", -"z c #D2AF8D", -"A c #84473C", -"B c #6D1E1F", -"C c #975F59", -"D c #BDBDAB", -"E c #878593", -"F c #909095", -"G c #C0BEAF", -"H c #A09EAD", -"I c #A6A5A9", -"J c #C19978", -"K c #7C3D33", -"L c #641C1F", -"M c #DBDCB8", -"N c #B4B492", -"O c #E5D9AA", -"P c #9F755A", -"Q c #50231F", -"R c #672424", -"S c #E4E3BC", -"T c #A5A28D", -"U c #D2D1B5", -"V c #E7E5C1", -"W c #E3DFC0", -"X c #E4CCA2", -"Y c #894E3A", -"Z c #461715", -"` c #632524", -" . c #665E46", -".. c #C0B396", -"+. c #AAAB90", -"@. c #463F31", -"#. c #7C7968", -"$. c #B3AF92", -"%. c #D4BD97", -"&. c #804B37", -"*. c #461F19", -"=. c #42201F", -"-. c #5A4F43", -";. c #504334", -">. c #979183", -",. c #DCD8B5", -"'. c #D0BC9D", -"). c #C8A487", -"!. c #82493F", -"~. c #3F1310", -"{. c #401613", -"]. c #664B46", -"^. c #DCD9BC", -"/. c #B8B59D", -"(. c #8C8977", -"_. c #E9E7C0", -":. c #A2897B", -"<. c #AE8872", -"[. c #CFB89A", -"}. c #A6715F", -"|. c #4B1D19", -"1. c #68272E", -"2. c #767361", -"3. c #7F8170", -"4. c #7B7B6C", -"5. c #8E897E", -"6. c #827F6E", -"7. c #83876F", -"8. c #847E70", -"9. c #9C7964", -"0. c #662F2A", -"a. c #5D2D2E", -"b. c #783C3F", -"c. c #87826E", -"d. c #B3B99A", -"e. c #D1D1AB", -"f. c #DFDDB9", -"g. c #C3B191", -"h. c #826453", -"i. c #6D2B2A", -"j. c #884144", -"k. c #772B2F", -"l. c #3A3A3A", -"m. c #AEA28C", -"n. c #C1C3A2", -"o. c #AEA07E", -"p. c #C8C09F", -"q. c #C4C6A3", -"r. c #B6886B", -"s. c #774237", -"t. c #7E3E3D", -"u. c #854748", -"v. c #78373B", -"w. c #000000", -"x. c #65635C", -"y. c #9F9D96", -"z. c #7C474A", -"A. c #815655", -"B. c #7F534F", -"C. c #8A5C54", -"D. c #74504B", -"E. c #8C615F", -"F. c #7E2C29", -"G. c #8C4240", -"H. c #7C322F", -"I. c #703634", -"J. c #807D74", -"K. c #3C3C3C", -"L. c #6D1B27", -"M. c #631D22", -"N. c #65101D", -"O. c #76746B", -"P. c #5D5C55", -"Q. c #6D6B63", -"R. c #B3B3B1", -"S. c #B50000", -"T. c #AA7979", -"U. c #8C8B89", -" . + @ # $ ", -" % & * = - ; > , ' ) ! ~ { ", -" ] ^ / ( _ : < [ } | 1 2 3 ", -" 4 ^ ^ ^ ^ ^ ^ ^ ^ ^ 5 6 7 ", -" 8 ^ 9 0 ^ a 9 b ^ ^ c d e ", -" f g h i j k h l m ^ n o p ", -" q r s t u v w x y ^ z A B C ", -" ] D E F ^ G H I ^ ^ J K L ", -" ] ^ M N ^ ^ ^ ^ ^ ^ O P Q R C ", -" ] ^ S T U V W ^ ^ ^ ^ X Y Z ` ", -" .....+.@. .#.$.......^ %.&.*.=. ", -"....^ ^ -.;.>.,.^ ^ ^ '.).!.~.{. ", -" .].^.^ /.(._.^ :.<.[.^ }.|.1. ", -" 2.2.3.4.5.6.7.8.^ ^ 9.0.a.b. ", -" c.^ d.^ ^ e.f.^ g.h.i.j.k. l.l. ", -" m.n...o.p.q.r.s.t.u.v. w.x.w.y.y.w.x.w. ", -" z.A.B.C.D.E.F.G.H.I. x.y.y.y.J.J.J.K. ", -" L.C M. N. w.y.y.O.J.P.Q.w. ", -" l.y.y.O.w.w.R.x.x.l.", -" S.S.T. S.S.T. S.S.T. l.y.J.J.w.U.R.x.K.l.", -" S. S. S. S. S. w.J.P.R.R.J.K.w. ", -" S.S.T. S. S. S.S. x.J.Q.x.x.K.K.K. ", -" S. S. S. S. w.K.w.x.K.w.K.w. ", -" S. S.S.T. S. l.l. "}; diff --git a/packages/auctex/images/exectex.xpm b/packages/auctex/images/exectex.xpm deleted file mode 100644 index 74f724aec..000000000 --- a/packages/auctex/images/exectex.xpm +++ /dev/null @@ -1,203 +0,0 @@ -/* XPM */ -static char * exectex40_xpm[] = { -"24 24 176 2", -" c None s backgroundToolBarColor", -". c #3E9543", -"+ c #409644", -"@ c #3D9D45", -"# c #3F9B42", -"$ c #4C2A1F", -"% c #4E3124", -"& c #727E51", -"* c #598A4E", -"= c #5B6647", -"- c #88624F", -"; c #89383B", -"> c #8B343B", -", c #6D5852", -"' c #506D48", -") c #4C843E", -"! c #648752", -"~ c #B8A789", -"{ c #80624D", -"] c #7D6951", -"^ c #FFFFC1", -"/ c #94A676", -"( c #8F8668", -"_ c #977567", -": c #A86660", -"< c #986C6A", -"[ c #758660", -"} c #708C60", -"| c #6A6C4E", -"1 c #C3C599", -"2 c #988167", -"3 c #5A3125", -"4 c #958066", -"5 c #BEA384", -"6 c #68372B", -"7 c #672124", -"8 c #5B392F", -"9 c #94917B", -"0 c #AFAC91", -"a c #B8B39C", -"b c #BDBCA0", -"c c #B39073", -"d c #582522", -"e c #712E2B", -"f c #83826F", -"g c #908F88", -"h c #F8FFFD", -"i c #686C8D", -"j c #D7DBB8", -"k c #716D76", -"l c #7B7B92", -"m c #D5D5B3", -"n c #DBBD9A", -"o c #81463B", -"p c #691A19", -"q c #838270", -"r c #888791", -"s c #6462D0", -"t c #2C2B87", -"u c #DAD9C7", -"v c #868394", -"w c #716DDC", -"x c #2F2C94", -"y c #C7C6B7", -"z c #D2AF8D", -"A c #84473C", -"B c #6D1E1F", -"C c #975F59", -"D c #BDBDAB", -"E c #878593", -"F c #909095", -"G c #C0BEAF", -"H c #A09EAD", -"I c #A6A5A9", -"J c #C19978", -"K c #7C3D33", -"L c #641C1F", -"M c #DBDCB8", -"N c #B4B492", -"O c #E5D9AA", -"P c #9F755A", -"Q c #50231F", -"R c #672424", -"S c #E4E3BC", -"T c #A5A28D", -"U c #D2D1B5", -"V c #E7E5C1", -"W c #E3DFC0", -"X c #E4CCA2", -"Y c #894E3A", -"Z c #461715", -"` c #632524", -" . c #979183", -".. c #665E46", -"+. c #C0B396", -"@. c #AAAB90", -"#. c #463F31", -"$. c #7C7968", -"%. c #B3AF92", -"&. c #D4BD97", -"*. c #804B37", -"=. c #461F19", -"-. c #42201F", -";. c #5A4F43", -">. c #504334", -",. c #DCD8B5", -"'. c #D0BC9D", -"). c #C8A487", -"!. c #82493F", -"~. c #3F1310", -"{. c #401613", -"]. c #664B46", -"^. c #DCD9BC", -"/. c #B8B59D", -"(. c #8C8977", -"_. c #E9E7C0", -":. c #A2897B", -"<. c #AE8872", -"[. c #CFB89A", -"}. c #A6715F", -"|. c #4B1D19", -"1. c #68272E", -"2. c #767361", -"3. c #7F8170", -"4. c #7B7B6C", -"5. c #8E897E", -"6. c #827F6E", -"7. c #83876F", -"8. c #847E70", -"9. c #9C7964", -"0. c #662F2A", -"a. c #5D2D2E", -"b. c #783C3F", -"c. c #87826E", -"d. c #B3B99A", -"e. c #D1D1AB", -"f. c #DFDDB9", -"g. c #C3B191", -"h. c #826453", -"i. c #6D2B2A", -"j. c #884144", -"k. c #772B2F", -"l. c #3A3A3A", -"m. c #AEA28C", -"n. c #C1C3A2", -"o. c #AEA07E", -"p. c #C8C09F", -"q. c #C4C6A3", -"r. c #B6886B", -"s. c #774237", -"t. c #7E3E3D", -"u. c #854748", -"v. c #78373B", -"w. c #000000", -"x. c #65635C", -"y. c #9F9D96", -"z. c #7C474A", -"A. c #815655", -"B. c #7F534F", -"C. c #8A5C54", -"D. c #74504B", -"E. c #8C615F", -"F. c #7E2C29", -"G. c #8C4240", -"H. c #7C322F", -"I. c #703634", -"J. c #807D74", -"K. c #3C3C3C", -"L. c #6D1B27", -"M. c #631D22", -"N. c #65101D", -"O. c #76746B", -"P. c #5D5C55", -"Q. c #6D6B63", -"R. c #B3B3B1", -"S. c #8C8B89", -" . + @ # $ ", -" % & * = - ; > , ' ) ! ~ { ", -" ] ^ / ( _ : < [ } | 1 2 3 ", -" 4 ^ ^ ^ ^ ^ ^ ^ ^ ^ 5 6 7 ", -" 8 ^ 9 0 ^ a 9 b ^ ^ c d e ", -" f g h i j k h l m ^ n o p ", -" q r s t u v w x y ^ z A B C ", -" ] D E F ^ G H I ^ ^ J K L ", -" ] ^ M N ^ ^ ^ ^ ^ ^ O P Q R C ", -" ] ^ S T U V W ^ ^ ^ ^ X Y Z ` ", -" ...+.+.@.#...$.%.+.+.+.^ &.*.=.-. ", -" +.+.^ ^ ;.>. .,.^ ^ ^ '.).!.~.{. ", -" ...].^.^ /.(._.^ :.<.[.^ }.|.1. ", -" 2.2.3.4.5.6.7.8.^ ^ 9.0.a.b. ", -" c.^ d.^ ^ e.f.^ g.h.i.j.k. l.l. ", -" m.n.+.o.p.q.r.s.t.u.v. w.x.w.y.y.w.x.w. ", -" z.A.B.C.D.E.F.G.H.I. x.y.y.y.J.J.J.K. ", -" L.C M. N. w.y.y.O.J.P.Q.w. ", -" l.y.y.O.w.w.R.x.x.l.", -" l.y.J.J.w.S.R.x.K.l.", -" w.J.P.R.R.J.K.w. ", -" x.J.Q.x.x.K.K.K. ", -" w.K.w.x.K.w.K.w. ", -" l.l. "}; diff --git a/packages/auctex/images/execviewdvi.xpm b/packages/auctex/images/execviewdvi.xpm deleted file mode 100644 index 177c623a1..000000000 --- a/packages/auctex/images/execviewdvi.xpm +++ /dev/null @@ -1,46 +0,0 @@ -/* XPM */ -static char * execviewdvi11_xpm[] = { -"24 24 19 1", -" c None s backgroundToolBarColor", -". c #295E29", -"+ c #5ABD5A", -"@ c #488148", -"# c #4CA14C", -"$ c #4D904D", -"% c #000000", -"& c #4FA64F", -"* c #FFFFFF", -"= c #3A3A3A", -"- c #65635C", -"; c #9F9D96", -"> c #807D74", -", c #3C3C3C", -"' c #76746B", -") c #5D5C55", -"! c #6D6B63", -"~ c #B3B3B1", -"{ c #8C8B89", -" ...+ . . . ", -" . . . . . ", -" . . . . . ", -" . . @ @ . ", -" . . #$$# . ", -" . . @@ . ", -" %% ...+ && . ", -" % % ", -" % % ", -" % % %% ", -" %% % % ", -"%* % % % ", -"%** % %% % % ", -"%** %%%* %% ", -" % % %** % == ", -" %% %** % %-%;;%-% ", -" % % -;;;>>>, ", -" %% %;;'>)!% ", -" =;;'%%~--=", -" =;>>%{~-,=", -" %>)~~>,% ", -" ->!--,,, ", -" %,%-,%,% ", -" == "}; diff --git a/packages/auctex/images/execviewpdf.xpm b/packages/auctex/images/execviewpdf.xpm deleted file mode 100644 index fded37aa1..000000000 --- a/packages/auctex/images/execviewpdf.xpm +++ /dev/null @@ -1,42 +0,0 @@ -/* XPM */ -static char * execviewpdf4_xpm[] = { -"24 24 15 1", -" c None s backgroundToolBarColor", -". c #B50000", -"+ c #AA7979", -"@ c #000000", -"# c #FFFFFF", -"$ c #3A3A3A", -"% c #65635C", -"& c #9F9D96", -"* c #807D74", -"= c #3C3C3C", -"- c #76746B", -"; c #5D5C55", -"> c #6D6B63", -", c #B3B3B1", -"' c #8C8B89", -" ...+ ...+ ...+", -" . . . . . ", -" . . . . . ", -" ...+ . . ..+ ", -" . . . . ", -" . . . . ", -" @@ . ...+ . ", -" @ @ ", -" @ @ ", -" @ @ @@ ", -" @@ @ @ ", -"@# @ @ @ ", -"@## @ @@ @ @ ", -"@## @@@# @@ ", -" @ @ @## @ $$ ", -" @@ @## @ @%@&&@%@ ", -" @ @ %&&&***= ", -" @@ @&&-*;>@ ", -" $&&-@@,%%$", -" $&**@',%=$", -" @*;,,*=@ ", -" %*>%%=== ", -" @=@%=@=@ ", -" $$ "}; diff --git a/packages/auctex/images/execviewps.xpm b/packages/auctex/images/execviewps.xpm deleted file mode 100644 index d62117f0c..000000000 --- a/packages/auctex/images/execviewps.xpm +++ /dev/null @@ -1,42 +0,0 @@ -/* XPM */ -static char * execviewps12_xpm[] = { -"24 24 15 1", -" c None s backgroundToolBarColor", -". c #0037C4", -"+ c #6C84B7", -"@ c #000000", -"# c #FFFFFF", -"$ c #3A3A3A", -"% c #65635C", -"& c #9F9D96", -"* c #807D74", -"= c #3C3C3C", -"- c #76746B", -"; c #5D5C55", -"> c #6D6B63", -", c #B3B3B1", -"' c #8C8B89", -" ...+ +..+ ", -" . . . . ", -" . . . ", -" ...+ +..+ ", -" . . ", -" . . . ", -" @@ . +..+ ", -" @ @ ", -" @ @ ", -" @ @ @@ ", -" @@ @ @ ", -"@# @ @ @ ", -"@## @ @@ @ @ ", -"@## @@@# @@ ", -" @ @ @## @ $$ ", -" @@ @## @ @%@&&@%@ ", -" @ @ %&&&***= ", -" @@ @&&-*;>@ ", -" $&&-@@,%%$", -" $&**@',%=$", -" @*;,,*=@ ", -" %*>%%=== ", -" @=@%=@=@ ", -" $$ "}; diff --git a/packages/auctex/images/gv.xpm b/packages/auctex/images/gv.xpm deleted file mode 100644 index 92dfb2389..000000000 --- a/packages/auctex/images/gv.xpm +++ /dev/null @@ -1,158 +0,0 @@ -/* XPM */ -static char * gv7_xpm[] = { -"24 24 131 2", -" c None s backgroundToolBarColor", -". c #9F9F9F", -"+ c #2F2F2F", -"@ c #373737", -"# c #323232", -"$ c #303030", -"% c #525252", -"& c #ECECEC", -"* c #FFFFFF", -"= c #F4F4F4", -"- c #BE5858", -"; c #FD6F6F", -"> c #FF7070", -", c #FF9898", -"' c #FFE1E1", -") c #FE7070", -"! c #C96363", -"~ c #FF6B6B", -"{ c #DD6666", -"] c #FDCFCF", -"^ c #FFD1D1", -"/ c #FF8888", -"( c #FFCACA", -"_ c #F37C7C", -": c #F56767", -"< c #DA6363", -"[ c #ECE6E6", -"} c #F2F2F2", -"| c #B6B6B6", -"1 c #D0CBCB", -"2 c #FD8686", -"3 c #FE7878", -"4 c #FE8787", -"5 c #DCD6D6", -"6 c #E1E1E1", -"7 c #F5EFEF", -"8 c #895B5B", -"9 c #848484", -"0 c #000000", -"a c #2B2B2B", -"b c #DAACAC", -"c c #F3C5C5", -"d c #414141", -"e c #4C4C4C", -"f c #B18383", -"g c #5B5B5B", -"h c #F86969", -"i c #A5A5A5", -"j c #3E3E3E", -"k c #E4B6B6", -"l c #F6C8C8", -"m c #5D5D5D", -"n c #6C6C6C", -"o c #F56666", -"p c #1C1C1C", -"q c #AFAFAF", -"r c #F6F6F6", -"s c #FA9494", -"t c #F67F7F", -"u c #FFF9F9", -"v c #FCFCFC", -"w c #EDEDED", -"x c #F3EDED", -"y c #FF7878", -"z c #F6F0F0", -"A c #F8F8F8", -"B c #EB7474", -"C c #DA7373", -"D c #E2E2E2", -"E c #A4A4A4", -"F c #F0F0F0", -"G c #D5D5D5", -"H c #393939", -"I c #161616", -"J c #8C8C8C", -"K c #F7F7F7", -"L c #BEBEBE", -"M c #191919", -"N c #989898", -"O c #BCBCBC", -"P c #2A2A2A", -"Q c #1B1B1B", -"R c #313131", -"S c #AAAAAA", -"T c #C7C7C7", -"U c #101010", -"V c #D3D3D3", -"W c #595959", -"X c #E4E4E4", -"Y c #969696", -"Z c #FBFBFB", -"` c #D1D1D1", -" . c #717171", -".. c #0A0A0A", -"+. c #B7B7B7", -"@. c #EEEEEE", -"#. c #F9F9F9", -"$. c #DBDBDB", -"%. c #EBEBEB", -"&. c #D2D2D2", -"*. c #6E6E6E", -"=. c #7D7D7D", -"-. c #EAEAEA", -";. c #A2A2A2", -">. c #CCCCCC", -",. c #E8E8E8", -"'. c #4E4E4E", -"). c #ABABAB", -"!. c #F5F5F5", -"~. c #6B6B6B", -"{. c #171717", -"]. c #434343", -"^. c #CECECE", -"/. c #4D4D4D", -"(. c #ADADAD", -"_. c #D0D0D0", -":. c #9E9E9E", -"<. c #808080", -"[. c #FAFAFA", -"}. c #858585", -"|. c #A0A0A0", -"1. c #BDBDBD", -"2. c #838383", -"3. c #181818", -"4. c #8F8F8F", -"5. c #959595", -"6. c #D6D6D6", -"7. c #DDDDDD", -"8. c #C1C1C1", -"9. c #7B7B7B", -"0. c #8E8E8E", -" ", -" . + @ @ @ # . ", -" $ % & * * * = % % ", -" - ; > , ' * ' , > ) ! ", -" ~ { ] ^ / > ( > / ^ ^ _ : ", -" ~ < [ } | 1 2 3 4 5 | 6 7 { ~ ", -" ~ 8 * 9 0 a b ~ c d 0 e * f ~ ", -" $ g h 8 * i 0 j k ~ l m 0 n * f o 0 g ", -" p q r s t u v w x 4 y / z w A u B C D D @ ", -" p E F ' > / ^ ^ / > ( > / ^ ^ / ) ' * G H ", -" I @ J K ' , > > , ' * ' , > > , ' * L E H ", -" M N * * * * * * * * * * * * * O P Q ", -" R S * * * * * * * * * * * T a ", -" U S * * * * * * * * * * * V W ", -" U S * * * * * * * * * * * X Y U ", -" U S * * * * * * * * * * * Z ` ... ", -" R +.* * Z @.#.* * * * * $.%.* &.*.Q ", -" 0 =.%.* * -.;.>.v v * * ,.'.).!.v >.~.{. ", -" ].q * * * ^./.(.A A * * _.p :.%.* %.:.p ", -" @ <.@.* [.r }.R |.1.1.L L 2.3.:.%.%.%.4.Q ", -" H 5.6.7.8.).0 0 j % % % % M 0 9.9.9. .% ", -" 3. .0.0.m @ % % % % ", -" @ @ @ @ ", -" "}; diff --git a/packages/auctex/images/jumpdvi.xpm b/packages/auctex/images/jumpdvi.xpm deleted file mode 100644 index 6cc568d24..000000000 --- a/packages/auctex/images/jumpdvi.xpm +++ /dev/null @@ -1,74 +0,0 @@ -/* XPM */ -static char * jumpdvi19_xpm[] = { -"24 24 47 1", -" c None s backgroundToolBarColor", -". c #212121", -"+ c #EAD4CB", -"@ c #E3C5BA", -"# c #DBB4A4", -"$ c #EEDED7", -"% c #FAF7F5", -"& c #F2E5E1", -"* c #D2AC99", -"= c #000000", -"- c #8D9E7C", -"; c #CDD9C2", -"> c #DEE6D7", -", c #DAE2D1", -"' c #9BAD89", -") c #B79382", -"! c #707D63", -"~ c #B4C6A2", -"{ c #ACC098", -"] c #636E57", -"^ c #AB8A7A", -"/ c #E4E9DD", -"( c #657158", -"_ c #C49F8D", -": c #C3D1B5", -"< c #808F70", -"[ c #4C5442", -"} c #58634E", -"| c #E6EBE0", -"1 c #D4DDC9", -"2 c #CAD7BE", -"3 c #90A17F", -"4 c #5F6A53", -"5 c #535C49", -"6 c #E9EDE4", -"7 c #616D56", -"8 c #A8BC95", -"9 c #7C8B6E", -"0 c #4C5443", -"a c #B6C2AA", -"b c #5E6953", -"c c #295E29", -"d c #5ABD5A", -"e c #488148", -"f c #4CA14C", -"g c #4D904D", -"h c #4FA64F", -" ", -" ", -" ", -" ... ", -" ..+@#.. ", -" .$%&@*. ", -" =======+#**. ", -" =-;>,'=###). ", -" =!~{]=##*^. ", -" ==/;{(]=#*_. ", -" ==/;:{<[}=)).. ", -" =|12{{34=5=.. ", -" =6{{{7= == ", -" =>890= ", -" =a]= ", -" =b= ", -" = cccd c c c ", -" c c c c c ", -" c c c c c ", -" c c e e c ", -" c c fggf c ", -" c c ee c ", -" cccd hh c ", -" "}; diff --git a/packages/auctex/images/ltx-symb-turn-off.xpm b/packages/auctex/images/ltx-symb-turn-off.xpm deleted file mode 100644 index bcb6d4fb6..000000000 --- a/packages/auctex/images/ltx-symb-turn-off.xpm +++ /dev/null @@ -1,47 +0,0 @@ -/* XPM */ -static char * ltx_symb_turn_off_xpm[] = { -"24 24 20 1", -" c None s backgroundToolBarColor", -". c #AEAEAE", -"+ c #000000", -"@ c #0A0A0A", -"# c #1F1F1F", -"$ c #C9C9C9", -"% c #353535", -"& c #999999", -"* c #4D4D4D", -"= c #777777", -"- c #141414", -"; c #878787", -"> c #686868", -", c #5A5A5A", -"' c #FF5858", -") c #FFB9B9", -"! c #FF0000", -"~ c #FF9595", -"{ c #414141", -"] c #292929", -" ", -" ", -" ", -".+@########++@$ ", -" %@& .*@= ", -" $--$ ;% ", -" .@% >$ ", -" ,+= ", -" %@. ", -" $--$ ' ' ", -" &+* )!' '!)", -" *@$ ~!~ ", -" $#; ~!~ ", -" %, )!' '!)", -" >% ' ' ", -" ;#$ &$ ", -" .-. ${ ", -" ]; .], ", -" *]>>>>>>>>]++. ", -"${{{{{{{{{{{{* ", -" ", -" ", -" ", -" "}; diff --git a/packages/auctex/images/ltx-symb-turn-on.xpm b/packages/auctex/images/ltx-symb-turn-on.xpm deleted file mode 100644 index d4d1ea3cd..000000000 --- a/packages/auctex/images/ltx-symb-turn-on.xpm +++ /dev/null @@ -1,46 +0,0 @@ -/* XPM */ -static char * ltx_symb_turn_on_xpm[] = { -"24 24 19 1", -" c None s backgroundToolBarColor", -". c #AEAEAE", -"+ c #000000", -"@ c #0A0A0A", -"# c #1F1F1F", -"$ c #C9C9C9", -"% c #353535", -"& c #999999", -"* c #4D4D4D", -"= c #777777", -"- c #141414", -"; c #878787", -"> c #686868", -", c #5A5A5A", -"' c #79DECA", -") c #00AA88", -"! c #5DC8B3", -"~ c #414141", -"{ c #292929", -" ", -" ", -" ", -".+@########++@$ ", -" %@& .*@= ", -" $--$ ;% ", -" .@% >$ ", -" ,+= '", -" %@. ) ", -" $--$ )) ", -" &+* ')! )) ", -" *@$ )))) ", -" $#; !)) ", -" %, ')' ", -" >% ", -" ;#$ &$ ", -" .-. $~ ", -" {; .{, ", -" *{>>>>>>>>{++. ", -"$~~~~~~~~~~~~* ", -" ", -" ", -" ", -" "}; diff --git a/packages/auctex/images/pdftex.xpm b/packages/auctex/images/pdftex.xpm deleted file mode 100644 index ca94a2425..000000000 --- a/packages/auctex/images/pdftex.xpm +++ /dev/null @@ -1,206 +0,0 @@ -/* XPM */ -static char * pdftex22_xpm[] = { -"24 24 179 2", -" c None s backgroundToolBarColor", -". c #3E9543", -"+ c #409644", -"@ c #3D9D45", -"# c #3F9B42", -"$ c #4C2A1F", -"% c #4E3124", -"& c #727E51", -"* c #598A4E", -"= c #5B6647", -"- c #88624F", -"; c #89383B", -"> c #8B343B", -", c #6D5852", -"' c #506D48", -") c #4C843E", -"! c #648752", -"~ c #B8A789", -"{ c #80624D", -"] c #7D6951", -"^ c #FFFFC1", -"/ c #94A676", -"( c #8F8668", -"_ c #977567", -": c #A86660", -"< c #986C6A", -"[ c #758660", -"} c #708C60", -"| c #6A6C4E", -"1 c #C3C599", -"2 c #988167", -"3 c #5A3125", -"4 c #561E1C", -"5 c #958066", -"6 c #BEA384", -"7 c #68372B", -"8 c #672124", -"9 c #5B392F", -"0 c #94917B", -"a c #AFAC91", -"b c #B8B39C", -"c c #BDBCA0", -"d c #B39073", -"e c #582522", -"f c #712E2B", -"g c #6F292C", -"h c #83826F", -"i c #908F88", -"j c #F8FFFD", -"k c #686C8D", -"l c #D7DBB8", -"m c #716D76", -"n c #7B7B92", -"o c #D5D5B3", -"p c #DBBD9A", -"q c #81463B", -"r c #691A19", -"s c #838270", -"t c #888791", -"u c #6462D0", -"v c #2C2B87", -"w c #DAD9C7", -"x c #868394", -"y c #716DDC", -"z c #2F2C94", -"A c #C7C6B7", -"B c #D2AF8D", -"C c #84473C", -"D c #6D1E1F", -"E c #6E262C", -"F c #BDBDAB", -"G c #878593", -"H c #909095", -"I c #C0BEAF", -"J c #A09EAD", -"K c #A6A5A9", -"L c #C19978", -"M c #7C3D33", -"N c #641C1F", -"O c #662633", -"P c #DBDCB8", -"Q c #B4B492", -"R c #E5D9AA", -"S c #9F755A", -"T c #50231F", -"U c #672424", -"V c #8E3B4B", -"W c #E4E3BC", -"X c #A5A28D", -"Y c #D2D1B5", -"Z c #E7E5C1", -"` c #E3DFC0", -" . c #E4CCA2", -".. c #894E3A", -"+. c #461715", -"@. c #632524", -"#. c #95404E", -"$. c #777776", -"%. c #C0B396", -"&. c #AAAB90", -"*. c #463F31", -"=. c #665E46", -"-. c #7C7968", -";. c #B3AF92", -">. c #D4BD97", -",. c #804B37", -"'. c #461F19", -"). c #42201F", -"!. c #5A4F43", -"~. c #504334", -"{. c #979183", -"]. c #DCD8B5", -"^. c #D0BC9D", -"/. c #C8A487", -"(. c #82493F", -"_. c #3F1310", -":. c #401613", -"<. c #664B46", -"[. c #DCD9BC", -"}. c #B8B59D", -"|. c #8C8977", -"1. c #E9E7C0", -"2. c #A2897B", -"3. c #AE8872", -"4. c #CFB89A", -"5. c #A6715F", -"6. c #4B1D19", -"7. c #68272E", -"8. c #6E2933", -"9. c #453E37", -"0. c #767361", -"a. c #7F8170", -"b. c #7B7B6C", -"c. c #8E897E", -"d. c #827F6E", -"e. c #83876F", -"f. c #847E70", -"g. c #9C7964", -"h. c #662F2A", -"i. c #5D2D2E", -"j. c #783C3F", -"k. c #87826E", -"l. c #B3B99A", -"m. c #D1D1AB", -"n. c #DFDDB9", -"o. c #C3B191", -"p. c #826453", -"q. c #6D2B2A", -"r. c #884144", -"s. c #772B2F", -"t. c #702F34", -"u. c #AEA28C", -"v. c #C1C3A2", -"w. c #AEA07E", -"x. c #C8C09F", -"y. c #C4C6A3", -"z. c #B6886B", -"A. c #774237", -"B. c #7E3E3D", -"C. c #854748", -"D. c #78373B", -"E. c #6A2932", -"F. c #5F343C", -"G. c #7C474A", -"H. c #815655", -"I. c #7F534F", -"J. c #8A5C54", -"K. c #74504B", -"L. c #8C615F", -"M. c #7E2C29", -"N. c #8C4240", -"O. c #7C322F", -"P. c #703634", -"Q. c #6D1B27", -"R. c #975F59", -"S. c #631D22", -"T. c #65101D", -"U. c #B50000", -"V. c #AA7979", -" . + @ # $ ", -" % & * = - ; > , ' ) ! ~ { ", -" ] ^ / ( _ : < [ } | 1 2 3 4 ", -" 5 ^ ^ ^ ^ ^ ^ ^ ^ ^ 6 7 8 ", -" 9 ^ 0 a ^ b 0 c ^ ^ d e f g ", -" h i j k l m j n o ^ p q r ", -" s t u v w x y z A ^ B C D E ", -" ] F G H ^ I J K ^ ^ L M N O ", -" ] ^ P Q ^ ^ ^ ^ ^ ^ R S T U V ", -" ] ^ W X Y Z ` ^ ^ ^ ^ ...+.@.#. ", -" $.$.%.%.&.*.=.-.;.%.%.%.^ >.,.'.). ", -" %.%.^ ^ !.~.{.].^ ^ ^ ^./.(._.:. ", -" $.$.<.[.^ }.|.1.^ 2.3.4.^ 5.6.7.8. ", -" 9.0.a.b.c.d.e.f.^ ^ g.h.i.j. ", -" k.^ l.^ ^ m.n.^ o.p.q.r.s.t. ", -" u.v.%.w.x.y.z.A.B.C.D.E.F. ", -" G.H.I.J.K.L.M.N.O.P. ", -" Q.R. S. T. ", -" ", -" U.U.U.V. U.U.U.V. U.U.U.V. ", -" U. U. U. U. U. ", -" U.U.U.V. U. U. U.U.V. ", -" U. U. U. U. ", -" U. U.U.U.V. U. "}; diff --git a/packages/auctex/images/prverr16.xpm b/packages/auctex/images/prverr16.xpm deleted file mode 100644 index 88d71d31c..000000000 --- a/packages/auctex/images/prverr16.xpm +++ /dev/null @@ -1,31 +0,0 @@ -/* XPM */ -static char *noway16[] = { -/* columns rows colors chars-per-pixel */ -"16 16 9 1", -" c red", -". c #FD0D0D", -"X c #FA1C1C", -"o c #F52D2D", -"O c #FB5B5B", -"+ c #FC6060", -"@ c #FFBBBB", -"# c #FEFEFE", -"$ c None", -/* pixels */ -"$$$$$ XXXX $$$$$", -"$$$X. .X$$$", -"$$o o$$", -"$X. .X$", -"$. .$", -" ", -"O@@@@@@@@@@@@@@O", -"+##############+", -"+##############+", -"O@@@@@@@@@@@@@@O", -" ", -"$. .$", -"$X. .X$", -"$$o o$$", -"$$$X. .X$$$", -"$$$$$ XXXX $$$$$" -}; diff --git a/packages/auctex/images/prverr20.xpm b/packages/auctex/images/prverr20.xpm deleted file mode 100644 index 18e5eaec3..000000000 --- a/packages/auctex/images/prverr20.xpm +++ /dev/null @@ -1,35 +0,0 @@ -/* XPM */ -static char *noway20[] = { -/* columns rows colors chars-per-pixel */ -"20 20 9 1", -" c red", -". c #FF0404", -"X c #FD0F0F", -"o c #F91919", -"O c #F82828", -"+ c #F33636", -"@ c #ED4A4A", -"# c #FEFEFE", -"$ c None", -/* pixels */ -"$$$$$$@+OXXO+@$$$$$$", -"$$$$OO. .OO$$$$", -"$$$@. .@$$$", -"$$@. .@$$", -"$O. .O$", -"$o o$", -"@. .@", -"+ +", -"o##################o", -"o##################o", -"o##################o", -"o##################o", -"+ +", -"@. .@", -"$o o$", -"$O. .O$", -"$$@. .@$$", -"$$$@. .@$$$", -"$$$$OO. .OO$$$$", -"$$$$$$@+OXXO+@$$$$$$" -}; diff --git a/packages/auctex/images/prverr24.xbm b/packages/auctex/images/prverr24.xbm deleted file mode 100644 index 1a369c51a..000000000 --- a/packages/auctex/images/prverr24.xbm +++ /dev/null @@ -1,9 +0,0 @@ -#define wutz_width 24 -#define wutz_height 24 -static unsigned char wutz_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xc0, 0xff, 0x03, 0xf0, 0xff, 0x0f, - 0xf8, 0xff, 0x1f, 0xf8, 0xff, 0x1f, 0xfc, 0xff, 0x3f, 0xfc, 0xff, 0x3f, - 0xfe, 0xff, 0x7f, 0x02, 0x00, 0x40, 0x01, 0x00, 0x80, 0x01, 0x00, 0x80, - 0x01, 0x00, 0x80, 0x01, 0x00, 0x80, 0x02, 0x00, 0x40, 0xfe, 0xff, 0x7f, - 0xfc, 0xff, 0x3f, 0xfc, 0xff, 0x3f, 0xf8, 0xff, 0x1f, 0xf8, 0xff, 0x1f, - 0xf0, 0xff, 0x0f, 0xc0, 0xff, 0x03, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00 }; diff --git a/packages/auctex/images/prverr24.xpm b/packages/auctex/images/prverr24.xpm deleted file mode 100644 index f855e95bd..000000000 --- a/packages/auctex/images/prverr24.xpm +++ /dev/null @@ -1,39 +0,0 @@ -/* XPM */ -static char *noway24[] = { -/* columns rows colors chars-per-pixel */ -"24 24 9 1", -" c red", -". c #FF0404", -"X c #FD0C0C", -"o c #F91919", -"O c #F62929", -"+ c #F34C4C", -"@ c #FF9090", -"# c #FEFEFE", -"$ c None", -/* pixels */ -"$$$$$$$$+OOXXOO+$$$$$$$$", -"$$$$$$OX XO$$$$$$", -"$$$$+X X+$$$$", -"$$$+ +$$$", -"$$+ +$$", -"$$X X$$", -"$O O$", -"$X X$", -"+ +", -"O+@@@@@@@@@@@@@@@@@@@@+O", -"o######################o", -"X######################X", -"X######################X", -"o######################o", -"O+@@@@@@@@@@@@@@@@@@@@+O", -"+ +", -"$X X$", -"$O O$", -"$$X X$$", -"$$+ +$$", -"$$$+ +$$$", -"$$$$+X X+$$$$", -"$$$$$$OX XO$$$$$$", -"$$$$$$$$+OOXXOO+$$$$$$$$" -}; diff --git a/packages/auctex/images/prvtex-cap-up.xpm b/packages/auctex/images/prvtex-cap-up.xpm deleted file mode 100644 index 726d81b5b..000000000 --- a/packages/auctex/images/prvtex-cap-up.xpm +++ /dev/null @@ -1,48 +0,0 @@ -/* XPM */ -static char * preview_cap_up_xpm[] = { -"33 33 12 1", -" c None", -". c #BFBFBF s backgroundToolBarColor", -"+ c #000000 s foregroundToolBarColor", -"! c #000000", -"@ c #FFFFFF", -"# c #7C7C7C", -"$ c #A0A0A0", -"% c #E5E5E5", -"& c #BABABA", -"* c #1D1D1D", -"= c #424242", -"- c #676767", -".................................", -".....!!!!!!!!!!!!!!!!!!!!!!......", -".....!@@@@@@@@@@@@@@@@@@@@!......", -".....!@@@@@@@@@#$@@@@@@@@@!......", -".....!@@@@@@@@%!&@@@@@@@@@!......", -".....!@@@@@@@@#$@@@@@@@@@@!......", -".....!@@@@@@@%*#%@%%@@@@&@!......", -".....!#!!!!=$*#-!$#!&@@#*@!......", -".....!@@&&@@#$@@%@@%=@%!$@!......", -".....!@@&&@@&-=$@@@@$$-=@@!......", -".....!@@&&@@$##&@@@@@=!&@@!......", -".....!@@&#%@#$@@&&@@@*-@@@!......", -".....!@@@*!@&!#-*@@@$!$@@@!......", -".....!@@@%%@@%#$@@@@!#-@@@!......", -".....!@%==@@@@@@@@@#*@-%@@!......", -"......!=#=@@@@@@@@%!&@%=#@!......", -"......%$$=@@@@@@@@$=@@@&=@!......", -".....#.&$#=&@@@@@@@@@@@@@@!......", -".....#...#-*$@@@@@@@@@@@@@!......", -"......#..###===*%%@@@@@@@@!......", -"......#...#...#.!!!!!!!!!!!......", -".......#..#...#..#.#..#..#.......", -".......#..#...#.##.#..#..#.......", -"........#..##..#.#..###...#......", -"........#.................#......", -"..+++............................", -"..+..+.+.+.+..+..+.+..+..+.+.+...", -"..+..+.++.+.+.+..+...+.+.+.+.+...", -"..+++..+..+++.+..+.+.+++.+.+.+...", -"..+....+..+...+.+..+.+....+.+....", -"..+....+...++..+...+..++..+.+....", -".................................", -"................................."}; diff --git a/packages/auctex/images/prvtex12.xbm b/packages/auctex/images/prvtex12.xbm deleted file mode 100644 index 2737176d4..000000000 --- a/packages/auctex/images/prvtex12.xbm +++ /dev/null @@ -1,6 +0,0 @@ -/* Created with The GIMP */ -#define preview12_width 12 -#define preview12_height 12 -static unsigned char preview12_bits[] = { - 0xff, 0x0f, 0x41, 0x08, 0x21, 0x08, 0x6f, 0x0d, 0x35, 0x0a, 0x75, 0x0a, - 0x6b, 0x0b, 0x82, 0x0c, 0x7c, 0x08, 0xf0, 0x08, 0x00, 0x0f, 0x00, 0x00 }; diff --git a/packages/auctex/images/prvtex12.xpm b/packages/auctex/images/prvtex12.xpm deleted file mode 100644 index 2a205a787..000000000 --- a/packages/auctex/images/prvtex12.xpm +++ /dev/null @@ -1,32 +0,0 @@ -/* XPM */ -static char * preview12_xpm[] = { -"12 12 17 1", -" c None", -". c #020202", -"+ c #1E1E1A", -"@ c #626256", -"# c #7D7D70", -"$ c #8A8A7A", -"% c #969686", -"& c #A6A692", -"* c #B2B29E", -"= c #46463E", -"- c #BEBEAA", -"; c #1A1A16", -"> c #CECEB2", -", c #363632", -"' c #6E6E62", -") c #0E0E0E", -"! c #52524A", -"............", -".>>>>$*>>>>.", -".>>>>&>>>>>.", -".'.,@+##&$%.", -".>)>'#>>&!>.", -".>=%#%%>@&>.", -"..,@>*>-@&>=", -" # #,>>#-%%.", -" . @,%>>>>.", -" . !;#>>>.", -" . . ,;.", -" . .. .."}; diff --git a/packages/auctex/images/prvtex16.xbm b/packages/auctex/images/prvtex16.xbm deleted file mode 100644 index 6fbe9c25a..000000000 --- a/packages/auctex/images/prvtex16.xbm +++ /dev/null @@ -1,7 +0,0 @@ -/* Created with The GIMP */ -#define preview16_width 16 -#define preview16_height 16 -static unsigned char preview16_bits[] = { - 0xff, 0xff, 0x01, 0x81, 0x81, 0x80, 0xbd, 0xad, 0x49, 0xa8, 0xc9, 0x91, - 0x49, 0x90, 0x9e, 0x99, 0x1c, 0xac, 0x7d, 0x84, 0xf1, 0x80, 0xf2, 0x87, - 0x22, 0xfa, 0x24, 0x52, 0x24, 0x5a, 0xc8, 0x94 }; diff --git a/packages/auctex/images/prvtex16.xpm b/packages/auctex/images/prvtex16.xpm deleted file mode 100644 index 84144847a..000000000 --- a/packages/auctex/images/prvtex16.xpm +++ /dev/null @@ -1,36 +0,0 @@ -/* XPM */ -static char * preview16_xpm[] = { -"16 16 17 1", -" c None", -". c #020202", -"+ c #1A1A16", -"@ c #636357", -"# c #6E6E62", -"$ c #828276", -"% c #8A8A7A", -"& c #969686", -"* c #A6A692", -"= c #B2B29E", -"- c #BABAA6", -"; c #363632", -"> c #BEBEAA", -", c #52524A", -"' c #CECEB2", -") c #46463E", -"! c #7A7A6E", -"................", -".''''''>@''''''.", -".''''''%>''''''.", -".'!..#*;,=#*'#=.", -".''.''!*>''&=@'.", -".''.''#@>''>)='.", -".'',,'#!@>'&@''.", -" .;@;''*>'')%''.", -" -$$;'''''%!>@=.", -". &$@;&'''*''>'.", -". @,+$'''''''.", -" . ...;;;+''''.", -" . . . .....", -" . . . . . ", -" . . . .. . ", -" . .. . . ."}; diff --git a/packages/auctex/images/prvtex20.xpm b/packages/auctex/images/prvtex20.xpm deleted file mode 100644 index cd6df1d14..000000000 --- a/packages/auctex/images/prvtex20.xpm +++ /dev/null @@ -1,40 +0,0 @@ -/* XPM */ -static char * preview20_xpm[] = { -"20 20 17 1", -" c None", -". c #000200", -"+ c #151614", -"@ c #20211F", -"# c #31312A", -"$ c #3D3C35", -"% c #474439", -"& c #504F48", -"* c #626054", -"= c #727063", -"- c #7E7E6F", -"; c #888A7A", -"> c #969987", -", c #A9A992", -"' c #B8B8A1", -") c #C6C5AA", -"! c #CFCDB1", -" .@@@@@@@@@@@@@@@@. ", -" %!!!!!!!''!!!!!!!% ", -" %!!!!!!)&>!!!!!!!% ", -" %!!!!!!>*'!!!!!!!% ", -" %!!!!!)&*')')!!''% ", -" @&@+#*&*=#;&*)'%-% ", -" %!,>!,=;,)!)=,-$'% ", -" %!,>!'=&-!!!'*#;!% ", -" %!,-),=>','!!$&)!% ", -" %!)$$'&&=%)!,+;!!% ", -" %!','!);;!!)%**!!% ", -" $;*$!!!!!!!;%'->)% ", -" *=$!!!!!!)*-!'*;% ", -" @>;*='!!!!),)!!''% ", -" . *&&,!!!!!!!!!!% ", -" ..+##@>,,,,,,,$ ", -" . . . ......... ", -" . . . ... . . ", -" . . . . ... . ", -" . . "}; diff --git a/packages/auctex/images/prvtex24.xbm b/packages/auctex/images/prvtex24.xbm deleted file mode 100644 index 91c07f3a8..000000000 --- a/packages/auctex/images/prvtex24.xbm +++ /dev/null @@ -1,10 +0,0 @@ -/* Created with The GIMP */ -#define preview_width 24 -#define preview_height 24 -static unsigned char preview_bits[] = { - 0xfe, 0xff, 0x7f, 0x02, 0x00, 0x40, 0x02, 0x18, 0x40, 0x02, 0x0c, 0x40, - 0x02, 0x04, 0x40, 0x02, 0x00, 0x50, 0xfe, 0xde, 0x59, 0x32, 0x03, 0x49, - 0x32, 0x0f, 0x4f, 0x32, 0x07, 0x46, 0x32, 0x23, 0x46, 0x62, 0x1e, 0x47, - 0x02, 0x0c, 0x47, 0x02, 0x80, 0x4d, 0x32, 0x80, 0x48, 0x2c, 0xc0, 0x58, - 0x42, 0x00, 0x40, 0xc2, 0x01, 0x40, 0xe4, 0x0e, 0x40, 0x44, 0xf4, 0x7f, - 0x48, 0xa4, 0x24, 0x48, 0xb4, 0x24, 0x90, 0x29, 0x47, 0x10, 0x00, 0x40 }; diff --git a/packages/auctex/images/prvtex24.xpm b/packages/auctex/images/prvtex24.xpm deleted file mode 100644 index 316ae31b6..000000000 --- a/packages/auctex/images/prvtex24.xpm +++ /dev/null @@ -1,37 +0,0 @@ -/* XPM */ -static char * preview_xpm[] = { -"24 24 10 1", -" c None", -". c #000000", -"+ c #CECEB2", -"@ c #656559", -"# c #818174", -"$ c #B9B9A4", -"% c #969686", -"& c #181815", -"* c #363630", -"= c #53534B", -" ...................... ", -" .++++++++++++++++++++. ", -" .+++++++++@#+++++++++. ", -" .++++++++$.%+++++++++. ", -" .++++++++@#++++++++++. ", -" .+++++++$&@$+$$++++%+. ", -" .@....*#&@=.#@.%++@&+. ", -" .++%%++@#++$++$*+$.#+. ", -" .++%%++%=*#++++##=*++. ", -" .++%%++#@@%+++++*.%++. ", -" .++%@$+@#++%%+++&=+++. ", -" .+++&.+%.@=&+++#.#+++. ", -" .+++$$++$@#++++.@=+++. ", -" .+$**+++++++++@&+=$++. ", -" .*@*++++++++$.%+$*@+. ", -" $##*++++++++#*+++%*+. ", -" . %#@*%++++++++++++++. ", -" . @=&#+++++++++++++. ", -" . ...***&$$++++++++. ", -" . . . ........... ", -" . . . . . . . ", -" . . . .. . . . ", -" . .. . . ... . ", -" . . "}; diff --git a/packages/auctex/images/prvwrk12.xpm b/packages/auctex/images/prvwrk12.xpm deleted file mode 100644 index 7b4bec9e9..000000000 --- a/packages/auctex/images/prvwrk12.xpm +++ /dev/null @@ -1,32 +0,0 @@ -/* XPM */ -static char * nwork12_xpm[] = { -"12 12 17 1", -" c None", -". c #0F110E", -"+ c #161815", -"@ c #1F211E", -"# c #383937", -"$ c #6A6C69", -"% c #818380", -"& c #E46767", -"* c #FF6467", -"= c #959794", -"- c #DC9897", -"; c #ADAFAC", -"> c #FF9797", -", c #C6C8C5", -"' c #FFCBCA", -") c #E4E6E3", -"! c #FBFDFA", -" >> ", -" '**' ", -" >>>> ", -" '*''*' ", -" >>!)>> ", -" '*,==,*' ", -" >>$@=!>> ", -" '*';#;!'*' ", -" >>!$$=!,-> ", -"'*'=)%!%.@&'", -">>!=!=;..+$>", -" ********** "}; diff --git a/packages/auctex/images/prvwrk14.xpm b/packages/auctex/images/prvwrk14.xpm deleted file mode 100644 index 6be87c63e..000000000 --- a/packages/auctex/images/prvwrk14.xpm +++ /dev/null @@ -1,34 +0,0 @@ -/* XPM */ -static char * nwork14_xpm[] = { -"14 14 17 1", -" c None", -". c #000100", -"+ c #161816", -"@ c #222421", -"# c #2A2C29", -"$ c #363836", -"% c #525451", -"& c #686A67", -"* c #828481", -"= c #FF6467", -"- c #949693", -"; c #A4A6A3", -"> c #FF9797", -", c #B8BAB7", -"' c #D8D6D4", -") c #FFCBCA", -"! c #FAFDF9", -" >> ", -" )==) ", -" >>>> ", -" )=))=) ", -" >>!!>> ", -" )=)!!)=) ", -" >>''@!>> ", -" )=&%#!!)=) ", -" >>-@$!!!>> ", -" )=);%&!!!)=) ", -" >>!&&;,!&,>> ", -")=)*',,'@.+'=)", -">>!-!';$+++%>>", -" ============ "}; diff --git a/packages/auctex/images/prvwrk16.xpm b/packages/auctex/images/prvwrk16.xpm deleted file mode 100644 index fd743527e..000000000 --- a/packages/auctex/images/prvwrk16.xpm +++ /dev/null @@ -1,36 +0,0 @@ -/* XPM */ -static char * nwork16_xpm[] = { -"16 16 17 1", -" c None", -". c #040703", -"+ c #0E100D", -"@ c #262825", -"# c #434542", -"$ c #4C4E4B", -"% c #5B5D5A", -"& c #70726F", -"* c #868885", -"= c #D86467", -"- c #FF6467", -"; c #A69F9F", -"> c #FF9797", -", c #B6B8B5", -"' c #C7C9C6", -") c #D5D7D4", -"! c #FAFCF9", -" >> ", -" -- ", -" >--> ", -" ->>- ", -" >-!!-> ", -" ->!!>- ", -" >-!!&*-> ", -" -;#@;)>- ", -" >-#&.;!!-> ", -" ->!+@,!!>- ", -" >-!&@%;!!!-> ", -" ->)#,%,,&.;- ", -" >-!%'!#!$..+=> ", -" ->!&!!&&..++#- ", -">->>>>>>>>>>>>->", -" >>>>>>>>>>>>>> "}; diff --git a/packages/auctex/images/prvwrk20.xpm b/packages/auctex/images/prvwrk20.xpm deleted file mode 100644 index d4b20457e..000000000 --- a/packages/auctex/images/prvwrk20.xpm +++ /dev/null @@ -1,40 +0,0 @@ -/* XPM */ -static char * nwork20_xpm[] = { -"20 20 17 1", -" c None", -". c #000100", -"+ c #262825", -"@ c #2B2D2A", -"# c #444643", -"$ c #575956", -"% c #726D6B", -"& c #D16668", -"* c #FF6467", -"= c #979794", -"- c #E4999A", -"; c #B1B3B0", -"> c #FF9797", -", c #C9CBC8", -"' c #D3D5D2", -") c #E5E7E3", -"! c #FDFFFB", -" ** ", -" >**> ", -" **** ", -" >****> ", -" **>>** ", -" >**!!**> ", -" **>!!>** ", -" >**!!)!**> ", -" **>!'.)>** ", -" >*%$$;,!!**> ", -" *&=;.=!!!>** ", -" >*&;@@=!!!!**> ", -" **>,$=;!!!!>** ", -" >**)#%;=!!!!!**> ", -" **>=,;=';!,#;>** ", -" >**)%!)%!!=+..,**> ", -" **>='!)%!;....@-** ", -">**!;!!!='#####$=**>", -"********************", -"********************"}; diff --git a/packages/auctex/images/prvwrk24.xbm b/packages/auctex/images/prvwrk24.xbm deleted file mode 100644 index 61aea62cb..000000000 --- a/packages/auctex/images/prvwrk24.xbm +++ /dev/null @@ -1,12 +0,0 @@ -/* ©2002 David Kastrup, GPL */ -#define prevwork_width 24 -#define prevwork_height 24 -#define prevwork_x_hot 0 -#define prevwork_y_hot 20 -static unsigned char prevwork_bits[] = { - 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, - 0x00, 0xe7, 0x00, 0x00, 0xe7, 0x00, 0x80, 0xc3, 0x01, 0x80, 0xc3, 0x01, - 0xc0, 0x81, 0x03, 0xc0, 0x81, 0x03, 0xe0, 0x30, 0x07, 0xe0, 0x3f, 0x07, - 0x70, 0x0d, 0x0e, 0x70, 0x0d, 0x0e, 0x38, 0x0e, 0x1c, 0x38, 0x0f, 0x1c, - 0x1c, 0x1f, 0x38, 0x9c, 0xa5, 0x3b, 0x8e, 0xc4, 0x77, 0xce, 0xe4, 0x7f, - 0x47, 0xec, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; diff --git a/packages/auctex/images/prvwrk24.xpm b/packages/auctex/images/prvwrk24.xpm deleted file mode 100644 index 7d50b1956..000000000 --- a/packages/auctex/images/prvwrk24.xpm +++ /dev/null @@ -1,44 +0,0 @@ -/* XPM */ -static char * nwork24_xpm[] = { -"24 24 17 1", -" c None", -". c #000100", -"+ c #141513", -"@ c #212320", -"# c #313230", -"$ c #3B3D3A", -"% c #484947", -"& c #626461", -"* c #8C8E8B", -"= c #FF6467", -"- c #B6AFAC", -"; c #FF9696", -"> c #C4C6C3", -", c #D0D2CE", -"' c #FFCBCA", -") c #DDDFDC", -"! c #FBFDFA", -" ;; ", -" ;==; ", -" ==== ", -" ;====; ", -" ==;;== ", -" ;==''==; ", -" ==;!!;== ", -" ;=='!!'==; ", -" ==;!!!!;== ", -" ;=='!!>,'==; ", -" ==;!!!.%!;== ", -" ;=;$#$*,)!'==; ", -" ==&,*..!!!!;== ", -" ;==#,@.$!!!!'==; ", -" ==;!&.&&!!!!!;== ", -" ;==')*&*&!!!!!'==; ", -" ==;!*#&>&!!!!!!;== ", -" ;==')$)&->-!!)&*'==; ", -" ==;!&-!,&!!-,%..*;== ", -" ;==',%!!)$!!>#....-==; ", -" ==;!&>!!)@!>+.....+;== ", -";=='!-!!!!*!&%%%%%&&*==;", -"========================", -" ====================== "}; diff --git a/packages/auctex/images/pspdf.xpm b/packages/auctex/images/pspdf.xpm deleted file mode 100644 index 78d2887f4..000000000 --- a/packages/auctex/images/pspdf.xpm +++ /dev/null @@ -1,83 +0,0 @@ -/* XPM */ -static char * pspdf5_xpm[] = { -"24 24 56 1", -" c None s backgroundToolBarColor", -". c #869CB4", -"+ c #00244C", -"@ c #000000", -"# c #002248", -"$ c #0050A9", -"% c #006FEB", -"& c #0066D9", -"* c #00336D", -"= c #37452B", -"- c #001070", -"; c #004BA2", -"> c #0078FF", -", c #0075FC", -"' c #004DB6", -") c #00072F", -"! c #0047FF", -"~ c #006DFF", -"{ c #0042CA", -"] c #00169E", -"^ c #000A45", -"/ c #445636", -"( c #0024FF", -"_ c #0027FF", -": c #0056ED", -"< c #001FA7", -"[ c #00179F", -"} c #526741", -"| c #001DCE", -"1 c #4C603C", -"2 c #566B43", -"3 c #5A7046", -"4 c #000B4C", -"5 c #0023F5", -"6 c #001492", -"7 c #000E65", -"8 c #00010B", -"9 c #001AB9", -"0 c #0022F0", -"a c #001387", -"b c #000942", -"c c #000C57", -"d c #D37F71", -"e c #0037C4", -"f c #6C84B7", -"g c #CE918A", -"h c #D4897A", -"i c #67102D", -"j c #C47474", -"k c #D69788", -"l c #CB8984", -"m c #D79C8D", -"n c #C8807D", -"o c #5A5A5A", -"p c #B50000", -"q c #AA7979", -" .+ @@@@ ", -" .#$%&* @@@=@@ ", -" -;%>>>,') @ @=@ ", -" -!~>>>{]^ @/@ ", -" -(_!:<[]^ @}@ ", -" -(((|]]]^ @@}}1@@ ", -" -(((|]]]^ @232@ ", -" 45((|]678 @}@ ", -" 490|ab @ ", -" -c ", -" @ ", -" @d@ ", -" eeef feef @ghi@ ", -" e e e @jgkii@ ", -" eeef feef @jlgmiii@ ", -" e e @jnlgmiiii@", -" e e e @jnlgkiii@ ", -" e feef o@jnhii@ ", -" o@di@ ", -"pppq pppq pppq @@ ", -"p p p p p ", -"pppq p p ppq ", -"p p p p ", -"p pppq p "}; diff --git a/packages/auctex/images/sep.xpm b/packages/auctex/images/sep.xpm deleted file mode 100644 index 151f5dfe6..000000000 --- a/packages/auctex/images/sep.xpm +++ /dev/null @@ -1,29 +0,0 @@ -/* XPM */ -static char * sep_xpm[] = { -"1 24 2 1", -" c None s backgroundToolBarColor", -". c #776758", -" ", -" ", -" ", -".", -".", -".", -".", -".", -".", -".", -".", -".", -".", -".", -".", -".", -".", -".", -".", -".", -".", -" ", -" ", -" "}; diff --git a/packages/auctex/images/tex.xpm b/packages/auctex/images/tex.xpm deleted file mode 100644 index 6c55bc5fe..000000000 --- a/packages/auctex/images/tex.xpm +++ /dev/null @@ -1,260 +0,0 @@ -/* XPM */ -static char * tex6_xpm[] = { -"24 24 233 2", -" c None s backgroundToolBarColor", -". c #3D9944", -"+ c #3E9842", -"@ c #3DA243", -"# c #3C9B47", -"$ c #3EA442", -"% c #290400", -"& c #304116", -"* c #3E8D43", -"= c #3F7744", -"- c #977C5E", -"; c #842835", -"> c #9C3635", -", c #94506A", -"' c #54764E", -") c #3DBA41", -"! c #386C34", -"~ c #CABC9A", -"{ c #C1AE8E", -"] c #795642", -"^ c #907F62", -"/ c #FFFFC1", -"( c #94AC73", -"_ c #664535", -": c #8A6A61", -"< c #6D302B", -"[ c #943A3B", -"} c #772437", -"| c #52382D", -"1 c #664940", -"2 c #99A578", -"3 c #6E4835", -"4 c #6D5642", -"5 c #9DBA88", -"6 c #A3B181", -"7 c #A3A982", -"8 c #B9968B", -"9 c #BF8A7F", -"0 c #CAA8A0", -"a c #6F9966", -"b c #CEE6B0", -"c c #3E8946", -"d c #808C6A", -"e c #947F66", -"f c #916B50", -"g c #370708", -"h c #5D181B", -"i c #664437", -"j c #F2DBB4", -"k c #621E1C", -"l c #782C33", -"m c #411712", -"n c #82806E", -"o c #868266", -"p c #C1BFA2", -"q c #C7C2A8", -"r c #82806A", -"s c #84826C", -"t c #E8E8C7", -"u c #D1B08B", -"v c #4A1A16", -"w c #5C2628", -"x c #7F3630", -"y c #6B262B", -"z c #82826F", -"A c #BBBABD", -"B c #F8FFFD", -"C c #404448", -"D c #48424A", -"E c #FFFEFF", -"F c #BBC0BB", -"G c #9C6D56", -"H c #5D201D", -"I c #712723", -"J c #868471", -"K c #A29EF2", -"L c #3132E4", -"M c #181766", -"N c #807E80", -"O c #2F29CF", -"P c #A46D56", -"Q c #6C0E12", -"R c #6B2731", -"S c #7F7F6F", -"T c #8E8BE8", -"U c #141369", -"V c #504D7F", -"W c #848081", -"X c #2725AA", -"Y c #A46F58", -"Z c #833A33", -"` c #040400", -" . c #BFBE98", -".. c #7F7F6C", -"+. c #8D523D", -"@. c #580F16", -"#. c #66283A", -"$. c #312B23", -"%. c #DCDFBB", -"&. c #E4D7A8", -"*. c #B48566", -"=. c #4E3025", -"-. c #3F0810", -";. c #9C4256", -">. c #31302E", -",. c #E2E0C7", -"'. c #ACA896", -"). c #CFD1B0", -"!. c #ECE6CB", -"~. c #F0D9AC", -"{. c #A26048", -"]. c #50271C", -"^. c #3D030C", -"/. c #392F26", -"(. c #E4E2CB", -"_. c #ACAA92", -":. c #48453B", -"<. c #878364", -"[. c #83806D", -"}. c #B2B496", -"|. c #CFBD94", -"1. c #8C5037", -"2. c #4C2318", -"3. c #351114", -"4. c #522B2B", -"5. c #B07F6B", -"6. c #62433A", -"7. c #A0876A", -"8. c #BFBB96", -"9. c #B8C2A0", -"0. c #1E140C", -"a. c #35210C", -"b. c #2B2106", -"c. c #A09A96", -"d. c #CCBF9A", -"e. c #AA8368", -"f. c #B4846A", -"g. c #AE826A", -"h. c #D2B89A", -"i. c #EAD0AA", -"j. c #9E6852", -"k. c #542D25", -"l. c #441C16", -"m. c #312019", -"n. c #5F2D31", -"o. c #604835", -"p. c #A29A8F", -"q. c #3D3123", -"r. c #A09698", -"s. c #BFBBA2", -"t. c #C7BB9C", -"u. c #B38A71", -"v. c #A05250", -"w. c #1A0400", -"x. c #520308", -"y. c #350010", -"z. c #584C44", -"A. c #444637", -"B. c #7F625E", -"C. c #834A3F", -"D. c #AA7F6D", -"E. c #D2BC9E", -"F. c #E6E4BD", -"G. c #A66456", -"H. c #2B0702", -"I. c #602A2B", -"J. c #5A2229", -"K. c #3C3831", -"L. c #6F6B58", -"M. c #797B6D", -"N. c #484A3E", -"O. c #ACA7A2", -"P. c #4C463E", -"Q. c #807E71", -"R. c #686F5A", -"S. c #605F56", -"T. c #E0D9BC", -"U. c #FDFACB", -"V. c #C5BD9C", -"W. c #8B5E4E", -"X. c #561F1A", -"Y. c #582E2F", -"Z. c #6F3A3A", -"`. c #814247", -" + c #94947D", -".+ c #858B75", -"++ c #9C9E81", -"@+ c #E0DBBB", -"#+ c #CFC19C", -"$+ c #483325", -"%+ c #661718", -"&+ c #995657", -"*+ c #732428", -"=+ c #7B2C2E", -"-+ c #655347", -";+ c #DACDA6", -">+ c #F6E5B8", -",+ c #73503A", -"'+ c #643433", -")+ c #894043", -"!+ c #9C5156", -"~+ c #681B23", -"{+ c #873E43", -"]+ c #5D2E34", -"^+ c #623C46", -"/+ c #775A50", -"(+ c #858271", -"_+ c #987B71", -":+ c #524024", -"<+ c #7D6C56", -"[+ c #8A806F", -"}+ c #7B826D", -"|+ c #853626", -"1+ c #894A3C", -"2+ c #75292C", -"3+ c #93594C", -"4+ c #623739", -"5+ c #8B5A56", -"6+ c #4E0E1C", -"7+ c #7E3F47", -"8+ c #804047", -"9+ c #6E3A3D", -"0+ c #9F6662", -"a+ c #A05A62", -"b+ c #4C2626", -"c+ c #A45862", -"d+ c #731C21", -"e+ c #964648", -"f+ c #722020", -"g+ c #620818", -"h+ c #A0675E", -"i+ c #561014", -"j+ c #5A0414", -" ", -" . + @ + # $ % ", -" % & * = - ; > , ' = ) ! ~ { ] ", -" ^ / ( _ : < [ } | ' 1 _ 2 ~ % 3 ", -" 4 / 5 6 7 8 9 0 a b c d / e f g h ", -" i / / / / / / / / / / / j 3 k l ", -" m / n o p / q r s t / / u v w x y ", -" z z A B C / D E F n / / j G H I ", -" J z K L M / N K O M / / j P h Q R ", -" S z T U V / W T X V / / u Y h Z ", -" ` t ...t / t . ./ / / u +.h @.#. ", -" $.%./ ../ / / / / / / / &.*.=.-.Z ;. ", -" >.,./ '.)./ / !./ / / / / ~.{.].^.Z ;. ", -" /.(./ _.:.<.[...}./ / / / / |.1.2.3.4. ", -"5.5.6.7.8.9.0.a.b.c.d.e.5.f.g.h.i.j.k.l.m.n. ", -" o./ / / p.q.r.s./ / / / / t.u.v.w.x. ", -"5.5.y.z./ / / A./ / / B.C.D.E.F.G.H.I.;.J. ", -" K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.`. ", -" +/ .+/ / / ++@+/ / #+$+%+&+*+=+ ", -" -+/ / / ;+/ / / >+,+'+)+!+~+{+]+^+ ", -" /+(+_+:+<+[+}+|+1+2+3+4+5+6+ ", -" 7+7+8+9+0+a+b+c+d+e+ f+ ", -" g+h+ i+ j+ ", -" "}; diff --git a/packages/auctex/images/view.xpm b/packages/auctex/images/view.xpm deleted file mode 100644 index 9a87ecf6b..000000000 --- a/packages/auctex/images/view.xpm +++ /dev/null @@ -1,31 +0,0 @@ -/* XPM */ -static char * view15_xpm[] = { -"24 24 4 1", -" c None s backgroundToolBarColor", -". c #000000", -"+ c #565656", -"@ c #FFFFFF", -" ", -" ", -" ", -" ", -" ... ", -" .+ . ", -" .+ . ", -" .+ .+ ", -" .+ .+ ... ", -" .+ .+ ..", -" .... .+ .", -" .@@ +. .+ .+", -" .@@@ +. .+ .+ ", -" .@@@ . .... .+ ", -" . @ ...@@ +.. ", -" +. +. .@@@ +. ", -" +.++. .@@@ . ", -" +.. . @ . ", -" +. +. ", -" +.++. ", -" +.. ", -" ", -" ", -" "}; diff --git a/packages/auctex/images/viewdvi.xpm b/packages/auctex/images/viewdvi.xpm deleted file mode 100644 index a527f55b8..000000000 --- a/packages/auctex/images/viewdvi.xpm +++ /dev/null @@ -1,58 +0,0 @@ -/* XPM */ -static char * viewdvi11_xpm[] = { -"24 24 31 1", -" c None s backgroundToolBarColor", -". c #090909", -"+ c #000000", -"@ c #292929", -"# c #8E8E8E", -"$ c #2D2D2D", -"% c #303030", -"& c #2B2B2B", -"* c #3C3C3C", -"= c #1F1F1F", -"- c #101010", -"; c #1A1A1A", -"> c #2E2E2E", -", c #FFFFFF", -"' c #C3C3C3", -") c #252525", -"! c #191919", -"~ c #131313", -"{ c #1D1D1D", -"] c #0D0D0D", -"^ c #121212", -"/ c #444444", -"( c #3B3B3B", -"_ c #3D3D3D", -": c #080808", -"< c #295E29", -"[ c #5ABD5A", -"} c #488148", -"| c #4CA14C", -"1 c #4D904D", -"2 c #4FA64F", -" .+ ", -" @# + ", -" $# @ ", -" %# &# ", -" @# ++ ", -" *=- ;# + ", -" >,,') !# ~ ", -" >,, + !# {# ", -" ],, ++ *=- =# ", -" #^ /+ >,,')# ", -" ($_: >,, + ", -" ## ],, + ", -" #^ /+ ", -" ($_: ", -" ## ", -" ", -" <<<[ < < <", -" < < < < <", -" < < < < <", -" < < } } <", -" < < |11| <", -" < < }} <", -" <<<[ 22 <", -" "}; diff --git a/packages/auctex/images/viewpdf.xpm b/packages/auctex/images/viewpdf.xpm deleted file mode 100644 index 4a317371b..000000000 --- a/packages/auctex/images/viewpdf.xpm +++ /dev/null @@ -1,54 +0,0 @@ -/* XPM */ -static char * viewpdf5_xpm[] = { -"24 24 27 1", -" c None s backgroundToolBarColor", -". c #090909", -"+ c #000000", -"@ c #292929", -"# c #8E8E8E", -"$ c #2D2D2D", -"% c #303030", -"& c #2B2B2B", -"* c #3C3C3C", -"= c #1F1F1F", -"- c #101010", -"; c #1A1A1A", -"> c #2E2E2E", -", c #FFFFFF", -"' c #C3C3C3", -") c #252525", -"! c #191919", -"~ c #131313", -"{ c #1D1D1D", -"] c #0D0D0D", -"^ c #121212", -"/ c #444444", -"( c #3B3B3B", -"_ c #3D3D3D", -": c #080808", -"< c #B50000", -"[ c #AA7979", -" .+ ", -" @# + ", -" $# @ ", -" %# &# ", -" @# ++ ", -" *=- ;# + ", -" >,,') !# ~ ", -" >,, + !# {# ", -" ],, ++ *=- =# ", -" #^ /+ >,,')# ", -" ($_: >,, + ", -" ## ],, + ", -" #^ /+ ", -" ($_: ", -" ## ", -" ", -" <<<[ <<<[ <<<[", -" < < < < < ", -" < < < < < ", -" <<<[ < < <<[ ", -" < < < < ", -" < < < < ", -" < <<<[ < ", -" "}; diff --git a/packages/auctex/images/viewps.xpm b/packages/auctex/images/viewps.xpm deleted file mode 100644 index c8b467ae6..000000000 --- a/packages/auctex/images/viewps.xpm +++ /dev/null @@ -1,54 +0,0 @@ -/* XPM */ -static char * viewps8_xpm[] = { -"24 24 27 1", -" c None s backgroundToolBarColor", -". c #090909", -"+ c #000000", -"@ c #292929", -"# c #8E8E8E", -"$ c #2D2D2D", -"% c #303030", -"& c #2B2B2B", -"* c #3C3C3C", -"= c #1F1F1F", -"- c #101010", -"; c #1A1A1A", -"> c #2E2E2E", -", c #FFFFFF", -"' c #C3C3C3", -") c #252525", -"! c #191919", -"~ c #131313", -"{ c #1D1D1D", -"] c #0D0D0D", -"^ c #121212", -"/ c #444444", -"( c #3B3B3B", -"_ c #3D3D3D", -": c #080808", -"< c #0037C4", -"[ c #6C84B7", -" .+ ", -" @# + ", -" $# @ ", -" %# &# ", -" @# ++ ", -" *=- ;# + ", -" >,,') !# ~ ", -" >,, + !# {# ", -" ],, ++ *=- =# ", -" #^ /+ >,,')# ", -" ($_: >,, + ", -" ## ],, + ", -" #^ /+ ", -" ($_: ", -" ## ", -" ", -" <<<[ [<<[ ", -" < < < < ", -" < < < ", -" <<<[ [<<[ ", -" < < ", -" < < < ", -" < [<<[ ", -" "}; diff --git a/packages/auctex/latex.el b/packages/auctex/latex.el deleted file mode 100644 index f9859a614..000000000 --- a/packages/auctex/latex.el +++ /dev/null @@ -1,5468 +0,0 @@ -;;; latex.el --- Support for LaTeX documents. - -;; Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2003, -;; 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. - -;; Maintainer: auctex-devel@gnu.org -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file provides AUCTeX support for LaTeX. - -;;; Code: - -(require 'tex) -(require 'tex-style) - -;;; Syntax - -(defvar LaTeX-optop "[" - "The LaTeX optional argument opening character.") - -(defvar LaTeX-optcl "]" - "The LaTeX optional argument closeing character.") - -;;; Style - -(defcustom LaTeX-default-style "article" - "*Default when creating new documents." - :group 'LaTeX-environment - :type 'string) - -(defcustom LaTeX-default-options nil - "Default options to documentstyle. -A list of strings." - :group 'LaTeX-environment - :type '(repeat (string :format "%v"))) - -(make-variable-buffer-local 'LaTeX-default-options) - -(defcustom LaTeX-insert-into-comments t - "*Whether insertion commands stay in comments. -This allows using the insertion commands even when -the lines are outcommented, like in dtx files." - :group 'LaTeX-environment - :type 'boolean) - -(defun LaTeX-newline () - "Start a new line potentially staying within comments. -This depends on `LaTeX-insert-into-comments'." - (if LaTeX-insert-into-comments - (cond ((and (save-excursion (skip-chars-backward " \t") (bolp)) - (save-excursion - (skip-chars-forward " \t") - (looking-at (concat TeX-comment-start-regexp "+")))) - (beginning-of-line) - (insert (buffer-substring-no-properties - (line-beginning-position) (match-end 0))) - (newline)) - ((and (not (bolp)) - (save-excursion - (skip-chars-forward " \t") (not (TeX-escaped-p))) - (looking-at - (concat "[ \t]*" TeX-comment-start-regexp "+[ \t]*"))) - (delete-region (match-beginning 0) (match-end 0)) - (indent-new-comment-line)) - (t - (indent-new-comment-line))) - (newline))) - - -;;; Syntax Table - -(defvar LaTeX-mode-syntax-table (copy-syntax-table TeX-mode-syntax-table) - "Syntax table used in LaTeX mode.") - -(progn ; set [] to match for LaTeX. - (modify-syntax-entry (string-to-char LaTeX-optop) - (concat "(" LaTeX-optcl) - LaTeX-mode-syntax-table) - (modify-syntax-entry (string-to-char LaTeX-optcl) - (concat ")" LaTeX-optop) - LaTeX-mode-syntax-table)) - -;;; Sections - -(defun LaTeX-section (arg) - "Insert a template for a LaTeX section. -Determine the type of section to be inserted, by the argument ARG. - -If ARG is nil or missing, use the current level. -If ARG is a list (selected by \\[universal-argument]), go downward one level. -If ARG is negative, go up that many levels. -If ARG is positive or zero, use absolute level: - - 0 : part - 1 : chapter - 2 : section - 3 : subsection - 4 : subsubsection - 5 : paragraph - 6 : subparagraph - -The following variables can be set to customize: - -`LaTeX-section-hook' Hooks to run when inserting a section. -`LaTeX-section-label' Prefix to all section labels." - - (interactive "*P") - (let* ((val (prefix-numeric-value arg)) - (level (cond ((null arg) - (LaTeX-current-section)) - ((listp arg) - (LaTeX-down-section)) - ((< val 0) - (LaTeX-up-section (- val))) - (t val))) - (name (LaTeX-section-name level)) - (toc nil) - (title (if (TeX-active-mark) - (buffer-substring (region-beginning) - (region-end)) - "")) - (done-mark (make-marker))) - (run-hooks 'LaTeX-section-hook) - (LaTeX-newline) - (if (marker-position done-mark) - (goto-char (marker-position done-mark))) - (set-marker done-mark nil))) - -(defun LaTeX-current-section () - "Return the level of the section that contain point. -See also `LaTeX-section' for description of levels." - (save-excursion - (max (LaTeX-largest-level) - (if (re-search-backward (LaTeX-outline-regexp) nil t) - (- (LaTeX-outline-level) (LaTeX-outline-offset)) - (LaTeX-largest-level))))) - -(defun LaTeX-down-section () - "Return the value of a section one level under the current. -Tries to find what kind of section that have been used earlier in the -text, if this fail, it will just return one less than the current -section." - (save-excursion - (let ((current (LaTeX-current-section)) - (next nil) - (regexp (LaTeX-outline-regexp))) - (if (not (re-search-backward regexp nil t)) - (1+ current) - (while (not next) - (cond - ((eq (LaTeX-current-section) current) - (if (re-search-forward regexp nil t) - (if (<= (setq next (LaTeX-current-section)) current) ;Wow! - (setq next (1+ current))) - (setq next (1+ current)))) - ((not (re-search-backward regexp nil t)) - (setq next (1+ current))))) - next)))) - -(defun LaTeX-up-section (arg) - "Return the value of the section ARG levels above this one." - (save-excursion - (if (zerop arg) - (LaTeX-current-section) - (let ((current (LaTeX-current-section))) - (while (and (>= (LaTeX-current-section) current) - (re-search-backward (LaTeX-outline-regexp) - nil t))) - (LaTeX-up-section (1- arg)))))) - -(defvar LaTeX-section-list '(("part" 0) - ("chapter" 1) - ("section" 2) - ("subsection" 3) - ("subsubsection" 4) - ("paragraph" 5) - ("subparagraph" 6)) - "List which elements is the names of the sections used by LaTeX.") - -(defun LaTeX-section-list-add-locally (sections &optional clean) - "Add SECTIONS to `LaTeX-section-list'. -SECTIONS can be a single list containing the section macro name -as a string and the the level as an integer or a list of such -lists. - -If optional argument CLEAN is non-nil, remove any existing -entries from `LaTeX-section-list' before adding the new ones. - -The function will make `LaTeX-section-list' buffer-local and -invalidate the section submenu in order to let the menu filter -regenerate it. It is mainly a convenience function which can be -used in style files." - (when (stringp (car sections)) - (setq sections (list sections))) - (make-local-variable 'LaTeX-section-list) - (when clean (setq LaTeX-section-list nil)) - (dolist (elt sections) (add-to-list 'LaTeX-section-list elt t)) - (setq LaTeX-section-list - (sort (copy-sequence LaTeX-section-list) - (lambda (a b) (< (nth 1 a) (nth 1 b))))) - (setq LaTeX-section-menu nil)) - -(defun LaTeX-section-name (level) - "Return the name of the section corresponding to LEVEL." - (let ((entry (TeX-member level LaTeX-section-list - (lambda (a b) (equal a (nth 1 b)))))) - (if entry - (nth 0 entry) - nil))) - -(defun LaTeX-section-level (name) - "Return the level of the section NAME." - (let ((entry (TeX-member name LaTeX-section-list - (lambda (a b) (equal a (nth 0 b)))))) - - (if entry - (nth 1 entry) - nil))) - -(defcustom TeX-outline-extra nil - "List of extra TeX outline levels. - -Each element is a list with two entries. The first entry is the -regular expression matching a header, and the second is the level of -the header. See `LaTeX-section-list' for existing header levels." - :group 'LaTeX - :type '(repeat (group (regexp :tag "Match") - (integer :tag "Level")))) - -(defun LaTeX-outline-regexp (&optional anywhere) - "Return regexp for LaTeX sections. - -If optional argument ANYWHERE is not nil, do not require that the -header is at the start of a line." - (concat (if anywhere "" "^") - "[ \t]*" - (regexp-quote TeX-esc) - "\\(appendix\\|documentstyle\\|documentclass\\|" - (mapconcat 'car LaTeX-section-list "\\|") - "\\)\\b" - (if TeX-outline-extra - "\\|" - "") - (mapconcat 'car TeX-outline-extra "\\|") - "\\|" TeX-header-end - "\\|" TeX-trailer-start)) - -(defvar LaTeX-largest-level nil - "Largest sectioning level with current document class.") - -(make-variable-buffer-local 'LaTeX-largest-level) - -(defun LaTeX-largest-level () - "Return largest sectioning level with current document class. -Run style hooks before it has not been done." - (TeX-update-style) - LaTeX-largest-level) - -(defun LaTeX-largest-level-set (section) - "Set `LaTeX-largest-level' to the level of SECTION. -SECTION has to be a string contained in `LaTeX-section-list'. -Additionally the function will invalidate the section submenu in -order to let the menu filter regenerate it." - (setq LaTeX-largest-level (LaTeX-section-level section)) - (setq LaTeX-section-menu nil)) - -(defun LaTeX-outline-offset () - "Offset to add to `LaTeX-section-list' levels to get outline level." - (- 2 (LaTeX-largest-level))) - -(defun TeX-look-at (list) - "Check if we are looking at the first element of a member of LIST. -If so, return the second element, otherwise return nil." - (while (and list - (not (looking-at (nth 0 (car list))))) - (setq list (cdr list))) - (if list - (nth 1 (car list)) - nil)) - -(defun LaTeX-outline-level () - "Find the level of current outline heading in an LaTeX document." - (cond ((looking-at LaTeX-header-end) 1) - ((looking-at LaTeX-trailer-start) 1) - ((TeX-look-at TeX-outline-extra) - (max 1 (+ (TeX-look-at TeX-outline-extra) - (LaTeX-outline-offset)))) - (t - (save-excursion - (skip-chars-forward " \t") - (forward-char 1) - (cond ((looking-at "appendix") 1) - ((looking-at "documentstyle") 1) - ((looking-at "documentclass") 1) - ((TeX-look-at LaTeX-section-list) - (max 1 (+ (TeX-look-at LaTeX-section-list) - (LaTeX-outline-offset)))) - (t - (error "Unrecognized header"))))))) - -(defun LaTeX-outline-name () - "Guess a name for the current header line." - (save-excursion - (if (re-search-forward "{\\([^\}]*\\)}" (+ (point) fill-column 10) t) - (match-string 1) - (buffer-substring (point) (min (point-max) (+ 20 (point))))))) - -(add-hook 'TeX-remove-style-hook - (lambda () (setq LaTeX-largest-level nil))) - -(defcustom LaTeX-section-hook - '(LaTeX-section-heading - LaTeX-section-title -;; LaTeX-section-toc ; Most people won't want this - LaTeX-section-section - LaTeX-section-label) - "List of hooks to run when a new section is inserted. - -The following variables are set before the hooks are run - -level - numeric section level, see the documentation of `LaTeX-section'. -name - name of the sectioning command, derived from `level'. -title - The title of the section, default to an empty string. -toc - Entry for the table of contents list, default nil. -done-mark - Position of point afterwards, default nil (meaning end). - -The following standard hook exist - - -LaTeX-section-heading: Query the user about the name of the -sectioning command. Modifies `level' and `name'. - -LaTeX-section-title: Query the user about the title of the -section. Modifies `title'. - -LaTeX-section-toc: Query the user for the toc entry. Modifies -`toc'. - -LaTeX-section-section: Insert LaTeX section command according to -`name', `title', and `toc'. If `toc' is nil, no toc entry is -inserted. If `toc' or `title' are empty strings, `done-mark' will be -placed at the point they should be inserted. - -LaTeX-section-label: Insert a label after the section command. -Controled by the variable `LaTeX-section-label'. - -To get a full featured `LaTeX-section' command, insert - - (setq LaTeX-section-hook - '(LaTeX-section-heading - LaTeX-section-title - LaTeX-section-toc - LaTeX-section-section - LaTeX-section-label)) - -in your .emacs file." - :group 'LaTeX-macro - :type 'hook - :options '(LaTeX-section-heading - LaTeX-section-title - LaTeX-section-toc - LaTeX-section-section - LaTeX-section-label)) - - -(defcustom LaTeX-section-label - '(("part" . "part:") - ("chapter" . "chap:") - ("section" . "sec:") - ("subsection" . "sec:") - ("subsubsection" . "sec:")) - "Default prefix when asking for a label. - -Some LaTeX packages \(such as `fancyref'\) look at the prefix to generate some -text around cross-references automatically. When using those packages, you -should not change this variable. - -If it is a string, it it used unchanged for all kinds of sections. -If it is nil, no label is inserted. -If it is a list, the list is searched for a member whose car is equal -to the name of the sectioning command being inserted. The cdr is then -used as the prefix. If the name is not found, or if the cdr is nil, -no label is inserted." - :group 'LaTeX-label - :type '(choice (const :tag "none" nil) - (string :format "%v" :tag "Common") - (repeat :menu-tag "Level specific" - :format "\n%v%i" - (cons :format "%v" - (string :tag "Type") - (choice :tag "Prefix" - (const :tag "none" nil) - (string :format "%v")))))) - -;;; Section Hooks. - -(defun LaTeX-section-heading () - "Hook to prompt for LaTeX section name. -Insert this hook into `LaTeX-section-hook' to allow the user to change -the name of the sectioning command inserted with `\\[LaTeX-section]'." - (let ((string (completing-read - (concat "Level: (default " name ") ") - LaTeX-section-list - nil nil nil))) - ; Update name - (if (not (zerop (length string))) - (setq name string)) - ; Update level - (setq level (LaTeX-section-level name)))) - -(defun LaTeX-section-title () - "Hook to prompt for LaTeX section title. -Insert this hook into `LaTeX-section-hook' to allow the user to change -the title of the section inserted with `\\[LaTeX-section]." - (setq title (read-string "Title: " title)) - (let ((region (and (TeX-active-mark) - (cons (region-beginning) (region-end))))) - (when region (delete-region (car region) (cdr region))))) - -(defun LaTeX-section-toc () - "Hook to prompt for the LaTeX section entry in the table of content . -Insert this hook into `LaTeX-section-hook' to allow the user to insert -a different entry for the section in the table of content." - (setq toc (read-string "Toc Entry: ")) - (if (zerop (length toc)) - (setq toc nil))) - -(defun LaTeX-section-section () - "Hook to insert LaTeX section command into the file. -Insert this hook into `LaTeX-section-hook' after those hooks that set -the `name', `title', and `toc' variables, but before those hooks that -assume that the section is already inserted." - ;; insert a new line if the current line and the previous line are - ;; not empty (except for whitespace), with one exception: do not - ;; insert a new line if the previous (or current, sigh) line starts - ;; an environment (i.e., starts with `[optional whitespace]\begin') - (unless (save-excursion - (re-search-backward - (concat "^\\s-*\n\\s-*\\=\\|^\\s-*" (regexp-quote TeX-esc) - "begin") - (line-beginning-position 0) t)) - (LaTeX-newline)) - (insert TeX-esc name) - (cond ((null toc)) - ((zerop (length toc)) - (insert LaTeX-optop) - (set-marker done-mark (point)) - (insert LaTeX-optcl)) - (t - (insert LaTeX-optop toc LaTeX-optcl))) - (insert TeX-grop) - (if (zerop (length title)) - (set-marker done-mark (point))) - (insert title TeX-grcl) - (LaTeX-newline) - ;; If RefTeX is available, tell it that we've just made a new section - (and (fboundp 'reftex-notice-new-section) - (reftex-notice-new-section))) - -(defun LaTeX-section-label () - "Hook to insert a label after the sectioning command. -Insert this hook into `LaTeX-section-hook' to prompt for a label to be -inserted after the sectioning command. - -The behaviour of this hook is controlled by variable `LaTeX-section-label'." - (and (LaTeX-label name) - (LaTeX-newline))) - -;;; Environments - -(defgroup LaTeX-environment nil - "Environments in AUCTeX." - :group 'LaTeX-macro) - -(defcustom LaTeX-default-environment "itemize" - "*The default environment when creating new ones with `LaTeX-environment'." - :group 'LaTeX-environment - :type 'string) - (make-variable-buffer-local 'LaTeX-default-environment) - -(defvar LaTeX-environment-history nil) - -;; Variable used to cache the current environment, e.g. for repeated -;; tasks in an environment, like indenting each line in a paragraph to -;; be filled. It must not have a non-nil value in general. That -;; means it is usually let-bound for such operations. -(defvar LaTeX-current-environment nil) - -(defun LaTeX-environment (arg) - "Make LaTeX environment (\\begin{...}-\\end{...} pair). -With optional ARG, modify current environment. - -It may be customized with the following variables: - -`LaTeX-default-environment' Your favorite environment. -`LaTeX-default-style' Your favorite document class. -`LaTeX-default-options' Your favorite document class options. -`LaTeX-float' Where you want figures and tables to float. -`LaTeX-table-label' Your prefix to labels in tables. -`LaTeX-figure-label' Your prefix to labels in figures. -`LaTeX-default-format' Format for array and tabular. -`LaTeX-default-width' Width for minipage and tabular*. -`LaTeX-default-position' Position for array and tabular." - - (interactive "*P") - (let ((environment (completing-read (concat "Environment type: (default " - (if (TeX-near-bobp) - "document" - LaTeX-default-environment) - ") ") - (LaTeX-environment-list) - nil nil nil - 'LaTeX-environment-history))) - ;; Get default - (cond ((and (zerop (length environment)) - (TeX-near-bobp)) - (setq environment "document")) - ((zerop (length environment)) - (setq environment LaTeX-default-environment)) - (t - (setq LaTeX-default-environment environment))) - - (let ((entry (assoc environment (LaTeX-environment-list)))) - (if (null entry) - (LaTeX-add-environments (list environment))) - - (if arg - (LaTeX-modify-environment environment) - (LaTeX-environment-menu environment))))) - -(defun LaTeX-environment-menu (environment) - "Insert ENVIRONMENT around point or region." - (let ((entry (assoc environment (LaTeX-environment-list)))) - (cond ((not (and entry (nth 1 entry))) - (LaTeX-insert-environment environment)) - ((numberp (nth 1 entry)) - (let ((count (nth 1 entry)) - (args "")) - (while (> count 0) - (setq args (concat args TeX-grop TeX-grcl)) - (setq count (- count 1))) - (LaTeX-insert-environment environment args))) - ((or (stringp (nth 1 entry)) (vectorp (nth 1 entry))) - (let ((prompts (cdr entry)) - (args "")) - (dolist (elt prompts) - (let* ((optional (vectorp elt)) - (elt (if optional (elt elt 0) elt)) - (arg (read-string (concat (when optional "(Optional) ") - elt ": ")))) - (setq args (concat args - (cond ((and optional (> (length arg) 0)) - (concat LaTeX-optop arg LaTeX-optcl)) - ((not optional) - (concat TeX-grop arg TeX-grcl))))))) - (LaTeX-insert-environment environment args))) - (t - (apply (nth 1 entry) environment (nthcdr 2 entry)))))) - -(defun LaTeX-close-environment (&optional reopen) - "Create an \\end{...} to match the current environment. -With prefix-argument, reopen environment afterwards." - (interactive "*P") - (if (> (point) - (save-excursion - (beginning-of-line) - (when LaTeX-insert-into-comments - (if (looking-at comment-start-skip) - (goto-char (match-end 0)))) - (skip-chars-forward " \t") - (point))) - (LaTeX-newline)) - (let ((environment (LaTeX-current-environment 1)) marker) - (insert "\\end{" environment "}") - (indent-according-to-mode) - (if (or (not (looking-at "[ \t]*$")) - (and (TeX-in-commented-line) - (save-excursion (beginning-of-line 2) - (not (TeX-in-commented-line))))) - (LaTeX-newline) - (let ((next-line-add-newlines t)) - (next-line 1) - (beginning-of-line))) - (indent-according-to-mode) - (when reopen - (save-excursion - (setq marker (point-marker)) - (set-marker-insertion-type marker t) - (LaTeX-environment-menu environment) - (delete-region (point) - (if (save-excursion (goto-char marker) - (bolp)) - (1- marker) - marker)) - (move-marker marker nil))))) - -(defvar LaTeX-after-insert-env-hooks nil - "List of functions to be run at the end of `LaTeX-insert-environment'. -Each function is called with three arguments: the name of the -environment just inserted, the buffer position just before -\\begin and the position just before \\end.") - -(defun LaTeX-insert-environment (environment &optional extra) - "Insert LaTeX ENVIRONMENT with optional argument EXTRA." - (let ((active-mark (and (TeX-active-mark) (not (eq (mark) (point))))) - prefix content-start env-start env-end) - (when (and active-mark (< (mark) (point))) (exchange-point-and-mark)) - ;; Compute the prefix. - (when (and LaTeX-insert-into-comments (TeX-in-commented-line)) - (save-excursion - (beginning-of-line) - (looking-at - (concat "^\\([ \t]*" TeX-comment-start-regexp "+\\)+[ \t]*")) - (setq prefix (match-string 0)))) - ;; What to do with the line containing point. - (cond ((save-excursion (beginning-of-line) - (looking-at (concat prefix "[ \t]*$"))) - (delete-region (match-beginning 0) (match-end 0))) - ((TeX-looking-at-backward (concat "^" prefix "[ \t]*") - (line-beginning-position)) - (beginning-of-line) - (newline) - (beginning-of-line 0)) - ((bolp) - (delete-horizontal-space) - (newline) - (beginning-of-line 0)) - (t - (delete-horizontal-space) - (newline 2) - (when prefix (insert prefix)) - (beginning-of-line 0))) - ;; What to do with the line containing mark. - (when active-mark - (save-excursion - (goto-char (mark)) - (cond ((save-excursion (beginning-of-line) - (or (looking-at (concat prefix "[ \t]*$")) - (looking-at "[ \t]*$"))) - (delete-region (match-beginning 0) (match-end 0))) - ((TeX-looking-at-backward (concat "^" prefix "[ \t]*") - (line-beginning-position)) - (beginning-of-line) - (newline) - (beginning-of-line 0)) - (t - (delete-horizontal-space) - (insert-before-markers "\n") - (newline) - (when prefix (insert prefix)))))) - ;; Now insert the environment. - (when prefix (insert prefix)) - (setq env-start (point)) - (insert TeX-esc "begin" TeX-grop environment TeX-grcl) - (indent-according-to-mode) - (when extra (insert extra)) - (setq content-start (line-beginning-position 2)) - (unless active-mark - (newline) - (when prefix (insert prefix)) - (newline)) - (when active-mark (goto-char (mark))) - (when prefix (insert prefix)) - (setq env-end (point)) - (insert TeX-esc "end" TeX-grop environment TeX-grcl) - (end-of-line 0) - (if active-mark - (progn - (or (assoc environment LaTeX-indent-environment-list) - (LaTeX-fill-region content-start (line-beginning-position 2))) - (set-mark content-start)) - (indent-according-to-mode)) - (save-excursion (beginning-of-line 2) (indent-according-to-mode)) - (TeX-math-input-method-off) - (run-hook-with-args 'LaTeX-after-insert-env-hooks - environment env-start env-end))) - -(defun LaTeX-modify-environment (environment) - "Modify current ENVIRONMENT." - (save-excursion - (LaTeX-find-matching-end) - (re-search-backward (concat (regexp-quote TeX-esc) - "end" - (regexp-quote TeX-grop) - " *\\([a-zA-Z*]*\\)" - (regexp-quote TeX-grcl)) - (save-excursion (beginning-of-line 1) (point))) - (replace-match (concat TeX-esc "end" TeX-grop environment TeX-grcl) t t) - (beginning-of-line 1) - (LaTeX-find-matching-begin) - (re-search-forward (concat (regexp-quote TeX-esc) - "begin" - (regexp-quote TeX-grop) - " *\\([a-zA-Z*]*\\)" - (regexp-quote TeX-grcl)) - (save-excursion (end-of-line 1) (point))) - (replace-match (concat TeX-esc "begin" TeX-grop environment TeX-grcl) t t))) - -(defun LaTeX-current-environment (&optional arg) - "Return the name (a string) of the enclosing LaTeX environment. -With optional ARG>=1, find that outer level. - -If function is called inside a comment and -`LaTeX-syntactic-comments' is enabled, try to find the -environment in commented regions with the same comment prefix. - -The functions `LaTeX-find-matching-begin' and `LaTeX-find-matching-end' -work analogously." - (setq arg (if arg (if (< arg 1) 1 arg) 1)) - (let* ((in-comment (TeX-in-commented-line)) - (comment-prefix (and in-comment (TeX-comment-prefix)))) - (save-excursion - (while (and (/= arg 0) - (re-search-backward - "\\\\\\(begin\\|end\\) *{ *\\([A-Za-z*]+\\) *}" nil t)) - (when (or (and LaTeX-syntactic-comments - (eq in-comment (TeX-in-commented-line)) - (or (not in-comment) - ;; Consider only matching prefixes in the - ;; commented case. - (string= comment-prefix (TeX-comment-prefix)))) - (and (not LaTeX-syntactic-comments) - (not (TeX-in-commented-line)))) - (setq arg (if (string= (match-string 1) "end") (1+ arg) (1- arg))))) - (if (/= arg 0) - "document" - (match-string-no-properties 2))))) - -(defun docTeX-in-macrocode-p () - "Determine if point is inside a macrocode environment." - (save-excursion - (re-search-backward - (concat "^% " (regexp-quote TeX-esc) - "\\(begin\\|end\\)[ \t]*{macrocode\\*?}") nil 'move) - (not (or (bobp) - (= (char-after (match-beginning 1)) ?e))))) - - -;;; Environment Hooks - -(defvar LaTeX-document-style-hook nil - "List of hooks to run when inserting a document environment. - -To insert a hook here, you must insert it in the appropiate style file.") - -(defun LaTeX-env-document (&optional ignore) - "Create new LaTeX document. -The compatibility argument IGNORE is ignored." - (TeX-insert-macro "documentclass") - (LaTeX-newline) - (LaTeX-newline) - (LaTeX-newline) - (end-of-line 0) - (LaTeX-insert-environment "document") - (run-hooks 'LaTeX-document-style-hook) - (setq LaTeX-document-style-hook nil)) - -(defcustom LaTeX-float "" - "Default float position for figures and tables. -If nil, act like the empty string is given, but do not prompt. -\(The standard LaTeX classes use [tbp] as float position if the -optional argument is omitted.)" - :group 'LaTeX-environment - :type '(choice (const :tag "Do not prompt" nil) - (const :tag "Empty" "") - (string :format "%v"))) -(make-variable-buffer-local 'LaTeX-float) - -(defcustom LaTeX-top-caption-list nil - "*List of float environments with top caption." - :group 'LaTeX-environment - :type '(repeat (string :format "%v"))) - -(defgroup LaTeX-label nil - "Adding labels for LaTeX commands in AUCTeX." - :group 'LaTeX) - -(defcustom LaTeX-label-function nil - "*A function inserting a label at point. -Sole argument of the function is the environment. The function has to return -the label inserted, or nil if no label was inserted." - :group 'LaTeX-label - :type 'function) - -(defcustom LaTeX-figure-label "fig:" - "*Default prefix to figure labels." - :group 'LaTeX-label - :group 'LaTeX-environment - :type 'string) - -(defcustom LaTeX-table-label "tab:" - "*Default prefix to table labels." - :group 'LaTeX-label - :group 'LaTeX-environment - :type 'string) - -(defcustom LaTeX-default-format "" - "Default format for array and tabular environments." - :group 'LaTeX-environment - :type 'string) -(make-variable-buffer-local 'LaTeX-default-format) - -(defcustom LaTeX-default-width "1.0\\linewidth" - "Default width for minipage and tabular* environments." - :group 'LaTeX-environment - :type 'string) -(make-variable-buffer-local 'LaTeX-default-width) - -(defcustom LaTeX-default-position "" - "Default position for array and tabular environments. -If nil, act like the empty string is given, but do not prompt." - :group 'LaTeX-environment - :type '(choice (const :tag "Do not prompt" nil) - (const :tag "Empty" "") - string)) -(make-variable-buffer-local 'LaTeX-default-position) - -(defcustom LaTeX-equation-label "eq:" - "*Default prefix to equation labels." - :group 'LaTeX-label - :type 'string) - -(defcustom LaTeX-eqnarray-label LaTeX-equation-label - "*Default prefix to eqnarray labels." - :group 'LaTeX-label - :type 'string) - -(defun LaTeX-env-item (environment) - "Insert ENVIRONMENT and the first item." - (LaTeX-insert-environment environment) - (if (TeX-active-mark) - (progn - (LaTeX-find-matching-begin) - (end-of-line 1)) - (end-of-line 0)) - (delete-char 1) - (when (looking-at (concat "^[ \t]+$\\|" - "^[ \t]*" TeX-comment-start-regexp "+[ \t]*$")) - (delete-region (point) (line-end-position))) - (delete-horizontal-space) - ;; Deactivate the mark here in order to prevent `TeX-parse-macro' - ;; from swapping point and mark and the \item ending up right after - ;; \begin{...}. - (TeX-deactivate-mark) - (LaTeX-insert-item) - ;; The inserted \item may have outdented the first line to the - ;; right. Fill it, if appropriate. - (when (and (not (looking-at "$")) - (not (assoc environment LaTeX-indent-environment-list)) - (> (- (line-end-position) (line-beginning-position)) - (current-fill-column))) - (LaTeX-fill-paragraph nil))) - -(defcustom LaTeX-label-alist - '(("figure" . LaTeX-figure-label) - ("table" . LaTeX-table-label) - ("figure*" . LaTeX-figure-label) - ("table*" . LaTeX-table-label) - ("equation" . LaTeX-equation-label) - ("eqnarray" . LaTeX-eqnarray-label)) - "Lookup prefixes for labels. -An alist where the CAR is the environment name, and the CDR -either the prefix or a symbol referring to one." - :group 'LaTeX-label - :type '(repeat (cons (string :tag "Environment") - (choice (string :tag "Label prefix") - (symbol :tag "Label prefix symbol"))))) - -(make-variable-buffer-local 'LaTeX-label-alist) - -(defun LaTeX-label (environment) - "Insert a label for ENVIRONMENT at point. -If `LaTeX-label-function' is a valid function, LaTeX label will transfer the -job to this function." - (let (label) - (if (and (boundp 'LaTeX-label-function) - LaTeX-label-function - (fboundp LaTeX-label-function)) - - (setq label (funcall LaTeX-label-function environment)) - (let ((prefix - (or (cdr (assoc environment LaTeX-label-alist)) - (if (assoc environment LaTeX-section-list) - (if (stringp LaTeX-section-label) - LaTeX-section-label - (and (listp LaTeX-section-label) - (cdr (assoc environment LaTeX-section-label)))) - "")))) - (when prefix - (when (symbolp prefix) - (setq prefix (symbol-value prefix))) - ;; Use completing-read as we do with `C-c C-m \label RET' - (setq label (completing-read - (TeX-argument-prompt t nil "What label") - (LaTeX-label-list) nil nil prefix)) - ;; No label or empty string entered? - (if (or (string= prefix label) - (string= "" label)) - (setq label nil) - (insert TeX-esc "label" TeX-grop label TeX-grcl)))) - (if label - (progn - (LaTeX-add-labels label) - label) - nil)))) - -(defun LaTeX-env-figure (environment) - "Create ENVIRONMENT with \\caption and \\label commands." - (let ((float (and LaTeX-float ; LaTeX-float can be nil, i.e. - ; do not prompt - (read-string "(Optional) Float position: " LaTeX-float))) - (caption (read-string "Caption: ")) - (center (y-or-n-p "Center? ")) - (active-mark (and (TeX-active-mark) - (not (eq (mark) (point))))) - start-marker end-marker) - (when active-mark - (if (< (mark) (point)) - (exchange-point-and-mark)) - (setq start-marker (point-marker)) - (set-marker-insertion-type start-marker t) - (setq end-marker (copy-marker (mark)))) - (setq LaTeX-float float) - (LaTeX-insert-environment environment - (unless (zerop (length float)) - (concat LaTeX-optop float - LaTeX-optcl))) - (when active-mark (goto-char start-marker)) - (when center - (insert TeX-esc "centering") - (indent-according-to-mode) - (LaTeX-newline)) - (if (member environment LaTeX-top-caption-list) - ;; top caption -- do nothing if user skips caption - (unless (zerop (length caption)) - (insert TeX-esc "caption" TeX-grop caption TeX-grcl) - (LaTeX-newline) - (indent-according-to-mode) - ;; ask for a label and insert a new line only if a label is - ;; actually inserted - (when (LaTeX-label environment) - (LaTeX-newline) - (indent-according-to-mode))) - ;; bottom caption (default) -- do nothing if user skips caption - (unless (zerop (length caption)) - (when active-mark (goto-char end-marker)) - (LaTeX-newline) - (indent-according-to-mode) - (insert TeX-esc "caption" TeX-grop caption TeX-grcl) - (LaTeX-newline) - (indent-according-to-mode) - ;; ask for a label -- if user skips label, remove the last new - ;; line again - (if (LaTeX-label environment) - (progn - (unless (looking-at "[ \t]*$") - (LaTeX-newline) - (end-of-line 0))) - (delete-blank-lines) - (end-of-line 0)) - ;; if there is a caption or a label, move point upwards again - ;; so that it is placed above the caption or the label (or - ;; both) -- search the current line (even long captions are - ;; inserted on a single line, even if auto-fill is turned on, - ;; so it is enough to search the current line) for \label or - ;; \caption and go one line upwards if any of them is found - (while (re-search-backward - (concat "^\\s-*" (regexp-quote TeX-esc) - "\\(label\\|caption\\)") - (line-beginning-position) t) - (end-of-line 0) - (indent-according-to-mode)))) - (when (and (member environment '("table" "table*")) - ;; Suppose an existing tabular environment should just - ;; be wrapped into a table if there is an active region. - (not active-mark)) - (LaTeX-env-array "tabular")))) - -(defun LaTeX-env-array (environment) - "Insert ENVIRONMENT with position and column specifications. -Just like array and tabular." - (let ((pos (and LaTeX-default-position ; LaTeX-default-position can - ; be nil, i.e. do not prompt - (read-string "(Optional) Position: " LaTeX-default-position))) - (fmt (read-string "Format: " LaTeX-default-format))) - (setq LaTeX-default-position pos) - (setq LaTeX-default-format fmt) - (LaTeX-insert-environment environment - (concat - (unless (zerop (length pos)) - (concat LaTeX-optop pos LaTeX-optcl)) - (concat TeX-grop fmt TeX-grcl))))) - -(defun LaTeX-env-label (environment) - "Insert ENVIRONMENT and prompt for label." - (LaTeX-insert-environment environment) - (when (LaTeX-label environment) - (LaTeX-newline) - (indent-according-to-mode))) - -(defun LaTeX-env-list (environment) - "Insert ENVIRONMENT and the first item." - (let ((label (read-string "Default Label: "))) - (LaTeX-insert-environment environment - (format "{%s}{}" label)) - (end-of-line 0) - (delete-char 1) - (delete-horizontal-space)) - (LaTeX-insert-item)) - -(defun LaTeX-env-minipage (environment) - "Create new LaTeX minipage or minipage-like ENVIRONMENT." - (let ((pos (and LaTeX-default-position ; LaTeX-default-position can - ; be nil, i.e. do not prompt - (read-string "(Optional) Position: " LaTeX-default-position))) - (width (read-string "Width: " LaTeX-default-width))) - (setq LaTeX-default-position pos) - (setq LaTeX-default-width width) - (LaTeX-insert-environment environment - (concat - (unless (zerop (length pos)) - (concat LaTeX-optop pos LaTeX-optcl)) - (concat TeX-grop width TeX-grcl))))) - -(defun LaTeX-env-tabular* (environment) - "Insert ENVIRONMENT with width, position and column specifications." - (let ((width (read-string "Width: " LaTeX-default-width)) - (pos (and LaTeX-default-position ; LaTeX-default-position can - ; be nil, i.e. do not prompt - (read-string "(Optional) Position: " LaTeX-default-position))) - (fmt (read-string "Format: " LaTeX-default-format))) - (setq LaTeX-default-width width) - (setq LaTeX-default-position pos) - (setq LaTeX-default-format fmt) - (LaTeX-insert-environment environment - (concat - (concat TeX-grop width TeX-grcl) ;; not optional! - (unless (zerop (length pos)) - (concat LaTeX-optop pos LaTeX-optcl)) - (concat TeX-grop fmt TeX-grcl))))) - -(defun LaTeX-env-picture (environment) - "Insert ENVIRONMENT with width, height specifications." - (let ((width (read-string "Width: ")) - (height (read-string "Height: ")) - (x-offset (read-string "X Offset: ")) - (y-offset (read-string "Y Offset: "))) - (if (zerop (length x-offset)) - (setq x-offset "0")) - (if (zerop (length y-offset)) - (setq y-offset "0")) - (LaTeX-insert-environment environment - (concat - (format "(%s,%s)" width height) - (if (not (and (string= x-offset "0") - (string= y-offset "0"))) - (format "(%s,%s)" x-offset y-offset)))))) - -(defun LaTeX-env-bib (environment) - "Insert ENVIRONMENT with label for bibitem." - (LaTeX-insert-environment environment - (concat TeX-grop - (read-string "Label for BibItem: " "99") - TeX-grcl)) - (end-of-line 0) - (delete-char 1) - (delete-horizontal-space) - (LaTeX-insert-item)) - -(defun LaTeX-env-contents (environment) - "Insert ENVIRONMENT with filename for contents." - (save-excursion - (when (re-search-backward "^\\\\documentclass.*{" nil t) - (error "Put %s environment before \\documentclass" environment))) - (LaTeX-insert-environment environment - (concat TeX-grop - (read-string "File: ") - TeX-grcl)) - (delete-horizontal-space)) - -(defun LaTeX-env-args (environment &rest args) - "Insert ENVIRONMENT and arguments defined by ARGS." - (LaTeX-insert-environment environment) - (let ((pos (point-marker))) - (end-of-line 0) - (TeX-parse-arguments args) - (goto-char pos))) - -;;; Item hooks - -(defvar LaTeX-item-list nil - "A list of environments where items have a special syntax. -The cdr is the name of the function, used to insert this kind of items.") - -(defun LaTeX-insert-item () - "Insert a new item in an environment. -You may use `LaTeX-item-list' to change the routines used to insert the item." - (interactive "*") - (let ((environment (LaTeX-current-environment))) - (when (and (TeX-active-mark) - (> (point) (mark))) - (exchange-point-and-mark)) - (unless (bolp) (LaTeX-newline)) - (if (assoc environment LaTeX-item-list) - (funcall (cdr (assoc environment LaTeX-item-list))) - (TeX-insert-macro "item")) - (indent-according-to-mode))) - -(defun LaTeX-item-argument () - "Insert a new item with an optional argument." - (let ((TeX-arg-item-label-p t)) - (TeX-insert-macro "item"))) - -(defun LaTeX-item-bib () - "Insert a new bibitem." - (TeX-insert-macro "bibitem")) - -;;; Parser - -(defvar LaTeX-auto-minimal-regexp-list - '(("\\\\document\\(style\\|class\\)\ -\\(\\[\\(\\([^#\\%]\\|%[^\n\r]*[\n\r]\\)*\\)\\]\\)?\ -{\\([^#\\.\n\r]+?\\)}" - (3 5 1) LaTeX-auto-style) - ("\\\\use\\(package\\)\\(\\[\\([^\]\\]*\\)\\]\\)?\ -{\\(\\([^#}\\.%]\\|%[^\n\r]*[\n\r]\\)+?\\)}" - (3 4 1) LaTeX-auto-style)) - "Minimal list of regular expressions matching LaTeX macro definitions.") - -(defvar LaTeX-auto-label-regexp-list - '(("\\\\label{\\([^\n\r%\\{}]+\\)}" 1 LaTeX-auto-label)) - "List of regular expression matching LaTeX labels only.") - -(defvar LaTeX-auto-index-regexp-list - '(("\\\\\\(index\\|glossary\\){\\([^}{]*\\({[^}{]*\\({[^}{]*\\({[^}{]*}[^}{]*\\)*}[^}{]*\\)*}[^}{]*\\)*\\)}" - 2 LaTeX-auto-index-entry)) - "List of regular expression matching LaTeX index/glossary entries only. -Regexp allows for up to 3 levels of parenthesis inside the index argument. -This is necessary since index entries may contain commands and stuff.") - -(defvar LaTeX-auto-class-regexp-list - '(;; \RequirePackage[]{}[] - ("\\\\Require\\(Package\\)\\(\\[\\([^#\\.%]*?\\)\\]\\)?\ -{\\([^#\\.\n\r]+?\\)}" - (3 4 1) LaTeX-auto-style) - ;; \RequirePackageWithOptions{}[], - ("\\\\Require\\(Package\\)WithOptions\\(\\){\\([^#\\.\n\r]+?\\)}" - (2 3 1) LaTeX-auto-style) - ;; \LoadClass[]{}[] - ("\\\\Load\\(Class\\)\\(\\[\\([^#\\.%]*?\\)\\]\\)?{\\([^#\\.\n\r]+?\\)}" - (3 4 1) LaTeX-auto-style) - ;; \LoadClassWithOptions{}[] - ("\\\\Load\\(Class\\)WithOptions\\(\\){\\([^#\\.\n\r]+?\\)}" - (2 3 1) LaTeX-auto-style) - ;; \DeclareRobustCommand{}[][]{}, - ;; \DeclareRobustCommand*{}[][]{} - ("\\\\DeclareRobustCommand\\*?{?\\\\\\([A-Za-z]+\\)}?\ -\\[\\([0-9]+\\)\\]\\[\\([^\n\r]*?\\)\\]" - (1 2 3) LaTeX-auto-optional) - ("\\\\DeclareRobustCommand\\*?{?\\\\\\([A-Za-z]+\\)}?\\[\\([0-9]+\\)\\]" - (1 2) LaTeX-auto-arguments) - ("\\\\DeclareRobustCommand\\*?{?\\\\\\([A-Za-z]+\\)}?" - 1 TeX-auto-symbol) - ;; Patterns for commands described in "LaTeX2e font selection" (fntguide) - ("\\\\DeclareMath\\(?:Symbol\\|Delimiter\\|Accent\\|Radical\\)\ -{?\\\\\\([A-Za-z]+\\)}?" - 1 TeX-auto-symbol) - ("\\\\\\(Declare\\|Provide\\)Text\ -\\(?:Command\\|Symbol\\|Accent\\|Composite\\){?\\\\\\([A-Za-z]+\\)}?" - 1 TeX-auto-symbol) - ("\\\\Declare\\(?:Text\\|Old\\)FontCommand{?\\\\\\([A-Za-z]+\\)}?" - 1 TeX-auto-symbol)) - "List of regular expressions matching macros in LaTeX classes and packages.") - -(defvar LaTeX-auto-regexp-list - (append - (let ((token TeX-token-char)) - `((,(concat "\\\\\\(?:new\\|provide\\)command\\*?{?\\\\\\(" token "+\\)}?\\[\\([0-9]+\\)\\]\\[\\([^\n\r]*\\)\\]") - (1 2 3) LaTeX-auto-optional) - (,(concat "\\\\\\(?:new\\|provide\\)command\\*?{?\\\\\\(" token "+\\)}?\\[\\([0-9]+\\)\\]") - (1 2) LaTeX-auto-arguments) - (,(concat "\\\\\\(?:new\\|provide\\)command\\*?{?\\\\\\(" token "+\\)}?") 1 TeX-auto-symbol) - (,(concat "\\\\newenvironment\\*?{?\\(" token "+\\)}?\\[\\([0-9]+\\)\\]\\[") - 1 LaTeX-auto-environment) - (,(concat "\\\\newenvironment\\*?{?\\(" token "+\\)}?\\[\\([0-9]+\\)\\]") - (1 2) LaTeX-auto-env-args) - (,(concat "\\\\newenvironment\\*?{?\\(" token "+\\)}?") 1 LaTeX-auto-environment) - (,(concat "\\\\newtheorem{\\(" token "+\\)}") 1 LaTeX-auto-environment) - ("\\\\input{\\(\\.*[^#}%\\\\\\.\n\r]+\\)\\(\\.[^#}%\\\\\\.\n\r]+\\)?}" - 1 TeX-auto-file) - ("\\\\include{\\(\\.*[^#}%\\\\\\.\n\r]+\\)\\(\\.[^#}%\\\\\\.\n\r]+\\)?}" - 1 TeX-auto-file) - (, (concat "\\\\bibitem{\\(" token "[^, \n\r\t%\"#'()={}]*\\)}") 1 LaTeX-auto-bibitem) - (, (concat "\\\\bibitem\\[[^][\n\r]+\\]{\\(" token "[^, \n\r\t%\"#'()={}]*\\)}") - 1 LaTeX-auto-bibitem) - ("\\\\bibliography{\\([^#}\\\\\n\r]+\\)}" 1 LaTeX-auto-bibliography))) - LaTeX-auto-class-regexp-list - LaTeX-auto-label-regexp-list - LaTeX-auto-index-regexp-list - LaTeX-auto-minimal-regexp-list) - "List of regular expression matching common LaTeX macro definitions.") - -(defun LaTeX-auto-prepare () - "Prepare for LaTeX parsing." - (setq LaTeX-auto-arguments nil - LaTeX-auto-optional nil - LaTeX-auto-env-args nil - LaTeX-auto-style nil - LaTeX-auto-end-symbol nil)) - -(add-hook 'TeX-auto-prepare-hook 'LaTeX-auto-prepare) - -(defun LaTeX-listify-package-options (options) - "Return a list from a comma-separated string of package OPTIONS. -The input string may include LaTeX comments and newlines." - ;; FIXME: Parse key=value options like "pdftitle={A Perfect - ;; Day},colorlinks=false" correctly. When this works, the check for - ;; "=" can be removed again. - (let (opts) - (dolist (elt (TeX-split-string "\\(,\\|%[^\n\r]*[\n\r]\\)+" - options)) - (unless (string-match "=" elt) - ;; Strip whitespace. - (dolist (item (TeX-split-string "[ \t\r\n]+" elt)) - (unless (string= item "") - (add-to-list 'opts item))))) - opts)) - -(defun LaTeX-auto-cleanup () - "Cleanup after LaTeX parsing." - - ;; Cleanup BibTeX files - (setq LaTeX-auto-bibliography - (apply 'append (mapcar (lambda (arg) - (TeX-split-string "," arg)) - LaTeX-auto-bibliography))) - - ;; Cleanup document classes and packages - (unless (null LaTeX-auto-style) - (while LaTeX-auto-style - (let* ((entry (car LaTeX-auto-style)) - (options (nth 0 entry)) - (style (nth 1 entry)) - (class (nth 2 entry))) - - ;; Next document style. - (setq LaTeX-auto-style (cdr LaTeX-auto-style)) - - ;; Get the options. - (setq options (LaTeX-listify-package-options options)) - - ;; Add them, to the style list. - (dolist (elt options) - (add-to-list 'TeX-auto-file elt)) - - ;; Treat documentclass/documentstyle specially. - (if (or (string-equal "package" class) - (string-equal "Package" class)) - (dolist (elt (TeX-split-string - "\\([ \t\r\n]\\|%[^\n\r]*[\n\r]\\|,\\)+" style)) - (add-to-list 'TeX-auto-file elt)) - ;; And a special "art10" style file combining style and size. - (add-to-list 'TeX-auto-file style) - (add-to-list 'TeX-auto-file - (concat - (cond ((string-equal "article" style) - "art") - ((string-equal "book" style) - "bk") - ((string-equal "report" style) - "rep") - ((string-equal "jarticle" style) - "jart") - ((string-equal "jbook" style) - "jbk") - ((string-equal "jreport" style) - "jrep") - ((string-equal "j-article" style) - "j-art") - ((string-equal "j-book" style) - "j-bk") - ((string-equal "j-report" style ) - "j-rep") - (t style)) - (cond ((member "11pt" options) - "11") - ((member "12pt" options) - "12") - (t - "10"))))) - - ;; The third argument if "class" indicates LaTeX2e features. - (cond ((equal class "class") - (add-to-list 'TeX-auto-file "latex2e")) - ((equal class "style") - (add-to-list 'TeX-auto-file "latex2")))))) - - ;; Cleanup optional arguments - (mapc (lambda (entry) - (add-to-list 'TeX-auto-symbol - (list (nth 0 entry) - (string-to-number (nth 1 entry))))) - LaTeX-auto-arguments) - - ;; Cleanup default optional arguments - (mapc (lambda (entry) - (add-to-list 'TeX-auto-symbol - (list (nth 0 entry) - (vector "argument") - (1- (string-to-number (nth 1 entry)))))) - LaTeX-auto-optional) - - ;; Cleanup environments arguments - (mapc (lambda (entry) - (add-to-list 'LaTeX-auto-environment - (list (nth 0 entry) - (string-to-number (nth 1 entry))))) - LaTeX-auto-env-args) - - ;; Cleanup use of def to add environments - ;; NOTE: This uses an O(N^2) algorithm, while an O(N log N) - ;; algorithm is possible. - (mapc (lambda (symbol) - (if (not (TeX-member symbol TeX-auto-symbol 'equal)) - ;; No matching symbol, insert in list - (add-to-list 'TeX-auto-symbol (concat "end" symbol)) - ;; Matching symbol found, remove from list - (if (equal (car TeX-auto-symbol) symbol) - ;; Is it the first symbol? - (setq TeX-auto-symbol (cdr TeX-auto-symbol)) - ;; Nope! Travel the list - (let ((list TeX-auto-symbol)) - (while (consp (cdr list)) - ;; Until we find it. - (if (equal (car (cdr list)) symbol) - ;; Then remove it. - (setcdr list (cdr (cdr list)))) - (setq list (cdr list))))) - ;; and add the symbol as an environment. - (add-to-list 'LaTeX-auto-environment symbol))) - LaTeX-auto-end-symbol)) - -(add-hook 'TeX-auto-cleanup-hook 'LaTeX-auto-cleanup) - -(TeX-auto-add-type "label" "LaTeX") -(TeX-auto-add-type "bibitem" "LaTeX") -(TeX-auto-add-type "environment" "LaTeX") -(TeX-auto-add-type "bibliography" "LaTeX" "bibliographies") -(TeX-auto-add-type "index-entry" "LaTeX" "index-entries") - -(fset 'LaTeX-add-bibliographies-auto - (symbol-function 'LaTeX-add-bibliographies)) -(defun LaTeX-add-bibliographies (&rest bibliographies) - "Add BIBLIOGRAPHIES to the list of known bibliographies and style files." - (apply 'LaTeX-add-bibliographies-auto bibliographies) - (apply 'TeX-run-style-hooks bibliographies)) - -(fset 'LaTeX-add-environments-auto - (symbol-function 'LaTeX-add-environments)) -(defun LaTeX-add-environments (&rest environments) - "Add ENVIRONMENTS to the list of known environments. -Additionally invalidate the environment submenus to let them be -regenerated by the respective menu filter." - (apply 'LaTeX-add-environments-auto environments) - (setq LaTeX-environment-menu nil) - (setq LaTeX-environment-modify-menu nil)) - -;;; BibTeX - -;;;###autoload -(defun BibTeX-auto-store () - "This function should be called from `bibtex-mode-hook'. -It will setup BibTeX to store keys in an auto file." - ;; We want this to be early in the list, so we do not - ;; add it before we enter BibTeX mode the first time. - (if (boundp 'local-write-file-hooks) - (add-hook 'local-write-file-hooks 'TeX-safe-auto-write) - (add-hook 'write-file-hooks 'TeX-safe-auto-write)) - (make-local-variable 'TeX-auto-update) - (setq TeX-auto-update 'BibTeX) - (make-local-variable 'TeX-auto-untabify) - (setq TeX-auto-untabify nil) - (make-local-variable 'TeX-auto-parse-length) - (setq TeX-auto-parse-length 999999) - (make-local-variable 'TeX-auto-regexp-list) - (setq TeX-auto-regexp-list BibTeX-auto-regexp-list) - (make-local-variable 'TeX-master) - (setq TeX-master t)) - -(defvar BibTeX-auto-regexp-list - `(("@[Ss][Tt][Rr][Ii][Nn][Gg]" 1 ignore) - (,(concat "@[a-zA-Z]+[{(][ \t]*\\(" TeX-token-char "[^, \n\r\t%\"#'()={}]*\\)") - 1 LaTeX-auto-bibitem)) - "List of regexp-list expressions matching BibTeX items.") - -;;; Macro Argument Hooks - -(defun TeX-arg-conditional (optional expr then else) - "Implement if EXPR THEN ELSE. - -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. - -If EXPR evaluate to true, parse THEN as an argument list, else parse -ELSE as an argument list." - (TeX-parse-arguments (if (eval expr) then else))) - -(defun TeX-arg-eval (optional &rest args) - "Evaluate ARGS and insert value in buffer. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one." - (TeX-argument-insert (eval args) optional)) - -(defun TeX-arg-label (optional &optional prompt definition) - "Prompt for a label completing with known labels. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string. If DEFINITION is non-nil, add the chosen label to the -list of defined labels." - (let ((label (completing-read (TeX-argument-prompt optional prompt "Key") - (LaTeX-label-list)))) - (if (and definition (not (string-equal "" label))) - (LaTeX-add-labels label)) - (TeX-argument-insert label optional optional))) - -(defalias 'TeX-arg-ref 'TeX-arg-label) - -(defun TeX-arg-index-tag (optional &optional prompt &rest args) - "Prompt for an index tag. -This is the name of an index, not the entry. - -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string. ARGS is unused." - (let (tag) - (setq prompt (concat (if optional "(Optional) " "") - (if prompt prompt "Index tag") - ": (default none) ")) - (setq tag (read-string prompt)) - (TeX-argument-insert tag optional))) - -(defun TeX-arg-index (optional &optional prompt &rest args) - "Prompt for an index entry completing with known entries. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string. ARGS is unused." - (let ((entry (completing-read (TeX-argument-prompt optional prompt "Key") - (LaTeX-index-entry-list)))) - (if (and (not (string-equal "" entry)) - (not (member (list entry) (LaTeX-index-entry-list)))) - (LaTeX-add-index-entries entry)) - (TeX-argument-insert entry optional optional))) - -(defalias 'TeX-arg-define-index 'TeX-arg-index) - -(defun TeX-arg-macro (optional &optional prompt definition) - "Prompt for a TeX macro with completion. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string. If DEFINITION is non-nil, add the chosen macro to the -list of defined macros." - (let ((macro (completing-read (TeX-argument-prompt optional prompt - (concat "Macro: " - TeX-esc) - t) - (TeX-symbol-list)))) - (if (and definition (not (string-equal "" macro))) - (TeX-add-symbols macro)) - (TeX-argument-insert macro optional TeX-esc))) - -(defun TeX-arg-environment (optional &optional prompt definition) - "Prompt for a LaTeX environment with completion. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string. If DEFINITION is non-nil, add the chosen environment to -the list of defined environments." - (let ((environment (completing-read (TeX-argument-prompt optional prompt - "Environment") - (TeX-symbol-list)))) - (if (and definition (not (string-equal "" environment))) - (LaTeX-add-environments environment)) - - (TeX-argument-insert environment optional))) - -;; Why is DEFINITION unused? -(defun TeX-arg-cite (optional &optional prompt definition) - "Prompt for a BibTeX citation with completion. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string. DEFINITION is unused." - (setq prompt (concat (if optional "(Optional) " "") - (if prompt prompt "Add key") - ": (default none) ")) - (let ((items (multi-prompt "," t prompt (LaTeX-bibitem-list)))) - (apply 'LaTeX-add-bibitems items) - (TeX-argument-insert (mapconcat 'identity items ",") optional optional))) - -;; Why is DEFINITION unused? -(defun TeX-arg-counter (optional &optional prompt definition) - "Prompt for a LaTeX counter. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string. DEFINITION is unused." - ;; Completion not implemented yet. - (TeX-argument-insert - (read-string (TeX-argument-prompt optional prompt "Counter")) - optional)) - -;; Why is DEFINITION unused? -(defun TeX-arg-savebox (optional &optional prompt definition) - "Prompt for a LaTeX savebox. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string. DEFINITION is unused." - ;; Completion not implemented yet. - (TeX-argument-insert - (read-string (TeX-argument-prompt optional prompt - (concat "Savebox: " TeX-esc) - t)) - optional TeX-esc)) - -(defun TeX-arg-file (optional &optional prompt) - "Prompt for a filename in the current directory. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string." - (TeX-argument-insert (read-file-name (TeX-argument-prompt optional - prompt "File") - "" "" nil) - optional)) - -(defun TeX-arg-define-label (optional &optional prompt) - "Prompt for a label completing with known labels. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string." - (TeX-arg-label optional prompt t)) - -(defun TeX-arg-define-macro (optional &optional prompt) - "Prompt for a TeX macro with completion. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string." - (TeX-arg-macro optional prompt t)) - -(defun TeX-arg-define-environment (optional &optional prompt) - "Prompt for a LaTeX environment with completion. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string." - (TeX-arg-environment optional prompt t)) - -(defun TeX-arg-define-cite (optional &optional prompt) - "Prompt for a BibTeX citation. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string." - (TeX-arg-cite optional prompt t)) - -(defun TeX-arg-define-counter (optional &optional prompt) - "Prompt for a LaTeX counter. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string." - (TeX-arg-counter optional prompt t)) - -(defun TeX-arg-define-savebox (optional &optional prompt) - "Prompt for a LaTeX savebox. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string." - (TeX-arg-savebox optional prompt t)) - -(defcustom LaTeX-style-list '(("amsart") - ("amsbook") - ("article") - ("beamer") - ("book") - ("dinbrief") - ("foils") - ("letter") - ("minimal") - ("prosper") - ("report") - ("scrartcl") - ("scrbook") - ("scrlttr2") - ("scrreprt") - ("slides")) - "List of document classes offered when inserting a document environment." - :group 'LaTeX-environment - :type '(repeat (group (string :format "%v")))) - -(defun TeX-arg-document (optional &optional ignore) - "Insert arguments to documentclass. -OPTIONAL and IGNORE are ignored." - (let ((style (completing-read - (concat "Document class: (default " LaTeX-default-style ") ") - LaTeX-style-list)) - (options (read-string "Options: " - (if (stringp LaTeX-default-options) - LaTeX-default-options - (mapconcat 'identity - LaTeX-default-options - ","))))) - (if (zerop (length style)) - (setq style LaTeX-default-style)) - (if (not (zerop (length options))) - (insert LaTeX-optop options LaTeX-optcl)) - (insert TeX-grop style TeX-grcl)) - - ;; remove old information - (TeX-remove-style) - - ;; defined in individual style hooks - (TeX-update-style)) - -(defun LaTeX-arg-usepackage (optional) - "Insert arguments to usepackage. -OPTIONAL is ignored." - (let ((TeX-file-extensions '("sty"))) - (TeX-arg-input-file nil "Package") - (save-excursion - (search-backward-regexp "{\\(.*\\)}") - (let* ((package (match-string 1)) - (var (intern (format "LaTeX-%s-package-options" package))) - (crm-separator ",") - (TeX-arg-opening-brace LaTeX-optop) - (TeX-arg-closing-brace LaTeX-optcl) - options) - (if (or (and (boundp var) - (listp (symbol-value var))) - (fboundp var)) - (if (functionp var) - (setq options (funcall var)) - (when (symbol-value var) - (setq options - (mapconcat 'identity - (TeX-completing-read-multiple - "Options: " (mapcar 'list (symbol-value var))) - ",")))) - (setq options (read-string "Options: "))) - (when options - ;; XXX: The following statement will add the options - ;; supplied to the LaTeX package to the style list. This is - ;; consistent with the way the parser works (see - ;; `LaTeX-auto-cleanup'). But in a revamped style system - ;; such options should be associated with their LaTeX - ;; package to avoid confusion. For example a `german' entry - ;; in the style list can come from documentclass options and - ;; does not necessarily mean that the babel-related - ;; extensions should be activated. - (mapc 'TeX-run-style-hooks (LaTeX-listify-package-options options)) - (TeX-argument-insert options t)))))) - -(defvar TeX-global-input-files nil - "List of the non-local TeX input files. - -Initialized once at the first time you prompt for an input file. -May be reset with `\\[universal-argument] \\[TeX-normal-mode]'.") - -(defun TeX-arg-input-file (optional &optional prompt local) - "Prompt for a tex or sty file. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. PROMPT is the prompt, -LOCAL is a flag. If the flag is set, only complete with local -files." - (unless (or TeX-global-input-files local) - (message "Searching for files...") - (setq TeX-global-input-files - (mapcar 'list (TeX-search-files (append TeX-macro-private - TeX-macro-global) - TeX-file-extensions t t)))) - (let ((file (if TeX-check-path - (completing-read - (TeX-argument-prompt optional prompt "File") - (TeX-delete-dups-by-car - (append (mapcar 'list - (TeX-search-files '("./") - TeX-file-extensions - t t)) - (unless local - TeX-global-input-files)))) - (read-file-name - (TeX-argument-prompt optional prompt "File"))))) - (if (null file) - (setq file "")) - (if (not (string-equal "" file)) - (TeX-run-style-hooks file)) - (TeX-argument-insert file optional))) - -(defvar BibTeX-global-style-files nil - "Association list of BibTeX style files. - -Initialized once at the first time you prompt for an input file. -May be reset with `\\[universal-argument] \\[TeX-normal-mode]'.") - -(defun TeX-arg-bibstyle (optional &optional prompt) - "Prompt for a BibTeX style file. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string." - (message "Searching for BibTeX styles...") - (or BibTeX-global-style-files - (setq BibTeX-global-style-files - (mapcar 'list - (TeX-search-files (append TeX-macro-private - TeX-macro-global) - BibTeX-style-extensions t t)))) - - (TeX-argument-insert - (completing-read (TeX-argument-prompt optional prompt "BibTeX style") - (append (mapcar 'list - (TeX-search-files '("./") - BibTeX-style-extensions - t t)) - BibTeX-global-style-files)) - optional)) - -(defvar BibTeX-global-files nil - "Association list of BibTeX files. - -Initialized once at the first time you prompt for an BibTeX file. -May be reset with `\\[universal-argument] \\[TeX-normal-mode]'.") - -(defun TeX-arg-bibliography (optional &optional prompt) - "Prompt for a BibTeX database file. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string." - (message "Searching for BibTeX files...") - (or BibTeX-global-files - (setq BibTeX-global-files - (mapcar 'list (TeX-search-files nil BibTeX-file-extensions t t)))) - - (let ((styles (multi-prompt - "," t - (TeX-argument-prompt optional prompt "BibTeX files") - (append (mapcar 'list - (TeX-search-files '("./") - BibTeX-file-extensions - t t)) - BibTeX-global-files)))) - (apply 'LaTeX-add-bibliographies styles) - (TeX-argument-insert (mapconcat 'identity styles ",") optional))) - -(defun TeX-arg-corner (optional &optional prompt) - "Prompt for a LaTeX side or corner position with completion. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string." - (TeX-argument-insert - (completing-read (TeX-argument-prompt optional prompt "Position") - '(("") ("l") ("r") ("t") ("b") ("tl") ("tr") ("bl") ("br")) - nil t) - optional)) - -(defun TeX-arg-lr (optional &optional prompt) - "Prompt for a LaTeX side with completion. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string." - (TeX-argument-insert - (completing-read (TeX-argument-prompt optional prompt "Position") - '(("") ("l") ("r")) - nil t) - optional)) - -(defun TeX-arg-tb (optional &optional prompt) - "Prompt for a LaTeX side with completion. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string." - (TeX-argument-insert - (completing-read (TeX-argument-prompt optional prompt "Position") - '(("") ("t") ("b")) - nil t) - optional)) - -(defun TeX-arg-pagestyle (optional &optional prompt) - "Prompt for a LaTeX pagestyle with completion. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string." - (TeX-argument-insert - (completing-read (TeX-argument-prompt optional prompt "Pagestyle") - '(("plain") ("empty") ("headings") ("myheadings"))) - optional)) - -(defcustom LaTeX-default-verb-delimiter ?| - "Default delimiter for `\\verb' macros." - :group 'LaTeX-macro - :type 'character) - -(defun TeX-arg-verb (optional &optional ignore) - "Prompt for delimiter and text. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. IGNORE is ignored." - (let ((del (read-quoted-char - (concat "Delimiter: (default " - (char-to-string LaTeX-default-verb-delimiter) ") ")))) - (when (<= del ?\ ) (setq del LaTeX-default-verb-delimiter)) - (if (TeX-active-mark) - (progn - (insert del) - (goto-char (mark)) - (insert del)) - (insert del (read-from-minibuffer "Text: ") del)) - (setq LaTeX-default-verb-delimiter del))) - -(defun TeX-arg-pair (optional first second) - "Insert a pair of number, prompted by FIRST and SECOND. - -The numbers are surounded by parenthesizes and separated with a -comma. - -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one." - (insert "(" (read-string (concat first ": ")) "," - (read-string (concat second ": ")) ")")) - -(defun TeX-arg-size (optional) - "Insert width and height as a pair. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one." - (TeX-arg-pair optional "Width" "Height")) - -(defun TeX-arg-coordinate (optional) - "Insert x and y coordinate as a pair. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one." - (TeX-arg-pair optional "X position" "Y position")) - -(defconst TeX-braces-default-association - '(("[" . "]") - ("\\{" . "\\}") - ("(" . ")") - ("|" . "|") - ("\\|" . "\\|") - ("/" . "/") - ("\\backslash" . "\\backslash") - ("\\lfloor" . "\\rfloor") - ("\\lceil" . "\\rceil") - ("\\langle" . "\\rangle"))) - -(defcustom TeX-braces-user-association nil - "A list of your personal association of brace symbols. -These are used for \\left and \\right. - -The car of each entry is the brace used with \\left, -the cdr is the brace used with \\right." - :group 'LaTeX-macro - :group 'LaTeX-math - :type '(repeat (cons :format "%v" - (string :tag "Left") - (string :tag "Right")))) - -(defvar TeX-braces-association - (append TeX-braces-user-association - TeX-braces-default-association) - "A list of association of brace symbols for \\left and \\right. -The car of each entry is the brace used with \\left, -the cdr is the brace used with \\right.") - -(defvar TeX-left-right-braces - '(("[") ("]") ("\\{") ("\\}") ("(") (")") ("|") ("\\|") - ("/") ("\\backslash") ("\\lfloor") ("\\rfloor") - ("\\lceil") ("\\rceil") ("\\langle") ("\\rangle") - ("\\uparrow") ("\\Uparrow") ("\\downarrow") ("\\Downarrow") - ("\\updownarrow") ("\\Updownarrow") (".")) - "List of symbols which can follow the \\left or \\right command.") - -(defun TeX-arg-insert-braces (optional &optional prompt) - "Prompt for a brace for \\left and insert the corresponding \\right. -If OPTIONAL is non-nil, insert the resulting value as an optional -argument, otherwise as a mandatory one. Use PROMPT as the prompt -string." - (save-excursion - (backward-word 1) - (backward-char) - (LaTeX-newline) - (indent-according-to-mode) - (beginning-of-line 0) - (if (looking-at "^[ \t]*$") - (progn (delete-horizontal-space) - (delete-char 1)))) - (let ((left-brace (completing-read - (TeX-argument-prompt optional prompt "Which brace") - TeX-left-right-braces))) - (insert left-brace) - (LaTeX-newline) - (indent-according-to-mode) - (save-excursion - (let ((right-brace (cdr (assoc left-brace - TeX-braces-association)))) - (LaTeX-newline) - (insert TeX-esc "right") - (if (and TeX-arg-right-insert-p - right-brace) - (insert right-brace) - (insert (completing-read - (TeX-argument-prompt optional prompt "Which brace") - TeX-left-right-braces))) - (indent-according-to-mode))))) - -(defun TeX-arg-key-val (optional key-val-alist) - "Prompt for keys and values in KEY-VAL-ALIST. -Insert the given value as a TeX macro argument. If OPTIONAL is -non-nil, insert it as an optional argument. KEY-VAL-ALIST is an -alist. The car of each element should be a string representing a -key and the optional cdr should be a list with strings to be used -as values for the key." - (let ((options (multi-prompt-key-value - (TeX-argument-prompt optional "Options" nil) - (if (symbolp key-val-alist) - (eval key-val-alist) - key-val-alist)))) - (TeX-argument-insert options optional))) - - -;;; Verbatim constructs - -(defcustom LaTeX-verbatim-macros-with-delims - '("verb" "verb*") - "Macros for inline verbatim with arguments in delimiters, like \\foo|...|. - -Programs should not use this variable directly but the function -`LaTeX-verbatim-macros-with-delims' which returns a value -including buffer-local keyword additions via -`LaTeX-verbatim-macros-with-delims-local' as well." - :group 'LaTeX-macro - :type '(repeat (string))) - -(defvar LaTeX-verbatim-macros-with-delims-local nil - "Buffer-local variable for inline verbatim with args in delimiters. - -Style files should add constructs to this variable and not to -`LaTeX-verbatim-macros-with-delims'. - -Programs should not use this variable directly but the function -`LaTeX-verbatim-macros-with-delims' which returns a value -including values of the variable -`LaTeX-verbatim-macros-with-delims' as well.") -(make-variable-buffer-local 'LaTeX-verbatim-macros-with-delims-local) - -(defcustom LaTeX-verbatim-macros-with-braces nil - "Macros for inline verbatim with arguments in braces, like \\foo{...}. - -Programs should not use this variable directly but the function -`LaTeX-verbatim-macros-with-braces' which returns a value -including buffer-local keyword additions via -`LaTeX-verbatim-macros-with-braces-local' as well." - :group 'LaTeX-macro - :type '(repeat (string))) - -(defvar LaTeX-verbatim-macros-with-braces-local nil - "Buffer-local variable for inline verbatim with args in braces. - -Style files should add constructs to this variable and not to -`LaTeX-verbatim-macros-with-braces'. - -Programs should not use this variable directly but the function -`LaTeX-verbatim-macros-with-braces' which returns a value -including values of the variable -`LaTeX-verbatim-macros-with-braces' as well.") -(make-variable-buffer-local 'LaTeX-verbatim-macros-with-braces-local) - -(defcustom LaTeX-verbatim-environments - '("verbatim" "verbatim*") - "Verbatim environments. - -Programs should not use this variable directly but the function -`LaTeX-verbatim-environments' which returns a value including -buffer-local keyword additions via -`LaTeX-verbatim-environments-local' as well." - :group 'LaTeX-environment - :type '(repeat (string))) - -(defvar LaTeX-verbatim-environments-local nil - "Buffer-local variable for inline verbatim environments. - -Style files should add constructs to this variable and not to -`LaTeX-verbatim-environments'. - -Programs should not use this variable directly but the function -`LaTeX-verbatim-environments' which returns a value including -values of the variable `LaTeX-verbatim-environments' as well.") -(make-variable-buffer-local 'LaTeX-verbatim-environments-local) - -(defun LaTeX-verbatim-macros-with-delims () - "Return list of verbatim macros with delimiters." - (append LaTeX-verbatim-macros-with-delims - LaTeX-verbatim-macros-with-delims-local)) - -(defun LaTeX-verbatim-macros-with-braces () - "Return list of verbatim macros with braces." - (append LaTeX-verbatim-macros-with-braces - LaTeX-verbatim-macros-with-braces-local)) - -(defun LaTeX-verbatim-environments () - "Return list of verbatim environments." - (append LaTeX-verbatim-environments - LaTeX-verbatim-environments-local)) - -(defun LaTeX-verbatim-macro-boundaries () - "Return boundaries of verbatim macro. -Boundaries are returned as a cons cell where the car is the macro -start and the cdr the macro end. - -Only macros which enclose their arguments with special -non-parenthetical delimiters, like \\verb+foo+, are recognized." - (save-excursion - (let ((orig (point)) - (verbatim-regexp (regexp-opt (LaTeX-verbatim-macros-with-delims) t))) - ;; Search backwards for the macro start, unless we are facing one - (unless (looking-at (concat (regexp-quote TeX-esc) verbatim-regexp)) - (catch 'found - (while (progn - (skip-chars-backward (concat "^\n" (regexp-quote TeX-esc)) - (line-beginning-position)) - (when (looking-at verbatim-regexp) (throw 'found nil)) - (or (bobp) (forward-char -1)) - (/= (point) (line-beginning-position)))))) - ;; Search forward for the macro end, unless we failed to find a start - (unless (bolp) - (let ((beg (1- (point)))) - (goto-char (1+ (match-end 0))) - (skip-chars-forward (concat "^" (buffer-substring-no-properties - (1- (point)) (point)))) - (when (<= orig (point)) - (cons beg (1+ (point))))))))) - -(defun LaTeX-current-verbatim-macro () - "Return name of verbatim macro containing point, nil if none is present." - (let ((macro-boundaries (LaTeX-verbatim-macro-boundaries))) - (when macro-boundaries - (save-excursion - (goto-char (car macro-boundaries)) - (forward-char (length TeX-esc)) - (buffer-substring-no-properties - (point) (progn (skip-chars-forward "@A-Za-z") (point))))))) - -(defun LaTeX-verbatim-p (&optional pos) - "Return non-nil if position POS is in a verbatim-like construct." - (when pos (goto-char pos)) - (save-match-data - (or (when (fboundp 'font-latex-faces-present-p) - (font-latex-faces-present-p 'font-latex-verbatim-face)) - (member (LaTeX-current-verbatim-macro) - (LaTeX-verbatim-macros-with-delims)) - (member (TeX-current-macro) (LaTeX-verbatim-macros-with-braces)) - (member (LaTeX-current-environment) (LaTeX-verbatim-environments))))) - - -;;; Formatting - -(defcustom LaTeX-syntactic-comments t - "If non-nil comments will be handled according to LaTeX syntax. -This variable influences, among others, the behavior of -indentation and filling which will take LaTeX syntax into -consideration just as is in the non-commented source code." - :type 'boolean - :group 'LaTeX) - - -;;; Indentation - -;; We are distinguishing two different types of comments: -;; -;; 1) Comments starting in column one (line comments) -;; -;; 2) Comments starting after column one with only whitespace -;; preceding it. -;; -;; (There is actually a third type: Comments preceded not only by -;; whitespace but by some code as well; so-called code comments. But -;; they are not relevant for the following explanations.) -;; -;; Additionally we are distinguishing two different types of -;; indentation: -;; -;; a) Outer indentation: Indentation before the comment character(s). -;; -;; b) Inner indentation: Indentation after the comment character(s) -;; (taking into account possible comment padding). -;; -;; Comments can be filled syntax-aware or not. -;; -;; In `doctex-mode' line comments should always be indented -;; syntax-aware and the comment character has to be anchored at the -;; first column (unless the appear in a macrocode environment). Other -;; comments not in the documentation parts always start after the -;; first column and can be indented syntax-aware or not. If they are -;; indented syntax-aware both the indentation before and after the -;; comment character(s) have to be checked and adjusted. Indentation -;; should not move the comment character(s) to the first column. With -;; `LaTeX-syntactic-comments' disabled, line comments should still be -;; indented syntax-aware. -;; -;; In `latex-mode' comments starting in different columns don't have -;; to be handled differently. They don't have to be anchored in -;; column one. That means that in any case indentation before and -;; after the comment characters has to be checked and adjusted. - -(defgroup LaTeX-indentation nil - "Indentation of LaTeX code in AUCTeX" - :group 'LaTeX - :group 'TeX-indentation) - -(defcustom LaTeX-indent-level 2 - "*Indentation of begin-end blocks in LaTeX." - :group 'LaTeX-indentation - :type 'integer) - -(defcustom LaTeX-item-indent (- LaTeX-indent-level) - "*Extra indentation for lines beginning with an item." - :group 'LaTeX-indentation - :type 'integer) - -(defcustom LaTeX-item-regexp "\\(bib\\)?item\\b" - "*Regular expression matching macros considered items." - :group 'LaTeX-indentation - :type 'regexp) - -(defcustom LaTeX-indent-environment-list - '(("verbatim" current-indentation) - ("verbatim*" current-indentation) - ;; The following should have there own, smart indentation function. - ;; Some other day. - ("array") - ("displaymath") - ("eqnarray") - ("eqnarray*") - ("equation") - ("equation*") - ("picture") - ("tabbing") - ("table") - ("table*") - ("tabular") - ("tabular*")) - "Alist of environments with special indentation. -The second element in each entry is the function to calculate the -indentation level in columns." - :group 'LaTeX-indentation - :type '(repeat (list (string :tag "Environment") - (option function)))) - -(defcustom LaTeX-indent-environment-check t - "*If non-nil, check for any special environments." - :group 'LaTeX-indentation - :type 'boolean) - -(defcustom LaTeX-document-regexp "document" - "Regexp matching environments in which the indentation starts at col 0." - :group 'LaTeX-indentation - :type 'regexp) - -(defcustom LaTeX-verbatim-regexp "verbatim\\*?" - "*Regexp matching environments with indentation at col 0 for begin/end." - :group 'LaTeX-indentation - :type 'regexp) - -(defcustom LaTeX-begin-regexp "begin\\b" - "*Regexp matching macros considered begins." - :group 'LaTeX-indentation - :type 'regexp) - -(defcustom LaTeX-end-regexp "end\\b" - "*Regexp matching macros considered ends." - :group 'LaTeX-indentation - :type 'regexp) - -(defcustom LaTeX-left-right-indent-level LaTeX-indent-level - "*The level of indentation produced by a \\left macro." - :group 'LaTeX-indentation - :type 'integer) - -(defcustom LaTeX-indent-comment-start-regexp "%" - "*Regexp matching comments ending the indent level count. -This means, we just count the LaTeX tokens \\left, \\right, \\begin, -and \\end up to the first occurence of text matching this regexp. -Thus, the default \"%\" stops counting the tokens at a comment. A -value of \"%[^>]\" would allow you to alter the indentation with -comments, e.g. with comment `%> \\begin'. -Lines which start with `%' are not considered at all, regardless if this -value." - :group 'LaTeX-indentation - :type 'regexp) - -(defvar docTeX-indent-inner-fixed - `((,(concat (regexp-quote TeX-esc) - "\\(begin\\|end\\)[ \t]*{macrocode\\*?}") 4 t) - (,(concat (regexp-quote TeX-esc) - "\\(begin\\|end\\)[ \t]*{\\(macro\\|environment\\)\\*?}") 0 nil)) - "List of items which should have a fixed inner indentation. -The items consist of three parts. The first is a regular -expression which should match the respective string. The second -is the amount of spaces to be used for indentation. The third -toggles if comment padding is relevant or not. If t padding is -part of the amount given, if nil the amount of spaces will be -inserted after potential padding.") - -(defun LaTeX-indent-line () - "Indent the line containing point, as LaTeX source. -Add `LaTeX-indent-level' indentation in each \\begin{ - \\end{ block. -Lines starting with an item is given an extra indentation of -`LaTeX-item-indent'." - (interactive) - (let* ((case-fold-search nil) - ;; Compute a fill prefix. Whitespace after the comment - ;; characters will be disregarded and replaced by - ;; `comment-padding'. - (fill-prefix - (and (TeX-in-commented-line) - (save-excursion - (beginning-of-line) - (looking-at - (concat "\\([ \t]*" TeX-comment-start-regexp "+\\)+")) - (concat (match-string 0) (TeX-comment-padding-string))))) - (overlays (when (featurep 'xemacs) - ;; Isn't that fun? In Emacs an `(overlays-at - ;; (line-beginning-position))' would do the - ;; trick. How boring. - (extent-list - nil (line-beginning-position) (line-beginning-position) - 'all-extents-closed-open 'overlay))) - ol-specs) - ;; XEmacs' `indent-to' function (at least in version 21.4.15) has - ;; a bug which leads to the insertion of whitespace in front of an - ;; invisible overlay. So during indentation we temporarily remove - ;; the 'invisible property. - (dolist (ol overlays) - (when (extent-property ol 'invisible) - (add-to-list 'ol-specs (list ol (extent-property ol 'invisible))) - (set-extent-property ol 'invisible nil))) - (save-excursion - (cond ((and fill-prefix - (TeX-in-line-comment) - (eq major-mode 'doctex-mode)) - ;; If point is in a line comment in `doctex-mode' we only - ;; consider the inner indentation. - (let ((inner-indent (LaTeX-indent-calculate 'inner))) - (when (/= (LaTeX-current-indentation 'inner) inner-indent) - (LaTeX-indent-inner-do inner-indent)))) - ((and fill-prefix - LaTeX-syntactic-comments) - ;; In any other case of a comment we have to consider - ;; outer and inner indentation if we do syntax-aware - ;; indentation. - (let ((inner-indent (LaTeX-indent-calculate 'inner)) - (outer-indent (LaTeX-indent-calculate 'outer))) - (when (/= (LaTeX-current-indentation 'inner) inner-indent) - (LaTeX-indent-inner-do inner-indent)) - (when (/= (LaTeX-current-indentation 'outer) outer-indent) - (LaTeX-indent-outer-do outer-indent)))) - (t - ;; The default is to adapt whitespace before any - ;; non-whitespace character, i.e. to do outer - ;; indentation. - (let ((outer-indent (LaTeX-indent-calculate 'outer))) - (when (/= (LaTeX-current-indentation 'outer) outer-indent) - (LaTeX-indent-outer-do outer-indent)))))) - ;; Make the overlays invisible again. - (dolist (ol-spec ol-specs) - (set-extent-property (car ol-spec) 'invisible (cadr ol-spec))) - (when (< (current-column) (save-excursion - (LaTeX-back-to-indentation) (current-column))) - (LaTeX-back-to-indentation)))) - -(defun LaTeX-indent-inner-do (inner-indent) - ;; Small helper function for `LaTeX-indent-line' to perform - ;; indentation after a comment character. It requires that - ;; `LaTeX-indent-line' already set the appropriate variables and - ;; should not be used outside of `LaTeX-indent-line'. - (move-to-left-margin) - (TeX-re-search-forward-unescaped - (concat "\\(" TeX-comment-start-regexp "+[ \t]*\\)+") (line-end-position) t) - (delete-region (line-beginning-position) (point)) - (insert fill-prefix) - (indent-to (+ inner-indent (length fill-prefix)))) - -(defun LaTeX-indent-outer-do (outer-indent) - ;; Small helper function for `LaTeX-indent-line' to perform - ;; indentation of normal lines or before a comment character in a - ;; commented line. It requires that `LaTeX-indent-line' already set - ;; the appropriate variables and should not be used outside of - ;; `LaTeX-indent-line'. - (back-to-indentation) - (delete-region (line-beginning-position) (point)) - (indent-to outer-indent)) - -(defun LaTeX-indent-calculate (&optional force-type) - "Return the indentation of a line of LaTeX source. -FORCE-TYPE can be used to force the calculation of an inner or -outer indentation in case of a commented line. The symbols -'inner and 'outer are recognized." - (save-excursion - (LaTeX-back-to-indentation force-type) - (let ((i 0) - (list-length (safe-length docTeX-indent-inner-fixed)) - entry - found) - (cond ((save-excursion (beginning-of-line) (bobp)) 0) - ((and (eq major-mode 'doctex-mode) - fill-prefix - (TeX-in-line-comment) - (progn - (while (and (< i list-length) - (not found)) - (setq entry (nth i docTeX-indent-inner-fixed)) - (when (looking-at (nth 0 entry)) - (setq found t)) - (setq i (1+ i))) - found)) - (if (nth 2 entry) - (- (nth 1 entry) (if (integerp comment-padding) - comment-padding - (length comment-padding))) - (nth 1 entry))) - ((looking-at (concat (regexp-quote TeX-esc) - "\\(begin\\|end\\){\\(" - LaTeX-verbatim-regexp - "\\)}")) - ;; \end{verbatim} must be flush left, otherwise an unwanted - ;; empty line appears in LaTeX's output. - 0) - ((and LaTeX-indent-environment-check - ;; Special environments. - (let ((entry (assoc (or LaTeX-current-environment - (LaTeX-current-environment)) - LaTeX-indent-environment-list))) - (and entry - (nth 1 entry) - (funcall (nth 1 entry)))))) - ((looking-at (concat (regexp-quote TeX-esc) - "\\(" - LaTeX-end-regexp - "\\)")) - ;; Backindent at \end. - (- (LaTeX-indent-calculate-last force-type) LaTeX-indent-level)) - ((looking-at (concat (regexp-quote TeX-esc) "right\\b")) - ;; Backindent at \right. - (- (LaTeX-indent-calculate-last force-type) - LaTeX-left-right-indent-level)) - ((looking-at (concat (regexp-quote TeX-esc) - "\\(" - LaTeX-item-regexp - "\\)")) - ;; Items. - (+ (LaTeX-indent-calculate-last force-type) LaTeX-item-indent)) - ((looking-at "}") - ;; End brace in the start of the line. - (- (LaTeX-indent-calculate-last force-type) - TeX-brace-indent-level)) - (t (LaTeX-indent-calculate-last force-type)))))) - -(defun LaTeX-indent-level-count () - "Count indentation change caused by all \\left, \\right, \\begin, and -\\end commands in the current line." - (save-excursion - (save-restriction - (let ((count 0)) - (narrow-to-region (point) - (save-excursion - (re-search-forward - (concat "[^" TeX-esc "]" - "\\(" LaTeX-indent-comment-start-regexp - "\\)\\|\n\\|\\'")) - (backward-char) - (point))) - (while (search-forward TeX-esc nil t) - (cond - ((looking-at "left\\b") - (setq count (+ count LaTeX-left-right-indent-level))) - ((looking-at "right\\b") - (setq count (- count LaTeX-left-right-indent-level))) - ((looking-at LaTeX-begin-regexp) - (setq count (+ count LaTeX-indent-level))) - ((looking-at LaTeX-end-regexp) - (setq count (- count LaTeX-indent-level))) - ((looking-at (regexp-quote TeX-esc)) - (forward-char 1)))) - count)))) - -(defun LaTeX-indent-calculate-last (&optional force-type) - "Return the correct indentation of a normal line of text. -The point is supposed to be at the beginning of the current line. -FORCE-TYPE can be used to force the calculation of an inner or -outer indentation in case of a commented line. The symbols -'inner and 'outer are recognized." - (let (line-comment-current-flag - line-comment-last-flag - comment-current-flag - comment-last-flag) - (beginning-of-line) - (setq line-comment-current-flag (TeX-in-line-comment) - comment-current-flag (TeX-in-commented-line)) - (if comment-current-flag - (skip-chars-backward "%\n\t ") - (skip-chars-backward "\n\t ")) - (beginning-of-line) - ;; If we are called in a non-comment line, skip over comment - ;; lines. The computation of indentation should in this case - ;; rather take the last non-comment line into account. - ;; Otherwise there might arise problems with e.g. multi-line - ;; code comments. This behavior is not enabled in docTeX mode - ;; where large amounts of line comments may have to be skipped - ;; and indentation should not be influenced by unrelated code in - ;; other macrocode environments. - (while (and (not (eq major-mode 'doctex-mode)) - (not comment-current-flag) - (TeX-in-commented-line) - (not (bobp))) - (skip-chars-backward "\n\t ") - (beginning-of-line)) - (setq line-comment-last-flag (TeX-in-line-comment) - comment-last-flag (TeX-in-commented-line)) - (LaTeX-back-to-indentation force-type) - ;; Separate line comments and other stuff (normal text/code and - ;; code comments). Additionally we don't want to compute inner - ;; indentation when a commented and a non-commented line are - ;; compared. - (cond ((or (and (eq major-mode 'doctex-mode) - (or (and line-comment-current-flag - (not line-comment-last-flag)) - (and (not line-comment-current-flag) - line-comment-last-flag))) - (and force-type - (eq force-type 'inner) - (or (and comment-current-flag - (not comment-last-flag)) - (and (not comment-current-flag) - comment-last-flag)))) - 0) - ((looking-at (concat (regexp-quote TeX-esc) - "begin *{\\(" - LaTeX-document-regexp - "\\)}")) - ;; I dislike having all of the document indented... - (+ (LaTeX-current-indentation force-type) - ;; Some people have opening braces at the end of the - ;; line, e.g. in case of `\begin{letter}{%'. - (TeX-brace-count-line))) - ((and (eq major-mode 'doctex-mode) - (looking-at (concat (regexp-quote TeX-esc) - "end[ \t]*{macrocode\\*?}")) - fill-prefix - (TeX-in-line-comment)) - ;; Reset indentation to zero after a macrocode - ;; environment. - 0) - ((looking-at (concat (regexp-quote TeX-esc) - "begin *{\\(" - LaTeX-verbatim-regexp - "\\)}")) - 0) - ((looking-at (concat (regexp-quote TeX-esc) - "end *{\\(" - LaTeX-verbatim-regexp - "\\)}")) - ;; If I see an \end{verbatim} in the previous line I skip - ;; back to the preceding \begin{verbatim}. - (save-excursion - (if (re-search-backward (concat (regexp-quote TeX-esc) - "begin *{\\(" - LaTeX-verbatim-regexp - "\\)}") 0 t) - (LaTeX-indent-calculate-last force-type) - 0))) - (t (+ (LaTeX-current-indentation force-type) - (if (not (and force-type - (eq force-type 'outer) - (TeX-in-commented-line))) - (+ (LaTeX-indent-level-count) - (TeX-brace-count-line)) - 0) - (cond ((looking-at (concat (regexp-quote TeX-esc) - "\\(" - LaTeX-end-regexp - "\\)")) - LaTeX-indent-level) - ((looking-at - (concat (regexp-quote TeX-esc) "right\\b")) - LaTeX-left-right-indent-level) - ((looking-at (concat (regexp-quote TeX-esc) - "\\(" - LaTeX-item-regexp - "\\)")) - (- LaTeX-item-indent)) - ((looking-at "}") - TeX-brace-indent-level) - (t 0))))))) - -(defun LaTeX-current-indentation (&optional force-type) - "Return the indentation of a line. -FORCE-TYPE can be used to force the calculation of an inner or -outer indentation in case of a commented line. The symbols -'inner and 'outer are recognized." - (if (and fill-prefix - (or (and force-type - (eq force-type 'inner)) - (and (not force-type) - (or - ;; If `LaTeX-syntactic-comments' is not enabled, - ;; do conventional indentation - LaTeX-syntactic-comments - ;; Line comments in `doctex-mode' are always - ;; indented syntax-aware so we need their inner - ;; indentation. - (and (TeX-in-line-comment) - (eq major-mode 'doctex-mode)))))) - ;; INNER indentation - (save-excursion - (beginning-of-line) - (looking-at (concat "\\(?:[ \t]*" TeX-comment-start-regexp "+\\)+" - "\\([ \t]*\\)")) - (- (length (match-string 1)) (length (TeX-comment-padding-string)))) - ;; OUTER indentation - (current-indentation))) - -(defun LaTeX-back-to-indentation (&optional force-type) - "Move point to the first non-whitespace character on this line. -If it is commented and comments are formatted syntax-aware move -point to the first non-whitespace character after the comment -character(s). The optional argument FORCE-TYPE can be used to -force point being moved to the inner or outer indentation in case -of a commented line. The symbols 'inner and 'outer are -recognized." - (if (or (and force-type - (eq force-type 'inner)) - (and (not force-type) - (or (and (TeX-in-line-comment) - (eq major-mode 'doctex-mode)) - (and (TeX-in-commented-line) - LaTeX-syntactic-comments)))) - (progn - (beginning-of-line) - ;; Should this be anchored at the start of the line? - (TeX-re-search-forward-unescaped - (concat "\\(?:" TeX-comment-start-regexp "+[ \t]*\\)+") - (line-end-position) t)) - (back-to-indentation))) - - -;;; Filling - -(defcustom LaTeX-fill-break-at-separators nil - "List of separators before or after which respectively a line -break will be inserted if they do not fit into one line." - :group 'LaTeX - :type '(set :tag "Contents" - (const :tag "Opening Brace" \{) - (const :tag "Closing Brace" \}) - (const :tag "Opening Bracket" \[) - (const :tag "Opening Inline Math Switches" \\\() - (const :tag "Closing Inline Math Switches" \\\)) - (const :tag "Opening Display Math Switch" \\\[) - (const :tag "Closing Display Math Switch" \\\]))) - -(defcustom LaTeX-fill-break-before-code-comments t - "If non-nil, a line with some code followed by a comment will -be broken before the last non-comment word in case the comment -does not fit into the line." - :group 'LaTeX - :type 'boolean) - -(defvar LaTeX-nospace-between-char-regexp - (if (featurep 'xemacs) - (if (and (boundp 'word-across-newline) word-across-newline) - word-across-newline - ;; NOTE: Ensure not to have a value of nil for such a rare case that - ;; somebody removes the mule test in `LaTeX-fill-delete-newlines' so that - ;; it could match only "\n" and this could lead to problem. XEmacs does - ;; not have a category `\c|' and `\ct' means `Chinese Taiwan' in XEmacs. - "\\(\\cj\\|\\cc\\|\\ct\\)") - "\\c|") - "Regexp matching a character where no interword space is necessary. -Words formed by such characters can be broken across newlines.") - -(defvar LaTeX-fill-newline-hook nil - "Hook run after `LaTeX-fill-newline' inserted and indented a new line.") - -(defun LaTeX-fill-region-as-paragraph (from to &optional justify-flag) - "Fill region as one paragraph. -Break lines to fit `fill-column', but leave all lines ending with -\\\\ \(plus its optional argument) alone. Lines with code -comments and lines ending with `\par' are included in filling but -act as boundaries. Prefix arg means justify too. From program, -pass args FROM, TO and JUSTIFY-FLAG." - (interactive "*r\nP") - (let ((end-marker (save-excursion (goto-char to) (point-marker)))) - (if (or (assoc (LaTeX-current-environment) LaTeX-indent-environment-list) - ;; This could be generalized, if there are more cases where - ;; a special string at the start of a region to fill should - ;; inhibit filling. - (progn (save-excursion (goto-char from) - (looking-at (concat TeX-comment-start-regexp - "+[ \t]*" - "Local Variables:"))))) - ;; Filling disabled, only do indentation. - (indent-region from to nil) - (save-restriction - (goto-char from) - (while (< (point) end-marker) - (if (re-search-forward - (concat "\\(" - ;; Code comments. - "[^\r\n%\\]\\([ \t]\\|\\\\\\\\\\)*" - TeX-comment-start-regexp - "\\|" - ;; Lines ending with `\par'. - "\\(\\=\\|[^" TeX-esc "\n]\\)\\(" - (regexp-quote (concat TeX-esc TeX-esc)) - "\\)*" - (regexp-quote TeX-esc) "par[ \t]*" - "\\({[ \t]*}\\)?[ \t]*$" - "\\)\\|\\(" - ;; Lines ending with `\\'. - (regexp-quote TeX-esc) - (regexp-quote TeX-esc) - "\\(\\s-*\\*\\)?" - "\\(\\s-*\\[[^]]*\\]\\)?" - "\\s-*$\\)") - end-marker t) - (progn - (goto-char (line-end-position)) - (delete-horizontal-space) - ;; I doubt very much if we want justify - - ;; this is a line with \\ - ;; if you think otherwise - uncomment the next line - ;; (and justify-flag (justify-current-line)) - (forward-char) - ;; keep our position in a buffer - (save-excursion - ;; Code comments and lines ending with `\par' are - ;; included in filling. Lines ending with `\\' are - ;; skipped. - (if (match-string 1) - (LaTeX-fill-region-as-para-do from (point) justify-flag) - (LaTeX-fill-region-as-para-do - from (line-beginning-position 0) justify-flag) - ;; At least indent the line ending with `\\'. - (indent-according-to-mode))) - (setq from (point))) - ;; ELSE part follows - loop termination relies on a fact - ;; that (LaTeX-fill-region-as-para-do) moves point past - ;; the filled region - (LaTeX-fill-region-as-para-do from end-marker justify-flag))))))) - -;; The content of `LaTeX-fill-region-as-para-do' was copied from the -;; function `fill-region-as-paragraph' in `fill.el' (CVS Emacs, -;; January 2004) and adapted to the needs of AUCTeX. - -(defun LaTeX-fill-region-as-para-do (from to &optional justify - nosqueeze squeeze-after) - "Fill the region defined by FROM and TO as one paragraph. -It removes any paragraph breaks in the region and extra newlines at the end, -indents and fills lines between the margins given by the -`current-left-margin' and `current-fill-column' functions. -\(In most cases, the variable `fill-column' controls the width.) -It leaves point at the beginning of the line following the paragraph. - -Normally performs justification according to the `current-justification' -function, but with a prefix arg, does full justification instead. - -From a program, optional third arg JUSTIFY can specify any type of -justification. Fourth arg NOSQUEEZE non-nil means not to make spaces -between words canonical before filling. Fifth arg SQUEEZE-AFTER, if non-nil, -means don't canonicalize spaces before that position. - -Return the `fill-prefix' used for filling. - -If `sentence-end-double-space' is non-nil, then period followed by one -space does not end a sentence, so don't break a line there." - (interactive (progn - (barf-if-buffer-read-only) - (list (region-beginning) (region-end) - (if current-prefix-arg 'full)))) - (unless (memq justify '(t nil none full center left right)) - (setq justify 'full)) - - ;; Make sure "to" is the endpoint. - (goto-char (min from to)) - (setq to (max from to)) - ;; Ignore blank lines at beginning of region. - (skip-chars-forward " \t\n") - - (let ((from-plus-indent (point)) - (oneleft nil)) - - (beginning-of-line) - (setq from (point)) - - ;; Delete all but one soft newline at end of region. - ;; And leave TO before that one. - (goto-char to) - (while (and (> (point) from) (eq ?\n (char-after (1- (point))))) - (if (and oneleft - (not (and use-hard-newlines - (get-text-property (1- (point)) 'hard)))) - (delete-backward-char 1) - (backward-char 1) - (setq oneleft t))) - (setq to (copy-marker (point) t)) - (goto-char from-plus-indent)) - - (if (not (> to (point))) - nil ;; There is no paragraph, only whitespace: exit now. - - (or justify (setq justify (current-justification))) - - ;; Don't let Adaptive Fill mode alter the fill prefix permanently. - (let ((fill-prefix fill-prefix)) - ;; Figure out how this paragraph is indented, if desired. - (when (and adaptive-fill-mode - (or (null fill-prefix) (string= fill-prefix ""))) - (setq fill-prefix (fill-context-prefix from to)) - ;; Ignore a white-space only fill-prefix - ;; if we indent-according-to-mode. - (when (and fill-prefix fill-indent-according-to-mode - (string-match "\\`[ \t]*\\'" fill-prefix)) - (setq fill-prefix nil))) - - (goto-char from) - (beginning-of-line) - - (if (not justify) ; filling disabled: just check indentation - (progn - (goto-char from) - (while (< (point) to) - (if (and (not (eolp)) - (< (LaTeX-current-indentation) (current-left-margin))) - (fill-indent-to-left-margin)) - (forward-line 1))) - - (when use-hard-newlines - (remove-text-properties from to '(hard nil))) - ;; Make sure first line is indented (at least) to left margin... - (indent-according-to-mode) - ;; COMPATIBILITY for Emacs <= 21.1 - (if (fboundp 'fill-delete-prefix) - ;; Delete the fill-prefix from every line. - (fill-delete-prefix from to fill-prefix) - ;; Delete the comment prefix and any whitespace from every - ;; line of the region in concern except the first. (The - ;; implementation is heuristic to a certain degree.) - (save-excursion - (goto-char from) - (forward-line 1) - (when (< (point) to) - (while (re-search-forward (concat "^[ \t]+\\|^[ \t]*" - TeX-comment-start-regexp - "+[ \t]*") to t) - (delete-region (match-beginning 0) (match-end 0)))))) - - (setq from (point)) - - ;; FROM, and point, are now before the text to fill, - ;; but after any fill prefix on the first line. - - (LaTeX-fill-delete-newlines from to justify nosqueeze squeeze-after) - - ;; This is the actual FILLING LOOP. - (goto-char from) - (let* (linebeg - (code-comment-start (save-excursion - (LaTeX-back-to-indentation) - (TeX-search-forward-comment-start - (line-end-position)))) - (end-marker (save-excursion - (goto-char (or code-comment-start to)) - (point-marker))) - (LaTeX-current-environment (LaTeX-current-environment))) - ;; Fill until point is greater than the end point. If there - ;; is a code comment, use the code comment's start as a - ;; limit. - (while (and (< (point) (marker-position end-marker)) - (or (not code-comment-start) - (and code-comment-start - (> (- (marker-position end-marker) - (line-beginning-position)) - fill-column)))) - (setq linebeg (point)) - (move-to-column (current-fill-column)) - (if (when (< (point) (marker-position end-marker)) - ;; Find the position where we'll break the line. - (forward-char 1) ; Use an immediately following - ; space, if any. - (LaTeX-fill-move-to-break-point linebeg) - - ;; Check again to see if we got to the end of - ;; the paragraph. - (skip-chars-forward " \t") - (< (point) (marker-position end-marker))) - ;; Found a place to cut. - (progn - (LaTeX-fill-newline) - (when justify - ;; Justify the line just ended, if desired. - (save-excursion - (forward-line -1) - (justify-current-line justify nil t)))) - - (goto-char end-marker) - ;; Justify this last line, if desired. - (if justify (justify-current-line justify t t)))) - - ;; Fill a code comment if necessary. (Enable this code if - ;; you want the comment part in lines with code comments to - ;; be filled. Originally it was disabled because the - ;; indentation code indented the lines following the line - ;; with the code comment to the column of the comment - ;; starters. That means, it would have looked like this: - ;; | code code code % comment - ;; | % comment - ;; | code code code - ;; This now (2005-07-29) is not the case anymore. But as - ;; filling code comments like this would split a single - ;; paragraph into two separate ones, we still leave it - ;; disabled. I leave the code here in case it is useful for - ;; somebody. - ;; (when (and code-comment-start - ;; (> (- (line-end-position) (line-beginning-position)) - ;; fill-column)) - ;; (LaTeX-fill-code-comment justify)) - - ;; The following is an alternative strategy to minimize the - ;; occurence of overfull lines with code comments. A line - ;; will be broken before the last non-comment word if the - ;; code comment does not fit into the line. - (when (and LaTeX-fill-break-before-code-comments - code-comment-start - (> (- (line-end-position) (line-beginning-position)) - fill-column)) - (beginning-of-line) - (goto-char end-marker) - (while (not (looking-at TeX-comment-start-regexp)) (forward-char)) - (skip-chars-backward " \t") - (skip-chars-backward "^ \t\n") - (unless (or (bolp) - ;; Comment starters and whitespace. - (TeX-looking-at-backward - (concat "^\\([ \t]*" TeX-comment-start-regexp - "+\\)+[ \t]*") - (line-beginning-position))) - (LaTeX-fill-newline))))) - ;; Leave point after final newline. - (goto-char to) - (unless (eobp) (forward-char 1)) - ;; Return the fill-prefix we used - fill-prefix))) - -;; Following lines are copied from `fill.el' (CVS Emacs, March 2005). -;; The `fill-space' property carries the string with which a newline should be -;; replaced when unbreaking a line (in fill-delete-newlines). It is added to -;; newline characters by fill-newline when the default behavior of -;; fill-delete-newlines is not what we want. -(unless (featurep 'xemacs) - ;; COMPATIBILITY for Emacs < 22.1 - (add-to-list 'text-property-default-nonsticky '(fill-space . t))) - -(defun LaTeX-fill-delete-newlines (from to justify nosqueeze squeeze-after) - ;; COMPATIBILITY for Emacs < 22.1 and XEmacs - (if (fboundp 'fill-delete-newlines) - (fill-delete-newlines from to justify nosqueeze squeeze-after) - (if (featurep 'xemacs) - (when (featurep 'mule) - (goto-char from) - (let ((unwished-newline (concat LaTeX-nospace-between-char-regexp "\n" - LaTeX-nospace-between-char-regexp))) - (while (re-search-forward unwished-newline to t) - (skip-chars-backward "^\n") - (delete-char -1)))) - ;; This else-sentence was copied from the function `fill-delete-newlines' - ;; in `fill.el' (CVS Emacs, 2005-02-17) and adapted accordingly. - (while (search-forward "\n" to t) - (if (get-text-property (match-beginning 0) 'fill-space) - (replace-match (get-text-property (match-beginning 0) 'fill-space)) - (let ((prev (char-before (match-beginning 0))) - (next (following-char))) - (when (or (aref (char-category-set next) ?|) - (aref (char-category-set prev) ?|)) - (delete-char -1)))))) - - ;; Make sure sentences ending at end of line get an extra space. - (if (or (not (boundp 'sentence-end-double-space)) - sentence-end-double-space) - (progn - (goto-char from) - (while (re-search-forward "[.?!][]})\"']*$" to t) - (insert ? )))) - ;; Then change all newlines to spaces. - (let ((point-max (progn - (goto-char to) - (skip-chars-backward "\n") - (point)))) - (subst-char-in-region from point-max ?\n ?\ )) - (goto-char from) - (skip-chars-forward " \t") - ;; Remove extra spaces between words. - (unless (and nosqueeze (not (eq justify 'full))) - (canonically-space-region (or squeeze-after (point)) to) - ;; Remove trailing whitespace. - (goto-char (line-end-position)) - (delete-char (- (skip-chars-backward " \t")))))) - -(defun LaTeX-fill-move-to-break-point (linebeg) - "Move to the position where the line should be broken." - ;; COMPATIBILITY for Emacs < 22.1 and XEmacs - (if (fboundp 'fill-move-to-break-point) - (fill-move-to-break-point linebeg) - (if (featurep 'mule) - (if (TeX-looking-at-backward - (concat LaTeX-nospace-between-char-regexp ".?") 2) - ;; Cancel `forward-char' which is called just before - ;; `LaTeX-fill-move-to-break-point' if the char before point matches - ;; `LaTeX-nospace-between-char-regexp'. - (backward-char 1) - (when (re-search-backward - (concat " \\|\n\\|" LaTeX-nospace-between-char-regexp) - linebeg 'move) - (forward-char 1))) - (skip-chars-backward "^ \n")) - ;; Prevent infinite loops: If we cannot find a place to break - ;; while searching backward, search forward again. - (when (save-excursion - (skip-chars-backward " \t%") - (bolp)) - (skip-chars-forward "^ \n" (point-max))) - ;; This code was copied from the function `fill-move-to-break-point' - ;; in `fill.el' (CVS Emacs, 2005-02-22) and adapted accordingly. - (when (and (< linebeg (point)) - ;; If we are going to break the line after or - ;; before a non-ascii character, we may have to - ;; run a special function for the charset of the - ;; character to find the correct break point. - (boundp 'enable-multibyte-characters) - enable-multibyte-characters - (fboundp 'charset-after) ; Non-MULE XEmacsen don't have this. - (not (and (eq (charset-after (1- (point))) 'ascii) - (eq (charset-after (point)) 'ascii)))) - ;; Make sure we take SOMETHING after the fill prefix if any. - (if (fboundp 'fill-find-break-point) - (fill-find-break-point linebeg) - (when (fboundp 'kinsoku-process) ;XEmacs - (kinsoku-process))))) - ;; Prevent line break between 2-byte char and 1-byte char. - (when (and (featurep 'mule) - enable-multibyte-characters - (or (and (not (looking-at LaTeX-nospace-between-char-regexp)) - (TeX-looking-at-backward - LaTeX-nospace-between-char-regexp 1)) - (and (not (TeX-looking-at-backward - LaTeX-nospace-between-char-regexp 1)) - (looking-at LaTeX-nospace-between-char-regexp))) - (re-search-backward - (concat LaTeX-nospace-between-char-regexp - LaTeX-nospace-between-char-regexp - LaTeX-nospace-between-char-regexp - "\\|" - ".\\ca\\s +\\ca") linebeg t)) - (if (looking-at "..\\c>") - (forward-char 1) - (forward-char 2))) - ;; Cater for Japanese Macro - (when (and (boundp 'japanese-TeX-mode) japanese-TeX-mode - (aref (char-category-set (char-after)) ?j) - (TeX-looking-at-backward (concat (regexp-quote TeX-esc) TeX-token-char "*") - (1- (- (point) linebeg))) - (not (TeX-escaped-p (match-beginning 0)))) - (goto-char (match-beginning 0))) - ;; Cater for \verb|...| (and similar) contructs which should not be - ;; broken. (FIXME: Make it work with shortvrb.sty (also loaded by - ;; doc.sty) where |...| is allowed. Arbitrary delimiters may be - ;; chosen with \MakeShortVerb{}.) This could probably be - ;; handled with `fill-nobreak-predicate', but this is not available - ;; in XEmacs. - (let ((final-breakpoint (point)) - (verb-macros (regexp-opt (append (LaTeX-verbatim-macros-with-delims) - (LaTeX-verbatim-macros-with-braces))))) - (save-excursion - ;; Look for the start of a verbatim macro in the current line. - (when (re-search-backward (concat (regexp-quote TeX-esc) - "\\(?:" verb-macros "\\)\\([^a-z@*]\\)") - (line-beginning-position) t) - ;; Determine start and end of verbatim macro. - (let ((beg (point)) - (end (if (not (string-match "[ [{]" (match-string 1))) - (cdr (LaTeX-verbatim-macro-boundaries)) - (TeX-find-macro-end)))) - ;; Determine if macro end is behind fill column. - (when (and end - (> (- end (line-beginning-position)) - (current-fill-column)) - (> end final-breakpoint)) - ;; Search backwards for place to break before the macro. - (goto-char beg) - (skip-chars-backward "^ \n") - ;; Determine if point ended up at the beginning of the line. - (when (save-excursion (skip-chars-backward " \t%") (bolp)) - ;; Search forward for a place to break after the macro. - (goto-char end) - (skip-chars-forward "^ \n" (point-max))) - (setq final-breakpoint (point)))))) - (goto-char final-breakpoint)) - (when LaTeX-fill-break-at-separators - (let ((orig-breakpoint (point)) - (final-breakpoint (point)) - start-point - math-sep) - (save-excursion - (beginning-of-line) - (LaTeX-back-to-indentation) - (setq start-point (point)) - ;; Find occurences of [, $, {, }, \(, \), \[, \] or $$. - (while (and (= final-breakpoint orig-breakpoint) - (TeX-re-search-forward-unescaped - (concat "[[{}]\\|\\$\\$?\\|" - (regexp-quote TeX-esc) "[][()]") - orig-breakpoint t)) - (let ((match-string (match-string 0))) - (cond - ;; [ (opening bracket) (The closing bracket should - ;; already be handled implicitely by the code for the - ;; opening brace.) - ((save-excursion - (and (memq '\[ LaTeX-fill-break-at-separators) - (string= match-string "[") - (TeX-re-search-forward-unescaped (concat "\\][ \t]*{") - (line-end-position) t) - (> (- (or (TeX-find-closing-brace) - (line-end-position)) - (line-beginning-position)) - fill-column))) - (save-excursion - (skip-chars-backward "^ \n") - (when (> (point) start-point) - (setq final-breakpoint (point))))) - ;; { (opening brace) - ((save-excursion - (and (memq '\{ LaTeX-fill-break-at-separators) - (string= match-string "{") - (> (- (save-excursion - ;; `TeX-find-closing-brace' is not enough - ;; if there is no breakpoint in form of - ;; whitespace after the brace. - (goto-char (or (TeX-find-closing-brace) - (line-end-position))) - (skip-chars-forward "^ \t\n") - (point)) - (line-beginning-position)) - fill-column))) - (save-excursion - (skip-chars-backward "^ \n") - ;; The following is a primitive and error-prone method - ;; to cope with point probably being inside square - ;; brackets. A better way would be to use functions - ;; to determine if point is inside an optional - ;; argument and to jump to the start and end brackets. - (when (save-excursion - (TeX-re-search-forward-unescaped - (concat "\\][ \t]*{") orig-breakpoint t)) - (TeX-search-backward-unescaped "[" - (line-beginning-position) t) - (skip-chars-backward "^ \n")) - (when (> (point) start-point) - (setq final-breakpoint (point))))) - ;; } (closing brace) - ((save-excursion - (and (memq '\} LaTeX-fill-break-at-separators) - (string= match-string "}") - (save-excursion - (backward-char 2) - (not (TeX-find-opening-brace - nil (line-beginning-position)))))) - (save-excursion - (skip-chars-forward "^ \n") - (when (> (point) start-point) - (setq final-breakpoint (point))))) - ;; $ or \( or \[ or $$ (opening math) - ((save-excursion - (and (or (and (memq '\\\( LaTeX-fill-break-at-separators) - (or (and (string= match-string "$") - (texmathp)) - (string= match-string "\\("))) - (and (memq '\\\[ LaTeX-fill-break-at-separators) - (or (string= match-string "\\[") - (and (string= match-string "$$") - (texmathp))))) - (> (- (save-excursion - (TeX-search-forward-unescaped - (cond ((string= match-string "\\(") - (concat TeX-esc ")")) - ((string= match-string "$") "$") - ((string= match-string "$$") "$$") - (t (concat TeX-esc "]"))) - (point-max) t) - (point)) - (line-beginning-position)) - fill-column))) - (save-excursion - (skip-chars-backward "^ \n") - (when (> (point) start-point) - (setq final-breakpoint (point))))) - ;; $ or \) or \] or $$ (closing math) - ((save-excursion - (and (or (and (memq '\\\) LaTeX-fill-break-at-separators) - (or (and (string= match-string "$") - (not (texmathp))) - (string= match-string "\\)"))) - (and (memq '\\\] LaTeX-fill-break-at-separators) - (or (string= match-string "\\]") - (and (string= match-string "$$") - (not (texmathp)))))) - (if (member match-string '("$" "$$")) - (save-excursion - (skip-chars-backward "$") - (not (TeX-search-backward-unescaped - match-string (line-beginning-position) t))) - (texmathp-match-switch (line-beginning-position))))) - (save-excursion - (skip-chars-forward "^ \n") - (when (> (point) start-point) - (setq final-breakpoint (point))))))))) - (goto-char final-breakpoint)))) - -;; The content of `LaTeX-fill-newline' was copied from the function -;; `fill-newline' in `fill.el' (CVS Emacs, January 2004) and adapted -;; to the needs of AUCTeX. -(defun LaTeX-fill-newline () - "Replace whitespace here with one newline and indent the line." - (skip-chars-backward " \t") - (newline 1) - ;; COMPATIBILITY for XEmacs - (unless (featurep 'xemacs) - ;; Give newline the properties of the space(s) it replaces - (set-text-properties (1- (point)) (point) - (text-properties-at (point))) - (and (looking-at "\\( [ \t]*\\)\\(\\c|\\)?") - (or (aref (char-category-set (or (char-before (1- (point))) ?\000)) ?|) - (match-end 2)) - ;; When refilling later on, this newline would normally not - ;; be replaced by a space, so we need to mark it specially to - ;; re-install the space when we unfill. - (put-text-property (1- (point)) (point) 'fill-space (match-string 1))) - ;; COMPATIBILITY for Emacs <= 21.3 - (when (boundp 'fill-nobreak-invisible) - ;; If we don't want breaks in invisible text, don't insert - ;; an invisible newline. - (if fill-nobreak-invisible - (remove-text-properties (1- (point)) (point) - '(invisible t))))) - ;; Insert the fill prefix. - (and fill-prefix (not (equal fill-prefix "")) - ;; Markers that were after the whitespace are now at point: insert - ;; before them so they don't get stuck before the prefix. - (insert-before-markers-and-inherit fill-prefix)) - (indent-according-to-mode) - (run-hooks 'LaTeX-fill-newline-hook)) - -(defun LaTeX-fill-paragraph (&optional justify) - "Like `fill-paragraph', but handle LaTeX comments. -If any of the current line is a comment, fill the comment or the -paragraph of it that point is in. Code comments, i.e. comments -with uncommented code preceding them in the same line, will not -be filled unless the cursor is placed on the line with the -code comment. - -If LaTeX syntax is taken into consideration during filling -depends on the value of `LaTeX-syntactic-comments'." - (interactive "P") - (if (save-excursion - (beginning-of-line) - (looking-at (concat TeX-comment-start-regexp "*[ \t]*$"))) - ;; Don't do anything if we look at an empty line and let - ;; `fill-paragraph' think we successfully filled the paragraph. - t - (let (;; Non-nil if the current line contains a comment. - has-comment - ;; Non-nil if the current line contains code and a comment. - has-code-and-comment - code-comment-start - ;; If has-comment, the appropriate fill-prefix for the comment. - comment-fill-prefix) - - ;; Figure out what kind of comment we are looking at. - (cond - ;; A line only with potential whitespace followed by a - ;; comment on it? - ((save-excursion - (beginning-of-line) - (looking-at (concat "^[ \t]*" TeX-comment-start-regexp - "\\(" TeX-comment-start-regexp "\\|[ \t]\\)*"))) - (setq has-comment t - comment-fill-prefix (TeX-match-buffer 0))) - ;; A line with some code, followed by a comment? - ((and (setq code-comment-start (save-excursion - (beginning-of-line) - (TeX-search-forward-comment-start - (line-end-position)))) - (> (point) code-comment-start) - (not (TeX-in-commented-line)) - (save-excursion - (goto-char code-comment-start) - ;; See if there is at least one non-whitespace character - ;; before the comment starts. - (re-search-backward "[^ \t\n]" (line-beginning-position) t))) - (setq has-comment t - has-code-and-comment t))) - - (cond - ;; Code comments. - (has-code-and-comment - (save-excursion - (when (>= (- code-comment-start (line-beginning-position)) - fill-column) - ;; If start of code comment is beyond fill column, fill it as a - ;; regular paragraph before it is filled as a code comment. - (let ((end-marker (save-excursion (end-of-line) (point-marker)))) - (LaTeX-fill-region-as-paragraph (line-beginning-position) - (line-beginning-position 2) - justify) - (goto-char end-marker) - (beginning-of-line))) - (LaTeX-fill-code-comment justify))) - ;; Syntax-aware filling: - ;; * `LaTeX-syntactic-comments' enabled: Everything. - ;; * `LaTeX-syntactic-comments' disabled: Uncommented code and - ;; line comments in `doctex-mode'. - ((or (or LaTeX-syntactic-comments - (and (not LaTeX-syntactic-comments) - (not has-comment))) - (and (eq major-mode 'doctex-mode) - (TeX-in-line-comment))) - (let ((fill-prefix comment-fill-prefix)) - (save-excursion - (let* ((end (progn (LaTeX-forward-paragraph) - (or (bolp) (newline 1)) - (and (eobp) (not (bolp)) (open-line 1)) - (point))) - (start - (progn - (LaTeX-backward-paragraph) - (while (and (looking-at - (concat "$\\|[ \t]+$\\|" - "[ \t]*" TeX-comment-start-regexp - "+[ \t]*$")) - (< (point) end)) - (forward-line)) - (point)))) - (LaTeX-fill-region-as-paragraph start end justify))))) - ;; Non-syntax-aware filling. - (t - (save-excursion - (save-restriction - (beginning-of-line) - (narrow-to-region - ;; Find the first line we should include in the region to fill. - (save-excursion - (while (and (zerop (forward-line -1)) - (looking-at (concat "^[ \t]*" - TeX-comment-start-regexp)))) - ;; We may have gone too far. Go forward again. - (or (looking-at (concat ".*" TeX-comment-start-regexp)) - (forward-line 1)) - (point)) - ;; Find the beginning of the first line past the region to fill. - (save-excursion - (while (progn (forward-line 1) - (looking-at (concat "^[ \t]*" - TeX-comment-start-regexp)))) - (point))) - ;; The definitions of `paragraph-start' and - ;; `paragraph-separate' will still make - ;; `forward-paragraph' and `backward-paragraph' stop at - ;; the respective (La)TeX commands. If these should be - ;; disregarded, the definitions would have to be changed - ;; accordingly. (Lines with only `%' characters on them - ;; can be paragraph boundaries.) - (let* ((paragraph-start - (concat paragraph-start "\\|" - "\\(" TeX-comment-start-regexp "\\|[ \t]\\)*$")) - (paragraph-separate - (concat paragraph-separate "\\|" - "\\(" TeX-comment-start-regexp "\\|[ \t]\\)*$")) - (fill-prefix comment-fill-prefix) - (end (progn (forward-paragraph) - (or (bolp) (newline 1)) - (point))) - (beg (progn (backward-paragraph) - (point)))) - (fill-region-as-paragraph - beg end - justify nil - (save-excursion - (goto-char beg) - (if (looking-at fill-prefix) - nil - (re-search-forward comment-start-skip nil t) - (point))))))))) - t))) - -(defun LaTeX-fill-code-comment (&optional justify-flag) - "Fill a line including code followed by a comment." - (let ((beg (line-beginning-position)) - fill-prefix code-comment-start) - (indent-according-to-mode) - (when (when (setq code-comment-start (save-excursion - (goto-char beg) - (TeX-search-forward-comment-start - (line-end-position)))) - (goto-char code-comment-start) - (while (not (looking-at TeX-comment-start-regexp)) (forward-char)) - ;; See if there is at least one non-whitespace character - ;; before the comment starts. - (save-excursion - (re-search-backward "[^ \t\n]" (line-beginning-position) t))) - (setq fill-prefix - (concat - (if indent-tabs-mode - (concat (make-string (/ (current-column) tab-width) ?\t) - (make-string (% (current-column) tab-width) ?\ )) - (make-string (current-column) ?\ )) - (progn - (looking-at (concat TeX-comment-start-regexp "+[ \t]*")) - (TeX-match-buffer 0)))) - (fill-region-as-paragraph beg (line-beginning-position 2) - justify-flag nil - (save-excursion - (goto-char beg) - (if (looking-at fill-prefix) - nil - (re-search-forward comment-start-skip nil t) - (point))))))) - -(defun LaTeX-fill-region (from to &optional justify what) - "Fill and indent the text in region from FROM to TO as LaTeX text. -Prefix arg (non-nil third arg JUSTIFY, if called from program) -means justify as well. Fourth arg WHAT is a word to be displayed when -formatting." - (interactive "*r\nP") - (save-excursion - (let ((to (set-marker (make-marker) to)) - (next-par (make-marker))) - (goto-char from) - (beginning-of-line) - (setq from (point)) - (catch 'end-of-buffer - (while (and (< (point) to)) - (message "Formatting%s ... %d%%" - (or what "") - (/ (* 100 (- (point) from)) (- to from))) - (save-excursion (LaTeX-fill-paragraph justify)) - (if (marker-position next-par) - (goto-char (marker-position next-par)) - (LaTeX-forward-paragraph)) - (when (eobp) (throw 'end-of-buffer t)) - (LaTeX-forward-paragraph) - (set-marker next-par (point)) - (LaTeX-backward-paragraph) - (while (and (not (eobp)) - (looking-at - (concat "^\\($\\|[ \t]+$\\|[ \t]*" - TeX-comment-start-regexp "+[ \t]*$\\)"))) - (forward-line 1)))) - (set-marker to nil))) - (message "Finished")) - -(defun LaTeX-find-matching-end () - "Move point to the \\end of the current environment. - -If function is called inside a comment and -`LaTeX-syntactic-comments' is enabled, try to find the -environment in commented regions with the same comment prefix." - (interactive) - (let* ((regexp (concat (regexp-quote TeX-esc) "\\(begin\\|end\\)\\b")) - (level 1) - (in-comment (TeX-in-commented-line)) - (comment-prefix (and in-comment (TeX-comment-prefix)))) - (save-excursion - (skip-chars-backward "a-zA-Z \t{") - (unless (bolp) - (backward-char 1) - (and (looking-at regexp) - (char-equal (char-after (1+ (match-beginning 0))) ?e) - (setq level 0)))) - (while (and (> level 0) (re-search-forward regexp nil t)) - (when (or (and LaTeX-syntactic-comments - (eq in-comment (TeX-in-commented-line)) - ;; If we are in a commented line, check if the - ;; prefix matches the one we started out with. - (or (not in-comment) - (string= comment-prefix (TeX-comment-prefix)))) - (and (not LaTeX-syntactic-comments) - (not (TeX-in-commented-line)))) - (if (= (char-after (1+ (match-beginning 0))) ?b) ;;begin - (setq level (1+ level)) - (setq level (1- level))))) - (if (= level 0) - (search-forward "}") - (error "Can't locate end of current environment")))) - -(defun LaTeX-find-matching-begin () - "Move point to the \\begin of the current environment. - -If function is called inside a comment and -`LaTeX-syntactic-comments' is enabled, try to find the -environment in commented regions with the same comment prefix." - (interactive) - (let* ((regexp (concat (regexp-quote TeX-esc) "\\(begin\\|end\\)\\b")) - (level 1) - (in-comment (TeX-in-commented-line)) - (comment-prefix (and in-comment (TeX-comment-prefix)))) - (skip-chars-backward "a-zA-Z \t{") - (unless (bolp) - (backward-char 1) - (and (looking-at regexp) - (char-equal (char-after (1+ (match-beginning 0))) ?b) - (setq level 0))) - (while (and (> level 0) (re-search-backward regexp nil t)) - (when (or (and LaTeX-syntactic-comments - (eq in-comment (TeX-in-commented-line)) - ;; If we are in a commented line, check if the - ;; prefix matches the one we started out with. - (or (not in-comment) - (string= comment-prefix (TeX-comment-prefix)))) - (and (not LaTeX-syntactic-comments) - (not (TeX-in-commented-line)))) - (if (= (char-after (1+ (match-beginning 0))) ?e) ;;end - (setq level (1+ level)) - (setq level (1- level))))) - (or (= level 0) - (error "Can't locate beginning of current environment")))) - -(defun LaTeX-mark-environment (&optional count) - "Set mark to end of current environment and point to the matching begin. -If prefix argument COUNT is given, mark the respective number of -enclosing environments. The command will not work properly if -there are unbalanced begin-end pairs in comments and verbatim -environments." - (interactive "p") - (setq count (if count (abs count) 1)) - (let ((cur (point)) beg end) - ;; Only change point and mark after beginning and end were found. - ;; Point should not end up in the middle of nowhere if the search fails. - (save-excursion - (dotimes (c count) (LaTeX-find-matching-end)) - (setq end (line-beginning-position 2)) - (goto-char cur) - (dotimes (c count) (LaTeX-find-matching-begin)) - (setq beg (point))) - (set-mark end) - (goto-char beg) - (TeX-activate-region))) - -(defun LaTeX-fill-environment (justify) - "Fill and indent current environment as LaTeX text." - (interactive "*P") - (save-excursion - (LaTeX-mark-environment) - (re-search-forward "{\\([^}]+\\)}") - (LaTeX-fill-region (region-beginning) (region-end) justify - (concat " environment " (TeX-match-buffer 1))))) - -(defun LaTeX-fill-section (justify) - "Fill and indent current logical section as LaTeX text." - (interactive "*P") - (save-excursion - (LaTeX-mark-section) - (re-search-forward "{\\([^}]+\\)}") - (LaTeX-fill-region (region-beginning) (region-end) justify - (concat " section " (TeX-match-buffer 1))))) - -(defun LaTeX-mark-section (&optional no-subsections) - "Set mark at end of current logical section, and point at top. -If optional argument NO-SUBSECTIONS is non-nil, mark only the -region from the current section start to the next sectioning -command. Thereby subsections are not being marked. - -If the function `outline-mark-subtree' is not available, -`LaTeX-mark-section' always behaves like this regardless of the -value of NO-SUBSECTIONS." - (interactive "P") - (if (or no-subsections - (not (fboundp 'outline-mark-subtree))) - (progn - (re-search-forward (concat "\\(" (LaTeX-outline-regexp) - "\\|\\'\\)")) - (beginning-of-line) - (push-mark (point) nil t) - (re-search-backward (concat "\\(" (LaTeX-outline-regexp) - "\\|\\`\\)"))) - (outline-mark-subtree) - (when (and (boundp 'transient-mark-mode) - transient-mark-mode - (boundp 'mark-active) - (not mark-active)) - (setq mark-active t) - (run-hooks 'activate-mark-hook))) - (TeX-activate-region)) - -(defun LaTeX-fill-buffer (justify) - "Fill and indent current buffer as LaTeX text." - (interactive "*P") - (save-excursion - (LaTeX-fill-region - (point-min) - (point-max) - justify - (concat " buffer " (buffer-name))))) - - -;;; Navigation - -(defvar LaTeX-paragraph-commands-internal - '("[" "]" ; display math - "appendix" "begin" "caption" "chapter" "end" "include" "includeonly" - "label" "maketitle" "noindent" "par" "paragraph" "part" "section" - "subsection" "subsubsection" "tableofcontents") - "Internal list of LaTeX macros that should have their own line.") - -(defun LaTeX-paragraph-commands-regexp-make () - "Return a regular expression matching defined paragraph commands." - (concat (regexp-quote TeX-esc) "\\(" - (regexp-opt (append LaTeX-paragraph-commands - LaTeX-paragraph-commands-internal)) "\\)")) - -(defcustom LaTeX-paragraph-commands nil - "List of LaTeX macros that should have their own line. -The list should contain macro names without the leading backslash." - :group 'LaTeX-macro - :type '(repeat (string)) - :set (lambda (symbol value) - (set-default symbol value) - (setq LaTeX-paragraph-commands-regexp - (LaTeX-paragraph-commands-regexp-make)))) - -(defvar LaTeX-paragraph-commands-regexp (LaTeX-paragraph-commands-regexp-make) - "Regular expression matching LaTeX macros that should have their own line.") - -(defun LaTeX-set-paragraph-start () - "Set `paragraph-start'." - (setq paragraph-start - (concat - "[ \t]*%*[ \t]*\\(" - LaTeX-paragraph-commands-regexp "\\|" - (regexp-quote TeX-esc) "\\(" LaTeX-item-regexp "\\)\\|" - "\\$\\$\\|" ; Plain TeX display math (Some people actually - ; use this with LaTeX. Yuck.) - "$\\)"))) - -(defun LaTeX-paragraph-commands-add-locally (commands) - "Make COMMANDS be recognized as paragraph commands. -COMMANDS can be a single string or a list of strings which will -be added to `LaTeX-paragraph-commands-internal'. Additionally -`LaTeX-paragraph-commands-regexp' will be updated and both -variables will be made buffer-local. This is mainly a -convenience function which can be used in style files." - (make-local-variable 'LaTeX-paragraph-commands-internal) - (make-local-variable 'LaTeX-paragraph-commands-regexp) - (unless (listp commands) (setq commands (list commands))) - (dolist (elt commands) - (add-to-list 'LaTeX-paragraph-commands-internal elt)) - (setq LaTeX-paragraph-commands-regexp (LaTeX-paragraph-commands-regexp-make)) - (LaTeX-set-paragraph-start)) - -(defun LaTeX-forward-paragraph (&optional count) - "Move forward to end of paragraph. -If COUNT is non-nil, do it COUNT times." - (or count (setq count 1)) - (dotimes (i count) - (let* ((macro-start (TeX-find-macro-start)) - (paragraph-command-start - (cond - ;; Point is inside of a paragraph command. - ((and macro-start - (save-excursion - (goto-char macro-start) - (looking-at LaTeX-paragraph-commands-regexp))) - (match-beginning 0)) - ;; Point is before a paragraph command in the same line. - ((looking-at - (concat "[ \t]*\\(?:" TeX-comment-start-regexp - "\\(?:" TeX-comment-start-regexp "\\|[ \t]\\)*\\)?" - "\\(" LaTeX-paragraph-commands-regexp "\\)")) - (match-beginning 1)))) - macro-end) - ;; If a paragraph command is encountered there are two cases to be - ;; distinguished: - ;; 1) If the end of the paragraph command coincides (apart from - ;; potential whitespace) with the end of the line, is only - ;; followed by a comment or is directly followed by a macro, - ;; it is assumed that it should be handled separately. - ;; 2) If the end of the paragraph command is followed by other - ;; code, it is assumed that it should be included with the rest - ;; of the paragraph. - (if (and paragraph-command-start - (save-excursion - (goto-char paragraph-command-start) - (setq macro-end (goto-char (TeX-find-macro-end))) - (looking-at (concat (regexp-quote TeX-esc) "[@A-Za-z]+\\|" - "[ \t]*\\($\\|" - TeX-comment-start-regexp "\\)")))) - (progn - (goto-char macro-end) - ;; If the paragraph command is followed directly by - ;; another macro, regard the latter as part of the - ;; paragraph command's paragraph. - (when (looking-at (concat (regexp-quote TeX-esc) "[@A-Za-z]+")) - (goto-char (TeX-find-macro-end))) - (forward-line)) - (let (limit) - (goto-char (min (save-excursion - (forward-paragraph) - (setq limit (point))) - (save-excursion - (TeX-forward-comment-skip 1 limit) - (point))))))))) - -(defun LaTeX-backward-paragraph (&optional count) - "Move backward to beginning of paragraph. -If COUNT is non-nil, do it COUNT times." - (or count (setq count 1)) - (dotimes (i count) - (let* ((macro-start (TeX-find-macro-start))) - (if (and macro-start - ;; Point really has to be inside of the macro, not before it. - (not (= macro-start (point))) - (save-excursion - (goto-char macro-start) - (looking-at LaTeX-paragraph-commands-regexp))) - ;; Point is inside of a paragraph command. - (progn - (goto-char macro-start) - (beginning-of-line)) - (let (limit - (start (line-beginning-position))) - (goto-char - (max (save-excursion - (backward-paragraph) - (setq limit (point))) - ;; Search for possible transitions from commented to - ;; uncommented regions and vice versa. - (save-excursion - (TeX-backward-comment-skip 1 limit) - (point)) - ;; Search for paragraph commands. - (save-excursion - (let ((end-point 0) macro-bol) - (when (setq macro-bol - (re-search-backward - (format "^[ \t]*%s*[ \t]*\\(%s\\)" - TeX-comment-start-regexp - LaTeX-paragraph-commands-regexp) - limit t)) - (if (and (string= (match-string 1) "\\begin") - (progn - (goto-char (match-end 1)) - (skip-chars-forward "{ \t") - (member (buffer-substring-no-properties - (point) (progn (skip-chars-forward - "A-Za-z*") (point))) - LaTeX-verbatim-environments))) - ;; If inside a verbatim environment, just - ;; use the next line. In such environments - ;; `TeX-find-macro-end' could otherwise - ;; think brackets or braces belong to the - ;; \begin macro. - (setq end-point (line-beginning-position 2)) - ;; Jump to the macro end otherwise. - (goto-char (match-beginning 1)) - (goto-char (TeX-find-macro-end)) - ;; For an explanation of this distinction see - ;; `LaTeX-forward-paragraph'. - (if (looking-at (concat (regexp-quote TeX-esc) - "[@A-Za-z]+\\|[ \t]*\\($\\|" - TeX-comment-start-regexp "\\)")) - (progn - (when (string= (buffer-substring-no-properties - (point) (+ (point) - (length TeX-esc))) - TeX-esc) - (goto-char (TeX-find-macro-end))) - (forward-line 1) - (when (< (point) start) - (setq end-point (point)))) - (setq end-point macro-bol)))) - end-point))))))))) - -(defun LaTeX-search-forward-comment-start (&optional limit) - "Search forward for a comment start from current position till LIMIT. -If LIMIT is omitted, search till the end of the buffer. - -This function makes sure that any comment starters found inside -of verbatim constructs are not considered." - (setq limit (or limit (point-max))) - (save-excursion - (let (start) - (catch 'found - (while (progn - (when (and (TeX-re-search-forward-unescaped - TeX-comment-start-regexp limit 'move) - (not (LaTeX-verbatim-p))) - (setq start (match-beginning 0)) - (throw 'found t)) - (< (point) limit)))) - start))) - - -;;; Math Minor Mode - -(defgroup LaTeX-math nil - "Mathematics in AUCTeX." - :group 'LaTeX-macro) - -(defcustom LaTeX-math-list nil - "Alist of your personal LaTeX math symbols. - -Each entry should be a list with up to four elements, KEY, VALUE, -MENU and CHARACTER. - -KEY is the key (after `LaTeX-math-abbrev-prefix') to be redefined -in math minor mode. If KEY is nil, the symbol has no associated -keystroke \(it is available in the menu, though\). - -VALUE can be a string with the name of the macro to be inserted, -or a function to be called. The macro must be given without the -leading backslash. - -The third element MENU is the name of the submenu where the -command should be added. MENU can be either a string -\(e.g. \"greek\"\), a list (e.g. \(\"AMS\" \"Delimiters\"\)\) or -nil. If MENU is nil, no menu item will be created. - -The fourth element CHARACTER is a Unicode character position for -menu display. When nil, no character is shown. - -See also `LaTeX-math-menu'." - :group 'LaTeX-math - :type '(repeat (group (choice :tag "Key" - (const :tag "none" nil) - (choice (character) - (string :tag "Key sequence"))) - (choice :tag "Value" - (string :tag "Macro") - (function)) - (choice :tag "Menu" - (string :tag "Top level menu" ) - (repeat :tag "Submenu" - (string :tag "Menu"))) - (choice :tag "Unicode character" - (const :tag "none" nil) - (integer :tag "Number"))))) - -(defconst LaTeX-math-default - '((?a "alpha" "Greek Lowercase" 945) ;; #X03B1 - (?b "beta" "Greek Lowercase" 946) ;; #X03B2 - (?g "gamma" "Greek Lowercase" 947) ;; #X03B3 - (?d "delta" "Greek Lowercase" 948) ;; #X03B4 - (?e "epsilon" "Greek Lowercase" 1013) ;; #X03F5 - (?z "zeta" "Greek Lowercase" 950) ;; #X03B6 - (?h "eta" "Greek Lowercase" 951) ;; #X03B7 - (?j "theta" "Greek Lowercase" 952) ;; #X03B8 - (nil "iota" "Greek Lowercase" 953) ;; #X03B9 - (?k "kappa" "Greek Lowercase" 954) ;; #X03BA - (?l "lambda" "Greek Lowercase" 955) ;; #X03BB - (?m "mu" "Greek Lowercase" 956) ;; #X03BC - (?n "nu" "Greek Lowercase" 957) ;; #X03BD - (?x "xi" "Greek Lowercase" 958) ;; #X03BE - (?p "pi" "Greek Lowercase" 960) ;; #X03C0 - (?r "rho" "Greek Lowercase" 961) ;; #X03C1 - (?s "sigma" "Greek Lowercase" 963) ;; #X03C3 - (?t "tau" "Greek Lowercase" 964) ;; #X03C4 - (?u "upsilon" "Greek Lowercase" 965) ;; #X03C5 - (?f "phi" "Greek Lowercase" 981) ;; #X03D5 - (?q "chi" "Greek Lowercase" 967) ;; #X03C7 - (?y "psi" "Greek Lowercase" 968) ;; #X03C8 - (?w "omega" "Greek Lowercase" 969) ;; #X03C9 - ("v e" "varepsilon" "Greek Lowercase" 949) ;; #X03B5 - ("v j" "vartheta" "Greek Lowercase" 977) ;; #X03D1 - ("v p" "varpi" "Greek Lowercase" 982) ;; #X03D6 - ("v r" "varrho" "Greek Lowercase" 1009) ;; #X03F1 - ("v s" "varsigma" "Greek Lowercase" 962) ;; #X03C2 - ("v f" "varphi" "Greek Lowercase" 966) ;; #X03C6 - (?G "Gamma" "Greek Uppercase" 915) ;; #X0393 - (?D "Delta" "Greek Uppercase" 916) ;; #X0394 - (?J "Theta" "Greek Uppercase" 920) ;; #X0398 - (?L "Lambda" "Greek Uppercase" 923) ;; #X039B - (?X "Xi" "Greek Uppercase" 926) ;; #X039E - (?P "Pi" "Greek Uppercase" 928) ;; #X03A0 - (?S "Sigma" "Greek Uppercase" 931) ;; #X03A3 - (?U "Upsilon" "Greek Uppercase" 978) ;; #X03D2 - (?F "Phi" "Greek Uppercase" 934) ;; #X03A6 - (?Y "Psi" "Greek Uppercase" 936) ;; #X03A8 - (?W "Omega" "Greek Uppercase" 937) ;; #X03A9 - (?c LaTeX-math-cal "Cal-whatever") - (nil "pm" "Binary Op" 177) ;; #X00B1 - (nil "mp" "Binary Op" 8723) ;; #X2213 - (?* "times" "Binary Op" 215) ;; #X00D7 - (nil "div" "Binary Op" 247) ;; #X00F7 - (nil "ast" "Binary Op" 8727) ;; #X2217 - (nil "star" "Binary Op" 8902) ;; #X22C6 - (nil "circ" "Binary Op" 8728) ;; #X2218 - (nil "bullet" "Binary Op" 8729) ;; #X2219 - (?. "cdot" "Binary Op" 8901) ;; #X22C5 - (?- "cap" "Binary Op" 8745) ;; #X2229 - (?+ "cup" "Binary Op" 8746) ;; #X222A - (nil "uplus" "Binary Op" 8846) ;; #X228E - (nil "sqcap" "Binary Op" 8851) ;; #X2293 - (?| "vee" "Binary Op" 8744) ;; #X2228 - (?& "wedge" "Binary Op" 8743) ;; #X2227 - (?\\ "setminus" "Binary Op" 8726) ;; #X2216 - (nil "wr" "Binary Op" 8768) ;; #X2240 - (nil "diamond" "Binary Op" 8900) ;; #X22C4 - (nil "bigtriangleup" "Binary Op" 9651) ;; #X25B3 - (nil "bigtriangledown" "Binary Op" 9661) ;; #X25BD - (nil "triangleleft" "Binary Op" 9665) ;; #X25C1 - (nil "triangleright" "Binary Op" 9655) ;; #X25B7 - (nil "lhd" "Binary Op") - (nil "rhd" "Binary Op") - (nil "unlhd" "Binary Op") - (nil "unrhd" "Binary Op") - (nil "oplus" "Binary Op" 8853) ;; #X2295 - (nil "ominus" "Binary Op" 8854) ;; #X2296 - (nil "otimes" "Binary Op" 8855) ;; #X2297 - (nil "oslash" "Binary Op" 8709) ;; #X2205 - (nil "odot" "Binary Op" 8857) ;; #X2299 - (nil "bigcirc" "Binary Op" 9675) ;; #X25CB - (nil "dagger" "Binary Op" 8224) ;; #X2020 - (nil "ddagger" "Binary Op" 8225) ;; #X2021 - (nil "amalg" "Binary Op" 10815) ;; #X2A3F - (?< "leq" "Relational" 8804) ;; #X2264 - (?> "geq" "Relational" 8805) ;; #X2265 - (nil "qed" "Relational" 8718) ;; #X220E - (nil "equiv" "Relational" 8801) ;; #X2261 - (nil "models" "Relational" 8871) ;; #X22A7 - (nil "prec" "Relational" 8826) ;; #X227A - (nil "succ" "Relational" 8827) ;; #X227B - (nil "sim" "Relational" 8764) ;; #X223C - (nil "perp" "Relational" 10178) ;; #X27C2 - (nil "preceq" "Relational" 10927) ;; #X2AAF - (nil "succeq" "Relational" 10928) ;; #X2AB0 - (nil "simeq" "Relational" 8771) ;; #X2243 - (nil "mid" "Relational" 8739) ;; #X2223 - (nil "ll" "Relational" 8810) ;; #X226A - (nil "gg" "Relational" 8811) ;; #X226B - (nil "asymp" "Relational" 8781) ;; #X224D - (nil "parallel" "Relational" 8741) ;; #X2225 - (?\{ "subset" "Relational" 8834) ;; #X2282 - (?\} "supset" "Relational" 8835) ;; #X2283 - (nil "approx" "Relational" 8776) ;; #X2248 - (nil "bowtie" "Relational" 8904) ;; #X22C8 - (?\[ "subseteq" "Relational" 8838) ;; #X2286 - (?\] "supseteq" "Relational" 8839) ;; #X2287 - (nil "cong" "Relational" 8773) ;; #X2245 - (nil "Join" "Relational" 10781) ;; #X2A1D - (nil "sqsubset" "Relational" 8847) ;; #X228F - (nil "sqsupset" "Relational" 8848) ;; #X2290 - (nil "neq" "Relational" 8800) ;; #X2260 - (nil "smile" "Relational" 8995) ;; #X2323 - (nil "sqsubseteq" "Relational" 8849) ;; #X2291 - (nil "sqsupseteq" "Relational" 8850) ;; #X2292 - (nil "doteq" "Relational" 8784) ;; #X2250 - (nil "frown" "Relational" 8994) ;; #X2322 - (?i "in" "Relational" 8712) ;; #X2208 - (nil "ni" "Relational" 8715) ;; #X220B - (nil "propto" "Relational" 8733) ;; #X221D - (nil "vdash" "Relational" 8866) ;; #X22A2 - (nil "dashv" "Relational" 8867) ;; #X22A3 - (?\C-b "leftarrow" "Arrows" 8592) ;; #X2190 - (nil "Leftarrow" "Arrows" 8656) ;; #X21D0 - (?\C-f "rightarrow" "Arrows" 8594) ;; #X2192 - (nil "Rightarrow" "Arrows" 8658) ;; #X21D2 - (nil "leftrightarrow" "Arrows" 8596) ;; #X2194 - (nil "Leftrightarrow" "Arrows" 8660) ;; #X21D4 - (nil "mapsto" "Arrows" 8614) ;; #X21A6 - (nil "hookleftarrow" "Arrows" 8617) ;; #X21A9 - (nil "leftharpoonup" "Arrows" 8636) ;; #X21BC - (nil "leftharpoondown" "Arrows" 8637) ;; #X21BD - (nil "longleftarrow" "Arrows" 10229) ;; #X27F5 - (nil "Longleftarrow" "Arrows" 10232) ;; #X27F8 - (nil "longrightarrow" "Arrows" 10230) ;; #X27F6 - (nil "Longrightarrow" "Arrows" 10233) ;; #X27F9 - (nil "longleftrightarrow" "Arrows" 10231) ;; #X27F7 - (nil "Longleftrightarrow" "Arrows" 10234) ;; #X27FA - (nil "longmapsto" "Arrows" 10236) ;; #X27FC - (nil "hookrightarrow" "Arrows" 8618) ;; #X21AA - (nil "rightharpoonup" "Arrows" 8640) ;; #X21C0 - (nil "rightharpoondown" "Arrows" 8641) ;; #X21C1 - (?\C-p "uparrow" "Arrows" 8593) ;; #X2191 - (nil "Uparrow" "Arrows" 8657) ;; #X21D1 - (?\C-n "downarrow" "Arrows" 8595) ;; #X2193 - (nil "Downarrow" "Arrows" 8659) ;; #X21D3 - (nil "updownarrow" "Arrows" 8597) ;; #X2195 - (nil "Updownarrow" "Arrows" 8661) ;; #X21D5 - (nil "nearrow" "Arrows" 8599) ;; #X2197 - (nil "searrow" "Arrows" 8600) ;; #X2198 - (nil "swarrow" "Arrows" 8601) ;; #X2199 - (nil "nwarrow" "Arrows" 8598) ;; #X2196 - (nil "ldots" "Punctuation" 8230) ;; #X2026 - (nil "cdots" "Punctuation" 8943) ;; #X22EF - (nil "vdots" "Punctuation" 8942) ;; #X22EE - (nil "ddots" "Punctuation" 8945) ;; #X22F1 - (?: "colon" "Punctuation" 58) ;; #X003A - (?N "nabla" "Misc Symbol" 8711) ;; #X2207 - (nil "aleph" "Misc Symbol" 8501) ;; #X2135 - (nil "prime" "Misc Symbol" 8242) ;; #X2032 - (?A "forall" "Misc Symbol" 8704) ;; #X2200 - (?I "infty" "Misc Symbol" 8734) ;; #X221E - (nil "hbar" "Misc Symbol" 8463) ;; #X210F - (?0 "emptyset" "Misc Symbol" 8709) ;; #X2205 - (?E "exists" "Misc Symbol" 8707) ;; #X2203 - (nil "surd" "Misc Symbol" 8730) ;; #X221A - (nil "Box" "Misc Symbol") - (nil "triangle" "Misc Symbol" 9651) ;; #X25B3 - (nil "Diamond" "Misc Symbol") - (nil "imath" "Misc Symbol" 305) ;; #X0131 - (nil "jmath" "Misc Symbol" 120485) ;; #X1D6A5 - (nil "ell" "Misc Symbol" 8467) ;; #X2113 - (nil "neg" "Misc Symbol" 172) ;; #X00AC - (?/ "not" "Misc Symbol" 824) ;; #X0338 - (nil "top" "Misc Symbol" 8868) ;; #X22A4 - (nil "flat" "Misc Symbol" 9837) ;; #X266D - (nil "natural" "Misc Symbol" 9838) ;; #X266E - (nil "sharp" "Misc Symbol" 9839) ;; #X266F - (nil "wp" "Misc Symbol" 8472) ;; #X2118 - (nil "bot" "Misc Symbol" 8869) ;; #X22A5 - (nil "clubsuit" "Misc Symbol" 9827) ;; #X2663 - (nil "diamondsuit" "Misc Symbol" 9826) ;; #X2662 - (nil "heartsuit" "Misc Symbol" 9825) ;; #X2661 - (nil "spadesuit" "Misc Symbol" 9824) ;; #X2660 - (nil "mho" "Misc Symbol" 8487) ;; #X2127 - (nil "Re" "Misc Symbol" 8476) ;; #X211C - (nil "Im" "Misc Symbol" 8465) ;; #X2111 - (nil "angle" "Misc Symbol" 8736) ;; #X2220 - (nil "partial" "Misc Symbol" 8706) ;; #X2202 - (nil "sum" "Var Symbol" 8721) ;; #X2211 - (nil "prod" "Var Symbol" 8719) ;; #X220F - (nil "coprod" "Var Symbol" 8720) ;; #X2210 - (nil "int" "Var Symbol" 8747) ;; #X222B - (nil "oint" "Var Symbol" 8750) ;; #X222E - (nil "bigcap" "Var Symbol" 8898) ;; #X22C2 - (nil "bigcup" "Var Symbol" 8899) ;; #X22C3 - (nil "bigsqcup" "Var Symbol" 10758) ;; #X2A06 - (nil "bigvee" "Var Symbol" 8897) ;; #X22C1 - (nil "bigwedge" "Var Symbol" 8896) ;; #X22C0 - (nil "bigodot" "Var Symbol" 10752) ;; #X2A00 - (nil "bigotimes" "Var Symbol" 10754) ;; #X2A02 - (nil "bigoplus" "Var Symbol" 10753) ;; #X2A01 - (nil "biguplus" "Var Symbol" 10756) ;; #X2A04 - (nil "arccos" "Log-like") - (nil "arcsin" "Log-like") - (nil "arctan" "Log-like") - (nil "arg" "Log-like") - (?\C-c "cos" "Log-like") - (nil "cosh" "Log-like") - (nil "cot" "Log-like") - (nil "coth" "Log-like") - (nil "csc" "Log-like") - (nil "deg" "Log-like") - (?\C-d "det" "Log-like") - (nil "dim" "Log-like") - (?\C-e "exp" "Log-like") - (nil "gcd" "Log-like") - (nil "hom" "Log-like") - (?\C-_ "inf" "Log-like") - (nil "ker" "Log-like") - (nil "lg" "Log-like") - (?\C-l "lim" "Log-like") - (nil "liminf" "Log-like") - (nil "limsup" "Log-like") - (nil "ln" "Log-like") - (nil "log" "Log-like") - (nil "max" "Log-like") - (nil "min" "Log-like") - (nil "Pr" "Log-like") - (nil "sec" "Log-like") - (?\C-s "sin" "Log-like") - (nil "sinh" "Log-like") - (?\C-^ "sup" "Log-like") - (?\C-t "tan" "Log-like") - (nil "tanh" "Log-like") - (nil "{" "Delimiters") - (nil "}" "Delimiters") - (nil "lfloor" "Delimiters" 8970) ;; #X230A - (nil "rfloor" "Delimiters" 8971) ;; #X230B - (nil "lceil" "Delimiters" 8968) ;; #X2308 - (nil "rceil" "Delimiters" 8969) ;; #X2309 - (?\( "langle" "Delimiters" 10216) ;; #X27E8 - (?\) "rangle" "Delimiters" 10217) ;; #X27E9 - (nil "rmoustache" "Delimiters" 9137) ;; #X23B1 - (nil "lmoustache" "Delimiters" 9136) ;; #X23B0 - (nil "rgroup" "Delimiters") - (nil "lgroup" "Delimiters") - (nil "backslash" "Delimiters" 92) ;; #X005C - (nil "|" "Delimiters") - (nil "arrowvert" "Delimiters") - (nil "Arrowvert" "Delimiters") - (nil "bracevert" "Delimiters") - (nil "widetilde" "Constructs" 771) ;; #X0303 - (nil "widehat" "Constructs" 770) ;; #X0302 - (nil "overleftarrow" "Constructs" 8406) ;; #X20D6 - (nil "overrightarrow" "Constructs") - (nil "overline" "Constructs") - (nil "underline" "Constructs") - (nil "overbrace" "Constructs" 65079) ;; #XFE37 - (nil "underbrace" "Constructs" 65080) ;; #XFE38 - (nil "sqrt" "Constructs" 8730) ;; #X221A - (nil "frac" "Constructs") - (?^ "hat" "Accents" 770) ;; #X0302 - (nil "acute" "Accents" 769) ;; #X0301 - (nil "bar" "Accents" 772) ;; #X0304 - (nil "dot" "Accents" 775) ;; #X0307 - (nil "breve" "Accents" 774) ;; #X0306 - (nil "check" "Accents" 780) ;; #X030C - (nil "grave" "Accents" 768) ;; #X0300 - (nil "vec" "Accents" 8407) ;; #X20D7 - (nil "ddot" "Accents" 776) ;; #X0308 - (?~ "tilde" "Accents" 771) ;; #X0303 - (nil "digamma" ("AMS" "Hebrew") 989) ;; #X03DD - (nil "varkappa" ("AMS" "Hebrew") 1008) ;; #X03F0 - (nil "beth" ("AMS" "Hebrew") 8502) ;; #X2136 - (nil "daleth" ("AMS" "Hebrew") 8504) ;; #X2138 - (nil "gimel" ("AMS" "Hebrew") 8503) ;; #X2137 - ("v G" "varGamma" ("AMS" "Greek Uppercase")) - ("v D" "varDelta" ("AMS" "Greek Uppercase")) - ("v J" "varTheta" ("AMS" "Greek Uppercase")) - ("v L" "varLambda" ("AMS" "Greek Uppercase")) - ("v X" "varXi" ("AMS" "Greek Uppercase")) - ("v P" "varPi" ("AMS" "Greek Uppercase")) - ("v S" "varSigma" ("AMS" "Greek Uppercase")) - ("v U" "varUpsilon" ("AMS" "Greek Uppercase")) - ("v F" "varPhi" ("AMS" "Greek Uppercase")) - ("v Y" "varPsi" ("AMS" "Greek Uppercase")) - ("v W" "varOmega" ("AMS" "Greek Uppercase")) - (nil "dashrightarrow" ("AMS" "Arrows")) - (nil "dashleftarrow" ("AMS" "Arrows")) - (nil "leftleftarrows" ("AMS" "Arrows") 8647) ;; #X21C7 - (nil "leftrightarrows" ("AMS" "Arrows") 8646) ;; #X21C6 - (nil "Lleftarrow" ("AMS" "Arrows") 8666) ;; #X21DA - (nil "twoheadleftarrow" ("AMS" "Arrows") 8606) ;; #X219E - (nil "leftarrowtail" ("AMS" "Arrows") 8610) ;; #X21A2 - (nil "looparrowleft" ("AMS" "Arrows") 8619) ;; #X21AB - (nil "leftrightharpoons" ("AMS" "Arrows") 8651) ;; #X21CB - (nil "curvearrowleft" ("AMS" "Arrows") 8630) ;; #X21B6 - (nil "circlearrowleft" ("AMS" "Arrows")) - (nil "Lsh" ("AMS" "Arrows") 8624) ;; #X21B0 - (nil "upuparrows" ("AMS" "Arrows") 8648) ;; #X21C8 - (nil "upharpoonleft" ("AMS" "Arrows") 8639) ;; #X21BF - (nil "downharpoonleft" ("AMS" "Arrows") 8643) ;; #X21C3 - (nil "multimap" ("AMS" "Arrows") 8888) ;; #X22B8 - (nil "leftrightsquigarrow" ("AMS" "Arrows") 8621) ;; #X21AD - (nil "looparrowright" ("AMS" "Arrows") 8620) ;; #X21AC - (nil "rightleftharpoons" ("AMS" "Arrows") 8652) ;; #X21CC - (nil "curvearrowright" ("AMS" "Arrows") 8631) ;; #X21B7 - (nil "circlearrowright" ("AMS" "Arrows")) - (nil "Rsh" ("AMS" "Arrows") 8625) ;; #X21B1 - (nil "downdownarrows" ("AMS" "Arrows") 8650) ;; #X21CA - (nil "upharpoonright" ("AMS" "Arrows") 8638) ;; #X21BE - (nil "downharpoonright" ("AMS" "Arrows") 8642) ;; #X21C2 - (nil "rightsquigarrow" ("AMS" "Arrows") 8605) ;; #X219D - (nil "nleftarrow" ("AMS" "Neg Arrows") 8602) ;; #X219A - (nil "nrightarrow" ("AMS" "Neg Arrows") 8603) ;; #X219B - (nil "nLeftarrow" ("AMS" "Neg Arrows") 8653) ;; #X21CD - (nil "nRightarrow" ("AMS" "Neg Arrows") 8655) ;; #X21CF - (nil "nleftrightarrow" ("AMS" "Neg Arrows") 8622) ;; #X21AE - (nil "nLeftrightarrow" ("AMS" "Neg Arrows") 8654) ;; #X21CE - (nil "leqq" ("AMS" "Relational I") 8806) ;; #X2266 - (nil "leqslant" ("AMS" "Relational I") 10877) ;; #X2A7D - (nil "eqslantless" ("AMS" "Relational I") 10901) ;; #X2A95 - (nil "lesssim" ("AMS" "Relational I") 8818) ;; #X2272 - (nil "lessapprox" ("AMS" "Relational I") 10885) ;; #X2A85 - (nil "approxeq" ("AMS" "Relational I") 8778) ;; #X224A - (nil "lessdot" ("AMS" "Relational I") 8918) ;; #X22D6 - (nil "lll" ("AMS" "Relational I") 8920) ;; #X22D8 - (nil "lessgtr" ("AMS" "Relational I") 8822) ;; #X2276 - (nil "lesseqgtr" ("AMS" "Relational I") 8922) ;; #X22DA - (nil "lesseqqgtr" ("AMS" "Relational I") 10891) ;; #X2A8B - (nil "doteqdot" ("AMS" "Relational I")) - (nil "risingdotseq" ("AMS" "Relational I") 8787) ;; #X2253 - (nil "fallingdotseq" ("AMS" "Relational I") 8786) ;; #X2252 - (nil "backsim" ("AMS" "Relational I") 8765) ;; #X223D - (nil "backsimeq" ("AMS" "Relational I") 8909) ;; #X22CD - (nil "subseteqq" ("AMS" "Relational I") 10949) ;; #X2AC5 - (nil "Subset" ("AMS" "Relational I") 8912) ;; #X22D0 - (nil "sqsubset" ("AMS" "Relational I") 8847) ;; #X228F - (nil "preccurlyeq" ("AMS" "Relational I") 8828) ;; #X227C - (nil "curlyeqprec" ("AMS" "Relational I") 8926) ;; #X22DE - (nil "precsim" ("AMS" "Relational I") 8830) ;; #X227E - (nil "precapprox" ("AMS" "Relational I") 10935) ;; #X2AB7 - (nil "vartriangleleft" ("AMS" "Relational I") 8882) ;; #X22B2 - (nil "trianglelefteq" ("AMS" "Relational I") 8884) ;; #X22B4 - (nil "vDash" ("AMS" "Relational I") 8872) ;; #X22A8 - (nil "Vvdash" ("AMS" "Relational I") 8874) ;; #X22AA - (nil "smallsmile" ("AMS" "Relational I") 8995) ;; #X2323 - (nil "smallfrown" ("AMS" "Relational I") 8994) ;; #X2322 - (nil "bumpeq" ("AMS" "Relational I") 8783) ;; #X224F - (nil "Bumpeq" ("AMS" "Relational I") 8782) ;; #X224E - (nil "geqq" ("AMS" "Relational II") 8807) ;; #X2267 - (nil "geqslant" ("AMS" "Relational II") 10878) ;; #X2A7E - (nil "eqslantgtr" ("AMS" "Relational II") 10902) ;; #X2A96 - (nil "gtrsim" ("AMS" "Relational II") 8819) ;; #X2273 - (nil "gtrapprox" ("AMS" "Relational II") 10886) ;; #X2A86 - (nil "gtrdot" ("AMS" "Relational II") 8919) ;; #X22D7 - (nil "ggg" ("AMS" "Relational II") 8921) ;; #X22D9 - (nil "gtrless" ("AMS" "Relational II") 8823) ;; #X2277 - (nil "gtreqless" ("AMS" "Relational II") 8923) ;; #X22DB - (nil "gtreqqless" ("AMS" "Relational II") 10892) ;; #X2A8C - (nil "eqcirc" ("AMS" "Relational II") 8790) ;; #X2256 - (nil "circeq" ("AMS" "Relational II") 8791) ;; #X2257 - (nil "triangleq" ("AMS" "Relational II") 8796) ;; #X225C - (nil "thicksim" ("AMS" "Relational II") 8764) ;; #X223C - (nil "thickapprox" ("AMS" "Relational II") 8776) ;; #X2248 - (nil "supseteqq" ("AMS" "Relational II") 10950) ;; #X2AC6 - (nil "Supset" ("AMS" "Relational II") 8913) ;; #X22D1 - (nil "sqsupset" ("AMS" "Relational II") 8848) ;; #X2290 - (nil "succcurlyeq" ("AMS" "Relational II") 8829) ;; #X227D - (nil "curlyeqsucc" ("AMS" "Relational II") 8927) ;; #X22DF - (nil "succsim" ("AMS" "Relational II") 8831) ;; #X227F - (nil "succapprox" ("AMS" "Relational II") 10936) ;; #X2AB8 - (nil "vartriangleright" ("AMS" "Relational II") 8883) ;; #X22B3 - (nil "trianglerighteq" ("AMS" "Relational II") 8885) ;; #X22B5 - (nil "Vdash" ("AMS" "Relational II") 8873) ;; #X22A9 - (nil "shortmid" ("AMS" "Relational II") 8739) ;; #X2223 - (nil "shortparallel" ("AMS" "Relational II") 8741) ;; #X2225 - (nil "between" ("AMS" "Relational II") 8812) ;; #X226C - (nil "pitchfork" ("AMS" "Relational II") 8916) ;; #X22D4 - (nil "varpropto" ("AMS" "Relational II") 8733) ;; #X221D - (nil "blacktriangleleft" ("AMS" "Relational II") 9664) ;; #X25C0 - (nil "therefore" ("AMS" "Relational II") 8756) ;; #X2234 - (nil "backepsilon" ("AMS" "Relational II") 1014) ;; #X03F6 - (nil "blacktriangleright" ("AMS" "Relational II") 9654) ;; #X25B6 - (nil "because" ("AMS" "Relational II") 8757) ;; #X2235 - (nil "nless" ("AMS" "Neg Rel I") 8814) ;; #X226E - (nil "nleq" ("AMS" "Neg Rel I") 8816) ;; #X2270 - (nil "nleqslant" ("AMS" "Neg Rel I")) - (nil "nleqq" ("AMS" "Neg Rel I")) - (nil "lneq" ("AMS" "Neg Rel I") 10887) ;; #X2A87 - (nil "lneqq" ("AMS" "Neg Rel I") 8808) ;; #X2268 - (nil "lvertneqq" ("AMS" "Neg Rel I")) - (nil "lnsim" ("AMS" "Neg Rel I") 8934) ;; #X22E6 - (nil "lnapprox" ("AMS" "Neg Rel I") 10889) ;; #X2A89 - (nil "nprec" ("AMS" "Neg Rel I") 8832) ;; #X2280 - (nil "npreceq" ("AMS" "Neg Rel I")) - (nil "precnsim" ("AMS" "Neg Rel I") 8936) ;; #X22E8 - (nil "precnapprox" ("AMS" "Neg Rel I") 10937) ;; #X2AB9 - (nil "nsim" ("AMS" "Neg Rel I") 8769) ;; #X2241 - (nil "nshortmid" ("AMS" "Neg Rel I") 8740) ;; #X2224 - (nil "nmid" ("AMS" "Neg Rel I") 8740) ;; #X2224 - (nil "nvdash" ("AMS" "Neg Rel I") 8876) ;; #X22AC - (nil "nvDash" ("AMS" "Neg Rel I") 8877) ;; #X22AD - (nil "ntriangleleft" ("AMS" "Neg Rel I") 8938) ;; #X22EA - (nil "ntrianglelefteq" ("AMS" "Neg Rel I") 8940) ;; #X22EC - (nil "nsubseteq" ("AMS" "Neg Rel I") 8840) ;; #X2288 - (nil "subsetneq" ("AMS" "Neg Rel I") 8842) ;; #X228A - (nil "varsubsetneq" ("AMS" "Neg Rel I")) - (nil "subsetneqq" ("AMS" "Neg Rel I") 10955) ;; #X2ACB - (nil "varsubsetneqq" ("AMS" "Neg Rel I")) - (nil "ngtr" ("AMS" "Neg Rel II") 8815) ;; #X226F - (nil "ngeq" ("AMS" "Neg Rel II") 8817) ;; #X2271 - (nil "ngeqslant" ("AMS" "Neg Rel II")) - (nil "ngeqq" ("AMS" "Neg Rel II")) - (nil "gneq" ("AMS" "Neg Rel II") 10888) ;; #X2A88 - (nil "gneqq" ("AMS" "Neg Rel II") 8809) ;; #X2269 - (nil "gvertneqq" ("AMS" "Neg Rel II")) - (nil "gnsim" ("AMS" "Neg Rel II") 8935) ;; #X22E7 - (nil "gnapprox" ("AMS" "Neg Rel II") 10890) ;; #X2A8A - (nil "nsucc" ("AMS" "Neg Rel II") 8833) ;; #X2281 - (nil "nsucceq" ("AMS" "Neg Rel II")) - (nil "succnsim" ("AMS" "Neg Rel II") 8937) ;; #X22E9 - (nil "succnapprox" ("AMS" "Neg Rel II") 10938) ;; #X2ABA - (nil "ncong" ("AMS" "Neg Rel II") 8775) ;; #X2247 - (nil "nshortparallel" ("AMS" "Neg Rel II") 8742) ;; #X2226 - (nil "nparallel" ("AMS" "Neg Rel II") 8742) ;; #X2226 - (nil "nvDash" ("AMS" "Neg Rel II") 8877) ;; #X22AD - (nil "nVDash" ("AMS" "Neg Rel II") 8879) ;; #X22AF - (nil "ntriangleright" ("AMS" "Neg Rel II") 8939) ;; #X22EB - (nil "ntrianglerighteq" ("AMS" "Neg Rel II") 8941) ;; #X22ED - (nil "nsupseteq" ("AMS" "Neg Rel II") 8841) ;; #X2289 - (nil "nsupseteqq" ("AMS" "Neg Rel II")) - (nil "supsetneq" ("AMS" "Neg Rel II") 8843) ;; #X228B - (nil "varsupsetneq" ("AMS" "Neg Rel II")) - (nil "supsetneqq" ("AMS" "Neg Rel II") 10956) ;; #X2ACC - (nil "varsupsetneqq" ("AMS" "Neg Rel II")) - (nil "dotplus" ("AMS" "Binary Op") 8724) ;; #X2214 - (nil "smallsetminus" ("AMS" "Binary Op") 8726) ;; #X2216 - (nil "Cap" ("AMS" "Binary Op") 8914) ;; #X22D2 - (nil "Cup" ("AMS" "Binary Op") 8915) ;; #X22D3 - (nil "barwedge" ("AMS" "Binary Op") 8892) ;; #X22BC - (nil "veebar" ("AMS" "Binary Op") 8891) ;; #X22BB - (nil "doublebarwedge" ("AMS" "Binary Op") 8966) ;; #X2306 - (nil "boxminus" ("AMS" "Binary Op") 8863) ;; #X229F - (nil "boxtimes" ("AMS" "Binary Op") 8864) ;; #X22A0 - (nil "boxdot" ("AMS" "Binary Op") 8865) ;; #X22A1 - (nil "boxplus" ("AMS" "Binary Op") 8862) ;; #X229E - (nil "divideontimes" ("AMS" "Binary Op") 8903) ;; #X22C7 - (nil "ltimes" ("AMS" "Binary Op") 8905) ;; #X22C9 - (nil "rtimes" ("AMS" "Binary Op") 8906) ;; #X22CA - (nil "leftthreetimes" ("AMS" "Binary Op") 8907) ;; #X22CB - (nil "rightthreetimes" ("AMS" "Binary Op") 8908) ;; #X22CC - (nil "curlywedge" ("AMS" "Binary Op") 8911) ;; #X22CF - (nil "curlyvee" ("AMS" "Binary Op") 8910) ;; #X22CE - (nil "circleddash" ("AMS" "Binary Op") 8861) ;; #X229D - (nil "circledast" ("AMS" "Binary Op") 8859) ;; #X229B - (nil "circledcirc" ("AMS" "Binary Op") 8858) ;; #X229A - (nil "centerdot" ("AMS" "Binary Op")) - (nil "intercal" ("AMS" "Binary Op") 8890) ;; #X22BA - (nil "hbar" ("AMS" "Misc") 8463) ;; #X210F - (nil "hslash" ("AMS" "Misc") 8463) ;; #X210F - (nil "vartriangle" ("AMS" "Misc") 9653) ;; #X25B5 - (nil "triangledown" ("AMS" "Misc") 9663) ;; #X25BF - (nil "square" ("AMS" "Misc") 9633) ;; #X25A1 - (nil "lozenge" ("AMS" "Misc") 9674) ;; #X25CA - (nil "circledS" ("AMS" "Misc") 9416) ;; #X24C8 - (nil "angle" ("AMS" "Misc") 8736) ;; #X2220 - (nil "measuredangle" ("AMS" "Misc") 8737) ;; #X2221 - (nil "nexists" ("AMS" "Misc") 8708) ;; #X2204 - (nil "mho" ("AMS" "Misc") 8487) ;; #X2127 - (nil "Finv" ("AMS" "Misc") 8498) ;; #X2132 - (nil "Game" ("AMS" "Misc") 8513) ;; #X2141 - (nil "Bbbk" ("AMS" "Misc") 120156) ;; #X1D55C - (nil "backprime" ("AMS" "Misc") 8245) ;; #X2035 - (nil "varnothing" ("AMS" "Misc") 8709) ;; #X2205 - (nil "blacktriangle" ("AMS" "Misc") 9652) ;; #X25B4 - (nil "blacktriangledown" ("AMS" "Misc") 9662) ;; #X25BE - (nil "blacksquare" ("AMS" "Misc") 9632) ;; #X25A0 - (nil "blacklozenge" ("AMS" "Misc") 10731) ;; #X29EB - (nil "bigstar" ("AMS" "Misc") 9733) ;; #X2605 - (nil "sphericalangle" ("AMS" "Misc") 8738) ;; #X2222 - (nil "complement" ("AMS" "Misc") 8705) ;; #X2201 - (nil "eth" ("AMS" "Misc") 240) ;; #X00F0 - (nil "diagup" ("AMS" "Misc") 9585) ;; #X2571 - (nil "diagdown" ("AMS" "Misc") 9586) ;; #X2572 - (nil "dddot" ("AMS" "Accents") 8411) ;; #X20DB - (nil "ddddot" ("AMS" "Accents") 8412) ;; #X20DC - (nil "bigl" ("AMS" "Delimiters")) - (nil "bigr" ("AMS" "Delimiters")) - (nil "Bigl" ("AMS" "Delimiters")) - (nil "Bigr" ("AMS" "Delimiters")) - (nil "biggl" ("AMS" "Delimiters")) - (nil "biggr" ("AMS" "Delimiters")) - (nil "Biggl" ("AMS" "Delimiters")) - (nil "Biggr" ("AMS" "Delimiters")) - (nil "lvert" ("AMS" "Delimiters")) - (nil "rvert" ("AMS" "Delimiters")) - (nil "lVert" ("AMS" "Delimiters")) - (nil "rVert" ("AMS" "Delimiters")) - (nil "ulcorner" ("AMS" "Delimiters") 8988) ;; #X231C - (nil "urcorner" ("AMS" "Delimiters") 8989) ;; #X231D - (nil "llcorner" ("AMS" "Delimiters") 8990) ;; #X231E - (nil "lrcorner" ("AMS" "Delimiters") 8991) ;; #X231F - (nil "nobreakdash" ("AMS" "Special")) - (nil "leftroot" ("AMS" "Special")) - (nil "uproot" ("AMS" "Special")) - (nil "accentedsymbol" ("AMS" "Special")) - (nil "xleftarrow" ("AMS" "Special")) - (nil "xrightarrow" ("AMS" "Special")) - (nil "overset" ("AMS" "Special")) - (nil "underset" ("AMS" "Special")) - (nil "dfrac" ("AMS" "Special")) - (nil "genfrac" ("AMS" "Special")) - (nil "tfrac" ("AMS" "Special")) - (nil "binom" ("AMS" "Special")) - (nil "dbinom" ("AMS" "Special")) - (nil "tbinom" ("AMS" "Special")) - (nil "smash" ("AMS" "Special")) - (nil "eucal" ("AMS" "Special")) - (nil "boldsymbol" ("AMS" "Special")) - (nil "text" ("AMS" "Special")) - (nil "intertext" ("AMS" "Special")) - (nil "substack" ("AMS" "Special")) - (nil "subarray" ("AMS" "Special")) - (nil "sideset" ("AMS" "Special"))) - "Alist of LaTeX math symbols. - -Each entry should be a list with upto four elements, KEY, VALUE, -MENU and CHARACTER, see `LaTeX-math-list' for details.") - -(defcustom LaTeX-math-abbrev-prefix "`" - "Prefix key for use in `LaTeX-math-mode'. -This has to be a string representing a key sequence in a format -understood by the `kbd' macro. This corresponds to the syntax -usually used in the Emacs and Elisp manuals. - -Setting this variable directly does not take effect; -use \\[customize]." - :group 'LaTeX-math - :initialize 'custom-initialize-default - :set '(lambda (symbol value) - (define-key LaTeX-math-mode-map (LaTeX-math-abbrev-prefix) t) - (set-default symbol value) - (define-key LaTeX-math-mode-map - (LaTeX-math-abbrev-prefix) LaTeX-math-keymap)) - :type '(string :tag "Key sequence")) - -(defun LaTeX-math-abbrev-prefix () - "Make a key definition from the variable `LaTeX-math-abbrev-prefix'." - (if (stringp LaTeX-math-abbrev-prefix) - (read-kbd-macro LaTeX-math-abbrev-prefix) - LaTeX-math-abbrev-prefix)) - -(defvar LaTeX-math-keymap - (let ((map (make-sparse-keymap))) - (define-key map (LaTeX-math-abbrev-prefix) 'self-insert-command) - map) - "Keymap used for `LaTeX-math-mode' commands.") - -(defvar LaTeX-math-menu - '("Math" - ("Greek Uppercase") ("Greek Lowercase") ("Binary Op") ("Relational") - ("Arrows") ("Punctuation") ("Misc Symbol") ("Var Symbol") ("Log-like") - ("Delimiters") ("Constructs") ("Accents") ("AMS")) - "Menu containing LaTeX math commands. -The menu entries will be generated dynamically, but you can specify -the sequence by initializing this variable.") - -(defcustom LaTeX-math-menu-unicode - (and (string-match "\\" (emacs-version)) t) - "Whether the LaTeX menu should try using Unicode for effect." - :type 'boolean - :group 'LaTeX-math) - -(let ((math (reverse (append LaTeX-math-list LaTeX-math-default))) - (map LaTeX-math-keymap) - (unicode (and LaTeX-math-menu-unicode (fboundp 'decode-char)))) - (while math - (let* ((entry (car math)) - (key (nth 0 entry)) - (prefix - (and unicode - (nth 3 entry))) - value menu name) - (setq math (cdr math)) - (if (and prefix - (setq prefix (decode-char 'ucs (nth 3 entry)))) - (setq prefix (concat (string prefix) " \\")) - (setq prefix "\\")) - (if (listp (cdr entry)) - (setq value (nth 1 entry) - menu (nth 2 entry)) - (setq value (cdr entry) - menu nil)) - (if (stringp value) - (progn - (setq name (intern (concat "LaTeX-math-" value))) - (fset name (list 'lambda (list 'arg) (list 'interactive "*P") - (list 'LaTeX-math-insert value 'arg)))) - (setq name value)) - (if key - (progn - (setq key (cond ((numberp key) (char-to-string key)) - ((stringp key) (read-kbd-macro key)) - (t (vector key)))) - (define-key map key name))) - (if menu - (let ((parent LaTeX-math-menu)) - (if (listp menu) - (progn - (while (cdr menu) - (let ((sub (assoc (car menu) LaTeX-math-menu))) - (if sub - (setq parent sub) - (setcdr parent (cons (list (car menu)) (cdr parent)))) - (setq menu (cdr menu)))) - (setq menu (car menu)))) - (let ((sub (assoc menu parent))) - (if sub - (if (stringp value) - (setcdr sub (cons (vector (concat prefix value) - name t) - (cdr sub))) - (error "Cannot have multiple special math menu items")) - (setcdr parent - (cons (if (stringp value) - (list menu (vector (concat prefix value) - name t)) - (vector menu name t)) - (cdr parent)))))))))) - -(define-minor-mode LaTeX-math-mode - "A minor mode with easy access to TeX math macros. - -Easy insertion of LaTeX math symbols. If you give a prefix argument, -the symbols will be surrounded by dollar signs. The following -commands are defined: - -\\{LaTeX-math-mode-map}" - nil nil (list (cons (LaTeX-math-abbrev-prefix) LaTeX-math-keymap)) - (if LaTeX-math-mode - (easy-menu-add LaTeX-math-mode-menu LaTeX-math-mode-map) - (easy-menu-remove LaTeX-math-mode-menu)) - (TeX-set-mode-name)) -(defalias 'latex-math-mode 'LaTeX-math-mode) - -(easy-menu-define LaTeX-math-mode-menu - LaTeX-math-mode-map - "Menu used in math minor mode." - LaTeX-math-menu) - -(defcustom LaTeX-math-insert-function 'TeX-insert-macro - "Function called with argument STRING to insert \\STRING." - :group 'LaTeX-math - :type 'function) - -(defun LaTeX-math-insert (string dollar) - "Insert \\STRING{}. If DOLLAR is non-nil, put $'s around it." - (if dollar (insert "$")) - (funcall LaTeX-math-insert-function string) - (if dollar (insert "$"))) - -(defun LaTeX-math-cal (char dollar) - "Insert a {\\cal CHAR}. If DOLLAR is non-nil, put $'s around it." - (interactive "*c\nP") - (if dollar (insert "$")) - (if (member "latex2e" (TeX-style-list)) - (insert "\\mathcal{" (char-to-string char) "}") - (insert "{\\cal " (char-to-string char) "}")) - (if dollar (insert "$"))) - - -;;; Folding - -(defcustom LaTeX-fold-macro-spec-list nil - "List of display strings and macros to fold in LaTeX mode." - :type '(repeat (group (choice (string :tag "Display String") - (integer :tag "Number of argument" :value 1)) - (repeat :tag "Macros" (string)))) - :group 'TeX-fold) - -(defcustom LaTeX-fold-env-spec-list nil - "List of display strings and environments to fold in LaTeX mode." - :type '(repeat (group (choice (string :tag "Display String") - (integer :tag "Number of argument" :value 1)) - (repeat :tag "Environments" (string)))) - :group 'TeX-fold) - -(defcustom LaTeX-fold-math-spec-list - (delete nil - (mapcar (lambda (elt) - (let ((tex-token (nth 1 elt)) - (submenu (nth 2 elt)) - (unicode (nth 3 elt)) - uchar noargp) - (when (and (fboundp 'decode-char) (integerp unicode)) - (setq uchar (decode-char 'ucs unicode))) - (when (listp submenu) (setq submenu (nth 1 submenu))) - (setq noargp - (not (string-match - (concat "^" (regexp-opt '("Constructs" - "Accents"))) - submenu))) - (when (and (stringp tex-token) (integerp uchar) noargp) - `(,(char-to-string uchar) (,tex-token))))) - `((nil "to" "" 8594) - (nil "gets" "" 8592) - ,@LaTeX-math-default))) - "List of display strings and math macros to fold in LaTeX mode." - :type '(repeat (group (choice (string :tag "Display String") - (integer :tag "Number of argument" :value 1)) - (repeat :tag "Math Macros" (string)))) - :group 'TeX-fold) - - -;;; Keymap - -(defvar LaTeX-mode-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map TeX-mode-map) - - ;; Standard - (define-key map "\n" 'reindent-then-newline-and-indent) - - ;; From latex.el - ;; We now set `fill-paragraph-function' instead. - ;; (define-key map "\eq" 'LaTeX-fill-paragraph) ;*** Alias - ;; This key is now used by Emacs for face settings. - ;; (define-key map "\eg" 'LaTeX-fill-region) ;*** Alias - (define-key map "\e\C-e" 'LaTeX-find-matching-end) - (define-key map "\e\C-a" 'LaTeX-find-matching-begin) - - (define-key map "\C-c\C-q\C-p" 'LaTeX-fill-paragraph) - (define-key map "\C-c\C-q\C-r" 'LaTeX-fill-region) - (define-key map "\C-c\C-q\C-s" 'LaTeX-fill-section) - (define-key map "\C-c\C-q\C-e" 'LaTeX-fill-environment) - - (define-key map "\C-c." 'LaTeX-mark-environment) ;*** Dubious - (define-key map "\C-c*" 'LaTeX-mark-section) ;*** Dubious - - (define-key map "\C-c\C-e" 'LaTeX-environment) - (define-key map "\C-c\n" 'LaTeX-insert-item) - (or (key-binding "\e\r") - (define-key map "\e\r" 'LaTeX-insert-item)) ;*** Alias - (define-key map "\C-c]" 'LaTeX-close-environment) - (define-key map "\C-c\C-s" 'LaTeX-section) - - (define-key map "\C-c~" 'LaTeX-math-mode) ;*** Dubious - - (define-key map "-" 'LaTeX-babel-insert-hyphen) - map) - "Keymap used in `LaTeX-mode'.") - -(defvar LaTeX-environment-menu-name "Insert Environment (C-c C-e)") - -(defun LaTeX-environment-menu-entry (entry) - "Create an entry for the environment menu." - (vector (car entry) (list 'LaTeX-environment-menu (car entry)) t)) - -(defvar LaTeX-environment-modify-menu-name "Change Environment (C-u C-c C-e)") - -(defun LaTeX-environment-modify-menu-entry (entry) - "Create an entry for the change environment menu." - (vector (car entry) (list 'LaTeX-modify-environment (car entry)) t)) - -(defun LaTeX-section-enable-symbol (LEVEL) - "Symbol used to enable section LEVEL in the menu bar." - (intern (concat "LaTeX-section-" (int-to-string (nth 1 entry)) "-enable"))) - -(defun LaTeX-section-enable (entry) - "Enable or disable section ENTRY from `LaTeX-section-list'." - (let* ((level (nth 1 entry)) - (symbol (LaTeX-section-enable-symbol level))) - (set symbol (or (= level 0) (>= level LaTeX-largest-level))) - (make-variable-buffer-local symbol))) - -(defun LaTeX-section-menu (level) - "Insert section from menu." - (let ((LaTeX-section-hook (delq 'LaTeX-section-heading - (copy-sequence LaTeX-section-hook)))) - (LaTeX-section level))) - -(defun LaTeX-section-menu-entry (entry) - "Create an ENTRY for the section menu." - (let ((enable (LaTeX-section-enable-symbol (nth 1 entry)))) - (vector (car entry) (list 'LaTeX-section-menu (nth 1 entry)) enable))) - -(defcustom LaTeX-menu-max-items 25 - "*Maximum number of items in the menu for LaTeX environments. -If number of entries in a menu is larger than this value, split menu -into submenus of nearly equal length. If nil, never split menu into -submenus." - :group 'LaTeX-environment - :type '(choice (const :tag "no submenus" nil) - (integer))) - -(defcustom LaTeX-submenu-name-format "%-12.12s ... %.12s" - "*Format specification of the submenu name. -Used by `LaTeX-split-long-menu' if the number of entries in a menu is -larger than `LaTeX-menu-max-items'. -This string should contain one %s for the name of the first entry and -one %s for the name of the last entry in the submenu. -If the value is a function, it should return the submenu name. The -function is called with two arguments, the names of the first and -the last entry in the menu." - :group 'LaTeX-environment - :type '(choice (string :tag "Format string") - (function))) - -(defun LaTeX-split-long-menu (menu) - "Split MENU according to `LaTeX-menu-max-items'." - (let ((len (length menu))) - (if (or (null LaTeX-menu-max-items) - (null (featurep 'lisp-float-type)) - (<= len LaTeX-menu-max-items)) - menu - ;; Submenu is max 2 entries longer than menu, never shorter, number of - ;; entries in submenus differ by at most one (with longer submenus first) - (let* ((outer (floor (sqrt len))) - (inner (/ len outer)) - (rest (% len outer)) - (result nil)) - (setq menu (reverse menu)) - (while menu - (let ((in inner) - (sub nil) - (to (car menu))) - (while (> in 0) - (setq in (1- in) - sub (cons (car menu) sub) - menu (cdr menu))) - (setq result - (cons (cons (if (stringp LaTeX-submenu-name-format) - (format LaTeX-submenu-name-format - (aref (car sub) 0) (aref to 0)) - (funcall LaTeX-submenu-name-format - (aref (car sub) 0) (aref to 0))) - sub) - result) - rest (1+ rest)) - (if (= rest outer) (setq inner (1+ inner))))) - result)))) - -(defvar LaTeX-section-menu nil) -(make-variable-buffer-local 'LaTeX-section-menu) -(defun LaTeX-section-menu-filter (ignored) - "Filter function for the section submenu in the mode menu. -The argument IGNORED is not used in any way." - (TeX-update-style) - (or LaTeX-section-menu - (progn - (setq LaTeX-section-list-changed nil) - (mapc 'LaTeX-section-enable LaTeX-section-list) - (setq LaTeX-section-menu - (mapcar 'LaTeX-section-menu-entry LaTeX-section-list))))) - -(defvar LaTeX-environment-menu nil) -(make-variable-buffer-local 'LaTeX-environment-menu) -(defvar LaTeX-environment-modify-menu nil) -(make-variable-buffer-local 'LaTeX-environment-modify-menu) -(defun LaTeX-environment-menu-filter (menu) - "Filter function for the environment submenus in the mode menu. -The argument MENU is the name of the submenu in concern and -corresponds to the variables `LaTeX-environment-menu-name' and -`LaTeX-environment-modify-menu-name'." - (TeX-update-style) - (cond - ((string= menu LaTeX-environment-menu-name) - (or LaTeX-environment-menu - (setq LaTeX-environment-menu - (LaTeX-split-long-menu - (mapcar 'LaTeX-environment-menu-entry - (LaTeX-environment-list)))))) - ((string= menu LaTeX-environment-modify-menu-name) - (or LaTeX-environment-modify-menu - (setq LaTeX-environment-modify-menu - (LaTeX-split-long-menu - (mapcar 'LaTeX-environment-modify-menu-entry - (LaTeX-environment-list)))))))) - -(easy-menu-define LaTeX-mode-command-menu - LaTeX-mode-map - "Command menu used in LaTeX mode." - (TeX-mode-specific-command-menu 'latex-mode)) - -(easy-menu-define LaTeX-mode-menu - LaTeX-mode-map - "Menu used in LaTeX mode." - (TeX-menu-with-help - `("LaTeX" - ("Section (C-c C-s)" :filter LaTeX-section-menu-filter) - ["Macro..." TeX-insert-macro - :help "Insert a macro and possibly arguments"] - ["Complete Macro" TeX-complete-symbol - :help "Complete the current macro or environment name"] - ,(list LaTeX-environment-menu-name - :filter (lambda (ignored) (LaTeX-environment-menu-filter - LaTeX-environment-menu-name))) - ,(list LaTeX-environment-modify-menu-name - :filter (lambda (ignored) (LaTeX-environment-menu-filter - LaTeX-environment-modify-menu-name))) - ["Close Environment" LaTeX-close-environment - :help "Insert the \\end part of the current environment"] - ["Item" LaTeX-insert-item - :help "Insert a new \\item into current environment"] - "-" - ("Insert Font" - ["Emphasize" (TeX-font nil ?\C-e) :keys "C-c C-f C-e"] - ["Bold" (TeX-font nil ?\C-b) :keys "C-c C-f C-b"] - ["Typewriter" (TeX-font nil ?\C-t) :keys "C-c C-f C-t"] - ["Small Caps" (TeX-font nil ?\C-c) :keys "C-c C-f C-c"] - ["Sans Serif" (TeX-font nil ?\C-f) :keys "C-c C-f C-f"] - ["Italic" (TeX-font nil ?\C-i) :keys "C-c C-f C-i"] - ["Slanted" (TeX-font nil ?\C-s) :keys "C-c C-f C-s"] - ["Roman" (TeX-font nil ?\C-r) :keys "C-c C-f C-r"] - ["Calligraphic" (TeX-font nil ?\C-a) :keys "C-c C-f C-a"]) - ("Replace Font" - ["Emphasize" (TeX-font t ?\C-e) :keys "C-u C-c C-f C-e"] - ["Bold" (TeX-font t ?\C-b) :keys "C-u C-c C-f C-b"] - ["Typewriter" (TeX-font t ?\C-t) :keys "C-u C-c C-f C-t"] - ["Small Caps" (TeX-font t ?\C-c) :keys "C-u C-c C-f C-c"] - ["Sans Serif" (TeX-font t ?\C-f) :keys "C-u C-c C-f C-f"] - ["Italic" (TeX-font t ?\C-i) :keys "C-u C-c C-f C-i"] - ["Slanted" (TeX-font t ?\C-s) :keys "C-u C-c C-f C-s"] - ["Roman" (TeX-font t ?\C-r) :keys "C-u C-c C-f C-r"] - ["Calligraphic" (TeX-font t ?\C-a) :keys "C-u C-c C-f C-a"]) - ["Delete Font" (TeX-font t ?\C-d) :keys "C-c C-f C-d"] - "-" - ["Comment or Uncomment Region" - TeX-comment-or-uncomment-region - :help "Make the selected region outcommented or active again"] - ["Comment or Uncomment Paragraph" - TeX-comment-or-uncomment-paragraph - :help "Make the current paragraph outcommented or active again"] - ("Formatting and Marking" - ["Format Environment" LaTeX-fill-environment - :help "Fill and indent the current environment"] - ["Format Paragraph" LaTeX-fill-paragraph - :help "Fill and ident the current paragraph"] - ["Format Region" LaTeX-fill-region - :help "Fill and indent the currently selected region"] - ["Format Section" LaTeX-fill-section - :help "Fill and indent the current section"] - "-" - ["Mark Environment" LaTeX-mark-environment - :help "Mark the current environment"] - ["Mark Section" LaTeX-mark-section - :help "Mark the current section"] - "-" - ["Beginning of Environment" LaTeX-find-matching-begin - :help "Move point to the beginning of the current environment"] - ["End of Environment" LaTeX-find-matching-end - :help "Move point to the end of the current environment"]) - ,TeX-fold-menu - ["Math Mode" LaTeX-math-mode - :style toggle :selected LaTeX-math-mode - :help "Toggle math mode"] - "-" - [ "Convert 209 to 2e" LaTeX-209-to-2e - :visible (member "latex2" (TeX-style-list)) ] - . ,TeX-common-menu-entries))) - -(defcustom LaTeX-font-list - '((?\C-a "" "" "\\mathcal{" "}") - (?\C-b "\\textbf{" "}" "\\mathbf{" "}") - (?\C-c "\\textsc{" "}") - (?\C-e "\\emph{" "}") - (?\C-f "\\textsf{" "}" "\\mathsf{" "}") - (?\C-i "\\textit{" "}" "\\mathit{" "}") - (?\C-m "\\textmd{" "}") - (?\C-n "\\textnormal{" "}" "\\mathnormal{" "}") - (?\C-r "\\textrm{" "}" "\\mathrm{" "}") - (?\C-s "\\textsl{" "}" "\\mathbb{" "}") - (?\C-t "\\texttt{" "}" "\\mathtt{" "}") - (?\C-u "\\textup{" "}") - (?\C-d "" "" t)) - "Font commands used with LaTeX2e. See `TeX-font-list'." - :group 'LaTeX-macro - :type '(repeat - (group - :value (?\C-a "" "") - (character :tag "Key") - (string :tag "Prefix") - (string :tag "Suffix") - (option (group - :inline t - (string :tag "Math Prefix") - (string :tag "Math Suffix"))) - (option (sexp :format "Replace\n" :value t))))) - - -;;; Simple Commands - -(defcustom LaTeX-babel-hyphen "\"=" - "String to be used when typing `-'. -This usually is a hyphen alternative or hyphenation aid, like -\"=, \"~ or \"-, provided by babel and the related language style -files. - -Set it to an empty string or nil in order to disable this -feature. Alter `LaTeX-babel-hyphen-language-alist' in case you -want to change the behavior for a specific language only." - :group 'LaTeX-macro - :type 'string) - -(defcustom LaTeX-babel-hyphen-after-hyphen t - "Control insertion of hyphen strings. -If non-nil insert normal hyphen on first key press and swap it -with the language-specific hyphen string specified in the -variable `LaTeX-babel-hyphen' on second key press. If nil do it -the other way round." - :group 'LaTeX-macro - :type 'boolean) - -(defcustom LaTeX-babel-hyphen-language-alist nil - "Alist controlling hyphen insertion for specific languages. -It may be used to override the defaults given by `LaTeX-babel-hyphen' -and `LaTeX-babel-hyphen-after-hyphen' respectively. The first item -in each element is a string specifying the language as set by the -language-specific style file. The second item is the string to be -used instead of `LaTeX-babel-hyphen'. The third element is the -value overriding `LaTeX-bybel-hyphen-after-hyphen'." - :group 'LaTeX-macro - :type '(alist :key-type (string :tag "Language") - :value-type (group (string :tag "Hyphen string") - (boolean :tag "Insert plain hyphen first" - :value t)))) - -(defvar LaTeX-babel-hyphen-language nil - "String determining language-specific behavior of hyphen insertion. -It serves as an indicator that the babel hyphenation string -should be used and as a means to find a potential customization -in `LaTeX-babel-hyphen-language-alist' related to the active -language. It is usually set by language-related style files.") -(make-variable-buffer-local 'LaTeX-babel-hyphen-language) - -(defun LaTeX-babel-insert-hyphen (force) - "Insert a hyphen string. -The string can be either a normal hyphen or the string specified -in `LaTeX-babel-hyphen'. Wether one or the other is chosen -depends on the value of `LaTeX-babel-hyphen-after-hyphen' and -the buffer context. -If prefix argument FORCE is non-nil, always insert a regular hyphen." - (interactive "*P") - (if (or force - (zerop (length LaTeX-babel-hyphen)) - (not LaTeX-babel-hyphen-language) - ;; FIXME: It would be nice to check for verbatim constructs in the - ;; non-font-locking case, but things like `LaTeX-current-environment' - ;; are rather expensive in large buffers. - (and (fboundp 'font-latex-faces-present-p) - (font-latex-faces-present-p '(font-latex-verbatim-face - font-latex-math-face - font-lock-comment-face))) - (texmathp) - (TeX-in-comment)) - (call-interactively 'self-insert-command) - (let* ((lang (assoc LaTeX-babel-hyphen-language - LaTeX-babel-hyphen-language-alist)) - (hyphen (if lang (nth 1 lang) LaTeX-babel-hyphen)) - (h-after-h (if lang (nth 2 lang) LaTeX-babel-hyphen-after-hyphen)) - (hyphen-length (length hyphen))) - (cond - ;; "= --> -- / - - ((string= (buffer-substring (max (- (point) hyphen-length) (point-min)) - (point)) - hyphen) - (if h-after-h - (progn (delete-backward-char hyphen-length) - (insert "--")) - (delete-backward-char hyphen-length) - (call-interactively 'self-insert-command))) - ;; -- --> [+]- - ((string= (buffer-substring (max (- (point) 2) (point-min)) - (point)) - "--") - (call-interactively 'self-insert-command)) - ;; - --> "= / [+]- - ((eq (char-before) ?-) - (if h-after-h - (progn (delete-backward-char 1) - (insert hyphen)) - (call-interactively 'self-insert-command))) - (h-after-h - (call-interactively 'self-insert-command)) - (t (insert hyphen)))))) -;; Cater for Delete Selection mode -(put 'LaTeX-babel-insert-hyphen 'delete-selection t) - -(defcustom LaTeX-enable-toolbar t - "Enable LaTeX tool bar." - :group 'TeX-tool-bar - :type 'boolean) - -(defun LaTeX-maybe-install-toolbar () - "Conditionally install tool bar buttons for LaTeX mode. -Install tool bar if `LaTeX-enable-toolbar' is non-nil." - (when LaTeX-enable-toolbar - ;; Defined in `tex-bar.el': - (LaTeX-install-toolbar))) - -;;; Mode - -(defgroup LaTeX-macro nil - "Special support for LaTeX macros in AUCTeX." - :prefix "TeX-" - :group 'LaTeX - :group 'TeX-macro) - -(defcustom TeX-arg-cite-note-p nil - "*If non-nil, ask for optional note in citations." - :type 'boolean - :group 'LaTeX-macro) - -(defcustom TeX-arg-footnote-number-p nil - "*If non-nil, ask for optional number in footnotes." - :type 'boolean - :group 'LaTeX-macro) - -(defcustom TeX-arg-item-label-p nil - "*If non-nil, always ask for optional label in items. -Otherwise, only ask in description environments." - :type 'boolean - :group 'LaTeX-macro) - -(defcustom TeX-arg-right-insert-p t - "*If non-nil, always insert automatically the corresponding \\right. -This happens when \\left is inserted." - :type 'boolean - :group 'LaTeX-macro) - -(defcustom LaTeX-mode-hook nil - "A hook run in LaTeX mode buffers." - :type 'hook - :group 'LaTeX) - -;;;###autoload -(add-to-list 'auto-mode-alist '("\\.drv\\'" . latex-mode)) - -;;;###autoload -(defun TeX-latex-mode () - "Major mode in AUCTeX for editing LaTeX files. -See info under AUCTeX for full documentation. - -Special commands: -\\{LaTeX-mode-map} - -Entering LaTeX mode calls the value of `text-mode-hook', -then the value of `TeX-mode-hook', and then the value -of `LaTeX-mode-hook'." - (interactive) - (LaTeX-common-initialization) - (setq TeX-base-mode-name "LaTeX") - (setq major-mode 'latex-mode) - (setq TeX-command-default "LaTeX") - (setq TeX-sentinel-default-function 'TeX-LaTeX-sentinel) - (add-hook 'tool-bar-mode-on-hook 'LaTeX-maybe-install-toolbar nil t) - (when (if (featurep 'xemacs) - (featurep 'toolbar) - (and (boundp 'tool-bar-mode) tool-bar-mode)) - (LaTeX-maybe-install-toolbar)) - (TeX-run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'LaTeX-mode-hook) - (TeX-set-mode-name) - ;; Defeat filladapt - (if (and (boundp 'filladapt-mode) - filladapt-mode) - (turn-off-filladapt-mode))) - -;;;###autoload -(add-to-list 'auto-mode-alist '("\\.dtx\\'" . doctex-mode)) - -;;;###autoload -(define-derived-mode docTeX-mode TeX-latex-mode "docTeX" - "Major mode in AUCTeX for editing .dtx files derived from `LaTeX-mode'. -Runs `LaTeX-mode', sets a few variables and -runs the hooks in `docTeX-mode-hook'." - (setq major-mode 'doctex-mode) - (set (make-local-variable 'LaTeX-insert-into-comments) t) - (set (make-local-variable 'LaTeX-syntactic-comments) t) - (setq TeX-default-extension docTeX-default-extension) - ;; Make filling and indentation aware of DocStrip guards. - (setq paragraph-start (concat paragraph-start "\\|%<") - paragraph-separate (concat paragraph-separate "\\|%<") - TeX-comment-start-regexp "\\(?:%\\(?:<[^>]+>\\)?\\)") - (setq TeX-base-mode-name "docTeX") - (TeX-set-mode-name) - (funcall TeX-install-font-lock)) - -;;This is actually a mess: to fit the scheme properly, our derived -;;mode definition would have had to be made for TeX-doctex-mode in the -;;first place, but then we could not have used define-derived-mode, or -;;all mode-specific variables would have gotten non-AUCTeX names. -;;This solution has the advantage that documentation strings are -;;provided in the autoloads, and has the disadvantage that docTeX-mode -;;is not aliased to doctex-mode (not even when the AUCTeX version is -;;disabled) as would be normal for our scheme. - -;;;###autoload -(defalias 'TeX-doctex-mode 'docTeX-mode) - -(defcustom docTeX-clean-intermediate-suffixes - TeX-clean-default-intermediate-suffixes - "List of regexps matching suffixes of files to be deleted. -The regexps will be anchored at the end of the file name to be matched, -i.e. you do _not_ have to cater for this yourself by adding \\\\' or $." - :type '(repeat regexp) - :group 'TeX-command) - -(defcustom docTeX-clean-output-suffixes TeX-clean-default-output-suffixes - "List of regexps matching suffixes of files to be deleted. -The regexps will be anchored at the end of the file name to be matched, -i.e. you do _not_ have to cater for this yourself by adding \\\\' or $." - :type '(repeat regexp) - :group 'TeX-command) - -(defvar LaTeX-header-end - (concat "^[^%\n]*" (regexp-quote TeX-esc) "begin *" - TeX-grop "document" TeX-grcl) - "Default end of header marker for LaTeX documents.") - -(defvar LaTeX-trailer-start - (concat "^[^%\n]*" (regexp-quote TeX-esc) "end *" - TeX-grop "document" TeX-grcl) - "Default start of trailer marker for LaTeX documents.") - -(defcustom LaTeX-clean-intermediate-suffixes - TeX-clean-default-intermediate-suffixes - "List of regexps matching suffixes of files to be deleted. -The regexps will be anchored at the end of the file name to be matched, -i.e. you do _not_ have to cater for this yourself by adding \\\\' or $." - :type '(repeat regexp) - :group 'TeX-command) - -(defcustom LaTeX-clean-output-suffixes TeX-clean-default-output-suffixes - "List of regexps matching suffixes of files to be deleted. -The regexps will be anchored at the end of the file name to be matched, -i.e. you do _not_ have to cater for this yourself by adding \\\\' or $." - :type '(repeat regexp) - :group 'TeX-command) - -(defun LaTeX-common-initialization () - "Common initialization for LaTeX derived modes." - (VirTeX-common-initialization) - (set-syntax-table LaTeX-mode-syntax-table) - (make-local-variable 'indent-line-function) - (setq indent-line-function 'LaTeX-indent-line) - - ;; Filling - (make-local-variable 'paragraph-ignore-fill-prefix) - (setq paragraph-ignore-fill-prefix t) - (make-local-variable 'fill-paragraph-function) - (setq fill-paragraph-function 'LaTeX-fill-paragraph) - (make-local-variable 'adaptive-fill-mode) - (setq adaptive-fill-mode nil) - - (or LaTeX-largest-level - (setq LaTeX-largest-level (LaTeX-section-level "section"))) - - (setq TeX-header-end LaTeX-header-end - TeX-trailer-start LaTeX-trailer-start) - - (require 'outline) - (make-local-variable 'outline-level) - (setq outline-level 'LaTeX-outline-level) - (make-local-variable 'outline-regexp) - (setq outline-regexp (LaTeX-outline-regexp t)) - (when (boundp 'outline-heading-alist) - (setq outline-heading-alist - (mapcar (lambda (x) - (cons (concat "\\" (nth 0 x)) (nth 1 x))) - LaTeX-section-list))) - - (make-local-variable 'TeX-auto-full-regexp-list) - (setq TeX-auto-full-regexp-list - (append LaTeX-auto-regexp-list plain-TeX-auto-regexp-list)) - - (LaTeX-set-paragraph-start) - (setq paragraph-separate - (concat - "[ \t]*%*[ \t]*\\(" - "\\$\\$" ; Plain TeX display math - "\\|$\\)")) - - (setq TeX-verbatim-p-function 'LaTeX-verbatim-p) - (setq TeX-search-forward-comment-start-function - 'LaTeX-search-forward-comment-start) - - (make-local-variable 'LaTeX-item-list) - (setq LaTeX-item-list '(("description" . LaTeX-item-argument) - ("thebibliography" . LaTeX-item-bib))) - - (setq TeX-complete-list - (append '(("\\\\cite\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)" - 1 LaTeX-bibitem-list "}") - ("\\\\cite{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-bibitem-list "}") - ("\\\\cite{\\([^{}\n\r\\%]*,\\)\\([^{}\n\r\\%,]*\\)" - 2 LaTeX-bibitem-list) - ("\\\\nocite{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-bibitem-list "}") - ("\\\\nocite{\\([^{}\n\r\\%]*,\\)\\([^{}\n\r\\%,]*\\)" - 2 LaTeX-bibitem-list) - ("\\\\ref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}") - ("\\\\eqref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}") - ("\\\\pageref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}") - ("\\\\\\(index\\|glossary\\){\\([^{}\n\r\\%]*\\)" - 2 LaTeX-index-entry-list "}") - ("\\\\begin{\\([A-Za-z]*\\)" 1 LaTeX-environment-list "}") - ("\\\\end{\\([A-Za-z]*\\)" 1 LaTeX-environment-list "}") - ("\\\\renewcommand\\*?{\\\\\\([A-Za-z]*\\)" - 1 LaTeX-symbol-list "}") - ("\\\\renewenvironment\\*?{\\([A-Za-z]*\\)" - 1 LaTeX-environment-list "}")) - TeX-complete-list)) - - (LaTeX-add-environments - '("document" LaTeX-env-document) - '("enumerate" LaTeX-env-item) - '("itemize" LaTeX-env-item) - '("list" LaTeX-env-list) - '("trivlist" LaTeX-env-item) - '("picture" LaTeX-env-picture) - '("tabular" LaTeX-env-array) - '("tabular*" LaTeX-env-tabular*) - '("array" LaTeX-env-array) - '("eqnarray" LaTeX-env-label) - '("equation" LaTeX-env-label) - '("minipage" LaTeX-env-minipage) - - ;; The following have no special support, but are included in - ;; case the auto files are missing. - - "sloppypar" "picture" "tabbing" "verbatim" "verbatim*" - "flushright" "flushleft" "displaymath" "math" "quote" "quotation" - "abstract" "center" "titlepage" "verse" "eqnarray*" - - ;; The following are not defined in latex.el, but in a number of - ;; other style files. I'm to lazy to copy them to all the - ;; corresponding .el files right now. - - ;; This means that AUCTeX will complete e.g. - ;; ``thebibliography'' in a letter, but I guess we can live with - ;; that. - - '("description" LaTeX-env-item) - '("figure" LaTeX-env-figure) - '("figure*" LaTeX-env-figure) - '("table" LaTeX-env-figure) - '("table*" LaTeX-env-figure) - '("thebibliography" LaTeX-env-bib) - '("theindex" LaTeX-env-item)) - - (TeX-add-symbols - '("addtocounter" TeX-arg-counter "Value") - '("alph" TeX-arg-counter) - '("arabic" TeX-arg-counter) - '("fnsymbol" TeX-arg-counter) - '("newcounter" TeX-arg-define-counter - [ TeX-arg-counter "Within counter" ]) - '("roman" TeX-arg-counter) - '("setcounter" TeX-arg-counter "Value") - '("usecounter" TeX-arg-counter) - '("value" TeX-arg-counter) - '("stepcounter" TeX-arg-counter) - '("refstepcounter" TeX-arg-counter) - '("label" TeX-arg-define-label) - '("pageref" TeX-arg-ref) - '("ref" TeX-arg-ref) - '("newcommand" TeX-arg-define-macro [ "Number of arguments" ] t) - '("renewcommand" TeX-arg-macro [ "Number of arguments" ] t) - '("newenvironment" TeX-arg-define-environment - [ "Number of arguments"] t t) - '("renewenvironment" TeX-arg-environment - [ "Number of arguments"] t t) - '("providecommand" TeX-arg-define-macro [ "Number of arguments" ] t) - '("providecommand*" TeX-arg-define-macro [ "Number of arguments" ] t) - '("newcommand*" TeX-arg-define-macro [ "Number of arguments" ] t) - '("renewcommand*" TeX-arg-macro [ "Number of arguments" ] t) - '("newenvironment*" TeX-arg-define-environment - [ "Number of arguments"] t t) - '("renewenvironment*" TeX-arg-environment - [ "Number of arguments"] t t) - '("newtheorem" TeX-arg-define-environment - [ TeX-arg-environment "Numbered like" ] - t [ (TeX-arg-eval progn (if (eq (save-excursion - (backward-char 2) - (preceding-char)) ?\]) - () - (TeX-arg-counter t "Within counter")) - "") ]) - '("newfont" TeX-arg-define-macro t) - '("circle" "Diameter") - '("circle*" "Diameter") - '("dashbox" "Dash Length" TeX-arg-size - [ TeX-arg-corner ] t) - '("frame" t) - '("framebox" (TeX-arg-conditional - (string-equal (LaTeX-current-environment) "picture") - (TeX-arg-size [ TeX-arg-corner ] t) - ([ "Length" ] [ TeX-arg-lr ] t))) - '("line" (TeX-arg-pair "X slope" "Y slope") "Length") - '("linethickness" "Dimension") - '("makebox" (TeX-arg-conditional - (string-equal (LaTeX-current-environment) "picture") - (TeX-arg-size [ TeX-arg-corner ] t) - ([ "Length" ] [ TeX-arg-lr ] t))) - '("multiput" - TeX-arg-coordinate - (TeX-arg-pair "X delta" "Y delta") - "Number of copies" - t) - '("oval" TeX-arg-size [ TeX-arg-corner "Portion" ]) - '("put" TeX-arg-coordinate t) - '("savebox" TeX-arg-savebox - (TeX-arg-conditional - (string-equal (LaTeX-current-environment) "picture") - (TeX-arg-size [ TeX-arg-corner ] t) - ([ "Length" ] [ TeX-arg-lr ] t))) - '("shortstack" [ TeX-arg-lr ] t) - '("vector" (TeX-arg-pair "X slope" "Y slope") "Length") - '("cline" "Span `i-j'") - '("multicolumn" "Columns" "Format" t) - '("item" - (TeX-arg-conditional (or TeX-arg-item-label-p - (string-equal (LaTeX-current-environment) - "description")) - ([ "Item label" ]) - ()) - (TeX-arg-literal " ")) - '("bibitem" [ "Bibitem label" ] TeX-arg-define-cite) - '("cite" - (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) ()) - TeX-arg-cite) - '("nocite" TeX-arg-cite) - '("bibliographystyle" TeX-arg-bibstyle) - '("bibliography" TeX-arg-bibliography) - '("footnote" - (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil) - t) - '("footnotetext" - (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil) - t) - '("footnotemark" - (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil)) - '("newlength" TeX-arg-define-macro) - '("setlength" TeX-arg-macro "Length") - '("addtolength" TeX-arg-macro "Length") - '("settowidth" TeX-arg-macro t) - '("\\" [ "Space" ]) - '("\\*" [ "Space" ]) - '("hyphenation" t) - '("linebreak" [ "How much [0 - 4]" ]) - '("nolinebreak" [ "How much [0 - 4]" ]) - '("nopagebreak" [ "How much [0 - 4]" ]) - '("pagebreak" [ "How much [0 - 4]" ]) - '("stackrel" t nil) - '("frac" t nil) - '("lefteqn" t) - '("overbrace" t) - '("overline" t) - '("overleftarrow" t) - '("overrightarrow" t) - '("sqrt" [ "Root" ] t) - '("underbrace" t) - '("underline" t) - '("author" t) - '("date" t) - '("thanks" t) - '("title" t) - '("pagenumbering" (TeX-arg-eval - completing-read "Numbering style: " - '(("arabic") ("roman") ("Roman") ("alph") ("Alph")))) - '("pagestyle" TeX-arg-pagestyle) - '("markboth" t nil) - '("markright" t) - '("thispagestyle" TeX-arg-pagestyle) - '("addvspace" "Length") - '("fbox" t) - '("hspace*" "Length") - '("hspace" "Length") - '("mbox" t) - '("newsavebox" TeX-arg-define-savebox) - '("parbox" [ TeX-arg-tb ] [ "Height" ] [ TeX-arg-tb "Inner position" ] - "Width" t) - '("raisebox" "Raise" [ "Height above" ] [ "Depth below" ] t) - '("rule" [ "Raise" ] "Width" "Thickness") - '("sbox" TeX-arg-savebox t) - '("usebox" TeX-arg-savebox) - '("vspace*" "Length") - '("vspace" "Length") - '("documentstyle" TeX-arg-document) - '("include" (TeX-arg-input-file "File" t)) - '("includeonly" t) - '("input" TeX-arg-input-file) - '("addcontentsline" TeX-arg-file - (TeX-arg-eval - completing-read "Numbering style: " LaTeX-section-list) - t) - '("addtocontents" TeX-arg-file t) - '("typeout" t) - '("typein" [ TeX-arg-define-macro ] t) - '("verb" TeX-arg-verb) - '("verb*" TeX-arg-verb) - '("extracolsep" t) - '("index" TeX-arg-index) - '("glossary" TeX-arg-index) - '("numberline" "Section number" "Heading") - '("caption" t) - '("marginpar" [ "Left margin text" ] "Text") - '("left" TeX-arg-insert-braces) - - ;; These have no special support, but are included in case the - ;; auto files are missing. - - "TeX" "LaTeX" - "samepage" "newline" - "smallskip" "medskip" "bigskip" "fill" "stretch" - "thinspace" "negthinspace" "enspace" "enskip" "quad" "qquad" - "nonumber" "centering" "raggedright" - "raggedleft" "kill" "pushtabs" "poptabs" "protect" "arraystretch" - "hline" "vline" "cline" "thinlines" "thicklines" "and" "makeindex" - "makeglossary" "reversemarginpar" "normalmarginpar" - "raggedbottom" "flushbottom" "sloppy" "fussy" "newpage" - "clearpage" "cleardoublepage" "twocolumn" "onecolumn" - - "maketitle" "tableofcontents" "listoffigures" "listoftables" - "tiny" "scriptsize" "footnotesize" "small" - "normalsize" "large" "Large" "LARGE" "huge" "Huge" - "pounds" "copyright" - "hfil" "hfill" "vfil" "vfill" "hrulefill" "dotfill" - "indent" "noindent" "today" - "appendix" - "dots") - - (when (string-equal LaTeX-version "2e") - (LaTeX-add-environments - '("filecontents" LaTeX-env-contents) - '("filecontents*" LaTeX-env-contents)) - - (TeX-add-symbols - '("enlargethispage" "Length") - '("enlargethispage*" "Length") - '("tabularnewline" [ "Length" ]) - '("suppressfloats" [ TeX-arg-tb "Suppress floats position" ]) - '("ensuremath" "Math commands") - '("textsuperscript" "Text") - '("textcircled" "Text") - - "LaTeXe" - "listfiles" "frontmatter" "mainmatter" "backmatter" - "textcompwordmark" "textvisiblespace" "textemdash" "textendash" - "textexclamdown" "textquestiondown" "textquotedblleft" - "textquotedblright" "textquoteleft" "textquoteright" - "textbullet" "textperiodcentered" - "textbackslash" "textbar" "textless" "textgreater" - "textasciicircum" "textasciitilde" - "textregistered" "texttrademark" - "rmfamily" "sffamily" "ttfamily" "mdseries" "bfseries" - "itshape" "slshape" "upshape" "scshape")) - - (TeX-run-style-hooks "LATEX") - - (make-local-variable 'TeX-font-list) - (make-local-variable 'TeX-font-replace-function) - (if (string-equal LaTeX-version "2") - () - (setq TeX-font-list LaTeX-font-list) - (setq TeX-font-replace-function 'TeX-font-replace-macro) - (TeX-add-symbols - '("newcommand" TeX-arg-define-macro - [ "Number of arguments" ] [ "Default value for first argument" ] t) - '("renewcommand" TeX-arg-macro - [ "Number of arguments" ] [ "Default value for first argument" ] t) - '("providecommand" TeX-arg-define-macro - [ "Number of arguments" ] [ "Default value for first argument" ] t) - '("providecommand*" TeX-arg-define-macro - [ "Number of arguments" ] [ "Default value for first argument" ] t) - '("newcommand*" TeX-arg-define-macro - [ "Number of arguments" ] [ "Default value for first argument" ] t) - '("renewcommand*" TeX-arg-macro - [ "Number of arguments" ] [ "Default value for first argument" ] t) - '("usepackage" LaTeX-arg-usepackage) - '("RequirePackage" LaTeX-arg-usepackage) - '("documentclass" TeX-arg-document))) - - (TeX-add-style-hook "latex2e" - ;; Use new fonts for `\documentclass' documents. - (lambda () - (setq TeX-font-list LaTeX-font-list) - (setq TeX-font-replace-function 'TeX-font-replace-macro) - (run-hooks 'LaTeX2e-hook))) - - (TeX-add-style-hook "latex2" - ;; Use old fonts for `\documentstyle' documents. - (lambda () - (setq TeX-font-list (default-value 'TeX-font-list)) - (setq TeX-font-replace-function - (default-value 'TeX-font-replace-function)) - (run-hooks 'LaTeX2-hook))) - - ;; There must be something better-suited, but I don't understand the - ;; parsing properly. -- dak - (TeX-add-style-hook "pdftex" 'TeX-PDF-mode-on) - (TeX-add-style-hook "pdftricks" 'TeX-PDF-mode-on) - (TeX-add-style-hook "pst-pdf" 'TeX-PDF-mode-on) - (TeX-add-style-hook "dvips" 'TeX-PDF-mode-off) -;; This is now done in style/pstricks.el because it prevents other -;; pstricks style files from being loaded. -;; (TeX-add-style-hook "pstricks" 'TeX-PDF-mode-off) - (TeX-add-style-hook "psfrag" 'TeX-PDF-mode-off) - (TeX-add-style-hook "dvipdf" 'TeX-PDF-mode-off) - (TeX-add-style-hook "dvipdfm" 'TeX-PDF-mode-off) -;; (TeX-add-style-hook "DVIoutput" 'TeX-PDF-mode-off) -;; -;; Well, DVIoutput indicates that we want to run PDFTeX and expect to -;; get DVI output. Ugh. - (TeX-add-style-hook "ifpdf" (lambda () - (TeX-PDF-mode-on) - (TeX-PDF-mode-off))) -;; ifpdf indicates that we cater for either. So calling both -;; functions will make sure that the default will get used unless the -;; user overrode it. - - (set (make-local-variable 'imenu-create-index-function) - 'LaTeX-imenu-create-index-function) - - (use-local-map LaTeX-mode-map) - ;; Calling `easy-menu-add' may result in the menu filters being - ;; executed which call `TeX-update-style'. So this is placed very - ;; late in mode initialization to assure that all relevant variables - ;; are properly initialized before style files try to alter them. - (easy-menu-add LaTeX-mode-menu LaTeX-mode-map) - (easy-menu-add LaTeX-mode-command-menu LaTeX-mode-map)) - -(defun LaTeX-imenu-create-index-function () - "Imenu support function for LaTeX." - (TeX-update-style) - (let (entries level - (regexp (LaTeX-outline-regexp))) - (goto-char (point-max)) - (while (re-search-backward regexp nil t) - (let* ((name (LaTeX-outline-name)) - (level (make-string (1- (LaTeX-outline-level)) ?\ )) - (label (concat level level name)) - (mark (make-marker))) - (set-marker mark (point)) - (set-text-properties 0 (length label) nil label) - (setq entries (cons (cons label mark) entries)))) - entries)) - -(defvar LaTeX-builtin-opts - '("12pt" "11pt" "10pt" "twocolumn" "twoside" "draft") - "Built in options for LaTeX standard styles.") - -(defun LaTeX-209-to-2e () - "Make a stab at changing 2.09 doc header to 2e style." - (interactive) - (TeX-home-buffer) - (let (optstr optlist 2eoptlist 2epackages docline docstyle) - (goto-char (point-min)) - (if - (search-forward-regexp - "\\documentstyle\\[\\([^]]*\\)\\]{\\([^}]*\\)}" - (point-max) t) - (setq optstr (TeX-match-buffer 1) - docstyle (TeX-match-buffer 2) - optlist (TeX-split-string "," optstr)) - (if (search-forward-regexp - "\\documentstyle{\\([^}]*\\)}" - (point-max) t) - (setq docstyle (TeX-match-buffer 1)) - (error "No documentstyle defined"))) - (beginning-of-line 1) - (setq docline (point)) - (insert "%%%") - (while optlist - (if (member (car optlist) LaTeX-builtin-opts) - (setq 2eoptlist (cons (car optlist) 2eoptlist)) - (setq 2epackages (cons (car optlist) 2epackages))) - (setq optlist (cdr optlist))) - ;;(message (format "%S %S" 2eoptlist 2epackages)) - (goto-char docline) - (forward-line 1) - (insert "\\documentclass") - (if 2eoptlist - (insert "[" - (mapconcat (lambda (x) x) - (nreverse 2eoptlist) ",") "]")) - (insert "{" docstyle "}\n") - (if 2epackages - (insert "\\usepackage{" - (mapconcat (lambda (x) x) - (nreverse 2epackages) "}\n\\usepackage{") "}\n")) - (if (equal docstyle "slides") - (progn - (goto-char (point-min)) - (while (re-search-forward "\\\\blackandwhite{" nil t) - (replace-match "\\\\input{" nil nil))))) - (TeX-normal-mode nil)) - -(provide 'latex) - -;;; latex.el ends here diff --git a/packages/auctex/latex/prauctex.cfg b/packages/auctex/latex/prauctex.cfg deleted file mode 100644 index 495ae40a6..000000000 --- a/packages/auctex/latex/prauctex.cfg +++ /dev/null @@ -1,48 +0,0 @@ -%% -%% This is file `prauctex.cfg', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% preview.dtx (with options: `auccfg') -%% -%% IMPORTANT NOTICE: -%% -%% For the copyright see the source file. -%% -%% Any modified versions of this file must be renamed -%% with new filenames distinct from prauctex.cfg. -%% -%% For distribution of the original source see the terms -%% for copying and modification in the file preview.dtx. -%% -%% This generated file may be distributed as long as the -%% original source files, as listed above, are part of the -%% same distribution. (The sources need not necessarily be -%% in the same archive or directory.) -%% The preview style for extracting previews from LaTeX documents. -%% Developed as part of AUCTeX . -\PreviewMacro*[[][#1{}]\footnote -\PreviewMacro*[?[{@{[]}}{}][#1]\item -\PreviewMacro*\emph -\PreviewMacro*\textrm -\PreviewMacro*\textit -\PreviewMacro*\textsc -\PreviewMacro*\textsf -\PreviewMacro*\textsl -\PreviewMacro*\texttt -\PreviewMacro*\textcolor -\PreviewMacro*\mbox -\PreviewMacro*[][#1{}]\author -\PreviewMacro*[][#1{}]\title -\PreviewMacro*\and -\PreviewMacro*\thanks -\PreviewMacro*[][#1{}]\caption -\preview@delay{\@ifundefined{pr@\string\@startsection}{% - \PreviewMacro*[!!!!!!*][#1{}]\@startsection}{}} -\preview@delay{\@ifundefined{pr@\string\chapter}{% - \PreviewMacro*[*][#1{}]\chapter}{}} -\PreviewMacro*\index -\endinput -%% -%% End of file `prauctex.cfg'. diff --git a/packages/auctex/latex/prauctex.def b/packages/auctex/latex/prauctex.def deleted file mode 100644 index 4f8f7fa6d..000000000 --- a/packages/auctex/latex/prauctex.def +++ /dev/null @@ -1,61 +0,0 @@ -%% -%% This is file `prauctex.def', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% preview.dtx (with options: `auctex') -%% -%% IMPORTANT NOTICE: -%% -%% For the copyright see the source file. -%% -%% Any modified versions of this file must be renamed -%% with new filenames distinct from prauctex.def. -%% -%% For distribution of the original source see the terms -%% for copying and modification in the file preview.dtx. -%% -%% This generated file may be distributed as long as the -%% original source files, as listed above, are part of the -%% same distribution. (The sources need not necessarily be -%% in the same archive or directory.) -%% The preview style for extracting previews from LaTeX documents. -%% Developed as part of AUCTeX . -\ifPreview\else\expandafter\endinput\fi -\nofiles -\preview@delay{\nonstopmode} -\begingroup -\lccode`\~=`\- -\lccode`\{=`\< -\lccode`\}=`\> -\lowercase{\endgroup - \def\pr@msgi{{~}}} -\def\pr@msgii{Preview: - Snippet \number\pr@snippet\space} -\begingroup -\catcode`\-=13 -\catcode`\<=13 -\@firstofone{\endgroup -\def\pr@msg#1{{% - \let<\pr@msgi - \def-{\pr@msgii#1}% - \errhelp{Not a real error.}% - \errmessage<}}} -\g@addto@macro\pr@ship@start{\pr@msg{started}} -\g@addto@macro\pr@ship@end{\pr@msg{ended.% - (\number\ht\pr@box+\number\dp\pr@box x\number\wd\pr@box)}} -\hbadness=\maxdimen -\newcount\hbadness -\vbadness=\maxdimen -\let\vbadness=\hbadness -\hfuzz=\maxdimen -\newdimen\hfuzz -\vfuzz=\maxdimen -\let\vfuzz=\hfuzz -\showboxdepth=-1 -\showboxbreadth=-1 -\pr@loadcfg{prauctex} -\endinput -%% -%% End of file `prauctex.def'. diff --git a/packages/auctex/latex/prcounters.def b/packages/auctex/latex/prcounters.def deleted file mode 100644 index f7b572671..000000000 --- a/packages/auctex/latex/prcounters.def +++ /dev/null @@ -1,38 +0,0 @@ -%% -%% This is file `prcounters.def', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% preview.dtx (with options: `counters') -%% -%% IMPORTANT NOTICE: -%% -%% For the copyright see the source file. -%% -%% Any modified versions of this file must be renamed -%% with new filenames distinct from prcounters.def. -%% -%% For distribution of the original source see the terms -%% for copying and modification in the file preview.dtx. -%% -%% This generated file may be distributed as long as the -%% original source files, as listed above, are part of the -%% same distribution. (The sources need not necessarily be -%% in the same archive or directory.) -%% The preview style for extracting previews from LaTeX documents. -%% Developed as part of AUCTeX . -\ifPreview\else\expandafter\endinput\fi -\def\pr@eltprint#1{\expandafter\@gobble\ifnum\value{#1}=0% - \csname pr@c@#1\endcsname\else\relax - \space{#1}{\arabic{#1}}\fi} -\def\pr@eltdef#1{\expandafter\xdef - \csname pr@c@#1\endcsname{\arabic{#1}}} -\def\pr@ckpt#1{{\let\@elt\pr@eltprint\edef\next{\cl@@ckpt}% - \ifx\next\@empty\else\typeout{Preview: Counters\next#1}% - \let\@elt\pr@eltdef\cl@@ckpt\fi}} -\pr@addto@front\pr@ship@start{\pr@ckpt:} -\pr@addto@front\pr@ship@end{\pr@ckpt.} -\endinput -%% -%% End of file `prcounters.def'. diff --git a/packages/auctex/latex/preview.sty b/packages/auctex/latex/preview.sty deleted file mode 100644 index 30402981d..000000000 --- a/packages/auctex/latex/preview.sty +++ /dev/null @@ -1,391 +0,0 @@ -%% -%% This is file `preview.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% preview.dtx (with options: `style') -%% preview.dtx (with options: `style,active') -%% -%% IMPORTANT NOTICE: -%% -%% For the copyright see the source file. -%% -%% Any modified versions of this file must be renamed -%% with new filenames distinct from preview.sty. -%% -%% For distribution of the original source see the terms -%% for copying and modification in the file preview.dtx preview.dtx. -%% -%% This generated file may be distributed as long as the -%% original source files, as listed above, are part of the -%% same distribution. (The sources need not necessarily be -%% in the same archive or directory.) -%% The preview style for extracting previews from LaTeX documents. -%% Developed as part of AUCTeX . -\NeedsTeXFormat{LaTeX2e} \def\reserved@a #1#2$#3: -#4${\xdef#1{\reserved@c #2#4 $}} \def\reserved@c #1 #2${#1} -\begingroup \catcode`\_=12 -\reserved@a\pr@version $Name: release_11_86 $ \ifx\pr@version\@empty -\reserved@a\pr@version CVS-$Revision: 1.126 $ \endgroup \else - \def\next release_{} \lccode`\_=`. - \edef\next{\lowercase{\endgroup - \def\noexpand\pr@version{\expandafter\next\pr@version}}} \next \fi -\reserved@a\next $Date: 2010/02/14 16:19:00 $ -\edef\next{\noexpand\ProvidesPackage{preview}% - [\next\space \pr@version\space (AUCTeX/preview-latex)]} -\next -\let\ifPreview\iffalse -\let\preview@delay=\@gobble -\let\pr@advise=\@gobbletwo -\long\def\pr@advise@ship#1#2#3{} -\def\pr@loadcfg#1{\InputIfFileExists{#1.cfg}{}{}} -\DeclareOption{noconfig}{\let\pr@loadcfg=\@gobble} -\long\def\pr@addto@front#1#2{% - \toks@{#2}\toks@\expandafter{\the\expandafter\toks@#1}% - \xdef#1{\the\toks@}} -\DeclareOption{active}{% - \let\ifPreview\iftrue - \def\pr@advise#1{% - \expandafter\pr@adviseii\csname pr@\string#1\endcsname#1}% - \long\def\pr@advise@ship#1#2#3{\pr@advise#1{\pr@protect@ship{#2}{#3}}}% - \let\preview@delay\@firstofone} -\long\def\pr@adviseii#1#2#3{\preview@delay{% - \ifx#1\relax \let#1#2\fi - \toks@{#3#1}% - \ifx\@undefined\protected \else \protected\fi - \long\edef#2{\the\toks@}}} -\DeclareOption{delayed}{% - \ifPreview \def\preview@delay{\AtBeginDocument}\fi -} -\newif\ifpr@fixbb -\pr@fixbbfalse -\DeclareOption{psfixbb}{\ifPreview% - \pr@fixbbtrue - \newbox\pr@markerbox - \setbox\pr@markerbox\hbox{\special{psfile=/dev/null}}\fi -} -\let\pr@graphicstype=\z@ -\DeclareOption{dvips}{% - \let\pr@graphicstype\@ne - \preview@delay{\AtBeginDvi{% - \special{!/preview@version(\pr@version)def} - \special{!userdict begin/preview-bop-level 0 def% - /bop-hook{/preview-bop-level dup load dup 0 le{/isls false def% - /vsize 792 def/hsize 612 def}if 1 add store}bind def% - /eop-hook{/preview-bop-level dup load dup 0 gt{1 sub}if - store}bind def end}}}} -\DeclareOption{pdftex}{% - \let\pr@graphicstype\tw@} -\DeclareOption{xetex}{% - \let\pr@graphicstype\thr@@} -\begingroup -\catcode`\*=11 -\@firstofone{\endgroup -\DeclareOption{displaymath}{% - \preview@delay{\toks@{% - \pr@startbox{\noindent$$% - \aftergroup\pr@endbox\@gobbletwo}{$$}\@firstofone}% - \everydisplay\expandafter{\the\expandafter\toks@ - \expandafter{\the\everydisplay}}}% - \pr@advise@ship\equation{\begingroup\aftergroup\pr@endbox - \def\dt@ptrue{\m@ne=\m@ne}\noindent}% - {\endgroup}% - \pr@advise@ship\equation*{\begingroup\aftergroup\pr@endbox - \def\dt@ptrue{\m@ne=\m@ne}\noindent}% - {\endgroup}% - \PreviewOpen[][\def\dt@ptrue{\m@ne=\m@ne}\noindent#1]\[% - \PreviewClose\]% - \PreviewEnvironment[][\noindent#1]{eqnarray}% - \PreviewEnvironment[][\noindent#1]{eqnarray*}% - \PreviewEnvironment{displaymath}% -}} -\begingroup -\def\next#1#2{% - \endgroup - \DeclareOption{textmath}{% - \PreviewEnvironment{math}% - \preview@delay{\ifx#1\@undefined \let#1=$%$ - \fi\catcode`\$=\active - \ifx\xyreuncatcodes\@undefined\else - \edef\next{\catcode`@=\the\catcode`@\relax}% - \makeatother\expandafter\xyreuncatcodes\next\fi}% - \pr@advise@ship\(\pr@endaftergroup{}% \) - \pr@advise@ship#1{\@firstoftwo{\let#1=#2% - \futurelet\reserved@a\pr@textmathcheck}}{}}% - \def\pr@textmathcheck{\expandafter\pr@endaftergroup - \ifx\reserved@a#1{#2#2}\expandafter\@gobbletwo\fi#2}} -\lccode`\~=`\$ -\lowercase{\expandafter\next\expandafter~}% - \csname pr@\string$%$ - \endcsname -\DeclareOption{graphics}{% - \PreviewMacro[*[[!]{\includegraphics}%]] -} -\def\pr@floatfix#1#2{\ifx#1#2% - \ifx#1\@undefined\else - \PackageWarningNoLine{preview}{% -Your document class has a bad definition^^J -of \string#1, most likely^^J -\string\let\string#1=\string#2^^J -which has now been changed to^^J -\string\def\string#1{\string#2}^^J -because otherwise subsequent changes to \string#2^^J -(like done by several packages changing float behaviour)^^J -can't take effect on \string#1.^^J -Please complain to your document class author}% - \def#1{#2}\fi\fi} -\begingroup -\def\next#1#2{\endgroup - \DeclareOption{floats}{% - \pr@floatfix\endfigure\end@float - \pr@floatfix\endtable\end@float - \pr@floatfix#1\end@dblfloat - \pr@floatfix#2\end@dblfloat - \PreviewSnarfEnvironment[![]{@float}%] - \PreviewSnarfEnvironment[![]{@dblfloat}%] - }} -\expandafter\next\csname endfigure*\expandafter\endcsname - \csname endtable*\endcsname -\DeclareOption{sections}{% - \PreviewMacro[!!!!!!*[[!]{\@startsection}%]] - \PreviewMacro[*[[!]{\chapter}%]] -} -\DeclareOption* - {\InputIfFileExists{pr\CurrentOption.def}{}{\OptionNotUsed}} -\def\PreviewMacro{\@ifstar\pr@starmacro\pr@macro} -\long\def\pr@domacro#1#2{% - \long\def\next##1{#2}% - \pr@callafter\next#1]\pr@endparse} -\newcommand\pr@macro[1][]{% - \toks@{\pr@domacro{#1}}% - \long\edef\next[##1]##2{% - \noexpand\pr@advise@ship{##2}{\the\toks@{##1\noexpand\pr@endbox}}{}}% - \@ifnextchar[\next\pr@macroii} -\def\pr@macroii{\next[##1]} -\long\def\pr@endmacro#1{#1\pr@endbox} -\long\def\pr@protect@domacro#1#2{\pr@protect{% - \long\def\next##1{#2}% - \pr@callafter\next#1]\pr@endparse}} -\newcommand\pr@starmacro[1][]{\toks@{\pr@protect@domacro{#1}}% - \long\edef\next[##1]##2{% - \noexpand\pr@advise##2{\the\toks@{##1}}}% - \@ifnextchar[\next{\next[]}} -\def\PreviewOpen{\@ifstar\pr@starmacro\pr@open} -\newcommand\pr@open[1][]{% - \toks@{\pr@domacro{#1}}% - \long\edef\next[##1]##2{% - \noexpand\pr@advise##2{\begingroup - \noexpand\pr@protect@ship - {\the\toks@{\begingroup\aftergroup\noexpand\pr@endbox##1}}% - {\endgroup}}}% - \@ifnextchar[\next\pr@macroii} -\def\PreviewClose{\@ifstar\pr@starmacro\pr@close} -\newcommand\pr@close[1][]{% - \toks@{\pr@domacro{#1}}% - \long\edef\next[##1]##2{% - \noexpand\pr@advise{##2}{\the\toks@{##1\endgroup}}}% - \@ifnextchar[\next\pr@macroii} -\def\PreviewEnvironment{\@ifstar\pr@starenv\pr@env} -\newcommand\pr@starenv[1][]{\toks@{\pr@starmacro[{#1}]}% - \long\edef\next##1##2{% - \the\toks@[{##2}]##1}% - \begingroup\pr@starenvii} -\newcommand\pr@starenvii[2][]{\endgroup - \expandafter\next\csname#2\endcsname{#1}% - \expandafter\pr@starmacro\csname end#2\endcsname} -\newcommand\pr@env[1][]{% - \toks@{\pr@domacro{#1}}% - \long\edef\next[##1]##2{% - \noexpand\expandafter\noexpand\pr@advise@ship - \noexpand\csname##2\noexpand\endcsname{\the\toks@ - {\begingroup\aftergroup\noexpand\pr@endbox##1}}{\endgroup}}% - \@ifnextchar[\next\pr@macroii %] - } -\newcommand{\PreviewSnarfEnvironment}[2][]{% - \expandafter\pr@advise - \csname #2\endcsname{\pr@snarfafter{#1}}% - \expandafter\pr@advise - \csname end#2\endcsname{\pr@endsnarf}} -\let\pr@ship@start\@empty -\let\pr@ship@end\@empty -\newenvironment{preview}{\ignorespaces}{\ifhmode\unskip\fi} -\newenvironment{nopreview}{\ignorespaces}{\ifhmode\unskip\fi} -\ProcessOptions\relax -\ifPreview\else\expandafter\endinput\fi -%% The preview style for extracting previews from LaTeX documents. -%% Developed as part of AUCTeX . -\newif\ifpr@outer -\pr@outertrue -\newcount\pr@snippet -\global\pr@snippet=1 -\def\pr@protect{\ifx\protect\@typeset@protect - \ifpr@outer \expandafter\expandafter\expandafter - \@secondoftwo\fi\fi\@gobble} -\def\pr@protect@ship{\pr@protect{\@firstoftwo\pr@startbox}% - \@gobbletwo} -\def\pr@insert{\begingroup\afterassignment\pr@insertii\count@} -\def\pr@insertii{\endgroup\setbox\pr@box\vbox} -\def\pr@mark{{\afterassignment}\toks@} -\def\pr@marks{{\aftergroup\pr@mark\afterassignment}\count@} -\newbox\pr@box -\long\def\pr@startbox#1#2{% - \ifpr@outer - \toks@{#2}% - \edef\pr@cleanup{\the\toks@}% - \setbox\pr@box\vbox\bgroup - \break - \pr@outerfalse\@arrayparboxrestore - \let\insert\pr@insert - \let\mark\pr@mark - \let\marks\pr@marks - \expandafter\expandafter\expandafter - \pr@ship@start - \expandafter\@firstofone - \else - \expandafter \@gobble - \fi{#1}} -\def\pr@endbox{% - \let\reserved@a\relax - \ifvmode \edef\reserved@a{\the\everypar}% - \ifx\reserved@a\@empty\else - \dimen@\prevdepth - \noindent\par - \setbox\z@\lastbox\unskip\unpenalty - \prevdepth\dimen@ - \setbox\z@\hbox\bgroup\penalty-\maxdimen\unhbox\z@ - \ifnum\lastpenalty=-\maxdimen\egroup - \else\egroup\box\z@ \fi\fi\fi - \ifhmode \par\unskip\setbox\z@\lastbox - \nointerlineskip\hbox{\unhbox\z@\/}% - \else \unskip\unpenalty\unskip \fi - \egroup - \setbox\pr@box\vbox{% - \baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@ - \@begindvi - \nointerlineskip - \splittopskip\z@skip\setbox\z@\vsplit\pr@box to\z@ - \unvbox\z@ - \nointerlineskip - %\color@setgroup - \box\pr@box - %\color@endgroup - }% - \pr@ship@end - {\let\protect\noexpand - \ifx\pr@offset@override\@undefined - \voffset=-\ht\pr@box - \hoffset=\z@ - \fi - \c@page=\pr@snippet - \pr@shipout - \ifpr@fixbb\hbox{% - \dimen@\wd\pr@box - \@tempdima\ht\pr@box - \@tempdimb\dp\pr@box - \box\pr@box - \llap{\raise\@tempdima\copy\pr@markerbox\kern\dimen@}% - \lower\@tempdimb\copy\pr@markerbox}% - \else \box\pr@box \fi}% - \global\advance\pr@snippet\@ne - \pr@cleanup -} -\let\pr@shipout=\shipout -\def\shipout{\deadcycles\z@\bgroup\setbox\z@\box\voidb@x - \afterassignment\pr@shipoutegroup\setbox\z@} -\def\pr@shipoutegroup{\ifvoid\z@ \expandafter\aftergroup\fi \egroup} -\def\pr@parseit#1{\csname pr@parse#1\endcsname} -\let\pr@endparse=\@percentchar -\def\next#1{% -\def\pr@callafter{% - \afterassignment\pr@parseit - \let#1= }} -\expandafter\next\csname pr@parse\pr@endparse\endcsname -\long\expandafter\def\csname pr@parse*\endcsname#1\pr@endparse#2{% - \begingroup\toks@{#1\pr@endparse{#2}}% - \edef\next##1{\endgroup##1\the\toks@}% - \@ifstar{\next{\pr@parse@*}}{\next\pr@parseit}} -\long\expandafter\def\csname pr@parse[\endcsname#1\pr@endparse#2{% - \begingroup\toks@{#1\pr@endparse{#2}}% - \edef\next##1{\endgroup##1\the\toks@}% - \@ifnextchar[{\next\pr@bracket}{\next\pr@parseit}} -\long\def\pr@bracket#1\pr@endparse#2[#3]{% - \pr@parseit#1\pr@endparse{#2[{#3}]}} -\expandafter\let\csname pr@parse]\endcsname=\pr@parseit -\long\def\pr@parse#1\pr@endparse#2#3{% - \pr@parseit#1\pr@endparse{#2{#3}}} -\expandafter\let\csname pr@parse!\endcsname=\pr@parse -\long\expandafter\def\csname pr@parse?\endcsname#1#2\pr@endparse#3{% - \begingroup\toks@{#2\pr@endparse{#3}}% - \@ifnextchar#1{\pr@parsecond\@firstoftwo}% - {\pr@parsecond\@secondoftwo}} -\def\pr@parsecond#1{\expandafter\endgroup - \expandafter\expandafter\expandafter\pr@parseit - \expandafter#1\the\toks@} - \long\def\pr@parse@#1#2\pr@endparse#3{% - \pr@parseit #2\pr@endparse{#3#1}} -\long\expandafter\def\csname pr@parse-\endcsname - #1\pr@endparse#2{\begingroup - \toks@{\endgroup\pr@parseit #1\pr@endparse{#2}}% - {\aftergroup\the\aftergroup\toks@ \afterassignment}% - \let\next= } -\long\expandafter\def\csname pr@parse:\endcsname - #1#2#3\pr@endparse#4{\begingroup - \toks@{\endgroup \pr@parseit#3\pr@endparse{#4}}% - \long\def\next#1{#2}% - \the\expandafter\toks@\next} -\long\expandafter\def\csname pr@parse#\endcsname - #1#2#3\pr@endparse#4{\begingroup - \toks@{#4}% - \long\edef\next##1{\toks@{\the\toks@##1}}% - \toks@{\endgroup \pr@parseit#3\pr@endparse}% - \long\def\reserved@a#1{{#2}}% - \the\expandafter\next\reserved@a} -\def\pr@endaftergroup#1{#1\aftergroup\pr@endbox} -\let\pr@endsnarf\relax -\long\def\pr@snarfafter#1{\ifpr@outer - \pr@ship@start - \let\pr@ship@start\relax - \let\pr@endsnarf\endgroup - \else - \let\pr@endsnarf\relax - \fi - \pr@protect{\pr@callafter\pr@startsnarf#1]\pr@endparse}} -\def\pr@startsnarf#1{#1\begingroup - \pr@startbox{\begingroup\aftergroup\pr@endbox}{\endgroup}% - \ignorespaces} -\renewenvironment{preview}{\begingroup - \pr@startbox{\begingroup\aftergroup\pr@endbox}% - {\endgroup}% - \ignorespaces}% - {\ifhmode\unskip\fi\endgroup} -\renewenvironment{nopreview}{\pr@outerfalse\ignorespaces}% - {\ifhmode\unskip\fi} -\newtoks\pr@output -\pr@output\output -\output{% - \pr@outerfalse - \let\@begindvi\@empty - \the\pr@output} -\let\output\pr@output -\def\pr@typeinfos{\typeout{Preview: Fontsize \f@size pt}% - \ifnum\mag=\@m\else\typeout{Preview: Magnification \number\mag}\fi - \ifx\pdfoutput\@undefined - \ifx\XeTeXversion\@undefined \else - % FIXME: The message should not be emitted if XeTeX does not produce - % PDF. There does not seem to be a primitive for that, though. - \typeout{Preview: PDFoutput 1}% - \fi - \else - \ifx\pdfoutput\relax \else - \ifnum\pdfoutput>\z@ - \typeout{Preview: PDFoutput 1}% - \fi - \fi - \fi -} -\AtBeginDocument{\pr@typeinfos} -\pr@loadcfg{prdefault} -\endinput -%% -%% End of file `preview.sty'. diff --git a/packages/auctex/latex/prfootnotes.def b/packages/auctex/latex/prfootnotes.def deleted file mode 100644 index 2d525a8ab..000000000 --- a/packages/auctex/latex/prfootnotes.def +++ /dev/null @@ -1,28 +0,0 @@ -%% -%% This is file `prfootnotes.def', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% preview.dtx (with options: `footnotes') -%% -%% IMPORTANT NOTICE: -%% -%% For the copyright see the source file. -%% -%% Any modified versions of this file must be renamed -%% with new filenames distinct from prfootnotes.def. -%% -%% For distribution of the original source see the terms -%% for copying and modification in the file preview.dtx. -%% -%% This generated file may be distributed as long as the -%% original source files, as listed above, are part of the -%% same distribution. (The sources need not necessarily be -%% in the same archive or directory.) -%% The preview style for extracting previews from LaTeX documents. -%% Developed as part of AUCTeX . -\PreviewMacro[[!]\footnote %] -\endinput -%% -%% End of file `prfootnotes.def'. diff --git a/packages/auctex/latex/prlyx.def b/packages/auctex/latex/prlyx.def deleted file mode 100644 index fd1dab790..000000000 --- a/packages/auctex/latex/prlyx.def +++ /dev/null @@ -1,32 +0,0 @@ -%% -%% This is file `prlyx.def', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% preview.dtx (with options: `lyx') -%% -%% IMPORTANT NOTICE: -%% -%% For the copyright see the source file. -%% -%% Any modified versions of this file must be renamed -%% with new filenames distinct from prlyx.def. -%% -%% For distribution of the original source see the terms -%% for copying and modification in the file preview.dtx. -%% -%% This generated file may be distributed as long as the -%% original source files, as listed above, are part of the -%% same distribution. (The sources need not necessarily be -%% in the same archive or directory.) -%% The preview style for extracting previews from LaTeX documents. -%% Developed as part of AUCTeX . -\ifPreview\else\expandafter\endinput\fi -\pr@loadcfg{prlyx} -\g@addto@macro\pr@ship@end{\typeout{Preview: - Snippet \number\pr@snippet\space - \number\ht\pr@box\space \number\dp\pr@box \space\number\wd\pr@box}} -\endinput -%% -%% End of file `prlyx.def'. diff --git a/packages/auctex/latex/prshowbox.def b/packages/auctex/latex/prshowbox.def deleted file mode 100644 index 3280b29d6..000000000 --- a/packages/auctex/latex/prshowbox.def +++ /dev/null @@ -1,32 +0,0 @@ -%% -%% This is file `prshowbox.def', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% preview.dtx (with options: `showbox') -%% -%% IMPORTANT NOTICE: -%% -%% For the copyright see the source file. -%% -%% Any modified versions of this file must be renamed -%% with new filenames distinct from prshowbox.def. -%% -%% For distribution of the original source see the terms -%% for copying and modification in the file preview.dtx. -%% -%% This generated file may be distributed as long as the -%% original source files, as listed above, are part of the -%% same distribution. (The sources need not necessarily be -%% in the same archive or directory.) -%% The preview style for extracting previews from LaTeX documents. -%% Developed as part of AUCTeX . -\ifPreview\else\expandafter\endinput\fi -\AtEndOfPackage{% - \showboxbreadth\maxdimen - \showboxdepth\maxdimen} -\g@addto@macro\pr@ship@end{\showbox\pr@box} -\endinput -%% -%% End of file `prshowbox.def'. diff --git a/packages/auctex/latex/prshowlabels.def b/packages/auctex/latex/prshowlabels.def deleted file mode 100644 index d0d61086b..000000000 --- a/packages/auctex/latex/prshowlabels.def +++ /dev/null @@ -1,67 +0,0 @@ -%% -%% This is file `prshowlabels.def', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% preview.dtx (with options: `showlabels') -%% -%% IMPORTANT NOTICE: -%% -%% For the copyright see the source file. -%% -%% Any modified versions of this file must be renamed -%% with new filenames distinct from prshowlabels.def. -%% -%% For distribution of the original source see the terms -%% for copying and modification in the file preview.dtx. -%% -%% This generated file may be distributed as long as the -%% original source files, as listed above, are part of the -%% same distribution. (The sources need not necessarily be -%% in the same archive or directory.) -%% The preview style for extracting previews from LaTeX documents. -%% Developed as part of AUCTeX . -\ifPreview\else\expandafter\endinput\fi -\newbox\pr@labelbox -\def\pr@label#1{\pr@@label{#1}% - \ifpr@setbox\z@{#1}% - \global\setbox\pr@labelbox\vbox{\unvbox\pr@labelbox - \box\z@}\egroup\fi} -\def\ifpr@setbox#1#2{% - \romannumeral% - \ifx\protect\@typeset@protect\ifpr@outer\else - \z@\bgroup - \protected@edef\next{#2}\@onelevel@sanitize\next - \ifx\next\@empty\egroup\romannumeral\else - \ifx\next\pr@lastlabel\egroup\romannumeral\else - \global\let\pr@lastlabel\next - \setbox#1\pr@boxlabel\pr@lastlabel - \expandafter\expandafter\romannumeral\fi\fi\fi\fi - \z@\iffalse\iftrue\fi} -\def\pr@boxlabel#1{\hbox{\normalfont - \footnotesize\ttfamily\fboxsep0.4ex\relax\fbox{#1}}} -\def\pr@maketag#1{\pr@@maketag{#1}% - \ifpr@setbox\z@{\df@label}% - \global\setbox\pr@labelbox\vbox{% - \hrule\@width\wd\z@\@height\z@ - \unvbox\pr@labelbox}% - \wd\z@\z@\box\z@ \egroup\fi} -\g@addto@macro\pr@ship@start{% - \global\setbox\pr@labelbox\box\voidb@x - \xdef\pr@lastlabel{}% - \global\let\pr@@label\label \let\label\pr@label - \global\let\pr@@maketag\maketag@@@ - \let\maketag@@@\pr@maketag -} -\pr@addto@front\pr@ship@end{% - \ifx \label\pr@label \global\let\label\pr@@label \fi - \ifx \maketag@@@\pr@maketag - \global\let\maketag@@@\pr@@maketag \fi - \ifvoid\pr@labelbox - \else \setbox\pr@box\hbox{% - \box\pr@box\,\box\pr@labelbox}% - \fi} -\endinput -%% -%% End of file `prshowlabels.def'. diff --git a/packages/auctex/latex/prtightpage.def b/packages/auctex/latex/prtightpage.def deleted file mode 100644 index 31516bed9..000000000 --- a/packages/auctex/latex/prtightpage.def +++ /dev/null @@ -1,146 +0,0 @@ -%% -%% This is file `prtightpage.def', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% preview.dtx (with options: `tightpage') -%% -%% IMPORTANT NOTICE: -%% -%% For the copyright see the source file. -%% -%% Any modified versions of this file must be renamed -%% with new filenames distinct from prtightpage.def. -%% -%% For distribution of the original source see the terms -%% for copying and modification in the file preview.dtx. -%% -%% This generated file may be distributed as long as the -%% original source files, as listed above, are part of the -%% same distribution. (The sources need not necessarily be -%% in the same archive or directory.) -%% The preview style for extracting previews from LaTeX documents. -%% Developed as part of AUCTeX . -\ifx\PreviewBorder\@undefined - \newdimen\PreviewBorder - \PreviewBorder=0.50001bp -\fi -\ifx\PreviewBbAdjust\@undefined - \def\PreviewBbAdjust{-\PreviewBorder -\PreviewBorder - \PreviewBorder \PreviewBorder} -\fi -\ifPreview\else\expandafter\endinput\fi -\def\pr@nextbb{\edef\next{\next\space\number\dimen@}% - \expandafter\xdef\csname pr@bb@% - \romannumeral\count@\endcsname{\the\dimen@}% - \advance\count@\@ne\ifnum\count@<5 - \afterassignment\pr@nextbb\dimen@=\fi} -\ifnum\pr@graphicstype=\z@ - \ifcase - \ifx\XeTeXversion\@undefined - \ifx\pdfoutput\@undefined \@ne\fi - \ifx\pdfoutput\relax \@ne\fi - \ifnum\pdfoutput>\z@ \tw@\fi \@ne - \else \thr@@\fi - \or \ExecuteOptions{dvips}\relax - \or \ExecuteOptions{pdftex}\relax - \or \ExecuteOptions{xetex}\relax\fi\fi -\global\let\pr@bbadjust\@empty -\pr@addto@front\pr@ship@end{\begingroup - \let\next\@gobble - \count@\@ne\afterassignment\pr@nextbb - \dimen@\PreviewBbAdjust - \ifx\pr@bbadjust\next - \else \global\let\pr@bbadjust\next - \typeout{Preview: Tightpage \pr@bbadjust}% - \fi\endgroup} -\ifcase\pr@graphicstype -\or - \g@addto@macro\pr@ship@end{\setbox\pr@box\hbox{% - \special{ps::\pr@bbadjust\space - \number\ifdim\ht\pr@box>\z@ \ht\pr@box - \else \z@ - \fi \space - \number\ifdim\dp\pr@box>\z@ \dp\pr@box - \else \z@ - \fi \space - \number\ifdim\wd\pr@box>\z@ \wd\pr@box - \else \z@ - \fi}\box\pr@box}} -\or - \g@addto@macro\pr@ship@end{{\dimen@\ht\pr@box - \ifdim\dimen@<\z@ \dimen@\z@\fi - \advance\dimen@\pr@bb@iv - \dimen@ii=\dimen@ - \global\pdfvorigin\dimen@ - \dimen@\dp\pr@box - \ifdim\dimen@<\z@ \dimen@\z@\fi - \advance\dimen@-\pr@bb@ii - \advance\dimen@\dimen@ii - \global\pdfpageheight\dimen@ - \dimen@\wd\pr@box - \ifdim\dimen@<\z@ \dimen@=\z@\fi - \advance\dimen@-\pr@bb@i - \advance\dimen@\pr@bb@iii - \global\pdfpagewidth\dimen@ - \global\pdfhorigin-\pr@bb@i}} -\or - \g@addto@macro\pr@ship@end{\dimen@\ht\pr@box - \ifdim\dimen@<\z@ \dimen@\z@\fi - \advance\dimen@\pr@bb@iv - \dimen@ii=\dimen@ - \voffset=-1in - \advance\voffset\dimen@ - \advance\voffset-\ht\pr@box - \dimen@\dp\pr@box - \ifdim\dimen@<\z@ \dimen@\z@\fi - \advance\dimen@-\pr@bb@ii - \advance\dimen@\dimen@ii - \global\pdfpageheight\dimen@ - \global\paperheight\dimen@ - \dimen@\wd\pr@box - \ifdim\dimen@<\z@ \dimen@=\z@\fi - \advance\dimen@-\pr@bb@i - \advance\dimen@\pr@bb@iii - \global\pdfpagewidth\dimen@ - \hoffset=-1in - \advance\hoffset-\pr@bb@i - \let\pr@offset@override\@empty} -\fi -\ifnum\pr@graphicstype=\@ne -\preview@delay{\AtBeginDvi{% - \special{!/preview@tightpage true def (% - compatibility PostScript comment for dvipng<=1.5 } - \special{!userdict begin/bop-hook{% - 7{currentfile token not{stop}if - 65781.76 div DVImag mul}repeat - 72 add 72 2 copy gt{exch}if 4 2 roll - neg 2 copy lt{exch}if dup 0 gt{pop 0 exch}% - {exch dup 0 lt{pop 0}if}ifelse 720 add exch 720 add - 3 1 roll - 4{5 -1 roll add 4 1 roll}repeat - <>setpagedevice% - //bop-hook exec}bind def end} - \special{!userdict (some extra code to avoid - dvipng>=1.6 unknown special: - 7{currentfile token not{stop}if 65781.76 div })) pop} - \special{!userdict begin/bop-hook{% - preview-bop-level 0 le{% - 7{currentfile token not{stop}if - 65781.76 div DVImag mul}repeat - 72 add 72 2 copy gt{exch}if 4 2 roll - neg 2 copy lt{exch}if dup 0 gt{pop 0 exch}% - {exch dup 0 lt{pop 0}if}ifelse 720 add exch 720 add - 3 1 roll - 4{5 -1 roll add 4 1 roll}repeat - <>setpagedevice}if% - //bop-hook exec}bind def end}}} -\fi -\endinput -%% -%% End of file `prtightpage.def'. diff --git a/packages/auctex/latex/prtracingall.def b/packages/auctex/latex/prtracingall.def deleted file mode 100644 index 7dfc7e344..000000000 --- a/packages/auctex/latex/prtracingall.def +++ /dev/null @@ -1,30 +0,0 @@ -%% -%% This is file `prtracingall.def', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% preview.dtx (with options: `tracingall') -%% -%% IMPORTANT NOTICE: -%% -%% For the copyright see the source file. -%% -%% Any modified versions of this file must be renamed -%% with new filenames distinct from prtracingall.def. -%% -%% For distribution of the original source see the terms -%% for copying and modification in the file preview.dtx. -%% -%% This generated file may be distributed as long as the -%% original source files, as listed above, are part of the -%% same distribution. (The sources need not necessarily be -%% in the same archive or directory.) -%% The preview style for extracting previews from LaTeX documents. -%% Developed as part of AUCTeX . -\ifPreview\else\expandafter\endinput\fi -\pr@addto@front\pr@ship@start{\let\tracingonline\count@ - \let\errorstopmode\@empty\tracingall} -\endinput -%% -%% End of file `prtracingall.def'. diff --git a/packages/auctex/multi-prompt.el b/packages/auctex/multi-prompt.el deleted file mode 100644 index 159380f64..000000000 --- a/packages/auctex/multi-prompt.el +++ /dev/null @@ -1,226 +0,0 @@ -;;; multi-prompt.el --- Completing read of multiple strings - -;; Copyright (C) 1996, 1997, 2000, 2009 Free Software Foundation - -;; Author: Per Abrahamsen -;; Maintainer: auctex-devel@gnu.org -;; Created: 1996-08-31 -;; Keywords: extensions - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program; if not, write to the Free Software -;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -;;; Commentary: - -;; This package is written for use in emacs lisp programs, where the -;; user is prompted for a string of the form: -;; -;; FOO,BAR,BAZ -;; -;; where FOO, BAR, and BAZ are elements of some table. The function -;; `multi-prompt' is a replacement `completing-read' that will allow -;; the user to enter a string like the above, yet get completion on -;; all FOO, BAR, and BAZ. - -;;; Code: - -(defvar multi-prompt-found nil - "List of entries currently added during a `multi-prompt'.") - -;;;###autoload -(defun multi-prompt (separator - unique prompt table - &optional mp-predicate require-match initial history) - "Completing prompt for a list of strings. -The first argument SEPARATOR should be the string (of length 1) to -separate the elements in the list. The second argument UNIQUE should -be non-nil, if each element must be unique. The remaining elements -are the arguments to `completing-read'. See that." - (let ((old-map (if require-match - minibuffer-local-must-match-map - minibuffer-local-completion-map)) - (new-map (make-sparse-keymap))) - (if (fboundp 'set-keymap-parent) - ;; `set-keymap-parent' was introduced in Emacs 19.32. - (set-keymap-parent new-map old-map) - (setq new-map (copy-keymap old-map))) - (define-key new-map separator (if require-match - 'multi-prompt-next-must-match - 'multi-prompt-next)) - (define-key new-map "\C-?" 'multi-prompt-delete) - (let* ((minibuffer-local-completion-map new-map) - (minibuffer-local-must-match-map new-map) - (multi-prompt-found nil) - (done nil) - (filter (cond (unique - (lambda (x) - (and (not (member (car x) multi-prompt-found)) - (or (null mp-predicate) - (funcall mp-predicate x))))) - (mp-predicate))) - (answer (catch 'multi-prompt-exit - (while t - (let ((extra (catch 'multi-prompt-next - (throw 'multi-prompt-exit - (completing-read prompt - table - filter - require-match - initial - history))))) - (cond ((eq extra 'back) - (when multi-prompt-found - (setq prompt (substring - prompt 0 - (- 0 (length separator) - (length - (car multi-prompt-found)))) - initial (car multi-prompt-found)) - (setq multi-prompt-found - (cdr multi-prompt-found)))) - (t - (setq prompt (concat prompt extra separator) - initial nil) - (setq multi-prompt-found - (cons extra multi-prompt-found))))))))) - (if answer - (nreverse (cons answer multi-prompt-found)) - multi-prompt-found)))) - -(defun multi-prompt-delete () - (interactive) - (if (bobp) - (throw 'multi-prompt-next 'back) - (call-interactively 'backward-delete-char))) - -(defun multi-prompt-next () - (interactive) - (throw 'multi-prompt-next - (cond - ((fboundp 'minibuffer-contents-no-properties) - ;; buffer-substring no longer works in emacs-21, it returns - ;; the whole prompt line. Use this instead. - (minibuffer-contents-no-properties)) - (t - (buffer-substring-no-properties (point-min) (point-max)))))) - -(defun multi-prompt-next-must-match () - (interactive) - (when (call-interactively 'minibuffer-complete) - (let ((content (buffer-substring-no-properties (point-min) (point-max)))) - (when (or (not require-match) - (assoc content table)) - (throw 'multi-prompt-next content))))) - - -;;; Support for key=value completion - -;; The following code was ripped out of crm.el -;; (completing-read-multiple) and extended to support comma-separated -;; key=value lists. The code is separate from the code above. - -;; WARNING: This obviously relies on internals of crm.el and -;; minibuffer.el and will therefore have to be adapted if these -;; change. - -;; TODO: How to support stuff like "caption={[one]two}" or -;; "morekeywords={one,three,five}"? - -(defvar multi-prompt-key-value-sep "=" - "Single-character string separating key=value pairs.") -(defvar multi-prompt-completion-table nil - "Completion table used by `multi-prompt-key-value'.") - -(defun multi-prompt-key-value-collection-fn (string predicate flag) - "Function used by `multi-prompt-key-value' to compute completion values. -The value of STRING is the string to be completed. - -The value of PREDICATE is a function to filter possible matches, or -nil if none. - -The value of FLAG is used to specify the type of completion operation. -A value of nil specifies `try-completion'. A value of t specifies -`all-completions'. A value of lambda specifes a test for an exact match. - -For more information on STRING, PREDICATE, and FLAG, see the Elisp -Reference sections on 'Programmed Completion' and 'Basic Completion -Functions'." - (let ((beg 0) (last 0) matched) - (while (string-match multi-prompt-key-value-sep string beg) - (setq matched t - last beg - beg (match-end 0))) - (completion-table-with-context - (substring string 0 beg) - (if (not matched) - multi-prompt-completion-table - (cadr (assoc (substring string last (1- beg)) - multi-prompt-completion-table))) - (substring string beg) - predicate - flag))) - -(defun multi-prompt-expand-completion-table (table) - "Return an expanded version of completion table TABLE. -This is achieved by eval'ing all variables in the value parts of -the alist elements." - (mapcar (lambda (x) - (if (and (cadr x) (symbolp (cadr x)) (not (functionp (cadr x)))) - (cons (car x) (list (eval (cadr x)))) - x)) - table)) - -;; Silence the byte compiler. -(defvar crm-local-must-match-map) -(defvar crm-local-completion-map) - -;;;###autoload -(defun multi-prompt-key-value - (prompt table &optional predicate require-match initial-input - hist def inherit-input-method) - "Read multiple strings, with completion and key=value support. -PROMPT is a string to prompt with, usually ending with a colon -and a space. TABLE is an alist. The car of each element should -be a string representing a key and the optional cdr should be a -list with strings to be used as values for the key. - -See the documentation for `completing-read' for details on the -other arguments: PREDICATE, REQUIRE-MATCH, INITIAL-INPUT, HIST, -DEF, and INHERIT-INPUT-METHOD. - -The return value is the string as entered in the minibuffer." - (require 'crm) - (let* ((minibuffer-completion-table #'multi-prompt-key-value-collection-fn) - (minibuffer-completion-predicate predicate) - (minibuffer-completion-confirm - (unless (eq require-match t) require-match)) - (multi-prompt-completion-table - ;; Expand the table here because completion would otherwise - ;; interpret symbols in the table as functions. However, it - ;; would be nicer if this could be done during the actual - ;; completion in order to avoid walking through the whole - ;; table. - (multi-prompt-expand-completion-table table)) - (map (if require-match - crm-local-must-match-map - crm-local-completion-map)) - (input (read-from-minibuffer - prompt initial-input map - nil hist def inherit-input-method))) - (and def (string-equal input "") (setq input def)) - input)) - -(provide 'multi-prompt) - -;;; multi-prompt.el ends here diff --git a/packages/auctex/preview-latex.info b/packages/auctex/preview-latex.info deleted file mode 100644 index db6780b0b..000000000 --- a/packages/auctex/preview-latex.info +++ /dev/null @@ -1,2700 +0,0 @@ -This is preview-latex.info, produced by makeinfo version 4.13 from -preview-latex.texi. - -This manual is for preview-latex, a LaTeX preview mode for AUCTeX -(version 11.86 from 2010-02-21). - - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software -Foundation, Inc. - - Permission is granted to copy, distribute and/or modify this - document under the terms of the GNU Free Documentation License, - Version 1.3 or any later version published by the Free Software - Foundation; with no Invariant Sections, no Front-Cover Texts and - no Back-Cover Texts. A copy of the license is included in the - section entitled "GNU Free Documentation License." - -INFO-DIR-SECTION Emacs -START-INFO-DIR-ENTRY -* preview-latex: (preview-latex). Preview LaTeX fragments in Emacs -END-INFO-DIR-ENTRY -INFO-DIR-SECTION TeX -START-INFO-DIR-ENTRY -* preview-latex: (preview-latex). Preview LaTeX fragments in Emacs -END-INFO-DIR-ENTRY - - -File: preview-latex.info, Node: Top, Prev: (dir), Up: (dir) - -preview-latex -************* - -This manual may be copied under the conditions spelled out in *note -Copying this Manual::. - - preview-latex is a package embedding preview fragments into Emacs -source buffers under the AUCTeX editing environment for LaTeX. It uses -`preview.sty' for the extraction of certain environments (most notably -displayed formulas). Other applications of this style file are -possible and exist. - - The name of the package is really `preview-latex', all in lowercase -letters, with a hyphen. If you typeset it, you can use a sans-serif -font to visually offset it. - -* Menu: - -* Copying:: Copying -* Introduction:: Getting started. -* Installation:: Make Install. -* Keys and lisp:: Key bindings and user-level lisp functions. -* Simple customization:: To make it fit in. -* Known problems:: When things go wrong. -* For advanced users:: Internals and more customizations. -* ToDo:: Future development. -* Frequently Asked Questions:: All about preview-latex -* Copying this Manual:: GNU Free Documentation License -* Index:: A menu of many topics. - - -File: preview-latex.info, Node: Copying, Next: Introduction, Prev: Top, Up: Top - -Copying -******* - -For the conditions for copying parts of preview-latex, see the General -Public Licenses referres to in the copyright notices of the files, the -General Public Licenses accompanying them and the explanatory section in -*note Copying: (auctex)Copying. - - This manual specifically is covered by the GNU Free Documentation -License (*note Copying this Manual::). - - -File: preview-latex.info, Node: Introduction, Next: Installation, Prev: Copying, Up: Top - -1 Introduction -************** - -Does your neck hurt from turning between previewer windows and the -source too often? This AUCTeX component will render your displayed -LaTeX equations right into the editing window where they belong. - - The purpose of preview-latex is to embed LaTeX environments such as -display math or figures into the source buffers and switch conveniently -between source and image representation. - -* Menu: - -* What use is it?:: -* Activating preview-latex:: -* Getting started:: -* Basic modes of operation:: -* More documentation:: -* Availability:: -* Contacts:: - - -File: preview-latex.info, Node: What use is it?, Next: Activating preview-latex, Prev: Introduction, Up: Introduction - -1.1 What use is it? -=================== - - WYSIWYG (what you see is what you get) sometimes is considered all -the rage, sometimes frowned upon. Do we really want it? Wrong -question. The right question is _what_ we want from it. Except when -finetuning the layout, we don't want to use printer fonts for on-screen -text editing. The low resolution and contrast of a computer screen -render all but the coarsest printer fonts (those for low-quality -newsprint) unappealing, and the margins and pagination of the print are -not wanted on the screen, either. On the other hand, more complex -visual compositions like math formulas and tables can't easily be taken -in when seen only in the source. preview-latex strikes a balance: it -only uses graphic renditions of the output for certain, configurable -constructs, does this only when told, and then right in the source code. -Switching back and forth between the source and preview is easy and -natural and can be done for each image independently. Behind the scenes -of preview-latex, a sophisticated framework of other programs like -`dvipng', Dvips and Ghostscript are employed together with a special -LaTeX style file for extracting the material of interest in the -background and providing fast interactive response. - - -File: preview-latex.info, Node: Activating preview-latex, Next: Getting started, Prev: What use is it?, Up: Introduction - -1.2 Activating preview-latex -============================ - -After installation, the package may need to be activated (and remember -to activate AUCTeX too). In XEmacs, and in any prepackaged versions -worth their salt, activation should be automatic upon installation. If -this seems not the case, complain to your installation provider. - - The usual activation (if it is not done automatically) would be - - (load "preview-latex.el" nil t t) - - If you still don't get a "Preview" menu in LaTeX mode in spite of -AUCTeX showing its "Command", your installation is broken. One -possible cause are duplicate Lisp files that might be detectable with -` list-load-path-shadows '. - - -File: preview-latex.info, Node: Getting started, Next: Basic modes of operation, Prev: Activating preview-latex, Up: Introduction - -1.3 Getting started -=================== - -Once activated, preview-latex and its documentation will be accessible -via its menus (note that preview-latex requires AUCTeX to be loaded). -When you have loaded a LaTeX document (a sample document `circ.tex' is -included in the distribution, but most documents including math and/or -figures should do), you can use its menu or `C-c C-p C-d' (for -`Preview/Document'). Previews will now be generated for various -objects in your document. You can use the time to take a short look at -the other menu entries and key bindings in the `Preview' menu. You'll -see the previewed objects change into a roadworks sign when -preview-latex has determined just what it is going to preview. Note -that you can freely navigate the buffer while this is going on. When -the process is finished you will see the objects typeset in your buffer. - - It is a bad idea, however, to edit the buffer before the roadworks -signs appear, since that is the moment when the correlation between the -original text and the buffer locations gets established. If the buffer -changes before that point of time, the previews will not be placed where -they belong. If you do want to change some obvious error you just -spotted, we recommend you stop the background process by pressing `C-c -C-k'. - - To see/edit the LaTeX code for a specific object, put the point (the -cursor) on it and press `C-c C-p C-p' (for `Preview/at point'). It -will also do to click with the middle mouse button on the preview. Now -you can edit the code, and generate a new preview by again pressing -`C-c C-p C-p' (or by clicking with the middle mouse button on the icon -before the edited text). - - If you are using the `desktop' package, previews will remain from -one session to the next as long as you don't kill your buffer. If you -are using XEmacs, you will probably need to upgrade the package to the -newest one; things are being fixed just as I am writing this. - - -File: preview-latex.info, Node: Basic modes of operation, Next: More documentation, Prev: Getting started, Up: Introduction - -1.4 Basic modes of operation -============================ - -preview-latex has a number of methods for generating its graphics. Its -default operation is equivalent to using the `LaTeX' command from -AUCTeX. If this happens to be a call of PDFLaTeX generating PDF output -(you need at least AUCTeX 11.51 for this), then Ghostscript will be -called directly on the resulting PDF file. If a DVI file gets -produced, first Dvips and then Ghostscript get called by default. - - The image type to be generated by Ghostscript can be configured with - - M-x customize-variable RET preview-image-type RET - -The default is `png' (the most efficient image type). A special -setting is `dvipng' in case you have the `dvipng' program installed. -In this case, `dvipng' will be used for converting DVI files and -Ghostscript (with a `PNG' device) for converting PDF files. `dvipng' -is much faster than the combination of Dvips and Ghostscript. You can -get downloads, access to its CVS archive and further information from -its project site (http://savannah.nongnu.org/projects/dvipng). - - -File: preview-latex.info, Node: More documentation, Next: Availability, Prev: Basic modes of operation, Up: Introduction - -1.5 More documentation -====================== - -After the installation, documentation in the form of this info manual -will be available. You can access it with the standalone info reader -with - - info preview-latex - -or by pressing `C-h i d m preview-latex ' in Emacs. Once -preview-latex is activated, you can instead use `C-c C-p ' (or the -menu entry `Preview/Read documentation'). - - Depending on your installation, a printable manual may also be -available in the form of `preview-latex.dvi' or `preview-latex.ps'. - - Detailed documentation for the LaTeX style used for extracting the -preview images is placed in `preview.dvi' in a suitable directory -during installation; on typical teTeX-based systems, - - texdoc preview - -will display it. - - -File: preview-latex.info, Node: Availability, Next: Contacts, Prev: More documentation, Up: Introduction - -1.6 Availability -================ - -The preview-latex project is now part of AUCTeX and accessible as part -of the AUCTeX project page (http://savannah.gnu.org/projects/auctex). -You can get its files from the AUCTeX download area -(ftp://ftp.gnu.org/pub/gnu/auctex). As of AUCTeX 11.81, preview-latex -should already be integrated into AUCTeX, so no separate download will -be necessary. - - You will also find `.rpm' files there for Fedora and possibly SuSE. -Anonymous CVS is available as well. - - -File: preview-latex.info, Node: Contacts, Prev: Availability, Up: Introduction - -1.7 Contacts -============ - -Bug reports should be sent by using `M-x preview-report-bug ', as -this will fill in a lot of information interesting to us. If the -installation fails (but this should be a rare event), report bugs to -. - - There is a general discussion list for AUCTeX which also covers -preview-latex, look at `http://lists.gnu.org/mailman/listinfo/auctex'. -For more information on the mailing list, send a message with just the -word "help" as subject or body to . For the -developers, there is the list; it would probably -make sense to direct feature requests and questions about internal -details there. There is a low-volume read-only announcement list -available to which you can subscribe by sending a mail with "subscribe" -in the subject to . - - Offers to support further development will be appreciated. If you -want to show your appreciation with a donation to the main developer, -you can do so via PayPal to , and of course you can arrange -for service contracts or for added functionality. Take a look at the -`TODO' list for suggestions in that area. - - -File: preview-latex.info, Node: Installation, Next: Keys and lisp, Prev: Introduction, Up: Top - -2 Installation -************** - -Installation is now being covered in *note Installation: -(auctex)Installation. - - -File: preview-latex.info, Node: Keys and lisp, Next: Simple customization, Prev: Installation, Up: Top - -3 Key bindings and user-level lisp functions -******************************************** - -preview-latex adds key bindings starting with `C-c C-p' to the -supported modes of AUCTeX (*note (auctex)Key Index::). It will also -add its own `Preview' menu in the menu bar, as well as an icon in the -toolbar. - - The following only describes the interactive use: view the -documentation strings with `C-h f' if you need the Lisp information. - -`C-c C-p C-p' -`preview-at-point' -Preview/Generate previews (or toggle) at point - If the cursor is positioned on or inside of a preview area, this - toggles its visibility, regenerating the preview if necessary. If - not, it will run the surroundings through preview. The - surroundings include all areas up to the next valid preview, - unless invalid previews occur before, in which case the area will - include the last such preview in either direction. And overriding - any other action, if a region is active (`transient-mark-mode' or - `zmacs-regions'), it is run through `preview-region'. - -`' - The middle mouse button has a similar action bound to it as - `preview-at-point', only that it knows which preview to apply it to - according to the position of the click. You can click either - anywhere on a previewed image, or when the preview is opened and - showing the source text, you can click on the icon preceding the - source text. In other areas, the usual mouse key action - (typically: paste) is not affected. - -`' - The right mouse key pops up a context menu with several options: - toggling the preview, regenerating it, removing it (leaving the - unpreviewed text), copying the text inside of the preview, and - copying it in a form suitable for copying as an image into a mail - or news article. This is a one-image variant of the following - command: - -`C-c C-p C-w' -`preview-copy-region-as-mml' -Copy a region as MML - This command is also available as a variant in the context menu on - the right mouse button (where the region is the preview that has - been clicked on). It copies the current region into the kill - buffer in a form suitable for copying as a text including images - into a mail or news article using mml-mode (*note Composing: - (emacs-mime)Composing.). - - If you regenerate or otherwise kill the preview in its source - buffer before the mail or news gets posted, this will fail. Also - you should generate images you want to send with - `preview-transparent-border' set to `nil', or the images will have - an ugly border. preview-latex detects this condition and asks - whether to regenerate the region with borders switched off. As - this is an asynchronous operation running in the background, - you'll need to call this command explicitly again to get the newly - generated images into the kill ring. - - Preview your articles with `mml-preview' (on `M-m P', or `C-c C-m - P' in Emacs 22) to make sure they look fine. - -`C-c C-p C-e' -`preview-environment' -Preview/Generate previews for environment - Run preview on LaTeX environment. The environments in - `preview-inner-environments' are treated as inner levels so that - for instance, the `split' environment in - `\begin{equation}\begin{split}...\end{split}\end{equation}' is - properly displayed. If called with a numeric argument, the - corresponding number of outward nested environments is treated as - inner levels. - -`C-c C-p C-s' -`preview-section' -Preview/Generate previews for section - Run preview on this LaTeX section. - -`C-c C-p C-r' -`preview-region' -Preview/Generate previews for region - Run preview on current region. - -`C-c C-p C-b' -`preview-buffer' -Preview/Generate previews for buffer - Run preview on the current buffer. - -`C-c C-p C-d' -`preview-document' -Preview/Generate previews for document - Run preview on the current document. - -`C-c C-p C-c C-p' -`preview-clearout-at-point' -Preview/Remove previews at point - Clear out (remove) the previews that are immediately adjacent to - point. - -`C-c C-p C-c C-s' -`preview-clearout-section' -Preview/Remove previews from section - Clear out all previews in current section. - -`C-c C-p C-c C-r' -`preview-clearout' -Preview/Remove previews from region - Clear out all previews in the current region. - -`C-c C-p C-c C-b' -`preview-clearout-buffer' -Preview/Remove previews from buffer - Clear out all previews in current buffer. This makes the current - buffer lose all previews. - -`C-c C-p C-c C-d' -`preview-clearout-document' -Preview/Remove previews from document - Clear out all previews in current document. The document consists - of all buffers that have the same master file as the current - buffer. This makes the current document lose all previews. - -`C-c C-p C-f' -`preview-cache-preamble' -Preview/Turn preamble cache on - Dump a pregenerated format file. For the rest of the session, - this file is used when running on the same master file. Use this - if you know your LaTeX takes a long time to start up, the speedup - will be most noticeable when generating single or few previews. - If you change your preamble, do this again. preview-latex will - try to detect the necessity of that automatically when editing - changes to the preamble are done from within Emacs, but it will - not notice if the preamble effectively changes because some - included file or style file is tampered with. - -`C-c C-p C-c C-f' -`preview-cache-preamble-off' -Preview/Turn preamble cache off - Clear the pregenerated format file and stop using preambles for the - current document. If the caching gives you problems, use this. - -`C-c C-p C-i' -`preview-goto-info-page' -Preview/Read Documentation - Read this info manual. - -`M-x preview-report-bug ' -`preview-report-bug' -Preview/Report Bug - This is the preferred way of reporting bugs as it will fill in what - version of preview-latex you are using as well as versions of - relevant other software, and also some of the more important - settings. Please use this method of reporting, if at all possible - and before reporting a bug, have a look at *note Known problems::. - -`C-c C-k' -LaTeX/TeX Output/Kill Job - Kills the preview-generating process. This is really an AUCTeX - keybinding, but it is included here as a hint. If you are - generating a preview and then make a change to the buffer, - preview-latex may be confused and place the previews wrong. - - -File: preview-latex.info, Node: Simple customization, Next: Known problems, Prev: Keys and lisp, Up: Top - -4 Simple customization -********************** - -Customization options can be found by typing `M-x customize-group -preview '. Remember to set the option when you have changed it. -The list of suggestions can be made very long (and is covered in detail -in *note For advanced users::), but some are: - - * Change the color of the preview background - - If you use a non-white background in Emacs, you might have color - artifacts at the edges of your previews. Playing around with the - option `preview-transparent-color' in the `Preview Appearance' - group might improve things. With some settings, the cursor may - cover the whole background of a preview, however. - - This option is specific to the display engine in use. Its default - is different in Emacs 21 and Emacs 22, and it is not available in - XEmacs. - - * Showing `\label's - - When using preview-latex, the `\label's are hidden by the - previews. It is possible to make them visible in the output by - using the LaTeX package `showkeys' alternatively `showlabels'. - However, the boxes of these labels will be outside the region - preview-latex considers as the preview image. To enable a similar - mechanism internal to preview-latex, enable the `showlabels' - option in the variable `preview-default-option-list' in the - `Preview Latex' group. - - It must be noted, however, that a much better idea may be to use - the RefTeX package for managing references. *Note RefTeX in a - Nutshell: (reftex)RefTeX in a Nutshell. - - * Open previews automatically - - The current default is to open previews automatically when you - enter them with cursor left/right motions. Auto-opened previews - will close again once the cursor leaves them again (this is also - done when doing incremental search, or query-replace operations), - unless you changed anything in it. In that case, you will have to - regenerate the preview (via e.g., `C-c C-p C-p'). Other options - for `preview-auto-reveal' are available via `customize'. - - * Automatically cache preambles - - Currently preview-latex asks you whether you want to cache the - document preamble (everything before `\begin{document}') before it - generates previews for a buffer the first time. Caching the - preamble will significantly speed up regeneration of previews. - The larger your preamble is, the more this will be apparent. Once - a preamble is cached, preview-latex will try to keep track of when - it is changed, and dump a fresh format in that case. If you - experience problems with this, or if you want it to happen without - asking you the first time, you can customize the variable - `preview-auto-cache-preamble'. - - * Attempt to keep counters accurate when editing - - Since preview-latex frequently runs only small regions through - LaTeX, values like equation counters are not consistent from run to - run. If this bothers you, customize the variable - `preview-preserve-counters' to `t' (this is consulted by - `preview-required-option-list'). LaTeX will then output a load of - counter information during compilation, and this information will - be used on subsequent updates to keep counters set to useful - values. The additional information takes additional time to - analyze, but this is relevant mostly only when you are - regenerating all previews at once, and maybe you will be less - tempted to do so when counters appear more or less correct. - - * Preview your favourite LaTeX constructs - - If you have a certain macro or environment that you want to - preview, first check if it can be chosen by cutomizing - `preview-default-options-list' in the `Preview Latex' group. - - If it is not available there, you can add it to - `preview-default-preamble' also in the `Preview Latex' group, by - adding a `\PreviewMacro' or `\PreviewEnvironment' entry (*note - Provided commands::) _after_ the `\RequirePackage' line. For - example, if you want to preview the `center' environment, press - the button and the last button, then add - - \PreviewEnvironment{center} - in the space that just opened. Note that since `center' is a - generic formatting construct of LaTeX, a general configuration like - that is not quite prudent. You better to do this on a per-document - base so that it is easy to disable this behavior when you find this - particular entry gives you trouble. - - One possibility is to save such settings in the corresponding - file-local variable instead of your global configuration (*note - Local Variables in Files: (emacs)File Variables.). A perhaps more - convenient place for such options would be in a configuration file - in the same directory with your project (*note Package options::). - - The usual file for preview-latex preconfiguration is - `prauctex.cfg'. If you also want to keep the systemwide defaults, - you should add a line - - \InputIfFileExists{preview/prauctex.cfg}{}{} - to your own version of `prauctex.cfg' (this is assuming that - global files relating to the `preview' package are installed in a - subdirectory `preview', the default behavior). - - * Don't preview inline math - - If you have performance problems because your document is full of - inline math (`$...$'), or if your usage of `$' conflicts with - preview-latex's, you can turn off inline math previews. In the - `Preview Latex' group, remove `textmath' from - `preview-default-option-list' by customizing this variable. - - -File: preview-latex.info, Node: Known problems, Next: For advanced users, Prev: Simple customization, Up: Top - -5 Known problems -**************** - -A number of issues are known concerning the interoperation with various -other software. Some of the known problems can be solved by moving to -newer versions of the problematic software or by simple patches. - -* Menu: - -* Problems with Ghostscript:: -* Font problems with Dvips:: -* Emacs problems:: -* Too small bounding boxes:: -* x-symbol interoperation:: -* Middle-clicks paste instead of toggling:: - - If you find something not mentioned here, please send a bug report -using `M-x preview-report-bug ', which will fill in a lot of -information interesting to us and send it to the -list. Please use the bug reporting commands if at all possible. - - -File: preview-latex.info, Node: Problems with Ghostscript, Next: Font problems with Dvips, Up: Known problems - -5.1 Problems with Ghostscript -============================= - - Most of the problems encountered come from interaction with -Ghostscript. It is a good idea to have a fairly recent version of -Ghostscript installed. One problem occurs if you have specified the -wrong executable under Windows: the command line version of Ghostscript -is called `GSWIN32C.EXE', not `GSWIN32.EXE'. - - When Ghostscript fails, the necessary information and messages from -Ghostscript go somewhere. If Ghostscript fails before starting to -process images, you'll find the information at the end of the process -buffer you can see with `C-c C-l'. If Ghostscript fails while -processing a particular image, this image will be tagged with clickable -buttons for the error description and for the corresponding source file. - - The default options configurable with - - `M-x customize-variable preview-gs-options ' - include the options `-dTextAlphaBits=4' and `-dGraphicsAlphaBits=4'. -These options have been reported to make Ghostscript 5.50 fail, but -should work under Ghostscript 6.51 and later. If you are experiencing -problems, it might help to customize them away. Of course, this also -takes away the joy of antialiasing, so upgrading Ghostscript might not -be the worst idea after all. - - The device names have changed over time, so when using an old -Ghostscript, you may have problems with the devices demanded by the -customizable variable `preview-image-creators'. In that case, make -sure they fit your version of Ghostscript, at least the entry -corresponding to the current value of `preview-image-type'. While not -being best in file size and image quality, setting -`preview-image-creators' to `jpeg' should probably be one of the best -bets for the purpose of checking basic operation, since that device -name has not changed in quite some time. But JPEG is not intended for -text, but for photographic images. On a more permanent time scale, the -best choice is to use PNG and complain to your suppliers if either -Emacs or Ghostscript fail to properly accommodate this format. - - -File: preview-latex.info, Node: Font problems with Dvips, Next: Emacs problems, Prev: Problems with Ghostscript, Up: Known problems - -5.2 Font problems with Dvips -============================ - -Some fonts have been reported to produce wrong characters with -preview-latex. preview-latex calls Dvips by default with the option -`-Pwww' in order to get scalable fonts for nice results. If you are -using antialiasing, however, the results might be sufficiently nice -with bitmapped fonts, anyway. You might try `-Ppdf' for another stab -at scalable fonts, or other printer definitions. Use - - `M-x customize-variable preview-fast-dvips-command ' - and - `M-x customize-variable preview-dvips-command ' - in order to customize this. - - One particular problem is that several printer setup files -(typically in a file called `/usr/share/texmf/dvips/config/config.pdf' -if you are using the `-Ppdf' switch) contain the `G' option for -`character shifting'. This option will result in `fi' being rendered -as `#' (British Pounds sign) in several fonts, unless your version of -Dvips has a long-standing bug in its implementation fixed (only very -recent versions of Dvips have). - - -File: preview-latex.info, Node: Emacs problems, Next: Too small bounding boxes, Prev: Font problems with Dvips, Up: Known problems - -5.3 Emacs problems -================== - - * GNU Emacs versions - - Don't use Emacsen older than 21.3 on X11-based systems. On most - other systems, you'll need at least Emacs 22.1 or one of the - developer versions leading up to it. Details can be found in - *note Prerequisites: (auctex)Prerequisites. - - * Emacsen on Windows operating systems - - For Emacs 21, no image support is available in Emacs under Windows. - Without images, preview-latex is useless. The current CVS version - of Emacs available from `http://savannah.gnu.org/projects/emacs' - now supports images including the PNG format, so Emacs 22 should - work out of the box once it is released. Precompiled versions are - available from `http://crasseux.com/emacs' and - `http://nqmacs.sf.net'. - - For detailed installation instructions for Windows, see *note - Installation under MS Windows: (auctex)Installation under MS - Windows. - - * XEmacs - - There is are two larger problems known with older XEmacs releases. - One leads to seriously mispositioned baselines and previews - hanging far above other text on the same line. This should be - fixed as of XEmacs-21.4.9. - - The other core bug causes a huge delay when XEmacs's idea of the - state of processes (like ghostscript) is wrong, and can lead to - nasty spurious error messages. It should be fixed in version - 21.4.8. - - Previews will only remain from one session to the next if you have - version 1.81 or above of the `edit-utils' package, first released - in the 2002-03-12 sumo tarball. - - -File: preview-latex.info, Node: Too small bounding boxes, Next: x-symbol interoperation, Prev: Emacs problems, Up: Known problems - -5.4 Too small bounding boxes -============================ - -The bounding box of a preview is determined by the LaTeX package using -the pure TeX bounding boxes. If there is material extending outside of -the TeX box, that material will be missing from the preview image. -This happens for the label-showing boxes from the `showkeys' package. -This particular problem can be circumvented by using the `showlabels' -option of the preview package. - - In general, you should try to fix the problem in the TeX code, like -avoiding drawing outside of the picture with PSTricks. - - One possible remedy is to set `preview-fast-conversion' to `Off' -(*note The Emacs interface::). The conversion will take more time, but -will then use the bounding boxes from EPS files generated by Dvips. - - Dvips generally does not miss things, but it does not understand -PostScript constructs like `\resizebox' or `\rotate' commands, so will -generate rather wrong boxes for those. Dvips can be helped with the -`psfixbb' package option to preview (*note The LaTeX style file::), -which will tag the corners of the included TeX box. This will mostly -be convenient for _pure_ PostScript stuff like that created by -PSTricks, which Dvips would otherwise reserve no space for. - - -File: preview-latex.info, Node: x-symbol interoperation, Next: Middle-clicks paste instead of toggling, Prev: Too small bounding boxes, Up: Known problems - -5.5 x-symbol interoperation -=========================== - -Thanks to the work of Christoph Wedler, starting with version -`4.0h/beta' of x-symbol, the line parsing of AUCTeX and preview-latex -is fully supported. Earlier versions exhibit problems. However, -versions before 4.2.2 will cause a drastic slowdown of preview-latex's -parsing pass, so we don't recommend to use versions earlier than that. - - If you wonder what x-symbol is, it is a package that transforms -various tokens and subscripts to a more readable form while editing and -offers a few input methods handy especially for dealing with math. Take -a look at `http://x-symbol.sourceforge.net'. - - x-symbol versions up to 4.5.1-beta at least require an 8bit-clean TeX -implementation (meaning that its terminal output should not use -`^^'-started escape sequences) for cooperation with preview-latex. -Later versions may get along without it, like preview-latex does now. - - If you experience problems with `circ.tex' in connection with both -x-symbol and Latin-1 characters, you may need to change your language -environment or, as a last resort, customize the variable -`LaTeX-command-style' by replacing the command `latex' with `latex --translate-file=cp8bit'. - - -File: preview-latex.info, Node: Middle-clicks paste instead of toggling, Prev: x-symbol interoperation, Up: Known problems - -5.6 Middle-clicks paste instead of toggling -=========================================== - -This is probably the fault of your favorite package. `flyspell.el' and -`mouse-drag.el' are known to be affected in versions before Emacs 21.3. -Upgrade to the most recent version. What version of XEmacs might -contain the fixes is unknown. - - `isearch.el' also shows this effect while searches are in progress, -but the code is such a complicated mess that no patch is in sight. -Better just end the search with `' before toggling and resume with -`C-s C-s' or similar afterwards. Since previews over the current match -will auto-open, anyway, this should not be much of a problem in -practice. - - -File: preview-latex.info, Node: For advanced users, Next: ToDo, Prev: Known problems, Up: Top - -6 For advanced users -******************** - -This package consists of two parts: a LaTeX style that splits the -output into appropriate parts with one preview object on each page, and -an Emacs-lisp part integrating the thing into Emacs (aided by AUCTeX). - -* Menu: - -* The LaTeX style file:: -* The Emacs interface:: -* The preview images:: -* Misplaced previews:: - - -File: preview-latex.info, Node: The LaTeX style file, Next: The Emacs interface, Prev: For advanced users, Up: For advanced users - -6.1 The LaTeX style file -======================== - -The main purpose of this package is the extraction of certain -environments (most notably displayed formulas) from LaTeX sources as -graphics. This works with DVI files postprocessed by either Dvips and -Ghostscript or dvipng, but it also works when you are using PDFTeX for -generating PDF files (usually also postprocessed by Ghostscript). - - Current uses of the package include the preview-latex package for -WYSIWYG functionality in the AUCTeX editing environment, generation of -previews in LyX, as part of the operation of the ps4pdf package, the -tbook XML system and some other tools. - - Producing EPS files with Dvips and its derivatives using the `-E' -option is not a good alternative: People make do by fiddling around -with `\thispagestyle{empty}' and hoping for the best (namely, that the -specified contents will indeed fit on single pages), and then trying to -guess the baseline of the resulting code and stuff, but this is at best -dissatisfactory. The preview package provides an easy way to ensure -that exactly one page per request gets shipped, with a well-defined -baseline and no page decorations. While you still can use the preview -package with the `classic' - - dvips -E -i - -invocation, there are better ways available that don't rely on Dvips -not getting confused by PostScript specials. - - For most applications, you'll want to make use of the `tightpage' -option. This will embed the page dimensions into the PostScript or PDF -code, obliterating the need to use the `-E -i' options to Dvips. You -can then produce all image files with a single run of Ghostscript from -a single PDF or PostScript (as opposed to EPS) file. - - Various options exist that will pass TeX dimensions and other -information about the respective shipped out material (including -descender size) into the log file, where external applications might -make use of it. - - The possibility for generating a whole set of graphics with a single -run of Ghostscript (whether from LaTeX or PDFLaTeX) increases both -speed and robustness of applications. It is also feasible to use -dvipng on a DVI file with the options - - -picky -noghostscript - -to omit generating any image file that requires Ghostscript, then let a -script generate all missing files using Dvips/Ghostscript. This will -usually speed up the process significantly. - -* Menu: - -* Package options:: -* Provided commands:: - - -File: preview-latex.info, Node: Package options, Next: Provided commands, Prev: The LaTeX style file, Up: The LaTeX style file - -6.1.1 Package options ---------------------- - -The package is included with the customary - - \usepackage[OPTIONS]{preview} - -You should usually load this package as the last one, since it -redefines several things that other packages may also provide. - - The following options are available: - -`active' - is the most essential option. If this option is not specified, - the `preview' package will be inactive and the document will be - typeset as if the `preview' package were not loaded, except that - all declarations and environments defined by the package are still - legal but have no effect. This allows defining previewing - characteristics in your document, and only activating them by - calling LaTeX as - - latex '\PassOptionsToPackage{active}{preview} \input{FILENAME}' - -`noconfig' - Usually the file `prdefault.cfg' gets loaded whenever the - `preview' package gets activated. `prdefault.cfg' is supposed to - contain definitions that can cater for otherwise bad results, for - example, if a certain document class would otherwise lead to - trouble. It also can be used to override any settings made in - this package, since it is loaded at the very end of it. In - addition, there may be configuration files specific for certain - `preview' options like `auctex' which have more immediate needs. - The `noconfig' option suppresses loading of those option files, - too. - -`psfixbb' - Dvips determines the bounding boxes from the material in the DVI - file it understands. Lots of PostScript specials are not part of - that. Since the TeX boxes do not make it into the DVI file, but - merely characters, rules and specials do, Dvips might include far - too small areas. The option `psfixbb' will include `/dev/null' as - a graphic file in the ultimate upper left and lower right corner - of the previewed box. This will make Dvips generate an - appropriate bounding box. - -`dvips' - If this option is specified as a class option or to other - packages, several packages pass things like page size information - to Dvips, or cause crop marks or draft messages written on pages. - This seriously hampers the usability of previews. If this option - is specified, the changes will be undone if possible. - -`pdftex' - If this option is set, PDFTeX is assumed as the output driver. - This mainly affects the `tightpage' option. - -`xetex' - If this option is set, XeTeX is assumed as the output driver. - This mainly affects the `tightpage' option. - -`displaymath' - will make all displayed math environments subject to preview - processing. This will typically be the most desired option. - -`floats' - will make all float objects subject to preview processing. If you - want to be more selective about what floats to pass through to a - preview, you should instead use the `\PreviewSnarfEnvironment' - command on the floats you want to have previewed. - -`textmath' - will make all text math subject to previews. Since math mode is - used throughly inside of LaTeX even for other purposes, this works - by redefining `\(', `\)' and `$' and the `math' environment - (apparently some people use that). Only occurences of these text - math delimiters in later loaded packages and in the main document - will thus be affected. - -`graphics' - will subject all `\includegraphics' commands to a preview. - -`sections' - will subject all section headers to a preview. - -`delayed' - will delay all activations and redefinitions the `preview' package - makes until `\'`begin{document}'. The purpose of this is to cater - for documents which should be subjected to the `preview' package - without having been prepared for it. You can process such - documents with - - latex '\RequirePackage[active,delayed,OPTIONS]{preview} - \input{FILENAME}' - - This relaxes the requirement to be loading the `preview' package - as last package. - -DRIVER - loads a special driver file `prDRIVER.def'. The remaining options - are implemented through the use of driver files. - -`auctex' - This driver will produce fake error messages at the start and end - of every preview environment that enable the Emacs package - preview-latex in connection with AUCTeX to pinpoint the exact - source location where the previews have originated. - Unfortunately, there is no other reliable means of passing the - current TeX input position _in_ a line to external programs. In - order to make the parsing more robust, this option also switches - off quite a few diagnostics that could be misinterpreted. - - You should not specify this option manually, since it will only be - needed by automated runs that want to parse the pseudo error - messages. Those runs will then use `\PassOptionsToPackage' in - order to effect the desired behaviour. In addition, - `prauctex.cfg' will get loaded unless inhibited by the `noconfig' - option. This caters for the most frequently encountered - problematic commands. - -`showlabels' - During the editing process, some people like to see the label - names in their equations, figures and the like. Now if you are - using Emacs for editing, and in particular preview-latex, I'd - strongly recommend that you check out the RefTeX package which - pretty much obliterates the need for this kind of functionality. - If you still want it, standard LaTeX provides it with the - `showkeys' package, and there is also the less encompassing - `showlabels' package. Unfortunately, since those go to some pain - not to change the page layout and spacing, they also don't change - `preview''s idea of the TeX dimensions of the involved boxes. So - if you are using `preview' for determing bounding boxes, those - packages are mostly useless. The option `showlabels' offers a - substitute for them. - -`tightpage' - It is not uncommon to want to use the results of `preview' as - graphic images for some other application. One possibility is to - generate a flurry of EPS files with - - dvips -E -i -Pwww -o OUTPUTFILE.000 INPUTFILE - - However, in case those are to be processed further into graphic - image files by Ghostscript, this process is inefficient since all - of those files need to be processed one by one. In addition, it - is necessary to extract the bounding box comments from the EPS - files and convert them into page dimension parameters for - Ghostscript in order to avoid full-page graphics. This is not - even possible if you wanted to use Ghostscript in a _single_ run - for generating the files from a single PostScript file, since - Dvips will in that case leave no bounding box information anywhere. - - The solution is to use the `tightpage' option. That way a single - command line like - - `gs -sDEVICE=png16m -dTextAlphaBits=4 -r300 - -dGraphicsAlphaBits=4 -dSAFER -q -dNOPAUSE - -sOutputFile=OUTPUTFILE%d.png INPUTFILE.ps' - - will be able to produce tight graphics from a single PostScript - file generated with Dvips _without_ use of the options `-E -i', in - a single run. - - The `tightpage' option actually also works when using the `pdftex' - option and generating PDF files with PDFTeX. The resulting PDF - file has separate page dimensions for every page and can directly - be converted with one run of Ghostscript into image files. - - If neither `dvips' or `pdftex' have been specified, the - corresponding option will get autodetected and invoked. - - If you need this in a batch environment where you don't want to - use `preview''s automatic extraction facilities, no problem: just - don't use any of the extraction options, and wrap everything to be - previewed into `preview' environments. This is how LyX does its - math previews. - - If the pages under the `tightpage' option are just too tight, you - can adjust by setting the length `\PreviewBorder' to a different - value by using `\setlength'. The default value is `0.50001bp', - which is half of a usual PostScript point, rounded up. If you go - below this value, the resulting page size may drop below `1bp', - and Ghostscript does not seem to like that. If you need finer - control, you can adjust the bounding box dimensions individually - by changing the macro `\PreviewBbAdjust' with the help of - `\renewcommand'. Its default value is - - \newcommand \PreviewBbAdjust - {-\PreviewBorder -\PreviewBorder - \PreviewBorder \PreviewBorder} - - This adjusts the left, lower, right and upper borders by the given - amount. The macro must contain 4 TeX dimensions after another, - and you may not omit the units if you specify them explicitly - instead of by register. PostScript points have the unit `bp'. - -`lyx' - This option is for the sake of LyX developers. It will output a - few diagnostics relevant for the sake of LyX' preview - functionality (at the time of writing, mostly implemented for math - insets, in versions of LyX starting with 1.3.0). - -`counters' - This writes out diagnostics at the start and the end of previews. - Only the counters changed since the last output get written, and - if no counters changed, nothing gets written at all. The list - consists of counter name and value, both enclosed in `{}' braces, - followed by a space. The last such pair is followed by a colon - (`:') if it is at the start of the preview snippet, and by a - period (`.') if it is at the end. The order of different - diagnostics like this being issued depends on the order of the - specification of the options when calling the package. - - Systems like preview-latex use this for keeping counters accurate - when single previews are regenerated. - -`footnotes' - This makes footnotes render as previews, and only as their - footnote symbol. A convenient editing feature inside of Emacs. - - The following options are just for debugging purposes of the package -and similar to the corresponding TeX commands they allude to: - -`tracingall' - causes lots of diagnostic output to appear in the log file during - the preview collecting phases of TeX's operation. In contrast to - the similarly named TeX command, it will not switch to - `\errorstopmode', nor will it change the setting of - `\tracingonline'. - -`showbox' - This option will show the contents of the boxes shipped out to the - DVI files. It also sets `\showboxbreadth' and `\showboxdepth' to - their maximum values at the end of loading this package, but you - may reset them if you don't like that. - - -File: preview-latex.info, Node: Provided commands, Prev: Package options, Up: The LaTeX style file - -6.1.2 Provided commands ------------------------ - -`\begin{preview}...\end{preview}' - The `preview' environment causes its contents to be set as a - single preview image. Insertions like figures and footnotes - (except those included in minipages) will typically lead to error - messages or be lost. In case the `preview' package has not been - activated, the contents of this environment will be typeset - normally. - -`\begin{nopreview}...\end{nopreview}' - The `nopreview' environment will cause its contents not to undergo - any special treatment by the `preview' package. When `preview' is - active, the contents will be discarded like all main text that - does not trigger the `preview' hooks. When `preview' is not - active, the contents will be typeset just like the main text. - - Note that both of these environments typeset things as usual when - preview is not active. If you need something typeset - conditionally, use the `\ifPreview' conditional for it. - -`\PreviewMacro' - If you want to make a macro like `\includegraphics' (actually, - this is what is done by the `graphics' option to `preview') - produce a preview image, you put a declaration like - - \PreviewMacro[*[[!]{\includegraphics} - - or, more readable, - - \PreviewMacro[{*[][]{}}]{\includegraphics} - - into your preamble. The optional argument to `\PreviewMacro' - specifies the arguments `\includegraphics' accepts, since this is - necessary information for properly ending the preview box. Note - that if you are using the more readable form, you have to enclose - the argument in a `[{' and `}]' pair. The inner braces are - necessary to stop any included `[]' pairs from prematurely ending - the optional argument, and to make a single `{}' denoting an - optional argument not get stripped away by TeX's argument parsing. - - The letters simply mean - - `*' - indicates an optional `*' modifier, as in `\includegraphics*'. - - `[' - ^^A] indicates an optional argument in brackets. This syntax - is somewhat baroque, but brief. - - `[]' - also indicates an optional argument in brackets. Be sure to - have encluded the entire optional argument specification in - an additional pair of braces as described above. - - `!' - indicates a mandatory argument. - - `{}' - indicates the same. Again, be sure to have that additional - level of braces around the whole argument specification. - - `?'DELIMITER{TRUE CASE}{FALSE CASE} - is a conditional. The next character is checked against - being equal to DELIMITER. If it is, the specification TRUE - CASE is used for the further parsing, otherwise FALSE CASE - will be employed. In neither case is something consumed from - the input, so {TRUE CASE} will still have to deal with the - upcoming delimiter. - - `@'{LITERAL SEQUENCE} - will insert the given sequence literally into the executed - call of the command. - - `-' - will just drop the next token. It will probably be most - often used in the true branch of a `?' specification. - - `#'{ARGUMENT}{REPLACEMENT} - is a transformation rule that calls a macro with the given - argument and replacement text on the rest of the argument - list. The replacement is used in the executed call of the - command. This can be used for parsing arbitrary constructs. - For example, the `[]' option could manually be implemented - with the option string `?[{#{[#1]}{[{#1}]}}{}'. PStricks - users might enjoy this sort of flexibility. - - `:'{ARGUMENT}{REPLACEMENT} - is again a transformation rule. As opposed to `#', however, - the result of the transformation is parsed again. You'll - rarely need this. - - There is a second optional argument in brackets that can be used to - declare any default action to be taken instead. This is mostly for - the sake of macros that influence numbering: you would want to keep - their effects in that respect. The default action should use `#1' - for referring to the original (not the patched) command with the - parsed options appended. Not specifying a second optional argument - here is equivalent to specifying `[#1]'. - -`\PreviewMacro*' - A similar invocation `\PreviewMacro*' simply throws the macro and - all of its arguments declared in the manner above away. This is - mostly useful for having things like `\footnote' not do their - magic on their arguments. More often than not, you don't want to - declare any arguments to scan to `\PreviewMacro*' since you would - want the remaining arguments to be treated as usual text and - typeset in that manner instead of being thrown away. An exception - might be, say, sort keys for `\cite'. - - A second optional argument in brackets can be used to declare any - default action to be taken instead. This is for the sake of macros - that influence numbering: you would want to keep their effects in - that respect. The default action might use `#1' for referring to - the original (not the patched) command with the parsed options - appended. Not specifying a second optional argument here is - equivalent to specifying `[]' since the command usually gets thrown - away. - - As an example for using this argument, you might want to specify - - \PreviewMacro*\footnote[{[]}][#1{}] - - This will replace a footnote by an empty footnote, but taking any - optional parameter into account, since an optional paramter changes - the numbering scheme. That way the real argument for the footnote - remains for processing by preview-latex. - -`\PreviewEnvironment' - The macro `\PreviewEnvironment' works just as `\PreviewMacro' does, - only for environments. - -`\PreviewEnvironment*' - And the same goes for `\PreviewEnvironment*' as compared to - `\PreviewMacro*'. - -`\PreviewSnarfEnvironment' - This macro does not typeset the original environment inside of a - preview box, but instead typesets just the contents of the - original environment inside of the preview box, leaving nothing - for the original environment. This has to be used for figures, - for example, since they would - - 1. produce insertion material that cannot be extracted to the - preview properly, - - 2. complain with an error message about not being in outer par - mode. - -`\PreviewOpen' - -`\PreviewClose' - Those Macros form a matched preview pair. This is for macros that - behave similar as `\begin' and `\end' of an environment. It is - essential for the operation of `\PreviewOpen' that the macro - treated with it will open an additional group even when the preview - falls inside of another preview or inside of a `nopreview' - environment. Similarly, the macro treated with `PreviewClose' - will close an environment even when inactive. - -`\ifPreview' - In case you need to know whether `preview' is active, you can use - the conditional `\ifPreview' together with `\else' and `\fi'. - - - -File: preview-latex.info, Node: The Emacs interface, Next: The preview images, Prev: The LaTeX style file, Up: For advanced users - -6.2 The Emacs interface -======================= - -You can use `M-x customize-group preview-latex ' in order to -customize these variables, or use the menus for it. We explain the -various available options together with explaining how they work -together in making preview-latex work as intended. - -`preview-LaTeX-command' - When you generate previews on a buffer or a region, the command in - `preview-LaTeX-command' gets run (that variable should only be - changed with Customize since its structure is somewhat peculiar, - though expressive). As usual with AUCTeX, you can continue - working while this is going on. It is not a good idea to change - the file until after preview-latex has established where to place - the previews which it can only do after the LaTeX run completes. - This run produces a host of pseudo-error messages that get parsed - by preview-latex at the end of the LaTeX run and give it the - necessary information about where in the source file the LaTeX - code for the various previews is located exactly. The parsing - takes a moment and will render Emacs busy. - -`preview-LaTeX-command-replacements' - This variable specifies transformations to be used before calling - the configured command. One possibility is to have `\pdfoutput=0 ' - appended to every command starting with `pdf'. This particular - setting is available as the shortcut - `preview-LaTeX-disable-pdfoutput'. Since preview-latex can work - with PDF files by now, there is little incentive for using this - option, anymore (for projects not requiring PDF output, the added - speed of `dvipng' might make this somewhat attractive). - -`preview-required-option-list' - `preview-LaTeX-command' uses `preview-required-option-list' in - order to pass options such as `auctex', `active' and `dvips' to - the `preview' package. This means that the user need (and should) - not supply these in the document itself in case he wants to be - able to still compile his document without it turning into an - incoherent mass of little pictures. These options even get passed - in when the user loads `preview' explicitly in his document. - - The default includes an option `counters' that is controlled by the - boolean variable - -`preview-preserve-counters' - This option will cause the `preview' package to emit information - that will assist in keeping things like equation counters and - section numbers reasonably correct even when you are regenerating - only single previews. - -`preview-default-option-list' -`preview-default-preamble' - If the document does not call in the package `preview' itself (via - `\usepackage') in the preamble, the preview package is loaded using - default options from `preview-default-option-list' and additional - commands specified in `preview-default-preamble'. - -`preview-fast-conversion' - This is relevant only for DVI mode. It defaults to `On' and - results in the whole document being processed as one large - PostScript file from which the single images are extracted with - the help of parsing the PostScript for use of so-called DSC - comments. The bounding boxes are extracted with the help of TeX - instead of getting them from Dvips. If you are experiencing - bounding box problems, try setting this option to `Off'. - -`preview-prefer-TeX-bb' - If this option is `On', it tells preview-latex never to try to - extract bounding boxes from the bounding box comments of EPS files, - but rather rely on the boxes it gets from TeX. If you activated - `preview-fast-conversion', this is done, anyhow, since there are no - EPS files from which to read this information. The option - defaults to `Off', simply because about the only conceivable - reason to switch off `preview-fast-conversion' would be that you - have some bounding box problem and want to get Dvips' angle on - that matter. - -`preview-scale-function' -`preview-reference-face' -`preview-document-pt-list' -`preview-default-document-pt' - `preview-scale-function' determines by what factor images should - be scaled when appearing on the screen. If you specify a - numerical value here, the physical size on the screen will be that - of the original paper output scaled by the specified factor, at - least if Emacs' information about screen size and resolution are - correct. The default is to let `preview-scale-from-face' - determine the scale function. This function determines the scale - factor by making the size of the default font in the document - match that of the on-screen fonts. - - The size of the screen fonts is deduced from the font - `preview-reference-face' (usually the default face used for - display), the size of the default font for the document is - determined by calling `preview-document-pt'. This function - consults the members of `preview-document-pt-list' in turn until - it gets the desired information. The default consults first - `preview-parsed-font-size', then calls `preview-auctex-font-size' which - asks AUCTeX about any size specification like `12pt' to the - documentclass that it might have detected when parsing the - document, and finally reverts to just assuming - `preview-default-document-pt' as the size used in the document - (defaulting to 10pt). - - If you find that the size of previews and the other Emacs display - clashes, something goes wrong. `preview-parsed-font-size' is - determined at `\begin{document}' time; if the default font size - changes after that, it will not get reported. If you have an - outdated version of `preview.sty' in your path, the size might not - be reported at all. If in this case AUCTeX is unable to find a - size specification, and if you are using a document class with a - different default value (like KomaScript), the default fallback - assumption will probably be wrong and preview-latex will scale up - things too large. So better specify those size options even when - you know that LaTeX does not need them: preview-latex might - benefit from them. Another possibility for error is that you have - not enabled AUCTeX's document parsing options. The fallback - method of asking AUCTeX about the size might be disabled in future - versions of preview-latex since in general it is more reliable to - get this information from the LaTeX run itself. - -`preview-fast-dvips-command' -`preview-dvips-command' - The regular command for turning a DVI file into a single - PostScript file is `preview-fast-dvips-command', while - `preview-dvips-command' is used for cranking out a DVI file where - every preview is in a separate EPS file. Which of the two - commands gets used depends on the setting of - `preview-fast-conversion'. The printer specified here by default - is `-Pwww' by default, which will usually get you scalable fonts - where available. If you are experiencing problems, you might want - to try playing around with Dvips options (*note - (dvips)Command-line options::). - - The conversion of the previews into PostScript or EPS files gets - started after the LaTeX run completes when Emacs recognizes the - first image while parsing the error messages. When Emacs has - finished parsing the error messages, it activates all detected - previews. This entails throwing away any previous previews - covering the same areas, and then replacing the text in its visual - appearance by a placeholder looking like a roadworks sign. - -`preview-nonready-icon-specs' - This is the roadworks sign displayed while previews are being - prepared. You may want to customize the font sizes at which - preview-latex switches over between different icon sizes, and the - ascent ratio which determines how high above the base line the - icon gets placed. - -`preview-error-icon-specs' -`preview-icon-specs' - Those are icons placed before the source code of an opened preview - and, respectively, the image specs to be used for PostScript - errors, and a normal open preview in text representation. - -`preview-inner-environments' - This is a list of environments that are regarded as inner levels - of an outer environment when doing `preview-environment'. One - example when this is needed is in - `\begin{equation}\begin{split}...\end{split}\end{equation}', and - accordingly `split' is one entry in `preview-inner-environments'. - -`preview-use-balloon-help' - If you turn this XEmacs-only option `on', then moving the mouse - over previews and icons will show appropriate help texts. This - works by switching on `balloon-help-mode' in the buffer if it is - not already enabled. The default now is `off' since some users - reported problems with their version of XEmacs. GNU Emacs has its - corresponding `tooltip-mode' enabled by default and in usable - condition. - - - -File: preview-latex.info, Node: The preview images, Next: Misplaced previews, Prev: The Emacs interface, Up: For advanced users - -6.3 The preview images -====================== - -`preview-image-type' -`preview-image-creators' -`preview-gs-image-type-alist' - What happens when LaTeX is finished depends on the configuration of - `preview-image-type'. What to do for each of the various settings - is specified in the variable `preview-image-creators'. The options - to pass into Ghostscript and what Emacs image type to use is - specified in `preview-gs-image-type-alist'. - - `preview-image-type' defaults to `png'. For this to work, your - version of Ghostscript needs to support the `png16m' device. If - you are experiencing problems here, you might want to reconfigure - `gs-image-type-alist' or `preview-image-type'. Reconfiguring - `preview-image-creators' is only necessary for adding additional - image types. - - Most devices make preview-latex start up a single Ghostscript - process for the entire preview run (as opposed to one per image) - and feed it either sections of a PDF file (if PDFLaTeX was used), - or (after running Dvips) sections of a single PostScript file or - separate EPS files in sequence for conversion into PNG format - which can be displayed much faster by Emacs. Actually, not in - sequence but backwards since you are most likely editing at the - end of the document. And as an added convenience, any preview - that happens to be on-screen is given higher priority so that - preview-latex will first cater for the images that are displayed. - There are various options customizable concerning aspects of that - operation, see the customization group `Preview Gs' for this. - - Another noteworthy setting of `preview-image-type' is `dvipng': in - this case, the `dvipng'will get run on DVI output (see below for - PDF). This is in general much faster than Dvips and Ghostscript. - In that case, the option - -`preview-dvipng-command' - will get run for doing the conversion, and it is expected that - -`preview-dvipng-image-type' - images get produced (`dvipng' might be configured for other image - types as well). You will notice that `preview-gs-image-type-alist' - contains an entry for `dvipng': this actually has nothing to with - `dvipng' itself but specifies the image type and Ghostscript device - option to use when `dvipng' can't be used. This will obviously be - the case for PDF output by PDFLaTeX, but it will also happen if - the DVI file contains PostScript specials in which case the - affected images will get run through Dvips and Ghostscript once - `dvipng' finishes. - -`preview-gs-options' - Most interesting to the user perhaps is the setting of this - variable. It contains the default antialiasing settings - `-dTextAlphaBits=4' and `-dGraphicsAlphaBits=4'. Decreasing those - values to 2 or 1 might increase Ghostscript's performance if you - find it lacking. - - Running and feeding Ghostscript from preview-latex happens -asynchronously again: you can resume editing while the images arrive. -While those pretty pictures filling in the blanks on screen tend to -make one marvel instead of work, rendering the non-displayed images -afterwards will not take away your attention and will eventually -guarantee that jumping around in the document will encounter only -prerendered images. - - -File: preview-latex.info, Node: Misplaced previews, Prev: The preview images, Up: For advanced users - -6.4 Misplaced previews -====================== - -If you are reading this section, the first thing is to check that your -problem is not caused by x-symbol in connection with an installation not -supporting 8-bit characters (*note x-symbol interoperation::). If not, -here's the beef: - - As explained previously, Emacs uses pseudo-error messages generated -by the `preview' package in order to pinpoint the exact source location -where a preview originated. This works in running text, but fails when -preview material happens to lie in macro arguments, like the contents -of `\emph'. Those macros first read in their entire argument, munge it -through, perhaps transform it somehow, process it and perhaps then -typeset something. When they finally typeset something, where is the -location where the stuff originated? TeX, having read in the entire -argument before, does not know and actually there would be no sane way -of defining it. - - For previews contained inside such a macro argument, the default -behaviour of preview-latex is to use a position immediately after the -closing brace of the argument. All the previews get placed there, all at -a zero-width position, which means that Emacs displays it in an order -that preview-latex cannot influence (currently in Emacs it is even -possible that the order changes between runs). And since the placement -of those previews is goofed up, you will not be able to regenerate them -by clicking on them. The default behaviour is thus somewhat undesirable. - - The solution (like with other preview problems) is to tell the LaTeX -`preview' package how to tackle this problem (*note The LaTeX style -file::). Simply, you don't need `\emph' do anything at all during -previews! You only want the text math previewed, so the solution is to -use `\PreviewMacro*\emph' in the preamble of your document which will -make LaTeX ignore `\emph' completely as long as it is not part of a -larger preview (in which case it gets typeset as usual). Its argument -thus becomes ordinary text and gets treated like ordinary text. - - Note that it would be a bad idea to declare -`\PreviewMacro*[{{}}]\emph' since then both `\emph' as well as its -argument would be ignored instead of previewed. For user-level macros, -this is almost never wanted, but there may be internal macros where you -might want to ignore internal arguments. - - The same mechanism can be used for a number of other text-formatting -commands like `\textrm', `\textit' and the like. While they all use the -same internal macro `\text@command', it will not do to redefine just -that, since they call it only after having read their argument in, and -then it already is too late. So you need to disable every of those -commands by hand in your document preamble. - - Actually, we wrote all of the above just to scare you. At least all -of the above mentioned macros and a few more are already catered for by -a configuration file `prauctex.cfg' that gets loaded by default unless -the `preview' package gets loaded with the `noconfig' option. You can -make your own copy of this file in a local directory and edit it in -case of need. You can also add loading of a file of your liking to -`preview-default-preamble', or alternatively do the manual disabling of -your favorite macro in `preview-default-preamble', which is -customizable in the Preview Latex group. - - -File: preview-latex.info, Node: ToDo, Next: Frequently Asked Questions, Prev: For advanced users, Up: Top - -Appendix A ToDo -*************** - - * Support other formats than just LaTeX - - plain TeX users and ConTeXt users should not have to feel left - out. While ConTeXt is not supported yet by released versions of - AUCTeX, at least supporting plain would help people, and be a start - for ConTeXt as well. There are plain-based formats like MusiXTeX - that could benefit a lot from preview-latex. The main part of the - difficulties here is to adapt `preview.dtx' to produce stuff not - requiring LaTeX. - - * Support nested snippets - - Currently you can't have both a footnote (which gets displayed as - just its footnote number) and math inside of a footnote rendered - as an image: such nesting might be achieved by rerunning - preview-latex on the footnote contents when one opens the footnote - for editing. - - * Support other text properties than just images - - Macros like `\textit' can be rendered as images, but the resulting - humungous blob is not suitable for editing, in particular since the - line filling from LaTeX does not coincide with that of Emacs. It - would be much more useful if text properties just switched the - relevant font to italics rather than replacing the whole text with - an image. It would also make editing quite easier. Then there - are things like footnotes that are currently just replaced by - their footnote number. While editing is not a concern here (the - number is not in the original text, anyway), it would save a lot - of conversion time if no images were generated, but Emacs just - displayed a properly fontified version of the footnote number. - Also, this might make preview-latex useful even on text terminals. - - * Find a way to facilitate Source Specials - - Probably in connection with adding appropriate support to - `dvipng', it would be nice if clicking on an image from a larger - piece of source code would place the cursor at the respective - source code location. - - * Make `preview.dtx' look reasonable in AUCTeX - - It is a bit embarrassing that `preview.dtx' is written in a manner - that will not give either good syntax highlighting or good - indentation when employing AUCTeX. - - * Web page work - - Currently, preview-latex's web page is not structured at all. - Better navigation would be desirable, as well as separate News and - Errata eye catchers. - - * Manual improvements - - - Pepper the manual with screen shots and graphics - - This will be of interest for the HTML and TeX renditions of - the texinfo manual. Since Texinfo now supports images as - well, this could well be nice to have. - - - Fix duplicates - - Various stuff appears several times. - - - * Implement rendering pipelines for Emacs - - The current `gs.el' interface is fundamentally flawed, not only - because of a broken implementation. A general batchable and - daemonizable rendering infrastructure that can work on all kinds of - preview images for embedding into buffers is warranted. The - current implementation has a rather adhoc flavor and is not easily - extended. It will not work outside of AUCTeX, either. - - * Integrate into RefTeX - - When referencing to equations and the like, the preview-images of - the source rather than plain text should be displayed. If the - preview in question covers labels, those should appear in the - bubble help and/or a context menu. Apropos: - - * Implement LaTeX error indicators - - Previews on erroneous LaTeX passages might gain a red border or - similar. - - * Pop up relevant online documentation for frequent errors - - A lot of errors are of the "badly configured" variety. Perhaps the - relevant info pages should be delivered in addition to the error - message. - - * Implement a table editing mode where every table cell gets output - as a separate preview. Alternatively, output the complete table - metrics in a way that lets people click on individual cells for - editing purposes. - - * Benchmark and kill Emacs inefficiencies - - Both the LaTeX run under Emacs control as well as actual image - insertion in Emacs could be faster. CVS Emacs has improved in that - respect, but it still is slower than desirable. - - * Improve image support under Emacs - - The general image and color handling in Emacs is inefficient and - partly defective. This is still the case in CVS. One option - would be to replace the whole color and image handling with GDK - routines when this library is available, since it has been - optimized for it. - - - -File: preview-latex.info, Node: Frequently Asked Questions, Next: Copying this Manual, Prev: ToDo, Up: Top - -Appendix B Frequently Asked Questions -************************************* - -* Menu: - -* Introduction to FAQ:: -* Requirements:: -* Installation Trouble:: -* Customization:: -* Troubleshooting:: -* Other formats:: - - -File: preview-latex.info, Node: Introduction to FAQ, Next: Requirements, Prev: Frequently Asked Questions, Up: Frequently Asked Questions - -B.1 Introduction -================ - -B.1.1 How can I contribute to the FAQ? --------------------------------------- - -Send an email with the subject: - Preview FAQ - to . - - -File: preview-latex.info, Node: Requirements, Next: Installation Trouble, Prev: Introduction to FAQ, Up: Frequently Asked Questions - -B.2 Requirements -================ - -B.2.1 Which version of (X)Emacs is needed? ------------------------------------------- - -See also the table at the end of the section. - - preview-latex nominally requires GNU Emacs with a version of at -least 21.1. However, Emacs 22 (currently under development) offers -superior performance and wider platform support, and is even now the -recommended platform to use. - - While recent versions of XEmacs 21.4 are supported, doing this in a -satisfactory manner has proven to be difficult due to technical -shortcomings and differing API's which are hard to come by. If -preview-latex is an important part of your editing workflow, you are -likely to get better results and support by switching to Emacs. Of -course, you can improve support for your favorite editor by giving -feedback in case you encounter bugs. - -B.2.2 Which versions of Ghostscript and AUCTeX are needed? ----------------------------------------------------------- - -We recommend to use GNU or AFPL Ghostscript with a version of at least -7.07. - - preview-latex has been distributed as part of AUCTeX since version -11.80. If your version of AUCTeX is older than that, or if it does not -contain a working copy of preview-latex, complain to wherever you got -it from. - -B.2.3 I have trouble with the display format... ------------------------------------------------ - -We recommend keeping the variable `preview-image-type' set to `dvipng' -(if you have it installed) or `png'. This is the default and can be -set via the Preview/Customize menu. - - All other formats are known to have inconveniences, either in file -size or quality. There are some Emacs versions around not supporting -PNG; the proper way to deal with that is to complain to your Emacs -provider. Short of that, checking out PNM or JPEG formats might be a -good way to find out whether the lack of PNG format support might be -the only problem with your Emacs. - -B.2.4 For which OS does preview work? -------------------------------------- - -It is known to work under the X Window System for Linux and for several -flavors of Unix: we have reports for HP and Solaris. - - There are several development versions of Emacs around for native -MacOS Carbon, and preview-latex is working with them, too. - - With Windows, Cygwin and native ports of XEmacs should work. -preview-latex will not work with any native version 21 of Emacs under -Windows: you need to get a hold of Emacs 22 which is at the time of -this writing not released but available as a developer snapshot. - - The entry "X11/Unix" currently means Linux, Solaris or HP/UX, as -well as the X-specific version for Mac/OSX. - -OS Emacs version XEmacs version -X11/Unix 21.1 21.4.9 -Win9x cygwin 21.3.50? 21.4.8 -Win9x native 22.1 21.4.8 -MacOSX native 22.1 - - - -File: preview-latex.info, Node: Installation Trouble, Next: Customization, Prev: Requirements, Up: Frequently Asked Questions - -B.3 Installation Trouble -======================== - -B.3.1 I just get `LaTeX found no preview images'. -------------------------------------------------- - -The reason for this is that LaTeX found no preview images in the -document in question. - - One reason might be that there are no previews to be seen. If you -have not used preview-latex before, you might not know its manner of -operation. One sure-fire way to test if you just have a document where -no previews are to be found is to use the provided example document -`circ.tex' (you will have to copy it to some directory where you have -write permissions). If the symptom persists, you have a problem, and -the problem is most likely a LaTeX problem. Here are possible reasons: - -Filename database not updated - Various TeX distributions have their own ways of knowing where the - files are without actually searching directories. The normal - preview-latex installation should detect common tools for that - purpose and use them. If this goes wrong, or if the files get - installed into a place where they are not looked for, the LaTeX - run will fail. - -An incomplete manual installation - This should not happen if you followed installation instructions. - Unfortunately, people know better all the time. If only - `preview.sty' gets installed without a set of supplementary files - also in the `latex' subdirectory, preview-latex runs will not - generate any errors, but they will not produce any previews, - either. - -An outdated `preview' installation - The `preview.sty' package is useful for more than just - preview-latex. For example, it is part of TeXlive. So you have - to make sure that preview-latex does not get to work with outdated - style and configuration files: some newer features will not work - with older TeX style files, and really old files will make - preview-latex fail completely. There usual is a local `texmf' - tree, or even a user-specific tree that are searched before the - default tree. Make sure that the first version of those files - that gets found is the correct one. - -B.3.2 I have problems with the XEmacs installation --------------------------------------------------- - -Please note that the XEmacs installation is different, since XEmacs has -a package system that gets used here. Please make sure that you read -and follow the installation instructions for XEmacs. - - -File: preview-latex.info, Node: Customization, Next: Troubleshooting, Prev: Installation Trouble, Up: Frequently Asked Questions - -B.4 Customization -================= - -B.4.1 Why don't I get balloon help like in the screen shots? ------------------------------------------------------------- - -Some users have reported problems with their XEmacs version, so balloon -help is no longer switched on by default. Use the Preview/Customize -menu or ` customize-variable' in order to customize -`preview-use-balloon-help' to `On'. This only concerns XEmacs: -tooltips under GNU Emacs are enabled by default and unproblematic. - -B.4.2 How to include additional environments like `enumerate' -------------------------------------------------------------- - -By default, preview-latex is intended mainly for displaying -mathematical formulas, so environments like `enumerate' or `tabular' -(except where contained in a float) are not included. You can include -them however manually by adding the lines: - - \usepackage[displaymath,textmath,sections,graphics,floats]{preview} - \PreviewEnvironment{enumerate} - - in your document header, that is before - - \begin{document} - In general, `preview' should be loaded as the last thing before the -start of document. - - Be aware that - - \PreviewEnvironment{...} - - does not accept a comma separated list! Also note that by putting -more and more - - \PreviewEnvironment{...} - - in your document, it will look more and more like a DVI file preview -when running preview-latex. Since each preview is treated as one large -monolithic block by Emacs, one should really restrict previews to those -elements where the improvement in visual representation more than makes -up for the decreased editability. - -B.4.3 What if I don't want to change the document? --------------------------------------------------- - -The easiest way is to generate a configuration file in the current -directory. You can basically either create `prdefault.cfg' which is -used for any use of the `preview' package, or you can use -`prauctex.cfg' which only applies to the use from with Emacs. Let us -assume you use the latter. In that case you should write something like - - \InputIfFileExists{preview/prauctex.cfg}{}{} - \PreviewEnvironment{enumerate} - - in it. The first line inputs the system-wide default configuration -(the file name should match that, but not your own `prauctex.cfg'), -then you add your own stuff. - -B.4.4 Suddenly I get gazillions of ridiculous pages?!? ------------------------------------------------------- - -When preview-latex works on extracting its stuff, it typesets each -single preview on a page of its own. This only happens when actual -previews get generated. Now if you want to configure preview-latex in -your document, you need to add your own `\usepackage' call to `preview' -so that it will be able to interpret its various definition commands. -It is an error to add the `active' option to this invocation: you don't -want the package to be active unless preview-latex itself enables the -previewing operation (which it will). - -B.4.5 Does preview-latex work with presentation classes? --------------------------------------------------------- - -preview-latex should work with most presentation classes. However, -since those classes often have macros or pseudo environments -encompassing a complete slide, you will need to use the customization -facilities of `preview.sty' to tell it how to resolve this, whether you -want no previews, previews of whole slides or previews of inner -material. - - -File: preview-latex.info, Node: Troubleshooting, Next: Other formats, Prev: Customization, Up: Frequently Asked Questions - -B.5 Troubleshooting -=================== - -B.5.1 Preview causes all sort of strange error messages -------------------------------------------------------- - -When running preview-latex and taking a look at either log file or -terminal output, lots of messages like - - ! Preview: Snippet 3 started. - <-><-> - - l.52 \item Sie lassen sich als Funktion $ - y = f(x)$ darstellen. - ! Preview: Snippet 3 ended.(491520+163840x2494310). - <-><-> - - l.52 \item Sie lassen sich als Funktion $y = f(x)$ - darstellen. - - appear (previous versions generated messages looking even more like -errors). Those are not real errors (as will be noted in the log file). -Or rather, while they *are* really TeX error messages, they are -intentional. This currently is the only reliable way to pass the -information from the LaTeX run of preview-latex to its Emacs part about -where the previews originated in the source text. Since they are -actual errors, you will also get AUCTeX to state - Preview-LaTeX exited as expected with code 1 at Wed Sep 4 17:03:30 - after the LaTeX run in the run buffer. This merely indicates that -errors were present, and errors will always be present when -preview-latex is operating. There might be also real errors, so in -case of doubt, look for them explicitly in either run buffer or the -resulting `.log' file. - -B.5.2 Why do my DVI and PDF output files vanish? ------------------------------------------------- - -In order to produce the preview images preview-latex runs LaTeX on the -master or region file. The resulting DVI or PDF file can happen to -have the same name as the output file of a regular LaTeX run. So the -regular output file gets overwritten and is subsequently deleted by -preview-latex. - -B.5.3 My output file suddenly only contains preview images?! ------------------------------------------------------------- - -As mentioned in the previews FAQ entry, preview-latex might use the -file name of the original output file for the creation of preview -images. If the original output file is being displayed with a viewer -when this happens, you might see strange effects depending on the -viewer, e.g. a message about the file being corrupted or the display of -all the preview images instead of your typeset document. (Also *Note -Customization::.) - - -File: preview-latex.info, Node: Other formats, Prev: Troubleshooting, Up: Frequently Asked Questions - -B.6 preview-latex when not using LaTeX -====================================== - -B.6.1 Does preview-latex work with PDFLaTeX? ---------------------------------------------- - -Yes, as long as you use AUCTeX's own PDFLaTeX mode and have not messed -with `TeX-command-list'. - -B.6.2 Does preview-latex work with `elatex'? --------------------------------------------- - -No problem here. If you configure your AUCTeX to use `elatex', or -simply have `latex' point to `elatex', this will work fine. Modern TeX -distributions use eTeX for LaTeX, anyway. - -B.6.3 Does preview-latex work with ConTeXt? -------------------------------------------- - -In short, no. The `preview' package is LaTeX-dependent. Adding -support for other formats requires volunteers. - -B.6.4 Does preview-latex work with plain TeX? ---------------------------------------------- - -Again, no. Restructuring the `preview' package for `plain' operation -would be required. Volunteers welcome. - - In some cases you might get around by making a wrapper pseudo-Master -file looking like the following: - - \documentclass{article} - \usepackage{plain} - \begin{document} - \begin{plain} - \input myplainfile - \end{plain} - \end{document} - - -File: preview-latex.info, Node: Copying this Manual, Next: Index, Prev: Frequently Asked Questions, Up: Top - -Appendix C Copying this Manual -****************************** - -The copyright notice for this manual is: - - This manual is for preview-latex, a LaTeX preview mode for AUCTeX -(version 11.86 from 2010-02-21). - - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software -Foundation, Inc. - - Permission is granted to copy, distribute and/or modify this - document under the terms of the GNU Free Documentation License, - Version 1.3 or any later version published by the Free Software - Foundation; with no Invariant Sections, no Front-Cover Texts and - no Back-Cover Texts. A copy of the license is included in the - section entitled "GNU Free Documentation License." - -The full license text can be read here: - -* Menu: - -* GNU Free Documentation License:: License for copying this manual. - - -File: preview-latex.info, Node: GNU Free Documentation License, Up: Copying this Manual - -C.1 GNU Free Documentation License -================================== - - Version 1.3, 3 November 2008 - - Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software - Foundation, Inc. `http://fsf.org/' - - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - 0. PREAMBLE - - The purpose of this License is to make a manual, textbook, or other - functional and useful document "free" in the sense of freedom: to - assure everyone the effective freedom to copy and redistribute it, - with or without modifying it, either commercially or - noncommercially. Secondarily, this License preserves for the - author and publisher a way to get credit for their work, while not - being considered responsible for modifications made by others. - - This License is a kind of "copyleft", which means that derivative - works of the document must themselves be free in the same sense. - It complements the GNU General Public License, which is a copyleft - license designed for free software. - - We have designed this License in order to use it for manuals for - free software, because free software needs free documentation: a - free program should come with manuals providing the same freedoms - that the software does. But this License is not limited to - software manuals; it can be used for any textual work, regardless - of subject matter or whether it is published as a printed book. - We recommend this License principally for works whose purpose is - instruction or reference. - - 1. APPLICABILITY AND DEFINITIONS - - This License applies to any manual or other work, in any medium, - that contains a notice placed by the copyright holder saying it - can be distributed under the terms of this License. Such a notice - grants a world-wide, royalty-free license, unlimited in duration, - to use that work under the conditions stated herein. The - "Document", below, refers to any such manual or work. Any member - of the public is a licensee, and is addressed as "you". You - accept the license if you copy, modify or distribute the work in a - way requiring permission under copyright law. - - A "Modified Version" of the Document means any work containing the - Document or a portion of it, either copied verbatim, or with - modifications and/or translated into another language. - - A "Secondary Section" is a named appendix or a front-matter section - of the Document that deals exclusively with the relationship of the - publishers or authors of the Document to the Document's overall - subject (or to related matters) and contains nothing that could - fall directly within that overall subject. (Thus, if the Document - is in part a textbook of mathematics, a Secondary Section may not - explain any mathematics.) The relationship could be a matter of - historical connection with the subject or with related matters, or - of legal, commercial, philosophical, ethical or political position - regarding them. - - The "Invariant Sections" are certain Secondary Sections whose - titles are designated, as being those of Invariant Sections, in - the notice that says that the Document is released under this - License. If a section does not fit the above definition of - Secondary then it is not allowed to be designated as Invariant. - The Document may contain zero Invariant Sections. If the Document - does not identify any Invariant Sections then there are none. - - The "Cover Texts" are certain short passages of text that are - listed, as Front-Cover Texts or Back-Cover Texts, in the notice - that says that the Document is released under this License. A - Front-Cover Text may be at most 5 words, and a Back-Cover Text may - be at most 25 words. - - A "Transparent" copy of the Document means a machine-readable copy, - represented in a format whose specification is available to the - general public, that is suitable for revising the document - straightforwardly with generic text editors or (for images - composed of pixels) generic paint programs or (for drawings) some - widely available drawing editor, and that is suitable for input to - text formatters or for automatic translation to a variety of - formats suitable for input to text formatters. A copy made in an - otherwise Transparent file format whose markup, or absence of - markup, has been arranged to thwart or discourage subsequent - modification by readers is not Transparent. An image format is - not Transparent if used for any substantial amount of text. A - copy that is not "Transparent" is called "Opaque". - - Examples of suitable formats for Transparent copies include plain - ASCII without markup, Texinfo input format, LaTeX input format, - SGML or XML using a publicly available DTD, and - standard-conforming simple HTML, PostScript or PDF designed for - human modification. Examples of transparent image formats include - PNG, XCF and JPG. Opaque formats include proprietary formats that - can be read and edited only by proprietary word processors, SGML or - XML for which the DTD and/or processing tools are not generally - available, and the machine-generated HTML, PostScript or PDF - produced by some word processors for output purposes only. - - The "Title Page" means, for a printed book, the title page itself, - plus such following pages as are needed to hold, legibly, the - material this License requires to appear in the title page. For - works in formats which do not have any title page as such, "Title - Page" means the text near the most prominent appearance of the - work's title, preceding the beginning of the body of the text. - - The "publisher" means any person or entity that distributes copies - of the Document to the public. - - A section "Entitled XYZ" means a named subunit of the Document - whose title either is precisely XYZ or contains XYZ in parentheses - following text that translates XYZ in another language. (Here XYZ - stands for a specific section name mentioned below, such as - "Acknowledgements", "Dedications", "Endorsements", or "History".) - To "Preserve the Title" of such a section when you modify the - Document means that it remains a section "Entitled XYZ" according - to this definition. - - The Document may include Warranty Disclaimers next to the notice - which states that this License applies to the Document. These - Warranty Disclaimers are considered to be included by reference in - this License, but only as regards disclaiming warranties: any other - implication that these Warranty Disclaimers may have is void and - has no effect on the meaning of this License. - - 2. VERBATIM COPYING - - You may copy and distribute the Document in any medium, either - commercially or noncommercially, provided that this License, the - copyright notices, and the license notice saying this License - applies to the Document are reproduced in all copies, and that you - add no other conditions whatsoever to those of this License. You - may not use technical measures to obstruct or control the reading - or further copying of the copies you make or distribute. However, - you may accept compensation in exchange for copies. If you - distribute a large enough number of copies you must also follow - the conditions in section 3. - - You may also lend copies, under the same conditions stated above, - and you may publicly display copies. - - 3. COPYING IN QUANTITY - - If you publish printed copies (or copies in media that commonly - have printed covers) of the Document, numbering more than 100, and - the Document's license notice requires Cover Texts, you must - enclose the copies in covers that carry, clearly and legibly, all - these Cover Texts: Front-Cover Texts on the front cover, and - Back-Cover Texts on the back cover. Both covers must also clearly - and legibly identify you as the publisher of these copies. The - front cover must present the full title with all words of the - title equally prominent and visible. You may add other material - on the covers in addition. Copying with changes limited to the - covers, as long as they preserve the title of the Document and - satisfy these conditions, can be treated as verbatim copying in - other respects. - - If the required texts for either cover are too voluminous to fit - legibly, you should put the first ones listed (as many as fit - reasonably) on the actual cover, and continue the rest onto - adjacent pages. - - If you publish or distribute Opaque copies of the Document - numbering more than 100, you must either include a - machine-readable Transparent copy along with each Opaque copy, or - state in or with each Opaque copy a computer-network location from - which the general network-using public has access to download - using public-standard network protocols a complete Transparent - copy of the Document, free of added material. If you use the - latter option, you must take reasonably prudent steps, when you - begin distribution of Opaque copies in quantity, to ensure that - this Transparent copy will remain thus accessible at the stated - location until at least one year after the last time you - distribute an Opaque copy (directly or through your agents or - retailers) of that edition to the public. - - It is requested, but not required, that you contact the authors of - the Document well before redistributing any large number of - copies, to give them a chance to provide you with an updated - version of the Document. - - 4. MODIFICATIONS - - You may copy and distribute a Modified Version of the Document - under the conditions of sections 2 and 3 above, provided that you - release the Modified Version under precisely this License, with - the Modified Version filling the role of the Document, thus - licensing distribution and modification of the Modified Version to - whoever possesses a copy of it. In addition, you must do these - things in the Modified Version: - - A. Use in the Title Page (and on the covers, if any) a title - distinct from that of the Document, and from those of - previous versions (which should, if there were any, be listed - in the History section of the Document). You may use the - same title as a previous version if the original publisher of - that version gives permission. - - B. List on the Title Page, as authors, one or more persons or - entities responsible for authorship of the modifications in - the Modified Version, together with at least five of the - principal authors of the Document (all of its principal - authors, if it has fewer than five), unless they release you - from this requirement. - - C. State on the Title page the name of the publisher of the - Modified Version, as the publisher. - - D. Preserve all the copyright notices of the Document. - - E. Add an appropriate copyright notice for your modifications - adjacent to the other copyright notices. - - F. Include, immediately after the copyright notices, a license - notice giving the public permission to use the Modified - Version under the terms of this License, in the form shown in - the Addendum below. - - G. Preserve in that license notice the full lists of Invariant - Sections and required Cover Texts given in the Document's - license notice. - - H. Include an unaltered copy of this License. - - I. Preserve the section Entitled "History", Preserve its Title, - and add to it an item stating at least the title, year, new - authors, and publisher of the Modified Version as given on - the Title Page. If there is no section Entitled "History" in - the Document, create one stating the title, year, authors, - and publisher of the Document as given on its Title Page, - then add an item describing the Modified Version as stated in - the previous sentence. - - J. Preserve the network location, if any, given in the Document - for public access to a Transparent copy of the Document, and - likewise the network locations given in the Document for - previous versions it was based on. These may be placed in - the "History" section. You may omit a network location for a - work that was published at least four years before the - Document itself, or if the original publisher of the version - it refers to gives permission. - - K. For any section Entitled "Acknowledgements" or "Dedications", - Preserve the Title of the section, and preserve in the - section all the substance and tone of each of the contributor - acknowledgements and/or dedications given therein. - - L. Preserve all the Invariant Sections of the Document, - unaltered in their text and in their titles. Section numbers - or the equivalent are not considered part of the section - titles. - - M. Delete any section Entitled "Endorsements". Such a section - may not be included in the Modified Version. - - N. Do not retitle any existing section to be Entitled - "Endorsements" or to conflict in title with any Invariant - Section. - - O. Preserve any Warranty Disclaimers. - - If the Modified Version includes new front-matter sections or - appendices that qualify as Secondary Sections and contain no - material copied from the Document, you may at your option - designate some or all of these sections as invariant. To do this, - add their titles to the list of Invariant Sections in the Modified - Version's license notice. These titles must be distinct from any - other section titles. - - You may add a section Entitled "Endorsements", provided it contains - nothing but endorsements of your Modified Version by various - parties--for example, statements of peer review or that the text - has been approved by an organization as the authoritative - definition of a standard. - - You may add a passage of up to five words as a Front-Cover Text, - and a passage of up to 25 words as a Back-Cover Text, to the end - of the list of Cover Texts in the Modified Version. Only one - passage of Front-Cover Text and one of Back-Cover Text may be - added by (or through arrangements made by) any one entity. If the - Document already includes a cover text for the same cover, - previously added by you or by arrangement made by the same entity - you are acting on behalf of, you may not add another; but you may - replace the old one, on explicit permission from the previous - publisher that added the old one. - - The author(s) and publisher(s) of the Document do not by this - License give permission to use their names for publicity for or to - assert or imply endorsement of any Modified Version. - - 5. COMBINING DOCUMENTS - - You may combine the Document with other documents released under - this License, under the terms defined in section 4 above for - modified versions, provided that you include in the combination - all of the Invariant Sections of all of the original documents, - unmodified, and list them all as Invariant Sections of your - combined work in its license notice, and that you preserve all - their Warranty Disclaimers. - - The combined work need only contain one copy of this License, and - multiple identical Invariant Sections may be replaced with a single - copy. If there are multiple Invariant Sections with the same name - but different contents, make the title of each such section unique - by adding at the end of it, in parentheses, the name of the - original author or publisher of that section if known, or else a - unique number. Make the same adjustment to the section titles in - the list of Invariant Sections in the license notice of the - combined work. - - In the combination, you must combine any sections Entitled - "History" in the various original documents, forming one section - Entitled "History"; likewise combine any sections Entitled - "Acknowledgements", and any sections Entitled "Dedications". You - must delete all sections Entitled "Endorsements." - - 6. COLLECTIONS OF DOCUMENTS - - You may make a collection consisting of the Document and other - documents released under this License, and replace the individual - copies of this License in the various documents with a single copy - that is included in the collection, provided that you follow the - rules of this License for verbatim copying of each of the - documents in all other respects. - - You may extract a single document from such a collection, and - distribute it individually under this License, provided you insert - a copy of this License into the extracted document, and follow - this License in all other respects regarding verbatim copying of - that document. - - 7. AGGREGATION WITH INDEPENDENT WORKS - - A compilation of the Document or its derivatives with other - separate and independent documents or works, in or on a volume of - a storage or distribution medium, is called an "aggregate" if the - copyright resulting from the compilation is not used to limit the - legal rights of the compilation's users beyond what the individual - works permit. When the Document is included in an aggregate, this - License does not apply to the other works in the aggregate which - are not themselves derivative works of the Document. - - If the Cover Text requirement of section 3 is applicable to these - copies of the Document, then if the Document is less than one half - of the entire aggregate, the Document's Cover Texts may be placed - on covers that bracket the Document within the aggregate, or the - electronic equivalent of covers if the Document is in electronic - form. Otherwise they must appear on printed covers that bracket - the whole aggregate. - - 8. TRANSLATION - - Translation is considered a kind of modification, so you may - distribute translations of the Document under the terms of section - 4. Replacing Invariant Sections with translations requires special - permission from their copyright holders, but you may include - translations of some or all Invariant Sections in addition to the - original versions of these Invariant Sections. You may include a - translation of this License, and all the license notices in the - Document, and any Warranty Disclaimers, provided that you also - include the original English version of this License and the - original versions of those notices and disclaimers. In case of a - disagreement between the translation and the original version of - this License or a notice or disclaimer, the original version will - prevail. - - If a section in the Document is Entitled "Acknowledgements", - "Dedications", or "History", the requirement (section 4) to - Preserve its Title (section 1) will typically require changing the - actual title. - - 9. TERMINATION - - You may not copy, modify, sublicense, or distribute the Document - except as expressly provided under this License. Any attempt - otherwise to copy, modify, sublicense, or distribute it is void, - and will automatically terminate your rights under this License. - - However, if you cease all violation of this License, then your - license from a particular copyright holder is reinstated (a) - provisionally, unless and until the copyright holder explicitly - and finally terminates your license, and (b) permanently, if the - copyright holder fails to notify you of the violation by some - reasonable means prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is - reinstated permanently if the copyright holder notifies you of the - violation by some reasonable means, this is the first time you have - received notice of violation of this License (for any work) from - that copyright holder, and you cure the violation prior to 30 days - after your receipt of the notice. - - Termination of your rights under this section does not terminate - the licenses of parties who have received copies or rights from - you under this License. If your rights have been terminated and - not permanently reinstated, receipt of a copy of some or all of - the same material does not give you any rights to use it. - - 10. FUTURE REVISIONS OF THIS LICENSE - - The Free Software Foundation may publish new, revised versions of - the GNU Free Documentation License from time to time. Such new - versions will be similar in spirit to the present version, but may - differ in detail to address new problems or concerns. See - `http://www.gnu.org/copyleft/'. - - Each version of the License is given a distinguishing version - number. If the Document specifies that a particular numbered - version of this License "or any later version" applies to it, you - have the option of following the terms and conditions either of - that specified version or of any later version that has been - published (not as a draft) by the Free Software Foundation. If - the Document does not specify a version number of this License, - you may choose any version ever published (not as a draft) by the - Free Software Foundation. If the Document specifies that a proxy - can decide which future versions of this License can be used, that - proxy's public statement of acceptance of a version permanently - authorizes you to choose that version for the Document. - - 11. RELICENSING - - "Massive Multiauthor Collaboration Site" (or "MMC Site") means any - World Wide Web server that publishes copyrightable works and also - provides prominent facilities for anybody to edit those works. A - public wiki that anybody can edit is an example of such a server. - A "Massive Multiauthor Collaboration" (or "MMC") contained in the - site means any set of copyrightable works thus published on the MMC - site. - - "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 - license published by Creative Commons Corporation, a not-for-profit - corporation with a principal place of business in San Francisco, - California, as well as future copyleft versions of that license - published by that same organization. - - "Incorporate" means to publish or republish a Document, in whole or - in part, as part of another Document. - - An MMC is "eligible for relicensing" if it is licensed under this - License, and if all works that were first published under this - License somewhere other than this MMC, and subsequently - incorporated in whole or in part into the MMC, (1) had no cover - texts or invariant sections, and (2) were thus incorporated prior - to November 1, 2008. - - The operator of an MMC Site may republish an MMC contained in the - site under CC-BY-SA on the same site at any time before August 1, - 2009, provided the MMC is eligible for relicensing. - - -ADDENDUM: How to use this License for your documents -==================================================== - -To use this License in a document you have written, include a copy of -the License in the document and put the following copyright and license -notices just after the title page: - - Copyright (C) YEAR YOUR NAME. - Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU Free Documentation License, Version 1.3 - or any later version published by the Free Software Foundation; - with no Invariant Sections, no Front-Cover Texts, and no Back-Cover - Texts. A copy of the license is included in the section entitled ``GNU - Free Documentation License''. - - If you have Invariant Sections, Front-Cover Texts and Back-Cover -Texts, replace the "with...Texts." line with this: - - with the Invariant Sections being LIST THEIR TITLES, with - the Front-Cover Texts being LIST, and with the Back-Cover Texts - being LIST. - - If you have Invariant Sections without Cover Texts, or some other -combination of the three, merge those two alternatives to suit the -situation. - - If your document contains nontrivial examples of program code, we -recommend releasing these examples in parallel under your choice of -free software license, such as the GNU General Public License, to -permit their use in free software. - - -File: preview-latex.info, Node: Index, Prev: Copying this Manual, Up: Top - -Index -***** - -[index] -* Menu: - -* \PreviewEnvironment: Provided commands. (line 133) -* \PreviewMacro: Provided commands. (line 26) -* Activation: Activating preview-latex. - (line 6) -* C-c C-k: Keys and lisp. (line 161) -* C-c C-m P: Keys and lisp. (line 64) -* C-c C-p C-b: Keys and lisp. (line 90) -* C-c C-p C-c C-b: Keys and lisp. (line 116) -* C-c C-p C-c C-d: Keys and lisp. (line 122) -* C-c C-p C-c C-p: Keys and lisp. (line 100) -* C-c C-p C-c C-r: Keys and lisp. (line 111) -* C-c C-p C-c C-s: Keys and lisp. (line 106) -* C-c C-p C-d: Keys and lisp. (line 95) -* C-c C-p C-e: Keys and lisp. (line 75) -* C-c C-p C-f: Keys and lisp. (line 129) -* C-c C-p C-i: Keys and lisp. (line 148) -* C-c C-p C-p: Keys and lisp. (line 24) -* C-c C-p C-r: Keys and lisp. (line 85) -* C-c C-p C-s: Keys and lisp. (line 80) -* C-c C-p C-w: Keys and lisp. (line 46) -* C-u C-c C-p C-f: Keys and lisp. (line 142) -* Caching a preamble: Simple customization. - (line 59) -* Contacts: Contacts. (line 6) -* Copying: Copying. (line 6) -* Copyright: Copying. (line 6) -* CVS access: Availability. (line 6) -* Distribution: Copying. (line 6) -* Download: Availability. (line 6) -* FDL, GNU Free Documentation License: GNU Free Documentation License. - (line 6) -* Free: Copying. (line 6) -* Free software: Copying. (line 6) -* General Public License: Copying. (line 6) -* GPL: Copying. (line 6) -* Inline math: Simple customization. - (line 110) -* Kill preview-generating process: Keys and lisp. (line 161) -* License: Copying. (line 6) -* M-m P: Keys and lisp. (line 64) -* M-x preview-report-bug : Keys and lisp. (line 153) -* Mailing list: Contacts. (line 6) -* Menu entries: Keys and lisp. (line 6) -* Philosophy of preview-latex: What use is it?. (line 6) -* preview-at-point: Keys and lisp. (line 24) -* preview-auctex-font-size: The Emacs interface. (line 100) -* preview-auto-cache-preamble: Simple customization. - (line 59) -* preview-buffer: Keys and lisp. (line 90) -* preview-cache-preamble: Keys and lisp. (line 129) -* preview-cache-preamble-off: Keys and lisp. (line 142) -* preview-clearout: Keys and lisp. (line 111) -* preview-clearout-at-point: Keys and lisp. (line 100) -* preview-clearout-buffer: Keys and lisp. (line 116) -* preview-clearout-document: Keys and lisp. (line 106) -* preview-copy-region-as-mml: Keys and lisp. (line 46) -* preview-default-document-pt: The Emacs interface. (line 83) -* preview-default-option-list: The Emacs interface. (line 53) -* preview-default-preamble <1>: Misplaced previews. (line 59) -* preview-default-preamble: The Emacs interface. (line 54) -* preview-document: Keys and lisp. (line 95) -* preview-document-pt: The Emacs interface. (line 97) -* preview-document-pt-list: The Emacs interface. (line 82) -* preview-dvipng-command: The preview images. (line 40) -* preview-dvipng-image-type: The preview images. (line 43) -* preview-dvips-command: The Emacs interface. (line 125) -* preview-environment: Keys and lisp. (line 75) -* preview-error-icon-specs: The Emacs interface. (line 152) -* preview-fast-conversion: The Emacs interface. (line 60) -* preview-fast-dvips-command: The Emacs interface. (line 124) -* preview-goto-info-page: Keys and lisp. (line 148) -* preview-gs-image-type-alist: The preview images. (line 8) -* preview-gs-options <1>: The preview images. (line 54) -* preview-gs-options: Problems with Ghostscript. - (line 22) -* preview-icon-specs: The Emacs interface. (line 153) -* preview-image-creators <1>: The preview images. (line 7) -* preview-image-creators: Problems with Ghostscript. - (line 31) -* preview-image-type <1>: The preview images. (line 6) -* preview-image-type <2>: Problems with Ghostscript. - (line 33) -* preview-image-type: Basic modes of operation. - (line 16) -* preview-inner-environments: The Emacs interface. (line 158) -* preview-LaTeX-command: The Emacs interface. (line 11) -* preview-LaTeX-command-replacements: The Emacs interface. (line 25) -* preview-nonready-icon-specs: The Emacs interface. (line 145) -* preview-parsed-font-size: The Emacs interface. (line 100) -* preview-prefer-TeX-bb: The Emacs interface. (line 69) -* preview-preserve-counters <1>: The Emacs interface. (line 47) -* preview-preserve-counters: Simple customization. - (line 63) -* preview-reference-face: The Emacs interface. (line 81) -* preview-region: Keys and lisp. (line 85) -* preview-report-bug: Keys and lisp. (line 153) -* preview-required-option-list <1>: The Emacs interface. (line 35) -* preview-required-option-list: Simple customization. - (line 63) -* preview-scale-function: The Emacs interface. (line 80) -* preview-section: Keys and lisp. (line 80) -* preview-transparent-border: Keys and lisp. (line 56) -* preview-use-balloon-help: The Emacs interface. (line 165) -* Readme: Introduction. (line 6) -* Report a bug: Keys and lisp. (line 153) -* Right: Copying. (line 6) -* Showing \labels: Simple customization. - (line 23) -* Using dvipng: Basic modes of operation. - (line 18) -* Warranty: Copying. (line 6) - - - -Tag Table: -Node: Top942 -Node: Copying2214 -Node: Introduction2675 -Node: What use is it?3348 -Node: Activating preview-latex4740 -Node: Getting started5555 -Node: Basic modes of operation7642 -Node: More documentation8846 -Node: Availability9734 -Node: Contacts10339 -Node: Installation11611 -Node: Keys and lisp11824 -Node: Simple customization18492 -Node: Known problems24253 -Node: Problems with Ghostscript25074 -Node: Font problems with Dvips27267 -Node: Emacs problems28470 -Node: Too small bounding boxes30207 -Node: x-symbol interoperation31591 -Node: Middle-clicks paste instead of toggling32973 -Node: For advanced users33789 -Node: The LaTeX style file34248 -Node: Package options36809 -Node: Provided commands47744 -Node: The Emacs interface55099 -Node: The preview images64279 -Node: Misplaced previews67751 -Node: ToDo71194 -Node: Frequently Asked Questions75979 -Node: Introduction to FAQ76302 -Node: Requirements76641 -Node: Installation Trouble79605 -Node: Customization82167 -Node: Troubleshooting85715 -Node: Other formats88232 -Node: Copying this Manual89549 -Node: GNU Free Documentation License90474 -Node: Index115615 - -End Tag Table diff --git a/packages/auctex/preview.el b/packages/auctex/preview.el deleted file mode 100644 index a2a17d318..000000000 --- a/packages/auctex/preview.el +++ /dev/null @@ -1,3610 +0,0 @@ -;;; preview.el --- embed preview LaTeX images in source buffer - -;; Copyright (C) 2001, 2002, 2003, 2004, 2005, -;; 2006 Free Software Foundation, Inc. - -;; Author: David Kastrup -;; Keywords: tex, wp, convenience - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, -;; Boston, MA 02110-1301, USA. - -;;; Commentary: - -;; $Id: preview.el,v 1.284 2009/06/18 19:20:46 angeli Exp $ -;; -;; This style is for the "seamless" embedding of generated images -;; into LaTeX source code. Please see the README and INSTALL files -;; for further instruction. -;; -;; Please use the usual configure script for installation: more than -;; just Elisp files are involved: a LaTeX style, icon files, startup -;; code and so on. -;; -;; Quite a few things with regard to preview-latex's operation can be -;; configured by using -;; M-x customize-group RET preview RET -;; -;; Please report bugs with M-x preview-report-bug RET -;; - -;;; Code: - -(require 'tex-site) -(require 'tex) -(require 'tex-buf) -(require 'latex) - -(eval-when-compile - (condition-case nil - (require 'desktop) - (file-error (message "Missing desktop package: -preview-latex buffers will not survive across sessions."))) - (condition-case nil - (require 'reporter) - (file-error (message "Missing reporter library, probably from the mail-lib package: -preview-latex's bug reporting commands will probably not work."))) - (require 'info) - (defvar error)) - -;; we need the compatibility macros which do _not_ get byte-compiled. -(eval-when-compile - (if (featurep 'xemacs) - (load-library "prv-xemacs.el"))) - -;; if the above load-library kicked in, this will not cause anything -;; to get loaded. -(require (if (featurep 'xemacs) - 'prv-xemacs 'prv-emacs)) - -(defgroup preview nil "Embed Preview images into LaTeX buffers." - :group 'AUCTeX - :prefix "preview-" - :link '(custom-manual "(preview-latex)Top") - :link '(info-link "(preview-latex)The Emacs interface") - :link '(url-link :tag "Homepage" "http://www.gnu.org/software/auctex/")) - -(defgroup preview-gs nil "Preview's Ghostscript renderer." - :group 'preview - :prefix "preview-") - -(defgroup preview-appearance nil "Preview image appearance." - :group 'preview - :prefix "preview-") - -(defconst preview-specs-type - '(repeat - (list :tag "Image spec" - ;; Use an extra :value keyword to avoid a bug in - ;; `widget-convert' of XEmacs 21.4 and Emacs 21. - ;; Analogously for the following `const' statements. - (const :format "" :value :type) - (choice :tag "Image type" - (const xpm) - (const xbm) - (symbol :tag "Other")) - (set :inline t :tag "Minimum font size" - (list :inline t :tag "" - (const :format "" :value :min) - (integer :tag "pixels"))) - (const :format "" :value :file) (string :tag "Filename") - (set :inline t :tag "Ascent ratio" - (list :inline t :tag "" - (const :format "" :value :ascent) - (integer :tag "percent of image" - :value 50)))))) - -(defun preview-specs-setter (symbol value) - "Set SYMBOL to VALUE and clear `preview-min-alist' property. -This is used in icon specs, so that customizing will -clear cached icons." - (put symbol 'preview-min-alist nil) - (set-default symbol value)) - -(defcustom preview-nonready-icon-specs - '((:type xpm :min 26 :file "prvwrk24.xpm" :ascent 90) - (:type xpm :min 22 :file "prvwrk20.xpm" :ascent 90) - (:type xpm :min 17 :file "prvwrk16.xpm" :ascent 90) - (:type xpm :min 15 :file "prvwrk14.xpm" :ascent 90) - (:type xpm :file "prvwrk12.xpm" :ascent 90) - (:type xbm :file "prvwrk24.xbm" :ascent 90)) - "The icon used for previews to be generated. -The spec must begin with `:type'. File names are relative to -`load-path' and `data-directory', a spec `:min' requires a -minimal pixel height for `preview-reference-face' before the spec -will be considered. Since evaluating the `:file' spec takes -considerable time under XEmacs, it should come after the `:min' -spec to avoid unnecessary evaluation time." - :group 'preview-appearance - :type preview-specs-type - :set #'preview-specs-setter) - -(defvar preview-nonready-icon) - -(defcustom preview-error-icon-specs - '((:type xpm :min 22 :file "prverr24.xpm" :ascent 90) - (:type xpm :min 18 :file "prverr20.xpm" :ascent 90) - (:type xpm :file "prverr16.xpm" :ascent 90) - (:type xbm :file "prverr24.xbm" :ascent 90)) - "The icon used for PostScript errors. -The spec must begin with `:type'. File names are relative to -`load-path' and `data-directory', a spec `:min' requires a -minimal pixel height for `preview-reference-face' before the spec -will be considered. Since evaluating the `:file' spec takes -considerable time under XEmacs, it should come after the `:min' -spec to avoid unnecessary evaluation time." - :group 'preview-appearance - :type preview-specs-type - :set #'preview-specs-setter -) - -(defvar preview-error-icon) - -(defcustom preview-icon-specs - '((:type xpm :min 24 :file "prvtex24.xpm" :ascent 75) - (:type xpm :min 20 :file "prvtex20.xpm" :ascent 75) - (:type xpm :min 16 :file "prvtex16.xpm" :ascent 75) - (:type xpm :file "prvtex12.xpm" :ascent 75) - (:type xbm :min 24 :file "prvtex24.xbm" :ascent 75) - (:type xbm :min 16 :file "prvtex16.xbm" :ascent 75) - (:type xbm :file "prvtex12.xbm" :ascent 75)) - "The icon used for an open preview. -The spec must begin with `:type'. File names are relative to -`load-path' and `data-directory', a spec `:min' requires a -minimal pixel height for `preview-reference-face' before the spec -will be considered. Since evaluating the `:file' spec takes -considerable time under XEmacs, it should come after the `:min' -spec to avoid unnecessary evaluation time." - :group 'preview-appearance - :type preview-specs-type - :set #'preview-specs-setter) - -(defvar preview-icon) - -(defgroup preview-latex nil "LaTeX options for preview." - :group 'preview - :prefix "preview-") - -(defcustom preview-image-creators - '((dvipng - (open preview-gs-open preview-dvipng-process-setup) - (place preview-gs-place) - (close preview-dvipng-close)) - (png (open preview-gs-open) - (place preview-gs-place) - (close preview-gs-close)) - (jpeg (open preview-gs-open) - (place preview-gs-place) - (close preview-gs-close)) - (pnm (open preview-gs-open) - (place preview-gs-place) - (close preview-gs-close)) - (tiff (open preview-gs-open) - (place preview-gs-place) - (close preview-gs-close))) - "Define functions for generating images. -These functions get called in the process of generating inline -images of the specified type. The open function is called -at the start of a rendering pass, the place function for -placing every image, the close function at the end of -the pass. Look at the documentation of the various -functions used here for the default settings, and at -the function `preview-call-hook' through which those are -called. Additional argument lists specified in here -are passed to the functions before any additional -arguments given to `preview-call-hook'. - -Not all of these image types may be supported by your copy -of Ghostscript, or by your copy of Emacs." - :group 'preview-gs - :type '(alist :key-type (symbol :tag "Preview's image type") - :value-type - (alist :tag "Handler" :key-type (symbol :tag "Operation:") - :value-type (list :tag "Handler" - (function :tag "Handler function") - (repeat :tag "Additional \ -function args" :inline t sexp)) - :options (open place close)))) - -(defcustom preview-gs-image-type-alist - '((png png "-sDEVICE=png16m") - (dvipng png "-sDEVICE=png16m") - (jpeg jpeg "-sDEVICE=jpeg") - (pnm pbm "-sDEVICE=pnmraw") - (tiff tiff "-sDEVICE=tiff12nc")) - "*Alist of image types and corresponding Ghostscript options. -The `dvipng' and `postscript' (don't use) entries really specify -a fallback device when images can't be processed by the requested -method, like when PDFTeX was used." - :group 'preview-gs - :type '(repeat (list :tag nil (symbol :tag "preview image-type") - (symbol :tag "Emacs image-type") - (repeat :inline t :tag "Ghostscript options" string)))) - -(defcustom preview-image-type 'png - "*Image type to be used in images." - :group 'preview-gs - :type (append '(choice) - (mapcar (lambda (symbol) (list 'const (car symbol))) - preview-image-creators) - '((symbol :tag "Other")))) - -(defun preview-call-hook (symbol &rest rest) - "Call a function from `preview-image-creators'. -This looks up SYMBOL in the `preview-image-creators' entry -for the image type `preview-image-type' and calls the -hook function given there with the arguments specified there -followed by REST. If such a function is specified in there, -that is." - (let ((hook (cdr (assq symbol - (cdr (assq preview-image-type - preview-image-creators)))))) - (when hook - (apply (car hook) (append (cdr hook) rest))))) - - -(defvar TeX-active-tempdir nil - "List of directory name, top directory name and reference count.") -(make-variable-buffer-local 'TeX-active-tempdir) - -(defcustom preview-bb-filesize 1024 - "Size of file area scanned for bounding box information." - :group 'preview-gs :type 'integer) - -(defcustom preview-preserve-indentation t - "*Whether to keep additional whitespace at the left of a line." - :group 'preview-appearance :type 'boolean) - -(defun preview-extract-bb (filename) - "Extract EPS bounding box vector from FILENAME." - (with-temp-buffer - (insert-file-contents-literally filename nil 0 preview-bb-filesize - t) - (goto-char (point-min)) - (when (search-forward-regexp "%%BoundingBox:\ - +\\([-+]?[0-9.]+\\)\ - +\\([-+]?[0-9.]+\\)\ - +\\([-+]?[0-9.]+\\)\ - +\\([-+]?[0-9.]+\\)" nil t) - (vector - (if preview-preserve-indentation - (min 72 (string-to-number (match-string 1))) - (string-to-number (match-string 1))) - (string-to-number (match-string 2)) - (string-to-number (match-string 3)) - (string-to-number (match-string 4)) - )))) - -(defcustom preview-prefer-TeX-bb nil - "*Prefer TeX bounding box to EPS one if available. -If `preview-fast-conversion' is set, this option is not - consulted since the TeX bounding box has to be used anyway." - :group 'preview-gs - :type 'boolean) - -(defcustom preview-TeX-bb-border 0.5 - "*Additional space in pt around Bounding Box from TeX." - :group 'preview-gs - :type 'number) - -(defvar preview-coding-system nil - "Coding system used for LaTeX process.") -(make-variable-buffer-local 'preview-coding-system) -(defvar preview-parsed-font-size nil - "Font size as parsed from the log of LaTeX run.") -(make-variable-buffer-local 'preview-parsed-font-size) -(defvar preview-parsed-magnification nil - "Magnification as parsed from the log of LaTeX run.") -(make-variable-buffer-local 'preview-parsed-magnification) -(defvar preview-parsed-pdfoutput nil - "PDFoutput as parsed from the log of LaTeX run.") -(make-variable-buffer-local 'preview-parsed-pdfoutput) -(defvar preview-parsed-counters nil - "Counters as parsed from the log of LaTeX run.") -(make-variable-buffer-local 'preview-parsed-counters) -(defvar preview-parsed-tightpage nil - "Tightpage as parsed from the log of LaTeX run.") -(make-variable-buffer-local 'preview-parsed-tightpage) - -(defun preview-get-magnification () - "Get magnification from `preview-parsed-magnification'." - (if preview-parsed-magnification - (/ preview-parsed-magnification 1000.0) 1.0)) - -(defun preview-TeX-bb (list) - "Calculate bounding box from (ht dp wd). -LIST consists of TeX dimensions in sp (1/65536 TeX point)." - (and - (consp list) - (let* ((dims (vconcat (mapcar - #'(lambda (x) - (/ x 65781.76)) list))) - (box - (vector - (+ 72 (min 0 (aref dims 2))) - (+ 720 (min (aref dims 0) (- (aref dims 1)) 0)) - (+ 72 (max 0 (aref dims 2))) - (+ 720 (max (aref dims 0) (- (aref dims 1)) 0)))) - (border (if preview-parsed-tightpage - (vconcat (mapcar - #'(lambda(x) - (/ x 65781.76)) preview-parsed-tightpage)) - (vector (- preview-TeX-bb-border) - (- preview-TeX-bb-border) - preview-TeX-bb-border - preview-TeX-bb-border)))) - (dotimes (i 4 box) - (aset box i (+ (aref box i) (aref border i))))))) - -(defcustom preview-gs-command (if (eq system-type 'windows-nt) - "GSWIN32C.EXE" - "gs") - "*How to call gs for conversion from EPS. See also `preview-gs-options'." - :group 'preview-gs - :type 'string) - -(defcustom preview-gs-options '("-q" "-dSAFER" "-dNOPAUSE" - "-DNOPLATFONTS" "-dPrinted" - "-dTextAlphaBits=4" - "-dGraphicsAlphaBits=4") - "*Options with which to call gs for conversion from EPS. -See also `preview-gs-command'." - :group 'preview-gs - :type '(repeat string)) - -(defvar preview-gs-queue nil - "List of overlays to convert using gs. -Buffer-local to the appropriate TeX process buffer.") -(make-variable-buffer-local 'preview-gs-queue) - -(defvar preview-gs-outstanding nil - "Overlays currently processed.") -(make-variable-buffer-local 'preview-gs-outstanding) - -(defcustom preview-gs-outstanding-limit 2 - "*Number of requests allowed to be outstanding. -This is the number of not-yet-completed requests we -might at any time have piped into Ghostscript. If -this number is larger, the probability of Ghostscript -working continuously is higher when Emacs is rather -busy. If this number is smaller, redisplay will -follow changes in the displayed buffer area faster." - :group 'preview-gs - :type '(restricted-sexp - :match-alternatives - ((lambda (value) (and - (integerp value) - (> value 0) - (< value 10)))) - :tag "small number")) - -(defvar preview-gs-answer nil - "Accumulated answer of Ghostscript process.") -(make-variable-buffer-local 'preview-gs-answer) - -(defvar preview-gs-image-type nil - "Image type for gs produced images.") -(make-variable-buffer-local 'preview-gs-image-type) - -(defvar preview-gs-sequence nil - "Pair of sequence numbers for gs produced images.") -(make-variable-buffer-local 'preview-gs-sequence) - -(defvar preview-scale nil - "Screen scale of images. -Magnify by this factor to make images blend with other -screen content. Buffer-local to rendering buffer.") -(make-variable-buffer-local 'preview-scale) - -(defvar preview-colors nil - "Color setup list. -An array with elements 0, 1 and 2 for background, -foreground and border colors, respectively. Each element -is a list of 3 real numbers between 0 and 1, or NIL -of nothing special should be done for the color") -(make-variable-buffer-local 'preview-colors) - -(defvar preview-gs-init-string nil - "Ghostscript setup string.") -(make-variable-buffer-local 'preview-gs-init-string) - -(defvar preview-ps-file nil - "PostScript file name for fast conversion.") -(make-variable-buffer-local 'preview-ps-file) - -(defvar preview-gs-dsc nil - "Parsed DSC information.") -(make-variable-buffer-local 'preview-gs-dsc) - -(defvar preview-resolution nil - "Screen resolution where rendering started. -Cons-cell of x and y resolution, given in -dots per inch. Buffer-local to rendering buffer.") -(make-variable-buffer-local 'preview-resolution) - -(defun preview-gs-resolution (scale xres yres) - "Generate resolution argument for gs. -Calculated from real-life factor SCALE and XRES and -YRES, the screen resolution in dpi." - (format "-r%gx%g" - (/ (* scale xres) (preview-get-magnification)) - (/ (* scale yres) (preview-get-magnification)))) - -(defun preview-gs-behead-outstanding (err) - "Remove leading element of outstanding queue after error. -Return element if non-nil. ERR is the error string to -show as response of Ghostscript." - (let ((ov (pop preview-gs-outstanding))) - (when ov - (preview-gs-flag-error ov err) - (overlay-put ov 'queued nil)) - ov)) - -(defvar preview-gs-command-line nil) -(make-variable-buffer-local 'preview-gs-command-line) -(defvar preview-gs-file nil) -(make-variable-buffer-local 'preview-gs-file) - -(defcustom preview-fast-conversion t - "*Set this for single-file PostScript conversion. -This will have no effect when `preview-image-type' is -set to `postscript'." - :group 'preview-latex - :type 'boolean) - -(defun preview-string-expand (arg &optional separator) - "Expand ARG as a string. -It can already be a string. Or it can be a list, then it is -recursively evaluated using SEPARATOR as separator. If a list -element is in itself a CONS cell, the CAR of the list (after symbol -dereferencing) can evaluate to either a string, in which case it is -used as a separator for the rest of the list, -or a boolean (t or nil) in which case the rest of the list is -either evaluated and concatenated or ignored, respectively. -ARG can be a symbol, and so can be the CDR -of a cell used for string concatenation." - (cond - ((stringp arg) arg) - ((consp arg) - (mapconcat - #'identity - (delq nil - (mapcar - (lambda(x) - (if (consp x) - (let ((sep (car x))) - (while (and (symbolp sep) - (not (memq sep '(t nil)))) - (setq sep (symbol-value sep))) - (if (stringp sep) - (preview-string-expand (cdr x) sep) - (and sep - (preview-string-expand (cdr x))))) - (preview-string-expand x))) - arg)) - (or separator ""))) - ((and (symbolp arg) (not (memq arg '(t nil)))) - (preview-string-expand (symbol-value arg) separator)) - (t (error "Bad string expansion")))) - -(defconst preview-expandable-string - ((lambda (f) (funcall f (funcall f 'sexp))) - (lambda (x) - `(choice - string - (repeat :tag "Concatenate" - (choice - string - (cons :tag "Separated list" - (choice (string :tag "Separator") - (symbol :tag "Indirect separator or flag")) - ,x) - (symbol :tag "Indirect variable (no separator)"))) - (symbol :tag "Indirect variable (with separator)")))) - "Type to be used for `preview-string-expand'. -Just a hack until we get to learn how to do this properly. -Recursive definitions are not popular with Emacs, -so we define this type just two levels deep. This -kind of expandible string can either be just a string, or a -cons cell with a separator string in the CAR, and either -an explicit list of elements in the CDR, or a symbol to -be consulted recursively.") - -(defcustom preview-dvipng-command - "dvipng -picky -noghostscript %d -o \"%m/prev%%03d.png\"" - "*Command used for converting to separate PNG images. - -You might specify options for converting to other image types, -but then you'll need to adapt `preview-dvipng-image-type'." - :group 'preview-latex - :type 'string) - -(defcustom preview-dvipng-image-type - 'png - "*Image type that dvipng produces. - -You'll need to change `preview-dvipng-command' too, -if you customize this." - :group 'preview-latex - :type '(choice (const png) - (const gif) - (symbol :tag "Other" :value png))) - -(defcustom preview-dvips-command - "dvips -Pwww -i -E %d -o %m/preview.000" - "*Command used for converting to separate EPS images." - :group 'preview-latex - :type 'string) - -(defcustom preview-fast-dvips-command - "dvips -Pwww %d -o %m/preview.ps" - "*Command used for converting to a single PS file." - :group 'preview-latex - :type 'string) - -(defcustom preview-pdf2dsc-command - "pdf2dsc %s.pdf %m/preview.dsc" - "*Command used for generating dsc from a PDF file." - :group 'preview-latex - :type 'string) - -(defun preview-gs-queue-empty () - "Kill off everything remaining in `preview-gs-queue'." - (mapc #'preview-delete preview-gs-outstanding) - (dolist (ov preview-gs-queue) - (if (overlay-get ov 'queued) - (preview-delete ov))) - (setq preview-gs-outstanding nil) - (setq preview-gs-queue nil)) - -(defvar preview-error-condition nil - "Last error raised and to be reported.") - -(defun preview-log-error (err context &optional process) - "Log an error message to run buffer. -ERR is the caught error syndrome, CONTEXT is where it -occured, PROCESS is the process for which the run-buffer -is to be used." - (when (or (null process) (buffer-name (process-buffer process))) - (with-current-buffer (or (and process - (process-buffer process)) - (current-buffer)) - (save-excursion - (goto-char (or (and process - (process-buffer process) - (marker-buffer (process-mark process)) - (process-mark process)) - (point-max))) - (insert-before-markers - (format "%s: %s\n" - context (error-message-string err))) - (display-buffer (current-buffer))))) - (setq preview-error-condition err)) - -(defun preview-reraise-error (&optional process) - "Raise an error that has been logged. -Makes sure that PROCESS is removed from the \"Compilation\" -tag in the mode line." - (when preview-error-condition - (unwind-protect - (signal (car preview-error-condition) (cdr preview-error-condition)) - (setq preview-error-condition nil - compilation-in-progress (delq process compilation-in-progress))))) - -(defun preview-gs-sentinel (process string) - "Sentinel function for rendering process. -Gets the default PROCESS and STRING arguments -and tries to restart Ghostscript if necessary." - (condition-case err - (let ((status (process-status process))) - (when (memq status '(exit signal)) - (setq compilation-in-progress (delq process compilation-in-progress))) - (when (buffer-name (process-buffer process)) - (with-current-buffer (process-buffer process) - (goto-char (point-max)) - (insert-before-markers "\n" mode-name " " string) - (forward-char -1) - (insert " at " - (substring (current-time-string) 0 -5)) - (forward-char 1) - (TeX-command-mode-line process) - (when (memq status '(exit signal)) - ;; process died. - ;; Throw away culprit, go on. - (let* ((err (concat preview-gs-answer "\n" - (process-name process) " " string)) - (ov (preview-gs-behead-outstanding err))) - (when (and (null ov) preview-gs-queue) - (save-excursion - (goto-char (if (marker-buffer (process-mark process)) - (process-mark process) - (point-max))) - (insert-before-markers err))) - (delete-process process) - (if (or (null ov) - (eq status 'signal)) - ;; if process was killed explicitly by signal, or if nothing - ;; was processed, we give up on the matter altogether. - (progn - (when preview-ps-file - (condition-case nil - (preview-delete-file preview-ps-file) - (file-error nil))) - (preview-gs-queue-empty)) - - ;; restart only if we made progress since last call - (let (filenames) - (dolist (ov preview-gs-outstanding) - (setq filenames (overlay-get ov 'filenames)) - (condition-case nil - (preview-delete-file (nth 1 filenames)) - (file-error nil)) - (setcdr filenames nil))) - (setq preview-gs-queue (nconc preview-gs-outstanding - preview-gs-queue)) - (setq preview-gs-outstanding nil) - (preview-gs-restart))))))) - (error (preview-log-error err "Ghostscript" process))) - (preview-reraise-error process)) - -(defun preview-gs-filter (process string) - "Filter function for processing Ghostscript output. -Gets the usual PROCESS and STRING parameters, see -`set-process-filter' for a description." - (with-current-buffer (process-buffer process) - (setq preview-gs-answer (concat preview-gs-answer string)) - (while (string-match "GS\\(<[0-9]+\\)?>" preview-gs-answer) - (let* ((pos (match-end 0)) - (answer (substring preview-gs-answer 0 pos))) - (setq preview-gs-answer (substring preview-gs-answer pos)) - (condition-case err - (preview-gs-transact process answer) - (error (preview-log-error err "Ghostscript filter" process)))))) - (preview-reraise-error)) - -(defun preview-gs-restart () - "Start a new Ghostscript conversion process." - (when preview-gs-queue - (if preview-gs-sequence - (setcar preview-gs-sequence (1+ (car preview-gs-sequence))) - (setq preview-gs-sequence (list 1))) - (setcdr preview-gs-sequence 1) - (let* ((process-connection-type nil) - (outfile (format "-dOutputFile=%s" - (preview-ps-quote-filename - (format "%s/pr%d-%%d.%s" - (car TeX-active-tempdir) - (car preview-gs-sequence) - preview-gs-image-type)))) - (process - (apply #'start-process - "Preview-Ghostscript" - (current-buffer) - preview-gs-command - outfile - preview-gs-command-line))) - (goto-char (point-max)) - (insert-before-markers "Running `Preview-Ghostscript' with ``" - (mapconcat #'shell-quote-argument - (append - (list preview-gs-command - outfile) - preview-gs-command-line) - " ") "''\n") - (setq preview-gs-answer "") - (process-kill-without-query process) - (set-process-sentinel process #'preview-gs-sentinel) - (set-process-filter process #'preview-gs-filter) - (process-send-string process preview-gs-init-string) - (setq mode-name "Preview-Ghostscript") - (push process compilation-in-progress) - (TeX-command-mode-line process) - (set-buffer-modified-p (buffer-modified-p)) - process))) - -(defun preview-gs-open (&optional setup) - "Start a Ghostscript conversion pass. -SETUP may contain a parser setup function." - (let ((image-info (assq preview-image-type preview-gs-image-type-alist))) - (setq preview-gs-image-type (nth 1 image-info)) - (setq preview-gs-sequence nil) - (setq preview-gs-command-line (append - preview-gs-options - (nthcdr 2 image-info)) - preview-gs-init-string - (format "{DELAYSAFER{.setsafe}if}stopped pop\ -/.preview-BP currentpagedevice/BeginPage get dup \ -null eq{pop{pop}bind}if def\ -<>setpagedevice\ -/preview-do{[count 3 roll save]3 1 roll dup length 0 eq\ -{pop}{setpagedevice}{ifelse .runandhide}\ -stopped{handleerror quit}if \ -aload pop restore}bind def " - (preview-gs-color-string preview-colors))) - (preview-gs-queue-empty) - (preview-parse-messages (or setup #'preview-gs-dvips-process-setup)))) - -(defun preview-gs-color-value (value) - "Return string to be used as color value for an RGB component. -Conversion from Emacs color numbers (0 to 65535) in VALUE -to Ghostscript floats." - (format "%g" (/ value 65535.0))) - -(defun preview-pdf-color-string (colors) - "Return a string that patches PDF foreground color to work properly." - ;; Actually, this is rather brutal. It will only be invoked in - ;; cases, however, where previously it was not expected that - ;; anything readable turned up, anyway. - (let ((fg (aref colors 1))) - (if fg - (concat - "/GS_PDF_ProcSet GS_PDF_ProcSet dup maxlength dict copy dup begin\ -/graphicsbeginpage{//graphicsbeginpage exec " - (mapconcat #'preview-gs-color-value fg " ") - " 3 copy rg RG}bind store end readonly store ")))) - -(defun preview-gs-color-string (colors) - "Return a string setting up colors" - (let ((bg (aref colors 0)) - (fg (aref colors 1)) - (mask (aref colors 2)) - (border (aref colors 3))) - (concat - (and (or (and mask border) (and bg (not fg))) - "gsave ") - (and bg - (concat - (mapconcat #'preview-gs-color-value bg " ") - " setrgbcolor clippath fill ")) - (and mask border - (format "%s setrgbcolor false setstrokeadjust %g \ -setlinewidth clippath strokepath \ -matrix setmatrix true \ -{2 index{newpath}if round exch round exch moveto pop false}\ -{round exch round exch lineto}{curveto}{closepath}\ -pathforall pop fill " - (mapconcat #'preview-gs-color-value mask " ") - (* 2 border))) - ;; I hate antialiasing. Warp border to integral coordinates. - (and (or (and mask border) (and bg (not fg))) - "grestore ") - (and fg - (concat - (mapconcat #'preview-gs-color-value fg " ") - " setrgbcolor"))))) - -(defun preview-dvipng-color-string (colors res) - "Return color setup tokens for dvipng. -Makes a string of options suitable for passing to dvipng. -Pure borderless black-on-white will return an empty string." - (let - ((bg (aref colors 0)) - (fg (aref colors 1)) - (mask (aref colors 2)) - (border (aref colors 3))) - (concat - (and bg - (format "--bg 'rgb %s' " - (mapconcat #'preview-gs-color-value bg " "))) - (and fg - (format "--fg 'rgb %s' " - (mapconcat #'preview-gs-color-value fg " "))) - (and mask border - (format "--bd 'rgb %s' " - (mapconcat #'preview-gs-color-value mask " "))) - (and border - (format "--bd %d" (max 1 (round (/ (* res border) 72.0)))))))) - -(defun preview-gs-dvips-process-setup () - "Set up Dvips process for conversions via gs." - (unless (preview-supports-image-type preview-gs-image-type) - (error "preview-image-type setting '%s unsupported by this Emacs" - preview-gs-image-type)) - (setq preview-gs-command-line (append - preview-gs-command-line - (list (preview-gs-resolution - (preview-hook-enquiry preview-scale) - (car preview-resolution) - (cdr preview-resolution))))) - (if preview-parsed-pdfoutput - (preview-pdf2dsc-process-setup) - (let ((process (preview-start-dvips preview-fast-conversion))) - (setq TeX-sentinel-function #'preview-gs-dvips-sentinel) - (list process (current-buffer) TeX-active-tempdir preview-ps-file - preview-gs-image-type)))) - -(defun preview-dvipng-process-setup () - "Set up dvipng process for conversion." - (setq preview-gs-command-line (append - preview-gs-command-line - (list (preview-gs-resolution - (preview-hook-enquiry preview-scale) - (car preview-resolution) - (cdr preview-resolution))))) - (if preview-parsed-pdfoutput - (if (preview-supports-image-type preview-gs-image-type) - (preview-pdf2dsc-process-setup) - (error "preview-image-type setting '%s unsupported by this Emacs" - preview-gs-image-type)) - (unless (preview-supports-image-type preview-dvipng-image-type) - (error "preview-dvipng-image-type setting '%s unsupported by this Emacs" - preview-dvipng-image-type)) - (let ((process (preview-start-dvipng))) - (setq TeX-sentinel-function #'preview-dvipng-sentinel) - (list process (current-buffer) TeX-active-tempdir t - preview-dvipng-image-type)))) - - -(defun preview-pdf2dsc-process-setup () - (let ((process (preview-start-pdf2dsc))) - (setq TeX-sentinel-function #'preview-pdf2dsc-sentinel) - (list process (current-buffer) TeX-active-tempdir preview-ps-file - preview-gs-image-type))) - -(defun preview-dvips-abort () - "Abort a Dvips run." - (preview-gs-queue-empty) - (condition-case nil - (delete-file - (let ((gsfile preview-gs-file)) - (with-current-buffer TeX-command-buffer - (funcall (car gsfile) "dvi")))) - (file-error nil)) - (when preview-ps-file - (condition-case nil - (preview-delete-file preview-ps-file) - (file-error nil))) - (setq TeX-sentinel-function nil)) - -(defalias 'preview-dvipng-abort 'preview-dvips-abort) -; "Abort a DviPNG run.") - -(defun preview-gs-dvips-sentinel (process command &optional gsstart) - "Sentinel function for indirect rendering DviPS process. -The usual PROCESS and COMMAND arguments for -`TeX-sentinel-function' apply. Starts gs if GSSTART is set." - (condition-case err - (let ((status (process-status process)) - (gsfile preview-gs-file)) - (cond ((eq status 'exit) - (delete-process process) - (setq TeX-sentinel-function nil) - (condition-case nil - (delete-file - (with-current-buffer TeX-command-buffer - (funcall (car gsfile) "dvi"))) - (file-error nil)) - (if preview-ps-file - (preview-prepare-fast-conversion)) - (when gsstart - (if preview-gs-queue - (preview-gs-restart) - (when preview-ps-file - (condition-case nil - (preview-delete-file preview-ps-file) - (file-error nil)))))) - ((eq status 'signal) - (delete-process process) - (preview-dvips-abort)))) - (error (preview-log-error err "DviPS sentinel" process))) - (preview-reraise-error process)) - -(defun preview-pdf2dsc-sentinel (process command &optional gsstart) - "Sentinel function for indirect rendering PDF process. -The usual PROCESS and COMMAND arguments for -`TeX-sentinel-function' apply. Starts gs if GSSTART is set." - (condition-case err - (let ((status (process-status process))) - (cond ((eq status 'exit) - (delete-process process) - (setq TeX-sentinel-function nil) - (setq preview-gs-init-string - (concat preview-gs-init-string - (preview-pdf-color-string preview-colors))) - (preview-prepare-fast-conversion) - (when gsstart - (if preview-gs-queue - (preview-gs-restart) - (when preview-ps-file - (condition-case nil - (preview-delete-file preview-ps-file) - (file-error nil)))))) - ((eq status 'signal) - (delete-process process) - (preview-dvips-abort)))) - (error (preview-log-error err "PDF2DSC sentinel" process))) - (preview-reraise-error process)) - -(defun preview-gs-close (process closedata) - "Clean up after PROCESS and set up queue accumulated in CLOSEDATA." - (setq preview-gs-queue (nconc preview-gs-queue closedata)) - (if process - (if preview-gs-queue - (if TeX-process-asynchronous - (if (and (eq (process-status process) 'exit) - (null TeX-sentinel-function)) - ;; Process has already finished and run sentinel - (progn - (when preview-ps-file - (condition-case nil - (preview-delete-file preview-ps-file) - (file-error nil))) - (preview-gs-restart)) - (setq TeX-sentinel-function - `(lambda (process command) - (,(if preview-parsed-pdfoutput - 'preview-pdf2dsc-sentinel - 'preview-gs-dvips-sentinel) - process - command - t)))) - (TeX-synchronous-sentinel "Preview-DviPS" (cdr preview-gs-file) - process)) - ;; pathological case: no previews although we sure thought so. - (delete-process process) - (unless (eq (process-status process) 'signal) - (preview-dvips-abort))))) - -(defun preview-dvipng-sentinel (process command &optional placeall) - "Sentinel function for indirect rendering DviPNG process. -The usual PROCESS and COMMAND arguments for -`TeX-sentinel-function' apply. Places all snippets if PLACEALL is set." - (condition-case err - (let ((status (process-status process))) - (cond ((eq status 'exit) - (delete-process process) - (setq TeX-sentinel-function nil) - (when placeall - (preview-dvipng-place-all))) - ((eq status 'signal) - (delete-process process) - (preview-dvipng-abort)))) - (error (preview-log-error err "DviPNG sentinel" process))) - (preview-reraise-error process)) - -(defun preview-dvipng-close (process closedata) - "Clean up after PROCESS and set up queue accumulated in CLOSEDATA." - (if preview-parsed-pdfoutput - (preview-gs-close process closedata) - (setq preview-gs-queue (nconc preview-gs-queue closedata)) - (if process - (if preview-gs-queue - (if TeX-process-asynchronous - (if (and (eq (process-status process) 'exit) - (null TeX-sentinel-function)) - ;; Process has already finished and run sentinel - (preview-dvipng-place-all) - (setq TeX-sentinel-function (lambda (process command) - (preview-dvipng-sentinel - process - command - t)))) - (TeX-synchronous-sentinel "Preview-DviPNG" (cdr preview-gs-file) - process)) - ;; pathological case: no previews although we sure thought so. - (delete-process process) - (unless (eq (process-status process) 'signal) - (preview-dvipng-abort)))))) - -(defun preview-dsc-parse (file) - "Parse DSC comments of FILE. -Returns a vector with offset/length pairs corresponding to -the pages. Page 0 corresponds to the initialization section." - (with-temp-buffer - (set-buffer-multibyte nil) - (insert-file-contents-literally file) - (let ((last-pt (point-min)) - trailer - pagelist - lastbegin - pt - case-fold-search - (level 0)) - (while (search-forward-regexp "\ -%%\\(?:\\(BeginDocument:\\)\\|\ -\\(EndDocument[\n\r]\\)\\|\ -\\(Page:\\)\\|\ -\\(Trailer[\n\r]\\)\\)" nil t) - (setq pt (match-beginning 0)) - (cond ((null (memq (char-before pt) '(?\C-j ?\C-m nil)))) - (trailer (error "Premature %%%%Trailer in `%s' at offsets %d/%d" - file trailer pt)) - ((match-beginning 1) - (if (zerop level) - (setq lastbegin pt)) - (setq level (1+ level))) - ((match-beginning 2) - (if (zerop level) - (error "Unmatched %%%%EndDocument in `%s' at offset %d" - file pt) - (setq level (1- level)))) - ((> level 0)) - ((match-beginning 3) - (push (list last-pt (- pt last-pt)) pagelist) - (setq last-pt pt)) - ((match-beginning 4) - (setq trailer pt)))) - (unless (zerop level) - (error "Unmatched %%%%BeginDocument in `%s' at offset %d" - file lastbegin)) - (push (list last-pt - (- (or trailer (point-max)) last-pt)) pagelist) - (vconcat (nreverse pagelist))))) - -(defun preview-gs-dsc-cvx (page dsc) - "Generate PostScript code accessing PAGE in the DSC object. -The returned PostScript code will need the file on -top of the stack, and will replace it with an executable -object corresponding to the wanted page." - (let ((curpage (aref dsc page))) - (format "dup %d setfileposition %d()/SubFileDecode filter cvx" - (1- (car curpage)) (nth 1 curpage)))) - -(defun preview-ps-quote-filename (str &optional nonrel) - "Make a PostScript string from filename STR. -The file name is first made relative unless -NONREL is not NIL." - (unless nonrel (setq str (file-relative-name str))) - (let ((index 0)) - (while (setq index (string-match "[\\()]" str index)) - (setq str (replace-match "\\\\\\&" t nil str) - index (+ 2 index))) - (concat "(" str ")"))) - -(defun preview-prepare-fast-conversion () - "This fixes up all parameters for fast conversion." - (let ((file (if (consp (car preview-ps-file)) - (if (consp (caar preview-ps-file)) - (car (last (caar preview-ps-file))) - (caar preview-ps-file)) - (car preview-ps-file)))) - (setq preview-gs-dsc (preview-dsc-parse file)) - (setq preview-gs-init-string - (concat preview-gs-init-string - (format "[%s(r)file]aload exch %s .runandhide aload pop " - (preview-ps-quote-filename file) - (preview-gs-dsc-cvx 0 preview-gs-dsc)))))) - -(defun preview-gs-urgentize (ov buff) - "Make a displayed overlay render with higher priority. -This function is used in fake conditional display properties -for reordering the conversion order to prioritize on-screen -images. OV is the overlay in question, and BUFF is the -Ghostscript process buffer where the buffer-local queue -is located." - ;; It does not matter that ov gets queued twice in that process: the - ;; first version to get rendered will clear the 'queued property. - ;; It cannot get queued more than twice since we remove the - ;; conditional display property responsible for requeuing here. - ;; We don't requeue if the overlay has been killed (its buffer made - ;; nil). Not necessary, but while we are checking... - ;; We must return t. - (preview-remove-urgentization ov) - (when (and (overlay-get ov 'queued) - (overlay-buffer ov)) - (with-current-buffer buff - (push ov preview-gs-queue))) - t) - - -(defun preview-gs-place (ov snippet box run-buffer tempdir ps-file imagetype) - "Generate an image placeholder rendered over by Ghostscript. -This enters OV into all proper queues in order to make it render -this image for real later, and returns the overlay after setting -a placeholder image. SNIPPET gives the number of the -snippet in question for the file to be generated. -BOX is a bounding box if we already know one via TeX. -RUN-BUFFER is the buffer of the TeX process, -TEMPDIR is the correct copy of `TeX-active-tempdir', -PS-FILE is a copy of `preview-ps-file', IMAGETYPE is the image type -for the file extension." - (overlay-put ov 'filenames - (unless (eq ps-file t) - (list - (preview-make-filename - (or ps-file - (format "preview.%03d" snippet)) - tempdir)))) - (overlay-put ov 'queued - (vector box nil snippet)) - (overlay-put ov 'preview-image - (list (preview-icon-copy preview-nonready-icon))) - (preview-add-urgentization #'preview-gs-urgentize ov run-buffer) - (list ov)) - -(defun preview-mouse-open-error (string) - "Display STRING in a new view buffer on click." - (let ((buff (get-buffer-create - "*Preview-Ghostscript-Error*"))) - (with-current-buffer buff - (kill-all-local-variables) - (set (make-local-variable 'view-exit-action) #'kill-buffer) - (setq buffer-undo-list t) - (erase-buffer) - (insert string) - (goto-char (point-min))) - (view-buffer-other-window buff))) - -(defun preview-mouse-open-eps (file &optional position) - "Display eps FILE in a view buffer on click. -Place point at POSITION, else beginning of file." - (let ((default-major-mode - (or - (assoc-default "x.ps" auto-mode-alist #'string-match) - default-major-mode)) - (buff (get-file-buffer file))) - (save-excursion - (if buff - (pop-to-buffer buff) - (view-file-other-window file)) - (goto-char (or position (point-min))) - (if (eq major-mode 'ps-mode) ; Bundled with GNU Emacs - (message "%s" (substitute-command-keys "\ -Try \\[ps-run-start] \\[ps-run-buffer] and \ -\\\\[ps-run-mouse-goto-error] on error offset." ))) - (if (eq major-mode 'postscript-mode) ; Bundled with XEmacs, limited - (message "%s" (substitute-command-keys "\ -Try \\[ps-shell] and \\[ps-execute-buffer].")))))) - -(defun preview-gs-flag-error (ov err) - "Make an eps error flag in overlay OV for ERR string." - (let* ((filenames (overlay-get ov 'filenames)) - (file (car (nth 0 filenames))) - (outfile (format "-dOutputFile=%s" - (preview-ps-quote-filename - (car (nth 1 filenames))))) - (ps-open - `(lambda() (interactive "@") - (preview-mouse-open-error - ,(concat - (mapconcat #'shell-quote-argument - (append (list - preview-gs-command - outfile) - preview-gs-command-line) - " ") - "\nGS>" - preview-gs-init-string - (aref (overlay-get ov 'queued) 1) - err)))) - (str - (preview-make-clickable - nil - preview-error-icon - "%s views error message -%s more options" - ps-open - `(lambda() (interactive) - (popup-menu - '("PostScript error" - ["View error" ,ps-open] - ["View source" - (lambda () (interactive "@") - ,(if preview-ps-file - `(preview-mouse-open-eps - ,(if (consp (car file)) - (nth 1 (car file)) - (car file)) - ,(nth 0 (aref preview-gs-dsc - (aref (overlay-get ov 'queued) 2)))) - `(preview-mouse-open-eps ,file)))])))))) - (overlay-put ov 'strings (cons str str)) - (preview-toggle ov))) - -(defun preview-gs-transact (process answer) - "Work off Ghostscript transaction. -This routine is the action routine called via the process filter. -The Ghostscript process buffer of PROCESS will already be selected, and -and the standard output of Ghostscript up to the next prompt will be -given as ANSWER." - (let ((ov (pop preview-gs-outstanding)) - (have-error (not - (string-match "\\`GS\\(<[0-9]+\\)?>\\'" answer )))) - (when (and ov (overlay-buffer ov)) - (let ((queued (overlay-get ov 'queued))) - (when queued - (let* ((bbox (aref queued 0)) - (filenames (overlay-get ov 'filenames)) - (oldfile (nth 0 filenames)) - (newfile (nth 1 filenames))) - (if have-error - (preview-gs-flag-error ov answer) - (condition-case nil - (preview-delete-file oldfile) - (file-error nil)) - (overlay-put ov 'filenames (cdr filenames)) - (preview-replace-active-icon - ov - (preview-create-icon (car newfile) - preview-gs-image-type - (preview-ascent-from-bb - bbox) - (aref preview-colors 2)))) - (overlay-put ov 'queued nil))))) - (while (and (< (length preview-gs-outstanding) - preview-gs-outstanding-limit) - (setq ov (pop preview-gs-queue))) - (let ((queued (overlay-get ov 'queued))) - (when (and queued - (not (memq ov preview-gs-outstanding)) - (overlay-buffer ov)) - (let* ((filenames (overlay-get ov 'filenames)) - (oldfile (car (nth 0 - (nconc filenames - (list - (preview-make-filename - (format "pr%d-%d.%s" - (car preview-gs-sequence) - (cdr preview-gs-sequence) - preview-gs-image-type) - TeX-active-tempdir)))))) - (bbox (aset queued 0 - (or (and preview-prefer-TeX-bb - (aref queued 0)) - (and (stringp oldfile) - (preview-extract-bb - oldfile)) - (aref queued 0) - (error "No bounding box")))) - (snippet (aref queued 2)) - (gs-line - (format - "%s<<%s>>preview-do\n" - (if preview-ps-file - (concat "dup " - (preview-gs-dsc-cvx - snippet - preview-gs-dsc)) - (format "%s(r)file cvx" - (preview-ps-quote-filename - (if (listp oldfile) - (car (last oldfile)) - oldfile)))) - (if preview-parsed-tightpage - "" - (format "/PageSize[%g %g]/PageOffset[%g \ -%g[1 1 dtransform exch]{0 ge{neg}if exch}forall]" - (- (aref bbox 2) (aref bbox 0)) - (- (aref bbox 3) (aref bbox 1)) - (aref bbox 0) (aref bbox 1)))))) - (setcdr preview-gs-sequence (1+ (cdr preview-gs-sequence))) - (setq preview-gs-outstanding - (nconc preview-gs-outstanding - (list ov))) - (aset queued 1 gs-line) - ;; ignore errors because of dying processes: they will get - ;; caught by the sentinel, anyway. - (condition-case nil - (process-send-string - process - gs-line) - (error nil)))))) - (unless preview-gs-outstanding - (condition-case nil - (process-send-eof process) - (error nil))))) - -(defun preview-hook-enquiry (hook) - "Gets a value from a configured hook. -HOOK is a list or single item, for which the first resolving to -non-nil counts. Entries can be a callable function, or -a symbol that is consulted, or a value. Lists are evaluated -recursively." - (cond ((functionp hook) - (funcall hook)) - ((consp hook) - (let (res) - (while (and (not res) hook) - (setq res (preview-hook-enquiry (car hook)) - hook (cdr hook))) - res)) - ((and (symbolp hook) (boundp hook)) - (symbol-value hook)) - (t hook))) - -(defcustom preview-scale-function #'preview-scale-from-face - "*Scale factor for included previews. -This can be either a function to calculate the scale, or -a fixed number." - :group 'preview-appearance - :type '(choice (function-item preview-scale-from-face) - (const 1.0) - (number :value 1.0) - (function :value preview-scale-from-face))) - -(defcustom preview-default-document-pt 10 - "*Assumed document point size for `preview-scale-from-face'. -If the point size (such as 11pt) of the document cannot be -determined from the document options itself, assume this size. -This is for matching screen font size and previews." - :group 'preview-appearance - :type - '(choice (const :tag "10pt" 10) - (const :tag "11pt" 11) - (const :tag "12pt" 12) - (number :tag "Other" :value 11.0)) -) - -(defcustom preview-document-pt-list '(preview-parsed-font-size - preview-auctex-font-size - preview-default-document-pt) - "*How `preview-document-pt' figures out the document size." - :group 'preview-appearance - :type - '(repeat (choice - ;; This is a bug: type function seems to match variables, too. - (restricted-sexp :match-alternatives (functionp) - :tag "Function" :value preview-auctex-font-size) - (variable :value preview-parsed-font-size) - (number :value 11)))) - -(defun preview-auctex-font-size () - "Calculate the default font size of document. -If packages, classes or styles were called with an option -like 10pt, size is taken from the first such option if you -had let your document be parsed by AucTeX." - (catch 'return (dolist (option (TeX-style-list)) - (if (string-match "\\`\\([0-9]+\\)pt\\'" option) - (throw 'return - (string-to-number - (match-string 1 option))))))) - -(defsubst preview-document-pt () - "Calculate the default font size of document." - (preview-hook-enquiry preview-document-pt-list)) - -(defun preview-scale-from-face () - "Calculate preview scale from `preview-reference-face'. -This calculates the scale of EPS images from a document assumed -to have a default font size given by function `preview-document-pt' -so that they match the reference face in height." - `(lambda nil - (/ ,(/ (preview-inherited-face-attribute 'preview-reference-face :height - 'default) 10.0) - (preview-document-pt)))) - -(defvar preview-min-spec) - -(defun preview-make-image (symbol) - "Make an image from a preview spec list. -The first spec that is workable (given the current setting of -`preview-min-spec') from the given symbol is used here. The -icon is cached in the property list of the symbol." - (let ((alist (get 'preview-min-alist symbol))) - (cdr (or - (assq preview-min-spec alist) - (car (put symbol 'preview-min-alist - (cons - (cons preview-min-spec - (preview-filter-specs - (symbol-value symbol))) - alist))))))) - -(defun preview-filter-specs (spec-list) - "Find the first of the fitting specs and make an image." - (let (image) - (while (and spec-list - (not (setq image - (catch 'preview-filter-specs - (preview-filter-specs-1 (car spec-list)))))) - (setq spec-list (cdr spec-list))) - image)) - -(defun preview-filter-specs-1 (specs) - (and specs - (if (get 'preview-filter-specs (car specs)) - (apply (get 'preview-filter-specs (car specs)) specs) - `(,(nth 0 specs) ,(nth 1 specs) - ,@(preview-filter-specs-1 (nthcdr 2 specs)))))) - -(put 'preview-filter-specs :min - #'(lambda (keyword value &rest args) - (if (> value preview-min-spec) - (throw 'preview-filter-specs nil) - (preview-filter-specs-1 args)))) - -(defvar preview-datadir (file-name-directory load-file-name) - "The directory relative to which package data may be found. -This should be hardwired into the startup file containing the -autoloads for preview-latex.") - -(put 'preview-filter-specs :file - #'(lambda (keyword value &rest args) - `(:file ,(expand-file-name value (expand-file-name "images" - preview-datadir)) - ,@(preview-filter-specs-1 args)))) - -(defun preview-ascent-from-bb (bb) - "This calculates the image ascent from its bounding box. -The bounding box BB needs to be a 4-component vector of -numbers (can be float if available)." - ;; baseline is at 1in from the top of letter paper (11in), so it is - ;; at 10in from the bottom precisely, which is 720 in PostScript - ;; coordinates. If our bounding box has its bottom not above this - ;; line, and its top above, we can calculate a useful ascent value. - ;; If not, something is amiss. We just use 100 in that case. - - (let ((bottom (aref bb 1)) - (top (aref bb 3))) - (if (and (<= bottom 720) - (> top 720)) - (round (* 100.0 (/ (- top 720.0) (- top bottom)))) - 100))) - -(defface preview-face '((((background dark)) - (:background "dark slate gray")) - (t - (:background "beige"))) - "Face to use for the preview source." - :group 'preview-appearance) - -(defface preview-reference-face '((t nil)) - "Face consulted for colors and scale of active previews. -Fallback to :inherit and 'default implemented." - :group 'preview-appearance) - -(defcustom preview-auto-reveal '(eval (preview-arrived-via - (key-binding [left]) - (key-binding [right]))) - "*Cause previews to open automatically when entered. -Possibilities are: -T autoopens, -NIL doesn't, -a symbol will have its value consulted if it exists, -defaulting to NIL if it doesn't. -An integer will specify a maximum cursor movement distance. -Larger movements won't open the preview. -A CONS-cell means to call a function for determining the value. -The CAR of the cell is the function to call which receives -the CDR of the CONS-cell in the rest of the arguments, while -point and current buffer point to the position in question. -All of the options show reasonable defaults." - :group 'preview-appearance - :type '(choice (const :tag "Off" nil) - (const :tag "On" t) - (symbol :tag "Indirect variable" :value reveal-mode) - (integer :tag "Maximum distance" :value 1) - (cons :tag "Function call" - :value (eval (preview-arrived-via - (key-binding [left]) - (key-binding [right]))) - function (list :tag "Argument list" - (repeat :inline t sexp))))) - -(defun preview-auto-reveal-p (mode distance) - "Decide whether to auto-reveal. -Returns non-NIL if region should be auto-opened. -See `preview-auto-reveal' for definitions of MODE, which gets -set to `preview-auto-reveal'. DISTANCE specifies the movement -distance with which point has been reached in case it has been -a movement starting in the current buffer." - (cond ((symbolp mode) - (and (boundp mode) - (symbol-value mode))) - ((integerp mode) - (and distance (/= 0 distance) (<= (abs distance) mode))) - ((consp mode) - (apply (car mode) (cdr mode))) - (t mode))) - -(defun preview-arrived-via (&rest list) - "Indicate auto-opening. -Returns non-NIL if called by one of the commands in LIST." - (memq this-command list)) - -(defcustom preview-equality-transforms '(identity - preview-canonical-spaces) -"Transformation functions for region changes. -These functions are tried in turn on the strings from the -regions of a preview to decide whether a preview is to be considered -changed. If any transform leads to equal results, the preview is -considered unchanged." - :group 'preview-appearance - :type '(repeat function)) - -(defun preview-relaxed-string= (&rest args) -"Check for functional equality of arguments. -The arguments ARGS are checked for equality by using -`preview-equality-transforms' on them until it is exhausted -or one transform returns equality." - (let ((lst preview-equality-transforms)) - (while (and lst (not (apply #'string= (mapcar (car lst) args)))) - (setq lst (cdr lst))) - lst)) - -(defun preview-canonical-spaces (arg) - "Convert ARG into canonical form. -Removes comments and collapses white space, except for multiple newlines." - (let (pos) - (while (setq pos (string-match "\\s<.*[\n\r][ \t]*" arg pos)) - (setq arg (replace-match "" t t arg 0))) - (while (setq pos (string-match "[ \t]*\\(\\([ \t]\\)\\|[\n\r][ \t]*\\)" - arg pos)) - (setq arg (replace-match (if (match-beginning 2) " " "\n") t t arg 0) - pos (1+ pos))) - (while (setq pos (string-match "\n+" arg pos)) - (if (string= "\n" (match-string 0 arg)) - (setq arg (replace-match " " t t arg 0) - pos (1+ pos)) - (setq pos (match-end 0))))) - arg) - -(defun preview-regenerate (ovr) - "Pass the modified region in OVR again through LaTeX." - (let ((begin (overlay-start ovr)) - (end (overlay-end ovr))) - (with-current-buffer (overlay-buffer ovr) - (preview-delete ovr) - (preview-region begin end)))) - -(defcustom preview-inner-environments '("Bmatrix" "Vmatrix" "aligned" - "array" "bmatrix" "cases" - "gathered" "matrix" "pmatrix" - "smallmatrix" "split" - "subarray" "vmatrix") - "Environments not to be previewed on their own." - :group 'preview-latex - :type '(repeat string)) - - -(defun preview-next-border (backwards) - "Search for the next interesting border for `preview-at-point'. -Searches backwards if BACKWARDS is non-nil." - (let (history preview-state (pt (point))) - (catch 'exit - (while - (null - (memq - (setq preview-state - (if backwards - (if (> (setq pt - (previous-single-char-property-change - pt 'preview-state)) (point-min)) - (get-char-property (1- pt) 'preview-state) - (throw 'exit (or history (point-min)))) - (if (< (setq pt - (next-single-char-property-change - pt 'preview-state)) (point-max)) - (get-char-property pt 'preview-state) - (throw 'exit (or history (point-max)))))) - '(active inactive))) - (setq history (and (not preview-state) pt))) - (or history pt)))) - -(defun preview-at-point () - "Do the appropriate preview thing at point. -If point is positioned on or inside of an unmodified preview area, -its visibility is toggled. - -If not, the surroundings are run through preview. The -surroundings don't extend into unmodified previews or past -contiguous previews invalidated by modifications. - -Overriding any other action, if a region is -active (`transient-mark-mode' or `zmacs-regions'), it is run -through `preview-region'." - (interactive) - (if (TeX-active-mark) - (preview-region (region-beginning) (region-end)) - (catch 'exit - (dolist (ovr (overlays-in (max (point-min) (1- (point))) - (min (point-max) (1+ (point))))) - (let ((preview-state (overlay-get ovr 'preview-state))) - (when preview-state - (unless (eq preview-state 'disabled) - (preview-toggle ovr 'toggle (selected-window)) - (throw 'exit t))))) - (preview-region (preview-next-border t) - (preview-next-border nil))))) - -(defun preview-disabled-string (ov) - "Generate a before-string for disabled preview overlay OV." - (concat (preview-make-clickable - (overlay-get ov 'preview-map) - preview-icon - "\ -%s regenerates preview -%s more options" - `(lambda() (interactive) (preview-regenerate ,ov))) -;; icon on separate line only for stuff starting on its own line - (with-current-buffer (overlay-buffer ov) - (save-excursion - (save-restriction - (widen) - (goto-char (overlay-start ov)) - (if (bolp) "\n" "")))))) - -(defun preview-disable (ovr) - "Change overlay behaviour of OVR after source edits." - (overlay-put ovr 'queued nil) - (preview-remove-urgentization ovr) - (overlay-put ovr 'preview-image nil) - (overlay-put ovr 'timestamp nil) - (setcdr (overlay-get ovr 'strings) (preview-disabled-string ovr)) - (preview-toggle ovr) - (overlay-put ovr 'preview-state 'disabled) - (dolist (filename (overlay-get ovr 'filenames)) - (condition-case nil - (preview-delete-file filename) - (file-error nil)) - (overlay-put ovr 'filenames nil))) - -(defun preview-delete (ovr &rest ignored) - "Delete preview overlay OVR, taking any associated file along. -IGNORED arguments are ignored, making this function usable as -a hook in some cases" - (let ((filenames (overlay-get ovr 'filenames))) - (overlay-put ovr 'filenames nil) - (delete-overlay ovr) - (dolist (filename filenames) - (condition-case nil - (preview-delete-file filename) - (file-error nil))))) - -(defun preview-clearout (&optional start end timestamp) - "Clear out all previews in the current region. -When called interactively, the current region is used. -Non-interactively, the region between START and END is -affected. Those two values default to the borders of -the entire buffer. If TIMESTAMP is non-nil, previews -with a `timestamp' property of it are kept." - (interactive "r") - (dolist (ov (overlays-in (or start (point-min)) - (or end (point-max)))) - (and (overlay-get ov 'preview-state) - (not (and timestamp - (equal timestamp (overlay-get ov 'timestamp)))) - (preview-delete ov)))) - -(defun preview-clearout-buffer (&optional buffer) - "Clearout BUFFER from previews, current buffer if nil." - (interactive) - (if buffer - (with-current-buffer buffer (preview-clearout)) - (preview-clearout))) - -(defun preview-clearout-section () - "Clearout previews from LaTeX section." - (interactive) - (save-excursion - (LaTeX-mark-section) - (preview-clearout (region-beginning) (region-end)))) - -(defun preview-clearout-at-point () - "Clearout any preview at point." - (interactive) - (preview-clearout (max (point-min) (1- (point))) - (min (point-max) (1+ (point))))) - -(defun preview-walk-document (func) - "Cycle through all buffers belonging to current document. -Each buffer having the same master file as the current file -has FUNC called with its current buffer being set to it." - (let* ((buffers (buffer-list)) - (master (expand-file-name (TeX-master-file t))) - (default-buffers (list (current-buffer) - (find-buffer-visiting master)))) - (while buffers - (with-current-buffer (pop buffers) - (when - (or (memq (current-buffer) default-buffers) - (and (memq major-mode '(plain-tex-mode latex-mode)) - (or (stringp TeX-master) - (eq TeX-master t)) - (string= (expand-file-name (TeX-master-file t)) - master))) - (funcall func)))))) - -(defun preview-clearout-document () - "Clear out all previews in current document. -The document consists of all buffers that have the same master file -as the current buffer. This makes the current document lose -all previews." - (interactive) - (preview-walk-document #'preview-clearout-buffer)) - -(defun preview-kill-buffer-cleanup (&optional buf) - "This is a cleanup function just for use in hooks. -Cleans BUF or current buffer. The difference to -`preview-clearout-buffer' is that previews -associated with the last buffer modification time are -kept." - (with-current-buffer (or buf (current-buffer)) - (save-restriction - (widen) - (preview-clearout (point-min) (point-max) (visited-file-modtime))))) - -(add-hook 'kill-buffer-hook #'preview-kill-buffer-cleanup) -(add-hook 'before-revert-hook #'preview-kill-buffer-cleanup) - -(defvar preview-last-counter) - -(defun preview-extract-counters (ctr) - (setq preview-last-counter - (prog1 (copy-sequence ctr) - (dolist (elt preview-last-counter) - (setq ctr (delete elt ctr))))) - (apply #'concat ctr)) - -(defun desktop-buffer-preview-misc-data (&rest ignored) - "Hook function that extracts previews for persistent sessions." - (unless (buffer-modified-p) - (setq preview-last-counter nil) - (save-restriction - (widen) - (let (save-info (timestamp (visited-file-modtime))) - (dolist (ov (sort (overlays-in (point-min) (point-max)) - (lambda (x y) (< (overlay-start x) - (overlay-start y))))) - (when (and (memq (overlay-get ov 'preview-state) '(active inactive)) - (null (overlay-get ov 'queued)) - (cdr (overlay-get ov 'preview-image))) - (push (preview-dissect ov timestamp) save-info))) - (and save-info - (cons 'preview (cons timestamp (nreverse save-info)))))))) - -(eval-after-load "desktop" - '(add-hook - 'desktop-buffer-misc-functions - #'desktop-buffer-preview-misc-data)) - -(defvar preview-temp-dirs nil -"List of top level temporary directories in use from preview. -Any directory not in this list will be cleared out by preview -on first use.") - -(defun preview-dissect (ov timestamp) - "Extract all persistent data from OV and TIMESTAMP it." - (let ((filenames (butlast (nth 0 (overlay-get ov 'filenames))))) - (overlay-put ov 'timestamp timestamp) - (list (overlay-start ov) - (overlay-end ov) - (cdr (overlay-get ov 'preview-image)) - filenames - (let ((ctr (overlay-get ov 'preview-counters))) - (and ctr - (cons (preview-extract-counters (car ctr)) - (preview-extract-counters (cdr ctr)))))))) - -(defun preview-buffer-restore-internal (buffer-misc) - "Restore previews from BUFFER-MISC if proper. -Remove them if they have expired." - (let ((timestamp (visited-file-modtime)) tempdirlist files) - (setq preview-parsed-counters nil) - (when (eq 'preview (pop buffer-misc)) - (preview-get-geometry) - (if (equal (pop buffer-misc) timestamp) - (dolist (ovdata buffer-misc) - (setq tempdirlist - (apply #'preview-reinstate-preview tempdirlist - timestamp ovdata))) - (dolist (ovdata buffer-misc) - (setq files (nth 3 ovdata)) - (condition-case nil - (delete-file (nth 0 files)) - (file-error nil)) - (unless (member (nth 1 files) tempdirlist) - (push (nth 1 files) tempdirlist))) - (dolist (dir tempdirlist) - (condition-case nil - (delete-directory dir) - (file-error nil))))))) - - -(defun preview-buffer-restore (buffer-misc) - "At end of desktop load, reinstate previews. -This delay is so that minor modes changing buffer positions -\(like `x-symbol-mode' does) will not wreak havoc. -BUFFER-MISC is the appropriate data to be used." - (add-hook 'desktop-delay-hook `(lambda () - (with-current-buffer ,(current-buffer) - (preview-buffer-restore-internal - ',buffer-misc))))) - -(defun desktop-buffer-preview (desktop-buffer-file-name - desktop-buffer-name - desktop-buffer-misc) - "Hook function for restoring persistent previews into a buffer." - (when (and desktop-buffer-file-name - (file-readable-p desktop-buffer-file-name)) - (let ((buf (find-file-noselect desktop-buffer-file-name))) - (if (eq (car desktop-buffer-misc) 'preview) - (with-current-buffer buf - (preview-buffer-restore desktop-buffer-misc) - buf) - buf)))) - -(eval-after-load "desktop" - '(if (boundp 'desktop-buffer-mode-handlers) - (add-to-list 'desktop-buffer-mode-handlers - '(latex-mode . desktop-buffer-preview)) - (add-hook 'desktop-buffer-handlers '(lambda () - (desktop-buffer-preview - desktop-buffer-file-name - desktop-buffer-name - desktop-buffer-misc))))) - -(defcustom preview-auto-cache-preamble 'ask - "*Whether to generate a preamble cache format automatically. -Possible values are nil, t, and `ask'." - :group 'preview-latex - :type '(choice (const :tag "Cache" t) - (const :tag "Don't cache" nil) - (const :tag "Ask" ask))) - -(defvar preview-dumped-alist nil - "Alist of dumped masters. -The elements are (NAME . ASSOC). NAME is the master file name -\(without extension), ASSOC is what to do with regard to this -format. Possible values: NIL means no format is available -and none should be generated. T means no format is available, -it should be generated on demand. If the value is a cons cell, -the CAR of the cons cell is the command with which the format -has been generated, and the CDR is some Emacs-flavor specific -value used for maintaining a watch on possible changes of the -preamble.") - -(defun preview-cleanout-tempfiles () - "Clean out all directories and files with non-persistent data. -This is called as a hook when exiting Emacs." - (mapc #'preview-kill-buffer-cleanup (buffer-list)) - (mapc #'preview-format-kill preview-dumped-alist)) - -(defun preview-inactive-string (ov) - "Generate before-string for an inactive preview overlay OV. -This is for overlays where the source text has been clicked -visible. For efficiency reasons it is expected that the buffer -is already selected and unnarrowed." - (concat - (preview-make-clickable (overlay-get ov 'preview-map) - preview-icon - "\ -%s redisplays preview -%s more options") -;; icon on separate line only for stuff starting on its own line - (with-current-buffer (overlay-buffer ov) - (save-excursion - (save-restriction - (widen) - (goto-char (overlay-start ov)) - (if (bolp) "\n" "")))))) - -(defun preview-dvipng-place-all () - "Place all images dvipng has created, if any. -Deletes the dvi file when finished." - (let (filename queued oldfiles snippet) - (dolist (ov (prog1 preview-gs-queue (setq preview-gs-queue nil))) - (when (and (setq queued (overlay-get ov 'queued)) - (setq snippet (aref (overlay-get ov 'queued) 2)) - (setq filename (preview-make-filename - (format "prev%03d.%s" - snippet preview-dvipng-image-type) - TeX-active-tempdir))) - (if (file-exists-p (car filename)) - (progn - (overlay-put ov 'filenames (list filename)) - (preview-replace-active-icon - ov - (preview-create-icon (car filename) - preview-dvipng-image-type - (preview-ascent-from-bb - (aref queued 0)) - (aref preview-colors 2))) - (overlay-put ov 'queued nil)) - (push filename oldfiles) - (overlay-put ov 'filenames nil) - (push ov preview-gs-queue)))) - (if (setq preview-gs-queue (nreverse preview-gs-queue)) - (progn - (preview-start-dvips preview-fast-conversion) - (setq TeX-sentinel-function (lambda (process command) - (preview-gs-dvips-sentinel - process - command - t))) - (dolist (ov preview-gs-queue) - (setq snippet (aref (overlay-get ov 'queued) 2)) - (overlay-put ov 'filenames - (list - (preview-make-filename - (or preview-ps-file - (format "preview.%03d" snippet)) - TeX-active-tempdir)))) - (while (setq filename (pop oldfiles)) - (condition-case nil - (preview-delete-file filename) - (file-error nil)))) - (condition-case nil - (let ((gsfile preview-gs-file)) - (delete-file - (with-current-buffer TeX-command-buffer - (funcall (car gsfile) "dvi")))) - (file-error nil))))) - -(defun preview-active-string (ov) - "Generate before-string for active image overlay OV." - (preview-make-clickable - (overlay-get ov 'preview-map) - (car (overlay-get ov 'preview-image)) - "%s opens text -%s more options")) - -(defun preview-make-filename (file tempdir) - "Generate a preview filename from FILE and TEMPDIR. -Filenames consist of a CONS-cell with absolute file name as CAR -and TEMPDIR as CDR. TEMPDIR is a copy of `TeX-active-tempdir' -with the directory name, the reference count and its top directory -name elements. If FILE is already in that form, the file name itself -gets converted into a CONS-cell with a name and a reference count." - (if (consp file) - (progn - (if (consp (car file)) - (setcdr (car file) (1+ (cdr (car file)))) - (setcar file (cons (car file) 1))) - file) - (setcar (nthcdr 2 tempdir) (1+ (nth 2 tempdir))) - (cons (expand-file-name file (nth 0 tempdir)) - tempdir))) - -(defun preview-attach-filename (attached file) - "Attaches the absolute file name ATTACHED to FILE." - (if (listp (caar file)) - (setcar (car file) (cons attached (caar file))) - (setcar (car file) (list attached (caar file)))) - file) - -(defun preview-delete-file (file) - "Delete a preview FILE. -See `preview-make-filename' for a description of the data -structure. If the containing directory becomes empty, -it gets deleted as well." - (let ((filename - (if (consp (car file)) - (and (zerop - (setcdr (car file) (1- (cdr (car file))))) - (car (car file))) - (car file)))) - (if filename - (unwind-protect - (if (listp filename) - (dolist (elt filename) (delete-file elt)) - (delete-file filename)) - (let ((tempdir (cdr file))) - (when tempdir - (if (> (nth 2 tempdir) 1) - (setcar (nthcdr 2 tempdir) (1- (nth 2 tempdir))) - (setcdr file nil) - (delete-directory (nth 0 tempdir))))))))) - -(defvar preview-buffer-has-counters nil) -(make-variable-buffer-local 'preview-buffer-has-counters) - -(defun preview-place-preview (snippet start end - box counters tempdir place-opts) - "Generate and place an overlay preview image. -This generates the filename for the preview -snippet SNIPPET in the current buffer, and uses it for the -region between START and END. BOX is an optional preparsed -TeX bounding BOX passed on to the `place' hook. -COUNTERS is the info about saved counter structures. -TEMPDIR is a copy of `TeX-active-tempdir'. -PLACE-OPTS are additional arguments passed into -`preview-parse-messages'. Returns -a list with additional info from the placement hook. -Those lists get concatenated together and get passed -to the close hook." - (preview-clearout start end tempdir) - (let ((ov (make-overlay start end nil nil nil))) - (when (fboundp 'TeX-overlay-prioritize) - (overlay-put ov 'priority (TeX-overlay-prioritize start end))) - (overlay-put ov 'preview-map - (preview-make-clickable - nil nil nil - `(lambda(event) (interactive "e") - (preview-toggle ,ov 'toggle event)) - `(lambda(event) (interactive "e") - (preview-context-menu ,ov event)))) - (overlay-put ov 'timestamp tempdir) - (when (cdr counters) - (overlay-put ov 'preview-counters counters) - (setq preview-buffer-has-counters t)) - (prog1 (apply #'preview-call-hook 'place ov snippet box - place-opts) - (overlay-put ov 'strings - (list (preview-active-string ov))) - (preview-toggle ov t)))) - -;; The following is a brutal hack. It relies on `begin' being let to -;; the start of the interesting area when TeX-region-create is being -;; called. - -(defun preview-counter-find (begin) - "Fetch the next preceding or next preview-counters property. -Factored out because of compatibility macros XEmacs would -not use in advice." - ;; The following two lines are bug workaround for Emacs < 22.1. - (if (markerp begin) - (setq begin (marker-position begin))) - (or (car (get-char-property begin 'preview-counters)) - (cdr (get-char-property (max (point-min) - (1- begin)) - 'preview-counters)) - (cdr (get-char-property - (max (point-min) - (1- (previous-single-char-property-change - begin - 'preview-counters))) - 'preview-counters)) - (car (get-char-property - (next-single-char-property-change begin 'preview-counters) - 'preview-counters)))) - -(defadvice TeX-region-create (around preview-counters) - "Write out counter information to region." - (let ((TeX-region-extra - (concat - (and (boundp 'begin) - preview-buffer-has-counters - (mapconcat - #'identity - (cons - "" - (preview-counter-find (symbol-value 'begin))) - "\\setcounter")) - TeX-region-extra))) - ad-do-it)) - -(defun preview-reinstate-preview (tempdirlist timestamp start end - image filename &optional counters) - "Reinstate a single preview. -This gets passed TEMPDIRLIST, a list consisting of the kind -of entries used in `TeX-active-tempdir', and TIMESTAMP, the -time stamp under which the file got read in. It returns an augmented -list. START and END give the buffer location where the preview -is to be situated, IMAGE the image to place there, and FILENAME -the file to use: a triple consisting of filename, its temp directory -and the corresponding topdir. COUNTERS is saved counter information, -if any." - (when - (or (null filename) (file-readable-p (car filename))) - (when filename - (unless (equal (nth 1 filename) (car TeX-active-tempdir)) - (setq TeX-active-tempdir - (or (assoc (nth 1 filename) tempdirlist) - (car (push (append (cdr filename) (list 0)) - tempdirlist)))) - (setcar (cdr TeX-active-tempdir) - (car (or (member (nth 1 TeX-active-tempdir) - preview-temp-dirs) - (progn - (add-hook 'kill-emacs-hook - #'preview-cleanout-tempfiles t) - (push (nth 1 TeX-active-tempdir) - preview-temp-dirs)))))) - (setcar (nthcdr 2 TeX-active-tempdir) - (1+ (nth 2 TeX-active-tempdir))) - (setcdr filename TeX-active-tempdir) - (setq filename (list filename))) - (let ((ov (make-overlay start end nil nil nil))) - (when (fboundp 'TeX-overlay-prioritize) - (overlay-put ov 'priority (TeX-overlay-prioritize start end))) - (overlay-put ov 'preview-map - (preview-make-clickable - nil nil nil - `(lambda(event) (interactive "e") - (preview-toggle ,ov 'toggle event)) - `(lambda(event) (interactive "e") - (preview-context-menu ,ov event)))) - (when counters - (overlay-put - ov 'preview-counters - (cons - (mapcar #'cdr - (if (string= (car counters) "") - preview-parsed-counters - (setq preview-parsed-counters - (preview-parse-counters (car counters))))) - (mapcar #'cdr - (if (string= (cdr counters) "") - preview-parsed-counters - (setq preview-parsed-counters - (preview-parse-counters (cdr counters))))))) - (setq preview-buffer-has-counters t)) - (overlay-put ov 'filenames filename) - (overlay-put ov 'preview-image (cons (preview-import-image image) - image)) - (overlay-put ov 'strings - (list (preview-active-string ov))) - (overlay-put ov 'timestamp timestamp) - (preview-toggle ov t))) - tempdirlist) - -(defun preview-back-command (&optional nocomplex) - "Move backward a TeX token. -If NOCOMPLEX is set, only basic tokens and no argument sequences -will be skipped over backwards." - (let ((oldpos (point)) oldpoint) - (condition-case nil - (or (search-backward-regexp "\\(\\$\\$?\ -\\|\\\\[^a-zA-Z@]\ -\\|\\\\[a-zA-Z@]+\ -\\|\\\\begin[ \t]*{[^}]+}\ -\\)\\=" (line-beginning-position) t) - nocomplex - (if (eq ?\) (char-syntax (char-before))) - (while - (progn - (setq oldpoint (point)) - (backward-sexp) - (and (not (eq oldpoint (point))) - (eq ?\( (char-syntax (char-after)))))) - (backward-char))) - (error (goto-char oldpos))))) - -(defcustom preview-required-option-list '("active" "tightpage" "auctex" - (preview-preserve-counters - "counters")) - "Specifies required options passed to the preview package. -These are passed regardless of whether there is an explicit -\\usepackage of that package present." - :group 'preview-latex - :type preview-expandable-string) - -(defcustom preview-preserve-counters nil - "Try preserving counters for partial runs if set." - :group 'preview-latex - :type 'boolean) - -(defcustom preview-default-option-list '("displaymath" "floats" - "graphics" "textmath" "sections" - "footnotes") - "*Specifies default options to pass to preview package. -These options are only used when the LaTeX document in question does -not itself load the preview package, namely when you use preview -on a document not configured for preview. \"auctex\", \"active\", -\"dvips\" and \"delayed\" need not be specified here." - :group 'preview-latex - :type '(list (set :inline t :tag "Options known to work" - :format "%t:\n%v%h" :doc - "The above options are all the useful ones -at the time of the release of this package. -You should not need \"Other options\" unless you -upgraded to a fancier version of just the LaTeX style. -Please also note that `psfixbb' fails to have an effect if -`preview-fast-conversion' or `preview-prefer-TeX-bb' -are selected." - (const "displaymath") - (const "floats") - (const "graphics") - (const "textmath") - (const "sections") - (const "footnotes") - (const "showlabels") - (const "psfixbb")) - (set :tag "Expert options" :inline t - :format "%t:\n%v%h" :doc - "Expert options should not be enabled permanently." - (const "noconfig") - (const "showbox") - (const "tracingall")) - (repeat :inline t :tag "Other options" (string)))) - -(defcustom preview-default-preamble - '("\\RequirePackage[" ("," . preview-default-option-list) - "]{preview}[2004/11/05]") - "*Specifies default preamble code to add to a LaTeX document. -If the document does not itself load the preview package, that is, -when you use preview on a document not configured for preview, this -list of LaTeX commands is inserted just before \\begin{document}." - :group 'preview-latex - :type preview-expandable-string) - -(defcustom preview-LaTeX-command '("%`%l \"\\nonstopmode\\nofiles\ -\\PassOptionsToPackage{" ("," . preview-required-option-list) "}{preview}\ -\\AtBeginDocument{\\ifx\\ifPreview\\undefined" -preview-default-preamble "\\fi}\"%' %t") - "*Command used for starting a preview. -See description of `TeX-command-list' for details." - :group 'preview-latex - :type preview-expandable-string) - -(defun preview-goto-info-page () - "Read documentation for preview-latex in the info system." - (interactive) - (info "(preview-latex)")) - -(eval-after-load 'info '(add-to-list 'Info-file-list-for-emacs - '("preview" . "preview-latex"))) - -(defvar preview-map - (let ((map (make-sparse-keymap))) - (define-key map "\C-p" #'preview-at-point) - (define-key map "\C-r" #'preview-region) - (define-key map "\C-b" #'preview-buffer) - (define-key map "\C-d" #'preview-document) - (define-key map "\C-f" #'preview-cache-preamble) - (define-key map "\C-c\C-f" #'preview-cache-preamble-off) - (define-key map "\C-i" #'preview-goto-info-page) - ;; (define-key map "\C-q" #'preview-paragraph) - (define-key map "\C-e" #'preview-environment) - (define-key map "\C-s" #'preview-section) - (define-key map "\C-w" #'preview-copy-region-as-mml) - (define-key map "\C-c\C-p" #'preview-clearout-at-point) - (define-key map "\C-c\C-r" #'preview-clearout) - (define-key map "\C-c\C-s" #'preview-clearout-section) - (define-key map "\C-c\C-b" #'preview-clearout-buffer) - (define-key map "\C-c\C-d" #'preview-clearout-document) - map)) - -(defun preview-copy-text (ov) - "Copy the text of OV into the kill buffer." - (save-excursion - (set-buffer (overlay-buffer ov)) - (copy-region-as-kill (overlay-start ov) (overlay-end ov)))) - -(defun preview-copy-mml (ov) - "Copy an MML representation of OV into the kill buffer. -This can be used to send inline images in mail and news when -using MML mode." - (when (catch 'badcolor - (let ((str (car (preview-format-mml ov)))) - (if str - (if (eq last-command 'kill-region) - (kill-append str nil) - (kill-new str)) - (error "No image file available"))) - nil) - (let (preview-transparent-border) - (preview-regenerate ov)))) - -(defun preview-copy-region-as-mml (start end) - (interactive "r") - (when (catch 'badcolor - (let (str lst dont-ask) - (dolist (ov (overlays-in start end)) - (when (setq str (preview-format-mml ov dont-ask)) - (setq dont-ask (cdr str)) - (and - (>= (overlay-start ov) start) - (<= (overlay-end ov) end) - (push (list (- (overlay-start ov) start) - (- (overlay-end ov) start) - (car str)) lst)))) - (setq str (buffer-substring start end)) - (dolist (elt (nreverse (sort lst #'car-less-than-car))) - (setq str (concat (substring str 0 (nth 0 elt)) - (nth 2 elt) - (substring str (nth 1 elt))))) - (if (eq last-command 'kill-region) - (kill-append str nil) - (kill-new str))) - nil) - (let (preview-transparent-border) - (preview-region start end)))) - -(autoload 'mailcap-extension-to-mime "mailcap") - -(defun preview-format-mml (ov &optional dont-ask) - "Return an MML representation of OV as string. -This can be used to send inline images in mail and news when -using MML mode. If there is nothing current available, -NIL is returned. If the image has a colored border and the -user wants it removed when asked (unless DONT-ASK is set), -'badcolor is thrown a t. The MML is returned in the car of the -result, DONT-ASK in the cdr." - (and (memq (overlay-get ov 'preview-state) '(active inactive)) - (not (overlay-get ov 'queued)) - (let* ((text (with-current-buffer (overlay-buffer ov) - (buffer-substring (overlay-start ov) - (overlay-end ov)))) - (image (cdr (overlay-get ov 'preview-image))) - file type) - (cond ((consp image) - (and (not dont-ask) - (nth 3 image) - (if (y-or-n-p "Replace colored borders? ") - (throw 'badcolor t) - (setq dont-ask t))) - (setq file (car (car (last (overlay-get ov 'filenames)))) - type (mailcap-extension-to-mime - (file-name-extension file))) - (cons - (format "<#part %s -description=\"%s\" -filename=%s> -<#/part>" - (if type - (format "type=\"%s\" disposition=inline" type) - "disposition=attachment") - (if (string-match "[\n\"]" text) - "preview-latex image" - text) - (if (string-match "[ \n<>]" file) - (concat "\"" file "\"") - file)) - dont-ask)) - ((stringp image) - (cons image dont-ask)))))) - -(defun preview-active-contents (ov) - "Check whether we have a valid image associated with OV." - (and (memq (overlay-get ov 'preview-state) '(active inactive)) t)) - -(defun preview-context-menu (ov ev) - "Pop up a menu for OV at position EV." - (popup-menu - `("Preview" - ["Toggle" (preview-toggle ,ov 'toggle ',ev) - (preview-active-contents ,ov)] - ["Regenerate" (preview-regenerate ,ov)] - ["Remove" (preview-delete ,ov)] - ["Copy text" (preview-copy-text ,ov)] - ["Copy MIME" (preview-copy-mml ,ov) - (preview-active-contents ,ov)]) - ev)) - -(defvar preview-TeX-style-dir) - -(defun preview-TeX-style-cooked () - "Return `preview-TeX-style-dir' in cooked form. -This will be fine for prepending to a `TEXINPUT' style -environment variable, including an initial `.' at the front." - (if (or (zerop (length preview-TeX-style-dir)) - (member (substring preview-TeX-style-dir -1) '(";" ":"))) - preview-TeX-style-dir - (let ((sep - (cond - ((stringp TeX-kpathsea-path-delimiter) - TeX-kpathsea-path-delimiter) - ((string-match - "\\`.[:]" - (if (file-name-absolute-p preview-TeX-style-dir) - preview-TeX-style-dir - (expand-file-name preview-TeX-style-dir))) - ";") - (t ":")))) - (concat "." sep preview-TeX-style-dir sep)))) - -(defun preview-set-texinputs (&optional remove) - "Add `preview-TeX-style-dir' into `TEXINPUTS' variables. -With prefix argument REMOVE, remove it again." - (interactive "P") - (let ((case-fold-search nil) - (preview-TeX-style-dir (preview-TeX-style-cooked)) - pattern) - (if remove - (progn - (setq pattern (concat "\\`\\(TEXINPUTS[^=]*\\)=\\(.*\\)" - (regexp-quote preview-TeX-style-dir))) - (dolist (env (copy-sequence process-environment)) - (if (string-match pattern env) - (setenv (match-string 1 env) - (and (or (< (match-beginning 2) (match-end 2)) - (< (match-end 0) (length env))) - (concat (match-string 2 env) - (substring env (match-end 0)))))))) - (setq pattern (regexp-quote preview-TeX-style-dir)) - (dolist (env (cons "TEXINPUTS=" (copy-sequence process-environment))) - (if (string-match "\\`\\(TEXINPUTS[^=]*\\)=" env) - (unless (string-match pattern env) - (setenv (match-string 1 env) - (concat preview-TeX-style-dir - (substring env (match-end 0)))))))))) - -(defcustom preview-TeX-style-dir nil - "This variable contains the location of uninstalled TeX styles. -If this is nil, the preview styles are considered to be part of -the installed TeX system. - -Otherwise, it can either just specify an absolute directory, or -it can be a complete TEXINPUTS specification. If it is the -latter, it has to be followed by the character with which -kpathsea separates path components, either `:' on Unix-like -systems, or `;' on Windows-like systems. And it should be -preceded with .: or .; accordingly in order to have . first in -the search path. - -The `TEXINPUT' environment type variables will get this prepended -at load time calling \\[preview-set-texinputs] to reflect this. -You can permanently install the style files using -\\[preview-install-styles]. - -Don't set this variable other than with customize so that its -changes get properly reflected in the environment." - :group 'preview-latex - :set (lambda (var value) - (and (boundp var) - (symbol-value var) - (preview-set-texinputs t)) - (set var value) - (and (symbol-value var) - (preview-set-texinputs))) - :type '(choice (const :tag "Installed" nil) - (string :tag "Style directory or TEXINPUTS path"))) - -;;;###autoload -(defun preview-install-styles (dir &optional force-overwrite - force-save) - "Installs the TeX style files into a permanent location. -This must be in the TeX search path. If FORCE-OVERWRITE is greater -than 1, files will get overwritten without query, if it is less -than 1 or nil, the operation will fail. The default of 1 for interactive -use will query. - -Similarly FORCE-SAVE can be used for saving -`preview-TeX-style-dir' to record the fact that the uninstalled -files are no longer needed in the search path." - (interactive "DPermanent location for preview TeX styles -pp") - (unless preview-TeX-style-dir - (error "Styles are already installed")) - (dolist (file (or - (condition-case nil - (directory-files - (progn - (string-match - "\\`\\(\\.[:;]\\)?\\(.*?\\)\\([:;]\\)?\\'" - preview-TeX-style-dir) - (match-string 2 preview-TeX-style-dir)) - t "\\.\\(sty\\|def\\|cfg\\)\\'") - (error nil)) - (error "Can't find files to install"))) - (copy-file file dir (cond ((eq force-overwrite 1) 1) - ((numberp force-overwrite) - (> force-overwrite 1)) - (t force-overwrite)))) - (if (cond ((eq force-save 1) - (y-or-n-p "Stop using non-installed styles permanently ")) - ((numberp force-save) - (> force-save 1)) - (t force-save)) - (customize-save-variable 'preview-TeX-style-dir nil) - (customize-set-variable 'preview-TeX-style-dir nil))) - -;;;###autoload -(defun LaTeX-preview-setup () - "Hook function for embedding the preview package into AUCTeX. -This is called by `LaTeX-mode-hook' and changes AUCTeX variables -to add the preview functionality." - (remove-hook 'LaTeX-mode-hook #'LaTeX-preview-setup) - (add-hook 'LaTeX-mode-hook #'preview-mode-setup) - (define-key LaTeX-mode-map "\C-c\C-p" preview-map) - (easy-menu-define preview-menu LaTeX-mode-map - "This is the menu for preview-latex." - '("Preview" - "Generate previews" - ["(or toggle) at point" preview-at-point] - ["for environment" preview-environment] - ["for section" preview-section] - ["for region" preview-region (preview-mark-active)] - ["for buffer" preview-buffer] - ["for document" preview-document] - "---" - "Remove previews" - ["at point" preview-clearout-at-point] - ["from section" preview-clearout-section] - ["from region" preview-clearout (preview-mark-active)] - ["from buffer" preview-clearout-buffer] - ["from document" preview-clearout-document] - "---" - "Turn preamble cache" - ["on" preview-cache-preamble] - ["off" preview-cache-preamble-off] - "---" - ("Customize" - ["Browse options" - (customize-group 'preview)] - ["Extend this menu" - (easy-menu-add-item - nil '("Preview") - (customize-menu-create 'preview))]) - ["Read documentation" preview-goto-info-page] - ["Report Bug" preview-report-bug])) - (if (eq major-mode 'latex-mode) - (preview-mode-setup)) - (if (boundp 'desktop-buffer-misc) - (preview-buffer-restore desktop-buffer-misc))) - -(defun preview-clean-subdir (dir) - "Cleans out a temporary DIR with preview image files." - (condition-case err - (progn - (mapc #'delete-file - (directory-files dir t "\\`pr" t)) - (delete-directory dir)) - (error (message "Deletion of `%s' failed: %s" dir - (error-message-string err))))) - -(defun preview-clean-topdir (topdir) - "Cleans out TOPDIR from temporary directories. -This does not erase the directory itself since its permissions -might be needed for colloborative work on common files." - (mapc #'preview-clean-subdir - (condition-case nil - (directory-files topdir t "\\`tmp" t) - (file-error nil)))) - -(defun preview-create-subdirectory () - "Create a temporary subdir for the current TeX process. -If necessary, generates a fitting top -directory or cleans out an existing one (if not yet -visited in this session), then returns the name of -the created subdirectory relative to the master directory, -in shell-quoted form. `TeX-active-tempdir' is -set to the corresponding TEMPDIR descriptor as described -in `preview-make-filename'. The directory is registered -in `preview-temp-dirs' in order not to be cleaned out -later while in use." - (let ((topdir (expand-file-name (TeX-active-master "prv")))) - (if (file-directory-p topdir) - (unless (member topdir preview-temp-dirs) - ;; Cleans out the top preview directory by - ;; removing subdirs possibly left from a previous session. - (preview-clean-topdir topdir) - (push topdir preview-temp-dirs)) - (make-directory topdir) - (add-to-list 'preview-temp-dirs topdir)) - (add-hook 'kill-emacs-hook #'preview-cleanout-tempfiles t) - (setq TeX-active-tempdir - (list (make-temp-file (expand-file-name - "tmp" (file-name-as-directory topdir)) t) - topdir - 0)) - (shell-quote-argument - (concat (file-name-as-directory (file-name-nondirectory topdir)) - (file-name-nondirectory (nth 0 TeX-active-tempdir)))))) - -;; Hook into TeX immediately if it's loaded, use LaTeX-mode-hook if not. -(if (featurep 'latex) - (LaTeX-preview-setup) - (add-hook 'LaTeX-mode-hook #'LaTeX-preview-setup)) - -;;;###autoload (add-hook 'LaTeX-mode-hook #'LaTeX-preview-setup) - -(defun preview-parse-counters (string) - "Extract counter information from STRING." - (let ((list preview-parsed-counters) (pos 0)) - (while (eq pos (string-match " *\\({\\([^{}]+\\)}{[-0-9]+}\\)" string pos)) - (setcdr (or (assoc (match-string 2 string) list) - (car (push (list (match-string 2 string)) list))) - (match-string 1 string)) - (setq pos (match-end 1))) - list)) - -(defun preview-parse-tightpage (string) - "Build tightpage vector from STRING," - (read (concat "[" string "]"))) - -(defvar preview-parse-variables - '(("Fontsize" preview-parsed-font-size - "\\` *\\([0-9.]+\\)pt\\'" 1 string-to-number) - ("Magnification" preview-parsed-magnification - "\\` *\\([0-9]+\\)\\'" 1 string-to-number) - ("PDFoutput" preview-parsed-pdfoutput - "" 0 stringp) - ("Counters" preview-parsed-counters - ".*" 0 preview-parse-counters) - ("Tightpage" preview-parsed-tightpage - "\\` *\\(-?[0-9]+ *\\)\\{4\\}\\'" 0 preview-parse-tightpage))) - -(defun preview-error-quote (string run-coding-system) - "Turn STRING with potential ^^ sequences into a regexp. -To preserve sanity, additional ^ prefixes are matched literally, -so the character represented by ^^^ preceding extended characters -will not get matched, usually." - (let (output case-fold-search) - (when (featurep 'mule) - (setq string (encode-coding-string string run-coding-system))) - (while (string-match "\\^\\{2,\\}\\(\\([@-_?]\\)\\|[8-9a-f][0-9a-f]\\)" - string) - (setq output - (concat output - (regexp-quote (substring string - 0 - (- (match-beginning 1) 2))) - (if (match-beginning 2) - (concat - "\\(?:" (regexp-quote - (substring string - (- (match-beginning 1) 2) - (match-end 0))) - "\\|" - (char-to-string - (logxor (aref string (match-beginning 2)) 64)) - "\\)") - (char-to-string - (string-to-number (match-string 1 string) 16)))) - string (substring string (match-end 0)))) - (setq output (concat output (regexp-quote string))) - (if (featurep 'mule) - (decode-coding-string output - (or (and (boundp 'TeX-japanese-process-output-coding-system) - TeX-japanese-process-output-coding-system) - buffer-file-coding-system)) - output))) - -(defun preview-parse-messages (open-closure) - "Turn all preview snippets into overlays. -This parses the pseudo error messages from the preview -document style for LaTeX. OPEN-CLOSURE is called once -it is certain that we have a valid output file, and it has -to return in its CAR the PROCESS parameter for the CLOSE -call, and in its CDR the final stuff for the placement hook." - (with-temp-message "locating previews..." - (let (TeX-error-file TeX-error-offset snippet box counters - file line - (lsnippet 0) lstart (lfile "") lline lbuffer lpoint - lcounters - string after-string error context-start - context offset - parsestate (case-fold-search nil) - (run-buffer (current-buffer)) - (run-coding-system preview-coding-system) - (run-directory default-directory) - tempdir - close-data - open-data - fast-hook - slow-hook) - ;; clear parsing variables - (dolist (var preview-parse-variables) - (set (nth 1 var) nil)) - (goto-char (point-min)) - (unwind-protect - (progn - (while - (re-search-forward "\ -^\\(!\\|\\(.*?\\):[0-9]+:\\) \\|\ -\(\\(/*\ -\\(?:\\.+[^()\r\n{} /]*\\|[^()\r\n{} ./]+\ -\\(?: [^()\r\n{} ./]+\\)*\\(?:\\.[-0-9a-zA-Z_.]*\\)?\\)\ -\\(?:/+\\(?:\\.+[^()\r\n{} /]*\\|[^()\r\n{} ./]+\ -\\(?: [^()\r\n{} ./]+\\)*\\(?:\\.[-0-9a-zA-Z_.]*\\)?\\)?\\)*\\)\ -)*\\(?: \\|\r?$\\)\\|\ -\\()+\\)\\|\ - !\\(?:offset(\\([---0-9]+\\))\\|\ -name(\\([^)]+\\))\\)\\|\ -^Preview: \\([a-zA-Z]+\\) \\([^\n\r]*\\)\r?$" nil t) -;;; Ok, here is a line by line breakdown: -;;; match-alternative 1: -;;; error indicator for TeX error, either style. -;;; match-alternative 2: -;;; The same, but file-line-error-style, matching on file name. -;;; match-alternative 3: -;;; Too ugly to describe in detail. In short, we try to catch file -;;; names built from path components that don't contain spaces or -;;; other special characters once the file extension has started. -;;; -;;; Position for searching immediately after the file name so as to -;;; not miss closing parens or something. -;;; (match-string 3) is the file name. -;;; match-alternative 4: -;;; )+\( \|$\) -;;; a closing paren followed by the end of line or a space: a just -;;; closed file. -;;; match-alternative 5 (wrapped into one shy group with -;;; match-alternative 6, so that the match on first char is slightly -;;; faster): -;;; !offset(\([---0-9]+\)) -;;; an AUCTeX offset message. (match-string 5) is the offset itself -;;; !name(\([^)]+\)) -;;; an AUCTeX file name message. (match-string 6) is the file name -;;; TODO: Actually, the latter two should probably again match only -;;; after a space or newline, since that it what \message produces. -;;;disabled in prauctex.def: -;;;\(?:Ov\|Und\)erfull \\.*[0-9]*--[0-9]* -;;;\(?:.\{79\} -;;;\)*.*$\)\| -;;; This would have caught overfull box messages that consist of -;;; several lines of context all with 79 characters in length except -;;; of the last one. prauctex.def kills all such messages. - (setq file (match-string-no-properties 2)) - (cond - ((match-beginning 1) - (if (looking-at "\ -\\(?:Preview\\|Package Preview Error\\): Snippet \\([---0-9]+\\) \\(started\\|ended\\(\ -\\.? *(\\([---0-9]+\\)\\+\\([---0-9]+\\)x\\([---0-9]+\\))\\)?\\)\\.") - (progn - (when file - (unless TeX-error-file - (push nil TeX-error-file) - (push nil TeX-error-offset)) - (unless (car TeX-error-offset) - (rplaca TeX-error-file file))) - (setq snippet (string-to-number (match-string 1)) - box (unless - (string= (match-string 2) "started") - (if (match-string 4) - (mapcar #'(lambda (x) - (* (preview-get-magnification) - (string-to-number x))) - (list - (match-string 4) - (match-string 5) - (match-string 6))) - t)) - counters (mapcar #'cdr preview-parsed-counters) - error (progn - (setq lpoint (point)) - (end-of-line) - (buffer-substring lpoint (point))) - - ;; And the context for the help window. - context-start (point) - - ;; And the line number to position the cursor. -;;; variant 1: profiling seems to indicate the regexp-heavy solution -;;; to be favorable. Removing incomplete characters from the error -;;; context is an absolute nuisance. - line (and (re-search-forward "\ -^l\\.\\([0-9]+\\) \\(\\.\\.\\.\\(?:\\^*\\(?:[89a-f][0-9a-f]\\|[]@-\\_?]\\)\\|\ -\[0-9a-f]?\\)\\)?\\([^\n\r]*?\\)\r? -\\([^\n\r]*?\\)\\(\\(?:\\^+[89a-f]?\\)?\\.\\.\\.\\)?\r?$" nil t) - (string-to-number (match-string 1))) - ;; And a string of the context to search for. - string (and line (match-string 3)) - after-string (and line (buffer-substring - (+ (match-beginning 4) - (- (match-end 3) - (match-beginning 0))) - (match-end 4))) - - ;; And we have now found to the end of the context. - context (buffer-substring context-start (point)) - ;; We may use these in another buffer. - offset (or (car TeX-error-offset) 0) - file (car TeX-error-file)) - (when (and (stringp file) - (or (string= file "") - (TeX-match-extension file))) - ;; if we are the first time round, check for fast hooks: - (when (null parsestate) - (setq open-data - (save-excursion (funcall open-closure)) - tempdir TeX-active-tempdir) - (dolist - (lst (if (listp TeX-translate-location-hook) - TeX-translate-location-hook - (list TeX-translate-location-hook))) - (let ((fast - (and (symbolp lst) - (get lst 'TeX-translate-via-list)))) - (if fast - (setq fast-hook - (nconc fast-hook (list fast))) - (setq slow-hook - (nconc slow-hook (list lst))))))) - (condition-case err - (save-excursion (run-hooks 'slow-hook)) - (error (preview-log-error err "Translation hook"))) - (push (vector file (+ line offset) - string after-string - snippet box counters) parsestate))) - ;; else normal error message - (forward-line) - (re-search-forward "^l\\.[0-9]" nil t) - (forward-line 2))) - ((match-beginning 3) - ;; New file -- Push on stack - (push (match-string-no-properties 3) TeX-error-file) - (push nil TeX-error-offset) - (goto-char (match-end 3))) - ((match-beginning 4) - ;; End of file -- Pop from stack - (when (> (length TeX-error-file) 1) - (pop TeX-error-file) - (pop TeX-error-offset)) - (goto-char (1+ (match-beginning 0)))) - ((match-beginning 5) - ;; Hook to change line numbers - (setq TeX-error-offset - (list (string-to-number (match-string 5))))) - ((match-beginning 6) - ;; Hook to change file name - (setq TeX-error-file (list (match-string-no-properties 6)))) - ((match-beginning 7) - (let ((var - (assoc (match-string-no-properties 7) - preview-parse-variables)) - (offset (- (match-beginning 0) (match-beginning 8))) - (str (match-string-no-properties 8))) - ;; paste together continuation lines: - (while (= (- (length str) offset) 79) - (search-forward-regexp "^\\([^\n\r]*\\)\r?$") - (setq offset (- (length str)) - str (concat str (match-string-no-properties 1)))) - (when (and var - (string-match (nth 2 var) str)) - (set (nth 1 var) - (funcall (nth 4 var) - (match-string-no-properties - (nth 3 var) - str)))))))) - (when (null parsestate) - (error "LaTeX found no preview images"))) - (unwind-protect - (save-excursion - (setq parsestate (nreverse parsestate)) - (condition-case err - (dolist (fun fast-hook) - (setq parsestate - (save-excursion (funcall fun parsestate)))) - (error (preview-log-error err "Fast translation hook"))) - (setq snippet 0) - (dolist (state parsestate) - (setq lsnippet snippet - file (aref state 0) - line (aref state 1) - string (aref state 2) - after-string (aref state 3) - snippet (aref state 4) - box (aref state 5) - counters (aref state 6)) - (unless (string= lfile file) - (set-buffer (if (string= file "") - (with-current-buffer run-buffer - TeX-command-buffer) - (find-file-noselect - (expand-file-name file run-directory)))) - (setq lfile file)) - (save-excursion - (save-restriction - (widen) - ;; a fast hook might have positioned us already: - (if (number-or-marker-p string) - (progn - (goto-char string) - (setq lpoint - (if (number-or-marker-p after-string) - after-string - (line-beginning-position)))) - (if (and (eq (current-buffer) lbuffer) - (<= lline line)) - ;; while Emacs does the perfectly correct - ;; thing even when when the line differences - ;; get zero or negative, I don't trust this - ;; to be universally the case across other - ;; implementations. Besides, if the line - ;; number gets smaller again, we are probably - ;; rereading the file, and restarting from - ;; the beginning will probably be faster. - (progn - (goto-char lpoint) - (if (/= lline line) - (if (eq selective-display t) - (re-search-forward "[\n\C-m]" nil - 'end - (- line lline)) - (forward-line (- line lline))))) - (goto-line line)) - (setq lpoint (point)) - (cond - ((search-forward (concat string after-string) - (line-end-position) t) - (backward-char (length after-string))) - ;;ok, transform ^^ sequences - ((search-forward-regexp - (concat "\\(" - (setq string - (preview-error-quote - string - run-coding-system)) - "\\)" - (setq after-string - (preview-error-quote - after-string - run-coding-system))) - (line-end-position) t) - (goto-char (match-end 1))) - ((search-forward-regexp - (concat "\\(" - (if (string-match - "^[^\0-\177]\\{1,6\\}" string) - (setq string - (substring string (match-end 0))) - string) - "\\)" - (if (string-match - "[^\0-\177]\\{1,6\\}$" after-string) - (setq after-string - (substring after-string - 0 (match-beginning 0))))) - (line-end-position) t) - (goto-char (match-end 1))) - (t (search-forward-regexp - string - (line-end-position) t)))) - (setq lline line - lbuffer (current-buffer)) - (if box - (progn - (if (and lstart (= snippet lsnippet)) - (setq close-data - (nconc - (preview-place-preview - snippet - (save-excursion - (preview-back-command - (= (prog1 (point) - (goto-char lstart)) - lstart)) - (point)) - (point) - (preview-TeX-bb box) - (cons lcounters counters) - tempdir - (cdr open-data)) - close-data)) - (with-current-buffer run-buffer - (preview-log-error - (list 'error - (format - "End of Preview snippet %d unexpected" - snippet)) "Parser"))) - (setq lstart nil)) - ;; else-part of if box - (setq lstart (point) lcounters counters) - ;; >= because snippets in between might have - ;; been ignored because of TeX-default-extension - (unless (>= snippet (1+ lsnippet)) - (with-current-buffer run-buffer - (preview-log-error - (list 'error - (format - "Preview snippet %d out of sequence" - snippet)) "Parser")))))))) - (preview-call-hook 'close (car open-data) close-data)))))) - -(defun preview-get-geometry () - "Transfer display geometry parameters from current display. -Returns list of scale, resolution and colors. Calculation -is done in current buffer." - (condition-case err - (let* ((geometry - (list (preview-hook-enquiry preview-scale-function) - (cons (/ (* 25.4 (display-pixel-width)) - (display-mm-width)) - (/ (* 25.4 (display-pixel-height)) - (display-mm-height))) - (preview-get-colors))) - (preview-min-spec - (* (cdr (nth 1 geometry)) - (/ - (preview-inherited-face-attribute - 'preview-reference-face :height 'default) - 720.0)))) - (setq preview-icon (preview-make-image 'preview-icon-specs) - preview-error-icon (preview-make-image - 'preview-error-icon-specs) - preview-nonready-icon (preview-make-image - 'preview-nonready-icon-specs)) - geometry) - (error (error "Display geometry unavailable: %s" - (error-message-string err))))) - -(defun preview-set-geometry (geometry) - "Set geometry variables from GEOMETRY. -Buffer-local `preview-scale', `preview-resolution', -and `preview-colors' are set as given." - (setq preview-scale (nth 0 geometry) - preview-resolution (nth 1 geometry) - preview-colors (nth 2 geometry))) - -(defun preview-start-dvipng () - "Start a DviPNG process.." - (let* ((file preview-gs-file) - tempdir - (res (/ (* (car preview-resolution) - (preview-hook-enquiry preview-scale)) - (preview-get-magnification))) - (resolution (format " -D%d " res)) - (colors (preview-dvipng-color-string preview-colors res)) - (command (with-current-buffer TeX-command-buffer - (prog1 - (concat (TeX-command-expand preview-dvipng-command - (car file)) - " " colors resolution) - (setq tempdir TeX-active-tempdir)))) - (name "Preview-DviPNG")) - (setq TeX-active-tempdir tempdir) - (goto-char (point-max)) - (insert-before-markers "Running `" name "' with ``" command "''\n") - (setq mode-name name) - (setq TeX-sentinel-function - (lambda (process name) (message "%s: done." name))) - (if TeX-process-asynchronous - (let ((process (start-process name (current-buffer) TeX-shell - TeX-shell-command-option - command))) - (if TeX-after-start-process-function - (funcall TeX-after-start-process-function process)) - (TeX-command-mode-line process) - (set-process-filter process 'TeX-command-filter) - (set-process-sentinel process 'TeX-command-sentinel) - (set-marker (process-mark process) (point-max)) - (push process compilation-in-progress) - (sit-for 0) - process) - (setq mode-line-process ": run") - (set-buffer-modified-p (buffer-modified-p)) - (sit-for 0) ; redisplay - (call-process TeX-shell nil (current-buffer) nil - TeX-shell-command-option - command)))) - -(defun preview-start-dvips (&optional fast) - "Start a DviPS process. -If FAST is set, do a fast conversion." - (let* ((file preview-gs-file) - tempdir - (command (with-current-buffer TeX-command-buffer - (prog1 - (TeX-command-expand (if fast - preview-fast-dvips-command - preview-dvips-command) - (car file)) - (setq tempdir TeX-active-tempdir)))) - (name "Preview-DviPS")) - (setq TeX-active-tempdir tempdir) - (setq preview-ps-file (and fast - (preview-make-filename - (preview-make-filename - "preview.ps" tempdir) tempdir))) - (goto-char (point-max)) - (insert-before-markers "Running `" name "' with ``" command "''\n") - (setq mode-name name) - (setq TeX-sentinel-function - (lambda (process name) (message "%s: done." name))) - (if TeX-process-asynchronous - (let ((process (start-process name (current-buffer) TeX-shell - TeX-shell-command-option - command))) - (if TeX-after-start-process-function - (funcall TeX-after-start-process-function process)) - (TeX-command-mode-line process) - (set-process-filter process 'TeX-command-filter) - (set-process-sentinel process 'TeX-command-sentinel) - (set-marker (process-mark process) (point-max)) - (push process compilation-in-progress) - (sit-for 0) - process) - (setq mode-line-process ": run") - (set-buffer-modified-p (buffer-modified-p)) - (sit-for 0) ; redisplay - (call-process TeX-shell nil (current-buffer) nil - TeX-shell-command-option - command)))) - -(defun preview-start-pdf2dsc () - "Start a PDF2DSC process." - (let* ((file preview-gs-file) - tempdir - pdfsource - (command (with-current-buffer TeX-command-buffer - (prog1 - (TeX-command-expand preview-pdf2dsc-command - (car file)) - (setq tempdir TeX-active-tempdir - pdfsource (funcall `,(car file) "pdf"))))) - (name "Preview-PDF2DSC")) - (setq TeX-active-tempdir tempdir) - (setq preview-ps-file (preview-attach-filename - pdfsource - (preview-make-filename - (preview-make-filename - "preview.dsc" tempdir) tempdir))) - (goto-char (point-max)) - (insert-before-markers "Running `" name "' with ``" command "''\n") - (setq mode-name name) - (setq TeX-sentinel-function - (lambda (process name) (message "%s: done." name))) - (if TeX-process-asynchronous - (let ((process (start-process name (current-buffer) TeX-shell - TeX-shell-command-option - command))) - (if TeX-after-start-process-function - (funcall TeX-after-start-process-function process)) - (TeX-command-mode-line process) - (set-process-filter process 'TeX-command-filter) - (set-process-sentinel process 'TeX-command-sentinel) - (set-marker (process-mark process) (point-max)) - (push process compilation-in-progress) - (sit-for 0) - process) - (setq mode-line-process ": run") - (set-buffer-modified-p (buffer-modified-p)) - (sit-for 0) ; redisplay - (call-process TeX-shell nil (current-buffer) nil - TeX-shell-command-option - command)))) - -(defun preview-TeX-inline-sentinel (process name) - "Sentinel function for preview. -See `TeX-sentinel-function' and `set-process-sentinel' -for definition of PROCESS and NAME." - (if process (TeX-format-mode-line process)) - (let ((status (process-status process))) - (if (memq status '(signal exit)) - (delete-process process)) - (when (eq status 'exit) - (save-excursion - (goto-char (point-max)) - (forward-line -1) - (if (search-forward "abnormally with code 1" nil t) - (replace-match "as expected with code 1" t t) - (if (search-forward "finished" nil t) - (insert " with nothing to show")))) - (condition-case err - (preview-call-hook 'open) - (error (preview-log-error err "LaTeX" process))) - (preview-reraise-error process)))) - -(defcustom preview-format-extensions '(".fmt" ".efmt") - "Possible extensions for format files. -Those are just needed for cleanup." - :group 'preview-latex - :type '(repeat string)) - -(defun preview-format-kill (format-cons) - "Kill a cached format. -FORMAT-CONS is intended to be an element of `preview-dumped-alist'. -Tries through `preview-format-extensions'." - (dolist (ext preview-format-extensions) - (condition-case nil - (delete-file (preview-dump-file-name (concat (car format-cons) ext))) - (file-error nil)))) - -(defun preview-dump-file-name (file) - "Make a file name suitable for dumping from FILE." - (if file - (concat (file-name-directory file) - "prv_" - (progn - (setq file (file-name-nondirectory file)) - (while (string-match " " file) - (setq file (replace-match "_" t t file))) - file)) - "prv_texput")) - -(defun preview-do-replacements (string replacements) - "Perform replacements in string. -STRING is the input string, REPLACEMENTS is a list of replacements. -A replacement is a cons-cell, where the car is the match string, -and the cdr is a list of strings or symbols. Symbols get dereferenced, -and strings get evaluated as replacement strings." - (let (rep case-fold-search) - (while replacements - (setq rep (pop replacements)) - (cond ((symbolp rep) - (setq string (preview-do-replacements - string (symbol-value rep)))) - ((string-match (car rep) string) - (setq string - (mapconcat (lambda(x) - (if (symbolp x) - (symbol-value x) - (replace-match x t nil string))) - (cdr rep) "")))))) - string) - -(defconst preview-LaTeX-disable-pdfoutput - '(("\\`\\(pdf[^ ]*\\)\ -\\(\\( [-&]\\([^ \"]\\|\"[^\"]*\"\\)*\\|\ - \"[-&][^\"]*\"\\)*\\)\\(.*\\)\\'" - . ("\\1\\2 \"\\\\pdfoutput=0 \" \\5"))) - "This replacement places `\"\\pdfoutput=0 \"' after the options -of any command starting with `pdf'.") - -(defcustom preview-LaTeX-command-replacements - nil - "Replacement for `preview-LaTeX-command'. -This is passed through `preview-do-replacements'." - :group 'preview-latex - :type '(repeat - (choice - (symbol :tag "Named replacement" :value preview-LaTeX-disable-pdfoutput) - (cons (string :tag "Matched string") - (repeat :tag "Concatenated elements for replacement" - (choice (symbol :tag "Variable with literal string") - (string :tag "non-literal regexp replacement"))))))) - -(defvar preview-format-name) - -(defcustom preview-dump-replacements - '(preview-LaTeX-command-replacements - ("\\`\\([^ ]+\\)\ -\\(\\( +-\\([^ \\\\\"]\\|\\\\\\.\\|\"[^\"]*\"\\)*\\)*\\)\\(.*\\)\\'" - . ("\\1 -ini -interaction=nonstopmode \"&\\1\" " preview-format-name ".ini \\5"))) - "Generate a dump command from the usual preview command." - :group 'preview-latex - :type '(repeat - (choice (symbol :tag "Named replacement") - (cons string (repeat (choice symbol string)))))) - -(defcustom preview-undump-replacements - '(("\\`\\([^ ]+\\)\ - .*? \"\\\\input\" \\(.*\\)\\'" - . ("\\1 -interaction=nonstopmode \"&" preview-format-name "\" \\2"))) - "Use a dumped format for reading preamble." - :group 'preview-latex - :type '(repeat - (choice (symbol :tag "Named replacement") - (cons string (repeat (choice symbol string)))))) - - -(defun preview-cache-preamble (&optional format-cons) - "Dump a pregenerated format file. -For the rest of the session, this file is used when running -on the same master file. - -Returns the process for dumping, nil if there is still a valid -format available. - -If FORMAT-CONS is non-nil, a previous format may get reused." - (interactive) - (let* ((dump-file - (expand-file-name (preview-dump-file-name (TeX-master-file "ini")))) - (master (TeX-master-file)) - (format-name (expand-file-name master)) - (preview-format-name (shell-quote-argument - (preview-dump-file-name (file-name-nondirectory - master)))) - (master-file (expand-file-name (TeX-master-file t))) - (command (preview-do-replacements - (TeX-command-expand - (preview-string-expand preview-LaTeX-command) - 'TeX-master-file) - preview-dump-replacements)) - (preview-auto-cache-preamble nil)) - (unless (and (consp (cdr format-cons)) - (string= command (cadr format-cons))) - (unless format-cons - (setq format-cons (assoc format-name preview-dumped-alist))) - (if format-cons - (preview-cache-preamble-off format-cons) - (setq format-cons (list format-name)) - (push format-cons preview-dumped-alist)) - ;; mylatex.ltx expects a file name to follow. Bad. `.tex' - ;; in the tools bundle is an empty file. - (write-region "\\ifx\\pdfoutput\\undefined\\else\ -\\let\\PREVIEWdump\\dump\\def\\dump{% -\\edef\\next{{\\catcode`\\ 9 \\pdfoutput=\\the\\pdfoutput\\relax\ -\\the\\everyjob}}\\everyjob\\next\\catcode`\\ 10 \\let\\dump\\PREVIEWdump\\dump}\\fi\\input mylatex.ltx \\relax\n" nil dump-file) - (TeX-save-document master) - (prog1 - (preview-generate-preview - nil (file-name-nondirectory master) - command) - (add-hook 'kill-emacs-hook #'preview-cleanout-tempfiles t) - (setq TeX-sentinel-function - `(lambda (process string) - (condition-case err - (progn - (if (and (eq (process-status process) 'exit) - (zerop (process-exit-status process))) - (preview-watch-preamble - ',master-file - ',command - ',format-cons) - (preview-format-kill ',format-cons)) - (delete-file ',dump-file)) - (error (preview-log-error err "Dumping" process))) - (preview-reraise-error process))))))) - -(defun preview-cache-preamble-off (&optional old-format) - "Clear the pregenerated format file. -The use of the format file is discontinued. -OLD-FORMAT may already contain a format-cons as -stored in `preview-dumped-alist'." - (interactive) - (unless old-format - (setq old-format - (let ((master-file (expand-file-name (TeX-master-file)))) - (or (assoc master-file preview-dumped-alist) - (car (push (list master-file) preview-dumped-alist)))))) - (preview-unwatch-preamble old-format) - (preview-format-kill old-format) - (setcdr old-format nil)) - -(defun preview-region (begin end) - "Run preview on region between BEGIN and END." - (interactive "r") - (TeX-region-create (TeX-region-file TeX-default-extension) - (buffer-substring begin end) - (if buffer-file-name - (file-name-nondirectory buffer-file-name) - "") - (save-restriction - (widen) - (let ((inhibit-point-motion-hooks t) - (inhibit-field-text-motion t)) - (+ (count-lines (point-min) begin) - (save-excursion - (goto-char begin) - (if (bolp) 0 -1)))))) - (preview-generate-preview t (TeX-region-file nil t) - (preview-do-replacements - (TeX-command-expand - (preview-string-expand preview-LaTeX-command) - 'TeX-region-file) - preview-LaTeX-command-replacements))) - -(defun preview-buffer () - "Run preview on current buffer." - (interactive) - (preview-region (point-min) (point-max))) - -;; We have a big problem: When we are dumping preambles, diagnostics -;; issued in later runs will not make it to the output when the -;; predumped format skips the preamble. So we have to place those -;; after \begin{document}. This we can only do if regions never -;; include the preamble. We could do this in our own functions, but -;; that would not extend to the operation of C-c C-r g RET. So we -;; make this preamble skipping business part of TeX-region-create. -;; This will fail if the region is to contain just part of the -;; preamble -- a bad idea anyhow. - -(defadvice TeX-region-create (before preview-preamble preactivate activate) - "Skip preamble for the sake of predumped formats." - (when (string-match TeX-header-end (ad-get-arg 1)) - (ad-set-arg 1 - (prog1 (substring (ad-get-arg 1) (match-end 0)) - (ad-set-arg 3 - (with-temp-buffer - (insert (substring (ad-get-arg 1) - 0 (match-end 0))) - (+ (ad-get-arg 3) - (count-lines (point-min) (point-max)) - (if (bolp) 0 -1)))))))) - -(defun preview-document () - "Run preview on master document." - (interactive) - (TeX-save-document (TeX-master-file)) - (preview-generate-preview - nil (TeX-master-file nil t) - (preview-do-replacements - (TeX-command-expand - (preview-string-expand preview-LaTeX-command) - 'TeX-master-file) - preview-LaTeX-command-replacements))) - -(defun preview-environment (count) - "Run preview on LaTeX environment. -This avoids running environments through preview that are -indicated in `preview-inner-environments'. If you use a prefix -argument COUNT, the corresponding level of outward nested -environments is selected." - (interactive "p") - (save-excursion - (let (currenv) - (dotimes (i (1- count)) - (setq currenv (LaTeX-current-environment)) - (if (string= currenv "document") - (error "No enclosing outer environment found")) - (LaTeX-find-matching-begin)) - (while (member (setq currenv (LaTeX-current-environment)) - preview-inner-environments) - (LaTeX-find-matching-begin)) - (if (string= currenv "document") - (error "No enclosing outer environment found")) - (preview-region - (save-excursion (LaTeX-find-matching-begin) (point)) - (save-excursion (LaTeX-find-matching-end) (point)))))) - -(defun preview-section () - "Run preview on LaTeX section." (interactive) - (save-excursion - (LaTeX-mark-section) - (preview-region (region-beginning) (region-end)))) - - -(defun preview-generate-preview (region-p file command) - "Generate a preview. -REGION-P is the region flag, FILE the file (without default -extension and directory), COMMAND is the command to use. - -It returns the started process." - (setq TeX-current-process-region-p region-p) - (let* ((geometry (preview-get-geometry)) - (commandbuff (current-buffer)) - (pr-file (cons - (if TeX-current-process-region-p - 'TeX-region-file - 'TeX-master-file) - file)) - (master (TeX-master-file)) - (master-file (expand-file-name master)) - (dumped-cons (assoc master-file - preview-dumped-alist)) - process) - (unless dumped-cons - (push (setq dumped-cons (cons master-file - (if (eq preview-auto-cache-preamble 'ask) - (y-or-n-p "Cache preamble? ") - preview-auto-cache-preamble))) - preview-dumped-alist)) - (when (cdr dumped-cons) - (let* (TeX-current-process-region-p) - (setq process (preview-cache-preamble dumped-cons)) - (if process - (setq TeX-sentinel-function - `(lambda (process string) - (funcall ,TeX-sentinel-function process string) - (TeX-inline-preview-internal - ,command ,file - ',pr-file ,commandbuff - ',dumped-cons - ',master - ',geometry - (buffer-string))))))) - (or process - (TeX-inline-preview-internal command file - pr-file commandbuff - dumped-cons master - geometry)))) - -(defun TeX-inline-preview-internal (command file pr-file - commandbuff dumped-cons master - geometry - &optional str) - "Internal stuff for previewing. -COMMAND and FILE should be explained in `TeX-command-list'. -PR-FILE is the target file name in the form for `preview-gs-file'. -COMMANDBUFF, DUMPED-CONS, MASTER, and GEOMETRY are -internal parameters, STR may be a log to insert into the current log." - (set-buffer commandbuff) - (let* - ((preview-format-name (shell-quote-argument - (preview-dump-file-name - (file-name-nondirectory master)))) - (process - (TeX-run-command - "Preview-LaTeX" - (if (consp (cdr dumped-cons)) - (preview-do-replacements - command preview-undump-replacements) - command) file))) - (condition-case err - (progn - (when str - (save-excursion - (goto-char (point-min)) - (insert str) - (when (= (process-mark process) (point-min)) - (set-marker (process-mark process) (point))))) - (preview-set-geometry geometry) - (setq preview-gs-file pr-file) - (setq TeX-sentinel-function 'preview-TeX-inline-sentinel) - (when (featurep 'mule) - (setq preview-coding-system - (or (and (boundp 'TeX-japanese-process-output-coding-system) - TeX-japanese-process-output-coding-system) - (with-current-buffer commandbuff - buffer-file-coding-system))) - (when preview-coding-system - (setq preview-coding-system - (preview-buffer-recode-system - (coding-system-base preview-coding-system)))) - (set-process-coding-system - process preview-coding-system)) - (TeX-parse-reset) - (setq TeX-parse-function 'TeX-parse-TeX) - (if TeX-process-asynchronous - process - (TeX-synchronous-sentinel "Preview-LaTeX" file process))) - (error (preview-log-error err "Preview" process) - (delete-process process) - (preview-reraise-error process))))) - -(defconst preview-version (eval-when-compile - (let ((name "$Name: release_11_86 $") - (rev "$Revision: 1.284 $")) - (or (when (string-match "\\`[$]Name: *release_\\([^ ]+\\) *[$]\\'" name) - (setq name (match-string 1 name)) - (while (string-match "_" name) - (setq name (replace-match "." t t name))) - name) - (if (string-match "\\`[$]Revision: *\\([^ ]+\\) *[$]\\'" rev) - (format "CVS-%s" (match-string 1 rev))) - "unknown"))) - "Preview version. -If not a regular release, CVS revision of `preview.el'.") - -(defconst preview-release-date - (eval-when-compile - (let ((date "$Date: 2009/06/18 19:20:46 $")) - (string-match - "\\`[$]Date: *\\([0-9]+\\)/\\([0-9]+\\)/\\([0-9]+\\)" - date) - (format "%s.%s%s" (match-string 1 date) (match-string 2 date) - (match-string 3 date)))) - "Preview release date. -In the form of yyyy.mmdd") - -(defun preview-dump-state (buffer) - (condition-case nil - (progn - (unless (local-variable-p 'TeX-command-buffer) - (setq buffer (with-current-buffer buffer (TeX-active-buffer)))) - (when (bufferp buffer) - (insert "\nRun buffer contents:\n\n") - (if (< (buffer-size buffer) 5000) - (insert-buffer-substring buffer) - (insert-buffer-substring buffer 1 2500) - (insert "...\n\n[...]\n\n\t...") - (insert-buffer-substring buffer - (- (buffer-size buffer) 2500) - (buffer-size buffer))) - (insert "\n"))) - (error nil))) - -;;;###autoload -(defun preview-report-bug () "Report a bug in the preview-latex package." - (interactive) - (let ((reporter-prompt-for-summary-p "Bug report subject: ")) - (reporter-submit-bug-report - "bug-auctex@gnu.org" - (if (string-match "^CVS-" preview-version) - (concat "preview-" (substring preview-version 4)) - preview-version) - '(AUCTeX-version - LaTeX-command-style - image-types - preview-image-type - preview-image-creators - preview-dvipng-image-type - preview-dvipng-command - preview-pdf2dsc-command - preview-gs-command - preview-gs-options - preview-gs-image-type-alist - preview-fast-conversion - preview-prefer-TeX-bb - preview-dvips-command - preview-fast-dvips-command - preview-scale-function - preview-LaTeX-command - preview-required-option-list - preview-preserve-counters - preview-default-option-list - preview-default-preamble - preview-LaTeX-command-replacements - preview-dump-replacements - preview-undump-replacements - preview-auto-cache-preamble - preview-TeX-style-dir) - `(lambda () (preview-dump-state ,(current-buffer))) - (lambda () - (insert (format "\nOutput from running `%s -h':\n" - preview-gs-command)) - (call-process preview-gs-command nil t nil "-h") - (insert "\n")) - "Remember to cover the basics. Including a minimal LaTeX example -file exhibiting the problem might help." - ))) - -(eval-when-compile - (when (boundp 'preview-compatibility-macros) - (dolist (elt preview-compatibility-macros) - (if (consp elt) - (fset (car elt) (cdr elt)) - (fmakunbound elt))))) - -(makunbound 'preview-compatibility-macros) - -(provide 'preview) -;;; preview.el ends here diff --git a/packages/auctex/prv-emacs.el b/packages/auctex/prv-emacs.el deleted file mode 100644 index 9f407360c..000000000 --- a/packages/auctex/prv-emacs.el +++ /dev/null @@ -1,600 +0,0 @@ -;;; prv-emacs.el --- GNU Emacs specific code for preview.el - -;; Copyright (C) 2001, 02, 03, 04, 05 Free Software Foundation, Inc. - -;; Author: David Kastrup -;; Keywords: convenience, tex, wp - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, -;; Boston, MA 02110-1301, USA. - -;;; Commentary: - -;; - -;;; Code: - -(require 'tex-site) -(require 'tex) -(require 'latex) - -(defvar preview-compatibility-macros nil - "List of macros only present when compiling/loading.") - -(defcustom preview-transparent-color '(highlight :background) - "Color to appear transparent in previews. -Set this to something unusual when using `preview-transparent-border', -to the default background in most other cases." - :type '(radio (const :tag "None" nil) - (const :tag "Autodetect" t) - (color :tag "By name" :value "white") - (list :tag "Take from face" - :value (default :background) - (face) - (choice :tag "What to take" - (const :tag "Background" :value :background) - (const :tag "Foreground" :value :foreground)))) - :group 'preview-appearance) - -;;; Note that the following default introduces a border only when -;;; Emacs blinks politely when point is on an image (the tested -;;; unrelated function was introduced at about the time image blinking -;;; became tolerable). -(defcustom preview-transparent-border (unless (fboundp 'posn-object-x-y) 1.5) - "Width of transparent border for previews in pt. -Setting this to a numeric value will add a border of -`preview-transparent-color' around images, and will turn -the heuristic-mask setting of images to default to 't since -then the borders are correctly detected even in case of -palette operations. If the transparent color is something -not present otherwise in the image, the cursor display -will affect just this border. A width of 0 is interpreted -by PostScript as meaning a single pixel, other widths are -interpreted as PostScript points (1/72 of 1in)" - :group 'preview-appearance - :type '(choice (const :value nil :tag "No border") - (number :value 1.5 :tag "Border width in pt"))) - -(defun preview-get-heuristic-mask () - "Get heuristic-mask to use for previews. -Consults `preview-transparent-color'." - (cond ((stringp preview-transparent-color) - (color-values preview-transparent-color)) - ((or (not (consp preview-transparent-color)) - (integerp (car preview-transparent-color))) - preview-transparent-color) - (t (color-values (preview-inherited-face-attribute - (nth 0 preview-transparent-color) - (nth 1 preview-transparent-color) - 'default))))) - -(defsubst preview-create-icon-1 (file type ascent border) - `(image - :file ,file - :type ,type - :ascent ,ascent - ,@(and border - '(:mask (heuristic t))))) - -(defun preview-create-icon (file type ascent border) - "Create an icon from FILE, image TYPE, ASCENT and BORDER." - (list - (preview-create-icon-1 file type ascent border) - file type ascent border)) - -(put 'preview-filter-specs :type - #'(lambda (keyword value &rest args) - (if (image-type-available-p value) - `(image :type ,value - ,@(preview-filter-specs-1 args)) - (throw 'preview-filter-specs nil)))) - -;; No defcustom here: does not seem to make sense. - -(defvar preview-tb-icon-specs - '((:type xpm :file "prvtex24.xpm") - (:type xbm :file "prvtex24.xbm"))) - -(defvar preview-tb-icon nil) - -(defun preview-add-urgentization (fun ov &rest rest) - "Cause FUN (function call form) to be called when redisplayed. -FUN must be a form with OV as first argument, -REST as the remainder, returning T." - (let ((dispro (overlay-get ov 'display))) - (unless (eq (car dispro) 'when) - (overlay-put ov 'display `(when (,fun ,ov ,@rest) . ,dispro))))) - -(defun preview-remove-urgentization (ov) - "Undo urgentization of OV by `preview-add-urgentization'. -Returns the old arguments to `preview-add-urgentization' -if there was any urgentization." - (let ((dispro (overlay-get ov 'display))) - (when (eq (car-safe dispro) 'when) - (prog1 - (car (cdr dispro)) - (overlay-put ov 'display (cdr (cdr dispro))))))) - -(defsubst preview-icon-copy (icon) - "Prepare a later call of `preview-replace-active-icon'." - - ;; This is just a GNU Emacs specific efficiency hack because it - ;; is easy to do. When porting, don't do anything complicated - ;; here, rather deliver just the unchanged icon and make - ;; `preview-replace-active-icon' do the necessary work of replacing - ;; the icon where it actually has been stored, probably - ;; in the car of the strings property of the overlay. This string - ;; might probably serve as a begin-glyph as well, in which case - ;; modifying the string in the strings property would change that - ;; glyph automatically. - - (cons 'image (cdr icon))) - -(defsubst preview-replace-active-icon (ov replacement) - "Replace the active Icon in OV by REPLACEMENT, another icon." - (let ((img (overlay-get ov 'preview-image))) - (setcdr (car img) (cdar replacement)) - (setcdr img (cdr replacement)))) - -(defvar preview-button-1 [mouse-2]) -(defvar preview-button-2 [mouse-3]) - -(defmacro preview-make-clickable (&optional map glyph helpstring click1 click2) - "Generate a clickable string or keymap. -If MAP is non-nil, it specifies a keymap to add to, otherwise -a new one is created. If GLYPH is given, the result is made -to display it wrapped in a string. In that case, -HELPSTRING is a format string with one or two %s specifiers -for preview's clicks, displayed as a help-echo. CLICK1 and CLICK2 -are functions to call on preview's clicks." - `(let ((resmap ,(or map '(make-sparse-keymap)))) - ,@(if click1 - `((define-key resmap preview-button-1 ,click1))) - ,@(if click2 - `((define-key resmap preview-button-2 ,click2))) - ,(if glyph - `(propertize - "x" - 'display ,glyph - 'mouse-face 'highlight - 'help-echo - ,(if (stringp helpstring) - (format helpstring preview-button-1 preview-button-2) - `(format ,helpstring preview-button-1 preview-button-2)) - 'keymap resmap) - 'resmap))) - -(defvar preview-overlay nil) - -(put 'preview-overlay - 'modification-hooks - '(preview-handle-modification)) - -(put 'preview-overlay - 'insert-in-front-hooks - '(preview-handle-insert-in-front)) - -(put 'preview-overlay - 'insert-behind-hooks - '(preview-handle-insert-behind)) - -;; We have to fake our way around atomicity. - -;; Here is the beef: for best intuitiveness, we want to have -;; insertions be carried out as expected before iconized text -;; passages, but we want to insert *into* the overlay when not -;; iconized. A preview that has become empty can not get content -;; again: we remove it. A disabled preview needs no insert-in-front -;; handler. - -(defvar preview-change-list nil - "List of tentatively changed overlays.") - -(defcustom preview-dump-threshold - "^ *\\\\begin *{document}[ %]*$" - "*Regexp denoting end of preamble. -This is the location up to which preamble changes are considered -to require redumping of a format." - :group 'preview-latex - :type 'string) - -(defun preview-preamble-changed-function - (ov after-change beg end &optional length) - "Hook function for change hooks on preamble. -See info node `(elisp) Overlay Properties' for -definition of OV, AFTER-CHANGE, BEG, END and LENGTH." - (let ((format-cons (overlay-get ov 'format-cons))) - (preview-unwatch-preamble format-cons) - (preview-format-kill format-cons) - (setcdr format-cons t))) - -(defun preview-watch-preamble (file command format-cons) - "Set up a watch on master file FILE. -FILE can be an associated buffer instead of a filename. -COMMAND is the command that generated the format. -FORMAT-CONS contains the format info for the main -format dump handler." - (let ((buffer (if (bufferp file) - file - (find-buffer-visiting file))) ov) - (setcdr - format-cons - (cons command - (when buffer - (with-current-buffer buffer - (save-excursion - (save-restriction - (widen) - (goto-char (point-min)) - (unless (re-search-forward preview-dump-threshold nil t) - (error "Can't find preamble of `%s'" file)) - (setq ov (make-overlay (point-min) (point))) - (overlay-put ov 'format-cons format-cons) - (overlay-put ov 'insert-in-front-hooks - '(preview-preamble-changed-function)) - (overlay-put ov 'modification-hooks - '(preview-preamble-changed-function)) - ov)))))))) - -(defun preview-unwatch-preamble (format-cons) - "Stop watching a format on FORMAT-CONS. -The watch has been set up by `preview-watch-preamble'." - (when (consp (cdr format-cons)) - (when (cddr format-cons) - (delete-overlay (cddr format-cons))) - (setcdr (cdr format-cons) nil))) - -(defun preview-register-change (ov) - "Register not yet changed OV for verification. -This stores the old contents of the overlay in the -`preview-prechange' property and puts the overlay into -`preview-change-list' where `preview-check-changes' will -find it at some later point of time." - (unless (overlay-get ov 'preview-prechange) - (if (eq (overlay-get ov 'preview-state) 'disabled) - (overlay-put ov 'preview-prechange t) - (overlay-put ov 'preview-prechange - (save-restriction - (widen) - (buffer-substring-no-properties - (overlay-start ov) (overlay-end ov))))) - (push ov preview-change-list))) - -(defun preview-check-changes () - "Check whether the contents under the overlay have changed. -Disable it if that is the case. Ignores text properties." - (dolist (ov preview-change-list) - (condition-case nil - (with-current-buffer (overlay-buffer ov) - (let ((text (save-restriction - (widen) - (buffer-substring-no-properties - (overlay-start ov) (overlay-end ov))))) - (if (zerop (length text)) - (preview-delete ov) - (unless - (or (eq (overlay-get ov 'preview-state) 'disabled) - (preview-relaxed-string= - text (overlay-get ov 'preview-prechange))) - (overlay-put ov 'insert-in-front-hooks nil) - (overlay-put ov 'insert-behind-hooks nil) - (preview-disable ov))))) - (error nil)) - (overlay-put ov 'preview-prechange nil)) - (setq preview-change-list nil)) - -(defun preview-handle-insert-in-front - (ov after-change beg end &optional length) - "Hook function for `insert-in-front-hooks' property. -See info node `(elisp) Overlay Properties' for -definition of OV, AFTER-CHANGE, BEG, END and LENGTH." - (if after-change - (unless undo-in-progress - (if (eq (overlay-get ov 'preview-state) 'active) - (move-overlay ov end (overlay-end ov)))) - (preview-register-change ov))) - -(defun preview-handle-insert-behind - (ov after-change beg end &optional length) - "Hook function for `insert-behind-hooks' property. -This is needed in case `insert-before-markers' is used at the -end of the overlay. See info node `(elisp) Overlay Properties' -for definition of OV, AFTER-CHANGE, BEG, END and LENGTH." - (if after-change - (unless undo-in-progress - (if (eq (overlay-get ov 'preview-state) 'active) - (move-overlay ov (overlay-start ov) beg))) - (preview-register-change ov))) - -(defun preview-handle-modification - (ov after-change beg end &optional length) - "Hook function for `modification-hooks' property. -See info node `(elisp) Overlay Properties' for -definition of OV, AFTER-CHANGE, BEG, END and LENGTH." - (unless after-change - (preview-register-change ov))) - -(defun preview-toggle (ov &optional arg event) - "Toggle visibility of preview overlay OV. -ARG can be one of the following: t displays the overlay, -nil displays the underlying text, and 'toggle toggles. -If EVENT is given, it indicates the window where the event -occured, either by being a mouse event or by directly being -the window in question. This may be used for cursor restoration -purposes." - (let ((old-urgent (preview-remove-urgentization ov)) - (preview-state - (if (if (eq arg 'toggle) - (null (eq (overlay-get ov 'preview-state) 'active)) - arg) - 'active - 'inactive)) - (strings (overlay-get ov 'strings))) - (unless (eq (overlay-get ov 'preview-state) 'disabled) - (overlay-put ov 'preview-state preview-state) - (if (eq preview-state 'active) - (progn - (overlay-put ov 'category 'preview-overlay) - (if (eq (overlay-start ov) (overlay-end ov)) - (overlay-put ov 'before-string (car strings)) - (dolist (prop '(display keymap mouse-face help-echo)) - (overlay-put ov prop - (get-text-property 0 prop (car strings)))) - (overlay-put ov 'before-string nil)) - (overlay-put ov 'face nil)) - (dolist (prop '(display keymap mouse-face help-echo)) - (overlay-put ov prop nil)) - (overlay-put ov 'face 'preview-face) - (unless (cdr strings) - (setcdr strings (preview-inactive-string ov))) - (overlay-put ov 'before-string (cdr strings))) - (if old-urgent - (apply 'preview-add-urgentization old-urgent)))) - (if event - (preview-restore-position - ov - (if (windowp event) - event - (posn-window (event-start event)))))) - -(defsubst preview-buffer-recode-system (base) - "This is supposed to translate unrepresentable base encodings -into something that can be used safely for byte streams in the -run buffer. A noop for Emacs." - base) - -(defun preview-mode-setup () - "Setup proper buffer hooks and behavior for previews." - (set (make-local-variable 'desktop-save-buffer) - #'desktop-buffer-preview-misc-data) - (add-hook 'pre-command-hook #'preview-mark-point nil t) - (add-hook 'post-command-hook #'preview-move-point nil t) - (easy-menu-add preview-menu LaTeX-mode-map) - (unless preview-tb-icon - (setq preview-tb-icon (preview-filter-specs preview-tb-icon-specs))) - (when preview-tb-icon - (define-key LaTeX-mode-map [tool-bar preview] - `(menu-item "Preview at point" preview-at-point - :image ,preview-tb-icon - :help "Preview on/off at point"))) - (when buffer-file-name - (let* ((filename (expand-file-name buffer-file-name)) - format-cons) - (when (string-match (concat "\\." TeX-default-extension "\\'") - filename) - (setq filename (substring filename 0 (match-beginning 0)))) - (setq format-cons (assoc filename preview-dumped-alist)) - (when (consp (cdr format-cons)) - (preview-unwatch-preamble format-cons) - (preview-watch-preamble (current-buffer) - (cadr format-cons) - format-cons))))) - -(defvar preview-marker (make-marker) - "Marker for fake intangibility.") - -(defvar preview-temporary-opened nil) - -(defvar preview-last-location nil - "Restored cursor position marker for reopened previews.") -(make-variable-buffer-local 'preview-last-location) - -(defun preview-mark-point () - "Mark position for fake intangibility." - (when (eq (get-char-property (point) 'preview-state) 'active) - (unless preview-last-location - (setq preview-last-location (make-marker))) - (set-marker preview-last-location (point)) - (set-marker preview-marker (point)) - (preview-move-point)) - (set-marker preview-marker (point))) - -(defun preview-restore-position (ov window) - "Tweak position after opening/closing preview. -The treated overlay OV has been triggered in WINDOW. This function -records the original buffer position for reopening, or restores it -after reopening. Note that by using the mouse, you can open/close -overlays not in the active window." - (when (eq (overlay-buffer ov) (window-buffer window)) - (with-current-buffer (overlay-buffer ov) - (if (eq (overlay-get ov 'preview-state) 'active) - (setq preview-last-location - (set-marker (or preview-last-location (make-marker)) - (window-point window))) - (when (and - (markerp preview-last-location) - (eq (overlay-buffer ov) (marker-buffer preview-last-location)) - (< (overlay-start ov) preview-last-location) - (> (overlay-end ov) preview-last-location)) - (set-window-point window preview-last-location)))))) - -(defun preview-move-point () - "Move point out of fake-intangible areas." - (preview-check-changes) - (let* (newlist (pt (point)) (lst (overlays-at pt)) distance) - (setq preview-temporary-opened - (dolist (ov preview-temporary-opened newlist) - (and (overlay-buffer ov) - (eq (overlay-get ov 'preview-state) 'inactive) - (if (and (eq (overlay-buffer ov) (current-buffer)) - (or (<= pt (overlay-start ov)) - (>= pt (overlay-end ov)))) - (preview-toggle ov t) - (push ov newlist))))) - (when lst - (if (or disable-point-adjustment - global-disable-point-adjustment - (preview-auto-reveal-p - preview-auto-reveal - (setq distance - (and (eq (marker-buffer preview-marker) - (current-buffer)) - (- pt (marker-position preview-marker)))))) - (preview-open-overlays lst) - (while lst - (setq lst - (if (and - (eq (overlay-get (car lst) 'preview-state) 'active) - (> pt (overlay-start (car lst)))) - (overlays-at - (setq pt (if (and distance (< distance 0)) - (overlay-start (car lst)) - (overlay-end (car lst))))) - (cdr lst)))) - (goto-char pt))))) - -(defun preview-open-overlays (list &optional pos) - "Open all previews in LIST, optionally restricted to enclosing POS." - (dolist (ovr list) - (when (and (eq (overlay-get ovr 'preview-state) 'active) - (or (null pos) - (and - (> pos (overlay-start ovr)) - (< pos (overlay-end ovr))))) - (preview-toggle ovr) - (push ovr preview-temporary-opened)))) - -(defadvice replace-highlight (before preview) - "Make `query-replace' open preview text about to be replaced." - (preview-open-overlays - (overlays-in (ad-get-arg 0) (ad-get-arg 1)))) - -(defcustom preview-query-replace-reveal t - "*Make `query-replace' autoreveal previews." - :group 'preview-appearance - :type 'boolean - :require 'preview - :set (lambda (symbol value) - (set-default symbol value) - (if value - (ad-enable-advice 'replace-highlight 'before 'preview) - (ad-disable-advice 'replace-highlight 'before 'preview)) - (ad-activate 'replace-highlight)) - :initialize #'custom-initialize-reset) - -;; Check whether the four-argument form of `face-attribute' exists. -;; If not, we will get a `wrong-number-of-arguments' error thrown. -;; Use `defun' instead of `defsubst' here so that the decision may be -;; reverted at load time if you are compiling with one Emacs and using -;; another. -(if (condition-case nil - (progn - (face-attribute 'default :height nil nil) - t) - (wrong-number-of-arguments nil)) - - (defun preview-inherited-face-attribute (face attribute &optional inherit) - "Fetch face attribute while adhering to inheritance. -This searches FACE for an ATTRIBUTE, using INHERIT -for resolving unspecified or relative specs. See the fourth -argument of function `face-attribute' for details." - (face-attribute face attribute nil inherit)) - - (defun preview-inherited-face-attribute (face attribute &optional inherit) - "Fetch face attribute while adhering to inheritance. -This searches FACE for an ATTRIBUTE. If it is 'unspecified, -first inheritance is consulted (if INHERIT is non-NIL), then -INHERIT is searched if it is a face or a list of faces. -Relative specs are evaluated recursively until they get absolute or -are not resolvable. Relative specs are float values." - (let ((value (face-attribute face attribute))) - (when inherit - (setq inherit - (append - (let ((ancestors (face-attribute face :inherit))) - (cond ((facep ancestors) (list ancestors)) - ((consp ancestors) ancestors))) - (cond ((facep inherit) (list inherit)) - ((consp inherit) inherit))))) - (cond ((null inherit) value) - ((floatp value) - (let ((avalue - (preview-inherited-face-attribute - (car inherit) attribute (or (cdr inherit) t)))) - (cond ((integerp avalue) - (round (* avalue value))) - ((floatp avalue) - (* value avalue)) - (t value)))) - ((eq value 'unspecified) - (preview-inherited-face-attribute - (car inherit) attribute (or (cdr inherit) t))) - (t value))))) - -(defun preview-get-colors () - "Return colors from the current display. -Fetches the current screen colors and makes a vector -of colors as numbers in the range 0..65535. -Pure borderless black-on-white will return triple NIL. -The fourth value is the transparent border thickness." - (let - ((bg (color-values (preview-inherited-face-attribute - 'preview-reference-face :background 'default))) - (fg (color-values (preview-inherited-face-attribute - 'preview-reference-face :foreground 'default))) - (mask (preview-get-heuristic-mask))) - (if (equal '(65535 65535 65535) bg) - (setq bg nil)) - (if (equal '(0 0 0) fg) - (setq fg nil)) - (unless (and (numberp preview-transparent-border) - (consp mask) (integerp (car mask))) - (setq mask nil)) - (vector bg fg mask preview-transparent-border))) - -(defmacro preview-mark-active () - "Return t if the mark is active." - 'mark-active) - -(defun preview-import-image (image) - "Convert the printable IMAGE rendition back to an image." - (cond ((stringp image) - (propertize image 'face 'preview-face)) - ((eq (car image) 'image) - image) - (t - (preview-create-icon-1 (nth 0 image) - (nth 1 image) - (nth 2 image) - (if (< (length image) 4) - (preview-get-heuristic-mask) - (nth 3 image)))))) - -(defsubst preview-supports-image-type (imagetype) - "Check if IMAGETYPE is supported." - (image-type-available-p imagetype)) - -(provide 'prv-emacs) -;;; prv-emacs.el ends here diff --git a/packages/auctex/style/.nosearch b/packages/auctex/style/.nosearch deleted file mode 100644 index aa31332e8..000000000 --- a/packages/auctex/style/.nosearch +++ /dev/null @@ -1 +0,0 @@ -;; AUCTeX style/ and auto/ directories should not appear in load path. diff --git a/packages/auctex/style/CJK.el b/packages/auctex/style/CJK.el deleted file mode 100644 index fa285bdd3..000000000 --- a/packages/auctex/style/CJK.el +++ /dev/null @@ -1,93 +0,0 @@ -;;; CJK.el --- AUCTeX style for the CJK package. - -;; Copyright (C) 2009 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2009-01-04 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for the CJK package, version 4.8.0 -;; (22-May-2008). - -;;; Code: - -(defvar LaTeX-CJK-package-options - '("lowercase" "global" "local" "active" "encapsulated") - "Package options for the CJK package.") - -(defvar LaTeX-CJK-enc-list - '("Bg5" "Bg5+" "HK" "GB" "GBt" "GBK" "JIS" "JIS2" "SJIS" "KS" "UTF8" "CNS1" - "CNS2" "CNS3" "CNS4" "CNS5" "CNS6" "CNS7" "CEFX" "CEFY") - "List of encodings supported by the CJK package.") - -(defun LaTeX-env-CJK (env) - "Prompt for the arguments of ENV and insert it. -The function can be used for CJK and CJK* environments." - (LaTeX-insert-environment - env - (concat - (let ((font-enc (read-string "(Optional) Font encoding: "))) - (unless (zerop (length font-enc)) (format "[%s]" font-enc))) - (format "{%s}" (completing-read "Encoding: " - (mapcar 'list LaTeX-CJK-enc-list))) - (format "{%s}" (read-string "Font family: "))))) - -(TeX-add-style-hook - "CJK" - (lambda () - ;; New symbols - (TeX-add-symbols - '("CJKencfamily" ["Font encoding"] "Encoding" "Font family") - '("CJKchar" ["Encoding"] "First byte" "Second byte") - '("CJKcaption" 1) - '("CJKfamily" 1) - '("CJKfontenc" "Encoding" "Font encoding") - '("CJKenc" 1) - '("Unicode" "First byte" "Second byte") - '("CJKsymbols" 2) - '("CJKsymbol" 1) - "CJKbold" - "CJKnormal" - "CJKboldshift" - "CJKCJKchar" - "CJKhangulchar" - "CJKlatinchar" - "CJKhwkatakana" - "CJKnohwkatakana" - "CJKglue" - "CJKtolerance" - "CJKtilde" - "nbs" - "standardtilde" - "CJKspace" - "CJKnospace" - "CJKindent" - '("CJKaddEncHook" 2) - "CJKkern" - "CJKverbatim") - ;; New environments - (LaTeX-add-environments - '("CJK" LaTeX-env-CJK) - '("CJK*" LaTeX-env-CJK)))) - -;;; CJK.el ends here diff --git a/packages/auctex/style/CJKutf8.el b/packages/auctex/style/CJKutf8.el deleted file mode 100644 index ea3c2e3d4..000000000 --- a/packages/auctex/style/CJKutf8.el +++ /dev/null @@ -1,38 +0,0 @@ -;;; CJKutf8.el --- AUCTeX style for the CJKutf8 package. - -;; Copyright (C) 2009 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2009-01-04 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for the CJKutf8 package. - -;;; Code: - -(TeX-add-style-hook - "CJKutf8" - (lambda () - (TeX-run-style-hooks "CJK"))) - -;;; CJKutf8.el ends here diff --git a/packages/auctex/style/MinionPro.el b/packages/auctex/style/MinionPro.el deleted file mode 100644 index 7151c368d..000000000 --- a/packages/auctex/style/MinionPro.el +++ /dev/null @@ -1,71 +0,0 @@ -;;; MinionPro.el -- AUCTeX style for MinionPro.sty - -;; Copyright (C) 2005 Free Software Foundation, Inc. - -;; Author: Mark Trettin -;; Maintainer: auctex-devel@gnu.org -;; Created: 2005-11-26 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `MinionPro.sty' (v2.0). - -;;; Code - -(TeX-add-style-hook - "MinionPro" - (lambda () - (TeX-add-symbols - ;; New symbols - '("figureversion" - (TeX-arg-eval completing-read "Figure style: " - '(("text") ("osf") - ("lining") ("lf") - ("tabular") ("tab") - ("proportional") ("prop")))) - '("smallfrac" "Numerator" "Denominator") - '("slantfrac" "Numerator" "Denominator") - ;; IMHO they should be added to the other \text.. and \..shape commands - '("textsw" 1) - '("textssc" 1) - "sscshape" - "swshape") - ;; Run style hook for amsmath which is loaded via MnSymbol - (TeX-run-style-hooks "amsmath") - ;; Fontification - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("smallfrac" "{{") - ("slantfrac" "{{") - ("textsw" "{") - ("textssc" "{")) - 'textual) - (font-latex-add-keywords '(("figureversion" "{")) 'variable)))) - -(defvar LaTeX-MinionPro-package-options - '("smallfamily" "medfamily" "fullfamily" "noopticals" "opticals" - "slides" "textosf" "mathosf" "osf" "textlf" "mathlf" "lf" - "mathtabular" "mnsy" "cmsy" "swash" "abx" "amsbb" "fourierbb" - "lucidabb" "mixedgreek" "italicgreek" "frenchmath" "minionint" - "footnotefigures") -"Package options for the MinionPro package.") - -;;; MinionPro.el ends here diff --git a/packages/auctex/style/alltt.el b/packages/auctex/style/alltt.el deleted file mode 100644 index a266a88fb..000000000 --- a/packages/auctex/style/alltt.el +++ /dev/null @@ -1,55 +0,0 @@ -;;; alltt.el --- AUCTeX style for `alltt.sty' - -;; Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2004-04-30 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `alltt.sty'. - -;;; Code: - -(TeX-add-style-hook - "alltt" - (lambda () - (LaTeX-add-environments "alltt") - (make-local-variable 'LaTeX-indent-environment-list) - (add-to-list 'LaTeX-indent-environment-list - '("alltt" current-indentation)) - (make-local-variable 'LaTeX-verbatim-regexp) - (setq LaTeX-verbatim-regexp (concat LaTeX-verbatim-regexp "\\|alltt")) - (add-to-list 'LaTeX-verbatim-environments-local "alltt") - ;; Fontification - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - ;; For syntactic fontification, e.g. verbatim constructs. - (font-latex-set-syntactic-keywords) - ;; Tell font-lock about the update. - (setq font-lock-set-defaults nil) - (font-lock-set-defaults)))) - -(defvar LaTeX-alltt-package-options nil - "Package options for the alltt package.") - -;;; alltt.el ends here diff --git a/packages/auctex/style/alphanum.el b/packages/auctex/style/alphanum.el deleted file mode 100644 index 43ce10e11..000000000 --- a/packages/auctex/style/alphanum.el +++ /dev/null @@ -1,99 +0,0 @@ -;;; alphanum.el --- AUCTeX style for `alphanum.sty' - -;; Copyright (C) 2004 Free Software Foundation, Inc. - -;; Author: Frank Küster -;; Maintainer: auctex-devel@gnu.org -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This is file alphanum.el, which makes AUCTeX usable with jura.cls -;; and its style file alphanum.sty. -;; -;; Contributed by Frank Küster . The code for -;; reftex has been written by Carsten Dominik, the maintainer of -;; reftex, but all the errors are mine. - -;;; Code: - - -(defun TeX-arg-none (arg) - (insert " ")) - -(defun reftex-get-section-level-alphanum () - (save-excursion ; preserve position - (save-match-data ; preserve matching data (important!) - ;; Go back to the beginning of the sectioning command - (goto-char (match-beginning 0)) - ;; Define an initial level number, depending on the current macro. - (let* ((macro (reftex-match-string 3)) ; "toc" or "sub" - (lev (cond ((string= macro "toc") 1) ; min level for "toc" - ((string= macro "sub") 2) ; min level for "sub" - (t 0))) - ;; Make a regular expression which will match sectioning commands - ;; and the levelup macro. - (re (concat "\\(^[^%]*\\\\levelup\\>\\)" - "\\|" - "\\(" reftex-section-regexp "\\)"))) - ;; Now parse backwards for all sectioning and levelup macros, - ;; and keep track of the relative level changes. - (while (re-search-backward re nil t) - (cond - ((match-beginning 1) - ;; levelup matched, reduce level counter - (setq lev (1- lev))) - ((string= (reftex-match-string 4) "toc") - ;; a toc entry, nothing changes - ) - ((string= (reftex-match-string 4) "sub") - ;; a sub entry, increase level counter - (setq lev (1+ lev))))) - ;; return the level - lev)))) - -(TeX-add-style-hook - "alphanum" - (lambda () - (LaTeX-largest-level-set "chapter") - (TeX-add-symbols '("levelup" TeX-arg-none)) - (make-local-variable 'LaTeX-section-list) - (LaTeX-section-list-add-locally - '(("part" 0) - ;; the levels don't make sense with alphanum, I randomly chose 0... - ("toc" 0) - ("sub" 0)) t) - (setq LaTeX-section-label - '(("part" . "part:") - ("toc" . "sec:") - ("sub" . "sec:"))) - ;; - ;; ****************** reftex part ****************** - ;; this won't work in multifile documents, but at least there is - ;; something. - - (if (fboundp 'reftex-add-section-levels) - (reftex-add-section-levels - '(("toc" . reftex-get-section-level-alphanum) - ("sub" . reftex-get-section-level-alphanum)))))) - -;; Local Variables: -;; coding: iso-8859-1 -;; End: diff --git a/packages/auctex/style/amsart.el b/packages/auctex/style/amsart.el deleted file mode 100644 index 51a2902ef..000000000 --- a/packages/auctex/style/amsart.el +++ /dev/null @@ -1,10 +0,0 @@ -;;; amsart.el --- Style hook for the AMS-LaTeX article document class. - -;;; Code: - -(TeX-add-style-hook "amsart" - (function - (lambda () - (TeX-run-style-hooks "amsmath" "amsthm")))) - -;;; amsart.el ends here. diff --git a/packages/auctex/style/amsbook.el b/packages/auctex/style/amsbook.el deleted file mode 100644 index ccbc84efe..000000000 --- a/packages/auctex/style/amsbook.el +++ /dev/null @@ -1,10 +0,0 @@ -;;; amsbook.el --- Style hook for the AMS-LaTeX book document class. - -;;; Code: - -(TeX-add-style-hook "amsbook" - (function - (lambda () - (TeX-run-style-hooks "amsmath" "amsthm")))) - -;;; amsbook.el ends here. diff --git a/packages/auctex/style/amsbsy.el b/packages/auctex/style/amsbsy.el deleted file mode 100644 index dd2605cd2..000000000 --- a/packages/auctex/style/amsbsy.el +++ /dev/null @@ -1,18 +0,0 @@ -;;; amsbsy.el --- Style hook for the AMS-LaTeX amsbsy package. -;;; -;;; AUTHOR: Carsten Dominik - -;;; Code: - -(TeX-add-style-hook "amsbsy" - (function - (lambda () - (TeX-add-symbols - '("boldsymbol" "Symbol") - '("pmb" "Symbol") - )))) - -(defvar LaTeX-amsbsy-package-options nil - "Package options for the amsbsy package.") - -;;; amsbsy.el ends here. diff --git a/packages/auctex/style/amsmath.el b/packages/auctex/style/amsmath.el deleted file mode 100644 index 8f164250c..000000000 --- a/packages/auctex/style/amsmath.el +++ /dev/null @@ -1,181 +0,0 @@ -;;; amsmath.el --- Style hook for the AMS-LaTeX amsmath package. - -;; Copyright (C) 2002, 2005 Free Software Foundation, Inc. -;; FIXME: What about the copyright for <= 2001? - -;; Author: Carsten Dominik -;; Maintainer: auctex-devel@gnu.org - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This will also load the amstext, amsbsy and amsopn style files. - -;;; Code: - -(TeX-add-style-hook "amsmath" - (function - (lambda () - - (LaTeX-add-environments - '("align" LaTeX-env-label) - '("gather" LaTeX-env-label) - '("flalign" LaTeX-env-label) - '("multline" LaTeX-env-label) - '("alignat" LaTeX-amsmath-env-alignat) - '("alignat*" LaTeX-amsmath-env-alignat) - '("xalignat" LaTeX-amsmath-env-alignat) - '("xalignat*" LaTeX-amsmath-env-alignat) - '("xxalignat" LaTeX-amsmath-env-alignat) - '("aligned" LaTeX-amsmath-env-aligned) - '("gathered" LaTeX-amsmath-env-aligned) - "align*" "gather*" "flalign*" "multline*" "equation*" - "split" - "cases" - "matrix" "smallmatrix" "pmatrix" "bmatrix" "Bmatrix" "vmatrix" "Vmatrix" - "subequations" - '("subarray" "Alignment")) - - (TeX-add-symbols - '("eqref" TeX-arg-ref) - '("numberwithin" TeX-arg-counter "Section level") - '("raisetag" "Dimension") - '("intertext" t) - '("hdotsfor" ["Stretch"] "Number of columns to cover") - '("xleftarrow" ["Below"] "Above") - '("xrightarrow" ["Below"] "Above") - '("overset" "Accent symbol" "Symbol") - '("underset" "Accent symbol" "Symbol") - '("dfrac" 2) - '("tfrac" 2) - '("binom" 2) - '("dbinom" 2) - '("tbinom" 2) - '("genfrac" "Left delimiter" "Right delimiter" "Thickness" - "Mathstyle" 2) - '("cfrac" ["position (l or r)"] t) - '("smash" ["where (t or b)"] t) - '("sideset" "Left" "Right") - '("tag" "(Tag)") - '("tag*" "Tag") - '("displaybreak" ["Weight (0..4)"]) - '("allowdisplaybreaks" ["Weight (1..4)"]) - '("substack" t) - '("leftroot" "Push root index left by") - '("uproot" "Push root index upward by") - '("boxed" t) - '("mspace" t) - '("mod" t) - '("pmod" t) - '("pod" t) - '("overleftrightarrow" t) - '("underleftarrow" t) - '("underrightarrow" t) - '("underleftrightarrow" t) - '("dddot" t) - '("ddddot" t) - "bmod" "notag" - "dots" "dotsb" "dotsc" "dotsi" "dotsm" "dotso" "nobreakdash" - "lvert" "rvert" "lVert" "rVert" - "iint" "iiint" "iiiint" "idotsint" - ) - - (setq LaTeX-item-list - (append '(("split" . LaTeX-item-equation) - ("multline" . LaTeX-item-equation) - ("multline*" . LaTeX-item-equation) - ("gather" . LaTeX-item-equations) - ("gather*" . LaTeX-item-equation) - ("gathered" . LaTeX-item-equation) - ("align" . LaTeX-item-equations) - ("align*" . LaTeX-item-equation) - ("aligned" . LaTeX-item-equation) - ("alignat" . LaTeX-item-equations) - ("alignat*" . LaTeX-item-equation) - ("xalignat" . LaTeX-item-equations) - ("xalignat*" . LaTeX-item-equation) - ("xxalignat" . LaTeX-item-equation) - ("flalign" . LaTeX-item-equations) - ("flalign*" . LaTeX-item-equation) - ("matrix" . LaTeX-item-equation) - ("pmatrix" . LaTeX-item-equation) - ("bmatrix" . LaTeX-item-equation) - ("Bmatrix" . LaTeX-item-equation) - ("vmatrix" . LaTeX-item-equation) - ("Vmatrix" . LaTeX-item-equation) - ("cases" . LaTeX-item-equation)) - LaTeX-item-list)) - - ;; When `LaTeX-amsmath-label' is nil, use value of LaTeX-equation-label: - (unless LaTeX-amsmath-label - (setq LaTeX-amsmath-label LaTeX-equation-label)) - - (setq LaTeX-label-alist - (append '(("align" . LaTeX-amsmath-label) - ("alignat" . LaTeX-amsmath-label) - ("xalignat" . LaTeX-amsmath-label) - ("multline" . LaTeX-amsmath-label) - ("flalign" . LaTeX-amsmath-label) - ("gather" . LaTeX-amsmath-label)) - LaTeX-label-alist)) - - ;; amsmath includes amstext, amsbsy, & amsopn. - ;; So we run their hooks, too. - (TeX-run-style-hooks "amstext" "amsbsy" "amsopn") - - ;; If RefTeX is loaded, make it recognize the amsmath environments. - (when (fboundp 'reftex-add-to-label-alist) - (reftex-add-to-label-alist '(AMSTeX)))))) - -(defun LaTeX-amsmath-env-alignat (env) - (let ((ncols (read-string "Number of columns: "))) - (LaTeX-insert-environment env (concat TeX-grop ncols TeX-grcl)) - (and (not (string= "xxalignat" env)) - (not (string= "*" (substring env -1))) - (LaTeX-label env) - (newline-and-indent)))) - -(defun LaTeX-amsmath-env-aligned (env) - (let ((where (read-string "(optional) Vertical position (t or b): "))) - (if (string= where "") - (setq where "") - (setq where (concat "[" where "]"))) - (LaTeX-insert-environment env where))) - -(defun LaTeX-item-equation () - (end-of-line 0) - (just-one-space) - (insert "\\\\") - (forward-line 1) - (indent-according-to-mode)) - -(defun LaTeX-item-equations () - (LaTeX-item-equation) - (let ((environment (LaTeX-current-environment 1))) - (and (LaTeX-label environment) - (newline-and-indent)))) - -(defvar LaTeX-amsmath-package-options '("intlimits" "nointlimits" - "sumlimits" "nosumlimits" - "namelimits" "nonamelimits" - "leqno" "reqno" "centertags" - "tbtags" "cmex10" "fleqn" "?") - "Package options for the amsmath package.") - -;;; amsmath.el ends here. diff --git a/packages/auctex/style/amsopn.el b/packages/auctex/style/amsopn.el deleted file mode 100644 index 1e875d8a7..000000000 --- a/packages/auctex/style/amsopn.el +++ /dev/null @@ -1,19 +0,0 @@ -;;; amsopn.el --- Style hook for the AMS-LaTeX amsopn package. -;;; -;;; AUTHOR: Carsten Dominik - -;;; Code: - -(TeX-add-style-hook "amsopn" - (function - (lambda () - (TeX-add-symbols - '("DeclareMathOperator" "Operator (with \\)" "Text") - '("DeclareMathOperator*" "Operator (with \\)" "Text") - '("operatorname" t) - '("operatorname*" t))))) - -(defvar LaTeX-amsopn-package-options '("namelimits" "nonamelimits") - "Package options for the amsopn package.") - -;;; amsopn.el ends here. diff --git a/packages/auctex/style/amstex.el b/packages/auctex/style/amstex.el deleted file mode 100644 index 347d72f0c..000000000 --- a/packages/auctex/style/amstex.el +++ /dev/null @@ -1,60 +0,0 @@ -;;; amstex.el --- AMS-LaTeX support. - -;; Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -;; Maintainer: auctex-devel@gnu.org -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file is only needed when using AMS-LaTeX 1.1 and LaTeX 2.09. -;; In later versions of LaTeX and AMS-LaTeX this file is never used, -;; because there is no longer a class or package name amstex. -;; -;; As far as AUCTeX is concerned, the old amstex style is fairly -;; similar to the new amsmath package. So we will just run that hook -;; here. -;; -;; amsmath.el should not be loaded, if an AMS-TeX (in contrast to -;; AMS-LaTeX) file is opened. The commands defined in amsmath.el -;; mostly have no meaning in this case and errors about unknown -;; variables or functions may occur due to latex.el possibly not being -;; loaded. - -;;; Code: - -(TeX-add-style-hook - "amstex" - (function - (lambda () - (unless (memq major-mode '(plain-tex-mode ams-tex-mode)) - (TeX-run-style-hooks "amsmath"))))) - -(defvar LaTeX-amstex-package-options '("noamsfonts" "psamsfonts" - "intlimits" "nointlimits" - "sumlimits" "nosumlimits" - "namelimits" "nonamelimits" - "leqno" "reqno" "centertags" - "tbtags" "fleqn" "righttag" - "ctagsplt" "intlim" "nosumlim" - "nonamelm") - "Package options for the amstex package.") - -;;; amstex.el ends here. diff --git a/packages/auctex/style/amstext.el b/packages/auctex/style/amstext.el deleted file mode 100644 index a9aa85575..000000000 --- a/packages/auctex/style/amstext.el +++ /dev/null @@ -1,16 +0,0 @@ -;;; amstext.el --- Style hook for the AMS-LaTeX amstext package. -;;; -;;; AUTHOR: Carsten Dominik - -;;; Code: - -(TeX-add-style-hook "amstext" - (function - (lambda () - (TeX-add-symbols - '("text" t))))) - -(defvar LaTeX-amstext-package-option nil - "Package options for the amstext package.") - -;;; amstext.el ends here. diff --git a/packages/auctex/style/amsthm.el b/packages/auctex/style/amsthm.el deleted file mode 100644 index 99030409b..000000000 --- a/packages/auctex/style/amsthm.el +++ /dev/null @@ -1,53 +0,0 @@ -;;; amsthm.el --- Style hook for the AMS-LaTeX amsthm package. - -;; Copyright (C) 1997 Free Software Foundation, Inc. - -;; Author: Carsten Dominik -;; Maintainer: auctex-devel@gnu.org - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Code: - -(TeX-add-style-hook "amsthm" - (function - (lambda () - (LaTeX-add-environments - '("proof" (lambda (env &rest ignore) - (LaTeX-insert-environment - env - (let ((heading (read-string "(optional) Heading: "))) - (if (string= heading "") - "" - (format "[%s]" heading)))))) - ) - (TeX-add-symbols - '("newtheorem" "Environment name" ["Share numbering with"] "Heading" - ["Number subordinated in each"]) - '("newtheorem*" "Environment name" "Heading") - '("theoremstyle" LaTeX-amsthm-complete-theoremstyle) - )))) - -(defun LaTeX-amsthm-complete-theoremstyle (&rest ignore) - (insert TeX-grop - (completing-read "Style: " '(("plain" . nil) - ("definition" . nil) - ("remark" . nil))) - TeX-grcl)) - -;;; amsthm.el ends here diff --git a/packages/auctex/style/article.el b/packages/auctex/style/article.el deleted file mode 100644 index 937fa4734..000000000 --- a/packages/auctex/style/article.el +++ /dev/null @@ -1,12 +0,0 @@ -;;; article.el - Special code for article style. - -;; $Id: article.el,v 1.4 2005/03/17 10:02:06 angeli Exp $ - -;;; Code: - -(TeX-add-style-hook - "article" - (lambda () - (LaTeX-largest-level-set "section"))) - -;;; article.el ends here diff --git a/packages/auctex/style/austrian.el b/packages/auctex/style/austrian.el deleted file mode 100644 index 13f28a863..000000000 --- a/packages/auctex/style/austrian.el +++ /dev/null @@ -1,39 +0,0 @@ -;;; austrian.el --- AUCTeX style for the `austrian' babel option. - -;; Copyright (C) 2009 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2009-12-28 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; Set up AUCTeX for editing Austrian text in connection with the -;; `austrian' babel option. - -;;; Code: - -(TeX-add-style-hook - "austrian" - (lambda () - (TeX-run-style-hooks "german"))) - -;;; austrian.el ends here diff --git a/packages/auctex/style/babel.el b/packages/auctex/style/babel.el deleted file mode 100644 index 3242d0e65..000000000 --- a/packages/auctex/style/babel.el +++ /dev/null @@ -1,108 +0,0 @@ -;;; babel.el --- AUCTeX style for `babel.sty' - -;; Copyright (C) 2005 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2005-05-29 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `babel.sty'. - -;;; Code: - -(defvar LaTeX-babel-language-list - '("acadian" "afrikaans" "american" "austrian""bahasa" "basque" "brazil" - "brazilian" "breton" "british" "bulgarian" "canadian" "canadien" - "catalan" "croatian" "czech" "danish" "dutch" "english" "esperanto" - "estonian" "finnish" "francais" "frenchb" "french" "galician" - "german" "germanb" "greek" "polutonikogreek" "hebrew" "hungarian" - "icelandic" "irish" "italian" "latin" "lowersorbian" "magyar" - "naustrian" "ngerman" "norsk" "samin" "nynorsk" "polish" "portuges" - "portuguese" "romanian" "russian" "scottish" "serbian" "slovak" - "slovene" "spanish" "swedish" "turkish" "ukrainian" "uppersorbian" - "welsh" "UKenglish" "USenglish") - "List of languages supported by the babel LaTeX package.") - -(if (fboundp 'defvaralias) - (defvaralias 'LaTeX-babel-package-options 'LaTeX-babel-language-list) - (defvar LaTeX-babel-package-options LaTeX-babel-language-list - "Package options for the babel package.")) - -(defun LaTeX-babel-active-languages () - "Return a list of languages used in the document." - (let (active-languages) - (dolist (elt LaTeX-babel-language-list) - (when (member elt TeX-active-styles) - (add-to-list 'active-languages (list elt)))) - active-languages)) - -(defun TeX-arg-babel-lang (optional &optional prompt) - "Prompt for a language with completion and insert it as an argument." - (TeX-argument-insert - (completing-read "Language: " (LaTeX-babel-active-languages)) nil)) - -(defun LaTeX-env-babel-lang (env) - "Prompt for a language and insert it as an argument of ENV." - (LaTeX-insert-environment - env (format "{%s}" (completing-read "Language: " - (LaTeX-babel-active-languages))))) - -(TeX-add-style-hook - "babel" - (lambda () - ;; New symbols - (TeX-add-symbols - '("selectlanguage" TeX-arg-babel-lang) - '("foreignlanguage" TeX-arg-babel-lang t) - "languagename" - '("iflanguage" TeX-arg-babel-lang t nil) - '("useshorthands" t) - '("defineshorthand" t nil) - '("aliasshorthand" t nil) - '("languageshorthands" TeX-arg-babel-lang) - '("shorthandon" t) - '("shorthandoff" t) - '("languageattribute" TeX-arg-babel-lang t)) - ;; New environments - (LaTeX-add-environments - '("otherlanguage" LaTeX-env-babel-lang) - '("otherlanguage*" LaTeX-env-babel-lang) - '("hyphenrules" LaTeX-env-babel-lang)) - ;; Fontification - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("selectlanguage" "{") - ("foreignlanguage" "{{") - ("iflanguage" "{{{") - ("languagename" "") - ("useshorthands" "{") - ("languageshorthands" "{") - ("shorthandon" "{") - ("shorthandoff" "{")) - 'function) - (font-latex-add-keywords '(("defineshorthand" "{{") - ("aliasshorthand" "{{") - ("languageattribute" "{{")) - 'variable)))) - -;;; babel.el ends here diff --git a/packages/auctex/style/beamer.el b/packages/auctex/style/beamer.el deleted file mode 100644 index 7b911cd4b..000000000 --- a/packages/auctex/style/beamer.el +++ /dev/null @@ -1,334 +0,0 @@ -;;; beamer.el --- AUCTeX style for the latex-beamer class - -;; Copyright (C) 2003, 2004, 2005,2008 Free Software Foundation - -;; Author: Thomas Baumann -;; Created: 2003-12-20 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for the latex-beamer class. - -;;; Code: - -(defun LaTeX-beamer-after-insert-env (env start end) - "Do beamer-specific stuff after the insertion of an environment." - ;; Add `fragile' as an optional argument to the frame environment if - ;; a verbatim environment is inserted. - (when (and (TeX-member env (LaTeX-verbatim-environments) 'string-equal) - (save-excursion - (goto-char start) - (string-equal (LaTeX-current-environment) "frame"))) - (save-excursion - (when (re-search-backward "\\\\begin[ \t]*{frame}" nil t) - (let ((end-of-begin (match-end 0))) - (goto-char end-of-begin) - (while (forward-comment 1)) - (if (eq (char-after) (string-to-char LaTeX-optop)) - (progn - (forward-char) - (insert "fragile") - (unless (looking-at (concat "[ \t]*" LaTeX-optcl)) - (insert ","))) - (goto-char end-of-begin) - (insert "[fragile]"))))))) - -(TeX-add-style-hook - "beamer" - (lambda () - (add-hook 'LaTeX-after-insert-env-hooks 'LaTeX-beamer-after-insert-env nil t) - - (unless LaTeX-beamer-section-labels-flag - (make-local-variable 'LaTeX-section-hook) - (setq LaTeX-section-hook - '(LaTeX-section-heading - LaTeX-section-title - LaTeX-section-section))) - - (setq LaTeX-item-list - (append '(("itemize" . LaTeX-item-beamer) - ("enumerate" . LaTeX-item-beamer)) - LaTeX-item-list)) - - (LaTeX-paragraph-commands-add-locally "frametitle") - - (TeX-add-symbols - '("alert" 1) - '("alt" TeX-arg-beamer-overlay-spec 2) - '("beamerbutton" 1) - '("beamergotobutton" 1) - '("beamerreturnbutton" 1) - '("beamerskipbutton" 1) - '("frame" TeX-arg-beamer-frametitle) - '("frametitle" 1) - '("hyperlink" TeX-arg-beamer-overlay-spec 2) - '("hyperlinkslideprev" TeX-arg-beamer-overlay-spec 1) - '("hyperlinkslidenext" TeX-arg-beamer-overlay-spec 1) - '("hyperlinkframestart" TeX-arg-beamer-overlay-spec 1) - '("hyperlinkframeend" TeX-arg-beamer-overlay-spec 1) - '("hyperlinkframestartnext" TeX-arg-beamer-overlay-spec 1) - '("hyperlinkframeendprev" TeX-arg-beamer-overlay-spec 1) - '("hyperlinkpresentationstart" TeX-arg-beamer-overlay-spec 1) - '("hyperlinkpresentationend" TeX-arg-beamer-overlay-spec 1) - '("hyperlinkappendixstart" TeX-arg-beamer-overlay-spec 1) - '("hyperlinkappendixend" TeX-arg-beamer-overlay-spec 1) - '("hyperlinkdocumentstart" TeX-arg-beamer-overlay-spec 1) - '("hyperlinkdocumentend" TeX-arg-beamer-overlay-spec 1) - '("hypertarget" TeX-arg-beamer-overlay-spec 2) - '("institute" 1) - '("invisible" TeX-arg-beamer-overlay-spec 1) - '("label" TeX-arg-beamer-overlay-spec 1) - '("logo" 1) - '("note" TeX-arg-beamer-note 1) - '("only" TeX-arg-beamer-overlay-spec 1) - '("onslide" TeX-arg-beamer-overlay-spec) - '("partpage") - '("pause") - '("structure" TeX-arg-beamer-overlay-spec 1) - '("temporal" TeX-arg-beamer-overlay-spec 3) - '("titlepage") - '("titlegraphic" 1) - '("uncover" TeX-arg-beamer-overlay-spec 1) - '("usetheme" LaTeX-arg-beamer-theme) - '("useinnertheme" LaTeX-arg-beamer-inner-theme) - '("useoutertheme" LaTeX-arg-beamer-outer-theme) - '("usecolortheme" LaTeX-arg-beamer-color-theme) - '("usefonttheme" LaTeX-arg-beamer-font-theme) - '("usetheme" LaTeX-arg-beamer-theme) - '("visible" TeX-arg-beamer-overlay-spec 1)) - - (LaTeX-add-environments - '("actionenv") - '("alertblock" 1) - '("beamerboxesrounded" 1) - '("block" 1) - '("column" "Width") - "columns" - "columnsonlytextwidth" - '("exampleblock" 1) - '("frame" (lambda (env &rest ignore) - (let ((title (read-string "(Optional) Title: "))) - (LaTeX-insert-environment env) - (unless (zerop (length title)) - (save-excursion - (LaTeX-find-matching-begin) - (end-of-line) - (LaTeX-newline) - (insert (format "\\frametitle{%s}" title)) - ;; This works because \frametitle is a - ;; paragraph command. - (backward-char) - (LaTeX-fill-paragraph)))))) - '("onlyenv" (lambda (env &rest ignore) - (LaTeX-insert-environment - env - (let ((overlay (read-string "(Optional) Overlay: "))) - (unless (zerop (length overlay)) - (format "<%s>" overlay)))))) - '("overlayarea" "Area width" "Area height") - '("overprint" (lambda (env &rest ignore) - (LaTeX-insert-environment - env - (let ((width (read-string "(Optional) Area width: "))) - (unless (zerop (length width)) - (format "[%s]" width)))))) - "semiverbatim") - - (make-local-variable 'LaTeX-indent-environment-list) - (add-to-list 'LaTeX-indent-environment-list - '("semiverbatim" current-indentation)) - (make-local-variable 'LaTeX-verbatim-regexp) - (setq LaTeX-verbatim-regexp (concat LaTeX-verbatim-regexp "\\|semiverbatim")) - (add-to-list 'LaTeX-verbatim-environments-local "semiverbatim") - - ;; Fontification - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("frametitle" "<[{")) 'slide-title) - ;; For syntactic fontification, e.g. verbatim constructs. - (font-latex-set-syntactic-keywords) - ;; Tell font-lock about the update. - (setq font-lock-set-defaults nil) - (font-lock-set-defaults)))) - -(defun TeX-arg-beamer-overlay-spec (optional &optional prompt) - "Prompt for overlay specification." - (let ((overlay (read-string "(Optional) Overlay: "))) - (unless (zerop (length overlay)) - (insert "<" overlay ">")) - (indent-according-to-mode))) - -(defun TeX-arg-beamer-frametitle (optional &optional prompt) - "Prompt for the frametitle." - (let ((title (read-string "Title: "))) - (if (not (zerop (length title))) - (insert TeX-grop TeX-esc "frametitle" TeX-grop - title TeX-grcl TeX-grcl) - (insert TeX-grop TeX-grcl)))) - -(defun LaTeX-item-beamer () - "Insert a new item with an optional overlay argument. You -can turn off the prompt for the overlay argument by setting -`LaTeX-beamer-item-overlay-flag' to nil. Calling the function -with a prefix argument prompts for the overlay specification -unconditionally." - (if (listp current-prefix-arg) - (setq current-prefix-arg (car current-prefix-arg)) - current-prefix-arg) - (TeX-insert-macro "item") - (delete-horizontal-space) - (if (or current-prefix-arg LaTeX-beamer-item-overlay-flag) - (TeX-arg-beamer-overlay-spec 0)) - (insert " ") - (indent-according-to-mode)) - -(defun TeX-arg-beamer-note (optional &optional prompt) - "Prompt for overlay specification and optional argument." - (let ((overlay (read-string "(Optional) Overlay: ")) - (options (read-string "(Optional) Options: "))) - (unless (zerop (length overlay)) - (insert "<" overlay ">")) - (unless (zerop (length options)) - (insert "[" options "]")) - (indent-according-to-mode))) - -(defun LaTeX-beamer-search-themes (&optional regexp extensions length) - "Search for beamer themes matching REGEXP with EXTENSIONS. -The function removes the first LENGTH characters and the -extension of the file and returns a list of strings. LENGTH may -also be a string. Then the length of the string is used." - (let* ((match (or regexp "^beamertheme[A-Z]")) - (exts (or extensions '("tex" "sty"))) - (chars (cond ((integerp length) - length) - ((stringp length) - (string-width length)) - ;; Try some DWIM magic... - ((and (not length) - (string-match "beamer[A-Za-z0-9]*theme" match)) - (- (match-end 0) (match-beginning 0))) - (t (error "Invalid length: `%s'" length))))) - ;; (message "match=`%s' chars=`%s'" match chars) - (TeX-delete-duplicate-strings - (delete nil - (mapcar - (lambda (file) - (let ((case-fold-search nil)) - (and (numberp (string-match match file)) - (substring file chars)))) - (TeX-search-files nil exts t t)))))) - -(defun LaTeX-arg-beamer-theme (&rest ignore) - "Prompt for beamer theme with completion." - (TeX-argument-insert - (completing-read - (TeX-argument-prompt nil nil "Theme") - (mapcar 'list - (cond ((eq LaTeX-beamer-themes 'local) - (set (make-local-variable 'LaTeX-beamer-themes) - (LaTeX-beamer-search-themes))) - ((functionp LaTeX-beamer-themes) - (funcall LaTeX-beamer-themes)) - ((listp LaTeX-beamer-themes) - LaTeX-beamer-themes) - (t (error - "`LaTeX-beamer-themes' should be a list: `%s'" - LaTeX-beamer-themes)))) - nil nil nil) - t)) - -(defun LaTeX-arg-beamer-inner-theme (&rest ignore) - "Prompt for beamer inner theme with completion." - (TeX-argument-insert - (completing-read - (TeX-argument-prompt nil nil "Theme") - (mapcar 'list - (cond ((eq LaTeX-beamer-inner-themes 'local) - (set (make-local-variable 'LaTeX-beamer-inner-themes) - (LaTeX-beamer-search-themes "^beamerinnertheme"))) - ((functionp LaTeX-beamer-inner-themes) - (funcall LaTeX-beamer-inner-themes)) - ((listp LaTeX-beamer-inner-themes) - LaTeX-beamer-inner-themes) - (t (error - "`LaTeX-beamer-inner-themes' should be a list: `%s'" - LaTeX-beamer-inner-themes)))) - nil nil nil) - t)) - -(defun LaTeX-arg-beamer-outer-theme (&rest ignore) - "Prompt for beamer outer theme with completion." - (TeX-argument-insert - (completing-read - (TeX-argument-prompt nil nil "Theme") - (mapcar 'list - (cond ((eq LaTeX-beamer-outer-themes 'local) - (set (make-local-variable 'LaTeX-beamer-outer-themes) - (LaTeX-beamer-search-themes "^beameroutertheme"))) - ((functionp LaTeX-beamer-outer-themes) - (funcall LaTeX-beamer-outer-themes)) - ((listp LaTeX-beamer-outer-themes) - LaTeX-beamer-outer-themes) - (t (error - "`LaTeX-beamer-outer-themes' should be a list: `%s'" - LaTeX-beamer-outer-themes)))) - nil nil nil) - t)) - -(defun LaTeX-arg-beamer-color-theme (&rest ignore) - "Prompt for beamer color theme with completion." - (TeX-argument-insert - (completing-read - (TeX-argument-prompt nil nil "Theme") - (mapcar 'list - (cond ((eq LaTeX-beamer-color-themes 'local) - (set (make-local-variable 'LaTeX-beamer-color-themes) - (LaTeX-beamer-search-themes "^beamercolortheme"))) - ((functionp LaTeX-beamer-color-themes) - (funcall LaTeX-beamer-color-themes)) - ((listp LaTeX-beamer-color-themes) - LaTeX-beamer-color-themes) - (t (error - "`LaTeX-beamer-color-themes' should be a list: `%s'" - LaTeX-beamer-color-themes)))) - nil nil nil) - t)) - -(defun LaTeX-arg-beamer-font-theme (&rest ignore) - "Prompt for beamer font theme with completion." - (TeX-argument-insert - (completing-read - (TeX-argument-prompt nil nil "Theme") - (mapcar 'list - (cond ((eq LaTeX-beamer-font-themes 'local) - (set (make-local-variable 'LaTeX-beamer-font-themes) - (LaTeX-beamer-search-themes "^beamerfonttheme"))) - ((functionp LaTeX-beamer-font-themes) - (funcall LaTeX-beamer-font-themes)) - ((listp LaTeX-beamer-font-themes) - LaTeX-beamer-font-themes) - (t (error - "`LaTeX-beamer-font-themes' should be a list: `%s'" - LaTeX-beamer-font-themes)))) - nil nil nil) - t)) - -;;; beamer.el ends here diff --git a/packages/auctex/style/book.el b/packages/auctex/style/book.el deleted file mode 100644 index 7b028e528..000000000 --- a/packages/auctex/style/book.el +++ /dev/null @@ -1,12 +0,0 @@ -;;; book.el - Special code for book style. - -;; $Id: book.el,v 1.5 2005/03/17 10:02:06 angeli Exp $ - -;;; Code: - -(TeX-add-style-hook - "book" - (lambda () - (LaTeX-largest-level-set "chapter"))) - -;;; book.el ends here diff --git a/packages/auctex/style/booktabs.el b/packages/auctex/style/booktabs.el deleted file mode 100644 index e12687228..000000000 --- a/packages/auctex/style/booktabs.el +++ /dev/null @@ -1,74 +0,0 @@ -;;; booktabs.el -- AUCTeX style for booktabs.sty - -;; Copyright (C) 2003, 2004 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2003-10-21 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `booktabs.sty'. - -;;; Code: - -(defun LaTeX-booktabs-arg-paren (optional prompt) - "Prompt for a value and use parentheses when it is inserted. -If OPTIONAL is non-nil the parameter is labeled as optional. -PROMPT is the value of the prompt to be shown." - (let ((< "\(") - (> "\)")) - (TeX-parse-argument optional prompt))) - -(TeX-add-style-hook - "booktabs" - (lambda () - - ;; New symbols - (TeX-add-symbols - '("toprule" [ "Thickness" ]) - '("midrule" [ "Thickness" ]) - '("bottomrule" [ "Thickness" ]) - ;; FIXME: The qestion for the trim parameter will only be asked if - ;; a value for the thickness parameter was given. Is this a - ;; feature of `TeX-parse-arguments'? - '("cmidrule" [ "Thickness" ] [ LaTeX-booktabs-arg-paren "Trim" ] - "Column(s)") - '("addlinespace" [ "Height" ]) - '("morecmidrules") - '("specialrule" "Thickness" "Space above" "Space below")) - - ;; Fontification - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("toprule" "[") - ("midrule" "[") - ("bottomrule" "[") - ("cmidrule" "[({") - ("addlinespace" "[") - ("morecmidrules" "") - ("specialrule" "{{{")) - 'function)))) - -(defvar LaTeX-booktabs-package-options nil - "Package options for the booktabs package.") - -;;; booktabs.el ends here diff --git a/packages/auctex/style/bulgarian.el b/packages/auctex/style/bulgarian.el deleted file mode 100644 index 3eb0144b8..000000000 --- a/packages/auctex/style/bulgarian.el +++ /dev/null @@ -1,52 +0,0 @@ -;;; bulgarian.el --- AUCTeX style for the `bulgarian' babel option. - -;; Copyright (C) 2008 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2008-06-28 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; Set up AUCTeX for editing Bulgarian text in connection with the -;; `bulgarian' babel option. - -;;; Code: - -(defvar LaTeX-bulgarian-mode-syntax-table - (copy-syntax-table LaTeX-mode-syntax-table) - "Syntax table used in LaTeX mode when using `bulgarian.sty'.") - -(modify-syntax-entry ?\" "w" LaTeX-bulgarian-mode-syntax-table) - -(TeX-add-style-hook - "bulgarian" - (lambda () - (set-syntax-table LaTeX-bulgarian-mode-syntax-table) - (setq TeX-quote-language `("bulgarian" "\"`" "\"'" ,TeX-quote-after-quote)) - (setq LaTeX-babel-hyphen-language "bulgarian") - ;; Fontification of quotation marks. - (when (fboundp 'font-latex-add-quotes) - (font-latex-add-quotes '("\"`" "\"'")) - (font-latex-add-quotes '("\"<" "\">" french))) - (run-hooks 'TeX-language-bg-hook))) - -;;; bulgarian.el ends here diff --git a/packages/auctex/style/captcont.el b/packages/auctex/style/captcont.el deleted file mode 100644 index ffa48bf28..000000000 --- a/packages/auctex/style/captcont.el +++ /dev/null @@ -1,46 +0,0 @@ -;; captcont.el --- AUCTeX style file for captcont.sty - -;; Copyright (C) 2003, 2005 Free Software Foundation, Inc. - -;; Author: Reiner Steib -;; Maintainer: auctex-devel@gnu.org -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; AUCTeX style file for captcont.sty - -;;; Code: - -(TeX-add-style-hook - "captcont" - (lambda () - (TeX-add-symbols - '("captcont" [ "list entry" ] "Caption") - '("captcont*" [ "list entry" ] "Caption")) - ;; Fontification - (when (featurep 'font-latex) - (font-latex-add-keywords '(("captcont" "*[{")) 'textual)))) - -(defvar LaTeX-captcont-package-options '("figbotcap" "figtopcap" "tabbotcap" - "tabtopcap") - "Package options for the captcont package.") - -;;; captcont.el ends here diff --git a/packages/auctex/style/comment.el b/packages/auctex/style/comment.el deleted file mode 100644 index c842d206b..000000000 --- a/packages/auctex/style/comment.el +++ /dev/null @@ -1,69 +0,0 @@ -;;; comment.el --- AUCTeX style for `comment.sty' - -;; Copyright (C) 2007 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2007-03-18 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -;; 02111-1307, USA. - -;;; Commentary: - -;; This file adds support for `comment.sty'. - -;;; Code: - -(TeX-add-style-hook - "comment" - (lambda () - ;; New symbols - (TeX-add-symbols - '("includecomment" "Name") - '("excludecomment" "Name") - '("specialcomment" "Name" "Before commands" "After commands") - '("processcomment" "Name" "Each-line commands" - "Before commands" "After commands")) - ;; New environments - (mapc 'LaTeX-add-environments LaTeX-comment-env-list) - ;; Fontification - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - ;; For syntactic fontification. - (add-to-list 'font-latex-syntactic-keywords-extra - ;; \begin is supposed to start at the beginning of a line. - `(,(format "^\\\\begin *{\\(?:%s\\)}.*\\(\n\\)" - (regexp-opt LaTeX-comment-env-list)) - (1 "<" t))) - (add-to-list 'font-latex-syntactic-keywords-extra - ;; \end is supposed to start at the beginning of a line. - `(,(format "^\\(\\\\\\)end *{\\(?:%s\\)}" - (regexp-opt LaTeX-comment-env-list)) - (1 ">" t))) - (font-latex-set-syntactic-keywords) - (font-latex-add-keywords '(("includecomment" "{") - ("excludecomment" "{") - ("specialcomment" "{{{") - ("processcomment" "{{{{")) - 'variable) - ;; Tell font-lock about the update. - (setq font-lock-set-defaults nil) - (font-lock-set-defaults)))) - -;;; comment.el ends here diff --git a/packages/auctex/style/csquotes.el b/packages/auctex/style/csquotes.el deleted file mode 100644 index 50aa1f97e..000000000 --- a/packages/auctex/style/csquotes.el +++ /dev/null @@ -1,245 +0,0 @@ -;;; csquotes.el --- AUCTeX style for `csquotes.sty' - -;; Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2004-11-29 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `csquotes.sty', version 3.7. - - -;;; Code: - -;; FIXME: It would be nice to be able to dump this function in favor -;; of a generalized handling of additional arguments for environments -;; specified via `LaTeX-add-environments'. `TeX-parse-arguments' and -;; friends would be the functions to be used for that, but those -;; functions currently insert text directly into the buffer. There -;; would either have to be a way of preventing this and letting them -;; return a string, or the insertion could happen in a temporary buffer -;; and the buffer content be returned. -(defun LaTeX-csquotes-insert-environment (env &rest args) - "Insert environment ENV considering optional arguments ARGS. - -This is basically a variant of `LaTeX-environment-menu' -specialized for csquotes.el. ARGS can be made up of strings and -vectors containing single strings. Plain strings will be used as -prompts for mandatory arguments and strings in vectors as prompts -for optional arguments of the environment to be inserted. - -That means, in contrast to `LaTeX-environment-menu' it supports -the insertion of optional arguments." - (let (env-extra prompt optional user-input) - (dolist (elt args) - (if (vectorp elt) - (setq prompt (aref elt 0) - optional t) - (setq prompt elt - optional nil)) - (setq user-input (read-string (TeX-argument-prompt optional prompt nil))) - (unless (and optional (zerop (length user-input))) - (setq env-extra (concat env-extra - (if optional LaTeX-optop TeX-grop) - user-input - (if optional LaTeX-optcl TeX-grcl))))) - (LaTeX-insert-environment env env-extra))) - -(TeX-add-style-hook - "csquotes" - (lambda () - (let ((quote-style-variant-list '(("quotes") ("guillemets") ("american") - ("british") ("oldstyle") ("imprimerie") - ("swiss"))) - (quote-style-name-list '(("danish") ("dutch") ("english") ("finnish") - ("french") ("german") ("italian") - ("norwegian") ("swedish")))) - ;; New symbols - (TeX-add-symbols - '("enquote" 1) - '("enquote*" 1) - '("foreignquote" 2) - '("foreignquote*" 2) - '("hyphenquote" 2) - '("hyphenquote*" 2) - '("textquote" ["Citation"] ["Punctuation"] t) - '("textquote*" ["Citation"] ["Punctuation"] t) - '("foreigntextquote" "Language" ["Citation"] ["Punctuation"] t) - '("foreigntextquote*" "Language" ["Citation"] ["Punctuation"] t) - '("hyphentextquote" "Language" ["Citation"] ["Punctuation"] t) - '("hyphentextquote*" "Language" ["Citation"] ["Punctuation"] t) - '("blockquote" ["Citation"] ["Punctuation"] t) - '("foreignblockquote" "Language" ["Citation"] ["Punctuation"] t) - '("hyphenblockquote" "Language" ["Citation"] ["Punctuation"] t) - `("setquotestyle" - [ (TeX-arg-eval completing-read "Quote style variant: " - ',quote-style-variant-list) ] - (TeX-arg-eval completing-read "Quote style name or alias: " - ',quote-style-name-list)) - "setquotestyle*" - '("MakeInnerQuote" "Character") - '("MakeOuterQuote" "Character") - '("MakeAutoQuote" "Opening quotation mark" "Closing quotation mark") - '("MakeAutoQuote*" "Opening quotation mark" "Closing quotation mark") - '("MakeForeignQuote" "Babel's language name" - "Opening quotation mark" "Closing quotation mark") - '("MakeForeignQuote*" "Babel's language name" - "Opening quotation mark" "Closing quotation mark") - '("MakeHyphenQuote" "Babel's language name" - "Opening quotation mark" "Closing quotation mark") - '("MakeHyphenQuote" "Babel's language name" - "Opening quotation mark" "Closing quotation mark") - '("MakeBlockQuote" "Opening quotation mark" "Delimiter for citation" - "Closing quotation mark") - '("MakeForeignBlockQuote" "Language" "Opening quotation mark" - "Delimiter for citation" "Closing quotation mark") - '("MakeHyphenBlockQuote" "Language" "Opening quotation mark" - "Delimiter for citation" "Closing quotation mark") - "EnableQuotes" - "DisableQuotes" - "VerbatimQuotes" - "DeleteQuotes" - '("textcquote" ["Pre-note"] ["Post-note"] "Key" ["Punctuation"] t) - '("textcquote*" ["Pre-note"] ["Post-note"] "Key" ["Punctuation"] t) - '("foreigntextcquote" "Language" ["Pre-note"] ["Post-note"] "Key" - ["Punctuation"] t) - '("foreigntextcquote*" "Language" ["Pre-note"] ["Post-note"] "Key" - ["Punctuation"] t) - '("hyphentextcquote" "Language" ["Pre-note"] ["Post-note"] "Key" - ["Punctuation"] t) - '("hyphentextcquote*" "Language" ["Pre-note"] ["Post-note"] "Key" - ["Punctuation"] t) - '("blockcquote" ["Pre-note"] ["Post-note"] "Key" ["Punctuation"] t) - '("foreignblockcquote" "Language" ["Pre-note"] ["Post-note"] "Key" - ["Punctuation"] t) - '("hyphenblockcquote" "Language" ["Pre-note"] ["Post-note"] "Key" - ["Punctuation"] t) - `("DeclareQuoteStyle" - [ (TeX-arg-eval completing-read "Quote style variant: " - ',quote-style-variant-list) ] - (TeX-arg-eval completing-read "Quote style name: " - ',quote-style-name-list) - ["Outer quote initialization"] ["Inner quote initialization"] - "Opening outer quotation mark" ["Middle outer quotation mark"] - "Closing outer quotation mark" ["Kerning between adjoining marks"] - "Opening inner quotation mark" ["Middle inner quotation mark"] - "Closing inner quotation mark") - `("DeclareQuoteAlias" - [ (TeX-arg-eval completing-read "Quote style variant: " - ',quote-style-variant-list) ] - (TeX-arg-eval completing-read "Quote style name: " - ',quote-style-name-list) - "Alias name") - '("DeclareQuoteOption" 1) - '("ExecuteQuoteOptions" 1) - '("DeclarePlainStyle" "Opening outer quotation mark" - "Closing outer quotation mark" "Opening inner quotation mark" - "Closing inner quotation mark") - '("SetBlockThreshold" "Number of lines") - '("SetBlockEnvironment" "Environment") - '("SetCiteCommand" "Command") - "mkcitation" - "mkccitation" - "mkpreblockpunct" - "mkmidblockpunct" - "mkfinblockpunct" - "mkpretextpunct" - "mkmidtextpunct" - "mkfintextpunct" - "mkpredisppunct" - "mkmiddisppunct" - "mkfindisppunct" - '("ifblockquote" 2) - '("ifquotepunct" 2) - '("ifquoteterm" 2) - '("ifquoteperiod" 2) - '("ifquotecomma" 2) - '("ifquotesemicolon" 2) - '("ifquotecolon" 2) - '("ifquoteexclam" 2) - '("ifquotequestion" 2) - '("ifstringblank" 2) - '("BlockquoteDisable" 1)) - ;; New environments - (LaTeX-add-environments - "quoteblock" - "quotetext" - '("displayquote" LaTeX-csquotes-insert-environment ["Citation"] - ["Punctuation"]) - '("foreigndisplayquote" LaTeX-csquotes-insert-environment "Language" - ["Citation"] ["Punctuation"]) - '("hyphendisplayquote" LaTeX-csquotes-insert-environment "Language" - ["Citation"] ["Punctuation"]) - '("displaycquote" LaTeX-csquotes-insert-environment - ["Pre-note"] ["Post-note"] "Key" ["Punctuation"]) - '("foreigndisplaycquote" LaTeX-csquotes-insert-environment - "Language" ["Pre-note"] ["Post-note"] "Key" ["Punctuation"]) - '("hyphendisplaycquote" LaTeX-csquotes-insert-environment - "Language" ["Pre-note"] ["Post-note"] "Key" ["Punctuation"])) - ;; Quotation marks - (when (and (> (length LaTeX-csquotes-open-quote) 0) - (> (length LaTeX-csquotes-close-quote) 0)) - (setq TeX-quote-language - `(override ,LaTeX-csquotes-open-quote ,LaTeX-csquotes-close-quote - ,LaTeX-csquotes-quote-after-quote))) - ;; Fontification - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("DisableQuotes" "") - ("RestoreQuotes" "")) - 'function) - (font-latex-add-keywords '(("enquote" "*{") - ("foreignquote" "*{{") - ("hyphenquote" "*{{") - ("textcquote" "*[[{[{") - ("foreigntextcquote" "*{[[{[{") - ("hyphentextcquote" "*{[[{[{") - ("textquote" "*[[{") - ("foreigntextquote" "*{[[{") - ("hyphentextquote" "*{[[{") - ("blockquote" "[[{") - ("foreignblockquote" "{[[{") - ("hyphenblockquote" "{[[{") - ("blockcquote" "[[{[{") - ("foreignblockcquote" "{[[{[{") - ("hyphenblockcquote" "{[[{[{")) - 'textual) - (font-latex-add-keywords '(("setquotestyle" "[{") - ("MakeOuterQuote" "{") - ("MakeInnerQuote" "{") - ("MakeAutoQuote" "*{{") - ("MakeForeignQuote" "*{{{") - ("MakeHyphenQuote" "*{{{") - ("MakeBlockQuote" "{{{") - ("MakeForeignBlockQuote" "{{{{") - ("MakeHyphenBlockQuote" "{{{{") - ("DeclareQuoteStyle" "[{[[{[{[{[{") - ("DeclareQuoteAlias" "[{{") - ("DeclareQuoteOption" "{") - ("DeclarePlainStyle" "{{{{") - ("SetBlockThreshold" "{") - ("SetBlockEnvironment" "{") - ("SetCiteCommand" "{")) - 'variable))))) - -;;; csquotes.el ends here diff --git a/packages/auctex/style/czech.el b/packages/auctex/style/czech.el deleted file mode 100644 index 4d8eb0b27..000000000 --- a/packages/auctex/style/czech.el +++ /dev/null @@ -1,7 +0,0 @@ -;;; czech.el --- Setup AUCTeX for editing Czech text. - -(TeX-add-style-hook - "czech" - (lambda () - (setq TeX-quote-language `("czech" "\\uv{" "}" ,TeX-quote-after-quote)) - (run-hooks 'TeX-language-cz-hook))) diff --git a/packages/auctex/style/danish.el b/packages/auctex/style/danish.el deleted file mode 100644 index 77a01642e..000000000 --- a/packages/auctex/style/danish.el +++ /dev/null @@ -1,16 +0,0 @@ -;;; danish.el --- Setup AUCTeX for editing Danish text. - -;;; Code: - -(TeX-add-style-hook - "danish" - (lambda () - (setq TeX-quote-language `("danish" "\"`" "\"'" ,TeX-quote-after-quote)) - (setq LaTeX-babel-hyphen-language "danish") - ;; Fontification of quotation marks. - (when (fboundp 'font-latex-add-quotes) - (font-latex-add-quotes '("\"`" "\"'")) - (font-latex-add-quotes '("\"<" "\">" french))) - (run-hooks 'TeX-language-dk-hook))) - -;;; danish.el ends here diff --git a/packages/auctex/style/dk-bib.el b/packages/auctex/style/dk-bib.el deleted file mode 100644 index 2ae7530a5..000000000 --- a/packages/auctex/style/dk-bib.el +++ /dev/null @@ -1,62 +0,0 @@ -;;; dk-bib.el --- AUCTeX style for `dk-bib.sty' - -;; Copyright (C) 2005 Free Software Foundation, Inc. - -;; Author: Arne Jørgensen -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -;; MA 02110-1301, USA. - -;;; Commentary: - -;; Prompt for package option for dk-bib.sty. - -;;; Code: - -(defun LaTeX-dk-bib-package-options nil - "Prompt for package options for the dk-bib package." - (let ((options - (mapconcat 'identity - (TeX-completing-read-multiple - "Options: " - '(("isbn") ("issn") ("url") ("annote") - ("printing") ("apalike") ("fixcitedash=false") - ("ordinals2word") ("ordinaldepth="))) - ",")) - (depth -1)) - (when (string-match "\\(ordinaldepth=\\)\\([^0-9]\\|$\\)" options) - (while (or (< depth 0) - (> depth 20)) - (setq depth (if (fboundp 'read-number) - (read-number "Ordinal depth: ") - (string-to-number (read-string "Ordinal depth: ")))) - (when (or (< depth 0) - (> depth 20)) - (message "Ordinal depth must be between 0 and 20") - (sit-for 1))) - (setq options (concat - (substring options 0 (match-end 1)) - (number-to-string depth) - (substring options (match-end 1))))) - options)) - -;; Local Variables: -;; coding: iso-8859-1 -;; End: - -;;; dk-bib.el ends here diff --git a/packages/auctex/style/dk.el b/packages/auctex/style/dk.el deleted file mode 100644 index b46feaf65..000000000 --- a/packages/auctex/style/dk.el +++ /dev/null @@ -1,11 +0,0 @@ -;;; dk.el - Setup AUC TeX for editing Danish text. - -;; $Id: dk.el,v 1.2 1993/12/15 21:42:40 amanda Exp $ - -;;; Code: - -(TeX-add-style-hook "dk" - (function (lambda () - (run-hooks 'TeX-language-dk-hook)))) - -;;; dk.el ends here diff --git a/packages/auctex/style/doc.el b/packages/auctex/style/doc.el deleted file mode 100644 index 3c7022013..000000000 --- a/packages/auctex/style/doc.el +++ /dev/null @@ -1,158 +0,0 @@ -;;; doc.el --- AUCTeX style for `doc.sty' - -;; Copyright (C) 2004, 2008 Free Software Foundation, Inc. - -;; Author: Frank Küster -;; Maintainer: auctex-devel@gnu.org -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `doc.sty'. - -;;; Code: - -(defun LaTeX-env-no-comment (environment) - "Insert ENVIRONMENT and make sure there is no commented empty line inside." - (LaTeX-insert-environment environment) - (unless (TeX-active-mark) - (when (save-excursion - (beginning-of-line) - (looking-at (concat "[ \t]+$\\|[ \t]*" - TeX-comment-start-regexp "+[ \t]*$"))) - (delete-region (line-beginning-position) (line-end-position)) - (indent-according-to-mode)))) - -(defun LaTeX-doc-after-insert-macrocode (env start end) - "Make sure the macrocode environment is properly formatted after insertion." - (when (TeX-member env '("macrocode" "macrocode*") 'string-equal) - (save-excursion - (goto-char end) - (skip-chars-backward " \t") - (when (bolp) - (insert "%") - (indent-according-to-mode)) - (goto-char start) - (skip-chars-backward " \t") - (when (bolp) - (insert "%") - (indent-according-to-mode))))) - -(TeX-add-style-hook - "doc" - (function - (lambda () - (add-to-list (make-local-variable 'LaTeX-indent-environment-list) - '("macrocode" current-indentation)) - (add-to-list 'LaTeX-indent-environment-list - '("macrocode*" current-indentation)) - (add-hook 'LaTeX-after-insert-env-hooks 'LaTeX-doc-after-insert-macrocode - nil t) - (LaTeX-add-environments - "theglossary" - '("macrocode" LaTeX-env-no-comment) - '("macrocode*" LaTeX-env-no-comment) - '("macro" "Macro")) - (TeX-add-symbols - "EnableCrossrefs" - "DisableCrossrefs" - "DoNotIndex" - "DontCheckModules" - "CheckModules" - "Module" - '("DescribeMacro" "Macro") - '("DescribeEnv" "Environment") - "verbatim" - "verb" - "parg" - "oarg" - "marg" - "meta" - "cmd" - "makelabel" - "MacroFont" - "MacroFont" - "AltMacroFont" - "AltMacroFont" - "PrintMacroName" - "PrintDescribeMacro" - "PrintDescribeEnv" - "PrintEnvName" - "MakePrivateLetters" - "actualchar" - "quotechar" - "levelchar" - "encapchar" - "verbatimchar" - "SpecialIndex" - "SpecialMainIndex" - "SpecialMainEnvIndex" - "SpecialUsageIndex" - "SpecialEnvIndex" - "SortIndex" - "LeftBraceIndex" - "RightBraceIndex" - "PercentIndex" - "OldMakeindex" - "PercentIndex" - "IndexPrologue" - "IndexParms" - "subitem" - "subsubitem" - "indexspace" - "efill" - "pfill" - "PrintIndex" - '("changes" "version" "date (YYYY/MM/DD)") - "generalname" - "RecordChanges" - "GlossaryPrologue" - "GlossaryParms" - "PrintChanges" - "AlsoImplementation" - "StopEventually" - "OnlyDescription" - "Finale" - "IndexInput" - "maketitle" - "MakeShortVerb" - "DeleteShortVerb" - "MakeShortverb" - "DeleteShortverb" - "CheckSum" - "CharacterTable" - "CharTableChanges" - "CodelineNumbered" - "CodelineIndex" - "PageIndex" - "theCodelineNo" - "theCodelineNo" - "DocstyleParms" - "MakePercentIgnore" - "MakePercentComment" - "DocInput" - "DocInclude" - "GetFileInfo" - "filename" - "fileinfo")))) - -;; Local Variables: -;; coding: iso-8859-1 -;; End: diff --git a/packages/auctex/style/dutch.el b/packages/auctex/style/dutch.el deleted file mode 100644 index c5f1cb548..000000000 --- a/packages/auctex/style/dutch.el +++ /dev/null @@ -1,11 +0,0 @@ -;;; dutch.el - Setup AUC TeX for editing Dutch text. - -;; $Id: dutch.el,v 1.2 1993/12/15 21:42:42 amanda Exp $ - -;;; Code: - -(TeX-add-style-hook "dutch" - (function (lambda () - (run-hooks 'TeX-language-nl-hook)))) - -;;; dutch.el ends here diff --git a/packages/auctex/style/emp.el b/packages/auctex/style/emp.el deleted file mode 100644 index 4e5f8674a..000000000 --- a/packages/auctex/style/emp.el +++ /dev/null @@ -1,84 +0,0 @@ -;;; emp.el --- AUCTeX support for emp.sty - -;; Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -;; Author: Yvon Henel aka TeXnicien de surface -;; Maintainer: auctex-devel@gnu.org -;; Keywords: tex - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, -;; Boston, MA 02110-1301, USA. - -;; version 1.0 2004-03-04 - -;;; Code: - - -(TeX-add-style-hook "emp" - (function - (lambda () - (TeX-add-symbols "empuse" "empTeX" "empaddtoTeX" - "emprelude" "empaddtoprelude" "unitlength" - ) - (LaTeX-add-environments - '("empfile" LaTeX-env-empfile) - '("emp" LaTeX-env-emp-gen) - '("empdef" LaTeX-env-emp-gen) - '("empgraph" LaTeX-env-emp-gen) - '("empcmds") - )))) - -(defun LaTeX-env-emp-gen (environment-name) - "Ask for file, width and length. Insert environment-name environment -Used for emp, empdef, and empgraph environments." - (let ((emp-fig-name (read-string "figure name: " "")) - (emp-fig-width (read-string "figure width: " "1" )) - (emp-fig-height (read-string "figure height: " "1" )) - ;;; emp.sty demands a width and a height for each of the - ;;; emp, empdef, and empgraph environments - ;;; we give them 1 by default - ;;; not necessarily the best thing to do? - ) - (if (not (zerop (length emp-fig-name))) - (progn - (setq LaTeX-emp-fig-name (concat LaTeX-optop emp-fig-name LaTeX-optcl)) - (LaTeX-insert-environment environment-name LaTeX-emp-fig-name)) - (LaTeX-insert-environment environment-name)) - (forward-line -1) - (end-of-line) - (insert "(" emp-fig-width "," emp-fig-height ")") - (forward-line 1) - (indent-according-to-mode) - )) - -(defun LaTeX-env-empfile (optional) - "Ask for file. Insert empfile environment" - (let ((empfile (read-string "empfile: " ""))) - (if (not (zerop (length empfile))) - (progn - (setq LaTeX-emp-file-name (concat LaTeX-optop empfile LaTeX-optcl)) - (setq mpost-emp-file-name (concat empfile ".mp")) - (LaTeX-insert-environment "empfile" LaTeX-emp-file-name)) - (progn - (setq mpost-emp-file-name "\\jobname") - (LaTeX-insert-environment "empfile"))) - (if LaTeX-write18-enabled-p - (progn - (forward-line 1) - (end-of-line) - (newline-and-indent) - (insert "\\immediate\\write18{mpost -tex=latex " mpost-emp-file-name TeX-grcl) - (forward-line -2))))) -;;; emp.el ends here diff --git a/packages/auctex/style/fancyref.el b/packages/auctex/style/fancyref.el deleted file mode 100644 index 53b64feac..000000000 --- a/packages/auctex/style/fancyref.el +++ /dev/null @@ -1,122 +0,0 @@ -;;; fancyref.el --- AUCTeX style file with support for fancyref.sty - -;; Copyright (C) 1999 Free Software Foundation, Inc. - -;; Author: Carsten Dominik -;; Maintainer: auctex-devel@gnu.org - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Code: - -(TeX-add-style-hook "fancyref" - (lambda () - - (TeX-add-symbols - - ;; The macros with label arguments - '("fref" [ TeX-arg-fancyref-format ] TeX-arg-label) - '("Fref" [ TeX-arg-fancyref-format ] TeX-arg-label) - - ;; The macros which define new prefixes and formats - '("fancyrefchangeprefix" TeX-arg-macro "Prefix") - '("Frefformat" TeX-arg-fancyref-format TeX-arg-macro "Output") - '("frefformat" TeX-arg-fancyref-format TeX-arg-macro "Output") - - ;; The delimiter - "fancyrefargdelim" - - ;; All those names and abbreviations. - ;; Part - "fancyrefpartlabelprefix" - "Frefpartname" "frefpartname" - ;; Chapter - "fancyrefchalabelprefix" - "Frefchaname" "frefchaname" - ;; Section - "fancyrefseclabelprefix" - "Frefsecname" "frefsecname" - ;; Equation - "fancyrefeqlabelprefix" - "Frefeqname" "frefeqname" - ;; Figure - "fancyreffiglabelprefix" - "Freffigname" "freffigname" "Freffigshortname" - ;; Footnote - "fancyreffnlabelprefix" - "Freffnname" "freffnname" - ;; Item - "fancyrefitemlabelprefix" - "Frefitemname" "frefitemname" - ;; Table - "fancyreftablabelprefix" - "Freftabname" "freftabname" "Freftabshortname" - ;; Page - "Frefpgname" "frefpgname" "Frefpgshortname" - ;; On - "Frefonname" "frefonname" - ;; See - "Frefseename" "frefseename" - - ;; The spacing macros - "fancyrefloosespacing" "fancyreftightspacing" "fancyrefdefaultspacing" - - ;; And the hook - "fancyrefhook") - - ;; Insatall completion for labels and formats - (setq TeX-complete-list - (append - '(("\\\\[fF]ref\\(\\[[^]]*\\]\\)?{\\([^{}\n\r\\%,]*\\)" - 2 LaTeX-label-list "}") - ("\\\\[fF]ref\\[\\([^{}\n\r\\%,]*\\)" - 1 LaTeX-fancyref-formats "]") - ("\\\\[fF]refformat{\\([^{}\n\r\\%,]*\\)" - 1 LaTeX-fancyref-formats "}")) - TeX-complete-list)) - ;; Fontification - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("fref" "[{") ("Fref" "[{")) 'reference)))) - -;; The following list keeps a list of available format names -;; Note that this list is only updated when a format is used, not -;; during buffer parsing. We could install a regexp to look for -;; formats, but this would not work in multifile documents since the -;; formats are not written out to the auto files. -;; For now, we just leave it at that. -(defvar LaTeX-fancyref-formats '(("plain") ("vario") ("margin") ("main")) - "List of formats for fancyref.") - -(defun LaTeX-fancyref-formats () LaTeX-fancyref-formats) - -(defun TeX-arg-fancyref-format (optional &optional prompt definition) - "Prompt for a fancyref format name. -If the user gives an unknown name, add it to the list." - (let ((format (completing-read (TeX-argument-prompt optional prompt "Format") - LaTeX-fancyref-formats))) - (if (not (string-equal "" format)) - (add-to-list 'LaTeX-fancyref-formats (list format))) - (TeX-argument-insert format optional))) - -(defvar LaTeX-fancyref-package-options '("english" "german" "loose" - "margin" "paren" "plain" "tight" - "vario") - "Package options for the fancyref package.") - -;;; fancyref.el ends here diff --git a/packages/auctex/style/flashcards.el b/packages/auctex/style/flashcards.el deleted file mode 100644 index 27e96d1c9..000000000 --- a/packages/auctex/style/flashcards.el +++ /dev/null @@ -1,60 +0,0 @@ -;;; flashcards.el --- AUCTeX style for the flashcards class. - -;; Copyright (C) 2007 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2007-04-23 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for the flashcards class. - -;;; Code: - -(TeX-add-style-hook - "flashcards" - (lambda () - (TeX-add-symbols - '("cardfrontstyle" ["Format"] "Style") - '("cardfrontfoot" "Footer text") - '("cardbackstyle" ["Format"] "Style") - '("cardfrontheadstyle" ["Format"] "Style") - '("cardfrontfootstyle" ["Format"] "Style") - "cardmargin" - "cardpaper" - "cardpapermode" - "cardrows" - "cardcolumns" - "cardheight" - "cardwidth") - (LaTeX-add-environments '("flashcard" ["Header"] "Front side")) - ;; Fontification - (when (and (fboundp 'font-latex-add-keywords) - (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("cardfrontstyle" "[{") - ("cardfrontfoot" "{") - ("cardbackstyle" "[{") - ("cardfrontheadstyle" "[{") - ("cardfrontfootstyle" "[{")) - 'variable)))) - -;;; flashcards.el ends here diff --git a/packages/auctex/style/foils.el b/packages/auctex/style/foils.el deleted file mode 100644 index 24d2b640d..000000000 --- a/packages/auctex/style/foils.el +++ /dev/null @@ -1,46 +0,0 @@ -;;; foils.el - Special code for FoilTeX. - -;; $Id: foils.el,v 1.5 2008/07/28 20:40:18 angeli Exp $ - -;;; Code: - -(require 'timezone) - -(TeX-add-style-hook "foils" - (function - (lambda () - (add-hook 'LaTeX-document-style-hook 'LaTeX-style-foils) - (setq LaTeX-default-style "foils") - (setq LaTeX-default-options '("landscape")) - (TeX-add-symbols - '("foilhead" [ "Rubric-body separation" ] "Foil rubric"))))) - -(defun LaTeX-style-foils nil - "Prompt for and insert foiltex options." - (let* ((date (timezone-parse-date (current-time-string))) - (year (string-to-number (aref date 0))) - (month (string-to-number (aref date 1))) - (day (string-to-number (aref date 2))) - (title (read-string "Title: "))) - (save-excursion - (goto-char (point-max)) - (re-search-backward ".begin.document.") - (insert TeX-esc "title" - TeX-grop title TeX-grcl "\n") - (insert TeX-esc "author" - TeX-grop (user-full-name) TeX-grcl "\n") - (insert TeX-esc "date" TeX-grop - (format "%d-%02d-%02d" year month day) - TeX-grcl "\n") - (insert "" TeX-esc "MyLogo" TeX-grop TeX-grcl "\n") - (insert "%" TeX-esc "Restriction" TeX-grop TeX-grcl "\n") - (insert "%" TeX-esc "rightfooter" TeX-grop TeX-grcl "\n") - (insert "%" TeX-esc "leftheader" TeX-grop TeX-grcl "\n") - (insert "%" TeX-esc "rightheader" TeX-grop TeX-grcl "\n\n") - (re-search-forward ".begin.document.") - (end-of-line) - (newline-and-indent) - (insert "" TeX-esc "maketitle\n\n")) - (forward-line -1))) - -;;; foils.el ends here diff --git a/packages/auctex/style/francais.el b/packages/auctex/style/francais.el deleted file mode 100644 index 323d545ed..000000000 --- a/packages/auctex/style/francais.el +++ /dev/null @@ -1,41 +0,0 @@ -;;; francais.el --- AUCTeX style for the `francais' babel option. - -;; Copyright (C) 2005 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2005-10-28 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; Set up AUCTeX for editing French text. In particular for commands -;; provided by the `francais' option of the `babel' LaTeX package. As -;; this is equivalent to the `frenchb' option, this file only loads -;; `frenchb.el'. - -;;; Code: - -(TeX-add-style-hook - "francais" - (lambda () - (TeX-run-style-hooks "frenchb"))) - -;;; francais.el ends here diff --git a/packages/auctex/style/frenchb.el b/packages/auctex/style/frenchb.el deleted file mode 100644 index fcef8a1d3..000000000 --- a/packages/auctex/style/frenchb.el +++ /dev/null @@ -1,77 +0,0 @@ -;;; frenchb.el --- AUCTeX style for the `frenchb' babel option. - -;; Copyright (C) 2005 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2005-10-28 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; Set up AUCTeX for editing French text. In particular for commands -;; provided by the `frenchb' option of the `babel' LaTeX package. The -;; `frenchb' option is equivalent to the `francais' option and since -;; babel version 3.7j with the `french' option. `french', however, is -;; ambiguous because another package by that name made by Bernard -;; Gaulle could be loaded. In order to avoid this, either `frenchb' -;; (or `francais') or `frenchle' (or `frenchPRO') should be used. See -;; the documentation of `frenchb' at -;; . - -;;; Code: - -(TeX-add-style-hook - "frenchb" - (lambda () - (TeX-add-symbols - "og" - "fg" - "up" - "ier" - "iere" - "iers" - "ieres" - "ieme" - "iemes" - '("bsc" t) - "primo" - "secundo" - "tertio" - "quarto" - "No" - "no" - "degre" - "degres" - "DecimalMathComma" - "StandardMathComma" - '("nombre" "Nombre") - "ThinSpaceInFrenchNumbers" - "FrenchLayout" - "StandardLayout") - (setq TeX-quote-language - `("french" "\\og " - (lambda () - (concat "\\fg" - (unless (member "xspace" TeX-active-styles) "{}"))) - ,TeX-quote-after-quote)) - (run-hooks 'TeX-language-fr-hook))) - -;;; frenchb.el ends here diff --git a/packages/auctex/style/german.el b/packages/auctex/style/german.el deleted file mode 100644 index 3676176d6..000000000 --- a/packages/auctex/style/german.el +++ /dev/null @@ -1,46 +0,0 @@ -;;; german.el --- Setup AUCTeX for editing German text. - -;;; Commentary: -;; -;; Cater for some specialities of `(n)german.sty', e.g. special quote -;; and hyphen strings or that `"' makes the following letter an -;; umlaut. - -;;; Code: - -(defvar LaTeX-german-mode-syntax-table - (copy-syntax-table LaTeX-mode-syntax-table) - "Syntax table used in LaTeX mode when using `german.sty'.") - -(modify-syntax-entry ?\" "w" LaTeX-german-mode-syntax-table) - -(TeX-add-style-hook - "german" - (lambda () - (set-syntax-table LaTeX-german-mode-syntax-table) - ;; XXX: Handle former customizations of the now defunct - ;; German-specific variables. References to the respective - ;; variables are to be deleted in future versions. (now = 2005-04-01) - (unless (eq (car TeX-quote-language) 'override) - (let ((open-quote (if (and (boundp 'LaTeX-german-open-quote) - LaTeX-german-open-quote) - LaTeX-german-open-quote - "\"`")) - (close-quote (if (and (boundp 'LaTeX-german-close-quote) - LaTeX-german-close-quote) - LaTeX-german-close-quote - "\"'")) - (q-after-q (if (and (boundp 'LaTeX-german-quote-after-quote) - LaTeX-german-quote-after-quote) - LaTeX-german-quote-after-quote - t))) - (setq TeX-quote-language - `("german" ,open-quote ,close-quote ,q-after-q)))) - (setq LaTeX-babel-hyphen-language "german") - ;; Fontification of quotation marks. - (when (fboundp 'font-latex-add-quotes) - (font-latex-add-quotes '("\"`" "\"'")) - (font-latex-add-quotes '("\">" "\"<" german))) - (run-hooks 'TeX-language-de-hook))) - -;;; german.el ends here diff --git a/packages/auctex/style/graphics.el b/packages/auctex/style/graphics.el deleted file mode 100644 index bffabc93c..000000000 --- a/packages/auctex/style/graphics.el +++ /dev/null @@ -1,10 +0,0 @@ -;;; graphics.el --- Handle graphical commands in LaTeX 2e. - -;;; Code: - -(TeX-add-style-hook "graphics" - (function - (lambda () - (TeX-run-style-hooks "graphicx")))) - -;;; graphics.el ends here. diff --git a/packages/auctex/style/graphicx.el b/packages/auctex/style/graphicx.el deleted file mode 100644 index a35d15177..000000000 --- a/packages/auctex/style/graphicx.el +++ /dev/null @@ -1,302 +0,0 @@ -;;; graphicx.el --- AUCTeX style file for graphicx.sty - -;; Copyright (C) 2000, 2004, 2005 by Free Software Foundation, Inc. - -;; Author: Ryuichi Arafune -;; Created: 1999/3/20 -;; Keywords: tex - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, -;; Boston, MA 02110-1301, USA. - -;;; Commentary: - -;; This package supports the includegraphcics macro in graphicx style. - -;; Acknowledgements -;; Dr. Thomas Baumann -;; David Kastrup -;; Masayuki Akata - -;;; Code: - -(TeX-add-style-hook - "graphicx" - (lambda () - (TeX-add-symbols - '("reflectbox" "Argument") - '("resizebox" "Width" "Height" "Argument") - '("resizebox*" "Width" "Total height" "Argument") - '("rotatebox" [ "Options" ] "Angle" "Argument") - '("scalebox" "Horizontal scale" [ "Vertical scale" ] "Argument") - '("includegraphics" LaTeX-arg-includegraphics)) - ;; Fontification - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("reflectbox" "{") - ("resizebox" "*{{{") - ("rotatebox" "[{{") - ("scalebox" "{[{")) - 'textual) - (font-latex-add-keywords '(("includegraphics" "*[[{")) 'reference)))) - -(defun LaTeX-includegraphics-extensions (&optional list) - "Return appropriate extensions for input files to \\includegraphics." - ;; FIXME: This function may check for latex/pdflatex later. - (concat "\\." - (mapconcat 'identity - (or list LaTeX-includegraphics-extensions) - "$\\|\\.") - "$")) - -(defun LaTeX-includegraphics-read-file-TeX () - "Read image file for \\includegraphics. -Offers all graphic files found in the TeX search path. See -`LaTeX-includegraphics-read-file' for more." - ;; Drop latex/pdflatex differences for now. Might be (re-)included later. - (completing-read - "Image file: " - (TeX-delete-dups-by-car - (mapcar 'list - (TeX-search-files nil LaTeX-includegraphics-extensions t t))) - nil nil nil)) - -(defun LaTeX-includegraphics-read-file-relative () - "Read image file for \\includegraphics. - -Lists all graphic files in the master directory and its -subdirectories and inserts the relative file name. This option -doesn't works with Emacs 21.3 or XEmacs. See -`LaTeX-includegraphics-read-file' for more." - (file-relative-name - (read-file-name - "Image file: " nil nil nil nil - ;; FIXME: Emacs 21.3 and XEmacs 21.4.15 dont have PREDICATE as the sixth - ;; argument (Emacs 21.3: five args; XEmacs 21.4.15: sixth is HISTORY). - (lambda (fname) - (or (file-directory-p fname) - (string-match (LaTeX-includegraphics-extensions) fname)))) - (TeX-master-directory))) - -(defun LaTeX-arg-includegraphics (prefix) - "Ask for mandantory and optional arguments for the \\includegraphics command. - -The extent of the optional arguments is determined by the prefix argument and -`LaTeX-includegraphics-options-alist'." - (let* ((maybe-left-brace "[") - (maybe-comma "") - show-hint - (image-file (funcall LaTeX-includegraphics-read-file)) - (incl-opts - (cond - ((numberp - (if (listp current-prefix-arg) - (setq current-prefix-arg (car current-prefix-arg)) - current-prefix-arg)) - (cdr - (assq current-prefix-arg LaTeX-includegraphics-options-alist))) - ;; If no prefix is given, use `0' and tell the user about the - ;; prefix. - ((eq current-prefix-arg nil) - (setq show-hint t) - (cdr (assq 0 LaTeX-includegraphics-options-alist))) - (t - (cdr (assq 0 LaTeX-includegraphics-options-alist))))) - ;; Order the optional aruments like in the tables in epslatex.ps, - ;; page 14. But collect y-or-n options at the end, so that the use - ;; can skip some options by typing `RET RET ... RET n n n ... n' - ;; - ;; Options from Table 1 (epslatex.ps, page 14): - (totalheight - (TeX-arg-maybe - 'totalheight incl-opts - '(read-string - (concat "Total Height (" TeX-default-unit-for-image "): ")))) - (height - (TeX-arg-maybe - 'height incl-opts - ;; Either totalheight or height make sense: - '(when (zerop (length totalheight)) - (read-string - (concat "Figure height (" TeX-default-unit-for-image "): "))))) - (width - (TeX-arg-maybe - 'width incl-opts - '(read-string - (concat "Figure width (" TeX-default-unit-for-image "): ")))) - (scale - (TeX-arg-maybe - 'angle incl-opts - ;; If size is already specified, don't ask for scale: - '(when (zerop (+ (length totalheight) - (length height) - (length width))) - (read-string "Scale: ")))) - (angle - (TeX-arg-maybe - 'angle incl-opts - '(read-string "Rotation angle: "))) - (origin - (TeX-arg-maybe - 'origin incl-opts - '(read-string - (concat - "Origin (any combination of `lcr' (horizontal) " - "and `tcbB' (vertical)): ")))) - (page ;; Not in any table; Only for PDF. - (TeX-arg-maybe - 'page incl-opts - '(read-string "Page: "))) - (bb - (TeX-arg-maybe - 'bb incl-opts - '(y-or-n-p "Set Bounding Box? "))) - ;; Table 2: - (viewport - (TeX-arg-maybe - 'viewport incl-opts - '(y-or-n-p "Set viewport? "))) - (trim - (TeX-arg-maybe - 'trim incl-opts - '(and (not viewport) - (y-or-n-p "Set trim? ")))) - ;; Table 3: - (clip - (TeX-arg-maybe - 'clip incl-opts - ;; If viewport, we also use clip. - '(or viewport - (y-or-n-p "Clipping figure? ")))) - (keepaspectratio - (TeX-arg-maybe - 'keepaspectratio incl-opts - ;; If we have width and [total]height... - '(or (and (not (zerop (length width))) - (or (not (zerop (length totalheight))) - (not (zerop (length height))))) - (y-or-n-p "Keep Aspectratio? ")))) - ;; Used for bb, trim, viewport, ...: - llx lly urx ury) - ;; Now insert stuff... - (when (not (zerop (length totalheight))) - (insert - maybe-left-brace maybe-comma "totalheight=" - (car (TeX-string-divide-number-unit totalheight)) - (if (zerop - (length - (car (cdr (TeX-string-divide-number-unit totalheight))))) - TeX-default-unit-for-image - (car (cdr (TeX-string-divide-number-unit totalheight))))) - (setq maybe-comma ",") - (setq maybe-left-brace "")) - (when (not (zerop (length height))) - (insert maybe-left-brace maybe-comma - "height=" (car (TeX-string-divide-number-unit height)) - (if (zerop - (length - (car (cdr (TeX-string-divide-number-unit height))))) - TeX-default-unit-for-image - (car (cdr (TeX-string-divide-number-unit height))))) - (setq maybe-comma ",") - (setq maybe-left-brace "")) - (when (not (zerop (length width))) - (insert maybe-left-brace maybe-comma - "width=" (car (TeX-string-divide-number-unit width)) - (if (zerop - (length - (car (cdr (TeX-string-divide-number-unit width))))) - TeX-default-unit-for-image - (car (cdr (TeX-string-divide-number-unit width))))) - (setq maybe-comma ",") - (setq maybe-left-brace "")) - (when (not (zerop (length scale))) - (insert maybe-left-brace maybe-comma "scale=" scale) - (setq maybe-comma ",") - (setq maybe-left-brace "")) - (when (not (zerop (length angle))) - (insert maybe-left-brace maybe-comma "angle=" angle) - (setq maybe-comma ",") - (setq maybe-left-brace "")) - (when (not (zerop (length origin))) - (insert maybe-left-brace maybe-comma "origin=" origin) - (setq maybe-comma ",") - (setq maybe-left-brace "")) - (when bb - (setq llx (read-string "Bounding Box lower left x: ")) - (setq lly (read-string "Bounding Box lower left y: ")) - (setq urx (read-string "Bounding Box upper right x: ")) - (setq ury (read-string "Bounding Box upper right y: ")) - (insert maybe-left-brace maybe-comma - "bb=" llx " " lly " " urx " " ury) - (setq maybe-comma ",") - (setq maybe-left-brace "")) - ;; - (when viewport - (setq llx (read-string "Viewport lower left x: ")) - (setq lly (read-string "Viewport lower left y: ")) - (setq urx (read-string "Viewport upper right x: ")) - (setq ury (read-string "Viewport upper right y: ")) - (insert maybe-left-brace maybe-comma - "viewport=" llx " " lly " " urx " " ury) - (setq maybe-comma ",") - (setq maybe-left-brace "")) - (when trim - (setq llx (read-string "Trim lower left x: ")) - (setq lly (read-string "Trim lower left y: ")) - (setq urx (read-string "Trim Upper right x: ")) - (setq ury (read-string "Trim Upper right y: ")) - (insert maybe-left-brace maybe-comma - "trim=" llx " " lly " " urx " " ury) - (setq maybe-comma ",") - (setq maybe-left-brace "")) - ;; - (when clip - (insert maybe-left-brace maybe-comma "clip") - (setq maybe-comma ",") - (setq maybe-left-brace "")) - (when keepaspectratio - (insert maybe-left-brace maybe-comma "keepaspectratio") - (setq maybe-comma ",") - (setq maybe-left-brace "")) - ;; - (when (not (zerop (length page))) - (insert maybe-left-brace maybe-comma "page=" page) - (setq maybe-comma ",") - (setq maybe-left-brace "")) - ;; - (if (zerop (length maybe-left-brace)) - (insert "]")) - (TeX-insert-braces 0) - (insert - (if LaTeX-includegraphics-strip-extension-flag - ;; We don't have `replace-regexp-in-string' in all (X)Emacs versions: - (with-temp-buffer - (insert image-file) - (goto-char (point-max)) - (when (search-backward-regexp (LaTeX-includegraphics-extensions) - nil t 1) - (replace-match "")) - (buffer-string)) - image-file)) - (when show-hint - (message - (concat - "Adding `C-u C-u' before the command asks for more optional arguments." - "\nSee `LaTeX-includegraphics-options-alist' for details.")) - (sit-for 3)) - t)) - -;;; graphicx.el ends here diff --git a/packages/auctex/style/harvard.el b/packages/auctex/style/harvard.el deleted file mode 100644 index ce591e28c..000000000 --- a/packages/auctex/style/harvard.el +++ /dev/null @@ -1,127 +0,0 @@ -;;; harvard.el --- Support for Harvard Citation style package for AUCTeX. - -;; Copyright (C) 1994,1997,2005,2012 Free Software Foundation, Inc. - -;; Harvard citation style is from Peter Williams -;; available on the CTAN servers - -;; Author: Berwin Turlach -;; Version: $Id: harvard.el,v 1.10 2008/02/03 14:53:30 angeli Exp $ - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program; if not, write to the Free Software Foundation, -;; Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -;;; Code: - -(TeX-add-style-hook "harvard" - (function - (lambda () - - (LaTeX-add-environments - '("thebibliography" LaTeX-env-harvardbib ignore)) - - (TeX-add-symbols - "harvardand" - '("citeasnoun" - (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil) - TeX-arg-cite) - '("possessivecite" - (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil) - TeX-arg-cite) - '("citeaffixed" - (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil) - TeX-arg-cite "Affix") - '("citeyear" - (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil) - TeX-arg-cite) - '("citename" - (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil) - TeX-arg-cite) - '("citationstyle" - (TeX-arg-eval completing-read "Citation style: " '(("agsm") ("dcu")))) - '("citationmode" - (TeX-arg-eval completing-read "Citation mode: " - '(("full") ("abbr") ("default")))) - '("harvardparenthesis" - (TeX-arg-eval completing-read "Harvardparenthesis: " - '(("round") ("curly") ("angle") ("square")))) - '("bibliographystyle" - (TeX-arg-eval - completing-read "Bibliography style: " - '(("agsm") ("apsr") ("dcu") ("jmr") ("jphysicsB") ("kluwer") ("nederlands") ("econometrica"))) - ignore) - '("harvarditem" [ "Short citation" ] - "Complete citation" "Year" TeX-arg-define-cite)) - - (setq TeX-complete-list - (append '(("\\\\citeasnoun\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)" - 1 LaTeX-bibitem-list "}") - ("\\\\citeasnoun{\\([^{}\n\r\\%,]*\\)" 1 - LaTeX-bibitem-list "}") - ("\\\\possessivecite\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)" - 1 LaTeX-bibitem-list "}") - ("\\\\possessivecite{\\([^{}\n\r\\%,]*\\)" 1 - LaTeX-bibitem-list "}") - ("\\\\citename\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)" - 1 LaTeX-bibitem-list "}") - ("\\\\citename{\\([^{}\n\r\\%,]*\\)" 1 - LaTeX-bibitem-list "}") - ("\\\\citeaffixed\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)" - 1 LaTeX-bibitem-list "}") - ("\\\\citeaffixed{\\([^{}\n\r\\%,]*\\)" 1 - LaTeX-bibitem-list "}") - ("\\\\citeaffixed{\\([^{}\n\r\\%]*,\\)\\([^{}\n\r\\%,]*\\)" - 2 LaTeX-bibitem-list) - ("\\\\citeyear\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)" - 1 LaTeX-bibitem-list "}") - ("\\\\citeyear{\\([^{}\n\r\\%,]*\\)" 1 - LaTeX-bibitem-list "}") - ("\\\\citeyear{\\([^{}\n\r\\%]*,\\)\\([^{}\n\r\\%,]*\\)" - 2 LaTeX-bibitem-list)) - TeX-complete-list)) - - (setq LaTeX-auto-regexp-list - (append '(("\\\\harvarditem{\\([a-zA-Z][^%#'()={}]*\\)}{\\([0-9][^, %\"#'()={}]*\\)}{\\([a-zA-Z][^, %\"#'()={}]*\\)}" 3 LaTeX-auto-bibitem) - ("\\\\harvarditem\\[[^][\n\r]+\\]{\\([a-zA-Z][^%#'()={}]*\\)}{\\([0-9][^, %\"#'()={}]*\\)}{\\([a-zA-Z][^, %\"#'()={}]*\\)}" 3 LaTeX-auto-bibitem) - ) - LaTeX-auto-regexp-list)) - - (setq LaTeX-item-list - (cons '("thebibliography" . LaTeX-item-harvardbib) - LaTeX-item-list)) - - ;; Tell RefTeX - (when (fboundp 'reftex-set-cite-format) - (reftex-set-cite-format 'harvard))))) - -(defun LaTeX-env-harvardbib (environment &optional ignore) - "Insert ENVIRONMENT with label for harvarditem." - (LaTeX-insert-environment environment - (concat TeX-grop "xx" TeX-grcl)) - (end-of-line 0) - (delete-char 1) - (delete-horizontal-space) - (LaTeX-insert-item)) - -;; Analog to LaTeX-item-bib from latex.el -(defun LaTeX-item-harvardbib () - "Insert a new harvarditem." - (TeX-insert-macro "harvarditem")) - -(defvar LaTeX-harvard-package-options '("full" "abbr" "default" - "agsmcite" "dcucite" "round" - "curly" "angle" "square" "none") - "Package options for the harvard package.") - -;; harvard.el ends here diff --git a/packages/auctex/style/hyperref.el b/packages/auctex/style/hyperref.el deleted file mode 100644 index 1f703f7fc..000000000 --- a/packages/auctex/style/hyperref.el +++ /dev/null @@ -1,124 +0,0 @@ -;;; hyperref.el --- AUCTeX style for the hyperref class. - -;; Copyright (C) 2008 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2008-06-21 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for the hyperref package. - -;;; Code: - -(defvar LaTeX-hyperref-package-options - '("a4paper" "a5paper" "anchorcolor" "b5paper" "backref" "baseurl" - "bookmarks" "bookmarksnumbered" "bookmarksopen" - "bookmarksopenlevel \maxdimen" "bookmarkstype" "breaklinks" - "CJKbookmarks" "citebordercolor" "citecolor" "colorlinks" "debug" - "draft" "dvipdf" "dvipdfm" "dvipdfmx" "dvips" "dvipsone" - "dviwindo" "encap" "executivepaper" "extension" "filebordercolor" - "filecolor" "final" "frenchlinks" "hyperfigures" "hyperfootnotes" - "hyperindex" "hypertex" "hypertexnames" "implicit" "latex2html" - "legalpaper" "letterpaper" "linkbordercolor" "linkcolor" - "linktocpage" "menubordercolor" "menucolor" "nativepdf" - "naturalnames" "nesting" "pageanchor" "pagebackref" - "pagebordercolor" "pagecolor" "pdfauthor" "pdfborder" - "pdfcenterwindow" "pdfcreator" "pdfdirection" "pdfdisplaydoctitle" - "pdfduplex" "pdffitwindow" "pdfhighlight" "pdfkeywords" "pdflang" - "pdfmark" "pdfmenubar" "pdfnewwindow" "pdfnonfullscreenpagemode" - "pdfnumcopies" "pdfpagelayout" "pdfpagemode" "pdfpagelabels" - "pdfpagescrop" "pdfpagetransition" "pdfpicktrackbypdfsize" - "pdfprintarea" "pdfprintclip" "pdfprintpagerange" - "pdfprintscaling" "pdfproducer" "pdfstartpage" "pdfstartview" - "pdfsubject" "pdftex" "pdftitle" "pdftoolbar" "pdfview" - "pdfviewarea" "pdfviewclip" "pdfwindowui" "plainpages" "ps2pdf" - "raiselinks" "runbordercolor" "setpagesize" "tex4ht" "textures" - "unicode" "urlbordercolor" "urlcolor" "verbose" "vtex" "xetex") - "Package options for the hyperref package.") - -(TeX-add-style-hook - "hyperref" - (lambda () - ;; hyperref.sty loads url.sty - (TeX-run-style-hooks "url") - (TeX-add-symbols - '("href" "URL" "Text") - '("nolinkurl" t) - '("hyperbaseurl" t) - '("hyperimage" "Image URL" "Text") - '("hyperdef" "Category" "Name" "Text") - '("hyperref" "URL" "Category" "Name" "Text") - '("hyperlink" "Name" "Text") - '("hypertarget" "Name" "Text") - '("phantomsection" 0) - '("autoref" TeX-arg-ref) - '("ref*" TeX-arg-ref) - '("pageref*" TeX-arg-ref) - '("pdfstringdef" "Macro name" "TeX string") - '("texorpdfstring" "TeX string" "PDF string") - '("hypercalcbp" t) - '("Acrobatmenu" "Menu option" "Text") - '("TextField" ["Parameters"] "Label") - '("CheckBox" ["Parameters"] "Label") - '("ChoiceMenu" ["Parameters"] "Label" "Choices") - '("PushButton" ["Parameters"] "Label") - '("Submit" ["Parameters"] "Label") - '("Reset" ["Parameters"] "Label") - '("LayoutTextField" "Label" "Field") - '("LayoutChoiceField" "Label" "Field") - '("LayoutCheckField" "Label" "Field") - '("MakeRadioField" "Width" "Height") - '("MakeCheckField" "Width" "Height") - '("MakeTextField" "Width" "Height") - '("MakeChoiceField" "Width" "Height") - '("MakeButtonField" "Text")) - - (add-to-list 'LaTeX-verbatim-macros-with-braces-local "nolinkurl") - (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperbaseurl") - (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperimage") - (add-to-list 'LaTeX-verbatim-macros-with-braces-local "hyperref") - - ;; Fontification - (when (and (fboundp 'font-latex-add-keywords) - (fboundp 'font-latex-set-syntactic-keywords) - (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("href" "{{") - ("nolinkurl" "{") - ("hyperbaseurl" "{") - ("hyperimage" "{{") - ("hyperdef" "{{{") - ("hyperref" "{{{{") - ("hyperlink" "{{") - ("hypertarget" "{{") - ("autoref" "{") - ("ref" "*{") - ("pageref" "*{")) - 'reference) - ;; For syntactic fontification, e.g. verbatim constructs. - (font-latex-set-syntactic-keywords)) - - ;; RefTeX - (when (fboundp 'reftex-ref-style-activate) - (reftex-ref-style-activate "Hyperref")))) - -;;; hyperref.el ends here diff --git a/packages/auctex/style/icelandic.el b/packages/auctex/style/icelandic.el deleted file mode 100644 index 6f4a9a12a..000000000 --- a/packages/auctex/style/icelandic.el +++ /dev/null @@ -1,52 +0,0 @@ -;;; icelandic.el --- AUCTeX style for the `icelandic' babel option. - -;; Copyright (C) 2007 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2007-03-11 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; Set up AUCTeX for editing Icelandic text in connection with the -;; `icelandic' babel option. - -;;; Code: - -(defvar LaTeX-icelandic-mode-syntax-table - (copy-syntax-table LaTeX-mode-syntax-table) - "Syntax table used in LaTeX mode when using `icelandic.sty'.") - -(modify-syntax-entry ?\" "w" LaTeX-icelandic-mode-syntax-table) - -(TeX-add-style-hook - "icelandic" - (lambda () - (set-syntax-table LaTeX-icelandic-mode-syntax-table) - (setq TeX-quote-language '("icelandic" "\"`" "\"'" t)) - (setq LaTeX-babel-hyphen-language "icelandic") - ;; Fontification of quotation marks. - (when (fboundp 'font-latex-add-quotes) - (font-latex-add-quotes '("\"`" "\"'")) - (font-latex-add-quotes '("\"<" "\">" french))) - (run-hooks 'TeX-language-is-hook))) - -;;; icelandic.el ends here diff --git a/packages/auctex/style/index.el b/packages/auctex/style/index.el deleted file mode 100644 index f14630bd8..000000000 --- a/packages/auctex/style/index.el +++ /dev/null @@ -1,83 +0,0 @@ -;;; index.el --- AUCTeX support for indices with index.sty. - -;; Copyright (C) 1999 Free Software Foundation, Inc. - -;; Author: Carsten Dominik -;; Maintainer: auctex-devel@gnu.org - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Code: - -(TeX-add-style-hook "index" - (lambda () - - (TeX-add-symbols - - ;; New indices - '("newindex" [ "Counter" ] "Tag" - "Extension of raw index" "Extension of processed index" "Index title") - '("renewindex" [ "Counter" ] "Tag" - "Extension of raw index" "Extension of processed index" "Index title") - "makeindex" - '("disableindex" "Tag[,tag...]") - - ;; Printing the index - '("printindex" [ "Indextag" ] [ "Prologue" ]) - "indexspace" - - ;; Index entries - '("index" [ TeX-arg-index-tag ] TeX-arg-index) - '("index*" [ TeX-arg-index-tag ] TeX-arg-index) - - ;; Showidx-like stuff - "proofmodetrue" "proofmodefalse" '("indexproofstyle" "Style") - - ;; Shortcuts (THESE ARE DEPRECATED AND SHOULD NOT BE USED - "shortindexingon" "shortindexinoff") - - ;; Parsing index macros - (setq LaTeX-auto-regexp-list - (append - - ;; The first regexp is faster, but less accurate - ;;'(("\\\\index\\*?\\[[^{}]*\\]{\\([^}]*\\)" - ;; 1 LaTeX-auto-index-entry)) - - ;; The second regexp is very good, but slower. - '(("\\\\index\\*?\\[[^{}]*\\]{\\([^}{]*\\({[^}{]*\\({[^}{]*\\({[^}{]*}[^}{]*\\)*}[^}{]*\\)*}[^}{]*\\)*\\)}" - 1 LaTeX-auto-index-entry)) - - LaTeX-auto-regexp-list)) - - ;; Completion for the index entries in \index and |see commands - (setq TeX-complete-list - (append - '(("\\\\index\\*?\\(\\[[^][{}]*\\]\\)?{\\([^{}\n\r]*\\)" - 2 LaTeX-index-entry-list) - ("|see{\\([^}]*\\)" 1 LaTeX-index-entry-list)) - TeX-complete-list)) - - ;; RefTeX support - (and (fboundp 'reftex-add-index-macros) - (reftex-add-index-macros '(index))))) - -(defvar LaTeX-index-package-options nil - "Package options for the index package.") - -;;; index.el ends here diff --git a/packages/auctex/style/inputenc.el b/packages/auctex/style/inputenc.el deleted file mode 100644 index 8b7be5c71..000000000 --- a/packages/auctex/style/inputenc.el +++ /dev/null @@ -1,86 +0,0 @@ -;;; inputenc.el --- AUCTeX style for `inputenc.sty' - -;; Copyright (C) 2005 Free Software Foundation, Inc. - -;; Author: Arne Jørgensen -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -;; MA 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `inputenc.sty'. - -;;; Code: - -(defun LaTeX-inputenc-package-options nil - "Prompt for package options for the inputenc package." - ;; separate the condition in three to silence the byte compiler - (if (boundp 'latex-inputenc-coding-alist) - (when (fboundp 'latexenc-coding-system-to-inputenc) - (when (fboundp 'latexenc-inputenc-to-coding-system) - (let ((default (latexenc-coding-system-to-inputenc - (or coding-system-for-write - buffer-file-coding-system))) - (selected 'undecided)) - (setq selected (completing-read - (if default - (format "Input encoding (default %s): " default) - "Input encoding: ") - (mapcar 'car latex-inputenc-coding-alist) - nil - nil - nil - nil - default)) - - ;; if necessary offer to set the coding system for saving - ;; this buffer based on the selected input encoding - (when (and (null - (coding-system-equal - (coding-system-base - (or coding-system-for-write - buffer-file-coding-system)) - (coding-system-base - (latexenc-inputenc-to-coding-system selected)))) - (y-or-n-p "Set coding system for saving this buffer? ") - (set-buffer-file-coding-system - (coding-system-base - (latexenc-inputenc-to-coding-system selected))) - (message nil))) - - ;; return selected input encoding - selected))) - (read-string "Input encoding: "))) - -(defun LaTeX-arg-inputenc-inputenc (optional) - "Prompt for input encoding." - (TeX-argument-insert (LaTeX-inputenc-package-options) nil)) - -(TeX-add-style-hook - "inputenc" - (lambda () - ;; New symbols - (TeX-add-symbols - '("inputencoding" LaTeX-arg-inputenc-inputenc)))) - -;; Local Variables: -;; coding: iso-8859-1 -;; End: - -;;; inputenc.el ends here diff --git a/packages/auctex/style/italian.el b/packages/auctex/style/italian.el deleted file mode 100644 index 4578f6f1d..000000000 --- a/packages/auctex/style/italian.el +++ /dev/null @@ -1,59 +0,0 @@ -;;; italian.el --- Setup AUCTeX for editing Italian text. - -;; Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -;; Author: Davide G. M. Salvetti -;; Maintainer: Davide G. M. Salvetti -;; Created: 2004-05-12 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: -;; -;; I believe that the Italian correct quoting is achieved with `\"<' and -;; `\">'. However, I will be glad to see a normative reference. -- DGMS - -;;; Code: - -(defvar TeX-language-it-hook nil - "Hook run for Italian texts.") - -(TeX-add-style-hook - "italian" - (lambda () - ;; XXX: Handle former customizations of the now defunct - ;; Italian-specific variables. References to the respective - ;; variables are to be deleted in future versions. (now = 2005-04-01) - (unless (eq (car TeX-quote-language) 'override) - (let ((open-quote (if (and (boundp 'LaTeX-italian-open-quote) - LaTeX-italian-open-quote) - LaTeX-italian-open-quote - "\"<")) - (close-quote (if (and (boundp 'LaTeX-italian-close-quote) - LaTeX-italian-close-quote) - LaTeX-italian-close-quote - "\">"))) - (setq TeX-quote-language - `("italian" ,open-quote ,close-quote TeX-quote-after-quote)))) - ;; Fontification of quotation marks. - (when (fboundp 'font-latex-add-quotes) - (font-latex-add-quotes '("\"<" "\">" french))) - (run-hooks 'TeX-language-it-hook))) - -;;; italian.el ends here diff --git a/packages/auctex/style/j-article.el b/packages/auctex/style/j-article.el deleted file mode 100644 index 1336458de..000000000 --- a/packages/auctex/style/j-article.el +++ /dev/null @@ -1,12 +0,0 @@ -;;; j-article.el - Special code for j-article style. - -;; $Id: j-article.el,v 1.4 2005/03/17 10:02:06 angeli Exp $ - -;;; Code: - -(TeX-add-style-hook - "j-article" - (lambda () - (LaTeX-largest-level-set "section"))) - -;;; j-article.el ends here diff --git a/packages/auctex/style/j-book.el b/packages/auctex/style/j-book.el deleted file mode 100644 index fd7394ace..000000000 --- a/packages/auctex/style/j-book.el +++ /dev/null @@ -1,12 +0,0 @@ -;;; j-book.el - Special code for j-book style. - -;; $Id: j-book.el,v 1.3 2005/03/17 10:02:06 angeli Exp $ - -;;; Code: - -(TeX-add-style-hook - "j-book" - (lambda () - (LaTeX-largest-level-set "chapter"))) - -;;; j-book.el ends here diff --git a/packages/auctex/style/j-report.el b/packages/auctex/style/j-report.el deleted file mode 100644 index ba6a266c5..000000000 --- a/packages/auctex/style/j-report.el +++ /dev/null @@ -1,12 +0,0 @@ -;;; j-report.el - Special code for j-report style. - -;; $Id: j-report.el,v 1.3 2005/03/17 10:02:06 angeli Exp $ - -;;; Code: - -(TeX-add-style-hook - "j-report" - (lambda () - (LaTeX-largest-level-set "chapter"))) - -;;; j-report.el ends here diff --git a/packages/auctex/style/jarticle.el b/packages/auctex/style/jarticle.el deleted file mode 100644 index b16bc6984..000000000 --- a/packages/auctex/style/jarticle.el +++ /dev/null @@ -1,12 +0,0 @@ -;;; jarticle.el - Special code for jarticle style. - -;; $Id: jarticle.el,v 1.4 2005/03/17 10:02:06 angeli Exp $ - -;;; Code: - -(TeX-add-style-hook - "jarticle" - (lambda () - (LaTeX-largest-level-set "section"))) - -;;; jarticle.el ends here diff --git a/packages/auctex/style/jbook.el b/packages/auctex/style/jbook.el deleted file mode 100644 index 221547797..000000000 --- a/packages/auctex/style/jbook.el +++ /dev/null @@ -1,12 +0,0 @@ -;;; jbook.el - Special code for jbook style. - -;; $Id: jbook.el,v 1.3 2005/03/17 10:02:06 angeli Exp $ - -;;; Code: - -(TeX-add-style-hook - "jbook" - (lambda () - (LaTeX-largest-level-set "chapter"))) - -;;; jbook.el ends here diff --git a/packages/auctex/style/jreport.el b/packages/auctex/style/jreport.el deleted file mode 100644 index 7e245aa85..000000000 --- a/packages/auctex/style/jreport.el +++ /dev/null @@ -1,13 +0,0 @@ -;;; jreport.el - Special code for jreport style. - -;; $Id: jreport.el,v 1.3 2005/03/17 10:02:06 angeli Exp $ - -;;; Code: - -(TeX-add-style-hook - "jreport" - (lambda () - (LaTeX-largest-level-set "chapter"))) - - -;;; jreport.el ends here diff --git a/packages/auctex/style/jsarticle.el b/packages/auctex/style/jsarticle.el deleted file mode 100644 index cf051f997..000000000 --- a/packages/auctex/style/jsarticle.el +++ /dev/null @@ -1,12 +0,0 @@ -;;; jsarticle.el - Special code for jsarticle style. - -;; $Id: jsarticle.el,v 1.2 2005/03/17 10:02:06 angeli Exp $ - -;;; Code: - -(TeX-add-style-hook - "jsarticle" - (lambda () - (LaTeX-largest-level-set "section"))) - -;;; jsarticle.el ends here diff --git a/packages/auctex/style/jsbook.el b/packages/auctex/style/jsbook.el deleted file mode 100644 index b9ddff024..000000000 --- a/packages/auctex/style/jsbook.el +++ /dev/null @@ -1,12 +0,0 @@ -;;; jsbook.el - Special code for jsbook style. - -;; $Id: jsbook.el,v 1.2 2005/03/17 10:02:06 angeli Exp $ - -;;; Code: - -(TeX-add-style-hook - "jsbook" - (lambda () - (LaTeX-largest-level-set "chapter"))) - -;;; jsbook.el ends here diff --git a/packages/auctex/style/jura.el b/packages/auctex/style/jura.el deleted file mode 100644 index 2f149c483..000000000 --- a/packages/auctex/style/jura.el +++ /dev/null @@ -1,39 +0,0 @@ -;;; jura.el --- AUCTeX style for `jura.cls' - -;; Copyright (C) 2004 Free Software Foundation, Inc. - -;; Author: Frank Küster -;; Maintainer: auctex-devel@gnu.org -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `jura.cls'. - -;;; Code: - -(TeX-add-style-hook - "jura" - (lambda () - (TeX-run-style-hooks "alphanum"))) - -;; Local Variables: -;; coding: iso-8859-1 -;; End: diff --git a/packages/auctex/style/jurabib.el b/packages/auctex/style/jurabib.el deleted file mode 100644 index c48e383ce..000000000 --- a/packages/auctex/style/jurabib.el +++ /dev/null @@ -1,634 +0,0 @@ -;;; jurabib.el --- AUCTeX style for the `jurabib' package - -;; Copyright (C) 2004, 2007 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2004-10-05 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for the `jurabib' package. - -;; Currently only the citation-related commands are supported. Feel -;; free to complete the support and send the result to the AUCTeX -;; mailing list. But be aware that the code can only be included if -;; you assign the copyright to the FSF. - -;;; Code: - -(TeX-add-style-hook - "jurabib" - (lambda () - ;; Taken from natbib.el and adapted. - (let ((citecmds - '(("cite" . 2) ("cite*" . 2) - ("citetitle" . 2) ("fullcite" . 2) - ("citet" . 1) ("citealt" . 1) - ("citep" . 2) ("citealp" . 2) - ("citeauthor" . 2) ("citeyear" . 2) - ("footcite" . 2) ("footcite*" . 2) - ("footcitetitle" . 2) ("footfullcite" . 2) - ("footcitet" . 1) ("footcitealt" . 1) - ("footcitep" . 2) ("footcitealp" . 2) - ("footciteauthor" . 2) ("footciteyear" . 2)))) - ;; Add these symbols - (apply - 'TeX-add-symbols - (mapcar - (lambda (cmd) - (cond - ((= (cdr cmd) 0) - ;; No optional arguments - (list (car cmd) 'TeX-arg-cite)) - ((= (cdr cmd) 1) - ;; Just one optional argument, the post note - (list - (car cmd) - '(TeX-arg-conditional TeX-arg-cite-note-p (["Post-note"]) nil) - 'TeX-arg-cite)) - ((= (cdr cmd) 2) - ;; Pre and post notes - (list - (car cmd) - '(TeX-arg-conditional TeX-arg-cite-note-p (natbib-note-args) nil) - 'TeX-arg-cite)))) - citecmds)) - ;; Special cases - (TeX-add-symbols - ;; FIXME: Completing read for field. - '("citefield" ; \citefield[]{}{} - (TeX-arg-conditional TeX-arg-cite-note-p (["Post-note"]) nil) - "Field" TeX-arg-cite) - '("footcitefield" ; \footcitefield[]{}{} - (TeX-arg-conditional TeX-arg-cite-note-p (["Post-note"]) nil) - "Field" TeX-arg-cite)) - - ;; Make an entry in TeX-complete-list - (add-to-list - 'TeX-complete-list - (list - (concat "\\\\\\(" - (mapconcat (lambda (x) (regexp-quote (car x))) - (append citecmds - '(("citefield") ("footcitefield"))) "\\|") - "\\)\\(\\[[^]\n\r\\%]*\\]\\)*{\\([^{}\n\r\\%,]*,\\)*" - "\\([^{}\n\r\\%,]*\\)") - 4 'LaTeX-bibitem-list "}")) - - ;; Add further symbols - (TeX-add-symbols - '("citefullfirstfortype" 1) - '("citenotitlefortype" 1) - '("citeswithoutentry" 1) - '("citetitlefortype" 1) - '("citeworkwithtitle" 1) - '("nextcitefull" 1) - '("nextcitenotitle" 1) - '("nextcitereset" 1) - '("nextciteshort" 1) - '("jurabibsetup" 1)) - - ;; Fontification - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("cite" "*[[{") - ("citetitle" "[[{") - ("fullcite" "[[{") - ("citet" "[{") - ("citealt" "[{") - ("citep" "[[{") - ("citealp" "[[{") - ("citeauthor" "[[{") - ("citeyear" "[[{") - ("footcite" "[[{") - ("footcite*" "[[{") - ("footcitetitle" "[[{") - ("footfullcite" "[[{") - ("footcitet" "[{") - ("footcitealt" "[{") - ("footcitep" "[[{") - ("footcitealp" "[[{") - ("footciteauthor" "[[{") - ("footciteyear" "[[{") - ("citefield" "[{{") - ("footcitefield" "[{{")) - 'reference) - (font-latex-add-keywords '(("citeswithoutentry" "{") - ("nextcitefull" "{") - ("nextcitenotitle" "{") - ("nextcitereset" "{") - ("nextciteshort" "{")) - 'function) - (font-latex-add-keywords '(("citenotitlefortype" "{") - ("citetitlefortype" "{") - ("jurabibsetup" "{")) - 'variable)) - - ;; Tell RefTeX (Thanks, Carsten) - (when (and (fboundp 'reftex-set-cite-format) - ;; Is it `reftex-cite-format' customized? - (not (get 'reftex-cite-format 'saved-value))) - ;; Check if RefTeX supports jurabib. - (if (assoc 'jurabib reftex-cite-format-builtin) - ;; Yes, use the provided default. - (reftex-set-cite-format 'jurabib) - ;; No, set it by hand. - (reftex-set-cite-format - '((?\C-m . "\\cite{%l}") - (?c . "\\cite[?][]{%l}") - (?t . "\\citet{%l}") - (?p . "\\citep{%l}") - (?e . "\\citep[e.g.][?]{%l}") - (?s . "\\citep[see][?]{%l}") - (?u . "\\fullcite{%l}") - (?i . "\\citetitle{%l}") - (?a . "\\citeauthor{%l}") - (?e . "\\citefield{?}{%l}") - (?y . "\\citeyear{%l}") - (?f . "\\footcite{%l}") - (?F . "\\footcite[?][]{%l}") - (?l . "\\footfullcite{%l}")))))) - - ;; FIXME: The following list is the edited output of - ;; `TeX-auto-generate' which probably includes internal macros of - ;; jurabib. Unfortunately the macros which should be accessible to - ;; the user are not fully documented at the time of this writing. - ;; But instead of including only the limited part which is - ;; documented we rather give the user a bit too much. The list - ;; should be reduced when there is proper documentation, though. - (TeX-add-symbols - '("Wrapquotes" 1) - '("apyformat" 1) - '("artnumberformat" 1) - '("artvolnumformat" 2) - '("artvolumeformat" 1) - '("artyearformat" 1) - '("bibAnnote" 1) - '("bibAnnoteFile" 1) - '("bibAnnotePath" 1) - '("bibEIMfont" 1) - '("bibIMfont" 1) - '("bibYear" 1) - '("bibedformat" 1) - '("bibedinformat" 1) - '("bibenf" 5) - '("biblenf" 5) - '("bibnf" 5) - '("bibnumberformat" 1) - '("bibrenf" 5) - '("bibrlenf" 5) - '("bibrnf" 5) - '("biburlfont" 1) - '("edfont" 1) - '("formatarticlepages" ["argument"] 2) - '("fsted" 1) - '("fullnameoxfordcrossref" 1) - '("incolledformat" 5) - '("jbArchPages" 1) - '("jbPages" 1) - '("jbannoteformat" 1) - '("jbapifont" 1) - '("jbarchnameformat" 1) - '("jbarchsig" 2) - '("jbartPages" 1) - '("jbartcrossrefchecked" ["argument"] 1) - '("jbauthorindexfont" 1) - '("jbbibargs" 5) - '("jbbibyearformat" 1) - '("jbcitationoyearformat" 1) - '("jbcitationyearformat" 1) - '("jbcrossrefchecked" ["argument"] 1) - '("jbedafti" 1) - '("jbedbyincollcrossreflong" 1) - '("jbedbyincollcrossrefshort" 1) - '("jbedbyincollcrossrefshortnoapy" 1) - '("jbedbyincollcrossrefshortwithapy" 1) - '("jbedition" 1) - '("jbeditorindexfont" 1) - '("jbendnote" 1) - '("jbflanguage" 1) - '("jbincollcrossref" 2) - '("jbisbn" 1) - '("jbissn" 1) - '("jbnote" 2) - '("jborganizationindexfont" 1) - '("jbpagesformat" 1) - '("jbprformat" 1) - '("jbrealcitation" 2) - '("jbshortarchformat" 1) - '("jbshortsubarchformat" 1) - '("jbsy" 1) - '("jbtiafed" 1) - '("lookatfortype" 1) - '("nobibliography" 1) - '("nocitebuthowcited" 1) - '("numberandseries" 2) - '("pageadd" 1) - '("pernumberformat" 1) - '("pervolnumformat" 2) - '("pervolumeformat" 1) - '("peryearformat" 1) - '("revnumberformat" 1) - '("revvolnumformat" 2) - '("revvolumeformat" 1) - '("revyearformat" 1) - '("snded" 1) - '("textitswitch" 1) - '("translator" 3) - '("volumeformat" 1) - "Bibbfsasep" - "Bibbfsesep" - "Bibbstasep" - "Bibbstesep" - "Bibbtasep" - "Bibbtesep" - "Bibchaptername" - "Bibetal" - "Edbyname" - "IbidemMidName" - "IbidemName" - "NAT" - "OpCit" - "Reprint" - "SSS" - "Transfrom" - "Volumename" - "addtoalllanguages" - "afterfoundersep" - "aftervolsep" - "ajtsep" - "alsothesisname" - "aprname" - "augname" - "bibBTsep" - "bibJTsep" - "bibPageName" - "bibPagesName" - "bibaesep" - "bibaldelim" - "bibaltformatalign" - "bibandname" - "bibanfont" - "bibansep" - "bibapifont" - "bibapyldelim" - "bibapyrdelim" - "bibarchpagename" - "bibarchpagesname" - "bibardelim" - "bibartperiodhowcited" - "bibatsep" - "bibauthormultiple" - "bibbdsep" - "bibbfsasep" - "bibbfsesep" - "bibbstasep" - "bibbstesep" - "bibbtasep" - "bibbtesep" - "bibbtfont" - "bibbtsep" - "bibbudcsep" - "bibces" - "bibchapterlongname" - "bibchaptername" - "bibcite" - "bibcolumnsep" - "bibcommenthowcited" - "bibcontinuedname" - "bibcrossrefcite" - "bibcrossrefciteagain" - "bibeandname" - "bibedformat" - "bibefnfont" - "bibeimfont" - "bibelnfont" - "bibenf" - "bibfnfmt" - "bibfnfont" - "bibhowcited" - "bibibidfont" - "bibidemPfname" - "bibidemPmname" - "bibidemPnname" - "bibidemSfname" - "bibidemSmname" - "bibidemSnname" - "bibidempfname" - "bibidempmname" - "bibidempnname" - "bibidemsfname" - "bibidemsmname" - "bibidemsnname" - "bibimfont" - "bibincollcrossrefcite" - "bibincollcrossrefciteagain" - "bibjtfont" - "bibjtsep" - "bibleftcolumn" - "bibleftcolumnadjust" - "bibleftcolumnstretch" - "biblenf" - "biblnfmt" - "biblnfont" - "bibnf" - "bibnotcited" - "bibpagename" - "bibpagesname" - "bibpagesnamesep" - "bibpldelim" - "bibprdelim" - "bibrevtfont" - "bibrightcolumn" - "bibrightcolumnadjust" - "bibrightcolumnstretch" - "bibsall" - "bibsdanish" - "bibsdutch" - "bibsenglish" - "bibsfinnish" - "bibsfrench" - "bibsgerman" - "bibsitalian" - "bibsnfont" - "bibsnorsk" - "bibsportuguese" - "bibsspanish" - "bibtabularitemsep" - "bibtfont" - "bibtotalpagesname" - "biburlprefix" - "biburlsuffix" - "bibvolumecomment" - "bibvtfont" - "bothaesep" - "bpubaddr" - "byname" - "citetitleonly" - "citeyearpar" - "commaename" - "commaname" - "dateldelim" - "daterdelim" - "decname" - "diffpageibidemmidname" - "diffpageibidemname" - "edbyname" - "edbysep" - "editionname" - "editorname" - "editorsname" - "enoteformat" - "etalname" - "etalnamenodot" - "febname" - "fifthedname" - "firstedname" - "footcitetitleonly" - "formatpages" - "foundername" - "fourthedname" - "fromdutch" - "fromenglish" - "fromfinnish" - "fromfrench" - "fromgerman" - "fromitalian" - "fromnorsk" - "fromportuguese" - "fromspanish" - "herename" - "howcitedprefix" - "howcitedsuffix" - "ibidem" - "ibidemmidname" - "ibidemname" - "idemPfedbyname" - "idemPfname" - "idemPmedbyname" - "idemPmname" - "idemPnedbyname" - "idemPnname" - "idemSfedbyname" - "idemSfname" - "idemSmedbyname" - "idemSmname" - "idemSnedbyname" - "idemSnname" - "idemmidname" - "idemname" - "idempfedbyname" - "idempfname" - "idempmedbyname" - "idempmname" - "idempnedbyname" - "idempnname" - "idemsfedbyname" - "idemsfname" - "idemsmedbyname" - "idemsmname" - "idemsnedbyname" - "idemsnname" - "incollinname" - "inname" - "inseriesname" - "janname" - "jbCheckedFirst" - "jbFirst" - "jbFirstAbbrv" - "jbJunior" - "jbLast" - "jbNotRevedNoVonJr" - "jbNotRevedNoVonNoJr" - "jbNotRevedOnlyLast" - "jbNotRevedVonJr" - "jbNotRevedVonNoJr" - "jbPAGES" - "jbPageName" - "jbPages" - "jbPagesName" - "jbRevedFirstNoVonJr" - "jbRevedFirstNoVonNoJr" - "jbRevedFirstOnlyLast" - "jbRevedFirstVonJr" - "jbRevedFirstVonNoJr" - "jbRevedNotFirstNoVonJr" - "jbRevedNotFirstNoVonNoJr" - "jbRevedNotFirstOnlyLast" - "jbRevedNotFirstVonJr" - "jbRevedNotFirstVonNoJr" - "jbVon" - "jbactualauthorfnfont" - "jbactualauthorfont" - "jbaddtomakehowcited" - "jbaensep" - "jbafterstartpagesep" - "jbannotatorfont" - "jbapifont" - "jbarchnamesep" - "jbarchpagename" - "jbarchpagesname" - "jbartPages" - "jbatsep" - "jbauthorfnfont" - "jbauthorfont" - "jbauthorfontifannotator" - "jbauthorinfo" - "jbbeforestartpagesep" - "jbbfsasep" - "jbbfsesep" - "jbbookedaftertitle" - "jbbstasep" - "jbbstesep" - "jbbtasep" - "jbbtesep" - "jbbtfont" - "jbbtitlefont" - "jbcitationyearformat" - "jbcrossrefchecked" - "jbdisablecitationcrossref" - "jbdoitem" - "jbdonotindexauthors" - "jbdonotindexeditors" - "jbdonotindexorganizations" - "jbdotafterbibentry" - "jbdotafterendnote" - "jbdy" - "jbedbyincollcrossrefcite" - "jbedbyincollcrossrefciteagain" - "jbedition" - "jbedseplikecite" - "jbeimfont" - "jbfirstcitepageranges" - "jbfootnoteformat" - "jbfootnotenumalign" - "jbfulltitlefont" - "jbhowcitedcomparepart" - "jbhowcitednormalpart" - "jbhowsepannotatorfirst" - "jbhowsepannotatorlast" - "jbhowsepbeforetitle" - "jbhowsepbeforetitleae" - "jbhowsepbeforetitleibidemname" - "jbignorevarioref" - "jbimfont" - "jbindexbib" - "jbindexonlyfirstauthors" - "jbindexonlyfirsteditors" - "jbindexonlyfirstorganizations" - "jbindextype" - "jblookforgender" - "jbmakeinbib" - "jbmakeinbiblist" - "jbmakeindexactual" - "jbnotsamearch" - "jbonlyforbib" - "jbonlyforcitations" - "jbonlyforfirstcitefullbegin" - "jbonlyforfirstcitefullend" - "jborgauthorfont" - "jboyearincitation" - "jbpagename" - "jbpagenamenodot" - "jbpages" - "jbpagesep" - "jbpagesname" - "jbpagesnamesep" - "jbsamearch" - "jbsamesubarch" - "jbsamesubarchindent" - "jbshorttitlefont" - "jbshowbibextralabel" - "jbssedbd" - "jbsubarchsep" - "jbsuperscripteditionafterauthor" - "jbtitlefont" - "jbts" - "jburldef" - "jbuseidemhrule" - "jbyear" - "jbyearaftertitle" - "julname" - "junname" - "jurthesisname" - "marname" - "mastersthesisname" - "mayname" - "nofirstnameforcitation" - "noibidem" - "noidem" - "nopage" - "novname" - "numbername" - "octname" - "ofseriesname" - "opcit" - "organizationname" - "origPAGES" - "origartPages" - "origbibces" - "origcrossref" - "origpages" - "osep" - "phdthesisname" - "reprint" - "reprintname" - "reviewbyname" - "reviewname" - "reviewofname" - "samepageibidemmidname" - "samepageibidemname" - "secondedname" - "sepname" - "sndecmd" - "snded" - "sndeditorname" - "sndeditorsname" - "technicalreportname" - "testnosig" - "textandname" - "texteandname" - "theHlvla" - "theHlvlb" - "theHlvlc" - "theHlvld" - "theHlvle" - "theHlvlf" - "theHlvlg" - "theHlvlh" - "theHlvli" - "theHlvlj" - "theHlvlk" - "theHlvll" - "thedname" - "thirdedname" - "trans" - "transby" - "transfrom" - "updatename" - "updatesep" - "urldatecomment" - "volname" - "volumename" - "volumeofname"))) - -;;; jurabib.el ends here diff --git a/packages/auctex/style/letter.el b/packages/auctex/style/letter.el deleted file mode 100644 index 76ab4d87c..000000000 --- a/packages/auctex/style/letter.el +++ /dev/null @@ -1,122 +0,0 @@ -;;; letter.el - Special code for letter style. - -;; $Id: letter.el,v 1.4 2008/05/25 06:50:33 angeli Exp $ - -;;; Code: - -;; You may want to define this in tex-site.el to contain your -;; organizations address. -(defvar LaTeX-letter-sender-address "" - "Initial value when prompting for a sender address in the letter style.") - -(TeX-add-style-hook "letter" - (function - (lambda () - (LaTeX-add-environments - '("letter" LaTeX-env-recipient)) - (TeX-add-symbols - '("name" "Sender: ") - '("address" "Sender address: ") - '("signature" "Signature: ") - '("opening" "Opening: ") - '("closing" "Closing: "))))) - -(defun LaTeX-env-recipient (environment) - "Insert ENVIRONMENT and prompt for recipient and address." - (let ((sender (read-string "Sender: " (user-full-name))) - (sender-address (read-string "Sender address: " - LaTeX-letter-sender-address)) - (recipient (read-string "Recipient: ")) - (address (read-string "Recipient address: ")) - (signature (read-string "Signature: ")) - (opening (read-string "Opening: ")) - (closing (read-string "Closing: ")) - (date (read-string "Date: " (LaTeX-today)))) - - (insert TeX-esc "name" TeX-grop sender TeX-grcl) - (newline-and-indent) - (if (not (zerop (length sender-address))) - (progn - (setq LaTeX-letter-sender-address sender-address) - (insert TeX-esc "address" TeX-grop sender-address TeX-grcl) - (newline-and-indent))) - (if (not (zerop (length signature))) - (progn - (insert TeX-esc "signature" TeX-grop signature TeX-grcl) - (newline-and-indent))) - (if (not (zerop (length date))) - (progn - (insert TeX-esc "def" TeX-esc "today" TeX-grop date TeX-grcl) - (newline-and-indent))) - (newline-and-indent) - - (let ((indentation (current-column))) - (LaTeX-insert-environment - environment - (concat TeX-grop recipient - (if (not (zerop (length address))) - (concat - (if (not (zerop (length recipient))) - (concat " " TeX-esc TeX-esc " ")) - address)) - TeX-grcl)) - (save-excursion ; Fix indentation of address - (if (search-backward TeX-grcl nil 'move) - (let ((addr-end (point-marker))) - (if (search-backward TeX-grop nil 'move) - (let ((addr-column (current-column))) - (while (search-forward - (concat TeX-esc TeX-esc) - (marker-position addr-end) 'move) - (progn - (newline) - (indent-to addr-column)))))))) - (insert "\n") - (indent-to indentation)) - (insert TeX-esc "opening" - TeX-grop - (if (zerop (length opening)) - (concat TeX-esc " ") - opening) - TeX-grcl "\n") - - (indent-relative-maybe) - (save-excursion - (insert "\n" TeX-esc "closing" - TeX-grop - (if (zerop (length closing)) - (concat TeX-esc " ") - closing) - TeX-grcl "\n") - (indent-relative-maybe)))) - -(defun LaTeX-today nil - "Return a string representing todays date according to flavor." - (interactive) - (let ((ctime-string (current-time-string)) - (month-alist '(("Jan". "01") - ("Feb" . "02") - ("Mar" . "03") - ("Apr" . "04") - ("May" . "05") - ("Jun" . "06") - ("Jul" . "07") - ("Aug" . "08") - ("Sep" . "09") - ("Oct" . "10") - ("Nov" . "11") - ("Dec" . "12")))) - (string-match - "^\\S-+\\s-+\\(\\S-+\\)\\s-+\\(\\S-+\\)\\s-+\\S-+\\s-+\\(\\S-+\\)" - ctime-string) - (let ((year (substring ctime-string (match-beginning 3) (match-end 3))) - (month (substring ctime-string (match-beginning 1) (match-end 1))) - (day (substring ctime-string (match-beginning 2) (match-end 2)))) - (if (assoc month month-alist) - (progn - (setq month (cdr (assoc month month-alist))) - (if (> 2 (length day)) - (setq day (concat "0" day))))) - (format "%s-%s-%s" year month day)))) - -;;; letter.el ends here diff --git a/packages/auctex/style/listings.el b/packages/auctex/style/listings.el deleted file mode 100644 index cfb11e993..000000000 --- a/packages/auctex/style/listings.el +++ /dev/null @@ -1,243 +0,0 @@ -;;; listings.el --- AUCTeX style for `listings.sty' - -;; Copyright (C) 2004, 2005, 2009 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2004-10-17 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `listings.sty'. -;; -;; FIXME: Please make me more sophisticated! - -;;; Code: - -;; The following are options taken from chapter 4 of the listings -;; manual (2006/05/08 Version 1.3c). Experimental options described -;; in chapter 5 are not included. -(defvar LaTeX-listings-key-val-options - '(;; Space and placement - ("float" ("t" "b" "p" "h")) ; Support [*] as an optional prefix and that - ; tbph are not exclusive. - ("floatplacement" ("t" "b" "p" "h")) - ("aboveskip") - ("belowskip") - ("lineskip") - ("boxpos" ("b" "c" "t")) - ;; The printed range - ("print" ("true" "false")) - ("firstline") - ("lastline") - ("linerange") - ("showlines" ("true" "false")) - ("emptylines") - ("gobble") - ;; Languages and styles - ("style") - ("language") - ("alsolanguage") - ("defaultdialect") - ("printpod" ("true" "false")) - ("usekeywordsintag" ("true" "false")) - ("tagstyle") - ("markfirstintag") - ("makemacrouse" ("true" "false")) - ;; Figure out the appearance - ("basicstyle") - ("identifierstyle") - ("commentstyle") - ("stringstyle") - ("keywordstyle") - ("classoffset") - ("texcsstyle") - ("directivestyle") - ("emph") - ("moreemph") - ("deleteemph") - ("emphstyle") - ("delim") - ("moredelim") - ("deletedelim") - ;; Getting all characters right - ("extendedchars" ("true" "false")) - ("inputencoding") ; Could make use of `latex-inputenc-coding-alist'. - ("upquote" ("true" "false")) - ("tabsize") - ("showtabs" ("true" "false")) - ("tab") - ("showspaces" ("true" "false")) - ("showstringspaces" ("true" "false")) - ("formfeed") - ;; Line numbers - ("numbers" ("none" "left" "right")) - ("stepnumber") - ("numberfirstline" ("true" "false")) - ("numberstyle") - ("numbersep") - ("numberblanklines" ("true" "false")) - ("firstnumber" ("auto" "last")) ; Can also take a number. - ("name") - ;; Captions - ("title") - ("caption") ; Insert braces? - ("label") - ("nolol" ("true" "false")) - ("captionpos" ("t" "b")) ; Can be a subset of tb. - ("abovecaptionskip") - ("belowcaptionskip") - ;; Margins and line shape - ("linewidth") - ("xleftmargin") - ("xrightmargin") - ("resetmargins" ("true" "false")) - ("breaklines" ("true" "false")) - ("breakatwhitespace" ("true" "false")) - ("prebreak") - ("postbreak") - ("breakindent") - ("breakautoindent" ("true" "false")) - ;; Frames - ("frame" ("none" "leftline" "topline" "bottomline" "lines" "single" - "shadowbox" - ;; Alternative to the above values. A subset of trblTRBL can be - ;; given. - "t" "r" "b" "l" "T" "R" "B" "L")) - ("frameround" ("t" "f")) ; The input actually has to be four times {t,f}. - ("framesep") - ("rulesep") - ("framerule") - ("framexleftmargin") - ("framexrightmargin") - ("framextopmargin") - ("framebottommargin") - ("backgroundcolor") - ("rulecolor") - ("fillcolor") - ("fulesepcolor") - ("frameshape") - ;; Indexing - ("index") - ("moreindex") - ("deleteindex") - ("indexstyle") - ;; Column alignment - ("columns" ("fixed" "flexible" "fullflexible")) ; Also supports an optional - ; argument with {c,l,r}. - ("flexiblecolumns" ("true" "false")) - ("keepspaces" ("true" "false")) - ("basewidth") - ("fontadjust" ("true" "false")) - ;; Escaping to LaTeX - ("texcl" ("true" "false")) - ("mathescape" ("true" "false")) - ("escapechar") - ("escapeinside") - ("escapebegin") - ("escapeend") - ;; Interface to fancyvrb - ("fancyvrb" ("true" "false")) - ("fvcmdparams") - ("morefvcmdparams") - ;; Language definitions - ("keywordsprefix") - ("keywords") - ("morekeywords") - ("deletekeywords") - ("texcs") - ("moretexcs") - ("deletetexcs") - ("directives") - ("moredirectives") - ("deletedirectives") - ("sensitive" ("true" "false")) - ("alsoletter") - ("alsodigit") - ("alsoother") - ("otherkeywords") - ("tag") - ("string") - ("morestring") - ("deletestring") - ("comment") - ("morecomment") - ("deletecomment") - ("keywordcomment") - ("morekeywordcomment") - ("deletekeywordcomment") - ("keywordcommentsemicolon") - ("podcomment" ("true" "false"))) - "Key=value options for listings macros and environments.") - -(TeX-add-style-hook - "listings" - (lambda () - ;; New symbols - (TeX-add-symbols - '("lstalias" ["Alias dialect"] "Alias" ["Dialect"] "Language") - '("lstdefinestyle" "Style name" - (TeX-arg-key-val LaTeX-listings-key-val-options)) - '("lstinline" TeX-arg-verb) - '("lstinputlisting" [TeX-arg-key-val LaTeX-listings-key-val-options] - TeX-arg-file) - "lstlistoflistings" - '("lstnewenvironment" "Name" ["Number or arguments"] ["Default argument"] - "Starting code" "Ending code") - '("lstset" (TeX-arg-key-val LaTeX-listings-key-val-options))) - ;; New environments - (LaTeX-add-environments - '("lstlisting" LaTeX-env-args - [TeX-arg-key-val LaTeX-listings-key-val-options])) - ;; Filling - (make-local-variable 'LaTeX-indent-environment-list) - (add-to-list 'LaTeX-indent-environment-list - '("lstlisting" current-indentation)) - (make-local-variable 'LaTeX-verbatim-regexp) - (setq LaTeX-verbatim-regexp (concat LaTeX-verbatim-regexp "\\|lstlisting")) - (add-to-list 'LaTeX-verbatim-environments-local "lstlisting") - (add-to-list 'LaTeX-verbatim-macros-with-delims-local "lstinline") - (add-to-list 'LaTeX-verbatim-macros-with-braces-local "lstinline") - ;; Fontification - (when (and (fboundp 'font-latex-add-keywords) - (fboundp 'font-latex-set-syntactic-keywords) - (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("lstnewenvironment" "{[[{{")) 'function) - (font-latex-add-keywords '(("lstinputlisting" "[{")) 'reference) - (font-latex-add-keywords '(("lstinline" "[{") ; The second argument should - ; actually be verbatim. - ("lstlistoflistings" "")) - 'textual) - (font-latex-add-keywords '(("lstalias" "{{") - ("lstdefinestyle" "{{") - ("lstset" "{")) - 'variable) - ;; For syntactic fontification, e.g. verbatim constructs. - (font-latex-set-syntactic-keywords) - ;; Tell font-lock about the update. - (setq font-lock-set-defaults nil) - (font-lock-set-defaults)))) - -(defvar LaTeX-listings-package-options '("draft" "final" "savemem" - "noaspects") - "Package options for the listings package.") - -;;; listings.el ends here diff --git a/packages/auctex/style/ltx-base.el b/packages/auctex/style/ltx-base.el deleted file mode 100644 index 27034a212..000000000 --- a/packages/auctex/style/ltx-base.el +++ /dev/null @@ -1,86 +0,0 @@ -;;; ltx-base.el --- AUCTeX style for basic LaTeX commands. - -;; Copyright (C) 2004 Free Software Foundation, Inc. - -;; Author: Frank Küster -;; Maintainer: auctex-devel@gnu.org -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds general support for basic LaTeX commands used for -;; writing LaTeX class files (.cls), style files (.sty) and package -;; files (.dtx). - -;;; Code: - -(TeX-add-style-hook - "ltx-base" - (function - (lambda () - (TeX-add-symbols - '("DeclareRobustCommand" TeX-arg-define-macro [ "Number of arguments" ] t) - '("CheckCommand" TeX-arg-define-macro [ "Number of arguments" ] t) - '("@addtoreset" TeX-arg-counter "Within counter" "counter") - '("addvspace" "space") - '("addpenalty" "penalty") - '("ProvidesClass" "name" [ "release information" ]) - '("ProvidesPackage" "name" [ "release information" ]) - '("ProvidesFile" "filename" [ "release information" ]) - '("NeedsTeXFormat" "format" [ "release" ]) - '("DeclareOption" "option" t) - ;; would be great if DeclareOption RET * RET would give - ;; \DeclareOption*! - "DeclareOption*" - '("CurrentOption" 0) - '("PassOptionsToPackage" "option list" "package") - '("ExecuteOptions" "option list") - "ProcessOptions" - "ProcessOptions*" - '("OptionNotUsed" 0) - ;; candidate for opt/mand toggling - '("RequirePackage" [ "option list" ] "package" [ "release" ]) - '("LoadClass" [ "option list" ] "class" [ "release" ]) - "AtEndOfPackage" - "AtEndOfClass" - "AtBeginDocument" - "AtEndDocument" - '("IfFileExists" "filename" 2) - '("InputIfFileExists" "filename" 2) - '("PackageWarning" "name" t) - '("PackageWarningNoLine" "name" t) - '("PackageInfo" "name" t) - '("PackageError" "name" "short text" t) - '("ClassWarning" "name" t) - '("ClassWarningNoLine" "name" t) - '("ClassInfo" "name" t) - '("ClassError" "name" "short text" t) - '("MessageBreak" 0) - '("@ifpackageloaded" "package" 2) - '("@ifpackagelater" "package" "date" 2) - '("@ifpackagewith" "package" "options" 2) - '("message" "Log Message") - '("@ifundefined" "Macro Name" 2) - '("@ifnextchar" (TeX-arg-literal " ") (TeX-arg-free "character") 2 ) - "expandafter")))) - -;; Local Variables: -;; coding: iso-8859-1 -;; End: diff --git a/packages/auctex/style/ltxdoc.el b/packages/auctex/style/ltxdoc.el deleted file mode 100644 index 113e0df3b..000000000 --- a/packages/auctex/style/ltxdoc.el +++ /dev/null @@ -1,40 +0,0 @@ -;;; ltxdoc.el --- AUCTeX style for `ltxdoc.cls' - -;; Copyright (C) 2004 Free Software Foundation, Inc. - -;; Author: Frank Küster -;; Maintainer: auctex-devel@gnu.org -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `ltxdoc.cls'. - -;;; Code: - -(TeX-add-style-hook - "ltxdoc" - (lambda () - (TeX-run-style-hooks "doc") - (TeX-run-style-hooks "ltx-base"))) - -;; Local Variables: -;; coding: iso-8859-1 -;; End: diff --git a/packages/auctex/style/makeidx.el b/packages/auctex/style/makeidx.el deleted file mode 100644 index 3425e49f5..000000000 --- a/packages/auctex/style/makeidx.el +++ /dev/null @@ -1,48 +0,0 @@ -;;; makeidx.el --- AUCTeX support for makeidx.sty - -;; Copyright (C) 1999 Free Software Foundation, Inc. - -;; Author: Carsten Dominik -;; Maintainer: auctex-devel@gnu.org - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Code: - -(TeX-add-style-hook "makeidx" - (lambda () - (TeX-add-symbols - "printindex" "indexspace") - - ;; Parsing the default index macro is defined in latex.el - ;; The same is true form completion in the index macro - - ;; Completion for the |see macro - (setq TeX-complete-list - (append - '(("|see{\\([^{}\n\r]*\\)" 1 LaTeX-index-entry-list)) - TeX-complete-list)) - - ;; RefTeX support - (and (fboundp 'reftex-add-index-macros) - (reftex-add-index-macros '(default))))) - -(defvar LaTeX-makeidx-package-options nil - "Package options for the makeidx package.") - -;;; makeidx.el ends here diff --git a/packages/auctex/style/mdwlist.el b/packages/auctex/style/mdwlist.el deleted file mode 100644 index 2e2634d52..000000000 --- a/packages/auctex/style/mdwlist.el +++ /dev/null @@ -1,63 +0,0 @@ -;;; mdwlist.el --- AUCTeX style for `mdwlist.sty' - -;; Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -;; Maintainer: auctex-devel@gnu.org -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `mdwlist.sty'. - -;;; Code: - -(TeX-add-style-hook - "mdwlist" - (lambda () - (TeX-add-symbols - '("makecompactlist" "New environment" "Existing environment") - '("suspend" "Environment") ; this could be done nicer by automatically - '("resume" "Environment")) ; determining the environment - (LaTeX-add-environments - '("enumerate*" LaTeX-env-item) - '("itemize*" LaTeX-env-item) - '("description*" LaTeX-env-item)) - ;; Indentation and filling - (make-local-variable 'LaTeX-begin-regexp) - (setq LaTeX-begin-regexp (concat LaTeX-begin-regexp "\\|resume\\b")) - (make-local-variable 'LaTeX-end-regexp) - (setq LaTeX-end-regexp (concat LaTeX-end-regexp "\\|suspend\\b")) - (make-local-variable 'paragraph-start) - (setq paragraph-start (concat paragraph-start - "\\|[ \t]*" TeX-comment-start-regexp "*[ \t]*" - (regexp-quote TeX-esc) - "\\(resume\\b\\|suspend\\b\\)")) - ;; Fontification - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("makecompactlist" "{{") - ("suspend" "[{") - ("resume" "[{[")) - 'function)))) - -(defvar LaTeX-mdwlist-package-options nil - "Package options for the mdwlist package.") - -;;; mdwlist.el ends here diff --git a/packages/auctex/style/multido.el b/packages/auctex/style/multido.el deleted file mode 100644 index 786185ea5..000000000 --- a/packages/auctex/style/multido.el +++ /dev/null @@ -1,52 +0,0 @@ -;;; multido.el --- AUCTeX style for `multido.sty' - -;; Copyright (C) 2007 Free Software Foundation, Inc. - -;; Author: Holger Sparr -;; Created: 21 Jun 2007 -;; Based on: Jean-Philippe Georget's multido.el -;; Keywords: latex, pstricks, auctex, emacs - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `multido.sty'. - -;;; TODO: -;; -;; -- better argument support for multido -;; -- parsing for fpAdd resp. fpSub - -;;; Code: - -(TeX-add-style-hook - "multido" - (function - (lambda () - (TeX-add-symbols - '("multido" "\var=+-" "Repititions" t) - '("Multido" "\var=+-" "Repititions" t) - '("mmultido" "\var=+-" "Repititions" t) - '("MMultido" "\var=+-" "Repititions" t) - "multidostop" - "multidocount" - '("fpAdd" "Summand 1" "Summand 2" "Register") - '("fpSub" "Minuend" "Subtrahend" "Register"))))) - -;;; multido.el ends here diff --git a/packages/auctex/style/multind.el b/packages/auctex/style/multind.el deleted file mode 100644 index 45c710b0e..000000000 --- a/packages/auctex/style/multind.el +++ /dev/null @@ -1,61 +0,0 @@ -;;; multind.el --- AUCTeX support for multiple indices with multind.sty. - -;; Copyright (C) 1999 Free Software Foundation, Inc. - -;; Author: Carsten Dominik -;; Maintainer: auctex-devel@gnu.org - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Code: - -(TeX-add-style-hook "multind" - (lambda () - - ;; Commands - (TeX-add-symbols - '("makeindex" "Indextag") - '("index" TeX-arg-index-tag TeX-arg-index) - '("printindex" TeX-arg-index-tag "Title") - "printindex" "indexspace") - - ;; Parsing index macros - (setq LaTeX-auto-regexp-list - (append - ;; The first regexp is faster, but less accurate - ;; '(("\\\\index\\*?{[^{}]*}{\\([^}]*\\)" 1 LaTeX-auto-index-entry)) - ;; The second regexp is very good, but slower - '(("\\\\index\\*?{[^{}]*}{\\([^}{]*\\({[^}{]*\\({[^}{]*\\({[^}{]*}[^}{]*\\)*}[^}{]*\\)*}[^}{]*\\)*\\)}" - 1 LaTeX-auto-index-entry)) - LaTeX-auto-regexp-list)) - - ;; Completion for index entries in the |see and \index commands - (setq TeX-complete-list - (append - '(("\\\\index{[^{}]*}{\\([^{}\n\r]*\\)" 1 LaTeX-index-entry-list) - ("|see{\\([^}]*\\)" 1 LaTeX-index-entry-list)) - TeX-complete-list)) - - ;; RefTeX support - (and (fboundp 'reftex-add-index-macros) - (reftex-add-index-macros '(multind))))) - -(defvar LaTeX-multind-package-options nil - "Package options for the multind package.") - -;;; multind.el ends here diff --git a/packages/auctex/style/natbib.el b/packages/auctex/style/natbib.el deleted file mode 100644 index 312430654..000000000 --- a/packages/auctex/style/natbib.el +++ /dev/null @@ -1,110 +0,0 @@ -;;; natbib.el --- Style hook for the NatBib package -;;; -;;; AUTHOR: Carsten Dominik -;;; building on older code from Berwin Turlach - -;;; Code: - -(TeX-add-style-hook "natbib" - (function - (lambda () - ;; The number in the cdr of the following list indicates how many - ;; optional note arguments we consider useful. Prompting for those - ;; arguments will still depend upon `TeX-arg-cite-note-p'. - (let ((citecmds - '(("cite" . 0) - ("citet" . 1) ("citet*" . 1) ("citealt" . 1) ("citealt*" . 1) - ("citep" . 2) ("citep*" . 2) ("citealp" . 2) ("citealp*" . 2) - ("citeauthor" . 0) ("citeauthor*" . 0) ("citefullauthor" . 0) - ("citeyear" . 0) ("citeyearpar" . 0) - ("shortcites" . 0)))) - - ;; Add these symbols - (apply - 'TeX-add-symbols - (mapcar - (lambda (cmd) - (cond - ((= (cdr cmd) 0) - ;; No optional arguments - (list (car cmd) 'TeX-arg-cite)) - ((= (cdr cmd) 1) - ;; Just one optional argument, the post note - (list - (car cmd) - '(TeX-arg-conditional TeX-arg-cite-note-p (["Post-note"]) nil) - 'TeX-arg-cite)) - ((= (cdr cmd) 2) - ;; Pre and post notes - (list - (car cmd) - '(TeX-arg-conditional TeX-arg-cite-note-p (natbib-note-args) nil) - 'TeX-arg-cite)))) - citecmds)) - - ;; Add the other symbols - (TeX-add-symbols - '("citetext" "Text") - '("bibpunct" ["Post note separator"] - "Opening bracket" - "Closing bracket" - "Punctuation between multiple citations" - "style [n]umeric [s]uperscript [a]uthor-year" - "Punctuation between author and year" - "Punctuation between years for common authors") - '("citestyle" "Style") - '("citeindextrue") - '("citeindexfalse") - '("citeindextype")) - - ;; Make an entry in TeX-complete-list - (add-to-list - 'TeX-complete-list - (list - (concat "\\\\\\(" - (mapconcat (lambda (x) (regexp-quote (car x))) - citecmds "\\|") - "\\)\\(\\[[^]\n\r\\%]*\\]\\)*{\\([^{}\n\r\\%,]*,\\)*\\([^{}\n\r\\%,]*\\)") - 4 'LaTeX-bibitem-list "}"))) - - ;; Fontification - (when (and (fboundp 'font-latex-add-keywords) - (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("cite" "*[[{") - ("citet" "*[[{") - ("citealt" "*[[{") - ("citep" "*[[{") - ("citealp" "*[[{") - ("citeauthor" "*[[{") - ("citefullauthor" "[[{") - ("citeyear" "[[{") - ("citeyearpar" "[[{") - ("shortcites" "{")) - 'reference)) - - ;; Tell RefTeX - (if (fboundp 'reftex-set-cite-format) - (reftex-set-cite-format 'natbib))))) - -(defun natbib-note-args (optional &optional prompt definition) - "Prompt for two note arguments a natbib citation command." - (if TeX-arg-cite-note-p - (let* ((pre (read-string - (TeX-argument-prompt optional optional "Pre-note"))) - (post (read-string - (TeX-argument-prompt optional optional "Post-note")))) - (if (not (string= pre "")) (insert "[" pre "]")) - (if (not (string= post "")) - (insert "[" post "]") - ;; Make sure that we have an empty post note if pre is not empty - (if (string= pre "") (insert "[]")))))) - -(defvar LaTeX-natbib-package-options '("numbers" "super" "authoryear" - "round" "square" "angle" "curly" - "comma" "colon" "nobibstyle" - "bibstyle" "openbib" "sectionbib" - "sort" "sort&compress" - "longnamesfirst" "nonamebreak") - "Package options for the natbib package.") - -;; natbib.el ends here diff --git a/packages/auctex/style/naustrian.el b/packages/auctex/style/naustrian.el deleted file mode 100644 index 0eb129411..000000000 --- a/packages/auctex/style/naustrian.el +++ /dev/null @@ -1,39 +0,0 @@ -;;; naustrian.el --- AUCTeX style for the `naustrian' babel option. - -;; Copyright (C) 2009 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2009-12-28 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; Set up AUCTeX for editing Austrian text in connection with the -;; `naustrian' babel option. - -;;; Code: - -(TeX-add-style-hook - "naustrian" - (lambda () - (TeX-run-style-hooks "ngerman"))) - -;;; naustrian.el ends here diff --git a/packages/auctex/style/ngerman.el b/packages/auctex/style/ngerman.el deleted file mode 100644 index d6b972acf..000000000 --- a/packages/auctex/style/ngerman.el +++ /dev/null @@ -1,46 +0,0 @@ -;;; ngerman.el --- Setup AUCTeX for editing German text. - -;;; Commentary: -;; -;; Cater for some specialities of `(n)german.sty', e.g. special quote -;; and hyphen strings or that `"' makes the following letter an -;; umlaut. - -;;; Code: - -(defvar LaTeX-german-mode-syntax-table - (copy-syntax-table LaTeX-mode-syntax-table) - "Syntax table used in LaTeX mode when using `german.sty'.") - -(modify-syntax-entry ?\" "w" LaTeX-german-mode-syntax-table) - -(TeX-add-style-hook - "ngerman" - (lambda () - (set-syntax-table LaTeX-german-mode-syntax-table) - ;; XXX: Handle former customizations of the now defunct - ;; German-specific variables. References to the respective - ;; variables are to be deleted in future versions. (now = 2005-04-01) - (unless (eq (car TeX-quote-language) 'override) - (let ((open-quote (if (and (boundp 'LaTeX-german-open-quote) - LaTeX-german-open-quote) - LaTeX-german-open-quote - "\"`")) - (close-quote (if (and (boundp 'LaTeX-german-close-quote) - LaTeX-german-close-quote) - LaTeX-german-close-quote - "\"'")) - (q-after-q (if (and (boundp 'LaTeX-german-quote-after-quote) - LaTeX-german-quote-after-quote) - LaTeX-german-quote-after-quote - t))) - (setq TeX-quote-language - `("ngerman" ,open-quote ,close-quote ,q-after-q)))) - (setq LaTeX-babel-hyphen-language "ngerman") - ;; Fontification of quotation marks. - (when (fboundp 'font-latex-add-quotes) - (font-latex-add-quotes '("\"`" "\"'")) - (font-latex-add-quotes '("\">" "\"<" german))) - (run-hooks 'TeX-language-de-hook))) - -;;; ngerman.el ends here diff --git a/packages/auctex/style/nicefrac.el b/packages/auctex/style/nicefrac.el deleted file mode 100644 index 77aee5123..000000000 --- a/packages/auctex/style/nicefrac.el +++ /dev/null @@ -1,45 +0,0 @@ -;;; nicefrac.el --- AUCTeX style for the LaTeX package `nicefrac.sty' (v0.9b) - -;; Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -;; Author: Christian Schlauer -;; Maintainer: auctex-devel@gnu.org -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `nicefrac.sty'. - -;;; Code: - -(TeX-add-style-hook - "nicefrac" - (lambda () - (TeX-add-symbols - '("nicefrac" [ "Font changing command" ] "Numerator" "Denominator")) - ;; Fontification - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("nicefrac" "[{{")) 'textual)))) - -(defvar LaTeX-nicefrac-package-options '("nice" "ugly") - "Package options for the nicefrac package.") - -;;; nicefrac.el ends here diff --git a/packages/auctex/style/nomencl.el b/packages/auctex/style/nomencl.el deleted file mode 100644 index 3b04d7b57..000000000 --- a/packages/auctex/style/nomencl.el +++ /dev/null @@ -1,70 +0,0 @@ -;;; nomencl.el --- AUCTeX style for the nomencl class. - -;; Copyright (C) 2007 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2007-10-09 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for the nomencl package. - -;;; Code: - -(defvar LaTeX-nomencl-package-options - '("refeq" "norefeq" "refpage" "norefpage" "prefix" "noprefix" "cfg" "nocfg" - "intoc" "notintoq" "compatible" "noncompatible" "croatian" "danish" - "english" "french" "german" "italian" "polish" "portuguese" "russian" - "spanish" "ukrainian") - "Package options for the nomencl package.") - -(TeX-add-style-hook - "nomencl" - (lambda () - (TeX-add-symbols - '("makenomenclature" 0) - '("printnomenclature" ["Label width"]) - '("nomenclature" ["Prefix"] "Symbol" "Description") - "nomrefeq" - "nomrefpage" - "nomrefeqpage" - "nomnorefeq" - "nomnorefpage" - "nomnorefeqpage" - '("nomlabelwidth" 0) - '("nomname" 0) - '("nomgroup" 0) - '("nompreamble" 0) - '("nompostamble" 0) - '("nomitemsep" 0) - '("nomprefix" 0) - '("nomlabel" 0) - '("nomentryend" 0) - '("eqdeclaration" 0) - '("pagedeclaration" 0)) - ;; Fontification - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("nomenclature" "[{{")) - 'reference)))) - -;;; nomencl.el ends here diff --git a/packages/auctex/style/paralist.el b/packages/auctex/style/paralist.el deleted file mode 100644 index a004d3c49..000000000 --- a/packages/auctex/style/paralist.el +++ /dev/null @@ -1,104 +0,0 @@ -;;; paralist.el -- AUCTeX style for paralist.sty - -;; Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2003-10-22 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `paralist.sty'. - -;;; Code: - -;; Insert an itemize-ish environment and ask for an optional label -(defun LaTeX-paralist-env-item-opt-label (environment) - "Insert ENVIRONMENT, an optional label and the first item." - (LaTeX-insert-environment - environment - (let ((label (read-string "(Optional) Label: "))) - (concat (unless (zerop (length label)) - (format "[%s]" label))))) - (LaTeX-find-matching-begin) - (end-of-line 1) - (delete-char 1) - (delete-horizontal-space) - (LaTeX-insert-item)) - -(TeX-add-style-hook - "paralist" - (lambda () - - ;; Add compactdesc to the list of environments which have an optional - ;; argument for each item. - (add-to-list 'LaTeX-item-list '("compactdesc" . LaTeX-item-argument)) - - ;; New symbols - (TeX-add-symbols - '("pointedenum") - '("pointlessenum") - '("paradescriptionlabel") - '("setdefaultitem" "First level" "Second level" "Third level" - "Fourth level") - '("setdefaultenum" "First level" "Second level" "Third level" - "Fourth level") - '("setdefaultleftmargin" "First level" "Second level" "Third level" - "Fourth level" "Fifth level" "Sixth level")) - - ;; New environments - (LaTeX-add-environments - '("asparaenum" LaTeX-paralist-env-item-opt-label) - '("inparaenum" LaTeX-paralist-env-item-opt-label) - '("compactenum" LaTeX-paralist-env-item-opt-label) - '("asparaitem" LaTeX-paralist-env-item-opt-label) - '("inparaitem" LaTeX-paralist-env-item-opt-label) - '("compactitem" LaTeX-paralist-env-item-opt-label) - '("compactdesc" LaTeX-env-item) - ;; FIXME: Should not be available if package is loaded with option - ;; `olditem': - '("itemize" LaTeX-paralist-env-item-opt-label) - ;; FIXME: Should not be available if package is loaded with option - ;; `oldenum': - '("enumerate" LaTeX-paralist-env-item-opt-label) - ;; FIXME: Only defined if package is loaded with option - ;; `defblank': - '("asparablank" LaTeX-env-item) - '("inparablank" LaTeX-env-item)) - - ;; Fontification - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("setdefaultitem" "{{{{") - ("setdefaultenum" "{{{{") - ("setdefaultleftmargin" "{{{{{{")) - 'variable)))) - -(defvar LaTeX-paralist-package-options '("newitem" "olditem" "newenum" - "oldenum" "alwaysadjust" - "neveradjust" "neverdecrease" - "increaseonly" "defblank" - "pointedenum" "pointlessenum" - "cfg" "nocfg" "flushright" - "flushleft") - "Package options for the paralist package.") - -;;; paralist.el ends here diff --git a/packages/auctex/style/pdfsync.el b/packages/auctex/style/pdfsync.el deleted file mode 100644 index a366fd7f4..000000000 --- a/packages/auctex/style/pdfsync.el +++ /dev/null @@ -1,91 +0,0 @@ -;;; pdfsync.el --- AUCTeX style for `pdfsync.sty' - -;; Copyright (C) 2005, 2008 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2005-12-28 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `pdfsync.sty'. - -;;; Code: - -(defun LaTeX-pdfsync-output-page () - "Return page number in output file corresponding to buffer position." - (let* ((line (TeX-line-number-at-pos)) - (master (TeX-active-master)) - (file (file-name-sans-extension - (file-relative-name (buffer-file-name) - (file-name-directory master)))) - (pdfsync-file (concat master ".pdfsync")) - (buf-live-p (get-file-buffer pdfsync-file)) - (sync-record "0") - (sync-line "-1") - (sync-page "1") - last-match) - (when (file-exists-p pdfsync-file) - (with-current-buffer (find-file-noselect pdfsync-file) - (save-restriction - (goto-char (point-min)) - ;; Narrow region to file in question. - (when (not (string= file master)) - (re-search-forward (concat "^(" file "\\(.tex\\)?$") nil t) - (let ((beg (match-beginning 0))) - (goto-char beg) - (narrow-to-region (line-beginning-position 2) - (progn (forward-sexp) (point)))) - (goto-char (point-min))) - ;; Look for the record number. - (catch 'break - (while (re-search-forward "^(\\|^l \\([0-9]+\\) \\([0-9]+\\)" nil t) - (cond ((string= (match-string 0) "(") - (goto-char (match-beginning 0)) - (forward-sexp)) - ((> (string-to-number (match-string 2)) line) - (throw 'break nil)) - (t - (setq sync-record (match-string 1) - sync-line (match-string 2) - last-match (match-beginning 0)))))) - ;; Look for the page number. - (goto-char (or last-match (point-min))) - ;; There might not be any p or s lines for the current file, - ;; so make it possible to search further. - (widen) - (catch 'break - (while (re-search-forward "^p \\([0-9]+\\)" nil t) - (when (>= (string-to-number (match-string 1)) - (string-to-number sync-record)) - (re-search-backward "^s \\([0-9]+\\)" nil t) - (setq sync-page (match-string 1)) - (throw 'break nil))))) - ;; Kill the buffer if it was loaded by us. - (unless buf-live-p (kill-buffer (current-buffer))))) - sync-page)) - -(TeX-add-style-hook - "pdfsync" - (lambda () - (setq TeX-source-correlate-output-page-function 'LaTeX-pdfsync-output-page))) - -;;; pdfsync.el ends here diff --git a/packages/auctex/style/plfonts.el b/packages/auctex/style/plfonts.el deleted file mode 100644 index d165ac258..000000000 --- a/packages/auctex/style/plfonts.el +++ /dev/null @@ -1,31 +0,0 @@ -;;; plfonts.el - Setup AUC TeX for editing Polish text with plfonts.sty - -;; $Id: plfonts.el,v 1.1 1994/01/30 21:17:25 amanda Exp $ - -;;; Commentary: -;; -;; `plfonts.sty' use `"' to make next character Polish. -;; `plfonts.sty' L. Holenderski, IIUW, lhol@mimuw.edu.pl - -;;; Code: - -(defvar LaTeX-plfonts-mode-syntax-table - (copy-syntax-table LaTeX-mode-syntax-table) - "Syntax table used in LaTeX mode when using `plfonts.sty'.") - -(modify-syntax-entry ?\" "w" LaTeX-plfonts-mode-syntax-table) - -(TeX-add-style-hook "plfonts" - (function (lambda () - (set-syntax-table LaTeX-plfonts-mode-syntax-table) - (make-local-variable 'TeX-open-quote) - (make-local-variable 'TeX-close-quote) - (make-local-variable 'TeX-quote-after-quote) - (make-local-variable 'TeX-command-default) - (setq TeX-open-quote "\"<") - (setq TeX-close-quote "\">") - (setq TeX-quote-after-quote t) - (setq TeX-command-default "plLaTeX") - (run-hooks 'TeX-language-pl-hook)))) - -;;; plfonts.el ends here diff --git a/packages/auctex/style/plhb.el b/packages/auctex/style/plhb.el deleted file mode 100644 index f933cc12c..000000000 --- a/packages/auctex/style/plhb.el +++ /dev/null @@ -1,31 +0,0 @@ -;;; plhb.el - Setup AUC TeX for editing Polish text with plhb.sty - -;; $Id: plhb.el,v 1.1 1994/01/30 21:17:27 amanda Exp $ - -;;; Commentary: -;; -;; `plhb.sty' use `"' to make next character Polish. -;; `plhb.sty' J. S. Bie\'n, IIUW, jsbien@mimuw.edu.pl - -;;; Code: - -(defvar LaTeX-plhb-mode-syntax-table - (copy-syntax-table LaTeX-mode-syntax-table) - "Syntax table used in LaTeX mode when using `plhb.sty'.") - -(modify-syntax-entry ?\" "w" LaTeX-plhb-mode-syntax-table) - -(TeX-add-style-hook "plhb" - (function (lambda () - (set-syntax-table LaTeX-plhb-mode-syntax-table) - (make-local-variable 'TeX-open-quote) - (make-local-variable 'TeX-close-quote) - (make-local-variable 'TeX-command-default) - (make-local-variable 'TeX-quote-after-quote) - (setq TeX-open-quote "\"<") - (setq TeX-close-quote "\">") - (setq TeX-quote-after-quote t) - (setq TeX-command-default "plLaTeX") - (run-hooks 'TeX-language-pl-hook)))) - -;;; plhb.el ends here diff --git a/packages/auctex/style/polish.el b/packages/auctex/style/polish.el deleted file mode 100644 index 312274af9..000000000 --- a/packages/auctex/style/polish.el +++ /dev/null @@ -1,51 +0,0 @@ -;;; polish.el --- AUCTeX style for the `polish' babel option. - -;; Copyright (C) 2007 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2007-01-08 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; Set up AUCTeX for editing Polish text in connection with the -;; `polish' babel option. - -;;; Code: - -(defvar LaTeX-polish-mode-syntax-table - (copy-syntax-table LaTeX-mode-syntax-table) - "Syntax table used in LaTeX mode when using `polish.sty'.") - -(modify-syntax-entry ?\" "w" LaTeX-polish-mode-syntax-table) - -(TeX-add-style-hook - "polish" - (lambda () - (set-syntax-table LaTeX-polish-mode-syntax-table) - (setq TeX-quote-language '("polish" "\"`" "\"'" t)) - ;; Fontification of quotation marks. - (when (fboundp 'font-latex-add-quotes) - (font-latex-add-quotes '("\"`" "\"'")) - (font-latex-add-quotes '("\"<" "\">" french))) - (run-hooks 'TeX-language-pl-hook))) - -;;; polish.el ends here diff --git a/packages/auctex/style/polski.el b/packages/auctex/style/polski.el deleted file mode 100644 index 1f5d62ed1..000000000 --- a/packages/auctex/style/polski.el +++ /dev/null @@ -1,54 +0,0 @@ -;;; polski.el --- AUCTeX style for `polski.sty'. - -;; Copyright (C) 2007 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2007-01-11 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; Set up AUCTeX for editing Polish text in connection with -;; `polski.sty'. - -;;; Code: - -(defvar LaTeX-polski-package-options - '("plmath" "nomathsymbols" "MeX" "T1" "QX" "OT1" "OT4" "prefixinginverb" - "noprefixinginverb" "roku" "r." "noroku") - "Package options for polski.sty.") - -(TeX-add-style-hook - "polski" - (lambda () - (TeX-add-symbols - ;; Dashes - "dywiz" - "pauza" - "ppauza") - ;; Quotation marks - (setq TeX-quote-language '("polski" ",," "''" t)) - ;; Fontification of quotation marks. - (when (fboundp 'font-latex-add-quotes) - (font-latex-add-quotes '(",," "''"))) - (run-hooks 'TeX-language-pl-hook))) - -;;; polski.el ends here diff --git a/packages/auctex/style/pst-grad.el b/packages/auctex/style/pst-grad.el deleted file mode 100644 index b1775611b..000000000 --- a/packages/auctex/style/pst-grad.el +++ /dev/null @@ -1,65 +0,0 @@ -;;; pst-grad.el --- AUCTeX style for `pst-grad.sty' - -;; Copyright (C) 2007 Free Software Foundation, Inc. - -;; Author: Holger Sparr -;; Created: 21 Jun 2007 -;; Keywords: latex, pstricks, auctex, emacs - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `pst-grad.sty'. - -;;; TODO: -;; -;; -- - -;;; Code: - -;;; Parameters -(defvar LaTeX-pstgrad-parameters-name-list - '("gradangle" "gradbegin" "gradend" "gradlines" "gradmidpoint" - "gradientHSB" "GradientCircle" "GradientPos" "GradientScale") - "A list of parameter names in pst-grad.") - -;;; Aliases -(defvaralias 'LaTeX-pst-gradbegin-list 'LaTeX-pst-color-list) -(defvaralias 'LaTeX-pst-gradend-list 'LaTeX-pst-color-list) - -;;; Hook -(TeX-add-style-hook - "pst-grad" - (function - (lambda () - (TeX-run-style-hooks - "pstricks") - (unless (member "gradient" LaTeX-pst-fillstyle-list) - (setq LaTeX-pst-fillstyle-list (append LaTeX-pst-fillstyle-list - '("gradient"))) - (setq LaTeX-pst-parameters-completion-regexp - (concat - (substring LaTeX-pst-parameters-completion-regexp 0 -2) - "\\|gradbegin\\|gradend\\)"))) - (make-local-variable 'LaTeX-pst-parameters-name-list) - (setq LaTeX-pst-parameters-name-list - (append LaTeX-pstgrad-parameters-name-list - LaTeX-pst-parameters-name-list))))) - -;;; pst-grad.el ends here diff --git a/packages/auctex/style/pst-node.el b/packages/auctex/style/pst-node.el deleted file mode 100644 index d5ff2743e..000000000 --- a/packages/auctex/style/pst-node.el +++ /dev/null @@ -1,191 +0,0 @@ -;;; pst-node.el --- AUCTeX style for `pst-node.sty' - -;; Copyright (C) 2007 Free Software Foundation, Inc. - -;; Author: Holger Sparr -;; Created: 21 Jun 2007 -;; Based on: Jean-Philippe Georget's pst-plot.el -;; Keywords: latex, pstricks, auctex, emacs - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `pst-node.sty'. - -;;; TODO: -;; -;; -- self parsing of possible node names -;; -- adding more macro support - -;;; Code: - -(defalias 'LaTeX-pst-node 'LaTeX-pst-point) - -(defvar LaTeX-pstnode-parameters-completion-regexp - "\\(npos\\|nrot\\)" - "Regexp for `string-match'ing a parameter.") - -(defvar LaTeX-pstnode-parameters-boolean-regexp "show\\([a-zA-Z]+\\)" - "Regexp for `string-match'ing a parameter.") - -(defvar LaTeX-pstnode-npos-list '(".25" ".5" ".75" "1" "1.5" "2") - "A list of values for npos in nput.") - -(defvar LaTeX-pstnode-nrot-list '(":U" ":D" ":R" ":L") - "A list of values for nrot in nput.") - -(defvar LaTeX-pstnode-psmatrix-list - '("mnode" "emnode" "name" "nodealign" "mocl" "rowsep" "colsep" - "mnodesize") - "A list of values for trimode in pstribox.") - -;;; Parameters -(defvar LaTeX-pstnode-parameters-history nil - "History of values for parameters in pst-node.") - -(defvar LaTeX-pstnode-parameters-value-history nil - "History of parameter values in pst-node.") - -(defvar LaTeX-pstnode-parameters-name-list - '("angle" "angleA" "angleB" "arcangle" "arcangleA" "arcangleB" "arm" - "armA" "armB" "boxsize" "colsep" "framesize" "href" "loopsize" - "ncurv" "ncurvA" "ncurvB" "nodesepA" "nodesepB" "npos" "nrot" - "offset" "offsetA" "offsetB" "radius" "vref" "Xnodesep" "XnodesepA" - "XnodesepB" "Ynodesep" "YnodesepA" "YnodesepB") - "A list of parameters' name in pst-node.") - -(defvar LaTeX-pstnode-parameters-name-history nil - "History of parameter names in pst-node.") - -;;; Derived Functions from pstricks.el defuns -(defun LaTeX-pstnode-parameter-value (param) - "See documentation of `LaTeX-package-parameter-value'." - (LaTeX-package-parameter-value param "pstnode")) - -(defun LaTeX-pstnode-parameters-pref-and-chosen (param &optional noskip) - "See documentation of `LaTeX-package-parameters-pref-and-chosen'." - (LaTeX-package-parameters-pref-and-chosen param "pstnode" noskip)) - -(defun LaTeX-pstnode-parameters (optional &optional preparam param) - "See documentation of `LaTeX-package-parameters-pref-and-chosen'." - (LaTeX-package-parameters optional "pstnode" preparam param)) - -;;; Macros -(defun LaTeX-pstnode-macro-nput (optional &optional arg) - "Return \\nput arguments after querying." - (insert "[rot=" (LaTeX-pst-angle) "]{" (LaTeX-pst-angle) "}{" - (LaTeX-pst-node) "}")) - -(defun LaTeX-pstnode-macro-cnodeput (optional &optional arg) - "Return \\cnodeput arguments after querying." - (let ((rotation (if current-prefix-arg (LaTeX-pst-angle) nil)) - (pnt (if current-prefix-arg (LaTeX-pst-point) nil))) - (insert (if rotation (format "{%s}" rotation) "") - (if pnt (format "(%s)" pnt) "") "{" (LaTeX-pst-node) "}"))) - -(defun LaTeX-pstnode-macro-nc (optional &optional arg) - "Return \\nc* arguments after querying." - (let ((arrows (LaTeX-pst-arrows))) - (insert (if arrows (format "{%s}" arrows) "") "{" (LaTeX-pst-node) - "}{" (LaTeX-pst-node) "}"))) - -(defun LaTeX-pstnode-macro-pc (optional &optional arg) - "Return \\pc* arguments after querying." - (let ((arrows (LaTeX-pst-arrows))) - (insert (if arrows (format "{%s}" arrows) "") "(" (LaTeX-pst-point) - ")(" (LaTeX-pst-point) ")"))) - -(defun LaTeX-pstnode-macro-tnabcput (optional &optional arg) - "Return \\t?put or \\n?put arguments after querying." - (TeX-argument-insert (LaTeX-pstnode-parameters-pref-and-chosen - '("nrot" "npos")) optional)) - -;;; Environments -(defun LaTeX-pstnode-env-psmatrix (env) - "Return psmatrix environment with arguments." - (let ((opt (completing-read-multiple "Options: " - LaTeX-pstnode-psmatrix-list))) - (LaTeX-insert-environment env opt))) - -(TeX-add-style-hook - "pst-node" - (function - (lambda () - (LaTeX-add-environments - '("psmatrix" LaTeX-pstnode-env-psmatrix)) - (TeX-add-symbols - '("MakeShortNab" 2) '("MakeShortTablr" 4) '("PSTnodesLoaded" 0) - '("nput" LaTeX-pstnode-macro-nput TeX-arg-macro) - '("cnodeput" [LaTeX-pst-parameters] LaTeX-pstnode-macro-cnodeput t) - '("Cnode" [LaTeX-pstnode-parameters] LaTeX-pst-point-in-parens t) - '("cnode" [LaTeX-pstnode-parameters] "Radius" t) - '("fnode" [LaTeX-pstnode-parameters] LaTeX-pst-point-in-parens t) - '("fnode*" [LaTeX-pstnode-parameters] LaTeX-pst-point-in-parens t) - '("dotnode" [LaTeX-pstnode-parameters] LaTeX-pst-point-in-parens t) - '("pnode" LaTeX-pst-point-in-parens t) - '("Rnode" [LaTeX-pstnode-parameters ("href" "vref")] - (TeX-arg-eval LaTeX-pst-point) t) - '("rnode" [LaTeX-pstnode-parameters ("ref")] - (TeX-arg-eval LaTeX-pst-point) t) - '("circlenode" [LaTeX-pst-parameters] - (TeX-arg-eval LaTeX-pst-point) t) - '("dianode" [LaTeX-pst-parameters] "Node Name" t) - '("ovalnode" [LaTeX-pst-parameters] "Node Name" t) - '("trinode" [LaTeX-pst-parameters] "Node Name" t) - '("dotnode" [LaTeX-pst-parameters] LaTeX-pst-point-in-parens - "Node Name") - '("naput" [LaTeX-pstnode-macro-tnabcput] t) - '("nbput" [LaTeX-pstnode-macro-tnabcput] t) - '("ncput" [LaTeX-pstnode-macro-tnabcput] t) - '("taput" [LaTeX-pstnode-macro-tnabcput] t) - '("tbput" [LaTeX-pstnode-macro-tnabcput] t) - '("thput" [LaTeX-pstnode-macro-tnabcput] t) - '("tlput" [LaTeX-pstnode-macro-tnabcput] t) - '("trput" [LaTeX-pstnode-macro-tnabcput] t) - '("tvput" [LaTeX-pstnode-macro-tnabcput] t) - '("ncline" [LaTeX-pst-parameters] LaTeX-pstnode-macro-nc) - '("ncarc" [LaTeX-pst-parameters] LaTeX-pstnode-macro-nc) - '("ncdiag" [LaTeX-pst-parameters] LaTeX-pstnode-macro-nc) - '("ncdiagg" [LaTeX-pst-parameters] LaTeX-pstnode-macro-nc) - '("ncbar" [LaTeX-pst-parameters] LaTeX-pstnode-macro-nc) - '("ncangle" [LaTeX-pst-parameters] LaTeX-pstnode-macro-nc) - '("ncangles" [LaTeX-pst-parameters] LaTeX-pstnode-macro-nc) - '("ncloop" [LaTeX-pst-parameters] LaTeX-pstnode-macro-nc) - '("nccurve" [LaTeX-pst-parameters] LaTeX-pstnode-macro-nc) - '("nccircle" [LaTeX-pst-parameters] LaTeX-pstnode-macro-nc) - '("ncbox" [LaTeX-pst-parameters] LaTeX-pstnode-macro-nc) - '("ncarcbox" [LaTeX-pst-parameters] LaTeX-pstnode-macro-nc) - '("pcline" [LaTeX-pst-parameters] LaTeX-pstnode-macro-pc) - '("pccurve" [LaTeX-pst-parameters] LaTeX-pstnode-macro-pc) - '("pcarc" [LaTeX-pst-parameters] LaTeX-pstnode-macro-pc) - '("pcbar" [LaTeX-pst-parameters] LaTeX-pstnode-macro-pc) - '("pcdiag" [LaTeX-pst-parameters] LaTeX-pstnode-macro-pc) - '("pcdiagg" [LaTeX-pst-parameters] LaTeX-pstnode-macro-pc) - '("pcangle" [LaTeX-pst-parameters] LaTeX-pstnode-macro-pc) - '("pcangles" [LaTeX-pst-parameters] LaTeX-pstnode-macro-pc) - '("pcloop" [LaTeX-pst-parameters] LaTeX-pstnode-macro-pc) - '("pcbox" [LaTeX-pst-parameters] LaTeX-pstnode-macro-pc) - '("pcarcbox" [LaTeX-pst-parameters] LaTeX-pstnode-macro-pc) - '("psspan" (TeX-arg-eval LaTeX-pst-input-int)) - '("psrowhook" t) - '("pscolhook" t)) - (TeX-run-style-hooks - "pstricks")))) - -;;; pst-node.el ends here diff --git a/packages/auctex/style/pst-plot.el b/packages/auctex/style/pst-plot.el deleted file mode 100644 index beae60a2b..000000000 --- a/packages/auctex/style/pst-plot.el +++ /dev/null @@ -1,137 +0,0 @@ -;;; pst-plot.el --- AUCTeX style for `pst-plot.sty' - -;; Copyright (C) 2007 Free Software Foundation, Inc. - -;; Author: Holger Sparr -;; Created: 21 Jun 2007 -;; Based on: Jean-Philippe Georget's pst-plot.el -;; Keywords: latex, pstricks, auctex, emacs - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `pst-plot.sty'. - -;;; TODO: -;; -;; -- improve symbol support (especially the pstScalePoints macros) -;; -- check for multido.el necessity - -;;; Code: - -;; Self Parsing -- see (info "(auctex)Hacking the Parser") -(defvar LaTeX-auto-pstplot-regexp-list - '(("\\\\\\(save\\|read\\)data{?\\(\\\\[a-zA-Z]+\\)}?" - 2 LaTeX-auto-pstplot)) - "List of regular expressions to extract arguments of \\*data - macros.") - -(defvar LaTeX-auto-pstplot nil - "Temporary for parsing \\*data definitions.") - -(defun LaTeX-pstplot-cleanup () - "Move symbols from `LaTeX-auto-pstplot to `TeX-auto-symbol'." - (mapcar (lambda (symbol) - ;; (setq TeX-symbol-list (cons (list symbol 0) TeX-symbol-list)) - ;; (setq TeX-auto-symbol (cons (list symbol 0) TeX-auto-symbol))) - (add-to-list 'LaTeX-pstplot-datasets symbol)) - LaTeX-auto-pstplot)) - -(defun LaTeX-pstplot-prepare () - "Clear `LaTeX-auto-pstplot' before use." - (setq LaTeX-auto-pstplot nil)) - -(add-hook 'TeX-auto-prepare-hook 'LaTeX-pstplot-prepare) -(add-hook 'TeX-auto-cleanup-hook 'LaTeX-pstplot-cleanup) - -;;; Parameters -(defvar LaTeX-pstplot-datasets nil - "List of parsed data sets defined with \\savedata or \\readdata.") - -(defvar LaTeX-pstplot-parameters-name-list - '("axesstyle" "labels" "plotpoints" "plotstyle" "showorigin" "ticks" - "ticksize" "tickstyle") - "A list of parameters' name in pst-plot.") - -(defvar LaTeX-pst-ticks-list '(t "none" "all" "x" "y") - "A list of values for ticks in pst-plot.") - -(defvaralias 'LaTeX-pst-labels-list 'LaTeX-pst-ticks-list) - -(defvar LaTeX-pst-plotstyle-list - '(t "dots" "line" "polygon" "curve" "ecurve" "ccurve") - "A list of values for tickstyles in pst-plot.") - -(defvar LaTeX-pst-tickstyle-list '(t "full" "top" "bottom") - "A list of values for tickstyles in pst-plot.") - -(defvar LaTeX-pst-axesstyle-list '(t "axes" "frame" "none") - "A list of values for axesstyles in pst-plot.") - -;;; Macros -(defun LaTeX-pst-macro-psaxes (optional &optional arg) - "Return \\psaxes arguments after querying." -(let* ((cpref (if current-prefix-arg (car current-prefix-arg) 0)) - (arrows (LaTeX-pst-arrows)) - (pnt1 (if (> cpref 4) (LaTeX-pst-point) nil)) - (pnt2 (if (> cpref 0) (LaTeX-pst-point) nil)) - (pnt3 (LaTeX-pst-point))) - ;; insert \psaxes arguments - (insert (if arrows (format "{%s}" arrows) "") - (if pnt1 (format "(%s)" pnt1) "") - (if pnt2 (format "(%s)" pnt2) "") "(" pnt3 ")"))) - -;;; Derived defuns -(defun LaTeX-pstplot-datasets-read () - (TeX-arg-compl-list "Datasets" LaTeX-pstplot-datasets)) - -;;; Hook -(TeX-add-style-hook - "pst-plot" - (function - (lambda () - (mapcar 'TeX-auto-add-regexp LaTeX-auto-pstplot-regexp-list) - (TeX-add-symbols - '("readdata" "Macro Name" TeX-arg-file) - '("savedata" "Macro Name" ["Values"]) - '("dataplot" ["Options"] - (TeX-arg-eval LaTeX-pstplot-datasets-read)) - '("fileplot" ["Options"] TeX-arg-file) - '("listplot" ["Options"] "Values") - '("pstScalePoints" "X-Mod" "Y-Mod") - '("psplot" [LaTeX-pst-parameter] "xmin" "xmax" t) - '("parametricplot" [LaTeX-pst-parameter] "xmin" "xmax" t) - '("psaxes" [LaTeX-pst-parameters] LaTeX-pst-macro-psaxes) - "pshlabel" - "psvlabel") - (TeX-run-style-hooks - "pstricks" - "multido") - (unless (string-match "plotstyle" - LaTeX-pst-parameters-completion-regexp) - (setq LaTeX-pst-parameters-completion-regexp - (concat - (substring LaTeX-pst-parameters-completion-regexp 0 -2) - "\\|plotstyle\\|ticks\\|tickstyle\\|axesstyle\\|labels\\)"))) - (make-local-variable 'LaTeX-pst-parameters-name-list) - (setq LaTeX-pst-parameters-name-list - (append LaTeX-pstplot-parameters-name-list - LaTeX-pst-parameters-name-list))))) - -;;; pst-plot.el ends here diff --git a/packages/auctex/style/pst-slpe.el b/packages/auctex/style/pst-slpe.el deleted file mode 100644 index 2c824549a..000000000 --- a/packages/auctex/style/pst-slpe.el +++ /dev/null @@ -1,67 +0,0 @@ -;;; pst-slpe.el --- AUCTeX style for `pst-slpe.sty' - -;; Copyright (C) 2007 Free Software Foundation, Inc. - -;; Author: Holger Sparr -;; Created: 21 Jun 2007 -;; Keywords: latex, pstricks, auctex, emacs - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `pst-slpe.sty'. - -;;; TODO: -;; -;; -- - -;;; Code: - -;;; Parameters -(defvar LaTeX-pstslpe-parameters-name-list - '("slopeangle" "slopecenter" "slopecolors" "slopebegin" "slopeend" - "sloperadius" "slopesteps") - "A list of parameter names in pst-slpe.") - -;;; Aliases -(defvaralias 'LaTeX-pst-slopebegin-list 'LaTeX-pst-color-list) -(defvaralias 'LaTeX-pst-slopeend-list 'LaTeX-pst-color-list) - -;;; Define hook -(TeX-add-style-hook - "pst-slpe" - (function - (lambda () - (TeX-run-style-hooks - "pstricks") - (unless (member "slope" LaTeX-pst-fillstyle-list) - (setq LaTeX-pst-fillstyle-list - (append LaTeX-pst-fillstyle-list - '("slope" "slopes" "ccslope" "ccslopes" "radslope" - "radslopes"))) - (setq LaTeX-pst-parameters-completion-regexp - (concat - (substring LaTeX-pst-parameters-completion-regexp 0 -2) - "\\|slopebegin\\|slopeend\\)"))) - (make-local-variable 'LaTeX-pst-parameters-name-list) - (setq LaTeX-pst-parameters-name-list - (append LaTeX-pstslpe-parameters-name-list - LaTeX-pst-parameters-name-list))))) - -;;; pst-slpe.el ends here diff --git a/packages/auctex/style/pstricks.el b/packages/auctex/style/pstricks.el deleted file mode 100644 index 6e4df329f..000000000 --- a/packages/auctex/style/pstricks.el +++ /dev/null @@ -1,866 +0,0 @@ -;;; pstricks.el --- AUCTeX style for the `pstricks' package. - -;; Copyright (C) 2007, 2009 Free Software Foundation, Inc. - -;; Author: Holger Sparr -;; Maintainer: auctex-devel@gnu.org -;; Created: 2007-06-14 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: -;; -;; AUCTeX style file for PSTricks -;; -;; Support for basic PSTricks macros and their arguments. Separate -;; history variables for point, angle, ... arguments. -;; -;; Parameter input completion together with input completion for certain -;; parameters (e.g. linestyle, linecolor and the like). -;; -;; There is a PSTricks-specific support for adding new parameters to -;; existing parameter lists or changing existing ones in optional -;; macro arguments. You might want to make those available through -;; key bindings by using something like -;; (define-key LaTeX-mode-map (kbd "C-c p a") -;; 'LaTeX-pst-parameter-add) -;; (define-key LaTeX-mode-map (kbd "C-c p c") -;; 'LaTeX-pst-parameter-change-value) -;; in a personal style file for PSTricks. - -;;; History: -;; -;; 14/06/2007 rewrite of pstricks.el based on Jean-Philippe Georget's -;; pstricks.el version found on - -;;; TODO: -;; -;; -- Use alist or hash-table for parameter input -;; -- Add more regularly used PSTricks macros -;; -- Prevent errors in AUCTeX modes other than LaTeX mode. -;; -- Check if the functionality for adding and changing parameters -;; can be generalized. - -;;; Code: - -;;; General Functions - -(defun TeX-arg-compl-list (list &optional prompt hist) - "Input a value after PROMPT with completion from LIST and HISTORY." - (let ((first (car list))) - (if (and first (listp first)) - (let ((func (nth 0 first)) - (prompt (concat (or (nth 1 first) prompt) ": ")) - (compl (nth 2 first)) - (hist (or (nth 3 first) hist)) - (crm-separator (nth 4 first)) - res) - (setq list (cdr list)) - (cond ((eq func 'completing-read-multiple) - (setq res (funcall func prompt list nil compl nil hist)) - (mapconcat 'identity res crm-separator)) - ((eq func 'completing-read) - (setq res - (funcall func prompt list nil compl nil hist))))) - (completing-read (concat prompt ": ") list nil nil nil hist)))) - -;; XXX: Show default value in prompt. Perhaps extend -;; `TeX-argument-prompt' to do that. -(defun LaTeX-pst-what (what prompt default &optional arg) - "Ask for WHAT with PROMPT with DEFAULT. -The corresponding lists LaTeX-pst--\\(list\\|history\\) -have to exist. - -\(Used to define functions named LaTeX-pst-.\))" - (let ((list (intern (concat "LaTeX-pst-" what "-list"))) - (hist (intern (concat "LaTeX-pst-" what "-history")))) - (if (not arg) - (setq arg (TeX-arg-compl-list (symbol-value list) prompt hist))) - (if (string= arg "") - default - (add-to-list list arg) - arg))) - -(defun LaTeX-pst-input-int (prompt arg) - "Return number as string asked for with PROMPT if no number -passed with ARG." - (unless (numberp arg) - (setq arg (read-number (concat prompt ": ") 2))) - (number-to-string arg)) - -(defun LaTeX-pst-enclose-obj (symbol op cl) - "Enclose string returned by the `funcall' SYMBOL in OP and CL -character." - (let ((str (funcall symbol))) - (if str (insert (char-to-string op) str (char-to-string cl))))) - -(defun LaTeX-package-parameter-value (param pname) - "Ask for possible value of parameter PARAM given as string -available through package name PNAME and return \"param=value\"." - (add-to-list (intern (concat "LaTeX-" pname "-parameters-name-list")) - param) - ;; select predefined set - (let* ((cregexp - (symbol-value - (intern (concat "LaTeX-" pname - "-parameters-completion-regexp")))) - (bregexp - (symbol-value (intern (concat "LaTeX-" pname - "-parameters-boolean-regexp")))) - (parlist (cond - ((string-match cregexp param) - (intern (concat "LaTeX-" pname "-" - (match-string 0 param) "-list"))) - ((string-match bregexp param) - 'LaTeX-pst-boolean-list))) - val compl) - ;; ask for value - (setq val (TeX-arg-compl-list - (symbol-value parlist) - (concat "(Press TAB for completions) " param) - (intern (concat "LaTeX-" pname - "-parameters-value-history")))) - ;; FIXME: This looks broken. `compl' is never set and unless "" - ;; is added to parlist (at least in the Boolean case), the prompt - ;; shown by `TeX-arg-compl-list' will be incorrect. - (if (and (not compl) parlist) (add-to-list parlist val)) - (if (string= val "") "" (concat param "=" val)))) - -(defun LaTeX-package-parameters-pref-and-chosen (param pname noskip) - "Set values for elements of PARAM from package PNAME and -further explicitly typed in parameters and return a comma -separated list as string." - (let ((allpars "") - (fask (intern (concat "LaTeX-" pname "-parameter-value"))) - tpara parval) - (when param - (while param - (setq tpara (pop param)) - (setq parval (funcall fask tpara)) - (setq allpars - (concat allpars - (if (or (string= "" allpars) (string= "" parval)) - "" ",") parval)))) - ;; ask for parameter names as long as none is given - (when noskip - (while - (not - (string= - "" - (setq tpara - (completing-read - "Parameter name (RET to stop): " - (symbol-value (intern - (concat "LaTeX-" pname - "-parameters-name-list"))) - nil nil nil (intern - (concat "LaTeX-" pname - "-parameters-name-history")))))) - (setq parval (funcall fask tpara)) - ;; concat param=value with other ones - (setq allpars - (concat allpars - (if (or (string= "" allpars) (string= "" parval)) - "" - ",") - parval)))) - (add-to-list - (intern (concat "LaTeX-" pname "-parameters-history")) allpars) - allpars)) - -(defun LaTeX-package-parameters (optional pname preparam param) - "Ask for parameters and manage several parameter lists for -package PNAME" - (let ((fask (intern - (concat "LaTeX-" pname "-parameters-pref-and-chosen"))) - (hlist (intern (concat "LaTeX-" pname "-parameters-history"))) - (nlist - (symbol-value - (intern (concat "LaTeX-" pname "-parameters-name-list"))))) - ;; - (when (and preparam (listp preparam)) - (setq preparam (funcall fask preparam))) - ;; - (setq param - (completing-read-multiple - (concat - "Params (use for history or RET for choices): ") - nlist nil nil nil hlist)) - ;; - (if (and (string= "" (car param)) (= (length param) 1)) - (setq param (funcall fask nil t)) - (setq param (car (symbol-value hlist)))) - (TeX-argument-insert - (if (or (string= "" preparam) (eq preparam nil)) - param - (concat preparam (if (string= "" param) "" (concat "," param)))) - optional))) - -;;; Points -(defvar LaTeX-pst-point-list (list "0,0") - "A list of values for point in pstricks.") - -(defvar LaTeX-pst-point-history LaTeX-pst-point-list - "History of values for point in pstricks.") - -(defun LaTeX-pst-point () - "Ask for a point and manage point list." - (LaTeX-pst-what "point" - (concat "Point (default " (car LaTeX-pst-point-history) ")") - (car LaTeX-pst-point-history))) - -(defun LaTeX-pst-point-in-parens (optional) - "Enclose point in parentheses." - (LaTeX-pst-enclose-obj 'LaTeX-pst-point ?( ?))) - -;;; Angles -(defvar LaTeX-pst-angle-list (list "0") - "A list of values for angle in pstricks.") - -(defvar LaTeX-pst-angle-history nil - "History of values for angle in pstricks.") - -(defun LaTeX-pst-angle () - "Ask for a angle and manage angle list" - (LaTeX-pst-what "angle" - (concat "Angle (default " (car LaTeX-pst-angle-list) ")") - (car LaTeX-pst-angle-list))) - -;;; Extension in one Direction -(defvar LaTeX-pst-extdir-list (list "1") - "A list of values for extdir in pstricks.") - -(defvar LaTeX-pst-extdir-history nil - "History of values for extdir in pstricks.") - -(defun LaTeX-pst-extdir (descr) - "Ask for a extdir and manage extdir list" - (LaTeX-pst-what "extdir" - (concat descr " (default " (car LaTeX-pst-extdir-list) ")") - (car LaTeX-pst-extdir-list))) - -;;; Relative Points -(defvar LaTeX-pst-delpoint-list nil - "A list of values for delpoint in pstricks.") - -(defvar LaTeX-pst-delpoint-history nil - "History of values for delpoint in pstricks.") - -;;; Arrows -(defvar LaTeX-pst-arrows-list - '("->" "<-" "<->" ">-<" ">-" "-<" "<<->>" "<<-" "->>" "|-|" "|-" "-|" - "|*-|*" "[-]" "[-" "-]" "(-)" "(-" "-)" "*-*" "*-" "-*" "0-0" "0-" - "-0" "c-c" "c-" "-c" "C-C" "C-" "-C" "cc-cc" "cc-" "-cc" "|<->|" "|<-" - "->|" "|<*->|*" "|<*-" "->|*" "-") - "A list of values for arrows in pstricks.") - -(defvar LaTeX-pst-arrows-history nil - "History of values for arrows in pstricks.") - -;; XXX: Better ask for arrow start and end separately? -;; `LaTeX-pst-arrows-list' is not exhaustive. -(defun LaTeX-pst-arrows () - "Ask for a arrow type and manage arrow type list" - (or (LaTeX-pst-what "arrows" "Arrow type" nil) "")) - -;;; Dots -(defvar LaTeX-pst-dotstyle-list - '((completing-read "Dot style" nil LaTeX-pst-dotstyle-history) - "*" "o" "+" "|" "triangle" "triangle*" "square" "square*" "pentagon" - "pentagon*") - "A list of values for dotstyle in pstricks.") - -(defvar LaTeX-pst-dotstyle-history nil - "History of values for dotstyle in pstricks.") - -;;; Reference Point -(defvar LaTeX-pst-refpoint-list - '((completing-read "Reference point" t LaTeX-pst-refpoint-history) - "l" "r" "t" "tl" "lt" "tr" "rt" "b" "bl" "br" "lb" "rb" "B" "Bl" - "Br" "lB" "rB") - "A list of values for refpoint in pstricks.") - -(defvar LaTeX-pst-refpoint-history nil - "History of values for refpoint in pstricks.") - -(defun LaTeX-pst-refpoint () - "Ask for a refpoint and manage refpoint list" - (LaTeX-pst-what "refpoint" "Reference point" nil)) - -;;; Color - -;; FIXME: Still used? -(defvar LaTeX-pst-color-history nil - "History of values for color in pstricks.") - -;;; Others without History in Completion - -(defvar LaTeX-pst-style-list - '((completing-read "Defined Style" t)) - "A list of values for user defined styles in pstricks.") - -;;; Parameters - -(defvar LaTeX-pst-parameters-history nil - "History of values for parameters in pstricks.") - -(defvar LaTeX-pst-parameters-value-history nil - "History of parameter values in pstricks.") - -(defvar LaTeX-pst-basic-parameters-name-list - '("arcsep" "arcsepA" "arcsepB" "arrowinset" "arrowlength" "arrows" - "arrowscale" "arrowsize" "border" "bordercolor" "boxsep" - "bracketlength" "cornersize" "curvature" "dash" "dimen" "dotangle" - "dotscale" "dotsep" "dotsize" "dotstyle" "doublecolor" "doubleline" - "doublesep" "doubleset" "fillcolor" "fillstyle" "framearc" - "framesep" "gangle" "gridcolor" "griddots" "gridlabelcolor" - "gridlabels" "gridwidth" "hatchangle" "hatchcolor" "hatchsep" - "hatchsepinc" "hatchwidth" "hatchwidthinc" "header" "labelsep" - "liftpen" "linearc" "linecolor" "linestyle" "linetype" "linewidth" - "rbracketlength" "ref" "runit" "shadow" "shadowangle" "shadowcolor" - "shadowsize" "showgrid" "showpoints" "style" "subgridcolor" - "subgriddiv" "subgriddots" "subgridwidth" "swapaxes" "tbarsize" - "trimode" "unit" "xunit" "yunit") - "A list of parameter names in pstricks.") - - -(defvar LaTeX-pst-boolean-list '("true" "false") - "List of binary values for key=value completion.") - -;; XXX: Colors can actually be given as [-][!]. -(defvar LaTeX-pst-color-list - '("black" "darkgray" "gray" "lightgray" "white" - "red" "green" "blue" "cyan" "magenta" "yellow") - "List of colors predefined in PSTricks.") - -(defvar LaTeX-pst-fillstyle-list - '("none" "solid" "vlines" "vlines*" "hlines" "hlines*" "crosshatch" - "crosshatch*" "boxfill") - "List of fill styles defined in PSTricks.") - -;; From PSTricks: PostScript macros for Generic TeX, User's Guide, -;; Timothy Van Zandt, 25 July 2003, Version 97. -;; FIXME: Provide separate variables tailored to the different macros. -(defvar LaTeX-pst-basic-parameters-list - '(;; Dimensions, coordinates and angles - ("unit") - ("xunit") - ("yunit") - ("runit") - ;; Basic graphics parameters - ("linewidth") - ("linecolor" LaTeX-pst-color-list) - ("fillstyle" LaTeX-pst-fillstyle-list) - ("fillcolor" LaTeX-pst-color-list) - ("arrows" LaTeX-pst-arrows-list) - ("showpoints" LaTeX-pst-boolean-list) - ;; Lines and polygons - ("linearc") - ("framearc") - ("cornersize" ("relative" "absolute")) - ("gangle") - ;; Arcs, circles and ellipses - ("arcsepA") - ("arcsepB") - ("arcsep") - ;; Curves - ("curvature") - ;; Dots - ("dotstyle" ("*" "o" "Bo" "x" "+" "B+" "asterisk" "Basterisk" "oplus" - "otimes" "|" "B|" "square" "Bsquare" "square*" "diamond" - "Bdiamond" "diamond*" "triangle" "Btriangle" "triangle*" - "pentagon" "Bpentagon" "pentagon*")) - ("dotsize") - ("dotscale") - ("dotangle") - ;; Grids - ("gridwidth") - ("gridcolor" LaTeX-pst-color-list) - ("griddots") - ("gridlabels") - ("gridlabelcolor" LaTeX-pst-color-list) - ("subgriddiv") - ("subgridwidth") - ("subgridcolor" LaTeX-pst-color-list) - ("subgriddots") - ;; Plots - ("plotstyle" ("dots" "line" "polygon" "curve" "ecurve" "ccurve")) - ("plotpoints") - ;; Coordinate systems - ("origin") - ("swapaxes" LaTeX-pst-boolean-list) - ;; Line styles - ("linestyle" ("none" "solid" "dashed" "dotted")) - ("dash") - ("dotsep") - ("border") - ("bordercolor" LaTeX-pst-color-list) - ("doubleline" LaTeX-pst-boolean-list) - ("doublesep") - ("doublecolor" LaTeX-pst-color-list) - ("shadow" LaTeX-pst-boolean-list) - ("shadowsize") - ("shadowangle") - ("shadowcolor" LaTeX-pst-color-list) - ("dimen" ("outer" "inner" "middle")) - ;; Fill styles - ("hatchwidth") - ("hatchsep") - ("hatchcolor" LaTeX-pst-color-list) - ("hatchangle") - ("addfillstyle" LaTeX-pst-fillstyle-list) - ;; Arrowheads and such - ("arrowsize") - ("arrowlength") - ("arrowwinset") - ("tbarsize") - ("bracketlength") - ("rbracketlength") - ("arrowscale") - ;; Parameters - ("linetype") - ;; Graphics objects - ("liftpen") - ;; Placing and rotating whatever - ("labelsep") - ;; Axes - ("labels" ("all" "x" "y" "none")) - ("showorigin" LaTeX-pst-boolean-list) - ("ticks" ("all" "x" "y" "none")) - ("tickstyle" ("full" "top" "bottom")) - ("ticksize") - ("axesstyle" ("axes" "frame" "none")) - ;; Framed boxes - ("framesep") - ("boxsep") - ("trimode" ("*" "U" "D" "R" "L")) - ;; Nodes - ("href") - ("vref") - ("radius") - ;; Node connections - ("nodesep") - ("arcangle") - ("angle") - ("arm") - ("loopsize") - ("ncurv") - ("boxsize") - ("offset") - ;; Node connections labels: I - ("ref") - ("nrot") - ("npos") - ("shortput" ("none" "nab" "tablr" "tab")) - ;; Node connection labels: II - ("tpos") - ;; Attaching labels to nodes - ("rot") - ;; Mathematical diagrams and graphs - ("mnode" ("R" "r" "C" "f" "p" "circle" "oval" "dia" "tri" "dot" "none")) - ("emnode" ("R" "r" "C" "f" "p" "circle" "oval" "dia" "tri" "dot" "none")) - ("name") - ("nodealign" LaTeX-pst-boolean-list) - ("mcol" ("l" "r" "c")) - ("rowsep") - ("colsep") - ("mnodesize") - ;; ... - ) - "List of keys and values for PSTricks macro arguments.") - -(defvar LaTeX-pst-parameters-name-list - LaTeX-pst-basic-parameters-name-list - "A list of all parameters with completion.") - -(defvar LaTeX-pst-parameters-name-history nil - "History of parameter names in pstricks.") - -(defvar LaTeX-pst-parameters-completion-regexp - "\\(arrows\\|linestyle\\|fillstyle\\|color\\|trimode\\|dotstyle\\|\\\\|show[a-zA-Z]+\\)" - "Regexp for `string-match'ing a parameter.") - -(defun LaTeX-pst-parameter-value (param) - "See documentation of `LaTeX-package-parameter-value'." - (LaTeX-package-parameter-value param "pst")) - -(defun LaTeX-pst-parameters-pref-and-chosen (param &optional noskip) - "See documentation of `LaTeX-package-parameters-pref-and-chosen'." - (LaTeX-package-parameters-pref-and-chosen param "pst" noskip)) - -;; FIXME: This is likely only a transitional function used until all -;; macros got their calls to `TeX-arg-key-val' with tailored parameter -;; lists. -(defun LaTeX-pst-parameters (optional) - "Prompt for general parameters of a PSTricks argument." - (TeX-arg-key-val optional LaTeX-pst-basic-parameters-list)) - -;;; Macros -(defun LaTeX-pst-macro-psarc (optional &optional arg) - "Return \\psarc arguments after querying." - (let ((arrows (LaTeX-pst-arrows)) - (pnt (if current-prefix-arg nil (LaTeX-pst-point)))) - (insert (if arrows (format "{%s}" arrows) "") - (if pnt (format "(%s)" pnt) "") - "{" (LaTeX-pst-extdir "Radius") "}{" (LaTeX-pst-angle) "}{" - (LaTeX-pst-angle) "}"))) - -(defun LaTeX-pst-macro-pscircle (optional &optional arg) - "Return \\pscircle arguments after querying." - (insert "(" (LaTeX-pst-point) "){" (LaTeX-pst-extdir "Radius") "}")) - -(defun LaTeX-pst-macro-rput (optional &optional arg) - "Return \\rput arguments after querying." - (let ((refpoint (LaTeX-pst-refpoint)) - (rotation (if current-prefix-arg (LaTeX-pst-angle) nil))) - (insert (if refpoint (concat "[" refpoint "]") "") - (if rotation - (concat "{" rotation "}") - "") "(" (LaTeX-pst-point) ")"))) - -(defun LaTeX-pst-macro-uput (optional &optional arg) - "Return \\uput arguments after querying." - (let ((dist (LaTeX-pst-extdir "Distance")) - (refpoint (LaTeX-pst-refpoint))) - (insert (if dist (concat "{" dist "}") "") - (if refpoint - (concat "[" (LaTeX-pst-refpoint) "]") - "[]") - "{" (LaTeX-pst-angle) "}(" (LaTeX-pst-point) ")"))) - -(defun LaTeX-pst-macro-multirputps (optional &optional arg) - "Return \\multirput or \\multips arguments after querying." - (let ((refpoint (LaTeX-pst-refpoint)) - (rotation (if current-prefix-arg (LaTeX-pst-angle) nil)) - (pnt (LaTeX-pst-point)) - (dpnt (LaTeX-pst-what "delpoint" "Increment (default 1,1)" "1,1")) - (repi (LaTeX-pst-input-int "Repetitions" nil))) - (insert (if refpoint (format "[%s]" refpoint) "") - (if rotation (format "{%s}" rotation) "") - "(" pnt ")(" dpnt "){" repi "}"))) - -(defun LaTeX-pst-macro-psline (optional &optional arg) - "Return \\psline or \\ps[ce]?curve[*] arguments after querying." - (let ((arrows (LaTeX-pst-arrows)) - (pnt1 (LaTeX-pst-point)) - (pnt2 (LaTeX-pst-point))) - (insert (if arrows (format "{%s}" arrows) "") "(" pnt1 ")" ) - (while (and (not (string= pnt2 "")) (not (string= pnt1 pnt2))) - (insert "(" pnt2 ")") - (setq pnt1 pnt2) - (setq pnt2 (LaTeX-pst-point))))) - -(defun LaTeX-pst-macro-psdots (optional single) - "Return \\psdot[s]? arguments after querying." - (let* ((pnt1 (LaTeX-pst-point)) - (pnt2 (if single pnt1 (LaTeX-pst-point)))) - (insert "(" pnt1 ")") - (while (and (not (string= pnt2 "")) (not (string= pnt1 pnt2))) - (setq pnt1 pnt2) - (insert "(" pnt1 ")") - (setq pnt2 (LaTeX-pst-point))))) - -(defun LaTeX-pst-macro-parabola (optional &optional arg) - "Return \\parabola arguments after querying." - (let ((arrows (LaTeX-pst-arrows))) - (insert (if arrows (format "{%s}" arrows) "") - "(" (LaTeX-pst-point) ")(" (LaTeX-pst-point) ")"))) - -(defun LaTeX-pst-macro-pnt-twolen (optional prompt1 prompt2) - "Return point and 2 paired lengths in separate parens as arguments." - ;; insert \psellipse[*]?, \psdiamond or \pstriangle arguments - (let ((pnt (if current-prefix-arg nil (LaTeX-pst-point)))) - (insert (if pnt (format "(%s)" pnt) "") - "(" (LaTeX-pst-extdir prompt1) "," - (LaTeX-pst-extdir prompt2) ")"))) - -(defun LaTeX-pst-macro-psbezier (optional &optional arg) - "Return \\psbezier arguments after querying." - (let ((arrows (LaTeX-pst-arrows)) - (pnt1 (LaTeX-pst-point)) - (pnt2 (LaTeX-pst-point)) - (pnt3 (LaTeX-pst-point))) - (insert (if arrows (format "{%s}" arrows) "") - "(" pnt1 ")(" pnt2 ")") - (while (not (string= pnt2 pnt3)) - (insert "(" pnt3 ")") - (setq pnt2 pnt3) - (setq pnt3 (LaTeX-pst-point))))) - -(defun LaTeX-pst-macro-pspolygon (optional &optional arg) - "Return \\pspolygon arguments after querying." - (let ((pnt1 (LaTeX-pst-point)) - (pnt2 (LaTeX-pst-point)) - (pnt3 (LaTeX-pst-point))) - (insert "(" pnt1 ")(" pnt2 ")") - (while (not (string= pnt2 pnt3)) - (insert "(" pnt3 ")") - (setq pnt2 pnt3) - (setq pnt3 (LaTeX-pst-point))))) - -(defun LaTeX-pst-macro-psframe (optional &optional arg) - "Return \\psframe arguments after querying." - (let ((pnt1 (if current-prefix-arg nil (LaTeX-pst-point))) - (pnt2 (LaTeX-pst-point))) - (insert (if pnt1 (format "(%s)" pnt1) "") "(" pnt2 ")"))) - -(defun LaTeX-pst-macro-psgrid (optional &optional arg) - "Return \\psgrid arguments after querying." - (let* ((cpref (if current-prefix-arg (car current-prefix-arg) 0)) - (pnt1 (if (> cpref 4) (LaTeX-pst-point) nil)) - (pnt2 (if (> cpref 0) (LaTeX-pst-point) nil)) - (pnt3 (if (> cpref 0) (LaTeX-pst-point) nil))) - (insert (if pnt1 (format "(%s)" pnt1) "") - (if pnt2 (format "(%s)(%s)" pnt2 pnt3) "")))) - -(defun LaTeX-pst-macro-newpsobject (&optional arg) - "Return \\newpsobject arguments after querying." - (insert "{" (read-string "New PSObject Name: ") "}" - ;; FIXME: It would be better to use something more confined - ;; than `TeX-symbol-list'. - "{" (completing-read "Parent Object: " (TeX-symbol-list)) - "}")) - -;;; Environments -(defun LaTeX-pst-env-pspicture (env) - "Create new pspicure environment." - (let ((opt (multi-prompt-key-value - (TeX-argument-prompt t "Options" nil) - '(("showgrid") ("shift")))) - (p0 (LaTeX-pst-what "point" "Lower left (default 0,0)" "0,0")) - (p1 (LaTeX-pst-what "point" "Upper right (default 1,1)" "1,1")) - corn) - (setq corn (concat (unless (string= "" opt) (format "[%s]" opt)) - (if (string= "0,0" p0) "" (format "(%s)" p0)) - "(" p1 ")")) - (LaTeX-insert-environment env corn))) - -;;; Self Parsing -- see (info "(auctex)Hacking the Parser") -(defvar LaTeX-auto-pstricks-regexp-list - '(("\\\\newps\\(object\\){\\([a-zA-Z]+\\)}{\\([a-zA-Z]+\\)}" (1 2 3) - LaTeX-auto-pstricks) - ("\\\\newps\\(fontdot\\){\\([a-zA-Z]+\\)}" (1 2) - LaTeX-auto-pstricks) - ("\\\\newps\\(style\\){\\([a-zA-Z]+\\)}" (1 2) - LaTeX-auto-pstricks) - ("\\\\define\\(color\\){\\([a-zA-Z]+\\)}{\\(rgb\\|cmyk\\)}" (1 2 3) - LaTeX-auto-pstricks) - ("\\\\new\\(rgb\\|hsb\\|cmyk\\)\\(color\\){\\([a-zA-Z]+\\)}" (2 3 1) - LaTeX-auto-pstricks)) - "List of regular expressions to extract arguments of \\newps* macros.") - -(defvar LaTeX-auto-pstricks nil - "Temporary for parsing \\newps* definitions.") - -(defun LaTeX-pst-cleanup () - "Move symbols from `LaTeX-auto-pstricks' to `TeX-auto-symbol'." - (mapcar - (lambda (list) - (let ((type (car list))) - (cond ((string= type "object") - (setq TeX-auto-symbol - (cons (list (nth 1 list) - (caddr (assoc (nth 2 list) - (TeX-symbol-list)))) - TeX-auto-symbol))) - ((string= type "fontdot") - (add-to-list 'LaTeX-pst-dotstyle-list (nth 1 list) t)) - ((string= type "style") - (add-to-list 'LaTeX-pst-style-list (nth 1 list) t)) - ((string= type "color") - (add-to-list 'LaTeX-pst-color-list (nth 1 list) t) - ;; FIXME: Why is an entry with "-" in front added? - (add-to-list 'LaTeX-pst-color-list - (concat "-" (nth 1 list)) t))))) - LaTeX-auto-pstricks)) - -(defun LaTeX-pst-prepare () - "Clear `LaTeX-auto-pstricks' before use." - (setq LaTeX-auto-pstricks nil)) - -;; FIXME: This does not seem to work unless one does a manual reparse. -;; Check e.g. with "\definecolor" and "fillcolor=". -(add-hook 'TeX-auto-prepare-hook 'LaTeX-pst-prepare) -(add-hook 'TeX-auto-cleanup-hook 'LaTeX-pst-cleanup) - -;;; Additional Functionality -(defun LaTeX-pst-parameters-add (&optional arg) - "With ARG as prefix-argument insert new parameter\(s\) behind -nearest backward LaTeX macro in brackets. Without ARG add -parameter\(s\) to the already existing ones at the end of the -comma separated list. Point has to be within the sexp to modify." - (interactive "P") - (let ((newpara (LaTeX-pst-parameters-pref-and-chosen nil t)) - (regexp "\\(") beg end check) - (if arg - (progn - (re-search-backward "\\\\\\([a-zA-Z]\\)") - (forward-word 1) - (insert-pair nil ?[ ?])) - (up-list 1) - (backward-char 1) - (save-excursion - (setq end (point)) - (up-list -1) - (while (re-search-forward "\\([a-zA-Z]+\\)=" end 'limit) - (setq regexp (concat regexp - (match-string-no-properties 1) "\\|"))) - (setq regexp (concat (substring regexp 0 -1) ")")) - (setq check (string-match regexp newpara)))) - (when newpara - (insert (if arg "" ",") newpara) - (when check - (message - "At least one Parameters appears twice. PLEASE CHECK!"))))) -;; FIXME: Only define a key for this once it is a general-purpose -;; facility, i.e. not just for pstricks but all types of macros. -;; (define-key LaTeX-mode-map "\C-c\C-x\C-a" 'LaTeX-pst-parameters-add) - -(defvar LaTeX-pst-value-regexp - "\\([-!.a-zA-Z0-9]*\\s\\?[-!.a-zA-Z0-9]+\\)" - "Expression matching a parameter value.") - -(defun LaTeX-pst-parameter-remove-value () - "Remove value of current parameter and return parameter name." - (re-search-backward - (concat "\\(\\s(\\|,\\)[a-zA-Z]+\\([a-zA-Z]\\|=\\|=" - LaTeX-pst-value-regexp "\\)")) - (re-search-forward "\\([a-zA-Z]+\\)=") - (let ((para (match-string-no-properties 1))) - (re-search-forward LaTeX-pst-value-regexp) - (delete-region (match-beginning 1) (match-end 1)) - para)) - -(defun LaTeX-pst-parameter-change-value () - "Replace parameter value with a new one." - (interactive) - (let* ((para (LaTeX-pst-parameter-remove-value)) - (symb - (when (and - (string-match - LaTeX-pst-parameters-completion-regexp para) - (boundp - (intern - (concat "LaTeX-pst-" (match-string 0 para) "-list")))) - (intern (concat "LaTeX-pst-" (match-string 0 para) - "-list"))))) - (insert (TeX-arg-compl-list (symbol-value symb) "New Value" - 'LaTeX-pst-parameters-value-history)))) -;; FIXME: Only define a key for this once it is a general-purpose -;; facility, i.e. not just for pstricks but all types of macros. (See -;; also `LaTeX-pst-parameters-add'. Note that a parameter change -;; should better be made available through a `C-u' prefix of the -;; binding for the function doing the parameter addition.) -;; (define-key LaTeX-mode-map "\C-c\C-x\C-v" 'LaTeX-pst-parameter-change-value) - -(TeX-add-style-hook - "pstricks" - (lambda () - (unless (member "pst-pdf" TeX-active-styles) - (TeX-PDF-mode-off)) - (mapc 'TeX-auto-add-regexp LaTeX-auto-pstricks-regexp-list) - (LaTeX-add-environments - '("pspicture" LaTeX-pst-env-pspicture) - "overlaybox" "psclip") - (TeX-add-symbols - '("AltClipMode" 0) '("DontKillGlue" 0) '("KillGlue" 0) - '("NormalCoor" 0) '("SpecialCoor" 0) '("PSTricksLoaded" 0) - '("PSTricksOff" 0) '("altcolormode" 0) '("pslinecolor" 0) - '("pslinestyle" 0) '("pslinetype" 0) '("pslinewidth" 0) - '("pslabelsep" 0) '("radian" 0) '("psunit" 0) '("psrunit" 0) - '("psxunit" 0) '("psyunit" 0) - '("arrows" (TeX-arg-eval LaTeX-pst-arrows)) - '("clipbox" ["Border"] t) - '("closedshadow" [LaTeX-pst-parameters]) - '("openshadow" [LaTeX-pst-parameters]) - "closepath" "code" "coor" "curveto" "degrees" "dim" "endpsclip" - "file" "fill" "grestore" "gsave" "lineto" "movepath" "moveto" - "mrestore" "msave" "newpath" "rcoor" "rcurveto" "rlineto" "rotate" - "scale" "stroke" "swapaxes" "translate" - '("newcmykcolor" "Name" "Quadruple") - '("newrgbcolor" "Name" "Triple") '("newhsbcolor" "Name" "Triple") - '("newgray" "Name" "Value") - '("newpsobject" LaTeX-pst-macro-newpsobject LaTeX-pst-parameters) - '("newpsstyle" "New PSStyle Name" LaTeX-pst-parameters) - '("newpsfontdot" "New PSDot Name" ["Factors"] - "Fontname" "Character Number (Hex)") - '("parabola" [LaTeX-pst-parameters] LaTeX-pst-macro-parabola) - '("parabola*" [LaTeX-pst-parameters] LaTeX-pst-macro-parabola) - '("psarc" [LaTeX-pst-parameters] LaTeX-pst-macro-psarc) - '("psarc*" [LaTeX-pst-parameters] LaTeX-pst-macro-psarc) - '("psarcn" [LaTeX-pst-parameters] LaTeX-pst-macro-psarc) - '("pswedge" [LaTeX-pst-parameters] LaTeX-pst-macro-psarc) - '("psbezier" [LaTeX-pst-parameters] LaTeX-pst-macro-psbezier) - '("psbezier*" [LaTeX-pst-parameters] LaTeX-pst-macro-psbezier) - '("pscbezier" [LaTeX-pst-parameters] LaTeX-pst-macro-pspolygon) - '("pscircle" [LaTeX-pst-parameters] LaTeX-pst-macro-pscircle) - '("psccurve" [LaTeX-pst-parameters] LaTeX-pst-macro-psline) - '("psccurve*" [LaTeX-pst-parameters] LaTeX-pst-macro-psline) - '("pscurve" [LaTeX-pst-parameters] LaTeX-pst-macro-psline) - '("pscurve*" [LaTeX-pst-parameters] LaTeX-pst-macro-psline) - '("pscustom" [LaTeX-pst-parameters]) - '("psdiamond" [LaTeX-pst-parameters] - (LaTeX-pst-macro-pnt-twolen "Width" "Height")) - '("pstriangle" [LaTeX-pst-parameters] - (LaTeX-pst-macro-pnt-twolen "Width" "Height")) - '("psdot" [LaTeX-pst-parameters] (LaTeX-pst-macro-psdots t)) - '("psdots" [LaTeX-pst-parameters] (LaTeX-pst-macro-psdots nil)) - '("psecurve" [LaTeX-pst-parameters] LaTeX-pst-macro-psline) - '("psecurve*" [LaTeX-pst-parameters] LaTeX-pst-macro-psline) - '("psellipse" [LaTeX-pst-parameters] - (LaTeX-pst-macro-pnt-twolen "Radius x" "Radius y")) - '("psellipse*" [LaTeX-pst-parameters] - (LaTeX-pst-macro-pnt-twolen "Radius x" "Radius y")) - '("psframe" [LaTeX-pst-parameters] LaTeX-pst-macro-psframe) - '("psframe*" [LaTeX-pst-parameters] LaTeX-pst-macro-psframe) - '("psframebox" [LaTeX-pst-parameters] t) - '("pscirclebox" [LaTeX-pst-parameters] t) - '("psdblframebox" [LaTeX-pst-parameters] t) - '("psdiabox" [LaTeX-pst-parameters] t) - '("psovalbox" [LaTeX-pst-parameters] t) - '("psshadowbox" [LaTeX-pst-parameters] t) - '("pstribox" [LaTeX-pst-parameters] t) - '("psscalebox" "Scaling Factor(s)" t) - '("psscaleboxto" LaTeX-pst-point-in-parens t) - '("psgrid" [LaTeX-pst-parameters] LaTeX-pst-macro-psgrid 0) - '("psline" [LaTeX-pst-parameters] LaTeX-pst-macro-psline) - '("psoverlay" t) - '("pspolygon" [LaTeX-pst-parameters] LaTeX-pst-macro-pspolygon) - '("pspolygon*" [LaTeX-pst-parameters] LaTeX-pst-macro-pspolygon) - '("psset" LaTeX-pst-parameters) - '("pssetlength" TeX-arg-macro "Length") - '("psaddtolength" TeX-arg-macro "Length") - '("degrees" ["Full Circle"]) - '("qdisk" LaTeX-pst-point-in-parens "Radius") - '("qline" LaTeX-pst-point-in-parens LaTeX-pst-point-in-parens) - "pslongbox" "psrotatedown" "psrotateleft" "psrotateright" - '("rput" LaTeX-pst-macro-rput t) - '("rput*" LaTeX-pst-macro-rput t) - '("cput" [LaTeX-pst-parameters] - (TeX-arg-eval LaTeX-pst-angle) LaTeX-pst-point-in-parens t) - '("uput" LaTeX-pst-macro-uput t) - '("multirput" (LaTeX-pst-macro-multirputps t) t) - '("multips" (LaTeX-pst-macro-multirputps nil) t)))) - -;;; pstricks.el ends here diff --git a/packages/auctex/style/report.el b/packages/auctex/style/report.el deleted file mode 100644 index 32329a8b2..000000000 --- a/packages/auctex/style/report.el +++ /dev/null @@ -1,12 +0,0 @@ -;;; report.el - Special code for report style. - -;; $Id: report.el,v 1.3 2005/03/17 10:02:06 angeli Exp $ - -;;; Code: - -(TeX-add-style-hook - "report" - (lambda () - (LaTeX-largest-level-set "chapter"))) - -;;; report.el ends here diff --git a/packages/auctex/style/ruby.el b/packages/auctex/style/ruby.el deleted file mode 100644 index 0a96e57ee..000000000 --- a/packages/auctex/style/ruby.el +++ /dev/null @@ -1,49 +0,0 @@ -;;; ruby.el --- AUCTeX style for the ruby package. - -;; Copyright (C) 2009 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2009-01-04 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for the ruby package. - -;;; Code: - -(defvar LaTeX-ruby-package-options - '("overlap" "nooverlap" "CJK" "latin") - "Package options for the ruby package.") - -(TeX-add-style-hook - "ruby" - (lambda () - (TeX-add-symbols - '("rubyoverlap" 0) - '("rubynooverlap" 0) - '("rubyCJK" 0) - '("rubylatin" 0) - '("rubysize" 0) - '("rubysep" 0) - '("ruby" t nil)))) - -;;; ruby.el ends here diff --git a/packages/auctex/style/scrartcl.el b/packages/auctex/style/scrartcl.el deleted file mode 100644 index 0c09d9137..000000000 --- a/packages/auctex/style/scrartcl.el +++ /dev/null @@ -1,26 +0,0 @@ -;;; -*- emacs-lisp -*- -;;; scrartcl.el -- AUCTeX style for scrartcl.cls - -;; Copyright (C) 2002, 2005 Free Software Foundation -;; License: GPL, see the file COPYING in the base directory of AUCTeX - -;; Author: Mark Trettin -;; Created: 2002-09-26 -;; Version: $Id: scrartcl.el,v 1.4 2005/03/17 10:02:06 angeli Exp $ -;; Keywords: tex - -;;; Commentary: - -;; This file adds support for `scrartcl.cls'. This file needs -;; `scrbase.el'. - -;; This file is part of AUCTeX. - -;;; Code: -(TeX-add-style-hook "scrartcl" - (lambda () - (LaTeX-largest-level-set "section") - ;; load basic definitons - (TeX-run-style-hooks "scrbase"))) - -;;; scrartcl.el ends here diff --git a/packages/auctex/style/scrbase.el b/packages/auctex/style/scrbase.el deleted file mode 100644 index 5a8b41ff7..000000000 --- a/packages/auctex/style/scrbase.el +++ /dev/null @@ -1,222 +0,0 @@ -;;; scrbase.el --- AUCTeX style for the KOMA-Script bundle. - -;; Copyright (C) 2002, 2004, 2005, 2007 Free Software Foundation, Inc. - -;; Author: Mark Trettin -;; Created: 2002-09-26 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for the KOMA-Script bundle. This file -;; contains the base definitions that work with all KOMA-Script -;; classes (scrarctl.cls, scrreprt.cls, scrbook.cls and scrlttr2.cls). -;; You need this file since it's loaded from the class-styles. - -;;; Code: -(TeX-add-style-hook "scrbase" - (lambda () - (TeX-add-symbols - "appendixmore" - "autodot" - '("addtokomafont" TeX-arg-KOMA-fontelements t) - '("areaset" [ "BCOR" ] "Width" "Height") - '("captionabove" [ "Lof entry" ] "Caption") - '("captionbelow" [ "Lof entry" ] "Caption") - '("cleardoubleemptypage") - '("cleardoubleplainpage") - '("cleardoublestandardpage") - '("dedication" t) - '("deffootnote" [ "Mark width" ] "Indent" "Parindent" "Definition") - '("deffootnotemark" "Definition") - '("extratitle" t) - '("ifpdfoutput" t nil) - '("ifthispageodd" t nil) - '("lowertitleback" t) - '("maketitle" [ "Pagenumber" ]) - '("marginline" t) - '("publishers" "Publishers") - '("sectionmark" "Running head") - '("setbibpreamble" "Preamble") - '("setcaphanging") - '("setcapindent" "Indent") - '("setcapindent*" "X-Indent") - '("setcapmargin" [ "Margin left" ] "Margin") - '("setcapmargin*" [ "Margin inside" ] "Margin") - '("setcapwidth" [ TeX-arg-KOMA-capjust ] "Width") - '("setindexpreamble" "Preamble") - '("setkomafont" TeX-arg-KOMA-fontelements t) - '("subject" "Subject") - '("subsectionmark" "Running head") - '("textsubscript" "Text") - '("thanks" "Footnote") - '("thefootnotemark") - '("titlehead" t) - '("uppertitleback" t) - '("usekomafont" TeX-arg-KOMA-fontelements)) - (LaTeX-add-environments - '("labeling" (lambda (env &rest ignore) - (LaTeX-insert-environment - env - (let ((delim (read-string "(Optional) Delimiter: ")) - (width (read-string "Longest item: "))) - (concat - (if (not (zerop (length delim))) - (format "[%s]" delim)) - (format "{%s}" width)))) - (LaTeX-find-matching-begin) - (end-of-line 1) - (LaTeX-insert-item))) - '("addmargin" (lambda (env &rest ignore) - (LaTeX-insert-environment - env - (let ((leftin (read-string "(Optional) Left Indentation: ")) - (indent (read-string "Indentation: "))) - (concat - (if (not (zerop (length leftin))) - (format "[%s]" leftin)) - (format "{%s}" indent)))))) - '("addmargin*" (lambda (env &rest ignore) - (LaTeX-insert-environment - env - (let ((innin (read-string "(Optional) Inner Indentation: ")) - (indent (read-string "Indentation: "))) - (concat - (if (not (zerop (length innin))) - (format "[%s]" innin)) - (format "{%s}" indent)))))) - '("captionbeside" (lambda (env &rest ignore) - (LaTeX-insert-environment - env - (let ((lofent (read-string "(Optional) Lof Entry: ")) - (title (read-string "Caption: ")) - (place (read-string "(Optional) Placement (l,r,o,i): ")) - (width (read-string "(Optional) Width: ")) - (offset (read-string "(Optional) Offset: "))) - (concat - (if (not (zerop (length lofent))) - (format "[%s]" lofent)) - (format "{%s}" title) - (if (not (zerop (length place))) - (format "[%s]" place)) - (if (not (zerop (length width))) - (format "[%s]" width)) - (and - (not (zerop (length place))) - (not (zerop (length offset))) - (format "[%s]%s" offset - (if (y-or-n-p "Starred? ") - "*" ""))))))))) - (LaTeX-section-list-add-locally '(("addpart" 0) - ("addsec" 2) - ("minisec" 7))) - ;; This doesn't work. Maybe it's RefTeX's label insertion? - (make-local-variable 'LaTeX-section-label) - (setq LaTeX-section-label (append - LaTeX-section-label - '(("addpart" . nil) - ("addsec" . nil) - ("minisec" . nil)))) - ;; Fontification - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - ;; Textual keywords - (font-latex-add-keywords '(("captionabove" "[{") - ("captionbelow" "[{") - ("dedication" "{") - ("extratitle" "{") - ("lowertitleback" "{") - ("maketitle" "[") - ("marginline" "{") - ("publishers" "{") - ("subject" "{") - ("sectionmark" "{") - ("setbibpreamble" "{") - ("setindexpreamble" "{") - ("subsectionmark" "{") - ("textsubscript" "{") - ("titlehead" "{") - ("uppertitleback" "{")) - 'textual) - ;; Function keywords - (font-latex-add-keywords '(("deffootnote" "[{{{") - ("deffootnotemark" "{") - ("ifpdfoutput" "{{") - ("ifthispageodd" "{{")) - 'function) - ;; Variable keywords - (font-latex-add-keywords '(("addtokomafont" "{{") - ("areaset" "[{{") - ("setcaphanging" "") - ("setcapindent" "{") - ("setcapmargin" "*[{") - ("setcapwidth" "[{") - ("setkomafont" "{{") - ("typearea" "[{") - ("usekomafont" "{")) - 'variable) - ;; Warning keywords - (font-latex-add-keywords '("cleardoublestandardpage" - "cleardoubleplainpage" - "cleardoubleemptypage") - 'warning) - ;; Sectioning keywords - (font-latex-add-keywords '(("addpart" "[{")) 'sectioning-1) - (font-latex-add-keywords '(("addsec" "[{")) 'sectioning-2) - (font-latex-add-keywords '(("minisec" "[{")) 'sectioning-4)))) - -(defun TeX-arg-KOMA-setpreamble (optional &optional prompt) - "Prompt for KOMA-Script's \\set*preamble position with completion." - (TeX-argument-insert - (completing-read - (TeX-argument-prompt optional prompt "Position") - '(("") ("l") ("r") ("c") ("o") ("u") - ("lo") ("lu") ("ro") ("ru") ("co") ("cu")) - nil t) - optional)) - -(defun TeX-arg-KOMA-capjust (optional &optional prompt) - "Prompt for KOMA-Script's \\setcapwidth justification with completion." - (TeX-argument-insert - (completing-read - (TeX-argument-prompt optional prompt "Justification") - '(("") ("l") ("r") ("c") ("i") ("o")) - nil t) - optional)) - -(defun TeX-arg-KOMA-fontelements (optional &optional prompt) - "Prompt for KOMA-Script's fontelements with completion." - (TeX-argument-insert - (completing-read - (TeX-argument-prompt optional prompt "Element") - '(("") - ("caption") ("captionlabel") - ("descriptionlabel") ("dictum") ("dictumauthor") ("dictumtext") - ("footnote") ("footnotelabel") ("footnotereference") - ("pagefoot") ("pagehead") ("pagenumber") ("pagination") - ("sectioning") ("part") ("partnumber") ("chapter") ("section") - ("subsection") ("subsubsection") ("paragraph") ("subparagraph") - ("title") ("disposition") ("minisec")) - nil t) - optional)) - -(add-to-list 'LaTeX-item-list '("labeling" . LaTeX-item-argument)) - -;;; scrbase.el ends here diff --git a/packages/auctex/style/scrbook.el b/packages/auctex/style/scrbook.el deleted file mode 100644 index 6cada7d45..000000000 --- a/packages/auctex/style/scrbook.el +++ /dev/null @@ -1,62 +0,0 @@ -;;; scrbook.el --- AUCTeX style for scrbook.cls - -;; Copyright (C) 2002, 2005 Free Software Foundation - -;; Author: Mark Trettin -;; Created: 2002-09-26 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `scrbook.cls'. This file needs -;; `scrbase.el'. - -;;; Code: - -(TeX-add-style-hook "scrbook" - (lambda () - (LaTeX-largest-level-set "chapter") - ;; load basic definitons - (TeX-run-style-hooks "scrbase") - (TeX-add-symbols - "chapapp" - "raggeddictum" - '("chapappifchapterprefix" "Additional text") - '("setpartpreamble" [ TeX-arg-KOMA-setpreamble ] [ "Width" ] t) - '("setchapterpreamble" [ TeX-arg-KOMA-setpreamble ] [ "Width" ] t) - '("dictum" [ "Author" ] t)) - (LaTeX-section-list-add-locally '("addchap" 1)) - (make-local-variable 'LaTeX-section-label) - (setq LaTeX-section-label (append - LaTeX-section-label - '(("addchap" . nil)))) - ;; Definitions for font-latex - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - ;; Textual keywords - (font-latex-add-keywords '(("addchap" "[{") - ("setpartpreamble" "[[{") - ("setchapterpreamble" "[[{") - ("dictum" "[{")) - 'textual) - ;; Sectioning keywords - (font-latex-add-keywords '(("addchap" "[{")) 'sectioning-1)))) - -;;; scrbook.el ends here diff --git a/packages/auctex/style/scrlttr2.el b/packages/auctex/style/scrlttr2.el deleted file mode 100644 index 136b1c54c..000000000 --- a/packages/auctex/style/scrlttr2.el +++ /dev/null @@ -1,239 +0,0 @@ -;;; scrlttr2.el --- AUCTeX style for scrlttr2.cls. - -;; Copyright (C) 2002, 2007 Free Software Foundation - -;; Author: Mark Trettin -;; Created: 2002-10-26 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `scrlttr2.cls'. - -;; Since I just recently switched from `g-brief.cls' to the -;; KOMA-Script letter class *and* I don't really write many -;; snailmails, there are probably some superflous macros included and -;; important ones left out. Comments appreciated. - -;; I left out any length and positioning macros since those should be -;; set in a personal `*.lco'-File. IMHO. - -;;; Code - -(TeX-add-style-hook "scrlttr2" - (lambda () - (TeX-add-symbols - '("AtBeginLetter" t) - '("KOMAoptions" t) - '("LetterOptionNeedsPapersize" "Name of lco file" "Paper size") - '("LoadLetterOption" "Name of lco file") - '("addrchar" "Initial letter") - '("addrentry" "Lastname" "Firstname" "Address" "Telephone" "F1" - "F2" "F3" "F4" "Key") - '("addtokomafont" TeX-arg-KOMA-scrlttr-fontelements t) - '("addtolengthplength" [ "Factor" ] "Name of length" - "Name of pseudo length") - '("addtoreffields" TeX-arg-KOMA-scrlttr-vars) - '("adrchar" "Initial letter") - '("adrentry" "Lastname" "Firstname" "Address" "Telephone" "F1" - "F2" "Comment" "Key") - '("bankname" t) - '("captionsUKenglish" nil) - '("captionsUSenglish" nil) - '("captionsamerican" nil) - '("captionsaustrian" nil) - '("captionsbritish" nil) - '("captionscroatian" nil) - '("captionsdutch" nil) - '("captionsenglish" nil) - '("captionsfrench" nil) - '("captionsgerman" nil) - '("captionsitalian" nil) - '("captionsngerman" nil) - '("captionsspanish" nil) - '("cc" t) - '("ccname" t) - '("cleardoubleemptypage") - '("cleardoubleplainpage") - '("cleardoublestandardpage") - '("closing" "Closing Phrase") - '("customername" t) - '("dateUKenglish" nil) - '("dateUSenglish" nil) - '("dateamerican" nil) - '("dateaustrian" nil) - '("datebritish" nil) - '("datecroatian" nil) - '("datedutch" nil) - '("dateenglish" nil) - '("datefrench" nil) - '("dategerman" nil) - '("dateitalian" nil) - '("datename" t) - '("datengerman" nil) - '("datespanish" nil) - '("emailname" t) - '("encl" t) - '("enclname" t) - '("faxname" t) - '("firstfoot" t) - '("firsthead" t) - '("headfromname" t) - '("headtoname" t) - '("ifkomavarempty" TeX-arg-KOMA-scrlttr-vars 2) - '("ifkomavarempty*" TeX-arg-KOMA-scrlttr-vars 2) - '("invoicename" t) - '("myrefname" t) - '("newcaptionname" "Language" "Term" "Definition") - '("newkomavar" [ "Description" ] "Name") - '("newkomavar*" [ "Description" ] "Name") - '("nextfoot" t) - '("nexthead" t) - '("opening" "Opening") - '("pagename" t) - '("phonename" t) - '("providecaptionname" "Language" "Term" "Definition") - '("ps") - '("raggedsignature" nil) - '("renewcaptionname" "Language" "Term" "Definition") - '("setkomafont" TeX-arg-KOMA-scrlttr-fontelements t) - '("setkomavar" TeX-arg-KOMA-scrlttr-vars [ "Description" ] t) - '("setkomavar*" TeX-arg-KOMA-scrlttr-vars "Description") - '("setlengthtoplength" [ "Factor" ] "Name of length" - "Name of pseudo length") - '("subjectname" t) - '("usekomafont" TeX-arg-KOMA-scrlttr-fontelements) - '("usekomavar" [ "Command" ] TeX-arg-KOMA-scrlttr-vars) - '("usekomavar*" [ "Command" ] TeX-arg-KOMA-scrlttr-vars) - '("useplength" "Name") - '("wwwname" t) - '("yourmailname" t) - '("yourrefname" t)) - (LaTeX-add-environments - '("letter" (lambda (env &rest ignore) - (LaTeX-insert-environment - env - (let ((options (read-string "Optional options: ")) - (recip (read-string "Recipient: "))) - (concat - (if (not (zerop (length options))) - (format "[%s]" options)) - (format "{%s}" recip))))))) - ;; Definitions for font-latex - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - ;; Textual keywords - (font-latex-add-keywords '(("addrentry" "{{{{{{{{{") - ("adrentry" "{{{{{{{{") - ("bankname" "{") - ("cc" "{") - ("ccname" "{") - ("closing" "{") - ("customername" "{") - ("datename" "{") - ("emailname" "{") - ("encl" "{") - ("enclname" "{") - ("faxname" "{") - ("firstfoot" "{") - ("firsthead" "{") - ("headfromname" "{") - ("headtoname" "{") - ("invoicename" "{") - ("myrefname" "{") - ("nextfoot" "{") - ("nexthead" "{") - ("opening" "{") - ("pagename" "{") - ("phonename" "{") - ("ps" "") - ("subjectname" "{") - ("wwwname" "{") - ("yourmailname" "{") - ("yourrefname" "{")) - 'textual) - ;; Function keywords - (font-latex-add-keywords '(("AtBeginLetter" "{") - ("LetterOptionNeedsPapersize" "{{") - ("LoadLetterOption" "{") - ("addrchar" "{") - ("adrchar" "{") - ("ifkomavarempty" "*{{{")) - 'function) - ;; Variable keywords - (font-latex-add-keywords '(("KOMAoptions" "{") - ("addtokomafont" "{{") - ("addtolengthplength" "[{{") - ("addtoreffields" "{") - ("newcaptionname" "{{{") - ("newkomavar" "*[{") - ("providecaptionname" "{{{") - ("renewcaptionname" "{{{") - ("setkomafont" "{{") - ("setkomavar" "*{[{") - ("setlengthtoplength" "[{{") - ("usekomafont" "{") - ("usekomavar" "*[{") - ("useplength" "{")) - 'variable) - ;; Warning keywords - (font-latex-add-keywords '("cleardoublestandardpage" - "cleardoubleplainpage" - "cleardoubleemptypage") - 'warning)))) - -(defun TeX-arg-KOMA-scrlttr-vars (optional &optional prompt) - "Prompt for KOMA-Script's scrlttr2 predefined variables with completion." - (TeX-argument-insert - (completing-read - (TeX-argument-prompt optional prompt "Variable") - '(("") - ("backaddress") ("backaddressseparator") - ("ccseparator") ("customer") - ("date") - ("emailseparator") ("enclseparator") - ("faxseparator") ("frombank") ("fromaddress") ("fromemail") - ("fromfax") ("fromlogo") ("fromname") ("fromphone") ("fromurl") - ("invoice") - ("location") - ("myref") - ("place") ("placeseparator") ("phoneseparator") - ("signature") ("specialmail") ("subject") ("subjectseparator") - ("title") ("toname") ("toaddress") - ("yourmail") ("yourref")) - nil nil) - optional)) - -(defun TeX-arg-KOMA-scrlttr-fontelements (optional &optional prompt) - "Prompt for KOMA-Script's scrlttr2 fontelements with completion." - (TeX-argument-insert - (completing-read - (TeX-argument-prompt optional prompt "Element") - '(("") - ("backaddress") - ("descriptionlabel") - ("fromaddress") ("fromname") - ("pagefoot") ("pagehead") ("pagenumber") - ("subject") - ("title")) - nil t) - optional)) - -;;; scrlttr2.el ends here diff --git a/packages/auctex/style/scrpage2.el b/packages/auctex/style/scrpage2.el deleted file mode 100644 index ed3d500a6..000000000 --- a/packages/auctex/style/scrpage2.el +++ /dev/null @@ -1,129 +0,0 @@ -;;; scrpage2.el --- AUCTeX style for scrpage2.sty. - -;; Author: Ralf Angeli -;; Created: 2003-11-01 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `scrpage2.sty'. - -;;; Code: - -(TeX-add-style-hook - "scrpage2" - (lambda () - - ;; New symbols - (TeX-add-symbols - '("lehead" [ "scrplain-left-even" ] "scrheadings-left-even") - '("cehead" [ "scrplain-center-even" ] "scrheadings-center-even") - '("rehead" [ "scrplain-right-even" ] "scrheadings-right-even") - '("lefoot" [ "scrplain-left-even" ] "scrheadings-left-even") - '("cefoot" [ "scrplain-center-even" ] "scrheadings-center-even") - '("refoot" [ "scrplain-right-even" ] "scrheadings-right-even") - '("lohead" [ "scrplain-left-odd" ] "scrheadings-left-odd") - '("cohead" [ "scrplain-center-odd" ] "scrheadings-center-odd") - '("rohead" [ "scrplain-right-odd" ] "scrheadings-right-odd") - '("lofoot" [ "scrplain-left-odd" ] "scrheadings-left-odd") - '("cofoot" [ "scrplain-center-odd" ] "scrheadings-center-odd") - '("rofoot" [ "scrplain-right-odd" ] "scrheadings-right-odd") - '("ihead" [ "scrplain-inside" ] "scrheadings-inside") - '("chead" [ "scrplain-center" ] "scrheadings-center") - '("ohead" [ "scrplain-outside" ] "scrheadings-outside") - '("ifoot" [ "scrplain-inside" ] "scrheadings-inside") - '("cfoot" [ "scrplain-center" ] "scrheadings-center") - '("ofoot" [ "scrplain-outside" ] "scrheadings-outside") - '("clearscrheadfoot") - '("clearscrheadings") - '("clearscrplain") - '("automark" [ "Right page" ] "Left page") - '("headmark") - '("manualmark") - '("pagemark") - '("leftmark") - '("rightmark") - '("setfootwidth" [ "Offset" ] "Width") - '("setheadwidth" [ "Offset" ] "Width") - '("setfootbotline" [ "Length" ] "Thickness") - '("setfootsepline" [ "Length" ] "Thickness") - '("setheadtopline" [ "Length" ] "Thickness") - '("setheadsepline" [ "Length" ] "Thickness") - '("deftripstyle" "Name" [ "Thickness of outer line" ] - [ "Thickness of inner line" ] "Inner box of page head" - "Center box of page head" "Outer box of page head" - "Inner box of page foot" "Center box of page foot" - "Outer box of page foot") - '("defpagestyle" "Name" "Head definition" "Foot definition") - '("newpagestyle" "Name" "Head definition" "Foot definition") - '("renewpagestyle" "Name" "Head definition" "Foot definition") - '("providepagestyle" "Name" "Head definition" "Foot definition")) - - ;; Fontification - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("lehead" "[{") - ("cehead" "[{") - ("rehead" "[{") - ("lefoot" "[{") - ("cefoot" "[{") - ("refoot" "[{") - ("lohead" "[{") - ("cohead" "[{") - ("rohead" "[{") - ("lofoot" "[{") - ("cofoot" "[{") - ("rofoot" "[{") - ("ihead" "[{") - ("chead" "[{") - ("ohead" "[{") - ("ifoot" "[{") - ("cfoot" "[{") - ("ofoot" "[{") - ("automark" "[{") - ("setfootwidth" "[{") - ("setheadwidth" "[{") - ("setfootbotline" "[{") - ("setfootsepline" "[{") - ("setheadtopline" "[{") - ("setheadsepline" "[{")) - 'variable) - (font-latex-add-keywords '(("deftripstyle" "{[[{{{{{{") - ("defpagestyle" "{{{") - ("newpagestyle" "{{{") - ("renewpagestyle" "{{{") - ("providepagestyle" "{{{")) - 'function)))) - -(defvar LaTeX-scrpage2-package-options '("headinclude" "headexclude" - "footinclude" "footexclude" - "mpinclude" "mpexclude" - "headtopline" "headsepline" - "footsepline" "footbotline" - "plainheadtopline" "plainheadsepline" - "plainfootsepline" "plainfootbotline" - "ilines" "clines" "olines" - "automark" "manualmark" - "autooneside" "markuppercase" - "markusedcase" "nouppercase" - "komastyle" "standardstyle") - "Package options for the scrpage2 package.") - -;;; scrpage2.el ends here diff --git a/packages/auctex/style/scrreprt.el b/packages/auctex/style/scrreprt.el deleted file mode 100644 index 2ffe3ad4c..000000000 --- a/packages/auctex/style/scrreprt.el +++ /dev/null @@ -1,63 +0,0 @@ -;;; scrreprt.el --- AUCTeX style for scrreprt.cls. - -;; Copyright (C) 2002, 2005 Free Software Foundation - -;; Author: Mark Trettin -;; Created: 2002-09-26 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `scrreprt.cls'. This file needs -;; `scrbase.el'. - -;;; Code: - -(TeX-add-style-hook - "scrreprt" - (lambda () - (LaTeX-largest-level-set "chapter") - ;; load basic definitons - (TeX-run-style-hooks "scrbase") - (TeX-add-symbols - "chapapp" - "raggeddictum" - '("chapappifchapterprefix" "Additional text") - '("setpartpreamble" [ TeX-arg-KOMA-setpreamble ] [ "Width" ] t) - '("setchapterpreamble" [ TeX-arg-KOMA-setpreamble ] [ "Width" ] t) - '("dictum" [ "Author" ] t)) - (LaTeX-section-list-add-locally '("addchap" 1)) - (make-local-variable 'LaTeX-section-label) - (setq LaTeX-section-label (append - LaTeX-section-label - '(("addchap" . nil)))) - ;; Definitions for font-latex - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - ;; Textual keywords - (font-latex-add-keywords '(("addchap" "[{") - ("setpartpreamble" "[[{") - ("setchapterpreamble" "[[{") - ("dictum" "[{")) - 'textual) - ;; Sectioning keywords - (font-latex-add-keywords '(("addchap" "[{")) 'sectioning-1)))) - -;;; scrreprt.el ends here diff --git a/packages/auctex/style/shortvrb.el b/packages/auctex/style/shortvrb.el deleted file mode 100644 index 2ef191a2c..000000000 --- a/packages/auctex/style/shortvrb.el +++ /dev/null @@ -1,56 +0,0 @@ -;;; shortvrb.el --- AUCTeX style for `shortvrb.sty' - -;; Copyright (C) 2009 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2009-12-23 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `shortvrb.sty'. - -;; XXX: We might want provide users with the possibility to activate -;; something like this for any file (incl. Plain TeX). That would -;; bring us one step closer to the goal of displaying texbook.tex -;; without font locking going haywire. - -;; FIXME: The code does not work for preview.dtx because in that file -;; the style list is empty. In its master file, preview.drv, it -;; works, however. However, even if the style file is loaded by hand, -;; it fails to fontify verbatim text in the documentation parts of the -;; file. - -;;; Code: - -(TeX-add-style-hook - "shortvrb" - (lambda () - ;; Fontification - (when (and LaTeX-shortvrb-chars - (fboundp 'font-latex-set-syntactic-keywords) - (eq TeX-install-font-lock 'font-latex-setup)) - (let (syntax-alist) - (dolist (char LaTeX-shortvrb-chars) - (add-to-list 'syntax-alist (cons char "|"))) - (font-latex-add-to-syntax-alist syntax-alist))))) - -;;; shortvrb.el ends here diff --git a/packages/auctex/style/slides.el b/packages/auctex/style/slides.el deleted file mode 100644 index 9e16024b6..000000000 --- a/packages/auctex/style/slides.el +++ /dev/null @@ -1,41 +0,0 @@ -;;; slides.el --- AUCTeX style for the `slides' document class - -;; Copyright (C) 2004 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2004-04-21 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for the `slides' document class. Currently -;; the support is very limited. You are welcome to improve it. - -;;; Code: - -(TeX-add-style-hook - "slides" - (lambda () - (LaTeX-add-environments "slide" - "overlay" - "note"))) - -;;; slides.el ends here diff --git a/packages/auctex/style/slovak.el b/packages/auctex/style/slovak.el deleted file mode 100644 index 57083a492..000000000 --- a/packages/auctex/style/slovak.el +++ /dev/null @@ -1,10 +0,0 @@ -;;; slovak.el --- Setup AUCTeX for editing Slovak text. - -(TeX-add-style-hook - "slovak" - (lambda () - (setq TeX-quote-language `("slovak" "\\uv{" "}" ,TeX-quote-after-quote)) - (when (fboundp 'font-latex-add-quotes) - (font-latex-add-quotes '("\"`" "\"'")) - (font-latex-add-quotes '("\"<" "\">" french))) - (run-hooks 'TeX-language-sk-hook))) diff --git a/packages/auctex/style/subfigure.el b/packages/auctex/style/subfigure.el deleted file mode 100644 index 945f540b9..000000000 --- a/packages/auctex/style/subfigure.el +++ /dev/null @@ -1,73 +0,0 @@ -;;; subfigure.el --- AUCTeX style file for subfigure.sty - -;; Copyright (C) 2003, 2005 Free Software Foundation, Inc. - -;; Author: Reiner Steib -;; Maintainer: auctex-devel@gnu.org -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; AUCTeX style file for subfigure.sty - -;;; Code: - -(TeX-add-style-hook - "subfigure" - (lambda () - (TeX-add-symbols - '("subfigure" [ "list entry" ] [ "sub caption" ] "figure") - '("subtable" [ "list entry" ] [ "sub caption" ] "figure") - '("Subref" TeX-arg-label) - '("subref" TeX-arg-label)) - ;; TODO: add \subfig* lengths - - ;; Install completion for labels: - (setq TeX-complete-list - (append - '(("\\\\subref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}") - ("\\\\Subref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}")) - TeX-complete-list)) - ;; Fontification - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("subfigure" "[[{") - ("subtable" "[[{")) - 'textual) - (font-latex-add-keywords '(("Subref" "{") - ("subref" "{")) - 'reference)))) - -(defvar LaTeX-subfigure-package-options '("normal" "hang" "center" - "centerlast" "nooneline" - "raggedright" "isu" "anne" - "scriptsize" "footnotesize" - "small" "normalsize" "large" - "Large" "rm" "sf" "tt" "md" - "bf" "up" "it" "sl" "sc" "RM" - "SF" "TT" "MD" "BF" "IT" "SL" - "SC" "UP" "figbotcap" - "figtopcap" "tabbotcap" - "tabtopcap" "FIGBOTCAP" - "FIGTOPCAP" "TABBOTCAP" - "TABTOPCAP" "loose" "tight") - "Package options for the subfigure package.") - -;;; subfigure.el ends here diff --git a/packages/auctex/style/swedish.el b/packages/auctex/style/swedish.el deleted file mode 100644 index 010163283..000000000 --- a/packages/auctex/style/swedish.el +++ /dev/null @@ -1,13 +0,0 @@ -;;; swedish.el --- Setup AUCTeX for editing Swedish text. - -;;; Commentary: -;; -;; Apparently the Swedes use ''this style'' quotations. - -(TeX-add-style-hook - "swedish" - (lambda () - (setq TeX-quote-language - `("swedish" "''" ,TeX-close-quote ,TeX-quote-after-quote)) - (setq LaTeX-babel-hyphen-language "swedish") - (run-hooks 'TeX-language-sv-hook))) diff --git a/packages/auctex/style/tabularx.el b/packages/auctex/style/tabularx.el deleted file mode 100644 index 0fc823497..000000000 --- a/packages/auctex/style/tabularx.el +++ /dev/null @@ -1,52 +0,0 @@ -;;; tabularx.el --- AUCTeX style for the tabularx package. - -;; Copyright (C) 2009 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2009-02-22 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for the tabularx package. - -;;; Code: - -(defvar LaTeX-tabularx-package-options - '("infoshow" "debugshow") - "Package options for the tabularx package.") - -(TeX-add-style-hook - "tabularx" - (lambda () - ;; New symbols - (TeX-add-symbols - "tracingtabularx" - '("tabularxcolumn" 0)) - ;; New environments - (LaTeX-add-environments - ;; XXX: The tabularx environment takes the same arguments as the - ;; tabular* environment. However, the supported tokens in the - ;; format can differ, so at some point in time we might want to - ;; separate tabular* and tabularx. - '("tabularx" LaTeX-env-tabular*)))) - -;;; tabularx.el ends here diff --git a/packages/auctex/style/units.el b/packages/auctex/style/units.el deleted file mode 100644 index 88ba73dfc..000000000 --- a/packages/auctex/style/units.el +++ /dev/null @@ -1,49 +0,0 @@ -;;; units.el --- AUCTeX style for the LaTeX package `units.sty' (v0.9b) - -;; Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -;; Author: Christian Schlauer -;; Maintainer: auctex-devel@gnu.org -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `units.sty'. - -;;; Code: - -(TeX-add-style-hook - "units" - (lambda () - (TeX-add-symbols - '("unit" [ "Value" ] "Unit") - '("unitfrac" [ "Value" ] "Unit in numerator" "Unit in denominator")) - ;; units.sty requires the package nicefrac.sty, thus we enable the - ;; macros of nicefrac.sty, too - (TeX-run-style-hooks "nicefrac") - ;; Fontification - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("unit" "[{") ("unitfrac" "[{{")) 'textual)))) - -(defvar LaTeX-units-package-options '("tight" "loose") - "Package options for the units package.") - -;;; units.el ends here diff --git a/packages/auctex/style/url.el b/packages/auctex/style/url.el deleted file mode 100644 index 0084be452..000000000 --- a/packages/auctex/style/url.el +++ /dev/null @@ -1,95 +0,0 @@ -;;; url.el --- AUCTeX style for `url.sty' - -;; Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2004-10-13 -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file adds support for `url.sty'. - -;;; Code: - -(TeX-add-style-hook - "url" - (lambda () - ;; New symbols - (TeX-add-symbols - "Url" - "UrlBigBreakPenalty" - "UrlBigBreaks" - "UrlBreakPenalty" - "UrlBreaks" - "UrlFont" - "UrlLeft" - "UrlNoBreaks" - "UrlOrds" - "UrlRight" - "UrlSpecials" - "path" - "url" - "urldef" - '("urlstyle" TeX-arg-urlstyle)) - - (add-to-list 'LaTeX-verbatim-macros-with-delims-local "path") - (add-to-list 'LaTeX-verbatim-macros-with-delims-local "url") - (add-to-list 'LaTeX-verbatim-macros-with-braces-local "path") - (add-to-list 'LaTeX-verbatim-macros-with-braces-local "url") - - ;; Fontification - (when (and (featurep 'font-latex) - (eq TeX-install-font-lock 'font-latex-setup)) - (font-latex-add-keywords '(("path" "{") ("url" "{")) 'reference) - (font-latex-add-keywords '(("Url" "") - ("UrlBigBreakPenalty" "") - ("UrlBigBreaks" "") - ("UrlBreakPenalty" "") - ("UrlBreaks" "") - ("UrlFont" "") - ("UrlLeft" "") - ("UrlNoBreaks" "") - ("UrlOrds" "") - ("UrlRight" "") - ("UrlSpecials" "") - ("urldef" "") - ("urlstyle" "{")) - 'variable) - ;; For syntactic fontification, e.g. verbatim constructs. - (font-latex-set-syntactic-keywords) - ;; Tell font-lock about the update. - (setq font-lock-set-defaults nil) - (font-lock-set-defaults)))) - -(defun TeX-arg-urlstyle (optional &optional prompt) - "Prompt for style used in \\urlstyle with completion." - (TeX-argument-insert - (completing-read (TeX-argument-prompt optional prompt "Style") - (mapcar 'list '("rm" "same" "sf" "tt")) - nil t) - optional)) - -(defvar LaTeX-url-package-options '("hyphens" "obeyspaces" "spaces" "LY1" - "T1" "allowmove") - "Package options for the url package.") - -;;; url.el ends here diff --git a/packages/auctex/style/varioref.el b/packages/auctex/style/varioref.el deleted file mode 100644 index 77c791bea..000000000 --- a/packages/auctex/style/varioref.el +++ /dev/null @@ -1,63 +0,0 @@ -;;; varioref.el --- AUCTeX style file with support for varioref.sty - -;; Copyright (C) 1999 Free Software Foundation, Inc. - -;; Author: Carsten Dominik -;; Maintainer: auctex-devel@gnu.org - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Code: - -(TeX-add-style-hook "varioref" - (lambda () - - (TeX-add-symbols - - ;; The macros with label arguments - '("vref" TeX-arg-label) - '("vpageref" [ "Same page text" ] [ "different page text" ] TeX-arg-label) - '("fullref" TeX-arg-label) - - ;; And the other macros used for customization - "reftextbefore" "reftextfacebefore" - "reftextafter" "reftextfaceafter" - "reftextfaraway" "vreftextvario" "vrefwarning") - - ;; Install completion for labels - (setq TeX-complete-list - (append - '(("\\\\vref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}") - ("\\\\vpageref\\(\\[[^]]*\\]\\)*{\\([^{}\n\r\\%,]*\\)" - 2 LaTeX-label-list "}")) - TeX-complete-list)))) - -(defvar LaTeX-varioref-package-options '("draft" "final" "afrikaans" - "american" "austrian" "naustrian" - "brazil" "breton" "catalan" "croatian" - "czech" "danish" "dutch" "english" - "esperanto" "finnish" "french" - "galician" "german" "ngerman" "greek" - "italian" "magyar" "norsk" "nynorsk" - "polish" "portuges" "romanian" - "russian" "slovak" "slovene" - "spanish" "swedish" "turkish" - "francais" "germanb") - "Package options for the varioref package.") - -;;; varioref.el ends here diff --git a/packages/auctex/style/verbatim.el b/packages/auctex/style/verbatim.el deleted file mode 100644 index 2c95def3e..000000000 --- a/packages/auctex/style/verbatim.el +++ /dev/null @@ -1,43 +0,0 @@ -;;; verbatim.el --- Style hook for the verbatim package. - -;; Copyright (C) 2001 Free Software Foundation, Inc. - -;; Author: Masayuki Ataka -;; Maintainer: auctex-devel@gnu.org -;; Created: 2001/05/01 - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; M-x TeX-auto-generate verbatim.sty makes garbages. - -;;; Code - -(TeX-add-style-hook "verbatim" - (function - (lambda () - (LaTeX-add-environments - "comment") - (TeX-add-symbols - '("verbatiminput" TeX-arg-file))))) - -(defvar LaTeX-verbatim-package-options nil - "Package options for the verbatim package.") - -;;; verbatim.el ends here. diff --git a/packages/auctex/style/virtex.el b/packages/auctex/style/virtex.el deleted file mode 100644 index af44a993b..000000000 --- a/packages/auctex/style/virtex.el +++ /dev/null @@ -1,83 +0,0 @@ -;;; virtex.el - Common code for all TeX formats. - -;; $Id: virtex.el,v 1.1 1994/01/23 08:14:44 amanda Exp $ - -;;; Code: - -(TeX-add-style-hook "virtex" - (function - (lambda () - (TeX-add-symbols "/" "above" "abovedisplayshortskip" - "abovedisplayskip" "abovewithdelims" "accent" - "adjdemerits" "advance" "afterassignment" - "aftergroup" "atop" "atopwithdelims" "badness" - "baselineskip" "batchmode" "begingroup" - "belowdisplayshortskip" "belowdisplayskip" - "binoppenalty" "botmark" "box" "boxmaxdepth" - "brokenpenalty" "catcode" "char" "chardef" - "cleaders" "closein" "closeout" "clubpenalty" - "copy" "count" "countdef" "cr" "crcr" "csname" - "day" "deadcycles" "def" "defaulthyphenchar" - "defaultskewchar" "delcode" "delimiter" - "delimiterfactor" "delimitershortfall" "dimen" - "dimendef" "discretionary" "displayindent" - "displaylimits" "displaystyle" - "displaywidowpenalty" "displaywidth" "divide" - "doublehyphendemerits" "dp" "dump" "edef" "else" - "emergencystretch" "end" "endcsname" "endgroup" - "endinput" "endlinechar" "eqno" "errhelp" - "errmessage" "errorcontextlines" "errorstopmode" - "escapechar" "everycr" "everydisplay" - "everyhbox" "everyjob" "everymath" "everypar" - "everyvbox" "exhyphenpenalty" "expandafter" - "fam" "fi" "finalhyphendemerits" "firstmark" - "floatingpenalty" "font" "fontdimen" "fontname" - "futurelet" "gdef" "global" "globaldefs" - "halign" "hangafter" "hangindent" "hbadness" - "hbox" "hfil" "hfill" "hfilneg" "hfuzz" - "hoffset" "holdinginserts" "hrule" "hsize" - "hskip" "hss" "ht" "hyphenpenation" "hyphenchar" - "hyphenpenalty" "if" "ifcase" "ifcat" "ifdim" - "ifeof" "iffalse" "ifhbox" "ifinner" "ifhmode" - "ifmmode" "ifnum" "ifodd" "iftrue" "ifvbox" - "ifvoid" "ifx" "ignorespaces" "immediate" - "indent" "input" "inputlineno" "insert" - "insertpenalties" "interlinepenalty" "jobname" - "kern" "language" "lastbox" "lastkern" - "lastpenalty" "lastskip" "lccode" "leaders" - "left" "lefthyphenmin" "leftskip" "leqno" "let" - "limits" "linepenalty" "lineskip" - "lineskiplimit" "long" "looseness" "lower" - "lowercase" "mag" "markaccent" "mathbin" - "mathchar" "mathchardef" "mathchoise" - "mathclose" "mathcode" "mathinner" "mathhop" - "mathopen" "mathord" "mathpunct" "mathrel" - "mathsurround" "maxdeadcycles" "maxdepth" - "meaning" "medmuskip" "message" "mkern" "month" - "moveleft" "moveright" "mskip" "multiply" - "muskip" "muskipdef" "newlinechar" "noalign" - "noboundary" "noexpand" "noindent" "nolimits" - "nonscript" "nonstopmode" "nulldelimiterspace" - "nullfont" "number" "omit" "openin" "openout" - "or" "outer" "output" "outputpenalty" - "overfullrule" "parfillskip" "parindent" - "parskip" "pausing" "postdisplaypenalty" - "predisplaypenalty" "predisplaysize" - "pretolerance" "relpenalty" "rightskip" - "scriptspace" "showboxbreadth" "showboxdepth" - "smallskipamount" "spaceskip" "splitmaxdepth" - "splittopskip" "tabskip" "thickmuskip" - "thinmuskip" "time" "tolerance" "topskip" - "tracingcommands" "tracinglostchars" - "tracingmacros" "tracingonline" "tracingoutput" - "tracingpages" "tracingparagraphs" - "tracingrestores" "tracingstats" "uccode" - "uchyph" "underline" "unhbox" "unhcopy" "unkern" - "unpenalty" "unskip" "unvbox" "unvcopy" - "uppercase" "vadjust" "valign" "vbadness" "vbox" - "vcenter" "vfil" "vfill" "vfilneg" "vfuzz" - "voffset" "vrule" "vsize" "vskip" "vss" "vtop" - "wd" "widowpenalty" "write" "xdef" "xleaders" - "xspaceskip" "year")))) - -;;; virtex.el ends here diff --git a/packages/auctex/tex-bar.el b/packages/auctex/tex-bar.el deleted file mode 100644 index cf7bc1dd0..000000000 --- a/packages/auctex/tex-bar.el +++ /dev/null @@ -1,513 +0,0 @@ -;;; tex-bar.el --- toolbar icons on AUCTeX in GNU emacs and XEmacs - -;; Copyright (C) 2004, 2005 Free Software Foundation, Inc. - -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 3 of -;; the License, or (at your option) any later version. - -;; This program is distributed in the hope that it will be -;; useful, but WITHOUT ANY WARRANTY; without even the implied -;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -;; PURPOSE. See the GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public -;; License along with this program; if not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, -;; MA 02110-1301 USA - -;; Author: Miguel V. S. Frasson -;; Keywords: tool-bar, tex, latex - -;;; Commentary: -;; - -;; This package also needs `toolbar-x.el', and `latex.el' for the -;; symbol-toolbar. - -;;; Use of this preliminary version: - -;; - Add `LaTeX-install-toolbar' to `LaTeX-mode-hook'. - -;; Special requirements for the use of experimental symbol-toolbar: - -;; - Customize `TeX-bar-LaTeX-buttons', adding the label -;; `LaTeX-symbols-experimental' at the end. - -;; - You should have a folder called "symb-pics" with the pics of the -;; symbols (xpm format is a good one), and the *parent* of this -;; folder should be in `load-path'. - -;; Did you read carefully this item? I will say again: the folder -;; "symb-pics" should *not* be in `load-path', but its *parent*. - -;; - each image file is named after the command that it represents in -;; the following rules: the base name is the name of the command -;; without the escape character "\", like \delta -> "delta.xpm"; -;; however, since in some OS filenames are case insensitive, all -;; occurences of capital letter should be replaced by the letter -;; plus a dash: \Rightarrow -> "R-ightarrow.xpm" --- actually, for -;; the correct name, apply `TeX-bar-img-filename' to "Rightarrow" -;; (TeX-bar-img-filename "Rightarrow") -;; --> "R-ightarrow" -;; The function `TeX-bar-img-filename' also treats special commands -;; like `\{', `\|', etc. - -;; You can get the symbol images on (temporary solution) -;; http://www.math.leidenuniv.nl/~frasson/symb-pics.tar.gz - -;;; Code: - -(require 'custom) - -(require 'toolbar-x) - -;; for error handling -(require 'tex-buf) - -;; For the symbol toolbar -(require 'latex) - -;;; Standard buttons - -;; help strings -(defun TeX-bar-help-from-command-list (item) - "Return the help string of ITEM in `TeX-command-list'. -If there is no help, the empty string is returned." - (let ((help (nth 1 (memq :help (assoc item TeX-command-list))))) - (if help help ""))) - -(defgroup TeX-tool-bar nil - "Tool bar support in AUCTeX." - :group 'AUCTeX) - -(defcustom TeX-bar-TeX-buttons - '(new-file open-file dired kill-buffer save-buffer cut copy paste undo - [separator nil] tex next-error view bibtex) - "List of buttons available in `tex-mode'. -It should be a list in the same format of the BUTTONS parameter -in function `toolbarx-install-toolbar', often a symbol that -labels a button or Emacs/XEmacs choice of buttons. - -Type `\\[TeX-bar-TeX-buttons]' for a list of available buttons. - -Buttons are defined in alists (labels associated to properties -that define a button). For a list of variables that hold such -alists, see variable `TeX-bar-TeX-all-button-alists'." - :type '(list (set :inline t - (const new-file) - (const open-file) - (const dired) - (const kill-buffer) - (const save-buffer) - (const write-file) - (const undo) - (const cut) - (const copy) - (const paste) - (const search-forward) - (const print-buffer) - (const [separator nil]) - (const tex) - (const next-error) - (const view) - (const file) - (const bibtex) - (const clean)) - ;; (const latex-symbols-experimental) - (repeat (choice (symbol :tag "Label") - (vector :args ((symbol :tag "Label in Emacs ") - (symbol :tag "Label in XEmacs")) - :tag "Emacs/XEmacs choice") - (sexp :tag "General element")))) - :group 'TeX-tool-bar) - -(defun TeX-bar-TeX-buttons () - "Display in a buffer a list of buttons for `tex-bar.el'." - (interactive) - (let ((assqs-button-alists) - (labels)) - (dolist (m-alist TeX-bar-TeX-all-button-alists) - (setq labels nil) - (dolist (as (eval m-alist)) - (setq labels (cons (car as) labels))) - (setq assqs-button-alists (cons (cons m-alist (nreverse labels)) - assqs-button-alists))) - (setq assqs-button-alists (nreverse assqs-button-alists)) - ;; displaying results - (save-excursion - (set-buffer (get-buffer-create "*TeX tool bar buttons*")) - (erase-buffer) - (insert "Available buttons for TeX mode -================================") - (dolist (i assqs-button-alists) - (insert (format "\n\n`%s' provides the following buttons:\n " (car i))) - (dolist (j (cdr i)) - (insert (format " %s" j))) - (fill-region (point-at-bol) (point-at-eol)))) - (display-buffer "*TeX tool bar buttons*" t))) - -(defgroup TeX-tool-bar-button-definitions nil - "Collections of button definitions." - :group 'TeX-tool-bar) - -(defcustom TeX-bar-TeX-all-button-alists - '(TeX-bar-TeX-button-alist - toolbarx-default-toolbar-meaning-alist) - "List of variables that hold buttons properties. -Each element should be a symbol bound to list in the format of -the argument BUTTON-ALIST in function `toolbarx-install-toolbar'." - :type '(repeat variable) - :group 'TeX-tool-bar-button-definitions) - -(defcustom TeX-bar-TeX-button-alist - '((tex :image (lambda nil (if TeX-PDF-mode "pdftex" "tex")) - :command (progn - (TeX-save-document (TeX-master-file)) - (TeX-command "TeX" 'TeX-master-file -1)) - :help (lambda (&rest ignored) - (TeX-bar-help-from-command-list "TeX"))) - (pdftex :image "pdftex" - :command (progn - (TeX-save-document (TeX-master-file)) - (TeX-command "PDFTeX" 'TeX-master-file -1)) - :help (lambda (&rest ignored) - (TeX-bar-help-from-command-list "PDFTeX"))) - (next-error :image "error" - :command TeX-next-error - :enable (plist-get TeX-error-report-switches - (intern (TeX-master-file))) - :visible (plist-get TeX-error-report-switches - (intern (TeX-master-file)))) - (view :image (lambda nil (if TeX-PDF-mode "viewpdf" "viewdvi")) - :command (TeX-command "View" 'TeX-master-file -1) - :help (lambda (&rest ignored) - (TeX-bar-help-from-command-list "View"))) - (file :image "dvips" - :command (TeX-command "File" 'TeX-master-file -1) - :visible (not TeX-PDF-mode) - :help (lambda (&rest ignored) - (TeX-bar-help-from-command-list "File"))) - (bibtex :image "bibtex" - :command (TeX-command "BibTeX" 'TeX-master-file -1) - :help (lambda (&rest ignored) - (TeX-bar-help-from-command-list "BibTeX"))) - (clean :image "delete" - :command (TeX-command "Clean" 'TeX-master-file -1) - :help (lambda (&rest ignored) - (TeX-bar-help-from-command-list "Clean")))) - ;; latex-symbols-experimental? - "Alist for button definitions in TeX bar. -Value should le a list where each element is of format (KEY . -PROPS), where KEY is a symbol that labels the button and PROPS is -a list of properties of the button. For a description of the -format of PROPS, please see documentation of function -`toolbarx-install-toolbar'. This custom variable is in the same -format of the argument MEANING-ALIST in the mentioned function." - :type '(alist :key-type symbol :value-type sexp) - :group 'TeX-tool-bar-button-definitions) - -;;; Installation of the tool bar -;;;###autoload -(defun TeX-install-toolbar () - "Install toolbar buttons for TeX mode." - (interactive) - (require 'toolbar-x) - (add-to-list 'toolbarx-image-path - (expand-file-name "images" TeX-data-directory)) - (add-hook 'TeX-PDF-mode-hook 'toolbarx-refresh nil t) - (toolbarx-install-toolbar TeX-bar-TeX-buttons - (let ((append-list)) - (dolist (elt TeX-bar-TeX-all-button-alists) - (setq append-list (append append-list - (eval elt)))) - append-list))) - -(defcustom TeX-bar-LaTeX-buttons - '(new-file open-file dired kill-buffer save-buffer cut copy paste undo - [separator nil] latex next-error view bibtex) - "List of buttons available in `latex-mode'. -It should be a list in the same format of the BUTTONS parameter -in function `toolbarx-install-toolbar', often a symbol that -labels a button or Emacs/XEmacs choice of buttons. - -Type `\\[TeX-bar-LaTeX-buttons]' for a list of available buttons. - -Buttons are defined in alists (labels associated to properties -that define a button). For a list of variables that hold such -alists, see variable `TeX-bar-LaTeX-all-button-alists'." - :type '(list (set :inline t - (const new-file) - (const open-file) - (const dired) - (const kill-buffer) - (const save-buffer) - (const write-file) - (const undo) - (const cut) - (const copy) - (const paste) - (const search-forward) - (const print-buffer) - (const [separator nil]) - (const latex) - (const next-error) - (const view) - (const file) - (const bibtex) - (const clean) - (const latex-symbols-experimental)) - (repeat (choice (symbol :tag "Label") - (vector :args ((symbol :tag "Label in Emacs ") - (symbol :tag "Label in XEmacs")) - :tag "Emacs/XEmacs choice") - (sexp :tag "General element")))) - :group 'TeX-tool-bar) - -(defun TeX-bar-LaTeX-buttons () - "Display in a buffer a list of buttons for `tex-bar.el'." - (interactive) - (let ((assqs-button-alists) - (labels)) - (dolist (m-alist TeX-bar-LaTeX-all-button-alists) - (setq labels nil) - (dolist (as (eval m-alist)) - (setq labels (cons (car as) labels))) - (setq assqs-button-alists (cons (cons m-alist (nreverse labels)) - assqs-button-alists))) - (setq assqs-button-alists (nreverse assqs-button-alists)) - ;; displaying results - (save-excursion - (set-buffer (get-buffer-create "*TeX tool bar buttons*")) - (erase-buffer) - (insert "Available buttons for LaTeX mode -================================") - (dolist (i assqs-button-alists) - (insert (format "\n\n`%s' provides the following buttons:\n " (car i))) - (dolist (j (cdr i)) - (insert (format " %s" j))) - (fill-region (point-at-bol) (point-at-eol)))) - (display-buffer "*TeX tool bar buttons*" t))) - -(defgroup TeX-tool-bar-button-definitions nil - "Collections of button definitions." - :group 'TeX-tool-bar) - -(defcustom TeX-bar-LaTeX-all-button-alists - '(TeX-bar-LaTeX-button-alist - toolbarx-default-toolbar-meaning-alist) - "List of variables that hold buttons properties. -Each element should be a symbol bound to list in the format of -the argument BUTTON-ALIST in function `toolbarx-install-toolbar'." - :type '(repeat variable) - :group 'TeX-tool-bar-button-definitions) - -(defcustom TeX-bar-LaTeX-button-alist - '((latex :image (lambda nil (if TeX-PDF-mode "pdftex" "tex")) - :command (progn - (TeX-save-document (TeX-master-file)) - (TeX-command "LaTeX" 'TeX-master-file -1)) - :help (lambda (&rest ignored) - (TeX-bar-help-from-command-list "LaTeX"))) - (pdflatex :image "pdftex" - :command (progn - (TeX-save-document (TeX-master-file)) - (TeX-command "PDFLaTeX" 'TeX-master-file -1)) - :help (lambda (&rest ignored) - (TeX-bar-help-from-command-list "PDFLaTeX"))) - (next-error :image "error" - :command TeX-next-error - :enable (plist-get TeX-error-report-switches - (intern (TeX-master-file))) - :visible (plist-get TeX-error-report-switches - (intern (TeX-master-file)))) - (view :image (lambda nil (if TeX-PDF-mode "viewpdf" "viewdvi")) - :command (TeX-command "View" 'TeX-master-file -1) - :help (lambda (&rest ignored) - (TeX-bar-help-from-command-list "View"))) - (file :image "dvips" - :command (TeX-command "File" 'TeX-master-file -1) - :visible (not TeX-PDF-mode) - :help (lambda (&rest ignored) - (TeX-bar-help-from-command-list "File"))) - (bibtex :image "bibtex" - :command (TeX-command "BibTeX" 'TeX-master-file -1) - :help (lambda (&rest ignored) - (TeX-bar-help-from-command-list "BibTeX"))) - (clean :image "delete" - :command (TeX-command "Clean" 'TeX-master-file -1) - :help (lambda (&rest ignored) - (TeX-bar-help-from-command-list "Clean"))) - (latex-symbols-experimental . (:alias :eval-group - LaTeX-symbols-toolbar-switch-contents - LaTeX-symbols-toolbar-contents))) - "Alist for button definitions in TeX bar. -Value should le a list where each element is of format (KEY . -PROPS), where KEY is a symbol that labels the button and PROPS is -a list of properties of the button. For a description of the -format of PROPS, please see documentation of function -`toolbarx-install-toolbar'. This custom variable is in the same -format of the argument MEANING-ALIST in the mentioned function." - :type '(alist :key-type symbol :value-type sexp) - :group 'TeX-tool-bar-button-definitions) - -;;; Installation of the tool bar -;;;###autoload -(defun LaTeX-install-toolbar () - "Install toolbar buttons for LaTeX mode." - (interactive) - (require 'toolbar-x) - (add-to-list 'toolbarx-image-path - (expand-file-name "images" TeX-data-directory)) - (add-hook 'TeX-PDF-mode-hook 'toolbarx-refresh nil t) - (toolbarx-install-toolbar TeX-bar-LaTeX-buttons - (let ((append-list)) - (dolist (elt TeX-bar-LaTeX-all-button-alists) - (setq append-list (append append-list - (eval elt)))) - append-list))) - -;;; Experimental Symbol Toolbar - -;;; symbol toolbar -(defun TeX-bar-img-filename (tex-command) - "Return the filename (no extension) for the image button of TEX-COMMAND." - (let ((str-list (append tex-command nil)) - (str-result)) - (dolist (i str-list) - (cond - ;; capital letter -> letter + "-" - ((and (>= i ?A) (<= i ?Z)) - (setq str-result (cons ?- (cons i str-result)))) - ;; lowercase letter -> letter - ((and (>= i ?a) (<= i ?z)) - (setq str-result (cons i str-result))) - ;; open curly brackets `{' -> "ocb--" - ((eq i ?{) - (setq str-result (cons ?o str-result)) - (setq str-result (cons ?c str-result)) - (setq str-result (cons ?b str-result)) - (setq str-result (cons ?- str-result)) - (setq str-result (cons ?- str-result))) - ;; close curly brackets `}' -> "ccb--" - ((eq i ?}) - (setq str-result (cons ?c str-result)) - (setq str-result (cons ?c str-result)) - (setq str-result (cons ?b str-result)) - (setq str-result (cons ?- str-result)) - (setq str-result (cons ?- str-result))) - ;; vertical bar `|' -> "v--" - ((eq i ?|) - (setq str-result (cons ?v str-result)) - (setq str-result (cons ?- str-result)) - (setq str-result (cons ?- str-result))) - ;; slash `/' -> "s--" - ((eq i ?/) - (setq str-result (cons ?s str-result)) - (setq str-result (cons ?- str-result)) - (setq str-result (cons ?- str-result))))) - (concat (nreverse str-result)))) - -(let* ((menu-strings-buttons-alist - ;; make a alist os strings with the symbol classes and store it in - ;; `menu-strings-alist' - (let* ((menu-strings-alist-temp)) - (dolist (item-external (cdr LaTeX-math-menu) - (nreverse menu-strings-alist-temp)) - (when (listp item-external) - ;; if first element is vector, I am supposing that all are - ;; vectors as well - (if (vectorp (cadr item-external)) - (let* ((menu-str (car item-external)) - (menu-buttons)) - (dolist (button (cdr item-external)) - (setq menu-buttons - (cons (list (intern (TeX-bar-img-filename - (aref button 0))) - :image - (concat "symb-pics/" - (TeX-bar-img-filename - (aref button 0))) - :help (aref button 0) - :command (aref button 1)) - menu-buttons))) - (setq menu-buttons (nreverse menu-buttons)) - (setq menu-strings-alist-temp - (cons (cons menu-str (list menu-buttons)) - menu-strings-alist-temp))) - ;; if another list (therefore, up to second level menu) - (let ((parent-str (concat (car item-external) " "))) - (dolist (item-internal (cdr item-external)) - (unless (equal (car item-internal) "Special") - (let* ((menu-str (concat parent-str - (car item-internal))) - (menu-buttons)) - (dolist (button (cdr item-internal)) - (setq menu-buttons - (cons (list (intern (aref button 0)) - :image - (concat "symb-pics/" - (TeX-bar-img-filename - (aref button 0))) - :help (aref button 0) - :command (aref button 1)) - menu-buttons))) - (setq menu-buttons (nreverse menu-buttons)) - (setq menu-strings-alist-temp - (cons (cons menu-str (list menu-buttons)) - menu-strings-alist-temp))))))))))) - (list-strings (let* ((list-str-temp)) - (dolist (i menu-strings-buttons-alist - (nreverse list-str-temp)) - (setq list-str-temp (cons (car i) - list-str-temp)))))) - (defvar LaTeX-symbols-toolbar-visible-flag nil - "Non-nil means that the LaTeX symbols on toolbar are visible. -Internal variable.") - (defconst LaTeX-symbols-toolbar-switch-contents - `(;; the on-off switch button - (latex-symbols-switch - :image (lambda nil (if LaTeX-symbols-toolbar-visible-flag - "ltx-symb-turn-off" - "ltx-symb-turn-on")) - :command (progn - (setq LaTeX-symbols-toolbar-visible-flag - (not LaTeX-symbols-toolbar-visible-flag)) - (toolbarx-refresh)) - ;; help message depends on if symb-toolbar is on or off, and in - ;; the name of the current class of symbols - :help (lambda (&rest ignore) - (concat "Turn " - (if LaTeX-symbols-toolbar-visible-flag "off " "on ") - "the toolbar of LaTeX symbols (current class: " - (nth (1- LaTeX-symbols-active-menuitem) - (quote ,list-strings)) - ")"))) - ;; the dropdown button, that also switch on the symbols - ,(append '(:dropdown-group) - list-strings - '(:variable - LaTeX-symbols-active-menuitem - :save offer - :dropdown-prepend-command - (setq LaTeX-symbols-toolbar-visible-flag t) - :dropdown-help "Select a class of symbols to be displayed")))) - (defconst LaTeX-symbols-toolbar-contents - (let* ((ltx-symb) - (count 0)) - (dolist (i menu-strings-buttons-alist - (append (nreverse ltx-symb) - '(:insert - LaTeX-symbols-toolbar-visible-flag - :toolbar (bottom . top)))) - (setq count (1+ count)) - (setq ltx-symb - (cons (append (cdr i) - `(:insert (eq LaTeX-symbols-active-menuitem - ,count))) - ltx-symb)))))) - -(provide 'tex-bar) - -;;; tex-bar.el ends here diff --git a/packages/auctex/tex-buf.el b/packages/auctex/tex-buf.el deleted file mode 100644 index c1b7665b0..000000000 --- a/packages/auctex/tex-buf.el +++ /dev/null @@ -1,2143 +0,0 @@ -;;; tex-buf.el --- External commands for AUCTeX. - -;; Copyright (C) 1991, 1993, 1996, 2001, 2003, 2004, 2005, 2006, 2007, -;; 2008, 2009 Free Software Foundation, Inc. - -;; Maintainer: auctex-devel@gnu.org -;; Keywords: tex, wp - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file provides support for external commands. - -;;; Code: - -(require 'tex) - -;;; Customization: - -(defcustom TeX-process-asynchronous (not (eq system-type 'ms-dos)) - "*Use asynchronous processes." - :group 'TeX-command - :type 'boolean) - -(defcustom TeX-shell - (if (memq system-type '(ms-dos emx windows-nt)) - shell-file-name - "/bin/sh") - "Name of shell used to parse TeX commands." - :group 'TeX-command - :type 'file) - -(defcustom TeX-shell-command-option - (cond ((memq system-type '(ms-dos emx windows-nt) ) - (cond ((boundp 'shell-command-option) - shell-command-option) - ((boundp 'shell-command-switch) - shell-command-switch) - (t - "/c"))) - (t ;Unix & EMX (Emacs 19 port to OS/2) - "-c")) - "Shell argument indicating that next argument is the command." - :group 'TeX-command - :type 'string) - -;;; Interactive Commands -;; -;; The general idea is, that there is one process and process buffer -;; associated with each master file, and one process and process buffer -;; for running TeX on a region. Thus, if you have N master files, you -;; can run N + 1 processes simultaneously. -;; -;; Some user commands operates on ``the'' process. The following -;; algorithm determine what ``the'' process is. -;; -;; IF last process started was on a region -;; THEN ``the'' process is the region process -;; ELSE ``the'' process is the master file (of the current buffer) process - -(defun TeX-save-document (name) - "Save all files belonging to the current document. -Return non-nil if document need to be re-TeX'ed." - (interactive (list (TeX-master-file))) - (if (string-equal name "") - (setq name (TeX-master-file))) - - (TeX-check-files (concat name "." (TeX-output-extension)) - (cons name (TeX-style-list)) - TeX-file-extensions)) - -(defun TeX-command-master (&optional override-confirm) - "Run command on the current document. - -If a prefix argument OVERRIDE-CONFIRM is given, confirmation will -depend on it being positive instead of the entry in `TeX-command-list'." - (interactive "P") - (TeX-command (TeX-command-query (TeX-master-file)) 'TeX-master-file - override-confirm)) - -(defvar TeX-command-region-begin nil) -(defvar TeX-command-region-end nil) -;; Used for marking the last region. - -(make-variable-buffer-local 'TeX-command-region-begin) -(make-variable-buffer-local 'TeX-command-region-end) - -(defun TeX-current-offset (&optional pos) - "Calculate line offset of POS, or of point if POS is nil." - (save-restriction - (widen) - (save-excursion - (let ((inhibit-point-motion-hooks t) - (inhibit-field-text-motion t)) - (if pos (goto-char pos)) - (+ (count-lines (point-min) (point)) - (if (bolp) 0 -1)))))) - -(defun TeX-pin-region (begin end) - "Pin the TeX region specified by BEGIN and END. -If BEGIN is nil, the region is unpinned. - -In interactive use, a positive prefix arg will pin the region, -a non-positive one will unpin it. Without a prefix arg, if -a region is actively marked, it will get pinned. If not, a -pinned region will get unpinned and vice versa." - (interactive - (if - (if current-prefix-arg - (> (prefix-numeric-value current-prefix-arg) 0) - (or (TeX-active-mark) - (null TeX-command-region-begin))) - (list (region-beginning) (region-end)) - '(nil nil))) - (if begin - (progn - (unless (markerp TeX-command-region-begin) - (setq TeX-command-region-begin (make-marker)) - (setq TeX-command-region-end (make-marker))) - (set-marker TeX-command-region-begin begin) - (set-marker TeX-command-region-end end) - (message "TeX region pinned.")) - (when (markerp TeX-command-region-begin) - (set-marker TeX-command-region-begin nil) - (set-marker TeX-command-region-end nil)) - (setq TeX-command-region-begin nil) - (setq TeX-command-region-end nil) - (message "TeX region unpinned."))) - -(defun TeX-command-region (&optional override-confirm) - "Run TeX on the current region. - -Query the user for a command to run on the temporary file specified by -the variable `TeX-region'. If there is an explicitly active region, -it is stored for later commands. If not, a previously stored region -\(can be also be set with `TeX-pin-region') overrides the current region, -if present. - -If a prefix argument OVERRIDE-CONFIRM is given, prompting will -ignore the prompting flag from `TeX-command-list' and instead -will prompt iff the prefix is positive. - -If the master file for the document has a header, it is written to the -temporary file before the region itself. The document's header is all -text before `TeX-header-end'. - -If the master file for the document has a trailer, it is written to -the temporary file before the region itself. The document's trailer is -all text after `TeX-trailer-start'." - (interactive "P") - ;; Note that TeX-command-region-begin is not a marker when called - ;; from TeX-command-buffer. - (and (or (null TeX-command-region-begin) - (markerp TeX-command-region-begin)) - (TeX-active-mark) - (TeX-pin-region (region-beginning) (region-end))) - (let ((begin (or TeX-command-region-begin (region-beginning))) - (end (or TeX-command-region-end (region-end)))) - (TeX-region-create (TeX-region-file TeX-default-extension) - (buffer-substring begin end) - (file-name-nondirectory (buffer-file-name)) - (TeX-current-offset begin))) - (TeX-command (TeX-command-query (TeX-region-file nil t)) 'TeX-region-file - override-confirm)) - -(defun TeX-command-buffer (&optional override-confirm) - "Run TeX on the current buffer. - -Query the user for a command to run on the temporary file specified by -the variable `TeX-region'. The region file will be recreated from the -visible part of the buffer. - -If a prefix argument OVERRIDE-CONFIRM is given, confirmation will -depend on it being positive instead of the entry in `TeX-command-list'." - (interactive "P") - (let ((TeX-command-region-begin (point-min)) - (TeX-command-region-end (point-max))) - (TeX-command-region override-confirm))) - -(unless (featurep 'xemacs) - ;; This variable is not defined in XEmacs because XEmacs' version of - ;; `pop-to-buffer' doesn't support the optional NORECORD argument. In - ;; XEmacs, the third arg is ON-FRAME (Emacs: NORECORD). - (defcustom TeX-record-buffer nil - "Whether to record buffer names of generated TeX buffers. -When non-nil, these buffers are put at the front of the list of -recently selected ones." - :group 'TeX-command - :type 'boolean)) - -(defun TeX-pop-to-buffer (buffer &optional other-window norecord) - "Compatibility wrapper for `pop-to-buffer'. - -Select buffer BUFFER in some window, preferably a different one. -BUFFER may be a buffer, a string (a buffer name), or nil. -If BUFFER is a string which is not the name of an existing buffer, -then this function creates a buffer with that name. -If BUFFER is nil, then it chooses some other buffer. -If `pop-up-windows' is non-nil, windows can be split to do this. -If optional second arg OTHER-WINDOW is non-nil, insist on finding another -window even if BUFFER is already visible in the selected window, -and ignore `same-window-regexps' and `same-window-buffer-names'. -This function returns the buffer it switched to. -This uses the function `display-buffer' as a subroutine; see the documentation -of `display-buffer' for additional customization information. - -Optional third arg NORECORD non-nil means do not put this buffer -at the front of the list of recently selected ones. - -NORECORD is ignored in XEmacs." - ;; Make sure not to use third arg in XEmacs. In XEmacs, the third arg is - ;; ON-FRAME (Emacs: NORECORD), so we set it to nil. - (pop-to-buffer buffer other-window (and norecord - (boundp 'TeX-record-buffer) - TeX-record-buffer))) - -(defun TeX-recenter-output-buffer (line) - "Redisplay buffer of TeX job output so that most recent output can be seen. -The last line of the buffer is displayed on line LINE of the window, or -at bottom if LINE is nil." - (interactive "P") - (let ((buffer (TeX-active-buffer))) - (if buffer - (let ((old-buffer (current-buffer))) - (TeX-pop-to-buffer buffer t t) - (bury-buffer buffer) - (goto-char (point-max)) - (recenter (if line - (prefix-numeric-value line) - (/ (window-height) 2))) - (TeX-pop-to-buffer old-buffer nil t)) - (message "No process for this document.")))) - -(defun TeX-kill-job () - "Kill the currently running TeX job." - (interactive) - (let ((process (TeX-active-process))) - (if process - (kill-process process) - ;; Should test for TeX background process here. - (error "No TeX process to kill")))) - -(defun TeX-home-buffer () - "Go to the buffer where you last issued a TeX command. -If there is no such buffer, or you already are in that buffer, find -the master file." - (interactive) - (if (or (null TeX-command-buffer) - (null (buffer-name TeX-command-buffer)) - (eq TeX-command-buffer (current-buffer))) - (find-file (TeX-master-file TeX-default-extension)) - (switch-to-buffer TeX-command-buffer))) - -(defun TeX-next-error (reparse) - "Find the next error in the TeX output buffer. -With \\[universal-argument] prefix, start from the beginning of the errors." - (interactive "P") - (if (null (TeX-active-buffer)) - (next-error reparse) - (funcall (TeX-process-get-variable (with-current-buffer TeX-command-buffer - (TeX-active-master)) - 'TeX-parse-function) - reparse))) - -(defun TeX-previous-error (arg) - "Find the previous error in the TeX output buffer." - (interactive "P") - (if (null (TeX-active-buffer)) - (previous-error arg) - (error "Jumping to previous error not supported"))) - -;;; Command Query - -(defun TeX-command (name file &optional override-confirm) - "Run command NAME on the file returned by calling FILE. - -FILE is the symbol of a function returning a file name. The -function has one optional argument, the extension to use on the -file. - -Use the information in `TeX-command-list' to determine how to run -the command. - -If OVERRIDE-CONFIRM is a prefix argument, confirmation will be -asked if it is positive, and suppressed if it is not." - (cond ((eq file 'TeX-region-file) - (setq TeX-current-process-region-p t)) - ((eq file 'TeX-master-file) - (setq TeX-current-process-region-p nil))) - (let ((command (TeX-command-expand (nth 1 (assoc name TeX-command-list)) - file)) - (hook (nth 2 (assoc name TeX-command-list))) - (confirm (if override-confirm - (> (prefix-numeric-value override-confirm) 0) - (nth 3 (assoc name TeX-command-list))))) - - ;; Verify the expanded command - (if confirm - (setq command - (read-from-minibuffer (concat name " command: ") command - nil nil))) - - ;; Now start the process - (setq file (funcall file)) - (TeX-process-set-variable file 'TeX-command-next TeX-command-Show) - (funcall hook name command file))) - -(defun TeX-command-expand (command file &optional list) - "Expand COMMAND for FILE as described in LIST. -LIST default to `TeX-expand-list'. As a special exception, -`%%' can be used to produce a single `%' sign in the output -without further expansion." - (let (pat - pos - entry TeX-command-text TeX-command-pos - (file `(lambda (&rest args) - (shell-quote-argument - (concat (and (stringp TeX-command-pos) TeX-command-pos) - (apply ',file args) - (and (stringp TeX-command-pos) TeX-command-pos))))) - case-fold-search string expansion arguments) - (setq list (cons - (list "%%" (lambda nil - (setq pos (1+ pos)) - "%")) - (or list TeX-expand-list)) - pat (regexp-opt (mapcar #'car list))) - (while (setq pos (string-match pat command pos)) - (setq string (match-string 0 command) - entry (assoc string list) - expansion (car (cdr entry)) ;Second element - arguments (cdr (cdr entry)) ;Remaining elements - string (save-match-data - ;; Note regarding the special casing of `file': - ;; `file' is prevented from being evaluated as a - ;; function because inside of AUCTeX it only has - ;; a meaning as a variable. This makes sure that - ;; a function definition made by an external - ;; package (e.g. icicles) is not picked up. - (cond ((and (not (eq expansion 'file)) - (TeX-function-p expansion)) - (apply expansion arguments)) - ((boundp expansion) - (apply (eval expansion) arguments)) - (t - (error "Nonexpansion %s" expansion))))) - (if (stringp string) - (setq command - (replace-match string t t command))))) - command) - -(defun TeX-check-files (derived originals extensions) - "Check that DERIVED is newer than any of the ORIGINALS. -Try each original with each member of EXTENSIONS, in all directories -in `TeX-check-path'." - (let ((found nil) - (regexp (concat "\\`\\(" - (mapconcat (lambda (dir) - (regexp-quote - (expand-file-name - (file-name-as-directory dir)))) - TeX-check-path "\\|") - "\\).*\\(" - (mapconcat 'regexp-quote originals "\\|") - "\\)\\.\\(" - (mapconcat 'regexp-quote extensions "\\|") - "\\)\\'")) - (buffers (buffer-list))) - (while buffers - (let* ((buffer (car buffers)) - (name (buffer-file-name buffer))) - (setq buffers (cdr buffers)) - (if (and name (string-match regexp name)) - (progn - (and (buffer-modified-p buffer) - (or (not TeX-save-query) - (y-or-n-p (concat "Save file " - (buffer-file-name buffer) - "? "))) - (save-excursion (set-buffer buffer) (save-buffer))) - (if (file-newer-than-file-p name derived) - (setq found t)))))) - found)) - -(defcustom TeX-save-query t - "*If non-nil, ask user for permission to save files before starting TeX." - :group 'TeX-command - :type 'boolean) - -(defvar TeX-command-history nil) - -(defun TeX-command-query (name) - "Query the user for what TeX command to use." - (let* ((default (cond ((if (string-equal name TeX-region) - (TeX-check-files (concat name "." (TeX-output-extension)) - (list name) - TeX-file-extensions) - (TeX-save-document (TeX-master-file))) - TeX-command-default) - ((and (memq major-mode '(doctex-mode latex-mode)) - (TeX-check-files (concat name ".bbl") - (mapcar 'car - (LaTeX-bibliography-list)) - BibTeX-file-extensions)) - ;; We should check for bst files here as well. - TeX-command-BibTeX) - ((TeX-process-get-variable name - 'TeX-command-next - TeX-command-Show)) - (TeX-command-Show))) - (completion-ignore-case t) - (answer (or TeX-command-force - (completing-read - (concat "Command: (default " default ") ") - (TeX-mode-specific-command-list major-mode) nil t - nil 'TeX-command-history)))) - ;; If the answer "latex" it will not be expanded to "LaTeX" - (setq answer (car-safe (TeX-assoc answer TeX-command-list))) - (if (and answer - (not (string-equal answer ""))) - answer - default))) - -(defvar TeX-command-next nil - "The default command next time `TeX-command' is invoked.") - - (make-variable-buffer-local 'TeX-command-next) - -(defun TeX-printer-query (&optional queue) - "Query the user for a printer name. -QUEUE is non-nil when we are checking for the printer queue." - (let (command element printer) - (if queue - (unless (setq element 2 command TeX-queue-command) - (error "Need to customize `TeX-queue-command'")) - (unless (setq element 1 command TeX-print-command) - (error "Need to customize `TeX-print-command'"))) - (while (progn - (setq printer (if TeX-printer-list - (let ((completion-ignore-case t)) - (completing-read - (concat "Printer: " - (and TeX-printer-default - (concat "(default " - TeX-printer-default ") "))) - TeX-printer-list)) - "")) - (setq printer (or (car-safe (TeX-assoc printer TeX-printer-list)) - printer)) - (not (if (or (null printer) (string-equal "" printer)) - (setq printer TeX-printer-default) - (setq TeX-printer-default printer))))) - - (let ((expansion (let ((entry (assoc printer TeX-printer-list))) - (or (nth element entry) - command)))) - (if (string-match "%p" printer) - (error "Don't use %s in printer names" "%p")) - (while (string-match "%p" expansion) - (setq expansion (replace-match printer t t expansion 0))) - expansion))) - -(defun TeX-style-check (styles) - "Check STYLES compared to the current style options." - (let ((files (TeX-style-list))) - (while (and styles - (not (TeX-member (car (car styles)) files 'string-match))) - (setq styles (cdr styles)))) - (if styles - (nth 1 (car styles)) - "")) - -(defun TeX-output-extension () - "Get the extension of the current TeX output file." - (if (listp TeX-output-extension) - (car TeX-output-extension) - (or (TeX-process-get-variable (TeX-active-master) - 'TeX-output-extension - TeX-output-extension) - TeX-output-extension))) - -(defun TeX-view-mouse (event) - "Start `TeX-view' at mouse position." - (interactive "e") - (save-excursion - (set-buffer (window-buffer (posn-window (event-start event)))) - (goto-char (posn-point (event-start event))) - (TeX-view))) - -(defun TeX-view () - "Start a viewer without confirmation. -The viewer is started either on region or master file, -depending on the last command issued." - (interactive) - (let ((output-file (TeX-active-master (TeX-output-extension)))) - (if (file-exists-p output-file) - (TeX-command "View" 'TeX-active-master 0) - (message "Output file %S does not exist." output-file)))) - -(defun TeX-output-style-check (styles) - "Check STYLES compared to the current view output file extension and -the current style options." - (let ((ext (TeX-output-extension)) - (files (TeX-style-list))) - (while (and - styles - (or - (not (string-match (car (car styles)) ext)) - (let ((style (nth 1 (car styles)))) - (cond - ((listp style) - (while - (and style - (TeX-member (car style) files 'string-match)) - (setq style (cdr style))) - style) - ((not (TeX-member style files 'string-match))))))) - (setq styles (cdr styles))) - (if styles - (nth 2 (car styles)) - "%v"))) - -;;; Command Hooks - -(defvar TeX-after-start-process-function nil - "Hooks to run after starting an asynchronous process. -Used by Japanese TeX to set the coding system.") - -(defcustom TeX-show-compilation nil - "*If non-nil, show output of TeX compilation in other window." - :group 'TeX-command - :type 'boolean) - -(defun TeX-run-command (name command file) - "Create a process for NAME using COMMAND to process FILE. -Return the new process." - (let ((default TeX-command-default) - (buffer (TeX-process-buffer-name file)) - (dir (TeX-master-directory)) - (command-buff (current-buffer))) - (TeX-process-check file) ; Check that no process is running - (setq-default TeX-command-buffer command-buff) - (get-buffer-create buffer) - (set-buffer buffer) - (buffer-disable-undo) - (erase-buffer) - (set (make-local-variable 'line-number-display-limit) 0) - (setq TeX-output-extension nil) - (set (make-local-variable 'TeX-command-buffer) command-buff) - (if dir (cd dir)) - (insert "Running `" name "' on `" file "' with ``" command "''\n") - (setq mode-name name) - (if TeX-show-compilation - (display-buffer buffer) - (message "Type `%s' to display results of compilation." - (substitute-command-keys - "\\\\[TeX-recenter-output-buffer]"))) - (setq TeX-parse-function 'TeX-parse-command) - (setq TeX-command-default default) - (setq TeX-sentinel-function - (lambda (process name) - (message (concat name ": done.")))) - (if TeX-process-asynchronous - (let ((process (start-process name buffer TeX-shell - TeX-shell-command-option command))) - (if TeX-after-start-process-function - (funcall TeX-after-start-process-function process)) - (TeX-command-mode-line process) - (set-process-filter process 'TeX-command-filter) - (set-process-sentinel process 'TeX-command-sentinel) - (set-marker (process-mark process) (point-max)) - (setq compilation-in-progress (cons process compilation-in-progress)) - process) - (setq mode-line-process ": run") - (set-buffer-modified-p (buffer-modified-p)) - (sit-for 0) ; redisplay - (call-process TeX-shell nil buffer nil - TeX-shell-command-option command)))) - -(defun TeX-run-set-command (name command) - "Remember TeX command to use to NAME and set corresponding output extension." - (setq TeX-command-default name - TeX-output-extension (if TeX-PDF-mode "pdf" "dvi")) - (let ((case-fold-search t) - (lst TeX-command-output-list)) - (while lst - (if (string-match (car (car lst)) command) - (setq TeX-output-extension (car (cdr (car lst))) - lst nil) - (setq lst (cdr lst)))))) - -(defun TeX-run-format (name command file) - "Create a process for NAME using COMMAND to format FILE with TeX." - (TeX-run-set-command name command) - (let ((buffer (TeX-process-buffer-name file)) - (process (TeX-run-command name command file))) - ;; Hook to TeX debuger. - (save-excursion - (set-buffer buffer) - (TeX-parse-reset) - (setq TeX-parse-function 'TeX-parse-TeX) - (setq TeX-sentinel-function 'TeX-TeX-sentinel) - (if TeX-process-asynchronous - (progn - ;; Updating the mode line. - (setq TeX-current-page "[0]") - (TeX-format-mode-line process) - (set-process-filter process 'TeX-format-filter))) - process))) - -(defvar TeX-error-report-switches nil - "Reports presence of errors after `TeX-run-TeX'. -To test whether the current buffer has an compile error from last -run of `TeX-run-TeX', use - (plist-get TeX-error-report-switches (intern (TeX-master-file)))") - -(defun TeX-run-TeX (name command file) - "Create a process for NAME using COMMAND to format FILE with TeX." - - ;; Save information in TeX-error-report-switches - ;; Initialize error to nil (no error) for current master. - ;; Presence of error is reported inside `TeX-TeX-sentinel-check' - (let ((current-master (TeX-master-file))) - ;; the current master file is saved because error routines are - ;; parsed in other buffers; - (setq TeX-error-report-switches - (plist-put TeX-error-report-switches - 'TeX-current-master current-master)) - ;; reset error to nil (no error) - (setq TeX-error-report-switches - (plist-put TeX-error-report-switches - (intern current-master) nil))) - - ;; can we assume that TeX-sentinel-function will not be changed - ;; during (TeX-run-format ..)? --pg - ;; rather use let* ? --pg - - (if TeX-interactive-mode - (TeX-run-interactive name command file) - (let ((sentinel-function TeX-sentinel-default-function)) - (let ((process (TeX-run-format name command file))) - (setq TeX-sentinel-function sentinel-function) - (if TeX-process-asynchronous - process - (TeX-synchronous-sentinel name file process)))))) - -;; backward compatibilty - -(defalias 'TeX-run-LaTeX 'TeX-run-TeX) - - -(defun TeX-run-BibTeX (name command file) - "Create a process for NAME using COMMAND to format FILE with BibTeX." - (let ((process (TeX-run-command name command file))) - (setq TeX-sentinel-function 'TeX-BibTeX-sentinel) - (if TeX-process-asynchronous - process - (TeX-synchronous-sentinel name file process)))) - -(defun TeX-run-compile (name command file) - "Ignore first and third argument, start compile with second argument." - (compile command)) - -(defun TeX-run-shell (name command file) - "Ignore first and third argument, start shell-command with second argument." - (let ((default-directory (TeX-master-directory))) - (shell-command command) - (if (eq system-type 'ms-dos) - (redraw-display)))) - -(defun TeX-run-discard (name command file) - "Start COMMAND as process, discarding its output. -NAME and FILE are ignored." - (let ((default-directory (TeX-master-directory))) - (call-process TeX-shell - nil 0 nil - TeX-shell-command-option - command))) - -(defun TeX-run-discard-foreground (name command file) - "Call process with second argument in the foreground, discarding its output. -With support for MS-DOS, especially when dviout is used with PC-9801 series." - (if (and (boundp 'dos-machine-type) (eq dos-machine-type 'pc98)) ;if PC-9801 - (send-string-to-terminal "\e[2J")) ; clear screen - (call-process TeX-shell (if (eq system-type 'ms-dos) "con") nil nil - TeX-shell-command-option command) - (if (eq system-type 'ms-dos) - (redraw-display))) -(defalias 'TeX-run-dviout 'TeX-run-discard-foreground) - -(defun TeX-run-background (name command file) - "Start process with second argument, show output when and if it arrives." - (let ((dir (TeX-master-directory))) - (set-buffer (get-buffer-create "*TeX background*")) - (if dir (cd dir)) - (erase-buffer) - (let ((process (start-process (concat name " background") - nil TeX-shell - TeX-shell-command-option command))) - (if TeX-after-start-process-function - (funcall TeX-after-start-process-function process)) - (set-process-filter process 'TeX-background-filter) - (process-kill-without-query process)))) - -(defun TeX-run-silent (name command file) - "Start process with second argument." - (let ((dir (TeX-master-directory))) - (set-buffer (get-buffer-create "*TeX silent*")) - (if dir (cd dir)) - (erase-buffer) - (let ((process (start-process (concat name " silent") - nil TeX-shell - TeX-shell-command-option command))) - (if TeX-after-start-process-function - (funcall TeX-after-start-process-function process)) - (process-kill-without-query process)))) - -(defun TeX-run-interactive (name command file) - "Run TeX interactively. -Run command in a buffer (in comint-shell-mode) so that it accepts user -interaction. If you return to the file buffer after the TeX run, -Error parsing on \\[next-error] should work with a bit of luck." - (TeX-run-set-command name command) - (require 'comint) - (let ((default TeX-command-default) - (buffer (TeX-process-buffer-name file)) - (process nil) - (dir (TeX-master-directory)) - (command-buff (current-buffer)) - (sentinel-function TeX-sentinel-default-function)) ; inherit from major mode - (TeX-process-check file) ; Check that no process is running - (setq-default TeX-command-buffer command-buff) - (with-output-to-temp-buffer buffer) - (set-buffer buffer) - (set (make-local-variable 'TeX-command-buffer) command-buff) - (setq buffer-read-only nil) - (if dir (cd dir)) - (insert "Running `" name "' on `" file "' with ``" command "''\n") - (comint-exec buffer name TeX-shell nil - (list TeX-shell-command-option command)) - (comint-mode) - (add-hook 'comint-output-filter-functions 'TeX-interactive-goto-prompt) - (setq mode-name name) - (setq TeX-command-default default) - (setq process (get-buffer-process buffer)) - (if TeX-after-start-process-function - (funcall TeX-after-start-process-function process)) - (TeX-command-mode-line process) - (set-process-sentinel process 'TeX-command-sentinel) - (set-marker (process-mark process) (point-max)) - (setq compilation-in-progress (cons process compilation-in-progress)) - (TeX-parse-reset) - (setq TeX-parse-function 'TeX-parse-TeX) - ;; use the sentinel-function that the major mode sets, not the LaTeX one - (setq TeX-sentinel-function sentinel-function))) - -(defun TeX-run-function (name command file) - "Execute Lisp function or function call given as the string COMMAND. -Parameters NAME and FILE are ignored." - (let ((fun (car (read-from-string command)))) - (if (functionp fun) (funcall fun) (eval fun)))) - -(defun TeX-run-discard-or-function (name command file) - "Start COMMAND as process or execute it as a Lisp function. -If run as a process, the output is discarded. COMMAND is -expected to be a string. NAME and FILE are ignored." - (if (functionp (car (read-from-string command))) - (TeX-run-function name command file) - (TeX-run-discard name command file))) - -(defun TeX-run-ispell-on-document (command ignored name) - "Run ispell on all open files belonging to the current document. -This function is *obsolete* and only here for compatibility -reasons. Use `TeX-run-function' instead." - (interactive) - (TeX-ispell-document "")) - - -;;; Command Sentinels - -(defun TeX-synchronous-sentinel (name file result) - "Process TeX command output buffer after the process dies." - (let* ((buffer (TeX-process-buffer file))) - (save-excursion - (set-buffer buffer) - - ;; Append post-mortem information to the buffer - (goto-char (point-max)) - (insert "\n" mode-name (if (and result (zerop result)) - " finished" " exited") " at " - (substring (current-time-string) 0 -5)) - (setq mode-line-process ": exit") - - ;; Do command specific actions. - (setq TeX-command-next TeX-command-Show) - (goto-char (point-min)) - (apply TeX-sentinel-function nil name nil) - - ;; Force mode line redisplay soon - (set-buffer-modified-p (buffer-modified-p))))) - -(defun TeX-command-sentinel (process msg) - "Process TeX command output buffer after the process dies." - ;; Set `TeX-transient-master' here because `preview-parse-messages' - ;; may open files and thereby trigger master file questions which we - ;; don't want and need because we already know the master. Use - ;; `TeX-master-file' instead of `TeX-active-master' to determine the - ;; master because the region file should never be the master. - (let* ((TeX-transient-master (TeX-master-file)) - (buffer (process-buffer process)) - (name (process-name process))) - (cond ((null (buffer-name buffer)) ; buffer killed - (set-process-buffer process nil) - (set-process-sentinel process nil)) - ((memq (process-status process) '(signal exit)) - (save-excursion - (set-buffer buffer) - - ;; Append post-mortem information to the buffer - (goto-char (point-max)) - (insert-before-markers "\n" mode-name " " msg) - (forward-char -1) - (insert " at " - (substring (current-time-string) 0 -5)) - (forward-char 1) - - ;; Do command specific actions. - (TeX-command-mode-line process) - (setq TeX-command-next TeX-command-Show) - (goto-char (point-min)) - (apply TeX-sentinel-function process name nil) - - - ;; If buffer and mode line will show that the process - ;; is dead, we can delete it now. Otherwise it - ;; will stay around until M-x list-processes. - (delete-process process) - - ;; Force mode line redisplay soon - (set-buffer-modified-p (buffer-modified-p)))))) - (setq compilation-in-progress (delq process compilation-in-progress))) - - -(defvar TeX-sentinel-function (lambda (process name)) - "Hook to cleanup TeX command buffer after temination of PROCESS. -NAME is the name of the process.") - - (make-variable-buffer-local 'TeX-sentinel-function) - - -(defvar TeX-sentinel-default-function (lambda (process name)) - "Default for `TeX-sentinel-function'. To be set in major mode. -Hook to cleanup TeX command buffer after temination of PROCESS. -NAME is the name of the process.") - - (make-variable-buffer-local 'TeX-sentinel-default-function) - -(defun TeX-TeX-sentinel (process name) - "Cleanup TeX output buffer after running TeX." - (if (TeX-TeX-sentinel-check process name) - () - (message (concat name ": formatted " (TeX-current-pages))) - (setq TeX-command-next TeX-command-Show))) - -(defun TeX-current-pages () - "Return string indicating the number of pages formatted." - (cond ((null TeX-current-page) - "some pages") - ((string-match "[^0-9]1[^0-9]" TeX-current-page) - (concat TeX-current-page " page")) - (t - (concat TeX-current-page " pages")))) - -(defun TeX-TeX-sentinel-check (process name) - "Cleanup TeX output buffer after running TeX. -Return nil ifs no errors were found." - (save-excursion - (goto-char (point-max)) - (if (re-search-backward "^Output written on \\(.*?\\) (\\([0-9]+\\) page" - nil t) - (let ((output-file (TeX-match-buffer 1))) - (setq TeX-current-page (concat "{" (TeX-match-buffer 2) "}")) - ;; Shave off quotation marks if present. - (when (string-match "\\`\"\\(.*\\)\"\\'" output-file) - (setq output-file (match-string 1 output-file))) - (setq TeX-output-extension - (if (string-match "\\.\\([^.]*\\)$" output-file) - (match-string 1 output-file) - "dvi"))))) - (if process (TeX-format-mode-line process)) - (if (re-search-forward "^\\(!\\|.*:[0-9]+:\\) " nil t) - (progn - (message "%s errors in `%s'. Use %s to display." name (buffer-name) - (substitute-command-keys - "\\\\[TeX-next-error]")) - (setq TeX-command-next TeX-command-default) - ;; error reported to TeX-error-report-switches - (setq TeX-error-report-switches - (plist-put TeX-error-report-switches - (intern (plist-get TeX-error-report-switches - 'TeX-current-master)) - t)) - t) - (setq TeX-command-next TeX-command-Show) - nil)) - -(defun TeX-LaTeX-sentinel-has-warnings () - "Return non-nil, if the output buffer contains warnings. -Warnings can be indicated by LaTeX or packages." - (save-excursion - (goto-char (point-min)) - (re-search-forward - "^\\(LaTeX [A-Za-z]*\\|Package [A-Za-z]+ \\)Warning:" nil t))) - -(defun TeX-LaTeX-sentinel-has-bad-boxes () - "Return non-nil, if LaTeX output indicates overfull or underfull boxes." - (save-excursion - (goto-char (point-min)) - (re-search-forward "^\\(Ov\\|Und\\)erfull \\\\" nil t))) - -;; should go into latex.el? --pg -(defun TeX-LaTeX-sentinel (process name) - "Cleanup TeX output buffer after running LaTeX." - (cond ((TeX-TeX-sentinel-check process name)) - ((and (save-excursion - (re-search-forward - "^\\(?:LaTeX\\|Package natbib\\) Warning: Citation" nil t)) - (with-current-buffer TeX-command-buffer - (and (LaTeX-bibliography-list) - (TeX-check-files (TeX-master-file "bbl") - (TeX-style-list) - (append TeX-file-extensions - BibTeX-file-extensions))))) - (message "%s%s" "You should run BibTeX to get citations right, " - (TeX-current-pages)) - (setq TeX-command-next (with-current-buffer TeX-command-buffer - TeX-command-BibTeX))) - ((re-search-forward "^\\(?:LaTeX Warning: Label(s)\\|\ -Package natbib Warning: Citation(s)\\)" nil t) - (message "%s%s" "You should run LaTeX again to get references right, " - (TeX-current-pages)) - (setq TeX-command-next TeX-command-default)) - ((re-search-forward "^LaTeX Warning: Reference" nil t) - (message "%s%s%s" name ": there were unresolved references, " - (TeX-current-pages)) - (setq TeX-command-next TeX-command-Show)) - ((re-search-forward "^\\(?:LaTeX Warning: Citation\\|\ -Package natbib Warning:.*undefined citations\\)" nil t) - (message "%s%s%s" name ": there were unresolved citations, " - (TeX-current-pages)) - (setq TeX-command-next TeX-command-Show)) - ((re-search-forward "Package longtable Warning: Table widths have \ -changed\\. Rerun LaTeX\\." nil t) - (message - "%s" "You should run LaTeX again to get table formatting right") - (setq TeX-command-next TeX-command-default)) - ((re-search-forward - "^\\(\\*\\* \\)?J?I?p?\\(La\\|Sli\\)TeX\\(2e\\)? \ -\\(Version\\|ver\\.\\|<[0-9/]*>\\)" nil t) - (let* ((warnings (and TeX-debug-warnings - (TeX-LaTeX-sentinel-has-warnings))) - (bad-boxes (and TeX-debug-bad-boxes - (TeX-LaTeX-sentinel-has-bad-boxes))) - (add-info (when (or warnings bad-boxes) - (concat " (with " - (when warnings "warnings") - (when (and warnings bad-boxes) " and ") - (when bad-boxes "bad boxes") - ")")))) - (message "%s" (concat name ": successfully formatted " - (TeX-current-pages) add-info))) - (setq TeX-command-next TeX-command-Show)) - (t - (message "%s%s%s" name ": problems after " (TeX-current-pages)) - (setq TeX-command-next TeX-command-default)))) - -;; should go into latex.el? --pg -(defun TeX-BibTeX-sentinel (process name) - "Cleanup TeX output buffer after running BibTeX." - (goto-char (point-max)) - (cond - ;; Check whether BibTeX reports any warnings or errors. - ((re-search-backward (concat - "^(There \\(?:was\\|were\\) \\([0-9]+\\) " - "\\(warnings?\\|error messages?\\))") nil t) - ;; Tell the user their number so that she sees whether the - ;; situation is getting better or worse. - (message (concat "BibTeX finished with %s %s. " - "Type `%s' to display output.") - (match-string 1) (match-string 2) - (substitute-command-keys - "\\\\[TeX-recenter-output-buffer]"))) - (t - (message (concat "BibTeX finished successfully. " - "Run LaTeX again to get citations right.")))) - (setq TeX-command-next TeX-command-default)) - -;;; Process Control - - -;; This variable is chared with `compile.el'. -(defvar compilation-in-progress nil - "List of compilation processes now running.") - -(or (assq 'compilation-in-progress minor-mode-alist) - (setq minor-mode-alist (cons '(compilation-in-progress " Compiling") - minor-mode-alist))) - -(defun TeX-process-get-variable (name symbol &optional default) - "Return the value in the process buffer for NAME of SYMBOL. - -Return DEFAULT if the process buffer does not exist or SYMBOL is not -defined." - (let ((buffer (TeX-process-buffer name))) - (if (and buffer - (local-variable-p symbol buffer)) - (save-excursion - (set-buffer buffer) - (symbol-value symbol)) - default))) - -(defun TeX-process-set-variable (name symbol value) - "Set the variable SYMBOL in the process buffer to VALUE. -Return nil iff no process buffer exist." - (let ((buffer (TeX-process-buffer name))) - (if buffer - (save-excursion - (set-buffer buffer) - (set symbol value) - t) - nil))) - -(defun TeX-process-check (name) - "Check if a process for the TeX document NAME already exist. -If so, give the user the choice of aborting the process or the current -command." - (let (process) - (while (and (setq process (TeX-process name)) - (eq (process-status process) 'run)) - (cond - ((yes-or-no-p (concat "Process `" - (process-name process) - "' for document `" - name - "' running, kill it? ")) - (delete-process process)) - ((eq (process-status process) 'run) - (error "Cannot have two processes for the same document")))))) - -(defun TeX-process-buffer-name (name) - "Return name of AUCTeX buffer associated with the document NAME." - (concat "*" (abbreviate-file-name (expand-file-name name)) " output*")) - -(defun TeX-process-buffer (name) - "Return the AUCTeX buffer associated with the document NAME." - (get-buffer (TeX-process-buffer-name name))) - -(defun TeX-process (name) - "Return AUCTeX process associated with the document NAME." - (and TeX-process-asynchronous - (get-buffer-process (TeX-process-buffer name)))) - -;;; Process Filters - -(defun TeX-command-mode-line (process) - "Format the mode line for a buffer containing output from PROCESS." - (setq mode-line-process (concat ": " - (symbol-name (process-status process)))) - (set-buffer-modified-p (buffer-modified-p))) - -(defun TeX-command-filter (process string) - "Filter to process normal output." - (with-current-buffer (process-buffer process) - (save-excursion - (goto-char (process-mark process)) - (insert-before-markers string) - (set-marker (process-mark process) (point))))) - -(defvar TeX-current-page nil - "The page number currently being formatted, enclosed in brackets.") - - (make-variable-buffer-local 'TeX-current-page) - -(defun TeX-format-mode-line (process) - "Format the mode line for a buffer containing TeX output from PROCESS." - (setq mode-line-process (concat " " TeX-current-page ": " - (symbol-name (process-status process)))) - (set-buffer-modified-p (buffer-modified-p))) - -(defun TeX-format-filter (process string) - "Filter to process TeX output." - (with-current-buffer (process-buffer process) - (let (str pos end (pt (marker-position (process-mark process)))) - (save-excursion - (goto-char pt) - (insert-before-markers string) - (set-marker (process-mark process) (point)) - ;; Remove line breaks at column 79 - (while (> (point) pt) - (end-of-line 0) - (when (and (= (current-column) 79) - ;; Heuristic: Don't delete the linebreak if the - ;; next line is empty or starts with an opening - ;; parenthesis or if point is located after a period. - (not (memq (char-after (1+ (point))) '(?\n ?\())) - (not (eq (char-before) ?.))) - (delete-char 1))) - (goto-char (marker-position (process-mark process))) - ;; Determine current page - (while (and pt - (skip-chars-backward "^]" pt) - (> (point) pt)) - (setq end (point)) - (backward-char) - (skip-chars-backward "-0-9\n." (max (point-min) (- pt 128))) - (when (and (eq ?\[ (char-before)) - (not (eq ?\] (char-after))) - (progn - (setq str (buffer-substring (1- (point)) end) - pos nil) - (while (setq pos (string-match "\n" str pos)) - (setq str (replace-match "" t t str))) - (string-match - "\\`\\[-?[0-9]+\\(\\.-?[0-9]+\\)\\{0,9\\}\\]\\'" - str))) - (setq TeX-current-page str - pt nil) - (TeX-format-mode-line process))))))) - -(defvar TeX-parse-function nil - "Function to call to parse content of TeX output buffer.") - (make-variable-buffer-local 'TeX-parse-function) - -(defun TeX-background-filter (process string) - "Filter to process background output." - (let ((old-window (selected-window)) - (pop-up-windows t)) - (TeX-pop-to-buffer "*TeX background*" nil t) - (goto-char (point-max)) - (insert string) - (select-window old-window))) - -;; Copy and adaption of `comint-postoutput-scroll-to-bottom' from CVS -;; Emacs of 2005-04-24. -(defun TeX-interactive-goto-prompt (string) - "Move point to prompt of an interactive TeX run." - (let* ((selected (selected-window)) - (current (current-buffer)) - (process (get-buffer-process current))) - (unwind-protect - (when process - (walk-windows - (lambda (window) - (when (eq (window-buffer window) current) - (select-window window) - (when (and (< (point) (process-mark process)) - (string-match "^\\? $" string)) - (goto-char (process-mark process))) - (select-window selected))) - nil t)) - (set-buffer current)))) - - -;;; Active Process - -(defvar TeX-current-process-region-p nil - "This variable is set to t iff the last TeX command is on a region.") - -(defun TeX-active-process () - "Return the active process for the current buffer." - (TeX-process (TeX-active-master))) - -(defun TeX-active-buffer () - "Return the buffer of the active process for this buffer." - (and TeX-command-buffer - (TeX-process-buffer (with-current-buffer TeX-command-buffer - (TeX-active-master))))) - -(defun TeX-active-master (&optional extension nondirectory) - "The master file currently being compiled. - -If optional argument EXTENSION is non-nil, add that file extension to -the name. Special value t means use `TeX-default-extension'. - -If optional second argument NONDIRECTORY is non-nil, do not include -the directory." - (if TeX-current-process-region-p - (TeX-region-file extension nondirectory) - (TeX-master-file extension nondirectory))) - -(defvar TeX-command-buffer nil - "The buffer from where the last TeX command was issued.") - -;;; Region File - -(defcustom TeX-region-extra "" - "*String to insert in the region file between the header and the text." - :group 'TeX-command - :type 'string) - -;; This was "{\\makeatletter\\gdef\\AucTeX@cite#1[#2]#3{[#3#1#2]}\ -;; \\gdef\\cite{\\@ifnextchar[{\\AucTeX@cite{, }}\ -;; {\\AucTeX@cite{}[]}}}\n" -;; However, that string is inappropriate for plain TeX and ConTeXt. -;; This needs reconsideration. - - -(defvar TeX-region-hook nil - "List of hooks to run before the region file is saved. -The hooks are run in the region buffer, you may use the variable -`master-buffer' to access the buffer of the master file and -`orig-buffer' to access the buffer where \\[TeX-command-region] or -\\[TeX-command-buffer] is invoked from.") - -(defun TeX-quote-filename (file) - "Convert file name into a form acceptable to TeX." - (let (pos) - (while (setq pos (string-match "\\\\" file pos)) - (setq file (replace-match "/" t t file 0) - pos (1+ pos))) - (while (setq pos (string-match "[~#]" file pos)) - (setq file (replace-match "\\\\string\\&" t nil file 0) - pos (+ pos 8)))) - file) - -(defun TeX-region-create (file region original offset) - "Create a new file named FILE with the string REGION. -The region is taken from ORIGINAL starting at line OFFSET. - -The current buffer and master file is searched, in order to ensure -that the TeX header and trailer information is also included. - -The OFFSET is used to provide the debugger with information about the -original file." - (let* (;; We shift buffer a lot, so we must keep track of the buffer - ;; local variables. - (header-end TeX-header-end) - (trailer-start TeX-trailer-start) - - ;; We seach for header and trailer in the master file. - (orig-buffer (current-buffer)) - (master-name (TeX-master-file TeX-default-extension)) - (master-buffer (find-file-noselect master-name)) - - ;; Attempt to disable font lock. - (font-lock-defaults-alist nil) - (font-lock-defaults nil) - (font-lock-maximum-size 0) - (font-lock-mode-hook nil) - (font-lock-auto-fontify nil) - (font-lock-mode-enable-list nil) - ;; And insert them into the FILE buffer. - (file-buffer (let ((TeX-transient-master t)) - (find-file-noselect file))) - ;; But remember original content. - original-content - - ;; We search for the header from the master file, if it is - ;; not present in the region. - (header (if (string-match header-end region) - "" - (save-excursion - (save-restriction - (set-buffer master-buffer) - (save-excursion - (save-restriction - (widen) - (goto-char (point-min)) - ;; NOTE: We use the local value of - ;; TeX-header-end from the master file. - (if (not (re-search-forward TeX-header-end nil t)) - "" - (re-search-forward "[\r\n]" nil t) - (buffer-substring (point-min) (point))))))))) - - ;; We search for the trailer from the master file, if it is - ;; not present in the region. - (trailer-offset 0) - (trailer (if (string-match trailer-start region) - "" - (save-excursion - (save-restriction - (set-buffer master-buffer) - (save-excursion - (save-restriction - (widen) - (goto-char (point-max)) - ;; NOTE: We use the local value of - ;; TeX-trailer-start from the master file. - (if (not (re-search-backward TeX-trailer-start nil t)) - "" - ;;(beginning-of-line 1) - (re-search-backward "[\r\n]" nil t) - (setq trailer-offset (TeX-current-offset)) - (buffer-substring (point) (point-max)))))))))) - ;; file name should be relative to master - (setq original (TeX-quote-filename (file-relative-name - original (TeX-master-directory))) - master-name (TeX-quote-filename master-name)) - (save-excursion - (set-buffer file-buffer) - (setq buffer-undo-list t) - (setq original-content (buffer-string)) - (erase-buffer) - (when (boundp 'buffer-file-coding-system) - (setq buffer-file-coding-system - (with-current-buffer master-buffer buffer-file-coding-system))) - (insert "\\message{ !name(" master-name ")}" - header - TeX-region-extra - "\n\\message{ !name(" original ") !offset(") - (insert (int-to-string (- offset - (1+ (TeX-current-offset)))) - ") }\n" - region - "\n\\message{ !name(" master-name ") !offset(") - (insert (int-to-string (- trailer-offset - (1+ (TeX-current-offset)))) - ") }\n" - trailer) - (run-hooks 'TeX-region-hook) - (if (string-equal (buffer-string) original-content) - (set-buffer-modified-p nil) - (save-buffer 0))))) - -(defun TeX-region-file (&optional extension nondirectory) - "Return TeX-region file name with EXTENSION. -If optional second argument NONDIRECTORY is non-nil, do not include -the directory." - (concat (if nondirectory "" (TeX-master-directory)) - (cond ((eq extension t) - (concat TeX-region "." TeX-default-extension)) - (extension - (concat TeX-region "." extension)) - (t - TeX-region)))) - -(defcustom TeX-region "_region_" - "*Base name of temporary file for `TeX-command-region' and `TeX-command-buffer'." - :group 'TeX-command - :type 'string) - -;;; Parsing - -;;; - Global Parser Variables - -(defvar TeX-error-point nil - "How far we have parsed until now.") - - (make-variable-buffer-local 'TeX-error-point) - -(defvar TeX-error-file nil - "Stack of files in which errors have occured.") - - (make-variable-buffer-local 'TeX-error-file) - -(defvar TeX-error-offset nil - "Add this to any line numbers from TeX. Stack like `TeX-error-file'.") - - (make-variable-buffer-local 'TeX-error-offset) - -(defun TeX-parse-reset () - "Reset all variables used for parsing TeX output." - (setq TeX-error-point (point-min)) - (setq TeX-error-offset nil) - (setq TeX-error-file nil)) - -;;; - Parsers Hooks - -(defun TeX-parse-command (reparse) - "We can't parse anything but TeX." - (error "I cannot parse %s output, sorry" - (if (TeX-active-process) - (process-name (TeX-active-process)) - "this"))) - -(defun TeX-parse-TeX (reparse) - "Find the next error produced by running TeX. -With \\[universal-argument] prefix, start from the beginning of the errors. - -If the file occurs in an included file, the file is loaded (if not -already in an Emacs buffer) and the cursor is placed at the error." - (let ((old-buffer (current-buffer)) - (default-major-mode major-mode)) - (with-current-buffer (TeX-active-buffer) - (if reparse - (TeX-parse-reset)) - (goto-char TeX-error-point) - (TeX-parse-error old-buffer)))) - -;;; - Parsing (La)TeX - -(defvar TeX-translate-location-hook nil - "List of functions to be called before showing an error or warning. - -You might want to examine and modify the free variables `file', -`offset', `line', `string', `error', and `context' from this hook.") - -(defun TeX-parse-error (old) - "Goto next error. Pop to OLD buffer if no more errors are found." - (let ((regexp - (concat - ;; TeX error - "^\\(!\\|\\(.*?\\):[0-9]+:\\) \\|" - ;; New file - "(\\(\"[^\"]*?\"\\|/*\ -\\(?:\\.+[^()\r\n{} \\/]*\\|[^()\r\n{} .\\/]+\ -\\(?: [^()\r\n{} .\\/]+\\)*\\(?:\\.[-0-9a-zA-Z_.]*\\)?\\)\ -\\(?:[\\/]+\\(?:\\.+[^()\r\n{} \\/]*\\|[^()\r\n{} .\\/]+\ -\\(?: [^()\r\n{} .\\/]+\\)*\\(?:\\.[-0-9a-zA-Z_.]*\\)?\\)?\\)*\\)\ -)*\\(?: \\|\r?$\\)\\|" - ;; End of file - "\\()\\))*\\|" - ;; Hook to change line numbers - " !\\(?:offset(\\([---0-9]+\\))\\|" - ;; Hook to change file name - "name(\\([^)]+\\))\\)\\|" - ;; LaTeX bad box - "^\\(\\(?:Overfull\\|Underfull\\|Tight\\|Loose\\)\ - \\\\.*?[0-9]+--[0-9]+\\)\\|" - ;; LaTeX warning - "^\\(LaTeX [A-Za-z]*\\|Package [A-Za-z]+ \\)Warning:.*"))) - (while - (cond - ((null - (re-search-forward regexp nil t)) - ;; No more errors. - (message "No more errors.") - (beep) - (TeX-pop-to-buffer old) - nil) - ;; TeX error - ((match-beginning 1) - (when (match-beginning 2) - (unless TeX-error-file - (push nil TeX-error-file) - (push nil TeX-error-offset)) - (unless (car TeX-error-offset) - (rplaca TeX-error-file (TeX-match-buffer 2)))) - (if (looking-at "Preview ") - t - (TeX-error) - nil)) - ;; LaTeX bad box - ((match-beginning 7) - (if TeX-debug-bad-boxes - (progn - (TeX-warning (TeX-match-buffer 7)) - nil) - (re-search-forward "\r?\n\ -\\(?:.\\{79\\}\r?\n\ -\\)*.*\r?$") - t)) - ;; LaTeX warning - ((match-beginning 8) - (if TeX-debug-warnings - (progn - (TeX-warning (TeX-match-buffer 8)) - nil) - t)) - - ;; New file -- Push on stack - ((match-beginning 3) - (let ((file (TeX-match-buffer 3)) - (end (match-end 3))) - ;; Strip quotation marks and remove newlines if necessary - (when (or (eq (string-to-char file) ?\") - (string-match "\n" file)) - (setq file - (mapconcat 'identity (split-string file "[\"\n]+") ""))) - (push file TeX-error-file) - (push nil TeX-error-offset) - (goto-char end)) - t) - - ;; End of file -- Pop from stack - ((match-beginning 4) - (when (> (length TeX-error-file) 1) - (pop TeX-error-file) - (pop TeX-error-offset)) - (goto-char (match-end 4)) - t) - - ;; Hook to change line numbers - ((match-beginning 5) - (setq TeX-error-offset - (list (string-to-number (TeX-match-buffer 5)))) - t) - - ;; Hook to change file name - ((match-beginning 6) - (setq TeX-error-file - (list (TeX-match-buffer 6))) - t))))) - -(defun TeX-error () - "Display an error." - - (let* (;; We need the error message to show the user. - (error (progn - (re-search-forward "\\(.*\\)") - (TeX-match-buffer 1))) - - ;; And the context for the help window. - (context-start (point)) - context-available - - ;; And the line number to position the cursor. - (line (cond - ;; regular style - ((re-search-forward "l\\.\\([0-9]+\\)" nil t) - (setq context-available t) - (string-to-number (TeX-match-buffer 1))) - ;; file:line:error style - ((save-excursion - (re-search-backward ":\\([0-9]+\\): " - (line-beginning-position) t)) - (string-to-number (TeX-match-buffer 1))) - ;; nothing found - (t 1))) - - ;; And a string of the context to search for. - (string (progn - (beginning-of-line) - (re-search-forward " \\(\\([^ \t]*$\\)\\|\\($\\)\\)") - (TeX-match-buffer 1))) - - ;; And we have now found to the end of the context. - (context (if context-available - (buffer-substring context-start (progn (forward-line 1) - (end-of-line) - (point))) - ;; There is no real context available, so we - ;; simply show the line with the error message. - (buffer-substring (1- (line-beginning-position)) - context-start))) - ;; We may use these in another buffer. - (offset (or (car TeX-error-offset) 0)) - (file (car TeX-error-file))) - - ;; Remember where we was. - (setq TeX-error-point (point)) - - ;; Find the error. - (if (null file) - (error "Error occured after last TeX file closed")) - (let ((runbuf (current-buffer)) - (master (with-current-buffer - TeX-command-buffer - (expand-file-name (TeX-master-file)))) - (command-buffer TeX-command-buffer) - error-file-buffer) - (run-hooks 'TeX-translate-location-hook) - (setq error-file-buffer (find-file file)) - ;; Set the value of `TeX-command-buffer' in the next file with an - ;; error to be displayed to the value it has in the current buffer. - (with-current-buffer error-file-buffer - (set (make-local-variable 'TeX-command-buffer) command-buffer)) - (goto-line (+ offset line)) - (if (not (string= string " ")) - (search-forward string nil t)) - - ;; Explain the error. - (cond ((eq TeX-display-help 'expert) - (TeX-pop-to-buffer runbuf nil t) - (goto-char TeX-error-point) - (TeX-pop-to-buffer error-file-buffer nil t)) - (TeX-display-help - (TeX-help-error error context runbuf)) - (t - (message (concat "! " error))))))) - -(defun TeX-warning (string) - "Display a warning for STRING." - - (let* ((error (concat "** " string)) - - ;; bad-box is nil if this is a "LaTeX Warning" - (bad-box (string-match "\\\\[vh]box.*[0-9]*--[0-9]*" string)) - ;; line-string: match 1 is beginning line, match 2 is end line - (line-string (if bad-box " \\([0-9]*\\)--\\([0-9]*\\)" - "on input line \\([0-9]*\\)\\.")) - ;; word-string: match 1 is the word - (word-string (if bad-box "[][\\W() ---]\\(\\w+\\)[][\\W() ---]*$" - "`\\(\\w+\\)'")) - - ;; Get error-line (warning) - (line (when (re-search-backward line-string nil t) - (string-to-number (TeX-match-buffer 1)))) - (line-end (if bad-box (string-to-number (TeX-match-buffer 2)) - line)) - - ;; Find the context - (context-start (progn (if bad-box (end-of-line) - (beginning-of-line)) - (point))) - - (context (progn - (forward-line 1) - (end-of-line) - (while (equal (current-column) 79) - (forward-line 1) - (end-of-line)) - (buffer-substring context-start (point)))) - - ;; This is where we want to be. - (error-point (point)) - - ;; Now find the error word. - (string (when (re-search-backward word-string context-start t) - (TeX-match-buffer 1))) - - ;; We might use these in another file. - (offset (or (car TeX-error-offset) 0)) - (file (car TeX-error-file))) - - ;; This is where we start next time. - (goto-char error-point) - (setq TeX-error-point (point)) - - ;; Go back to TeX-buffer - (let ((runbuf (current-buffer)) - (master (with-current-buffer - TeX-command-buffer - (expand-file-name (TeX-master-file)))) - (command-buffer TeX-command-buffer) - error-file-buffer) - (run-hooks 'TeX-translate-location-hook) - (setq error-file-buffer (find-file file)) - ;; Set the value of `TeX-command-buffer' in the next file with an - ;; error to be displayed to the value it has in the current buffer. - (with-current-buffer error-file-buffer - (set (make-local-variable 'TeX-command-buffer) command-buffer)) - ;; Find line and string - (when line - (goto-line (+ offset line)) - (beginning-of-line 0) - (let ((start (point))) - (goto-line (+ offset line-end)) - (end-of-line) - (when string - (search-backward string start t) - (search-forward string nil t)))) - ;; Display help - (cond ((eq TeX-display-help 'expert) - (TeX-pop-to-buffer runbuf nil t) - (goto-char TeX-error-point) - (TeX-pop-to-buffer error-file-buffer nil t)) - (TeX-display-help - (TeX-help-error error (if bad-box context (concat "\n" context)) - runbuf)) - (t - (message (concat "! " error))))))) - -;;; - Help - -(defun TeX-help-error (error output runbuffer) - "Print ERROR in context OUTPUT from RUNBUFFER in another window." - - (let ((old-buffer (current-buffer)) - (log-file (with-current-buffer runbuffer - (with-current-buffer TeX-command-buffer - (expand-file-name (TeX-active-master "log"))))) - (TeX-error-pointer 0)) - - ;; Find help text entry. - (while (not (string-match (car (nth TeX-error-pointer - TeX-error-description-list)) - error)) - (setq TeX-error-pointer (+ TeX-error-pointer 1))) - - (TeX-pop-to-buffer (get-buffer-create "*TeX Help*") nil t) - (erase-buffer) - (insert "ERROR: " error - "\n\n--- TeX said ---" - output - "\n--- HELP ---\n" - (let ((help (cdr (nth TeX-error-pointer - TeX-error-description-list)))) - (save-excursion - (if (and (string= help "No help available") - (let* ((log-buffer (find-buffer-visiting log-file))) - (if log-buffer - (progn - (set-buffer log-buffer) - (revert-buffer t t)) - (setq log-buffer - (find-file-noselect log-file)) - (set-buffer log-buffer)) - (auto-save-mode nil) - (setq buffer-read-only t) - (goto-line (point-min)) - (search-forward error nil t 1)) - (re-search-forward "^l\\." nil t) - (re-search-forward "^ [^\n]+$" nil t)) - (let ((start (1+ (point)))) - (forward-char 1) - (re-search-forward "^$") - (concat "From the .log file...\n\n" - (buffer-substring start (point)))) - help)))) - (goto-char (point-min)) - (TeX-pop-to-buffer old-buffer nil t))) - -;;; Error Messages - -(defcustom TeX-error-description-list - '(("\\(?:Package Preview Error\\|Preview\\):.*" . -"The `auctex' option to `preview' should not be applied manually. -If you see this error message outside of a preview run, either -you did something too clever, or AUCTeX something too stupid.") - - ("Bad \\\\line or \\\\vector argument.*" . -"The first argument of a \\line or \\vector command, which specifies the -slope, is illegal\.") - - ("Bad math environment delimiter.*" . -"TeX has found either a math-mode-starting command such as \\[ or \\( -when it is already in math mode, or else a math-mode-ending command -such as \\) or \\] while in LR or paragraph mode. The problem is caused -by either unmatched math mode delimiters or unbalanced braces\.") - - ("Bad use of \\\\\\\\.*" . -"A \\\\ command appears between paragraphs, where it makes no sense. This -error message occurs when the \\\\ is used in a centering or flushing -environment or else in the scope of a centering or flushing -declaration.") - - ("\\\\begin{[^ ]*} ended by \\\\end{[^ ]*}." . -"LaTeX has found an \\end command that doesn't match the corresponding -\\begin command. You probably misspelled the environment name in the -\\end command, have an extra \\begin, or else forgot an \\end.") - - ("Can be used only in preamble." . -"LaTeX has encountered, after the \\begin{document}, one of the -following commands that should appear only in the preamble: -\\documentclass, \\nofiles, \\includeonly, \\makeindex, or -\\makeglossary. The error is also caused by an extra \\begin{document} -command.") - - ("Command name [^ ]* already used.*" . -"You are using \\newcommand, \\newenvironment, \\newlength, \\newsavebox, -or \\newtheorem to define a command or environment name that is -already defined, or \\newcounter to define a counter that already -exists. (Defining an environment named gnu automatically defines the -command \\gnu.) You'll have to choose a new name or, in the case of -\\newcommand or \\newenvironment, switch to the \\renew ... command.") - - ("Counter too large." . -"1. Some object that is numbered with letters, probably an item in a -enumerated list, has received a number greater than 26. Either you're -making a very long list or you've been resetting counter values. - -2. Footnotes are being ``numbered'' with letters or footnote symbols -and LaTeX has run out of letters or symbols. This is probably caused -by too many \\thanks commands.") - - ("Environment [^ ]* undefined." . -"LaTeX has encountered a \\begin command for a nonexistent environment. -You probably misspelled the environment name. ") - - ("Float(s) lost." . -"You put a figure or table environment or a \\marginpar command inside a -parbox---either one made with a minipage environment or \\parbox -command, or one constructed by LaTeX in making a footnote, figure, -etc. This is an outputting error, and the offending environment or -command may be quite a way back from the point where LaTeX discovered -the problem. One or more figures, tables, and/or marginal notes have -been lost, but not necessarily the one that caused the error.") - - ("Illegal character in array arg." . -"There is an illegal character in the argument of an array or tabular -environment, or in the second argument of a \\multicolumn command.") - - ("Missing \\\\begin{document}." . -"LaTeX produced printed output before encountering a \\begin{document} -command. Either you forgot the \\begin{document} command or there is -something wrong in the preamble. The problem may be a stray character -or an error in a declaration---for example, omitting the braces around -an argument or forgetting the \\ in a command name.") - - ("Missing p-arg in array arg.*" . -"There is a p that is not followed by an expression in braces in the -argument of an array or tabular environment, or in the second argument -of a \\multicolumn command.") - - ("Missing @-exp in array arg." . -"There is an @ character not followed by an @-expression in the -argument of an array or tabular environment, or in the second argument -of a \\multicolumn command.") - - ("No such counter." . -"You have specified a nonexistent counter in a \\setcounter or -\\addtocounter command. This is probably caused by a simple typing -error. However, if the error occurred while a file with the extension -aux is being read, then you probably used a \\newcounter command -outside the preamble.") - - ("Not in outer par mode." . -"You had a figure or table environment or a \\marginpar command in math -mode or inside a parbox.") - - ("\\\\pushtabs and \\\\poptabs don't match." . -"LaTeX found a \\poptabs with no matching \\pushtabs, or has come to the -\\end{tabbing} command with one or more unmatched \\pushtabs commands.") - - ("Something's wrong--perhaps a missing \\\\item." . -"The most probable cause is an omitted \\item command in a list-making -environment. It is also caused by forgetting the argument of a -thebibliography environment.") - - ("Tab overflow." . -"A \\= command has exceeded the maximum number of tab stops that LaTeX -permits.") - - ("There's no line here to end." . -"A \\newline or \\\\ command appears between paragraphs, where it makes no -sense. If you're trying to ``leave a blank line'', use a \\vspace -command.") - - ("This may be a LaTeX bug." . -"LaTeX has become thoroughly confused. This is probably due to a -previously detected error, but it is possible that you have found an -error in LaTeX itself. If this is the first error message produced by -the input file and you can't find anything wrong, save the file and -contact the person listed in your Local Guide.") - - ("Too deeply nested." . -"There are too many list-making environments nested within one another. -How many levels of nesting are permitted may depend upon what computer -you are using, but at least four levels are provided, which should be -enough.") - - ("Too many unprocessed floats." . -"While this error can result from having too many \\marginpar commands -on a page, a more likely cause is forcing LaTeX to save more figures -and tables than it has room for. When typesetting its continuous -scroll, LaTeX saves figures and tables separately and inserts them as -it cuts off pages. This error occurs when LaTeX finds too many figure -and/or table environments before it is time to cut off a page, a -problem that is solved by moving some of the environments farther -towards the end of the input file. The error can also be caused by a -``logjam''---a figure or table that cannot be printed causing others -to pile up behind it, since LaTeX will not print figures or tables out -of order. The jam can be started by a figure or table that either is -too large to fit on a page or won't fit where its optional placement -argument says it must go. This is likely to happen if the argument -does not contain a p option.") - - ("Undefined tab position." . -"A \\>, \\+, \\-, or \\< command is trying to go to a nonexistent tab -position---one not defined by a \\= command.") - - ("\\\\< in mid line." . -"A \\< command appears in the middle of a line in a tabbing environment. -This command should come only at the beginning of a line.") - - ("Double subscript." . -"There are two subscripts in a row in a mathematical -formula---something like x_{2}_{3}, which makes no sense.") - - ("Double superscript." . -"There are two superscripts in a row in a mathematical -formula---something like x^{2}^{3}, which makes no sense.") - - ("Extra alignment tab has been changed to \\\\cr." . -"There are too many separate items (column entries) in a single row of -an array or tabular environment. In other words, there were too many & -'s before the end of the row. You probably forgot the \\\\ at the end of -the preceding row.") - - ("Extra \\}, or forgotten \\$." . -"The braces or math mode delimiters don't match properly. You probably -forgot a {, \\[, \\(, or $.") - - ("Font [^ ]* not loaded: Not enough room left." . -"The document uses more fonts than TeX has room for. If different parts -of the document use different fonts, then you can get around the -problem by processing it in parts.") - - ("I can't find file `.*'." . -"TeX can't find a file that it needs. If the name of the missing file -has the extension tex, then it is looking for an input file that you -specified---either your main file or another file inserted with an -\\input or \\include command. If the missing file has the extension sty -, then you have specified a nonexistent document style or style -option.") - - ("Illegal parameter number in definition of .*" . -"This is probably caused by a \\newcommand, \\renewcommand, -\\newenvironment, or \\renewenvironment command in which a # is used -incorrectly. A # character, except as part of the command name \\#, -can be used only to indicate an argument parameter, as in #2, which -denotes the second argument. This error is also caused by nesting one -of the above four commands inside another, or by putting a parameter -like #2 in the last argument of a \\newenvironment or \\renewenvironment -command.") - - ("Illegal unit of measure ([^ ]* inserted)." . -"If you just got a - - ! Missing number, treated as zero. - -error, then this is part of the same problem. If not, it means that -LaTeX was expecting a length as an argument and found a number -instead. The most common cause of this error is writing 0 instead of -something like 0in for a length of zero, in which case typing return -should result in correct output. However, the error can also be caused -by omitting a command argument.") - - ("Misplaced alignment tab character \\&." . -"The special character &, which should be used only to separate items -in an array or tabular environment, appeared in ordinary text. You -probably meant to type \\&.") - - ("Missing control sequence inserted." . -"This is probably caused by a \\newcommand, \\renewcommand, \\newlength, -or \\newsavebox command whose first argument is not a command name.") - - ("Missing number, treated as zero." . -"This is usually caused by a LaTeX command expecting but not finding -either a number or a length as an argument. You may have omitted an -argument, or a square bracket in the text may have been mistaken for -the beginning of an optional argument. This error is also caused by -putting \\protect in front of either a length command or a command such -as \\value that produces a number.") - - ("Missing [{}] inserted." . -"TeX has become confused. The position indicated by the error locator -is probably beyond the point where the incorrect input is.") - - ("Missing \\$ inserted." . -"TeX probably found a command that can be used only in math mode when -it wasn't in math mode. Remember that unless stated otherwise, all -all the commands of Section 3.3 in LaTeX Book (Lamport) can be used -only in math mode. TeX is not in math mode when it begins processing -the argument of a box-making command, even if that command is inside a -math environment. This error also occurs if TeX encounters a blank -line when it is in math mode.") - - ("Not a letter." . -"Something appears in the argument of a \\hyphenation command that -doesn't belong there.") - - ("Paragraph ended before [^ ]* was complete." . -"A blank line occurred in a command argument that shouldn't contain -one. You probably forgot the right brace at the end of an argument.") - - ("\\\\[^ ]*font [^ ]* is undefined .*" . -"These errors occur when an uncommon font is used in math mode---for -example, if you use a \\sc command in a formula inside a footnote, -calling for a footnote-sized small caps font. This problem is solved -by using a \\load command.") - - ("Font .* not found." . -"You requested a family/series/shape/size combination that is totally -unknown. There are two cases in which this error can occur: - 1) You used the \\size macro to select a size that is not available. - 2) If you did not do that, go to your local `wizard' and - complain fiercely that the font selection tables are corrupted!") - - ("TeX capacity exceeded, sorry .*" . -"TeX has just run out of space and aborted its execution. Before you -panic, remember that the least likely cause of this error is TeX not -having the capacity to process your document. It was probably an -error in your input file that caused TeX to run out of room. The -following discussion explains how to decide whether you've really -exceeded TeX's capacity and, if so, what to do. If the problem is an -error in the input, you may have to use the divide and conquer method -described previously to locate it. LaTeX seldom runs out of space on a -short input file, so if running it on the last few pages before the -error indicator's position still produces the error, then there's -almost certainly something wrong in the input file. - -The end of the error indicator tells what kind of space TeX ran out -of. The more common ones are listed below, with an explanation of -their probable causes. - -buffer size -=========== -Can be caused by too long a piece of text as the argument -of a sectioning, \\caption, \\addcontentsline, or \\addtocontents -command. This error will probably occur when the \\end{document} is -being processed, but it could happen when a \\tableofcontents, -\\listoffigures, or \\listoftables command is executed. To solve this -problem, use a shorter optional argument. Even if you're producing a -table of contents or a list of figures or tables, such a long entry -won't help the reader. - -exception dictionary -==================== -You have used \\hyphenation commands to give TeX -more hyphenation information than it has room for. Remove some of the -less frequently used words from the \\hyphenation commands and insert -\\- commands instead. - -hash size -========= -Your input file defines too many command names and/or uses -too many cross-ref- erencing labels. - -input stack size -================ -This is probably caused by an error in a command -definition. For example, the following command makes a circular -definition, defining \\gnu in terms of itself: - - \\newcommand{\\gnu}{a \\gnu} % This is wrong! - -When TeX encounters this \\gnu command, it will keep chasing its tail -trying to figure out what \\gnu should produce, and eventually run out -of ``input stack''. - -main memory size -================ -This is one kind of space that TeX can run out of when processing a -short file. There are three ways you can run TeX out of main memory -space: (1) defining a lot of very long, complicated commands, (2) -making an index or glossary and having too many \\index or \\glossary -commands on a single page, and (3) creating so complicated a page of -output that TeX can't hold all the information needed to generate it. -The solution to the first two problems is obvious: define fewer -commands or use fewer \\index and \\glossary commands. The third problem -is nastier. It can be caused by large tabbing, tabular, array, and -picture environments. TeX's space may also be filled up with figures -and tables waiting for a place to go. To find out if you've really -exceeded TeX's capacity in this way, put a \\clearpage command in your -input file right before the place where TeX ran out of room and try -running it again. If it doesn't run out of room with the \\clearpage -command there, then you did exceed TeX's capacity. If it still runs -out of room, then there's probably an error in your file. If TeX is -really out of room, you must give it some help. Remember that TeX -processes a complete paragraph before deciding whether to cut the -page. Inserting a \\newpage command in the middle of the paragraph, -where TeX should break the page, may save the day by letting TeX write -the current page before processing the rest of the paragraph. (A -\\pagebreak command won't help.) If the problem is caused by -accumulated figures and tables, you can try to prevent them from -accumulating---either by moving them further towards the end of the -document or by trying to get them to come out sooner. If you are -still writing the document, simply add a \\clearpage command and forget -about the problem until you're ready to produce the final version. -Changes to the input file are likely to make the problem go away. - -pool size -========= -You probably used too many cross-ref-erencing \\labels and/or defined -too many new command names. More precisely, the labels and command -names that you define have too many characters, so this problem can be -solved by using shorter names. However, the error can also be caused -by omitting the right brace that ends the argument of either a counter -command such as \\setcounter, or a \\newenvironment or \\newtheorem -command. - -save size -========= -This occurs when commands, environments, and the scopes of -declarations are nested too deeply---for example, by having the -argument of a \\multiput command contain a picture environment that in -turn has a \\footnotesize declaration whose scope contains a \\multiput -command containing a ....") - - ("Text line contains an invalid character." . -"The input contains some strange character that it shouldn't. A mistake -when creating the file probably caused your text editor to insert this -character. Exactly what could have happened depends upon what text -editor you used. If examining the input file doesn't reveal the -offending character, consult the Local Guide for suggestions.") - - ("Undefined control sequence." . -"TeX encountered an unknown command name. You probably misspelled the -name. If this message occurs when a LaTeX command is being processed, -the command is probably in the wrong place---for example, the error -can be produced by an \\item command that's not inside a list-making -environment. The error can also be caused by a missing \\documentclass -command.") - - ("Use of [^ ]* doesn't match its definition." . -"It's probably one of the picture-drawing commands, and you have used -the wrong syntax for specifying an argument. If it's \\@array that -doesn't match its definition, then there is something wrong in an -@-expression in the argument of an array or tabular -environment---perhaps a fragile command that is not \\protect'ed.") - - ("You can't use `macro parameter character \\#' in [^ ]* mode." . -"The special character # has appeared in ordinary text. You probably -meant to type \\#.") - - ("Overfull \\\\hbox .*" . -"Because it couldn't find a good place for a line break, TeX put more -on this line than it should.") - - ("Overfull \\\\vbox .*" . -"Because it couldn't find a good place for a page break, TeX put more -on the page than it should. ") - - ("Underfull \\\\hbox .*" . -"Check your output for extra vertical space. If you find some, it was -probably caused by a problem with a \\\\ or \\newline command---for -example, two \\\\ commands in succession. This warning can also be -caused by using the sloppypar environment or \\sloppy declaration, or -by inserting a \\linebreak command.") - - ("Underfull \\\\vbox .*" . -"TeX could not find a good place to break the page, so it produced a -page without enough text on it. ") - -;; New list items should be placed here -;; -;; ("err-regexp" . "context") -;; -;; the err-regexp item should match anything - - (".*" . "No help available")) ; end definition -"A list of the form (\"err-regexp\" . \"context\") used by function -`TeX-help-error' to display help-text on an error message or warning. -err-regexp should be a regular expression matching the error message -given from TeX/LaTeX, and context should be some lines describing that -error." - :group 'TeX-output - :type '(repeat (cons :tag "Entry" - (regexp :tag "Match") - (string :format "Description:\n%v")))) - -(provide 'tex-buf) - -;;; tex-buf.el ends here diff --git a/packages/auctex/tex-fold.el b/packages/auctex/tex-fold.el deleted file mode 100644 index 0b8de3a00..000000000 --- a/packages/auctex/tex-fold.el +++ /dev/null @@ -1,980 +0,0 @@ -;;; tex-fold.el --- Fold TeX macros. - -;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. - -;; Author: Ralf Angeli -;; Maintainer: auctex-devel@gnu.org -;; Created: 2004-07-04 -;; Keywords: tex, wp - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file provides support for hiding and unhiding TeX, LaTeX, -;; ContTeXt, Texinfo and similar macros and environments inside of -;; AUCTeX. -;; -;; Caveats: -;; -;; The display string of content which should display part of itself -;; is made by copying the text from the buffer together with its text -;; properties. If fontification has not happened when this is done -;; (e.g. because of lazy or just-in-time font locking) the intended -;; fontification will not show up. Maybe this could be improved by -;; using some sort of "lazy folding" or refreshing the window upon -;; scrolling. As a workaround fontification of the whole buffer -;; currently is forced before folding it. - -;;; Code: - -(when (featurep 'xemacs) - (require 'overlay)) -(require 'tex) -(autoload 'LaTeX-forward-paragraph "latex") -(autoload 'LaTeX-backward-paragraph "latex") -(autoload 'LaTeX-find-matching-begin "latex") -(autoload 'LaTeX-find-matching-end "latex") -(autoload 'ConTeXt-find-matching-start "context") -(autoload 'ConTeXt-find-matching-stop "context") -(autoload 'Texinfo-find-env-start "tex-info") -(autoload 'Texinfo-find-env-end "tex-info") - -(defgroup TeX-fold nil - "Fold TeX macros." - :group 'AUCTeX) - -(defcustom TeX-fold-type-list '(env macro math) - "List of item types to consider when folding. -Valid items are the symbols 'env for environments, 'macro for -macros, 'math for math macros and 'comment for comments." - :type '(set (const :tag "Environments" env) - (const :tag "Macros" macro) - (const :tag "Math Macros" math) - (const :tag "Comments" comment)) - :group 'TeX-fold) - -(defcustom TeX-fold-macro-spec-list - `(("[f]" ("footnote" "marginpar")) - ("[c]" ("cite")) - ("[l]" ("label")) - ("[r]" ("ref" "pageref" "eqref")) - ("[i]" ("index" "glossary")) - ("[1]:||*" ("item")) - ("..." ("dots")) - ("(C)" ("copyright")) - ("(R)" ("textregistered")) - ("TM" ("texttrademark")) - (1 ("part" "chapter" "section" "subsection" "subsubsection" - "paragraph" "subparagraph" - "part*" "chapter*" "section*" "subsection*" "subsubsection*" - "paragraph*" "subparagraph*" - "emph" "textit" "textsl" "textmd" "textrm" "textsf" "texttt" - "textbf" "textsc" "textup"))) - "List of replacement specifiers and macros to fold. - -The first element of each item can be a string, an integer or a -function symbol. The second element is a list of macros two fold -without the leading backslash. - -If the first element is a string, it will be used as a display -replacement for the whole macro. Numbers in braces, brackets, -parens or angle brackets will be replaced by the respective macro -argument. For example \"{1}\" will be replaced by the first -mandatory argument of the macro. One can also define -alternatives within the specifier which are used if an argument -is not found. Alternatives are separated by \"||\". They are -most useful with optional arguments. As an example, the default -specifier for \\item is \"[1]:||*\" which means that if there is -an optional argument, its value is shown followed by a colon. If -there is no optional argument, only an asterisk is used as the -display string. - -If the first element is an integer, the macro will be replaced by -the respective macro argument. - -If the first element is a function symbol, the function will be -called with all mandatory arguments of the macro and the result -of the function call will be used as a replacement for the macro. - -Setting this variable does not take effect immediately. Use -Customize or reset the mode." - :type '(repeat (group (choice (string :tag "Display String") - (integer :tag "Number of argument" :value 1) - (function :tag "Function to execute")) - (repeat :tag "Macros" (string)))) - :group 'TeX-fold) - -(defvar TeX-fold-macro-spec-list-internal nil - "Internal list of display strings and macros to fold. -Is updated when the TeX Fold mode is being activated and then -contains all constructs to fold for the given buffer or mode -respectively, i.e. contents of both `TeX-fold-macro-spec-list' -and -fold-macro-spec-list.") -(make-variable-buffer-local 'TeX-fold-macro-spec-list-internal) - -(defcustom TeX-fold-env-spec-list - '(("[comment]" ("comment"))) - "List of display strings and environments to fold." - :type '(repeat (group (choice (string :tag "Display String") - (integer :tag "Number of argument" :value 1)) - (repeat :tag "Environments" (string)))) - :group 'TeX-fold) - -(defvar TeX-fold-env-spec-list-internal nil - "Internal list of display strings and environments to fold. -Is updated when the TeX Fold mode is being activated and then -contains all constructs to fold for the given buffer or mode -respectively, i.e. contents of both `TeX-fold-env-spec-list' -and -fold-env-spec-list.") -(make-variable-buffer-local 'TeX-fold-env-spec-list-internal) - -(defcustom TeX-fold-math-spec-list nil - "List of display strings and math macros to fold." - :type '(repeat (group (choice (string :tag "Display String") - (integer :tag "Number of argument" :value 1)) - (repeat :tag "Math Macros" (string)))) - :group 'TeX-fold) - -(defvar TeX-fold-math-spec-list-internal nil - "Internal list of display strings and math macros to fold. -Is updated when the TeX Fold mode is being activated and then -contains all constructs to fold for the given buffer or mode -respectively, i.e. contents of both `TeX-fold-math-spec-list' -and -fold-math-spec-list.") -(make-variable-buffer-local 'TeX-fold-math-spec-list-internal) - -(defcustom TeX-fold-unspec-macro-display-string "[m]" - "Display string for unspecified macros. -This string will be displayed if a single macro is being hidden -which is not specified in `TeX-fold-macro-spec-list'." - :type '(string) - :group 'TeX-fold) - -(defcustom TeX-fold-unspec-env-display-string "[env]" - "Display string for unspecified environments. -This string will be displayed if a single environment is being -hidden which is not specified in `TeX-fold-env-spec-list'." - :type '(string) - :group 'TeX-fold) - -(defcustom TeX-fold-unspec-use-name t - "If non-nil use the name of an unspecified item as display string. -Set it to nil if you want to use the values of the variables -`TeX-fold-unspec-macro-display-string' or -`TeX-fold-unspec-env-display-string' respectively as a display -string for any unspecified macro or environment." - :type 'boolean - :group 'TeX-fold) - -(defcustom TeX-fold-preserve-comments nil - "If non-nil do not fold in comments." - :type 'boolean - :group 'TeX-fold) - -(defcustom TeX-fold-unfold-around-mark t - "Unfold text around the mark, if active." - :type 'boolean - :group 'TeX-fold) - -(defcustom TeX-fold-help-echo-max-length 70 - "Maximum length of help echo message for folded overlays. -Set it to zero in order to disable help echos." - :type 'integer - :group 'TeX-fold) - -(defcustom TeX-fold-force-fontify t - "Force the buffer to be fully fontified by folding it." - :group 'TeX-fold - :type 'boolean) - -(defcustom TeX-fold-auto nil - "If non-nil, fold macros automatically after `TeX-insert-macro'." - :group 'TeX-fold - :type 'boolean) - -(defface TeX-fold-folded-face - '((((class color) (background light)) - (:foreground "SlateBlue")) - (((class color) (background dark)) - (:foreground "SlateBlue1")) - (((class grayscale) (background light)) - (:foreground "DimGray")) - (((class grayscale) (background dark)) - (:foreground "LightGray")) - (t (:slant italic))) - "Face for the display string of folded content." - :group 'TeX-fold) - -(defvar TeX-fold-folded-face 'TeX-fold-folded-face - "Face for the display string of folded content.") - -(defface TeX-fold-unfolded-face - '((((class color) (background light)) - (:background "#f2f0fd")) - (((class color) (background dark)) - (:background "#38405d")) - (((class grayscale) (background light)) - (:background "LightGray")) - (((class grayscale) (background dark)) - (:background "DimGray")) - (t (:inverse-video t))) - "Face for folded content when it is temporarily opened." - :group 'TeX-fold) - -(defvar TeX-fold-unfolded-face 'TeX-fold-unfolded-face - "Face for folded content when it is temporarily opened.") - -(defvar TeX-fold-ellipsis "..." - "String used as display string for overlays instead of a zero-length string.") - -(defvar TeX-fold-open-spots nil) -(make-variable-buffer-local 'TeX-fold-open-spots) - -(defcustom TeX-fold-command-prefix "\C-c\C-o" - "Prefix key to use for commands in TeX Fold mode. -The value of this variable is checked as part of loading TeX Fold mode. -After that, changing the prefix key requires manipulating keymaps." - :type 'string - :group 'TeX-fold) - -(defvar TeX-fold-keymap - (let ((map (make-sparse-keymap))) - (define-key map "\C-o" 'TeX-fold-dwim) - (define-key map "\C-b" 'TeX-fold-buffer) - (define-key map "\C-r" 'TeX-fold-region) - (define-key map "\C-p" 'TeX-fold-paragraph) - (define-key map "\C-m" 'TeX-fold-macro) - (define-key map "\C-e" 'TeX-fold-env) - (define-key map "\C-c" 'TeX-fold-comment) - (define-key map "b" 'TeX-fold-clearout-buffer) - (define-key map "r" 'TeX-fold-clearout-region) - (define-key map "p" 'TeX-fold-clearout-paragraph) - (define-key map "i" 'TeX-fold-clearout-item) - map)) - - -;;; Folding - -(defun TeX-fold-dwim () - "Hide or show items according to the current context. -If there is folded content, unfold it. If there is a marked -region, fold all configured content in this region. If there is -no folded content but a macro or environment, fold it." - (interactive) - (cond ((TeX-fold-clearout-item)) - ((TeX-active-mark) (TeX-fold-region (mark) (point))) - ((TeX-fold-item 'macro)) - ((TeX-fold-item 'math)) - ((TeX-fold-item 'env)) - ((TeX-fold-comment)))) - -(defun TeX-fold-buffer () - "Hide all configured macros and environments in the current buffer. -The relevant macros are specified in the variable `TeX-fold-macro-spec-list' -and `TeX-fold-math-spec-list', and environments in `TeX-fold-env-spec-list'." - (interactive) - (TeX-fold-clearout-region (point-min) (point-max)) - (when (and TeX-fold-force-fontify - (boundp 'jit-lock-mode) - jit-lock-mode - (fboundp 'jit-lock-fontify-now)) - ;; We force fontification here only because it should rarely be - ;; needed for the other folding commands. - (jit-lock-fontify-now)) - (TeX-fold-region (point-min) (point-max))) - -(defun TeX-fold-paragraph () - "Hide all configured macros and environments in the current paragraph. -The relevant macros are specified in the variable `TeX-fold-macro-spec-list' -and `TeX-fold-math-spec-list', and environments in `TeX-fold-env-spec-list'." - (interactive) - (save-excursion - (let ((end (progn (LaTeX-forward-paragraph) (point))) - (start (progn (LaTeX-backward-paragraph) (point)))) - (TeX-fold-clearout-region start end) - (TeX-fold-region start end)))) - -(defun TeX-fold-region (start end) - "Fold all items in region from START to END." - (interactive "r") - (when (and (memq 'env TeX-fold-type-list) - (not (eq major-mode 'plain-tex-mode))) - (TeX-fold-region-macro-or-env start end 'env)) - (when (memq 'macro TeX-fold-type-list) - (TeX-fold-region-macro-or-env start end 'macro)) - (when (memq 'math TeX-fold-type-list) - (TeX-fold-region-macro-or-env start end 'math)) - (when (memq 'comment TeX-fold-type-list) - (TeX-fold-region-comment start end))) - -(defun TeX-fold-region-macro-or-env (start end type) - "Fold all items of type TYPE in region from START to END. -TYPE can be one of the symbols 'env for environments, 'macro -for macros and 'math for math macros." - (save-excursion - (let (fold-list item-list regexp) - (dolist (item (cond ((eq type 'env) TeX-fold-env-spec-list-internal) - ((eq type 'math) TeX-fold-math-spec-list-internal) - (t TeX-fold-macro-spec-list-internal))) - (dolist (i (cadr item)) - (add-to-list 'fold-list (list i (car item))) - (add-to-list 'item-list i))) - (when item-list - (setq regexp (cond ((and (eq type 'env) - (eq major-mode 'context-mode)) - (concat (regexp-quote TeX-esc) - "start" (regexp-opt item-list t))) - ((and (eq type 'env) - (eq major-mode 'texinfo-mode)) - (concat (regexp-quote TeX-esc) - (regexp-opt item-list t))) - ((eq type 'env) - (concat (regexp-quote TeX-esc) - "begin[ \t]*{" - (regexp-opt item-list t) "}")) - (t - (concat (regexp-quote TeX-esc) - (regexp-opt item-list t))))) - (save-restriction - (narrow-to-region start end) - ;; Start from the bottom so that it is easier to prioritize - ;; nested macros. - (goto-char (point-max)) - (let ((case-fold-search nil) - item-name) - (while (re-search-backward regexp nil t) - (setq item-name (match-string 1)) - (unless (or (and TeX-fold-preserve-comments - (TeX-in-commented-line)) - ;; Make sure no partially matched macros are - ;; folded. For macros consisting of letters - ;; this means there should be none of the - ;; characters [A-Za-z@*] after the matched - ;; string. Single-char non-letter macros like - ;; \, don't have this requirement. - (and (memq type '(macro math)) - (save-match-data - (string-match "[A-Za-z]" item-name)) - (save-match-data - (string-match "[A-Za-z@*]" - (string (char-after - (match-end 0))))))) - (let* ((item-start (match-beginning 0)) - (display-string-spec (cadr (assoc item-name - fold-list))) - (item-end (TeX-fold-item-end item-start type)) - (ov (TeX-fold-make-overlay item-start item-end type - display-string-spec))) - (TeX-fold-hide-item ov)))))))))) - -(defun TeX-fold-region-comment (start end) - "Fold all comments in region from START to END." - (save-excursion - (goto-char start) - (let (beg) - (while (setq beg (TeX-search-forward-comment-start end)) - (goto-char beg) - ;; Determine the start of the region to be folded just behind - ;; the comment starter. - (looking-at TeX-comment-start-regexp) - (setq beg (match-end 0)) - ;; Search for the end of the comment. - (while (TeX-comment-forward)) - (end-of-line 0) - ;; Hide the whole region. - (TeX-fold-hide-item (TeX-fold-make-overlay beg (point) 'comment - TeX-fold-ellipsis)))))) - -(defun TeX-fold-macro () - "Hide the macro on which point currently is located." - (interactive) - (unless (TeX-fold-item 'macro) - (message "No macro found"))) - -(defun TeX-fold-math () - "Hide the math macro on which point currently is located." - (interactive) - (unless (TeX-fold-item 'math) - (message "No macro found"))) - -(defun TeX-fold-env () - "Hide the environment on which point currently is located." - (interactive) - (unless (TeX-fold-item 'env) - (message "No environment found"))) - -(defun TeX-fold-comment () - "Hide the comment on which point currently is located." - (interactive) - (unless (TeX-fold-comment-do) - (message "No comment found"))) - -(defun TeX-fold-item (type) - "Hide the item on which point currently is located. -TYPE specifies the type of item and can be one of the symbols -'env for environments, 'macro for macros or 'math for math -macros. -Return non-nil if an item was found and folded, nil otherwise." - (if (and (eq type 'env) - (eq major-mode 'plain-tex-mode)) - (message - "Folding of environments is not supported in current mode") - (let ((item-start (cond ((and (eq type 'env) - (eq major-mode 'context-mode)) - (save-excursion - (ConTeXt-find-matching-start) (point))) - ((and (eq type 'env) - (eq major-mode 'texinfo-mode)) - (save-excursion - (Texinfo-find-env-start) (point))) - ((eq type 'env) - (condition-case nil - (save-excursion - (LaTeX-find-matching-begin) (point)) - (error nil))) - (t - (TeX-find-macro-start))))) - (when item-start - (let* ((item-name (save-excursion - (goto-char item-start) - (looking-at - (cond ((and (eq type 'env) - (eq major-mode 'context-mode)) - (concat (regexp-quote TeX-esc) - "start\\([A-Za-z]+\\)")) - ((and (eq type 'env) - (eq major-mode 'texinfo-mode)) - (concat (regexp-quote TeX-esc) - "\\([A-Za-z]+\\)")) - ((eq type 'env) - (concat (regexp-quote TeX-esc) - "begin[ \t]*{" - "\\([A-Za-z]+\\)}")) - (t - (concat (regexp-quote TeX-esc) - "\\([A-Za-z@*]+\\)")))) - (if (fboundp 'match-string-no-properties) - (match-string-no-properties 1) - (match-string 1)))) - (fold-list (cond ((eq type 'env) TeX-fold-env-spec-list-internal) - ((eq type 'math) - TeX-fold-math-spec-list-internal) - (t TeX-fold-macro-spec-list-internal))) - fold-item - (display-string-spec - (or (catch 'found - (while fold-list - (setq fold-item (car fold-list)) - (setq fold-list (cdr fold-list)) - (when (member item-name (cadr fold-item)) - (throw 'found (car fold-item))))) - ;; Item is not specified. - (if TeX-fold-unspec-use-name - (concat "[" item-name "]") - (if (eq type 'env) - TeX-fold-unspec-env-display-string - TeX-fold-unspec-macro-display-string)))) - (item-end (TeX-fold-item-end item-start type)) - (ov (TeX-fold-make-overlay item-start item-end type - display-string-spec))) - (TeX-fold-hide-item ov)))))) - -(defun TeX-fold-comment-do () - "Hide the comment on which point currently is located. -This is the function doing the work for `TeX-fold-comment'. It -is an internal function communicating with return values rather -than with messages for the user. -Return non-nil if a comment was found and folded, nil otherwise." - (if (and (not (TeX-in-comment)) (not (TeX-in-line-comment))) - nil - (let (beg) - (save-excursion - (while (progn - (beginning-of-line 0) - (and (TeX-in-line-comment) - (not (bobp))))) - (goto-char (TeX-search-forward-comment-start (line-end-position 2))) - (looking-at TeX-comment-start-regexp) - (setq beg (match-end 0)) - (while (TeX-comment-forward)) - (end-of-line 0) - (when (> (point) beg) - (TeX-fold-hide-item (TeX-fold-make-overlay beg (point) 'comment - TeX-fold-ellipsis))))))) - - -;;; Utilities - -(defun TeX-fold-make-overlay (ov-start ov-end type display-string-spec) - "Make a TeX-fold overlay extending from OV-START to OV-END. -TYPE is a symbol which is used to describe the content to hide -and may be 'macro for macros, 'math for math macro and 'env for -environments. -DISPLAY-STRING-SPEC is the original specification of the display -string in the variables `TeX-fold-macro-spec-list' or -`TeX-fold-env-spec-list' and may be a string or an integer." - ;; Calculate priority before the overlay is instantiated. We don't - ;; want `TeX-overlay-prioritize' to pick up a non-prioritized one. - (let ((priority (TeX-overlay-prioritize ov-start ov-end)) - (ov (make-overlay ov-start ov-end (current-buffer) t nil))) - (overlay-put ov 'category 'TeX-fold) - (overlay-put ov 'priority priority) - (overlay-put ov 'evaporate t) - (overlay-put ov 'TeX-fold-type type) - (overlay-put ov 'TeX-fold-display-string-spec display-string-spec) - ov)) - -(defun TeX-fold-item-end (start type) - "Return the end of an item of type TYPE starting at START. -TYPE can be either 'env for environments, 'macro for macros or -'math for math macros." - (save-excursion - (cond ((and (eq type 'env) - (eq major-mode 'context-mode)) - (goto-char start) - (ConTeXt-find-matching-stop) - (point)) - ((and (eq type 'env) - (eq major-mode 'texinfo-mode)) - (goto-char (1+ start)) - (Texinfo-find-env-end) - (point)) - ((eq type 'env) - (goto-char (1+ start)) - (LaTeX-find-matching-end) - (point)) - (t - (goto-char start) - (TeX-find-macro-end))))) - -(defun TeX-fold-overfull-p (ov-start ov-end display-string) - "Return t if an overfull line will result after adding an overlay. -The overlay extends from OV-START to OV-END and will display the -string DISPLAY-STRING." - (and (not (featurep 'xemacs)) ; Linebreaks in glyphs don't - ; work in XEmacs anyway. - (save-excursion - (goto-char ov-end) - (search-backward "\n" ov-start t)) - (not (string-match "\n" display-string)) - (> (+ (- ov-start - (save-excursion - (goto-char ov-start) - (line-beginning-position))) - (length display-string) - (- (save-excursion - (goto-char ov-end) - (line-end-position)) - ov-end)) - (current-fill-column)))) - -(defun TeX-fold-macro-nth-arg (n macro-start &optional macro-end delims) - "Return a property list of the argument number N of a macro. -The start of the macro to examine is given by MACRO-START, its -end optionally by MACRO-END. With DELIMS the type of delimiters -can be specified as a cons cell containing the opening char as -the car and the closing char as the cdr. The chars have to have -opening and closing syntax as defined in -`TeX-search-syntax-table'. - -The first item in the returned list is the string specified in -the argument, the second item may be a face if the argument -string was fontified. In Emacs the string holds text properties -as well, so the second item is always nil. In XEmacs the string -does not enclose any faces, so these are given in the second item -of the resulting list." - (save-excursion - (let* ((macro-end (or macro-end - (save-excursion (goto-char macro-start) - (TeX-find-macro-end)))) - (open-char (if delims (car delims) ?{)) - (open-string (char-to-string open-char)) - (close-char (if delims (cdr delims) ?})) - (close-string (char-to-string close-char)) - content-start content-end) - (goto-char macro-start) - (if (condition-case nil - (progn - (while (> n 0) - (skip-chars-forward (concat "^" open-string) macro-end) - (when (= (point) macro-end) - (error nil)) - (setq content-start (progn - (skip-chars-forward - (concat open-string " \t")) - (point))) - (goto-char - (if delims - (with-syntax-table - (TeX-search-syntax-table open-char close-char) - (scan-lists (point) 1 1)) - (TeX-find-closing-brace))) - (setq content-end (save-excursion - (backward-char) - (skip-chars-backward " \t") - (point))) - (setq n (1- n))) - t) - (error nil)) - (list (TeX-fold-buffer-substring content-start content-end) - (when (and (featurep 'xemacs) - (extent-at content-start)) - ;; A glyph in XEmacs does not seem to be able to hold more - ;; than one face, so we just use the first one we get. - (car (extent-property (extent-at content-start) 'face)))) - nil)))) - -(defun TeX-fold-buffer-substring (start end) - "Return the contents of buffer from START to END as a string. -Like `buffer-substring' but copy overlay display strings as well." - ;; Swap values of `start' and `end' if necessary. - (when (> start end) (let ((tmp start)) (setq start end end tmp))) - (let ((overlays (overlays-in start end)) - result) - ;; Get rid of overlays not under our control or not completely - ;; inside the specified region. - (dolist (ov overlays) - (when (or (not (eq (overlay-get ov 'category) 'TeX-fold)) - (< (overlay-start ov) start) - (> (overlay-end ov) end)) - (setq overlays (remove ov overlays)))) - (if (null overlays) - (buffer-substring start end) - ;; Sort list according to ascending starts. - (setq overlays (sort (copy-sequence overlays) - (lambda (a b) - (< (overlay-start a) (overlay-start b))))) - ;; Get the string from the start of the region up to the first overlay. - (setq result (buffer-substring start (overlay-start (car overlays)))) - (let (ov) - (while overlays - (setq ov (car overlays) - overlays (cdr overlays)) - ;; Add the display string of the overlay. - (setq result (concat result (overlay-get ov 'display))) - ;; Remove overlays contained in the current one. - (dolist (elt overlays) - (when (< (overlay-start elt) (overlay-end ov)) - (setq overlays (remove elt overlays)))) - ;; Add the string from the end of the current overlay up to - ;; the next overlay or the end of the specified region. - (setq result (concat result (buffer-substring (overlay-end ov) - (if overlays - (overlay-start - (car overlays)) - end)))))) - result))) - -(defun TeX-fold-make-help-echo (start end) - "Return a string to be used as the help echo of folded overlays. -The text between START and END will be used for this but cropped -to the length defined by `TeX-fold-help-echo-max-length'. Line -breaks will be replaced by spaces." - (let* ((spill (+ start TeX-fold-help-echo-max-length)) - (lines (split-string (buffer-substring start (min end spill)) "\n")) - (result (pop lines))) - (dolist (line lines) - ;; Strip leading whitespace - (when (string-match "^[ \t]+" line) - (setq line (replace-match "" nil nil line))) - ;; Strip trailing whitespace - (when (string-match "[ \t]+$" line) - (setq line (replace-match "" nil nil line))) - (setq result (concat result " " line))) - (when (> end spill) (setq result (concat result "..."))) - result)) - -(defun TeX-fold-update-at-point () - "Update all TeX-fold overlays at point displaying computed content." - (let (overlays) - ;; Get all overlays at point under our control. - (dolist (ov (overlays-at (point))) - (when (and (eq (overlay-get ov 'category) 'TeX-fold) - (numberp (overlay-get ov 'TeX-fold-display-string-spec))) - (add-to-list 'overlays ov))) - (when overlays - ;; Sort list according to descending starts. - (setq overlays (sort (copy-sequence overlays) - (lambda (a b) - (> (overlay-start a) (overlay-start b))))) - (dolist (ov overlays) - (TeX-fold-hide-item ov))))) - - -;;; Removal - -(defun TeX-fold-clearout-buffer () - "Permanently show all macros in the buffer." - (interactive) - (TeX-fold-clearout-region (point-min) (point-max))) - -(defun TeX-fold-clearout-paragraph () - "Permanently show all macros in the paragraph point is located in." - (interactive) - (save-excursion - (let ((end (progn (LaTeX-forward-paragraph) (point))) - (start (progn (LaTeX-backward-paragraph) (point)))) - (TeX-fold-clearout-region start end)))) - -(defun TeX-fold-clearout-region (start end) - "Permanently show all macros in region starting at START and ending at END." - (interactive "r") - (let ((overlays (overlays-in start end))) - (TeX-fold-remove-overlays overlays))) - -(defun TeX-fold-clearout-item () - "Permanently show the macro on which point currently is located." - (interactive) - (let ((overlays (overlays-at (point)))) - (TeX-fold-remove-overlays overlays))) - -(defun TeX-fold-remove-overlays (overlays) - "Remove all overlays set by TeX-fold in OVERLAYS. -Return non-nil if a removal happened, nil otherwise." - (let (found) - (while overlays - (when (eq (overlay-get (car overlays) 'category) 'TeX-fold) - (delete-overlay (car overlays)) - (setq found t)) - (setq overlays (cdr overlays))) - found)) - - -;;; Toggling - -(defun TeX-fold-expand-spec (spec ov-start ov-end) - "Expand instances of {}, [], <>, and (). -Replace them with the respective macro argument." - (let ((spec-list (split-string spec "||")) - (delims '((?{ . ?}) (?[ . ?]) (?< . ?>) (?\( . ?\)))) - match-end success) - (catch 'success - ;; Iterate over alternatives. - (dolist (elt spec-list) - (setq spec elt) - ;; Find and expand every placeholder. - (while (and (string-match "\\([[{<]\\)\\([1-9]\\)\\([]}>]\\)" elt - match-end) - ;; Does the closing delim fit to the opening one? - (string-equal - (match-string 3 elt) - (char-to-string - (cdr (assq (string-to-char (match-string 1 elt)) - delims))))) - (setq match-end (match-beginning 0)) - (let ((arg (car (save-match-data - ;; Get the argument. - (TeX-fold-macro-nth-arg - (string-to-number (match-string 2 elt)) - ov-start ov-end - (assoc (string-to-char (match-string 1 elt)) - delims)))))) - (when arg (setq success t)) - ;; Replace the placeholder in the string. - (setq elt (replace-match (or arg TeX-fold-ellipsis) nil t elt) - spec elt))) - (when success (throw 'success nil)))) - spec)) - -(defun TeX-fold-hide-item (ov) - "Hide a single macro or environment. -That means, put respective properties onto overlay OV." - (let* ((ov-start (overlay-start ov)) - (ov-end (overlay-end ov)) - (spec (overlay-get ov 'TeX-fold-display-string-spec)) - (computed (cond - ((stringp spec) - (TeX-fold-expand-spec spec ov-start ov-end)) - ((functionp spec) - (let (arg arg-list - (n 1)) - (while (setq arg (TeX-fold-macro-nth-arg - n ov-start ov-end)) - (add-to-list 'arg-list (car arg) t) - (setq n (1+ n))) - (or (condition-case nil - (apply spec arg-list) - (error nil)) - "[Error: No content or function found]"))) - (t (or (TeX-fold-macro-nth-arg spec ov-start ov-end) - "[Error: No content found]")))) - (display-string (if (listp computed) (car computed) computed)) - (face (when (listp computed) (cadr computed)))) - ;; Cater for zero-length display strings. - (when (string= display-string "") (setq display-string TeX-fold-ellipsis)) - ;; Add a linebreak to the display string and adjust the overlay end - ;; in case of an overfull line. - (when (TeX-fold-overfull-p ov-start ov-end display-string) - (setq display-string (concat display-string "\n")) - (move-overlay ov ov-start (save-excursion - (goto-char ov-end) - (skip-chars-forward " \t") - (point)))) - (overlay-put ov 'mouse-face 'highlight) - (overlay-put ov 'display display-string) - (if (featurep 'xemacs) - (let ((glyph (make-glyph (if (listp display-string) - (car display-string) - display-string)))) - (overlay-put ov 'invisible t) - (when font-lock-mode - (if face - (set-glyph-property glyph 'face face) - (set-glyph-property glyph 'face TeX-fold-folded-face))) - (set-extent-property ov 'end-glyph glyph)) - (when font-lock-mode - (overlay-put ov 'face TeX-fold-folded-face)) - (unless (zerop TeX-fold-help-echo-max-length) - (overlay-put ov 'help-echo (TeX-fold-make-help-echo - (overlay-start ov) (overlay-end ov))))))) - -(defun TeX-fold-show-item (ov) - "Show a single LaTeX macro or environment. -Remove the respective properties from the overlay OV." - (overlay-put ov 'mouse-face nil) - (if (featurep 'xemacs) - (progn - (set-extent-property ov 'end-glyph nil) - (overlay-put ov 'invisible nil)) - (overlay-put ov 'display nil) - (overlay-put ov 'help-echo nil) - (when font-lock-mode - (overlay-put ov 'face TeX-fold-unfolded-face)))) - -;; Copy and adaption of `reveal-post-command' from reveal.el in GNU -;; Emacs on 2004-07-04. -(defun TeX-fold-post-command () - ;; `with-local-quit' is not supported in XEmacs. - (condition-case nil - (let ((inhibit-quit nil)) - (condition-case err - (let* ((spots (TeX-fold-partition-list - (lambda (x) - ;; We refresh any spot in the current - ;; window as well as any spots associated - ;; with a dead window or a window which - ;; does not show this buffer any more. - (or (eq (car x) (selected-window)) - (not (window-live-p (car x))) - (not (eq (window-buffer (car x)) - (current-buffer))))) - TeX-fold-open-spots)) - (old-ols (mapcar 'cdr (car spots)))) - (setq TeX-fold-open-spots (cdr spots)) - (when (or (and (boundp 'disable-point-adjustment) - disable-point-adjustment) - (and (boundp 'global-disable-point-adjustment) - global-disable-point-adjustment) - ;; See preview.el on how to make this configurable. - (memq this-command (list (key-binding [left]) - (key-binding [right]) - 'mouse-set-point))) - ;; Open new overlays. - (dolist (ol (nconc (when (and TeX-fold-unfold-around-mark - (boundp 'mark-active) - mark-active) - (overlays-at (mark))) - (overlays-at (point)))) - (when (eq (overlay-get ol 'category) 'TeX-fold) - (push (cons (selected-window) ol) TeX-fold-open-spots) - (setq old-ols (delq ol old-ols)) - (TeX-fold-show-item ol)))) - ;; Close old overlays. - (dolist (ol old-ols) - (when (and (eq (current-buffer) (overlay-buffer ol)) - (not (rassq ol TeX-fold-open-spots)) - (or (not (featurep 'xemacs)) - (and (featurep 'xemacs) - (not (extent-detached-p ol))))) - (if (and (>= (point) (overlay-start ol)) - (<= (point) (overlay-end ol))) - ;; Still near the overlay: keep it open. - (push (cons (selected-window) ol) TeX-fold-open-spots) - ;; Really close it. - (TeX-fold-hide-item ol))))) - (error (message "TeX-fold: %s" err)))) - (quit (setq quit-flag t)))) - - -;;; Misc - -;; Copy and adaption of `cvs-partition' from pcvs-util.el in GNU Emacs -;; on 2004-07-05 to make tex-fold.el mainly self-contained. -(defun TeX-fold-partition-list (p l) - "Partition a list L into two lists based on predicate P. -The function returns a `cons' cell where the `car' contains -elements of L for which P is true while the `cdr' contains -the other elements. The ordering among elements is maintained." - (let (car cdr) - (dolist (x l) - (if (funcall p x) (push x car) (push x cdr))) - (cons (nreverse car) (nreverse cdr)))) - - -;;; The mode - -;; This autoload cookie had to be changed because of XEmacs. This is -;; very dissatisfactory, because we now don't have the full doc string -;; available to tell people what to expect when using this mode before -;; loading it. - -;;;###autoload (autoload 'TeX-fold-mode "tex-fold" "Minor mode for hiding and revealing macros and environments." t) -(define-minor-mode TeX-fold-mode - "Minor mode for hiding and revealing macros and environments. - -Called interactively, with no prefix argument, toggle the mode. -With universal prefix ARG (or if ARG is nil) turn mode on. -With zero or negative ARG turn mode off." - nil nil (list (cons TeX-fold-command-prefix TeX-fold-keymap)) - (if TeX-fold-mode - (progn - (set (make-local-variable 'search-invisible) t) - (add-hook 'post-command-hook 'TeX-fold-post-command nil t) - (add-hook 'LaTeX-fill-newline-hook 'TeX-fold-update-at-point nil t) - (add-hook 'TeX-after-insert-macro-hook - (lambda () - (when (and TeX-fold-mode TeX-fold-auto) - (save-excursion - (backward-char) - (or (TeX-fold-item 'macro) - (TeX-fold-item 'math) - (TeX-fold-item 'env)))))) - ;; Update the `TeX-fold-*-spec-list-internal' variables. - (dolist (elt '("macro" "env" "math")) - (set (intern (format "TeX-fold-%s-spec-list-internal" elt)) - ;; Append the value of `TeX-fold-*-spec-list' to the - ;; mode-specific `-fold-*-spec-list' variable. - (append (symbol-value (intern (format "TeX-fold-%s-spec-list" - elt))) - (let ((symbol (intern (format "%s-fold-%s-spec-list" - (TeX-mode-prefix) elt)))) - (when (boundp symbol) - (symbol-value symbol))))))) - (kill-local-variable 'search-invisible) - (remove-hook 'post-command-hook 'TeX-fold-post-command t) - (remove-hook 'LaTeX-fill-newline-hook 'TeX-fold-update-at-point t) - (TeX-fold-clearout-buffer)) - (TeX-set-mode-name)) - -;;;###autoload -(defalias 'tex-fold-mode 'TeX-fold-mode) - -(provide 'tex-fold) - -;;; tex-fold.el ends here diff --git a/packages/auctex/tex-font.el b/packages/auctex/tex-font.el deleted file mode 100644 index 8c0bf6104..000000000 --- a/packages/auctex/tex-font.el +++ /dev/null @@ -1,173 +0,0 @@ -;;; tex-font.el --- Font-Lock support stolen from Emacs 21. -;; -;; Copyright (C) 1985, 86, 89, 92, 94, 95, 96, 97, 98, 1999 -;; Free Software Foundation, Inc. - -;; Maintainer: auctex-devel@gnu.org -;; Keywords: tex, faces - -;; This file is part of AUC TeX. - -;; AUC TeX is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUC TeX is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUC TeX; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, -;; Boston, MA 02110-1301, USA. - -;;; Comments: - -;; Please keep this file in sync with GNU Emacs 21. - -;;; Code: - -(defconst tex-font-lock-keywords-1 - (eval-when-compile - (let* (;; Names of commands whose arg should be fontified as heading, etc. - (headings (regexp-opt - '("title" "begin" "end" "chapter" "part" - "section" "subsection" "subsubsection" - "paragraph" "subparagraph" "subsubparagraph" - "newcommand" "renewcommand" "newenvironment" - "newtheorem") - t)) - (variables (regexp-opt - '("newcounter" "newcounter*" "setcounter" "addtocounter" - "setlength" "addtolength" "settowidth") - t)) - (includes (regexp-opt - '("input" "include" "includeonly" "bibliography" - "epsfig" "psfig" "epsf" "nofiles" "usepackage" - "documentstyle" "documentclass" "verbatiminput" - "includegraphics" "includegraphics*") - t)) - ;; Miscellany. - (slash "\\\\") - (opt " *\\(\\[[^]]*\\] *\\)*") - ;; This would allow highlighting \newcommand\CMD but requires - ;; adapting subgroup numbers below. - ;; (arg "\\(?:{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)\\|\\\\[a-z*]+\\)")) - (arg "{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)")) - (list - ;; Heading args. - (list (concat slash headings "\\*?" opt arg) - ;; If ARG ends up matching too much (if the {} don't match, f.ex) - ;; jit-lock will do funny things: when updating the buffer - ;; the re-highlighting is only done locally so it will just - ;; match the local line, but defer-contextually will - ;; match more lines at a time, so ARG will end up matching - ;; a lot more, which might suddenly include a comment - ;; so you get things highlighted bold when you type them - ;; but they get turned back to normal a little while later - ;; because "there's already a face there". - ;; Using `keep' works around this un-intuitive behavior as well - ;; as improves the behavior in the very rare case where you do - ;; have a comment in ARG. - 3 'font-lock-function-name-face 'keep) - (list (concat slash "\\(re\\)?newcommand\\** *\\(\\\\[A-Za-z@]+\\)") - 2 'font-lock-function-name-face 'keep) - ;; Variable args. - (list (concat slash variables " *" arg) 2 'font-lock-variable-name-face) - ;; Include args. - (list (concat slash includes opt arg) 3 'font-lock-builtin-face) - ;; Definitions. I think. - '("^[ \t]*\\\\def *\\\\\\(\\(\\w\\|@\\)+\\)" - 1 font-lock-function-name-face)))) - "Subdued expressions to highlight in TeX modes.") - -(defconst tex-font-lock-keywords-2 - (append tex-font-lock-keywords-1 - (eval-when-compile - (let* (;; - ;; Names of commands whose arg should be fontified with fonts. - (bold (regexp-opt '("textbf" "textsc" "textup" - "boldsymbol" "pmb") t)) - (italic (regexp-opt '("textit" "textsl" "emph") t)) - (type (regexp-opt '("texttt" "textmd" "textrm" "textsf") t)) - ;; - ;; Names of commands whose arg should be fontified as a citation. - (citations (regexp-opt - '("label" "ref" "pageref" "vref" "eqref" - "cite" "nocite" "index" "glossary" "bibitem" - ;; These are text, rather than citations. - ;; "caption" "footnote" "footnotemark" "footnotetext" - ) - t)) - ;; - ;; Names of commands that should be fontified. - (specials (regexp-opt - '("\\" "\\*" ;; "-" - "linebreak" "nolinebreak" "pagebreak" "nopagebreak" - "newline" "newpage" "clearpage" "cleardoublepage" - "displaybreak" "allowdisplaybreaks" "enlargethispage") - t)) - (general "\\([a-zA-Z@]+\\**\\|[^ \t\n]\\)") - ;; - ;; Miscellany. - (slash "\\\\") - (opt " *\\(\\[[^]]*\\] *\\)*") - (arg "{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)")) - (list - ;; - ;; Citation args. - (list (concat slash citations opt arg) 3 'font-lock-constant-face) - ;; - ;; Text between `` quotes ''. - (cons (concat (regexp-opt `("``" "\"<" "\"`" "<<" "«") t) - "[^'\">»]+" ;a bit pessimistic - (regexp-opt `("''" "\">" "\"'" ">>" "»") t)) - 'font-lock-string-face) - ;; - ;; Command names, special and general. - (cons (concat slash specials) 'font-lock-warning-face) - (concat slash general) - ;; - ;; Font environments. It seems a bit dubious to use `bold' etc. faces - ;; since we might not be able to display those fonts. - (list (concat slash bold " *" arg) 2 '(quote bold) 'append) - (list (concat slash italic " *" arg) 2 '(quote italic) 'append) - ;; (list (concat slash type arg) 2 '(quote bold-italic) 'append) - ;; - ;; Old-style bf/em/it/sl. Stop at `\\' and un-escaped `&', for tables. - (list (concat "\\\\\\(\\(bf\\)\\|em\\|it\\|sl\\)\\>" - "\\(\\([^}&\\]\\|\\\\[^\\]\\)+\\)") - 3 '(if (match-beginning 2) 'bold 'italic) 'append))))) - "Gaudy expressions to highlight in TeX modes.") - -(defvar tex-font-lock-keywords tex-font-lock-keywords-1 - "Default expressions to highlight in TeX modes.") - - -(defface tex-math-face - '((t :inherit font-lock-string-face)) - "Face used to highlight TeX math expressions.") -(defvar tex-math-face 'tex-math-face) - -;; Use string syntax but math face for $...$. -(defun tex-font-lock-syntactic-face-function (state) - (if (nth 3 state) tex-math-face font-lock-comment-face)) - -;;;###autoload -(defun tex-font-setup () - "Setup font lock support for TeX." - (set (make-local-variable 'font-lock-defaults) - '((tex-font-lock-keywords - tex-font-lock-keywords-1 tex-font-lock-keywords-2) - nil nil ((?$ . "\"")) nil - ;; Who ever uses that anyway ??? - (font-lock-mark-block-function . mark-paragraph) - (font-lock-syntactic-face-function - . tex-font-lock-syntactic-face-function))) - ) - -(provide 'tex-font) - -;;; tex-font.el ends here \ No newline at end of file diff --git a/packages/auctex/tex-fptex.el b/packages/auctex/tex-fptex.el deleted file mode 100644 index b00ed6df9..000000000 --- a/packages/auctex/tex-fptex.el +++ /dev/null @@ -1,91 +0,0 @@ -;;; tex-fptex.el --- fpTeX support for AUCTeX. - -;; Copyright (C) 2000, 2004, 2012 Free Software Foundation, Inc. - -;; Author: Fabrice Popineau -;; Maintainer: auctex-devel@gnu.org -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: -;; -;; This file contains variables customized for fpTeX. - -;;; Code: - -(defmacro parent-directory (f) - "Return safe parent directory of the directory given as argument." - `(directory-file-name - (file-name-directory - (directory-file-name ,f)))) - -(unless (get 'TeX-lisp-directory 'saved-value) - (setq-default TeX-lisp-directory - (concat (parent-directory (invocation-directory)) - "/site-lisp/auctex"))) - - ;; Remove the Queue entry from the default, and make a non-Unix - ;; specific print entry, assuming that dvips will print by default. -(unless (get 'TeX-queue-command 'saved-value) - (setq TeX-queue-command nil)) - -(unless (get 'TeX-printer-list 'saved-value) - (setq TeX-printer-list nil)) - -(unless (get 'TeX-print-command 'saved-value) - (setq TeX-print-command - "dvips %d")) - -(unless (get 'TeX-view-style 'saved-value) - (setq TeX-view-style '(("^a5\\(?:comb\\|paper\\)?$" "windvi %d -qpaper a5") - ("^landscape$" "windvi %d -qpaper a4r -s 4") - ("^epsf$" "start \"\" %f") - ("." "windvi %d")))) - -(unless (get 'TeX-output-view-style 'saved-value) - (setq TeX-output-view-style - '(("^dvi$" "^pstricks$\\|^pst-\\|^psfrag$" "dvips %d -o && start \"\" %f") - ("^dvi$" ("^a5\\(?:comb\\|paper\\)$" "^landscape$") - "windvi %d %dS -qpaper a5r -s 0") - ("^dvi$" "^a5\\(?:comb\\|paper\\)$" "windvi %d %dS -qpaper a5") - ("^dvi$" "^b5paper$" "windvi %d %dS -qpaper b5") - ("^dvi$" ("^landscape$" "^pstricks$\\|^psfrag$") - "dvips -t landscape %d -o && start \"\" %f") - ("^dvi$" "^letterpaper$" "windvi %d %dS -qpaper us") - ("^dvi$" "^legalpaper$" "windvi %d %dS -qpaper legal") - ("^dvi$" "^executivepaper$" "windvi %d %dS -qpaper 7.25x10.5in") - ("^dvi$" "^landscape$" "windvi %d %dS -qpaper a4r") - ("^dvi$" "." "windvi %d %dS") - ("^pdf$" "." "start \"\" %o") - ("^html?$" "." "start \"\" %o")))) - -;; WinDVI does not support source specials? -(unless (get 'TeX-source-specials-view-position-flags 'saved-value) - (setq TeX-source-specials-view-position-flags "")) - -(unless (get 'TeX-source-specials-view-editor-flags 'saved-value) - (setq TeX-source-specials-view-editor-flags "")) - -(unless (get 'TeX-kpathsea-path-delimiter 'saved-value) - (setq TeX-kpathsea-path-delimiter ";")) - -(provide 'tex-fptex) -(require 'tex-site) - -;;; tex-fptex.el ends here diff --git a/packages/auctex/tex-info.el b/packages/auctex/tex-info.el deleted file mode 100644 index 6f7b8497e..000000000 --- a/packages/auctex/tex-info.el +++ /dev/null @@ -1,566 +0,0 @@ -;;; tex-info.el --- Support for editing Texinfo source. - -;; Copyright (C) 1993, 1994, 1997, 2000, 2001, -;; 2004, 2005, 2006 Free Software Foundation, Inc. - -;; Maintainer: auctex-devel@gnu.org -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Code: - -(require 'tex) - -(require 'texinfo) -;; Make sure the Texinfo mode of AUCTeX is still used after loading -;; texinfo.el. (This is only an issue on Emacs 21.) -(when (and (boundp 'TeX-modes) - (memq 'texinfo-mode TeX-modes)) - (defalias 'texinfo-mode 'TeX-texinfo-mode)) - -;;; Environments: - -(defvar Texinfo-environment-list - '(("cartouche") ("command") ("copying") ("defcv") ("deffn") ("defivar") - ("defmac") ("defmethod") ("defop") ("defopt") ("defspec") - ("deftp") ("deftypefn") ("deftypefun") ("deftypevar") ("deftypevr") - ("defun") ("defvar") ("defvr") ("description") ("detailmenu") - ("direntry") ("display") ("documentdescription") ("enumerate") - ("example") ("flushleft") ("flushright") ("format") ("ftable") - ("group") ("ifclear") ("ifdocbook") ("ifhtml") ("ifinfo") - ("ifnotdocbook") ("ifnothtml") ("ifnotinfo") ("ifnotplaintext") - ("ifnottex") ("ifnotxml") ("ifplaintext") ("ifset") ("iftex") - ("ifxml") ("ignore") ("itemize") ("lisp") ("macro") ("menu") - ("multitable") ("quotation") ("smalldisplay") ("smallexample") - ("smallformat") ("smalllisp") ("table") ("tex") ("titlepage") - ("verbatim") ("vtable")) - "Alist of Texinfo environments.") - -(defconst texinfo-environment-regexp - ;; Overwrite version from `texinfo.el'. - (concat "^@\\(" - (mapconcat 'car Texinfo-environment-list "\\|") - "\\|end\\)\\>") - "Regexp for environment-like Texinfo list commands. -Subexpression 1 is what goes into the corresponding `@end' statement.") - -(defun Texinfo-environment (env &optional arg) - "Make Texinfo environment ENV. -With optional ARG, modify current environment." - ;; XXX: This could be enhanced to act like `LaTeX-environment', - ;; i.e. suggest a default environment and have its own history. - (interactive (list (completing-read "Environment: " - Texinfo-environment-list) - current-prefix-arg)) - (if arg - (Texinfo-modify-environment env) - (Texinfo-insert-environment env))) - -(defun Texinfo-insert-environment (env) - "Insert Texinfo environment ENV." - (if (and (TeX-active-mark) - (not (eq (mark) (point)))) - (progn - (when (< (mark) (point)) - (exchange-point-and-mark)) - (unless (TeX-looking-at-backward "^[ \t]*") - (newline)) - (insert "@" env) - (newline) - (goto-char (mark)) - (unless (TeX-looking-at-backward "^[ \t]*") - (newline)) - (insert "@end " env) - (save-excursion (newline)) - (end-of-line 0)) - (insert "@" env "\n\n@end " env "\n") - (if (null (cdr-safe (assoc "defcv" Texinfo-environment-list))) - (forward-line -2)))) - -(defun Texinfo-modify-environment (env) - "Change current environment to environment ENV." - (save-excursion - (Texinfo-find-env-end) - (re-search-backward (concat (regexp-quote TeX-esc) "end \\([a-zA-Z]*\\)") - (line-beginning-position)) - (replace-match env t t nil 1) - (beginning-of-line) - (Texinfo-find-env-start) - (re-search-forward (concat (regexp-quote TeX-esc) "\\([a-zA-Z]*\\)") - (line-end-position)) - (replace-match env t t nil 1))) - -(defun Texinfo-find-env-end () - "Move point to the end of the current environment." - (interactive) - (let* ((envs (mapcar 'car Texinfo-environment-list)) - (regexp (concat "^[ \t]*" (regexp-quote TeX-esc) "\\(end \\)*" - (regexp-opt envs t) "\\b")) - (level 1) - case-fold-search) - (save-restriction - (save-excursion - (save-excursion - (beginning-of-line) - (when (and (looking-at regexp) - (match-string 1)) - (setq level 0))) - (while (and (> level 0) (re-search-forward regexp nil t)) - (if (match-string 1) - (setq level (1- level)) - (setq level (1+ level))))) - (if (= level 0) - (goto-char (match-end 0)) - (error "Can't locate end of current environment"))))) - -(defun Texinfo-find-env-start () - "Move point to the start of the current environment." - (interactive) - (let* ((envs (mapcar 'car Texinfo-environment-list)) - (regexp (concat "^[ \t]*" (regexp-quote TeX-esc) "\\(end \\)*" - (regexp-opt envs t) "\\b")) - (level 1) - case-fold-search) - (save-restriction - (save-excursion - (save-excursion - (beginning-of-line) - (when (and (looking-at regexp) - (not (match-string 1))) - (setq level 0))) - (while (and (> level 0) (re-search-backward regexp nil t)) - (if (match-string 1) - (setq level (1+ level)) - (setq level (1- level))))) - (if (= level 0) - (goto-char (match-beginning 0)) - (error "Can't locate start of current environment"))))) - -(defun Texinfo-insert-node () - "Insert a Texinfo node in the current buffer. -That means, insert the string `@node' and prompt for current, -next, previous and upper node. If there is an active region, use -this for the current node and inhibit the prompt for it. Insert -a comment on the following line indicating the order of arguments -for @node." - (interactive) - (let ((active-mark (and (TeX-active-mark) (not (eq (mark) (point))))) - nodes node-name next-node previous-node up-node) - ;; Build list of nodes in current buffer. - ;; (What about using `imenu--index-alist'?) - ;; FIXME: Support multi-file documents. - (save-excursion - (goto-char (point-min)) - (while (re-search-forward "^@node\\b" nil t) - (skip-chars-forward " \t") - (add-to-list 'nodes - (list (buffer-substring-no-properties - (point) (progn (skip-chars-forward "^,") - (point))))))) - (unless active-mark - (setq node-name (read-string "Node name: "))) - ;; FIXME: What if key binding for `minibuffer-complete' was changed? - ;; `substitute-command-keys' doesn't return the correct value. - (setq next-node (completing-read "Next node (TAB completes): " nodes)) - (setq previous-node - (completing-read "Previous node (TAB completes): " nodes)) - (setq up-node (completing-read "Upper node (TAB completes): " nodes)) - (when (and active-mark - (< (mark) (point))) - (exchange-point-and-mark)) - (insert "@node ") - (if active-mark - (goto-char (mark)) - (insert node-name)) - (insert ", " next-node ", " previous-node ", " up-node - "\n@comment node-name, next, previous, up\n") - ;; Position point at first empty field. - (unless (and (or (> (length node-name) 0) active-mark) - (> (length next-node) 0) - (> (length previous-node) 0) - (> (length up-node) 0)) - (forward-line -2) - (forward-char 6) - (catch 'break - (if (or (> (length node-name) 0) active-mark) - (progn (skip-chars-forward "^,") (forward-char 2)) - (throw 'break nil)) - (dolist (node (list next-node previous-node up-node)) - (if (> (length node) 0) - (progn (skip-chars-forward "^,") (forward-char 2)) - (throw 'break nil))))))) - - -;;; Keymap: - -(defvar Texinfo-mode-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map TeX-mode-map) - - ;; From texinfo.el - ;; bindings for updating nodes and menus - (define-key map "\C-c\C-um" 'texinfo-master-menu) - (define-key map "\C-c\C-u\C-m" 'texinfo-make-menu) - (define-key map "\C-c\C-u\C-n" 'texinfo-update-node) - (define-key map "\C-c\C-u\C-e" 'texinfo-every-node-update) - (define-key map "\C-c\C-u\C-a" 'texinfo-all-menus-update) - - ;; Simulating LaTeX-mode - (define-key map "\C-c\C-e" 'Texinfo-environment) - (define-key map "\C-c\n" 'texinfo-insert-@item) - (or (key-binding "\e\r") - (define-key map "\e\r" 'texinfo-insert-@item)) ;*** Alias - (define-key map "\C-c\C-s" 'Texinfo-insert-node) - (define-key map "\C-c]" 'texinfo-insert-@end) - map) - "Keymap for Texinfo mode.") - -(easy-menu-define Texinfo-command-menu - Texinfo-mode-map - "Menu used in Texinfo mode for external commands." - (TeX-mode-specific-command-menu 'texinfo-mode)) - -(easy-menu-define Texinfo-mode-menu - Texinfo-mode-map - "Menu used in Texinfo mode." - (TeX-menu-with-help - `("Texinfo" - ["Node ..." texinfo-insert-@node - :help "Insert a node"] - ["Macro ..." TeX-insert-macro - :help "Insert a macro and possibly arguments"] - ["Complete Macro" TeX-complete-symbol - :help "Complete the current macro"] - ["Environment ..." Texinfo-insert-environment - :help "Insert an environment"] - ["Item" texinfo-insert-@item - :help "Insert an @item"] - "-" - ("Insert Font" - ["Emphasize" (TeX-font nil ?\C-e) :keys "C-c C-f C-e"] - ["Bold" (TeX-font nil ?\C-b) :keys "C-c C-f C-b"] - ["Typewriter" (TeX-font nil ?\C-t) :keys "C-c C-f C-t"] - ["Small Caps" (TeX-font nil ?\C-c) :keys "C-c C-f C-c"] - ["Italic" (TeX-font nil ?\C-i) :keys "C-c C-f C-i"] - ["Sample" (TeX-font nil ?\C-s) :keys "C-c C-f C-s"] - ["Roman" (TeX-font nil ?\C-r) :keys "C-c C-f C-r"]) - ("Replace Font" - ["Emphasize" (TeX-font t ?\C-e) :keys "C-u C-c C-f C-e"] - ["Bold" (TeX-font t ?\C-b) :keys "C-u C-c C-f C-b"] - ["Typewriter" (TeX-font t ?\C-t) :keys "C-u C-c C-f C-t"] - ["Small Caps" (TeX-font t ?\C-c) :keys "C-u C-c C-f C-c"] - ["Italic" (TeX-font t ?\C-i) :keys "C-u C-c C-f C-i"] - ["Sample" (TeX-font t ?\C-s) :keys "C-u C-c C-f C-s"] - ["Roman" (TeX-font t ?\C-r) :keys "C-u C-c C-f C-r"]) - ["Delete Font" (TeX-font t ?\C-d) :keys "C-c C-f C-d"] - "-" - ["Create Master Menu" texinfo-master-menu - :help "Make a master menu for the whole Texinfo file"] - ["Create Menu" texinfo-make-menu - :help "Make or update the menu for the current section"] - ["Update Node" texinfo-update-node - :help "Update the current node"] - ["Update Every Node" texinfo-every-node-update - :help "Update every node in the current file"] - ["Update All Menus" texinfo-all-menus-update - :help "Update every menu in the current file"] - "-" - ("Commenting" - ["Comment or Uncomment Region" - TeX-comment-or-uncomment-region - :help "Comment or uncomment the currently selected region"] - ["Comment or Uncomment Paragraph" - TeX-comment-or-uncomment-paragraph - :help "Comment or uncomment the current paragraph"]) - ,TeX-fold-menu - "-" - . ,TeX-common-menu-entries))) - -(defvar Texinfo-font-list - '((?\C-b "@b{" "}") - (?\C-c "@sc{" "}") - (?\C-e "@emph{" "}") - (?\C-i "@i{" "}") - (?\C-r "@r{" "}") - (?\C-s "@samp{" "}") - (?\C-t "@t{" "}") - (?s "@strong{" "}") - (?\C-f "@file{" "}") - (?d "@dfn{" "}") - (?\C-v "@var{" "}") - (?k "@key{" "}") - (?\C-k "@kbd{" "}") - (?c "@code{" "}") - (?C "@cite{" "}") - (?\C-d "" "" t)) - "Font commands used in Texinfo mode. See `TeX-font-list'.") - -;;; Mode: - -;;;###autoload -(defalias 'Texinfo-mode 'texinfo-mode) - -;;;###autoload -(defun TeX-texinfo-mode () - "Major mode in AUCTeX for editing Texinfo files. - -Special commands: -\\{Texinfo-mode-map} - -Entering Texinfo mode calls the value of `text-mode-hook' and then the -value of `Texinfo-mode-hook'." - (interactive) - (kill-all-local-variables) - (setq TeX-mode-p t) - ;; Mostly stolen from texinfo.el - (setq TeX-base-mode-name "Texinfo") - (setq major-mode 'texinfo-mode) - (use-local-map Texinfo-mode-map) - (set-syntax-table texinfo-mode-syntax-table) - (make-local-variable 'page-delimiter) - (setq page-delimiter - (concat - "^@node [ \t]*[Tt]op\\|^@\\(" - texinfo-chapter-level-regexp - "\\)")) - (make-local-variable 'require-final-newline) - (setq require-final-newline t) - (make-local-variable 'indent-tabs-mode) - (setq indent-tabs-mode nil) - (make-local-variable 'paragraph-separate) - (setq paragraph-separate - (concat "\b\\|^@[a-zA-Z]*[ \n]\\|" paragraph-separate)) - (make-local-variable 'paragraph-start) - (setq paragraph-start - (concat "\b\\|^@[a-zA-Z]*[ \n]\\|" paragraph-start)) - (make-local-variable 'fill-column) - (setq fill-column 72) - (make-local-variable 'comment-start) - (setq comment-start "@c ") - (make-local-variable 'comment-start-skip) - (setq comment-start-skip "@c +\\|@comment +") - (set (make-local-variable 'comment-use-syntax) nil) - (make-local-variable 'words-include-escapes) - (setq words-include-escapes t) - (if (not (boundp 'texinfo-imenu-generic-expression)) - ;; This was introduced in 19.30. - () - (make-local-variable 'imenu-generic-expression) - (setq imenu-generic-expression texinfo-imenu-generic-expression)) - (make-local-variable 'font-lock-defaults) - (setq font-lock-defaults - ;; COMPATIBILITY for Emacs 20 - (if (boundp 'texinfo-font-lock-syntactic-keywords) - '(texinfo-font-lock-keywords - nil nil nil backward-paragraph - (font-lock-syntactic-keywords - . texinfo-font-lock-syntactic-keywords)) - '(texinfo-font-lock-keywords t))) - (if (not (boundp 'texinfo-section-list)) - ;; This was included in 19.31. - () - (make-local-variable 'outline-regexp) - (setq outline-regexp - (concat "@\\(" - (mapconcat 'car texinfo-section-list "\\>\\|") - "\\>\\)")) - (make-local-variable 'outline-level) - (setq outline-level 'texinfo-outline-level)) - - ;; Mostly AUCTeX stuff - (easy-menu-add Texinfo-mode-menu Texinfo-mode-map) - (easy-menu-add Texinfo-command-menu Texinfo-mode-map) - (make-local-variable 'TeX-command-current) - (setq TeX-command-current 'TeX-command-master) - - (setq TeX-default-extension "texi") - (make-local-variable 'TeX-esc) - (setq TeX-esc "@") - - (make-local-variable 'TeX-auto-regexp-list) - (setq TeX-auto-regexp-list 'TeX-auto-empty-regexp-list) - (make-local-variable 'TeX-auto-update) - (setq TeX-auto-update t) - - (setq TeX-command-default "TeX") - (setq TeX-header-end "%*end") - (setq TeX-trailer-start (regexp-quote (concat TeX-esc "bye"))) - - (make-local-variable 'TeX-complete-list) - (setq TeX-complete-list - (list (list "@\\([a-zA-Z]*\\)" 1 'TeX-symbol-list nil) - (list "" TeX-complete-word))) - - (make-local-variable 'TeX-font-list) - (setq TeX-font-list Texinfo-font-list) - (make-local-variable 'TeX-font-replace-function) - (setq TeX-font-replace-function 'TeX-font-replace-macro) - - (add-hook 'find-file-hooks (lambda () - (unless (file-exists-p (buffer-file-name)) - (TeX-master-file nil nil t))) nil t) - - (TeX-add-symbols - '("appendix" (TeX-arg-literal " ") (TeX-arg-free "Title")) - '("appendixsec" (TeX-arg-literal " ") (TeX-arg-free "Title")) - '("appendixsection" (TeX-arg-literal " ") (TeX-arg-free "Title")) - '("appendixsubsec" (TeX-arg-literal " ") (TeX-arg-free "Title")) - '("appendixsubsubsec" (TeX-arg-literal " ") (TeX-arg-free "Title")) - '("asis") - '("author" (TeX-arg-literal " ") (TeX-arg-free "Author")) - '("b" "Text") - '("bullet") - '("bye") - '("c" (TeX-arg-literal " ") (TeX-arg-free "Comment")) - '("center" (TeX-arg-literal " ") (TeX-arg-free "Line of text")) - '("chapheading" (TeX-arg-literal " ") (TeX-arg-free "Title")) - '("chapter" (TeX-arg-literal " ") (TeX-arg-free "Title")) - '("cindex" (TeX-arg-literal " ") (TeX-arg-free "Entry")) - '("cite" "Reference") - '("clear" (TeX-arg-literal " ") (TeX-arg-free "Flag")) - '("code" "Sample code") - '("command" "Command") - '("comment" (TeX-arg-literal " ") (TeX-arg-free "Comment")) - '("contents") - '("copyright" nil) - '("defcodeindex" (TeX-arg-literal " ") (TeX-arg-free "Index name")) - '("defindex" (TeX-arg-literal " ") (TeX-arg-free "Index name")) - '("dfn" "Term") - '("dmn" "Dimension") - '("dots" nil) - '("emph" "Text") - '("email" "Email address") - '("equiv" nil) - '("error") - '("evenfooting" Texinfo-lrc-argument-hook) - '("evenheading" Texinfo-lrc-argument-hook) - '("everyfooting" Texinfo-lrc-argument-hook) - '("everyheading" Texinfo-lrc-argument-hook) - '("exdent" (TeX-arg-literal " ") (TeX-arg-free "Line of text")) - '("expansion" nil) - '("file" "Filename") - '("finalout") - '("findex" (TeX-arg-literal " ") (TeX-arg-free "Entry")) - '("footnote" "Text of footnote") - '("footnotestyle" (TeX-arg-literal " ") (TeX-arg-free "Style")) - '("group") - '("heading" (TeX-arg-literal " ") (TeX-arg-free "Title")) - ;; XXX: Would be nice with completion. - '("headings" (TeX-arg-literal " ") (TeX-arg-free "On off single double")) - '("i" "Text") - '("ignore") - '("include" (TeX-arg-literal " ") (TeX-arg-free "Filename")) - '("inforef" "Node name" "Info file name") - '("item") - '("itemx") - '("kbd" "Keyboard characters") - '("key" "Key name") - '("kindex" (TeX-arg-literal " ") (TeX-arg-free "Entry")) - '("lowersections" 0) - '("majorheading" (TeX-arg-literal " ") (TeX-arg-free "Title")) - '("menu") - '("minus") - '("need" "N") - '("node" (TeX-arg-literal " ") (TeX-arg-free "Name") - (TeX-arg-literal ", ") (TeX-arg-free "Next") - (TeX-arg-literal ", ") (TeX-arg-free "Previous") - (TeX-arg-literal ", ") (TeX-arg-free "Up")) - '("noindent") - '("oddfooting" Texinfo-lrc-argument-hook) - '("oddheading" Texinfo-lrc-argument-hook) - '("page") - '("paragraphindent" (TeX-arg-literal " ") (TeX-arg-free "Indent")) - '("pindex" "Entry") - '("point" nil) - '("print") - '("printindex" (TeX-arg-literal " ") (TeX-arg-free "Index name")) - '("pxref" "Node name") - '("r" "Text") - '("raisesections" 0) - '("ref" "Node name") - '("refill") - '("result") - '("samp" "Text") - '("sc" "Text") - '("section" (TeX-arg-literal " ") (TeX-arg-free "Title")) - '("set" (TeX-arg-literal " ") (TeX-arg-free "Flag")) - ;; XXX: Would be nice with completion. - '("setchapternewpage" (TeX-arg-literal " ") (TeX-arg-free "On off odd")) - '("setfilename" (TeX-arg-literal " ") (TeX-arg-free "Info file name")) - '("settitle" (TeX-arg-literal " ") (TeX-arg-free "Title")) - '("shortcontents") - '("smallbook") - '("sp" "N") - '("strong" "Text") - '("subheading" (TeX-arg-literal " ") (TeX-arg-free "Title")) - '("subsection" (TeX-arg-literal " ") (TeX-arg-free "Title")) - '("subsubheading" (TeX-arg-literal " ") (TeX-arg-free "Title")) - '("subsubsection" (TeX-arg-literal " ") (TeX-arg-free "Title")) - '("subtitle" (TeX-arg-literal " ") (TeX-arg-free "Title")) - '("summarycontents") - '("syncodeindex" (TeX-arg-literal " ") (TeX-arg-free "From index") - (TeX-arg-literal " ") (TeX-arg-free "Into index")) - '("synindex" (TeX-arg-literal " ") (TeX-arg-free "From index") - (TeX-arg-literal " ") (TeX-arg-free "Into index")) - '("t" "Text") - '("TeX" nil) - '("thischapter") - '("thischaptername") - '("thisfile") - '("thispage") - '("tindex" (TeX-arg-literal " ") (TeX-arg-free "Entry")) - '("title" (TeX-arg-literal " ") (TeX-arg-free "Title")) - '("titlefont" "Text") - '("titlepage") - '("today" nil) - '("top" (TeX-arg-literal " ") (TeX-arg-free "Title")) - '("unnumbered" (TeX-arg-literal " ") (TeX-arg-free "Title")) - '("unnumberedsec" (TeX-arg-literal " ") (TeX-arg-free "Title")) - '("unnumberedsubsec" (TeX-arg-literal " ") (TeX-arg-free "Title")) - '("unnumberedsubsubsec" (TeX-arg-literal " ") (TeX-arg-free "Title")) - '("value" "Flag") - '("var" "Metasyntactic variable") - '("vindex" (TeX-arg-literal " ") (TeX-arg-free "Entry")) - '("vskip" (TeX-arg-literal " ") (TeX-arg-free "Amount")) - '("w" "Text") - '("xref" "Node name")) - - (TeX-run-mode-hooks 'text-mode-hook 'Texinfo-mode-hook) - (TeX-set-mode-name)) - -(defcustom Texinfo-clean-intermediate-suffixes nil - "List of regexps matching suffixes of files to be deleted. -The regexps will be anchored at the end of the file name to be matched, -i.e. you do _not_ have to cater for this yourself by adding \\\\' or $." - :type '(repeat regexp) - :group 'TeX-command) - -(defcustom Texinfo-clean-output-suffixes - ;; See `man texi2html' for the HTML stuff. - '("\\.info\\(-[0-9]+\\)?" "\\.dvi" "\\.pdf" "\\.ps" "\\.html" - "_toc\\.html" "_fot\\.html" "_abt\\.html" "_[0-9]+\\.html" "_l2h_img.+") - "List of regexps matching suffixes of files to be deleted. -The regexps will be anchored at the end of the file name to be matched, -i.e. you do _not_ have to cater for this yourself by adding \\\\' or $." - :type '(repeat regexp) - :group 'TeX-command) - -(provide 'tex-info) - -;;; tex-info.el ends here diff --git a/packages/auctex/tex-jp.el b/packages/auctex/tex-jp.el deleted file mode 100644 index 4e3f90c70..000000000 --- a/packages/auctex/tex-jp.el +++ /dev/null @@ -1,624 +0,0 @@ -;;; tex-jp.el --- Support for Japanese TeX. -*- coding: iso-2022-jp-unix; -*- - -;; Copyright (C) 1999, 2001-2007, 2012 Free Software Foundation, Inc. - -;; Author: KOBAYASHI Shinji , -;; Hidenobu Nabetani -;; Maintainer: Masayuki Ataka -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file was written by KOBAYASHI Shinji -;; based on many patches developed by Japanese NetNews community. -;; Japanese message translation by MATUI Takao . - -;;; Code: - -(require 'latex) - -;;; Customization - -(defgroup AUCTeX-jp nil - "Japanese support in AUCTeX." - :group 'AUCTeX) - -(defcustom japanese-TeX-command-list - ;; Changed to double quotes for Windows afflicted people. I don't - ;; use the %(latex) and %(tex) shorthands here because I have not - ;; clue whether Omega-related versions exist. --dak - '(("jTeX" "%(PDF)jtex %`%S%(PDFout)%(mode)%' %t" - TeX-run-TeX nil (plain-tex-mode) :help "Run NTT jTeX") - ("jLaTeX" "%(PDF)jlatex %`%S%(PDFout)%(mode)%' %t" - TeX-run-TeX nil (latex-mode) :help "Run NTT jLaTeX") - ("pTeX" "%(PDF)ptex %`%S%(PDFout)%(mode)%' %t" - TeX-run-TeX nil (plain-tex-mode) :help "Run ASCII pTeX") - ("pLaTeX" "%(PDF)platex %`%S%(PDFout)%(mode)%' %t" - TeX-run-TeX nil (latex-mode) :help "Run ASCII pLaTeX") - ("Mendex" "mendex %s" TeX-run-command nil t :help "Create index file with mendex") - ("jBibTeX" "jbibtex %s" TeX-run-BibTeX nil t :help "Run jBibTeX")) - "Additional list of commands, especially for Japanese. -For detail, see `TeX-command-list', which this list is appended to." - :group 'AUCTeX-jp - :type '(repeat (group :value ("" "" TeX-run-command nil t) - (string :tag "Name") - (string :tag "Command") - (choice :tag "How" - :value TeX-run-command - (function-item TeX-run-command) - (function-item TeX-run-format) - (function-item TeX-run-TeX) - (function-item TeX-run-interactive) - (function-item TeX-run-BibTeX) - (function-item TeX-run-compile) - (function-item TeX-run-shell) - (function-item TeX-run-discard) - (function-item TeX-run-background) - (function-item TeX-run-silent) - (function-item TeX-run-discard-foreground) - (function-item TeX-run-function) - (function :tag "Other")) - (boolean :tag "Prompt") - (choice :tag "Modes" - (const :tag "All" t) - (set (const :tag "Plain TeX" plain-tex-mode) - (const :tag "LaTeX" latex-mode) - (const :tag "DocTeX" doctex-mode) - (const :tag "ConTeXt" context-mode) - (const :tag "Texinfo" texinfo-mode) - (const :tag "AmSTeX" ams-tex-mode))) - (repeat :tag "Menu elements" :inline t sexp)))) - -(setq TeX-command-list - (append japanese-TeX-command-list - '(("-" "" ignore nil t)) ;; separator for command menu - TeX-command-list)) - -(mapc (lambda (dir) (add-to-list 'TeX-macro-global dir t)) - (or (TeX-tree-expand - '("$SYSTEXMF" "$TEXMFLOCAL" "$TEXMFMAIN" "$TEXMFDIST") - "platex" '("/ptex/" "/jbibtex/bst/")) - '("/usr/share/texmf/ptex/" "/usr/share/texmf/jbibtex/bst/"))) - -(mapc (lambda (dir) (add-to-list 'TeX-macro-global dir t)) - (or (TeX-tree-expand - '("$SYSTEXMF" "$TEXMFLOCAL" "$TEXMFMAIN" "$TEXMFDIST") - "jlatex" '("/jtex/" "/jbibtex/bst/")) - '("/usr/share/texmf/jtex/" "/usr/share/texmf/jbibtex/bst/"))) - -;; Menus - -(setq LaTeX-command-style - (append '(("^j-\\(article\\|report\\|book\\)$" - "%(PDF)jlatex %S%(PDFout)") - ("^[jt]s?\\(article\\|report\\|book\\)$" - "%(PDF)platex %S%(PDFout)")) - LaTeX-command-style)) - -(defcustom japanese-TeX-error-messages t - "*If non-nil, explain TeX error messages in Japanese." - :group 'AUCTeX-jp - :type 'boolean) - -(when (featurep 'mule) - -;; FIX-ME (2007-02-09) The default coding system in recent Unix (like Fedora and -;; Ubuntu) is utf-8. But Japanese TeX system is not support utf-8 yet -;; (platex-utf is under development, may be alpha phase). So, -;; process-coding-system for Japanese TeX is not defined from -;; default-coding-system. When platex-utf is out, we should look this setting, -;; again. - -(defcustom TeX-japanese-process-input-coding-system - (cond ((memq system-type '(windows-nt ms-dos cygwin)) 'shift_jis-dos) - ((memq system-type '(mac darwin)) 'shift_jis-mac) - (t 'euc-jp-unix)) - "TeX-process' coding system with standard input." - :group 'AUCTeX-jp - :type 'coding-system) - -(defcustom TeX-japanese-process-output-coding-system - (cond ((memq system-type '(windows-nt ms-dos cygwin)) 'shift_jis-dos) - ((memq system-type '(mac darwin)) 'shift_jis-mac) - (t 'euc-jp-unix)) - "TeX-process' coding system with standard output." - :group 'AUCTeX-jp - :type 'coding-system) - -) - -(defcustom japanese-TeX-command-default "pTeX" - "*The default command for `TeX-command' in the japanese-TeX mode." - :group 'AUCTeX-jp - :type 'string) - (make-variable-buffer-local 'japanese-TeX-command-default) - -(defcustom japanese-LaTeX-command-default "LaTeX" - "*The default command for `TeX-command' in the japanese-LaTeX mode." - :group 'AUCTeX-jp - :type 'string) - (make-variable-buffer-local 'japanese-LaTeX-command-default) - -(defcustom japanese-LaTeX-default-style "jarticle" - "*Default when creating new Japanese documents." - :group 'AUCTeX-jp - :type 'string) - -(defcustom japanese-LaTeX-style-list - '(("j-article") - ("j-report") - ("j-book") - ("jslides") - ("jarticle") - ("jreport") - ("jbook") - ("tarticle") - ("treport") - ("tbook") - ("jsarticle") - ("jsbook")) - "*List of Japanese document styles." - :group 'AUCTeX-jp - :type '(repeat (group (string :format "%v")))) - -(setq LaTeX-style-list - (append japanese-LaTeX-style-list LaTeX-style-list)) - -;;; Coding system - -(when (featurep 'mule) - -(defun japanese-TeX-set-process-coding-system (process) - "Set proper coding system for japanese TeX PROCESS." - (if (with-current-buffer TeX-command-buffer japanese-TeX-mode) - (set-process-coding-system process - TeX-japanese-process-output-coding-system - TeX-japanese-process-input-coding-system))) -(setq TeX-after-start-process-function - 'japanese-TeX-set-process-coding-system) -) - -;;; Japanese TeX modes - -(defvar japanese-TeX-mode nil - "Non-nil means the current buffer handles Japanese TeX/LaTeX.") -(make-variable-buffer-local 'japanese-TeX-mode) -(put 'japanese-TeX-mode 'permanent-local t) - -;;;###autoload -(defun japanese-plain-tex-mode () - "Major mode in AUCTeX for editing Japanese plain TeX files. -Set `japanese-TeX-mode' to t, and enter `TeX-plain-tex-mode'." - (interactive) - (setq japanese-TeX-mode t) - (TeX-plain-tex-mode)) - -(defun japanese-plain-tex-mode-initialization () - "Japanese plain-TeX specific initializations." - (when japanese-TeX-mode - (setq TeX-command-default japanese-TeX-command-default))) - -(add-hook 'plain-TeX-mode-hook 'japanese-plain-tex-mode-initialization) - -;;;###autoload -(defun japanese-latex-mode () - "Major mode in AUCTeX for editing Japanese LaTeX files. -Set `japanese-TeX-mode' to t, and enter `TeX-latex-mode'." - (interactive) - (setq japanese-TeX-mode t) - (TeX-latex-mode)) - -(defun japanese-latex-mode-initialization () - "Japanese LaTeX specific initializations." - (when japanese-TeX-mode - (setq TeX-command-default japanese-LaTeX-command-default) - (setq LaTeX-default-style japanese-LaTeX-default-style) - (setq TeX-command-BibTeX "jBibTeX"))) - -(add-hook 'LaTeX-mode-hook 'japanese-latex-mode-initialization) - - -;;; Support for various self-insert-command - -(fset 'japanese-TeX-self-insert-command - (cond ((fboundp 'can-n-egg-self-insert-command) - 'can-n-egg-self-insert-command) - ((fboundp 'egg-self-insert-command) - 'egg-self-insert-command) - ((fboundp 'canna-self-insert-command) - 'canna-self-insert-command) - (t - 'self-insert-command))) - -(defun TeX-insert-punctuation () - "Insert point or comma, cleaning up preceding space." - (interactive) - (expand-abbrev) - (if (TeX-looking-at-backward "\\\\/\\(}+\\)" 50) - (replace-match "\\1" t)) - (call-interactively 'japanese-TeX-self-insert-command)) - -;;; Error Messages - -(if japanese-TeX-error-messages -(setq TeX-error-description-list - '(("Bad \\\\line or \\\\vector argument.*" . -"$B@~$N79$-$r;XDj$9$k!$(B\\line$B$^$?$O(B\\vector$B$N:G=i$N0z?t$,IT@5$G$9!%(B") - - ("Bad math environment delimiter.*" . -"$B?t<0%b!<%ICf$G?t<0%b!<%I3+;O%3%^%s%I(B\\[$B$^$?$O(B\\($B!$$^$?$O!$?t<0%b!<%I30$G(B -$B?t<0%b!<%I=*N;%3%^%s%I(B\\]$B$^$?$O(B\\)$B$r(BTeX$B$,8+$D$1$^$7$?!%$3$NLdBj$O!$?t<0%b!<(B -$B%I$N%G%j%_%?$,%^%C%A$7$F$$$J$+$C$?$j!$3g8L$N%P%i%s%9$,$H$l$F$$$J$+$C$?$j$9(B -$B$k$?$a$K@8$8$^$9!%(B") - - ("Bad use of \\\\\\\\.*" . -"\\\\$B%3%^%s%I$,%Q%i%0%i%UCf$K$"$j$^$7$?!%$3$N;H$$$+$?$OL50UL#$G$9!%(B -$B$3$N%(%i!<%a%C%;!<%8$O(B\\\\$B$,(Bcentering$B4D6-$d(Bflushing$B4D6-$G;H$o$l$?(B -$B;~!$$"$k$$$O(Bcentering/flushing$B@k8@$,M-8z$J$H$3$m$G;H$o$l$?;~$K@8$8$^$9!%(B") - - ("\\\\begin{[^ ]*} ended by \\\\end{[^ ]*}." . -"$BBP1~$9$k(B\\begin$BL?Na$N$J$$(B\\end$BL?Na$r(BLaTeX$B$,8+$D$1$^$7$?!%(B\\end$BL?Na$N4D(B -$B6-L>$r4V0c$($?$+!$M>J,$J(B\\begin$BL?Na$,$"$k$+!$(B\\end$BL?Na$r$o$9$l$?$+$N$$$:(B -$B$l$+$G$7$g$&!%(B") - - ("Can be used only in preamble." . -"$B%W%j%"%s%V%k$G$7$+;H$($J$$(B\\documentclass$B!&(B\\nofiles$B!&(B\\includeonly -\\makeindex$B!&(B\\makeglossary$B$N$&$A$N$$$:$l$+$,(B\\begin{document}$B$h$j$b(B -$B8e$G;H$o$l$F$$$k$N$r(BLaTeX$B$,8!=P$7$^$7$?!%$3$N%(%i!<$O(B\\begin{document} -$B$,M>J,$K$"$C$?;~$K$b@8$8$^$9!%(B") - - ("Command name [^ ]* already used.*" . -"$B$9$G$KDj5A$5$l$F$$$kL?NaL>$^$?$O4D6-L>$KBP$7$F(B\\newcommand$B!&(B -\\newenvironment$B!&(B\\newlength$B!&(B\\newsavebox$B!&(B\\newtheorem$B$N$&$A$N$$$:(B -$B$l$+$rA0$NL?Na$,<+F0(B -$BE*$KDj5A$5$l$k$N$G!$4{$KB8:_$9$k4D6-$HF1L>$NL?Na$ODj5A$G$-$^$;$s(B)$B!%?7(B -$B$7$$L>A0$r9M$($k$+!$(B\\newcommand$B$+(B\\newenvironment$B$N>l9g$J$iBP1~$9$k(B -\\renew...$BL?Na$r;H$o$J$1$l$P$J$j$^$;$s!%(B") - - ("Counter too large." . -"1. $BJ8;z$G=g=xIU$1$5$l$?$b$N!$$?$V$sHV9fIU$1$5$l$?%j%9%H4D6-$N%i%Y%k$,!$(B -26$B$h$j$bBg$-$$HV9f$ro$KD9$$%j%9%H$r;H$C$F$$$k$+!$(B -$B%+%&%s%?$r:F@_Dj$7$F$7$^$C$?$+$N$$$:$l$+$G$7$g$&!%(B - -2. $B5SCm$,J8;z$^$?$O5SCm5-9f$G=g=x$E$1$5$l$F$$$^$9$,!$J8;z$^$?$O5-9f$r(B -$B;H$$@Z$C$F$7$^$$$^$7$?!%$*$=$i$/(B\\thanks$BL?Na$N;H$$$9$.$G$9!%(B") - - - ("Environment [^ ]* undefined." . -"$BDj5A$5$l$F$$$J$$4D6-$KBP$9$k(B\\begin$BL?Na$r(BLaTeX$B$,8+$D$1$^$7$?!%$*$=$i$/(B -$B4D6-L>$r4V0c$($?$N$G$7$g$&!%(B") - - ("Float(s) lost." . -"parbox$B$N$J$+$K(Bfigure$B4D6-!&(Btable$B4D6-$^$?$O(B\\marginpar$BL?Na$,$"$j$^$7$?(B -\($B$J$*!$(Bparbox$B$O(Bminipage$B4D6-$+(B\\parbox$BL?Na$K$h$C$F:n$i$l$k$+!$5SCm$d?^(B -$B$J$I$KBP$7$F(BLaTeX$B$,@8@.$9$k$b$N$G$9(B\)$B!%$3$l$O=PNO;~$N%(%i!<$J$N$G!$860x(B -$B$H$J$C$F$$$k4D6-$"$k$$$OL?Na$O!$(BLaTeX$B$,LdBj$rH/8+$7$?>l=j$h$j$b$@$$$V(B -$B$sA0$K$"$k2DG=@-$,$"$j$^$9!%=PNO$5$l$F$$$J$$?^!&I=!&K5Cm$J$I$,$$$/$D$+(B -$B$"$k$+$b$7$l$^$;$s$,!$$=$l$i$,860x$G$"$k$H$O8B$j$^$;$s!%(B") - - ("Illegal character in array arg." . -"array$B4D6-$^$?$O(Btabular$B4D6-$N0z?t!$$^$?$O(B\\multicolumn$BL?Na$NBh(B2$B0z?t(B -$B$NCf$KIT@5$JJ8;z$,$"$j$^$7$?!%(B") - - ("Missing \\\\begin{document}." . -"\\begin{document}$BL?Na$h$jA0$K(BLaTeX$B$,=PNO$r9T$J$C$F$7$^$$$^$7$?!%(B -\\begin{document}$BL?Na$rK:$l$?$+!$%W%j%"%s%V%k$K2?$+4V0c$$$,$"$k$N$G$7$g$&!%(B -$BBG$A4V0c$$$K$h$kJ8;z$d!$@k8@$N8m$j$K$h$k2DG=@-$b$"$j$^$9!%Nc$($P!$0z?t$r(B -$B0O$`3g8L$rH4$+$7$?$H$+!$L?NaL>$N(B\\$B$rK:$l$?>l9g$J$I$G$9!%(B") - - ("Missing p-arg in array arg.*" . -"array$B4D6-!&(Btabular$B4D6-$N0z?t!$$"$k$$$O(B\\multicolumn$BL?Na$NBh(B2$B0z?t$NCf$K!$(B -$B3g8L$K0O$^$l$?I=8=$N$D$$$F$$$J$$(Bp$B$,$"$j$^$7$?!%(B") - - ("Missing @-exp in array arg." . -"array$B4D6-!&(Btabular$B4D6-$N0z?t!$$"$k$$$O(B\\multicolumn$BL?Na$NBh(B2$B0z?t$NCf$K!$(B -@$BI=8=$N$D$$$F$$$J$$(B@$B$,$"$j$^$7$?!%(B") - - ("No such counter." . -"\\setcounter$BL?Na$^$?$O(B\\addtocounter$BL?Na$G!$B8:_$7$J$$%+%&%s%?$,;XDj$5$l(B -$B$^$7$?!%$*$=$i$/$?$@$N%?%$%W%_%9$G$7$g$&!%$?$@$7!$%(%i!<$,(Baux$B%U%!%$%k$NCf(B -$B$G@8$8$?>l9g$O!$(B\\newcounter$BL?Na$r%W%j%"%s%V%k$N30$G;H$C$?$N$@$H;W$o$l$^$9!%(B") - - ("Not in outer par mode." . -"figure$B4D6-!&(Btable$B4D6-$"$k$$$O(B\\marginpar$BL?Na$,?t<0%b!<%I$^$?$O(Bparbox$B$NCf(B -$B$G;H$o$l$^$7$?!%(B") - - ("\\\\pushtabs and \\\\poptabs don't match." . -"\\pushtabs$B$HBP1~$7$J$$(B\\poptabs$B$,$_$D$+$C$?$+!$$^$?$O!$BP1~$9$k(B\\poptabs -$B$r$b$?$J$$(B\\pushtabs$B$,$"$k$N$K(B\\end{tabbing}$B$,8=$l$F$7$^$$$^$7$?!%(B") - - ("Something's wrong--perhaps a missing \\\\item." . -"$B%j%9%H4D6-$NCf$K(B\\item$BL?Na$,$J$$$N$,:G$b$"$j$=$&$J%1!<%9$G$9!%(B -thebibliography$B4D6-$G0z?t$rK:$l$?>l9g$K$b@8$8$^$9!%(B") - - ("Tab overflow." . -"\\=$B$,!$(BLaTeX$B$G5v$5$l$k%?%V%9%H%C%W$N:GBg?t$rD6$($F$$$^$9!%(B") - - ("There's no line here to end." . -"\\newline$BL?Na$^$?$O(B\\\\$BL?Na$,%Q%i%0%i%U4V$K$"$j$^$9!%$3$N;H$$$+$?$O(B -$BL50UL#$G$9!%$b$76u9T$r$"$1$?$$$N$G$7$?$i!$(B\\vspace$B$r;H$C$F$/$@$5$$!%(B") - - ("This may be a LaTeX bug." . -"$B$^$C$?$/$o$1$,$o$+$i$J$/$J$C$F$7$^$$$^$7$?!%$?$V$s$3$l0JA0$K8!=P$5$l$?(B -$B%(%i!<$N$;$$$@$H;W$o$l$^$9!%$7$+$7!$(BLaTeX$B<+BN$N%P%0$G$"$k2DG=@-$b$"$j$^$9!%(B -$B$b$7$3$N%(%i!<$,F~NO%U%!%$%k$KBP$9$k:G=i$N%(%i!<$G$"$j!$2?$b4V0c$$$,8+$D(B -$B$+$i$J$$>l9g$O!$$=$N%U%!%$%k$rJ]B8$7$F!$%m!<%+%k%,%$%I$K=q$+$l$F$$$k@UG$(B -$B/$J$/$H$b(B4$BCJ3,$^$G$O5v$5$l$F$$$^$9(B($BIaDL$O(B -$B$=$l$G==J,$G$7$g$&(B)$B!%(B") - - ("Too many unprocessed floats." . -"$B$3$N%(%i!<$O(B1$B%Z!<%8Cf$N(B\\marginpar$BL?Na$,B?$9$.$k$?$a$K@8$8$k>l9g$b$"(B -$B$j$^$9$,!$$b$C$H$"$j$=$&$J$N$O!$8B3&$rD6$($F?^$dI=$rJ]B8$7$h$&$H$7$?>l(B -$B9g$G$9!%D9$$J8=q$rAHHG$7$F$$$/$H$-!$(BLaTeX$B$O?^$dI=$r8D!9$KJ]B8$7!$%Z!<(B -$B%8$NJ,3d$r9T$J$&;~$K$=$l$i$rA^F~$7$^$9!%$3$N%(%i!<$O!$%Z!<%8$X$NJ,3d$,(B -$B9T$J$o$l$kA0$K!$$"$^$j$K$bB?$/$N(Bfigure$B4D6-$d(Btable$B4D6-$,8+$D$+$C$?>l9g(B -$B$K@8$8$^$9!%$3$NLdBj$O4D6-$N$&$A$N$$$/$D$+$rJ8=q$N=*$o$j$NJ}$K0\F0$9$l(B -$B$P2r7h$G$-$^$9!%$^$?!$$3$N%(%i!<$O(B``logjam''$B$K$h$C$F@8$8$k$3$H$b$"$j$^(B -$B$9!%(B``logjam''$B$H$O!$(BLaTeX$B$,=P8==g=xDL$j$K$7$+?^I=$r=PNO$G$-$J$$$;$$$G!$(B -$B$D$^$C$F$$$k8e$m$N?^I=$N$?$a$KA0$N?^I=$r=PNO$G$-$J$/$J$k$3$H$r$$$$$^$9!%(B -$B$3$N%8%c%`$N860x$O!$Bg$-$9$.$F(B1$B%Z!<%8$J$$$7$O;XDj$5$l$?NN0h$K<}$^$i$J(B -$B$$$h$&$J?^$dI=$G$"$k2DG=@-$,$"$j$^$9!%$3$l$O!$0z?t$K(Bp$B%*%W%7%g%s$,;XDj(B -$B$5$l$F$$$J$$$H5/$-$d$9$/$J$j$^$9!%(B") - - ("Undefined tab position." . -"\\>$B!&(B\\+$B!&(B\\-$B$^$?$O(B\\<$BL?Na$G!$B8:_$7$J$$%?%V0LCV!$$9$J$o$A(B\\=$BL?Na$GDj(B -$B5A$5$l$F$$$J$$%?%V0LCV$r;XDj$7$h$&$H$7$F$$$^$9!%(B") - - ("\\\\< in mid line." . -"\\<$BL?Na$,(Btabbing$B4D6-$N9T$NESCf$K8=$l$^$7$?!%$3$NL?Na$O9T$N@hF,$K$J$1$l$P(B -$B$J$j$^$;$s!%(B") - - ("Double subscript." . -"$B?t<0Cf$N(B1$B$D$NNs$K(B2$B$D$N2eIU$-J8;z$,$D$$$F$$$^$9!%Nc$($P(Bx^{2}^{3}$B$N$h$&$K!%(B -$B$3$N$h$&$JI=8=$OL50UL#$G$9!%(B") - - ("Extra alignment tab has been changed to \\\\cr." . -"array$B4D6-$^$?$O(Btabular$B4D6-$N(B1$BNsCf$K$"$k9`L\$,B?$9$.$^$9!%8@$$49$($k$H!$(B -$BNs$N=*$o$j$^$G$K$"$k(B&$B$N?t$,B?$9$.$^$9!%$*$=$i$/A0$NNs$N:G8e$K(B\\\\$B$r$D$1(B -$B$k$N$rK:$l$?$N$G$7$g$&!%(B") - - ("Extra \\}, or forgotten \\$." . -"$B3g8L$^$?$O?t<0%b!<%I$N%G%j%_%?$,@5$7$/BP1~$7$F$$$^$;$s!%$*$=$i$/(B{$B!&(B\\[$B!&(B -\\($B$"$k$$$O(B$$B$N$&$A$N$$$:$l$+$r=q$-K:$l$?$N$G$7$g$&!%(B") - - ("Font [^ ]* not loaded: Not enough room left." . -"$B$3$NJ8=q$O8B3&$h$j$bB?$/$N%U%)%s%H$r;H$C$F$$$^$9!%$b$7J8=q$NItJ,$4$H$K(B -$BJL!9$N%U%)%s%H$,;H$o$l$F$$$k$N$J$i!$J,3d$7$F=hM}$9$l$PLdBj$O2r7h$5$l$^$9!%(B") - - ("I can't find file `.*'." . -"$BI,MW$J%U%!%$%k$,8+$D$+$j$^$;$s$G$7$?!%$b$78+$D$+$i$J$$%U%!%$%k$N3HD%;R(B -$B$,(Btex$B$N>l9g!$$"$J$?$,;XDj$7$?%U%!%$%k!$$9$J$o$A%a%$%s%U%!%$%k$^$?$O(B -\\input$BL?Na!&(B\\include$BL?Na$GA^F~$5$l$k%U%!%$%k$,8+$D$+$i$J$$$N$G$9!%(B -$B3HD%;R$,(Bsty$B$G$"$l$P!$B8:_$7$J$$J8=q%9%?%$%k$^$?$O%9%?%$%k%*%W%7%g%s$r(B -$B;XDj$7$h$&$H$7$F$$$^$9!%(B") - - ("Illegal parameter number in definition of .*" . -"$B$3$l$O$*$=$i$/!$(B\\newcommand$B!&(B\\renewcommand$B!&(B\\newenvironment$B$^$?$O(B -\\renewenvironment$BL?Na$N$J$+$G(B#$B$,@5$7$/;H$o$l$J$+$C$?$?$a$K@8$8$?%(%i!<(B -$B$G$9!%(B\\#$BL?Na$H$7$F;H$o$l$k>l9g$r=|$1$P!$(B#$B$H$$$&J8;z$O!$Nc$($P(B2$BHVL\$N(B -$B0z?t$r;XDj$9$k(B#2$B$N$h$&$K!$0z?t%Q%i%a!<%?$H$7$F$7$+;H$($^$;$s!%$^$?!$(B -$B$3$N%(%i!<$O!$>e$K$"$2$?(B4$B$D$N%3%^%s%I$,$*8_$$$KF~$l;R$K$J$C$F$$$k>l9g(B -$B$d!$(B\\newenvironment$BL?Na!&(B\\renewenvironment$BL?Na$G(B#2$B$N$h$&$J%Q%i%a!<%?(B -$B$,:G8e$N0z?t$NCf$G;H$o$l$F$$$k>l9g$K$b@8$8$^$9!%(B") - - ("Illegal unit of measure ([^ ]* inserted)." . -"$B$b$7(B - ! Missing number, treated as zero. -$B$H$$$&%(%i!<$,5/$-$?D>8e$G$"$l$P!$$3$N%(%i!<$N860x$b$=$l$HF1$8$G$9!%(B -$B$=$&$G$J$$>l9g$O!$(BLaTeX$B$,0z?t$H$7$F(Blength$B$r4|BT$7$F$$$k$N$K(Bnumber$B$,(B -$B8=$l$?$3$H$r0UL#$7$F$$$^$9!%$3$N%(%i!<$N:G$b$"$j$,$A$J860x$OD9$5(B0$B$r(B -$BI=$o$9(B0in$B$N$h$&$JI=8=$NBe$o$j$K(B0$B$H$+$$$F$7$^$&$3$H$K$"$j$^$9!%$?$@$7!$(B -$BL?Na$N0z?t$r=q$-K:$l$?>l9g$K$b$3$N%(%i!<$,@8$8$k$3$H$,$"$j$^$9!%(B") - - ("Misplaced alignment tab character \\&." . -"array$B$^$?$O(Btabular$B4D6-$G$N9`L\6h@Z$j$K$N$_;H$o$l$k$Y$-J8;z(B&$B$,IaDL$NJ8(B -$B$NCf$K$"$j$^$7$?!%$?$V$s(B\\&$B$HF~NO$7$?$+$C$?$N$G$7$g$&!%(B") - - ("Missing control sequence inserted." . -"$B$3$N%(%i!<$O!$$*$=$i$/L?NaL>$G$J$$$b$N$r(B\\newcommand$B!&(B\\renewcommand$B!&(B -\\newlength$B$^$?$O(B\\newsavebox$B$NBh(B1$B0z?t$H$7$F;H$C$?$?$a$K@8$8$?$N$G$7$g$&!%(B") - - ("Missing number, treated as zero." . -"$B$3$N%(%i!<$O$?$$$F$$!$0z?t$H$7$F(Bnumber$B$^$?$O(Blength$B$rI,MW$H$7$F$$$kL?Na$K(B -$BBP$7$F0z?t$,M?$($i$l$J$+$C$?$?$a$K@8$8$^$9!%0z?t$r=q$-K:$l$?$N$+!$%F%-%9%H(B -$B$NCf$NBg3g8L(B([])$B$,%*%W%7%g%s0z?t$N;XDj$H4V0c$($i$l$F$7$^$C$?$+$N$I$A$i$+$G(B -$B$7$g$&!%$^$?!$?t$r@8@.$9$k(B\\value$B$N$h$&$JL?Na$d(Blength$BL?Na$NA0$K(B\\protect$B$r(B -$BCV$$$?>l9g$K$b$3$N%(%i!<$O@8$8$^$9!%(B") - - ("Missing [{}] inserted." . -"TeX$B$O4{$K$o$1$,$o$+$i$J$/$J$C$F$$$^$9!%%(%i!<%a%C%;!<%8$K$h$C$F<($5$l$F(B -$B$$$k>l=j$O$?$V$sF~NO$K4V0c$$$,$"$C$?$H$3$m$h$j$b8e$m$K$J$C$F$7$^$C$F$$$k(B -$B$G$7$g$&!%(B") - - ("Missing \\$ inserted." . -"$B$*$=$i$/!$?t<0%b!<%ICf$G$7$+;H$($J$$L?Na$r(BTeX$B$,?t<0%b!<%I30$G8!=P$7$?(B -$B$N$@$H;W$o$l$^$9!%FC$K5-=R$5$l$F$$$J$$8B$j!$(BLaTeX Book(Lamport$BCx(B,$BLu=q(B -$B$O%"%9%-!<=PHG(B)$B$N(B3.3$B@a$K$"$kE:;z!&J,?t!&?t3X5-9f$J$I$N%3%^%s%I$O$9$Y$F(B -$B?t<0%b!<%I$G$7$+;H$($J$$$N$@$H$$$&$3$H$KCm0U$7$F$/$@$5$$!%$?$H$(L?Na$,(B -$B?t<04D6-$NCf$K$"$C$?$H$7$F$b!$(Bbox$B$r@8@.$9$kL?Na$N0z?t$r=hM}$7$O$8$a$?(B -$B;~E@$G$O!$(BTeX$B$O$^$@?t<0%b!<%I$KF~$C$F$$$J$$$N$G$9!%$^$?!$$3$N%(%i!<$O!$(B -$B?t<0%b!<%ICf$G(BTeX$B$,6u9T$r8!=P$7$?>l9g$K$b@8$8$^$9!%(B") - - ("Not a letter." . -"\\hyphenation$BL?Na$N0z?t$NCf$K$J$K$+@5$7$/$J$$$b$N$,$"$j$^$9!%(B") - - ("Paragraph ended before [^ ]* was complete." . -"$BL?Na$N0z?t$NCf$KIT@5$J6u9T$,F~$C$F$7$^$C$F$$$^$9!%$*$=$i$/0z?t$N=*$o$j(B -$B$KJD$83g8L$r$D$1$k$N$rK:$l$?$N$G$7$g$&!%(B") - - ("\\\\[^ ]*font [^ ]* is undefined .*" . -"$B$3$N%(%i!<$O$"$^$j0lHLE*$G$J$$%U%)%s%H$,?t<0%b!<%I$G;H$o$l$?;~$K@8$8(B -$B$^$9!%Nc$($P!$5SCm$NCf$N?t<0$G(B\\sc$BL?Na$,;H$o$l$k$H!$(Bfootnotesize$B$N(B -small caps$B%U%)%s%H$,8F$S$@$5$l$k$3$H$K$J$j$^$9!%$3$NLdBj$O(B\\load$BL?Na$r(B -$B;H$($P2r7h$G$-$^$9!%(B") - - ("Font .* not found." . -"$BL$CN$N(Bfamily/series/shape/size$B$NAH$_9g$o$;$N%U%)%s%H$,;XDj$5$l$^$7$?!%(B -$B$3$N%(%i!<$,5/$-$k%1!<%9$O(B2$B$D9M$($i$l$^$9!%(B - 1) \\size$B%^%/%m$G;H$($J$$%5%$%:$rA*Br$7$h$&$H$7$?!%(B - 2) $B$=$&$G$J$1$l$P!$4IM}l9g$I$&$9$l(B -$B$P$$$$$N$+$rH=CG$9$kJ}K!$r0J2<$K@bL@$7$^$9!%$b$7LdBj$,F~NO%U%!%$%kCf$N(B -$B%(%i!<$K$"$k>l9g$O!$8D!9$N%(%i!<$r2r7h$7$F$$$/J}K!$r$H$k$N$,$h$$$G$7$g(B -$B$&!%(BLaTeX$B$,C;$$%U%!%$%k$G%a%b%j$r;H$$$-$k$3$H$O$a$C$?$K$"$j$^$;$s$+$i!$(B -$B%(%i!<$N5/$-$?0LCV$h$jA0$K=hM}$7$?%Z!<%8$,?t%Z!<%8$7$+$J$1$l$P!$$^$:4V(B -$B0c$$$J$/F~NO%U%!%$%k$KLdBj$,$"$k$O$:$G$9!%(B - -$B%(%i!<%a%C%;!<%8$N:G8e$K!$(BTeX$B$,;H$$$-$C$F$7$^$C$?%a%b%j$NO@a!&(B\\caption$B!&(B\\addcontentsline$B$"$k$$$O(B\\addtocontents$BL?Na$N0z?t$H(B -$B$7$FM?$($?%F%-%9%H$,D9$9$.$k>l9g$K@8$8$k$3$H$,$"$j$^$9!%$3$N%(%i!<$O(B -$B$?$$$F$$(B\\end{document}$B$r=hM}$7$F$$$k;~$K@8$8$^$9$,!$(B\\tableofcontents$B!&(B -\\listoffigures$B$"$k$$$O(B\\listoftables$BL?Na$rl9g$K$b5/$-$k(B -$B$3$H$,$"$j$^$9!%$3$NLdBj$r2r7h$9$k$K$O!$$b$C$HC;$$%F%-%9%H$r%*%W%7%g%s(B -$B0z?t$H$7$FM?$($F$/$@$5$$!%L\e$K%O%$%U%M!<%7%g%s>pJs$rM?$($h$&$H$7$F$$$^$9!%(B -$B$"$^$j;H$o$J$$C18l$N(B\\hyphenation$BL?Na$r$NDj5A$^$?$OAj8_;2>H%i%Y%k$NDj5A$,B?$9$.$^$9!%(B - -input stack size -================ -$B$3$N%(%i!<$O$*$=$i$/L?NaDj5ACf$N8m$j$K$h$k$b$N$G$9!%Nc$($P!$l9g$N$$$:$l$+$G$9!%(B -\(1\)$BHs>o$KD9$/J#;($JL?Na$r?tB?$/Dj5A$7$?!%(B(2)index$B$^$?$O(Bglossary$B$r:n$C(B -$B$F$$$k$H$-!$(B1$B%Z!<%8Cf$K$"$^$j$K$bB?$/$N(B\\index$B$^$?$O(B\\glossary$BL?Na$,$"(B -$B$k!%(B(3)$B@8@.$N$?$a$N>pJs$r(BTeX$B$,J];}$7$-$l$J$$$h$&$J!$$"$^$j$K$bJ#;($J%Z!<(B -$B%8$r@8@.$7$h$&$H$7$?!%:G=i$N(B2$B$D$NLdBj$N2r7hJ}K!$OL@$i$+$G$9!%L?NaDj5A(B -$B$N?t$"$k$$$O(B\\index$B!&(B\\glossary$BL?Na$N?t$r8:$i$9$3$H$G$9!%(B3$BHVL\$NLdBj$O(B -$B$A$g$C$HLq2p$G$9!%$3$l$O!$Bg$-$J(Btabbing$B!&(Btabular$B!&(Barray$B!&(Bpicture$B4D6-$N(B -$B$;$$$G@8$8$k$3$H$,$"$j$^$9!%=PNO0LCV$,7hDj$5$l$k$N$rBT$C$F$$$k?^$dI=$G(B -TeX$B$N%a%b%j$,$$$C$Q$$$K$J$C$F$$$k$N$+$b$7$l$^$;$s!%K\Ev$K(BTeX$B$NMFNL$rD6(B -$B$($F$7$^$C$?$N$+$I$&$+D4$Y$k$?$a$K$O!$%(%i!<$N5/$3$C$?>l=j$ND>A0$K(B -\\clearpage$BL?Na$rF~$l$F$b$&0lEY%3%s%Q%$%k$rM5$,$G$-$k$+$b$7$l$^$;$s(B(\\pagebreak$BL?Na$G$O$@$a$G$9(B)$B!%$b$7?^$dI=(B -$B$,N/$^$C$F$$$k$3$H$,LdBj$J$N$J$i$P!$?^I=$r$b$C$H8e$m$NJ}$K0\F0$9$k$H$+!$(B -$B$"$k$$$O$b$C$HA0$N;~E@$G=PNO$5$l$k$h$&$K$9$l$P2sHr$G$-$^$9!%$b$7$^$@J8(B -$B=q$r:n@.$7$F$$$kESCf$J$i!$$H$j$"$($:(B\\clearpage$BL?Na$rF~$l$F$*$$$F!$:G(B -$B=*HG$r:n$k;~$^$G$3$NLdBj$OC*>e$2$7$F$*$-$^$7$g$&!%F~NO%U%!%$%k$,JQ$o$k(B -$B$HLdBj$,2r>C$5$l$k>l9g$b$"$k$N$G$9!%(B - -pool size -========= -$BAj8_;2>H$N(B\\label$B$,B?$9$.$k$+!$L?Na$NDj5A$,B?$9$.$k$+$N$I$A$i$+$G$9!%(B -$B@53N$K$$$($P!$Dj5A$7$?%i%Y%kL>$*$h$SL?NaL>$K;H$C$?J8;z?t$,B?$9$.$k$H$$(B -$B$&$3$H$G$9!%$G$9$+$i!$$b$C$HC;$$L>A0$r;H$($P$3$NLdBj$O2r7h$7$^$9!%$?$@(B -$B$7!$$3$N%(%i!<$O!$(B\\setcounter$B$J$I$N%+%&%s%?L?Na$d(B\\newenvironment$B!&(B -\\newtheorem$BL?Na$N0z?t$N=*$o$j$r<($91&3g8L$rK:$l$?>l9g$K$b@8$8$^$9!%(B - -save size -========= -$B$3$N%(%i!<$O!$@k8@$NM-8zHO0O$dL?Na!&4D6-$,$"$^$j$K$b?<$/F~$l;R$K$J$C$F(B -$B$$$k>l9g$K@8$8$^$9!%$?$H$($P!$(B\\multiput$BL?Na$N0z?t$K(Bpicture$B4D6-$,$"$j!$(B -$B$=$N$J$+$K(B\\footnotesize$B@k8@$,$"$j!$$=$N@k8@$NM-8zHO0O$K(B\\multiput$BL?Na(B -$B$,$"$C$F!$$=$N0z?t$K(B... $B$H$$$&$h$&$J>l9g$G$9!%(B") - - ("Text line contains an invalid character." . -"$BF~NOCf$KIT@5$JJ8;z$,4^$^$l$F$$$^$9!%%U%!%$%k:n@.$N8m$j$K$h$C$F%F%-%9%H(B -$B%(%G%#%?$,$3$NJ8;z$rA^F~$7$F$7$^$C$?$N$G$7$g$&!%l9g$K$O%m!<%+%k%,%$%I$r8+$F$/$@$5$$!%(B") - - ("Undefined control sequence." . -"TeX$B$,L$Dj5A$NL?NaL>$rH/8+$7$^$7$?!%$*$=$i$/F~NO$N8m$j$G$7$g$&!%$b$7$3(B -$B$N%(%i!<$,(BLaTeX$BL?Na$N=hM}Cf$K@8$8$?>l9g$O!$$=$NL?Na$O4V0c$C$?0LCV$KCV$+(B -$B$l$F$$$^$9!%Nc$($P!$%j%9%H4D6-$NCf$G$J$$$N$K(B\\item$BL?Na$,;H$o$l$?>l9g$J$I(B -$B$G$9!%$^$?!$(B\\documentclass$BL?Na$,$J$$>l9g$K$b$3$N%(%i!<$,@8$8$^$9!%(B") - - ("Use of [^ ]* doesn't match its definition." . -"$B$*$=$i$/IA2h$N$?$a$NL?Na$@$H;W$o$l$^$9$,!$0z?t$N;H$$$+$?$,4V0c$C$F$$(B -$B$^$9!%4V0c$C$F$$$k$N$,(B\\@array$BL?Na$N>l9g$O!$(Barray$B4D6-$+(Btabular$B4D6-$G$N(B -@$BI=8=$N0z?t$K$J$K$+8m$j$,$"$k$N$G$7$g$&!%(Bfragile$B$JL?Na$,(B\\protect$B$5$l$F(B -$B$$$J$$$N$+$b$7$l$^$;$s!%(B") - - ("You can't use `macro parameter character \\#' in [^ ]* mode." . -"$BFCl=j$,8+$D$+$i$J$+$C$?$N$G!$(B1$B9T$K<}$^$k$Y$-J,NL0J>e(B -$B$N=PNO$,9T$J$o$l$F$7$^$$$^$7$?!%(B") - - ("Overfull \\\\vbox .*" . -"$B%Z!<%8J,3d$N$?$a$NE,@Z$J>l=j$,8+$D$+$i$J$+$C$?$N$G!$(B1$B%Z!<%8$K<}$^$k$Y$-(B -$BJ,NL0J>e$N=PNO$,9T$J$o$l$F$7$^$$$^$7$?!%(B") - - ("Underfull \\\\hbox .*" . -"$BM>J,$J?bD>%9%Z!<%9$,$J$$$+$I$&$+=PNO$r3N$+$a$F$/$@$5$$!%$b$7$"$l$P!$$=(B -$B$l$O(B\\\\$BL?Na$^$?$O(B\\newline$BL?Na$K4X78$9$kLdBj$N$?$a$K@8$8$?$b$N$G$9!%Nc(B -$B$($P(B2$B$D$N(B\\\\$BL?Na$,B3$$$F$$$k>l9g$J$I$G$9!%$3$N7Y9p$O(Bsloppypar$B4D6-$d(B -\\sloppy$B@k8@$N;HMQ!$$"$k$$$O(B\\linebreak$BL?Na$NA^F~$J$I$K$h$k>l9g$b$"$j$^$9!%(B") - - ("Underfull \\\\vbox .*" . -"$B%Z!<%8$rJ,3d$9$k$?$a$NE,@Z$J>l=j$,8+$D$1$i$l$:!$==J,$J%F%-%9%H$N$J$$(B -$B%Z!<%8$,$G$-$F$7$^$$$^$7$?!%(B") - -;; New list items should be placed here -;; -;; ("err-regexp" . "context") -;; -;; the err-regexp item should match anything - - (".*" . "$B$4$a$s$J$5$$!%3:Ev$9$k%X%k%W%a%C%;!<%8$,$"$j$^$;$s!%(B")))) - -(provide 'tex-jp) - -;;; tex-jp.el ends here diff --git a/packages/auctex/tex-mik.el b/packages/auctex/tex-mik.el deleted file mode 100644 index 4197df5a8..000000000 --- a/packages/auctex/tex-mik.el +++ /dev/null @@ -1,71 +0,0 @@ -;;; tex-mik.el --- MiKTeX support for AUCTeX. - -;; Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. - -;; Author: Per Abrahamsen -;; Maintainer: auctex-devel@gnu.org -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: -;; -;; This file contains variables customized for MiKTeX. - -;;; Code: - - ;; Remove the Queue entry from the default, and make a non-Unix - ;; specific print entry, assuming that we'll print via gsview32. -(unless (get 'TeX-queue-command 'saved-value) - (setq TeX-queue-command nil)) - -(unless (get 'TeX-printer-list 'saved-value) - (setq TeX-printer-list nil)) - -(unless (get 'TeX-print-command 'saved-value) - (setq TeX-print-command - "start \"\" %f")) - -(unless (get 'TeX-view-style 'saved-value) - (setq TeX-view-style '(("^epsf$" "start \"\" %f") - ("." "yap -1 %dS %d")))) - -(unless (get 'TeX-output-view-style 'saved-value) - (setq TeX-output-view-style - '(("^dvi$" "^pstricks$\\|^pst-\\|^psfrag$" "dvips %d -o && start \"\" %f") - ("^dvi$" "." "yap -1 %dS %d") - ("^pdf$" "." "start \"\" %o") - ("^html?$" "." "start \"\" %o")))) - -(unless (get 'TeX-source-specials-view-position-flags 'saved-value) - (setq TeX-source-specials-view-position-flags "-s %n%b")) - -;; Yap does not support a command line option for inverse searching. -;; The editor command has to be configured inside Yap in -;; "View/Options/Inverse Search" instead. -(unless (get 'TeX-source-specials-view-editor-flags 'saved-value) - (setq TeX-source-specials-view-editor-flags "")) - -;; kpsewhich in MiKTeX (aka findtexmf) does not emit any useful -;; information if fed with kpathsea-related variables anyway. -(unless (get 'TeX-kpathsea-path-delimiter 'saved-value) - (setq TeX-kpathsea-path-delimiter nil)) - -(provide 'tex-mik) - -;;; tex-mik.el ends here diff --git a/packages/auctex/tex-site.el b/packages/auctex/tex-site.el deleted file mode 100644 index 0a31f4d5d..000000000 --- a/packages/auctex/tex-site.el +++ /dev/null @@ -1,164 +0,0 @@ -;;; tex-site.el - Site specific variables. Don't edit. - -;; Copyright (C) 2005 Free Software Foundation, Inc. -;; -;; completely rewritten. - -;; Author: David Kastrup -;; Maintainer: auctex-devel@gnu.org -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file contains startup code, autoloads and variables adapted to -;; the local site configuration. It is generated and placed by the -;; installation procedure and should not be edited by hand, nor moved -;; to a different place, as some settings may be established relative -;; to the file. - -;; All user customization should be done with -;; M-x customize-variable RET - -;;; Code: - -(if (< emacs-major-version 21) - (error "AUCTeX requires Emacs 21 or later")) - -;; Define here in order for `M-x customize-group AUCTeX ' -;; to work if the main AUCTeX files are not loaded yet. -(defgroup AUCTeX nil - "A (La)TeX environment." - :tag "AUCTeX" - :link '(custom-manual "(auctex)Top") - :link '(url-link :tag "Home Page" "http://www.gnu.org/software/auctex/") - :prefix "TeX-" - :group 'tex - :load "tex" :load "latex" :load "tex-style") - -(defvar TeX-lisp-directory (file-name-directory load-file-name) - "The directory where most of the AUCTeX lisp files are located. -For the location of lisp files associated with -styles, see the variables TeX-style-* (hand-generated lisp) and -TeX-auto-* (automatically generated lisp).") - -(add-to-list 'load-path TeX-lisp-directory) - -(defvar TeX-data-directory (file-name-directory load-file-name) - "The directory where the AUCTeX non-Lisp data is located.") - -(defcustom TeX-auto-global "/usr/local/var/auctex" - "Directory containing automatically generated information. -Must end with a directory separator. - -For storing automatic extracted information about the TeX macros -shared by all users of a site." - :group 'TeX-file - :type 'directory) - -(defconst TeX-mode-alist - '((tex-mode . tex-mode) - (plain-tex-mode . tex-mode) - (texinfo-mode . texinfo) - (latex-mode . tex-mode) - (doctex-mode . tex-mode)) - "Alist of built-in TeX modes and their load files.") - -(defalias 'TeX-load-hack 'ignore) - -(add-hook 'tex-site-unload-hook - (lambda () - (let ((list after-load-alist)) - (while list - ;; Adapted copy of the definition of `assq-delete-all' - ;; from Emacs 21 as substitute for - ;; `(assq-delete-all'TeX-modes-set (car list))' which - ;; fails on non-list elements in Emacs 21. - (let* ((alist (car list)) - (tail alist) - (key 'TeX-modes-set)) - (while tail - (if (and (consp (car tail)) - (eq (car (car tail)) key)) - (setq alist (delq (car tail) alist))) - (setq tail (cdr tail)))) - (setq list (cdr list)))) - (setq load-path (delq TeX-lisp-directory load-path)))) - -(defun TeX-modes-set (var value &optional update) - "Set VAR (which should be `TeX-modes') to VALUE. - -This places either the standard or the AUCTeX versions of -functions into the respective function cell of the mode. -If UPDATE is set, a previously saved value for -the non-AUCTeX function gets overwritten with the current -definition." - (custom-set-default var value) - (let ((list TeX-mode-alist) elt) - (while list - (setq elt (car (pop list))) - (when (or update (null (get elt 'tex-saved))) - (when (fboundp elt) - (put elt 'tex-saved (symbol-function elt)))) - (defalias elt - (if (memq elt value) - (intern (concat "TeX-" (symbol-name elt))) - (get elt 'tex-saved)))))) - -(defcustom TeX-modes - (mapcar 'car TeX-mode-alist) - "List of modes provided by AUCTeX. - -This variable can't be set normally; use customize for that, or -set it with `TeX-modes-set'." - :type (cons 'set - (mapcar (lambda(x) (list 'const (car x))) TeX-mode-alist)) - :set 'TeX-modes-set - :group 'AUCTeX - :initialize (lambda (var value) - (custom-initialize-reset var value) - (let ((list TeX-mode-alist)) - (while list - (eval-after-load (cdar list) - `(TeX-modes-set ',var ,var t)) - (setq list (cdr list)))))) - -(defconst AUCTeX-version "11.86" - "AUCTeX version. -If not a regular release, the date of the last change.") - -(defconst AUCTeX-date "2010-02-21" - "AUCTeX release date using the ISO 8601 format, yyyy-mm-dd.") - -;; Store bibitems when saving a BibTeX buffer -(add-hook 'bibtex-mode-hook 'BibTeX-auto-store) - - -;;; Code specific to ELPA packaging: - -;; From preview-latex.el: - -(defvar preview-TeX-style-dir - (expand-file-name "latex" (file-name-directory load-file-name))) - -;;; Ensure that loading the autoloads file also loads this file. -;;;###autoload (require 'tex-site) - -(provide 'tex-site) -;;; tex-site.el ends here diff --git a/packages/auctex/tex-style.el b/packages/auctex/tex-style.el deleted file mode 100644 index 781aa1134..000000000 --- a/packages/auctex/tex-style.el +++ /dev/null @@ -1,367 +0,0 @@ -;;; tex-style.el --- Customizable variables for AUCTeX style files - -;; Copyright (C) 2005 Free Software Foundation, Inc. - -;; Author: Reiner Steib -;; Keywords: tex, wp, convenience - -;; This file is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This file is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, -;; Boston, MA 02110-1301, USA. - -;;; Commentary: - -;; This file provides customizable variables for AUCTeX style files. - -;;; Code: - -(defgroup LaTeX-style nil - "Support for special LaTeX style files in AUCTeX." - :group 'LaTeX-macro) - -;; Note: We don't have any defcustom in plain TeX style files yet. Else we -;; should also create a TeX-style group. - -;; style/amsmath.el - -(defcustom LaTeX-amsmath-label nil - "Default prefix to amsmath equation labels. - -Amsmath equations include \"align\", \"alignat\", \"xalignat\", -\"multline\", \"flalign\" and \"gather\". If it is nil, -`LaTeX-equation-label' is used." - :group 'LaTeX-label - :type '(choice (const :tag "Use `LaTeX-equation-label'" nil) - (string))) - -;; style/beamer.el - -(defcustom LaTeX-beamer-section-labels-flag nil - "If non-nil section labels are added" - :type 'boolean - :group 'LaTeX-style) - -(defcustom LaTeX-beamer-item-overlay-flag t - "If non-nil do prompt for an overlay in itemize-like environments." - :type 'boolean - :group 'LaTeX-style) - -(defcustom LaTeX-beamer-themes 'local - "Presentation themes for the LaTeX beamer package. -It can be a list of themes or a function. If it is the symbol -`local', search only once per buffer." - :group 'LaTeX-style - :type - '(choice - (const :tag "TeX search" LaTeX-beamer-search-themes) - (const :tag "Search once per buffer" local) - (function :tag "Other function") - (list - :value - ;; Work around (bug in customize?), see - ;; - ("Antibes" "Bergen" "Berkeley" "Berlin" "Boadilla" "Copenhagen" - "Darmstadt" "Dresden" "Frankfurt" "Goettingen" "Hannover" - "Ilmenau" "JuanLesPins" "Luebeck" "Madrid" "Malmoe" "Marburg" - "Montpellier" "PaloAlto" "Pittsburgh" "Rochester" "Singapore" - "Szeged" "Warsaw") - (set :inline t - (const "Antibes") - (const "Bergen") - (const "Berkeley") - (const "Berlin") - (const "Boadilla") - (const "Copenhagen") - (const "Darmstadt") - (const "Dresden") - (const "Frankfurt") - (const "Goettingen") - (const "Hannover") - (const "Ilmenau") - (const "JuanLesPins") - (const "Luebeck") - (const "Madrid") - (const "Malmoe") - (const "Marburg") - (const "Montpellier") - (const "PaloAlto") - (const "Pittsburgh") - (const "Rochester") - (const "Singapore") - (const "Szeged") - (const "Warsaw")) - (repeat :inline t - :tag "Other" - (string))))) - -(defcustom LaTeX-beamer-inner-themes 'local - "Presentation inner themes for the LaTeX beamer package. -It can be a list of themes or a function. If it is the symbol -`local', search only once per buffer." - :group 'LaTeX-style - :type '(choice - (const :tag "TeX search" LaTeX-beamer-search-inner-themes) - (const :tag "Search once per buffer" local) - (function :tag "Other function") - (list - :value ("circles" "default" "inmargin" "rectangles" "rounded") - (set :inline t - (const "circles") - (const "default") - (const "inmargin") - (const "rectangles") - (const "rounded")) - (repeat :inline t - :tag "Other" - (string))))) - -(defcustom LaTeX-beamer-outer-themes 'local - "Presentation outer themes for the LaTeX beamer package. -It can be a list of themes or a function. If it is the symbol -`local', search only once per buffer." - :group 'LaTeX-style - :type - '(choice - (const :tag "TeX search" LaTeX-beamer-search-outer-themes) - (const :tag "Search once per buffer" local) - (function :tag "Other function") - (list - :value - ("default" "infolines" "miniframes" "shadow" "sidebar" "smoothbars" - "smoothtree" "split" "tree") - (set :inline t - (const "default") - (const "infolines") - (const "miniframes") - (const "shadow") - (const "sidebar") - (const "smoothbars") - (const "smoothtree") - (const "split") - (const "tree")) - (repeat :inline t - :tag "Other" - (string))))) - -(defcustom LaTeX-beamer-color-themes 'local - "Presentation color themes for the LaTeX beamer package. -It can be a list of themes or a function. If it is the symbol -`local', search only once per buffer." - :group 'LaTeX-style - :type - '(choice - (const :tag "TeX search" LaTeX-beamer-search-color-themes) - (const :tag "Search once per buffer" local) - (function :tag "Other function") - (list - :value - ("albatross" "beetle" "crane" "default" "dolphin" "dove" "fly" "lily" - "orchid" "rose" "seagull" "seahorse" "sidebartab" "structure" "whale") - (set :inline t - (const "albatross") - (const "beetle") - (const "crane") - (const "default") - (const "dolphin") - (const "dove") - (const "fly") - (const "lily") - (const "orchid") - (const "rose") - (const "seagull") - (const "seahorse") - (const "sidebartab") - (const "structure") - (const "whale")) - (repeat :inline t - :tag "Other" - (string))))) - -(defcustom LaTeX-beamer-font-themes 'local - "Presentation font themes for the LaTeX beamer package. -It can be a list of themes or a function. If it is the symbol -`local', search only once per buffer." - :group 'LaTeX-style - :type - '(choice - (const :tag "TeX search" LaTeX-beamer-search-font-themes) - (const :tag "Search once per buffer" local) - (function :tag "Other function") - (list - :value - ("default" "professionalfonts" "serif" "structurebold" - "structureitalicserif" "structuresmallcapsserif") - (set :inline t - (const "default") - (const "professionalfonts") - (const "serif") - (const "structurebold") - (const "structureitalicserif") - (const "structuresmallcapsserif")) - (repeat :inline t - :tag "Other" - (string))))) - -;; style/comment.el - -(defcustom LaTeX-comment-env-list '("comment") - "List of environment names defined with comment.sty. -Setting this variable does not take effect unless you -reinitialize affected buffers." - :type '(repeat string) - :group 'LaTeX-style) - -;; style/csquotes.el - -(defcustom LaTeX-csquotes-quote-after-quote nil - "Initial value of `TeX-quote-after-quote' for `csquotes.el'" - :type 'boolean - :group 'LaTeX-style) - -(defcustom LaTeX-csquotes-open-quote "" - "Opening quotation mark to be used with the csquotes package. -The specified string will be used for `TeX-open-quote' (and override -any language-specific setting) only if both `LaTeX-csquotes-open-quote' -and `LaTeX-csquotes-close-quote' are non-empty strings." - :type 'string - :group 'LaTeX-style) - -(defcustom LaTeX-csquotes-close-quote "" - "Closing quotation mark to be used with the csquotes package. -The specified string will be used for `TeX-close-quote' (and override -any language-specific setting) only if both `LaTeX-csquotes-open-quote' -and `LaTeX-csquotes-close-quote' are non-empty strings." - :type 'string - :group 'LaTeX-style) - -;; style/emp.el - -(defcustom LaTeX-write18-enabled-p t - "*If non-nil, insert automatically the \\write18 calling metapost. -When disabled, you have to use mpost on the mp files automatically -produced by emp.sty and then re-LaTeX the document." - :type 'boolean - :group 'LaTeX-style) - -;; style/graphicx.el - -(defcustom LaTeX-includegraphics-extensions - '("eps" "jpe?g" "pdf" "png") - "Extensions for images files used by \\includegraphics." - :group 'LaTeX-style - :type '(list (set :inline t - (const "eps") - (const "jpe?g") - (const "pdf") - (const "png")) - (repeat :inline t - :tag "Other" - (string)))) - -(defcustom LaTeX-includegraphics-options-alist - '((0 width) - ;; (1 width height clip) - ;; (2 width height keepaspectratio clip) - (4) ;; --> (4 nil) - (5 trim) - (16 - ;; Table 1 in epslatex.ps: ``includegraphics Options'' - height totalheight width scale angle origin bb - ;; Table 2 in epslatex.ps: ``cropping Options'' - viewport trim - ;; Table 3 in epslatex.ps: ``Boolean Options'' - ;; [not implemented:] noclip draft final - clip keepaspectratio - ;; Only for PDF: - page)) - "Controls for which optional arguments of \\includegraphics you get prompted. - -An alist, consisting of \(NUMBER . LIST\) pairs. Valid elements of LIST are -`width', `height', `keepaspectratio', `clip', `angle', `totalheight', `trim' -and `bb' \(Bounding Box\). - -The list corresponding to 0 is used if no prefix is given. Note that 4 \(one -\\[universal-argument]\) and 16 \(two \\[universal-argument]'s\) are easy to -type and should be used for frequently needed combinations." - :group 'LaTeX-style - :type '(repeat (cons (integer :tag "Argument") - (list (set :inline t - (const height) - (const totalheight) - (const width) - (const scale) - (const angle) - (const origin) - (const :tag "Bounding Box" bb) - ;; - (const viewport) - (const trim) - ;; - (const clip) - (const keepaspectratio)))))) - -(defcustom LaTeX-includegraphics-strip-extension-flag t - "Non-nil means to strip known extensions from image file name." - :group 'LaTeX-style - :type 'boolean) - -(defcustom LaTeX-includegraphics-read-file - 'LaTeX-includegraphics-read-file-TeX - "Function for reading \\includegraphics files. - -`LaTeX-includegraphics-read-file-TeX' lists all graphic files -found in the TeX search path. - -`LaTeX-includegraphics-read-file-relative' lists all graphic files -in the master directory and its subdirectories and inserts the -relative file name. This option does not work with Emacs 21 or -XEmacs. - -The custom option `simple' works as -`LaTeX-includegraphics-read-file-relative' but it lists all kind of -files. - -Inserting the subdirectory in the filename (as -`LaTeX-includegraphics-read-file-relative') is discouraged by -`epslatex.ps'." -;; ,----[ epslatex.ps; Section 12; (page 26) ] -;; | Instead of embedding the subdirectory in the filename, there are two -;; | other options -;; | 1. The best method is to modify the TeX search path [...] -;; | 2. Another method is to specify sub/ in a \graphicspath command -;; | [...]. However this is much less efficient than modifying the -;; | TeX search path -;; `---- -;; See "Inefficiency" and "Unportability" in the same section for more -;; information. - :group 'LaTeX-style - :type '(choice (const :tag "TeX" LaTeX-includegraphics-read-file-TeX) - (const :tag "relative" - LaTeX-includegraphics-read-file-relative) - (const :tag "simple" (lambda () - (file-relative-name - (read-file-name "Image file: ") - (TeX-master-directory)))) - (function :tag "other"))) - -;; style/shortvrb.el - -(defcustom LaTeX-shortvrb-chars '(?|) - "List of characters toggling verbatim mode." - :group 'LaTeX-style - :type '(repeat character)) - -(provide 'tex-style) - -;;; tex-style.el ends here diff --git a/packages/auctex/tex.el b/packages/auctex/tex.el deleted file mode 100644 index 0ff821ce0..000000000 --- a/packages/auctex/tex.el +++ /dev/null @@ -1,5605 +0,0 @@ -;;; tex.el --- Support for TeX documents. - -;; Copyright (C) 1985-1987, 1991, 1993, 1994, 1996, 1997, 1999-2013 -;; Free Software Foundation, Inc. - -;; Maintainer: auctex-devel@gnu.org -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: - -;; This file provides AUCTeX support for plain TeX as well as basic -;; functions used by other AUCTeX modes (e.g. for LaTeX, Texinfo and -;; ConTeXt). - -;;; Code: - -(when (< emacs-major-version 21) - (error "AUCTeX requires Emacs 21 or later")) - -(require 'custom) -(require 'tex-site) -(eval-when-compile - (require 'cl)) - -(defun TeX--call-3/2 (f arg1 arg2 arg3) - (condition-case nil - (funcall f arg1 arg2 arg3) - (wrong-number-of-arguments (funcall f arg1 arg2)))) - -(defgroup TeX-file nil - "Files used by AUCTeX." - :group 'AUCTeX) - -(defgroup TeX-command nil - "Calling external commands from AUCTeX." - :group 'AUCTeX) - -(defgroup LaTeX nil - "LaTeX support in AUCTeX." - :tag "LaTeX" - :group 'AUCTeX - :prefix "LaTeX-") - -(defgroup TeX-misc nil - "Various AUCTeX settings." - :group 'AUCTeX) - -;;; Site Customization -;; -;; The following variables are likely to need to be changed for your -;; site. You should do this with customize. Here is the beef: If you -;; want to print, TeX-print-command must be non-nil (if it is nil, -;; you'll get a complaint when using the print menu). If you want to -;; view the queue, TeX-queue-command needs to be non-nil (if it is -;; nil, it won't get mentioned in the menu). If TeX-printer-list is -;; nil, nothing else gets asked: the menu entries lead directly to the -;; respective commands. If those commands contain %p, the value of -;; TeX-printer-default gets inserted there, no questions asked. Now -;; if TeX-printer-list is non-nil, you'll always get asked which -;; printer you want to use. You can enter a configured printer from -;; TeX-printer-list, or an unknown one. The respective menus will -;; show all configured printers. Since you can enter unknown -;; printers, the printer name _must_ be set with %p in -;; TeX-print-command. - -;; How to print. - -(defcustom TeX-print-command "%(o?)dvips -P%p %r %s" - "*Command used to print a file. - -First `%p' is expanded to the printer name, then ordinary expansion is -performed as specified in `TeX-expand-list'. If it is nil, -then customization is requested." - :group 'TeX-command - :type '(choice (string :tag "Print command") - (const :tag "No print command customized" nil))) - -(defcustom TeX-command "tex" - "Command to run plain TeX." - :group 'TeX-command - :type 'string) - -(defcustom TeX-Omega-command "omega" - "Command to run plain TeX on Omega." - :group 'TeX-command - :type 'string) - -(defcustom LaTeX-command "latex" - "Command to run LaTeX." - :group 'TeX-command - :type 'string) - -(defcustom LaTeX-Omega-command "lambda" - "Command to run LaTeX on Omega." - :group 'TeX-command - :type 'string) - -(defcustom ConTeXt-engine nil - "Engine to use for --engine in the texexec command. -If nil, none is specified." - :group 'TeX-command - :type '(choice (const :tag "Unspecified" nil) - string)) - -(defcustom ConTeXt-Omega-engine TeX-Omega-command - "Engine to use for --engine in the texexec command in Omega mode. -If nil, none is specified." - :group 'TeX-command - :type '(choice (const :tag "Unspecified" nil) - string)) -;; At least in TeXLive 2009 ConTeXt does not support an omega option anymore. -(TeX--call-3/2 #'make-obsolete-variable 'ConTeXt-Omega-engine - 'TeX-engine-alist "before 11.86") - -(defcustom TeX-queue-command "lpq -P%p" - "*Command used to show the status of a printer queue. - -First `%p' is expanded to the printer name, then ordinary expansion is -performed as specified in `TeX-expand-list'. If this is nil, -the printer has no corresponding command." - :group 'TeX-command - :type '(choice (string :tag "Queue check command") - (const :tag "No such command" nil))) - -(defcustom TeX-mode-hook nil - "A hook run in TeX mode buffers." - :type 'hook - :group 'TeX-misc) - -(defcustom AmS-TeX-mode-hook nil - "A hook run in AmS-TeX mode buffers." - :type 'hook - :group 'TeX-misc) - -;; This is the major configuration variable. Most sites will only -;; need to change the second string in each entry, which is the name -;; of a command to send to the shell. If you use other formatters -;; like AMSLaTeX or AMSTeX, you can add those to the list. See -;; TeX-expand-list for a description of the % escapes - -(defcustom TeX-command-list - `(("TeX" "%(PDF)%(tex) %`%S%(PDFout)%(mode)%' %t" - TeX-run-TeX nil - (plain-tex-mode ams-tex-mode texinfo-mode) :help "Run plain TeX") - ("LaTeX" "%`%l%(mode)%' %t" - TeX-run-TeX nil - (latex-mode doctex-mode) :help "Run LaTeX") - ;; Not part of standard TeX. - ("Makeinfo" "makeinfo %t" TeX-run-compile nil - (texinfo-mode) :help "Run Makeinfo with Info output") - ("Makeinfo HTML" "makeinfo --html %t" TeX-run-compile nil - (texinfo-mode) :help "Run Makeinfo with HTML output") - ("AmSTeX" "%(PDF)amstex %`%S%(PDFout)%(mode)%' %t" - TeX-run-TeX nil (ams-tex-mode) :help "Run AMSTeX") - ;; support for ConTeXt --pg - ;; first version of ConTeXt to support nonstopmode: 2003.2.10 - ("ConTeXt" "texexec --once --texutil %(execopts)%t" - TeX-run-TeX nil (context-mode) :help "Run ConTeXt once") - ("ConTeXt Full" "texexec %(execopts)%t" - TeX-run-TeX nil - (context-mode) :help "Run ConTeXt until completion") - ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help "Run BibTeX") - ,(if (or window-system (getenv "DISPLAY")) - '("View" "%V" TeX-run-discard-or-function t t :help "Run Viewer") - '("View" "dvi2tty -q -w 132 %s" TeX-run-command t t - :help "Run Text viewer")) - ("Print" "%p" TeX-run-command t t :help "Print the file") - ("Queue" "%q" TeX-run-background nil t :help "View the printer queue" - :visible TeX-queue-command) - ("File" "%(o?)dvips %d -o %f " TeX-run-command t t - :help "Generate PostScript file") - ("Index" "makeindex %s" TeX-run-command nil t :help "Create index file") - ("Check" "lacheck %s" TeX-run-compile nil (latex-mode) - :help "Check LaTeX file for correctness") - ("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil t - :help "Spell-check the document") - ("Clean" "TeX-clean" TeX-run-function nil t - :help "Delete generated intermediate files") - ("Clean All" "(TeX-clean t)" TeX-run-function nil t - :help "Delete generated intermediate and output files") - ("Other" "" TeX-run-command t t :help "Run an arbitrary command")) - "List of commands to execute on the current document. - -Each element is a list, whose first element is the name of the command -as it will be presented to the user. - -The second element is the string handed to the shell after being -expanded. The expansion is done using the information found in -`TeX-expand-list'. - -The third element is the function which actually start the process. -Several such hooks has been defined: - -TeX-run-command: Start up the process and show the output in a -separate buffer. Check that there is not two commands running for the -same file. Return the process object. - -TeX-run-format: As `TeX-run-command', but assume the output is created -by a TeX macro package. Return the process object. - -TeX-run-TeX: For TeX output. - -TeX-run-interactive: Run TeX or LaTeX interactively. - -TeX-run-BibTeX: For BibTeX output. - -TeX-run-compile: Use `compile' to run the process. - -TeX-run-shell: Use `shell-command' to run the process. - -TeX-run-discard: Start the process in the background, discarding its -output. - -TeX-run-background: Start the process in the background, show output -in other window. - -TeX-run-silent: Start the process in the background. - -TeX-run-discard-foreground: Start the process in the foreground, -discarding its output. - -TeX-run-function: Execute the Lisp function or function call -specified by the string in the second element. Consequently, -this hook does not start a process. - -TeX-run-discard-or-function: If the command is a Lisp function, -execute it as such, otherwise start the command as a process, -discarding its output. - -To create your own hook, define a function taking three arguments: The -name of the command, the command string, and the name of the file to -process. It might be useful to use `TeX-run-command' in order to -create an asynchronous process. - -If the fourth element is non-nil, the user will get a chance to -modify the expanded string. - -The fifth element indicates in which mode(s) the command should be -present in the Command menu. Use t if it should be active in any -mode. If it should only be present in some modes, specify a list with -the respective mode names. - -Any additional elements get just transferred to the respective menu entries." - :group 'TeX-command - :type '(repeat (group :value ("" "" TeX-run-command nil t) - (string :tag "Name") - (string :tag "Command") - (choice :tag "How" - :value TeX-run-command - (function-item TeX-run-command) - (function-item TeX-run-format) - (function-item TeX-run-TeX) - (function-item TeX-run-interactive) - (function-item TeX-run-BibTeX) - (function-item TeX-run-compile) - (function-item TeX-run-shell) - (function-item TeX-run-discard) - (function-item TeX-run-background) - (function-item TeX-run-silent) - (function-item TeX-run-discard-foreground) - (function-item TeX-run-function) - (function-item TeX-run-discard-or-function) - (function :tag "Other")) - (boolean :tag "Prompt") - (choice :tag "Modes" - (const :tag "All" t) - (set (const :tag "Plain TeX" plain-tex-mode) - (const :tag "LaTeX" latex-mode) - (const :tag "DocTeX" doctex-mode) - (const :tag "ConTeXt" context-mode) - (const :tag "Texinfo" texinfo-mode) - (const :tag "AmSTeX" ams-tex-mode))) - (repeat :tag "Menu elements" :inline t sexp)))) - -(defcustom TeX-command-output-list - '( -; Add the following line if you want to use htlatex (tex4ht) -; ("\\`htlatex" ("html")) - ) - "List of regexps and file extensions. - -Each element is a list, whose first element is a regular expression to -match against the name of the command that will be used to process the TeX -file. - -The second element is either a string or a list with a string as element. -If it is a string this is the default file extension that will be expected -for output files that are produced by commands that match the first -element. The real file extension will be obtained from the logging output -if possible, defaulting to the given string. -If it is a list, the element of the list will be the fixed extension used -without looking at the logging output. - -If this list does not yield an extension, the default is either \"dvi\" -or \"pdf\", depending on the setting of `TeX-PDF-mode'. -Extensions must be given without the \".\"." - - :group 'TeX-command - :type '(repeat (group (regexp :tag "Command Regexp") - (choice (string :tag "Default Extension") - (group (string :tag "Fixed Extension")))))) - -;; You may want to change the default LaTeX version for your site. -(defcustom LaTeX-version "2e" - "Default LaTeX version. Currently recognized is \"2\" and \"2e\"." - :group 'LaTeX - :type '(radio (const :format "%v\n%h" - :doc "\ -The executable `latex' is LaTeX version 2." - "2") - (const :format "%v\n%h" - :doc "\ -The executable `latex' is LaTeX version 2e." - "2e") - (string :tag "Other"))) - - -;; Use different compilation commands depending on style. -;; Only works if parsing is enabled. - -(defcustom LaTeX-command-style - ;; They have all been combined in LaTeX 2e. - '(("" "%(PDF)%(latex) %S%(PDFout)")) -"List of style options and LaTeX commands. - -If the first element (a regular expression) matches the name of one of -the style files, any occurrence of the string `%l' in a command in -`TeX-command-list' will be replaced with the second element. The first -match is used, if no match is found the `%l' is replaced with the empty -string." - :group 'TeX-command - :type '(repeat (group :value ("" "") - regexp (string :tag "Style")))) - -;; Enter the names of the printers available at your site, or nil if -;; you only have one printer. - -(defcustom TeX-printer-list - '(("Default" "%(o?)dvips -f %s | lpr" "lpq")) - "List of available printers. - -The first element of each entry is the printer name. - -The second element is the command used to print to this -printer. It defaults to the value of `TeX-print-command' when nil. - -The third element is the command used to examine the print queue for -this printer. It defaults to the value of `TeX-queue-command' similarly. - -Any occurrence of `%p' in the second or third element is expanded to -the printer name given in the first element, then ordinary expansion -is performed as specified in `TeX-expand-list'. - -If this list is empty, only `TeX-print-command' and `TeX-queue-command' -get consulted." - :group 'TeX-command - :type '(repeat (group (string :tag "Name") - (option (group :inline t - :extra-offset -4 - (choice :tag "Print" - (const :tag "default") - (string :format "%v")) - (option (choice :tag "Queue" - (const :tag "default") - (string - :format "%v")))))))) - -;; The name of the most used printer. - -(defcustom TeX-printer-default (or (getenv "PRINTER") - (and TeX-printer-list - (car (car TeX-printer-list))) - "lp") - "*Default printer to use with `TeX-command'." - :group 'TeX-command - :type 'string) - -(defcustom TeX-print-style '(("^landscape$" "-t landscape")) - "List of style options and print options. - -If the first element (a regular expression) matches the name of one of -the style files, any occurrence of the string `%r' in a command in -`TeX-command-list' will be replaced with the second element. The first -match is used, if no match is found the `%r' is replaced with the empty -string." - :group 'TeX-command - :type '(repeat (group regexp (string :tag "Command")))) - -;; This is the list of expansion for the commands in -;; TeX-command-list. Not likely to be changed, but you may e.g. want -;; to handle .ps files. - -(defcustom TeX-expand-list - '(("%p" TeX-printer-query) ;%p must be the first entry - ("%q" (lambda () - (TeX-printer-query t))) - ("%V" (lambda () - (TeX-source-correlate-start-server-maybe) - (TeX-view-command-raw))) - ("%vv" (lambda () - (TeX-source-correlate-start-server-maybe) - (TeX-output-style-check TeX-output-view-style))) - ("%v" (lambda () - (TeX-source-correlate-start-server-maybe) - (TeX-style-check TeX-view-style))) - ("%r" (lambda () - (TeX-style-check TeX-print-style))) - ("%l" (lambda () - (TeX-style-check LaTeX-command-style))) - ("%(PDF)" (lambda () - (if (and (eq TeX-engine 'default) - (or TeX-PDF-mode - TeX-DVI-via-PDFTeX)) - "pdf" - ""))) - ("%(PDFout)" (lambda () - (cond ((and (eq TeX-engine 'xetex) - (not TeX-PDF-mode)) - " -no-pdf") - ((and (eq TeX-engine 'luatex) - (not TeX-PDF-mode)) - " --output-format=dvi") - ((and (eq TeX-engine 'default) - (not TeX-PDF-mode) - TeX-DVI-via-PDFTeX) - " \"\\pdfoutput=0 \"") - (t "")))) - ("%(mode)" (lambda () - (if TeX-interactive-mode - "" - " -interaction=nonstopmode"))) - ("%(o?)" (lambda () (if (eq TeX-engine 'omega) "o" ""))) - ("%(tex)" (lambda () (eval (nth 2 (assq TeX-engine (TeX-engine-alist)))))) - ("%(latex)" (lambda () (eval (nth 3 (assq TeX-engine (TeX-engine-alist)))))) - ("%(execopts)" ConTeXt-expand-options) - ("%S" TeX-source-correlate-expand-options) - ("%dS" TeX-source-specials-view-expand-options) - ("%cS" TeX-source-specials-view-expand-client) - ("%(outpage)" (lambda () - (if TeX-source-correlate-output-page-function - (funcall TeX-source-correlate-output-page-function) - "1"))) - ;; `file' means to call `TeX-master-file' or `TeX-region-file' - ("%s" file nil t) - ("%t" file t t) - ("%`" (lambda nil - (setq TeX-command-pos t TeX-command-text ""))) - (" \"\\" (lambda nil - (if (eq TeX-command-pos t) - (setq TeX-command-pos pos - pos (+ 3 pos)) - (setq pos (1+ pos))))) - ("\"" (lambda nil (if (numberp TeX-command-pos) - (setq TeX-command-text - (concat - TeX-command-text - (substring command - TeX-command-pos - (1+ pos))) - command - (concat - (substring command - 0 - TeX-command-pos) - (substring command - (1+ pos))) - pos TeX-command-pos - TeX-command-pos t) - (setq pos (1+ pos))))) - ("%'" (lambda nil - (prog1 - (if (stringp TeX-command-text) - (progn - (setq pos (+ (length TeX-command-text) 9) - TeX-command-pos - (and (string-match " " - (funcall file t t)) - "\"")) - (concat TeX-command-text " \"\\input\"")) - (setq TeX-command-pos nil) - "") - (setq TeX-command-text nil)))) - ("%n" TeX-current-line) - ("%d" file "dvi" t) - ("%f" file "ps" t) - ("%o" (lambda nil (funcall file (TeX-output-extension) t))) - ;; for source specials the file name generated for the xdvi - ;; command needs to be relative to the master file, just in - ;; case the file is in a different subdirectory - ("%b" TeX-current-file-name-master-relative) - ;; the following is for preview-latex. - ("%m" preview-create-subdirectory)) - "List of expansion strings for TeX command names. - -Each entry is a list with two or more elements. The first element is -the string to be expanded. The second element is the name of a -function returning the expanded string when called with the remaining -elements as arguments. The special value `file' will be expanded to -the name of the file being processed, with an optional extension." - :group 'TeX-command - :type '(repeat (group (string :tag "Key") - (sexp :tag "Expander") - (repeat :inline t - :tag "Arguments" - (sexp :format "%v"))))) - - -;; The following dependencies are not done with autoload cookies since -;; they are only useful when tex.el is loaded, anyway. tex-buf.el -;; should remain unloaded as long as one is only editing files, so -;; requiring it here would be wrong. - -(autoload 'TeX-region-create "tex-buf" nil nil) -(autoload 'TeX-save-document "tex-buf" nil t) -(autoload 'TeX-home-buffer "tex-buf" nil t) -(autoload 'TeX-pin-region "tex-buf" nil t) -(autoload 'TeX-command-region "tex-buf" nil t) -(autoload 'TeX-command-buffer "tex-buf" nil t) -(autoload 'TeX-command-master "tex-buf" nil t) -(autoload 'TeX-command "tex-buf" nil nil) -(autoload 'TeX-kill-job "tex-buf" nil t) -(autoload 'TeX-recenter-output-buffer "tex-buf" nil t) -(autoload 'TeX-next-error "tex-buf" nil t) -(autoload 'TeX-region-file "tex-buf" nil nil) -(autoload 'TeX-current-offset "tex-buf" nil nil) -(autoload 'TeX-process-set-variable "tex-buf" nil nil) -(autoload 'TeX-view "tex-buf" nil t) - -;;; Portability. - -(require 'easymenu) - -(eval-and-compile - (if (featurep 'xemacs) - (defun TeX-maybe-remove-help (menu) - "Removes :help entries from menus, since XEmacs does not like them. -Also does other stuff." - (cond ((consp menu) - (cond ((eq (car menu) :help) - (TeX-maybe-remove-help (cddr menu))) - ((eq (car menu) :visible) - (cons :included - (cons (cadr menu) - (TeX-maybe-remove-help (cddr menu))))) - (t (cons (TeX-maybe-remove-help (car menu)) - (TeX-maybe-remove-help (cdr menu)))))) - ((vectorp menu) - (vconcat (TeX-maybe-remove-help (append menu nil)))) - (t menu))) - (defun TeX-maybe-remove-help (menu) - "Compatibility function that would remove :help entries if on XEmacs, -but does nothing in Emacs." - menu)) - (defmacro TeX-menu-with-help (menu) - "Compatibility macro that removes :help entries if on XEmacs. -Also does other stuff." - (TeX-maybe-remove-help menu))) - - -;;; Documentation for Info-goto-emacs-command-node and similar - -(eval-after-load 'info '(dolist (elt '("TeX" "LaTeX" "ConTeXt" "Texinfo" - "docTeX")) - (add-to-list 'Info-file-list-for-emacs - (cons elt "AUCTeX")))) - -(defadvice hack-one-local-variable (after TeX-hack-one-local-variable-after - activate) - "Call minor mode function if minor mode variable is found." - (let ((var (ad-get-arg 0)) - (val (ad-get-arg 1))) - ;; Instead of checking for each mode explicitely `minor-mode-list' - ;; could be used. But this may make the byte compiler pop up. - (when (memq var '(TeX-PDF-mode - TeX-source-correlate-mode TeX-interactive-mode - TeX-fold-mode LaTeX-math-mode)) - (if (symbol-value val) (funcall var 1) (funcall var 0))))) - -(defvar TeX-overlay-priority-step 16 - "Numerical difference of priorities between nested overlays. -The step should be big enough to allow setting a priority for new -overlays between two existing ones.") - - -;;; Special support for XEmacs - -(when (featurep 'xemacs) - - (defun TeX-read-string - (prompt &optional initial-input history default-value) - (condition-case nil - (read-string prompt initial-input history default-value t) - (wrong-number-of-arguments - (read-string prompt initial-input history default-value)))) - - (defun TeX-mark-active () - ;; In Lucid (mark) returns nil when not active. - (if zmacs-regions - (mark) - (mark t))) - - (defun TeX-active-mark () - (and zmacs-regions (mark))) - - (fset 'TeX-activate-region (symbol-function 'zmacs-activate-region)) - - ;; I am aware that this counteracts coding conventions but I am sick - ;; of it. - (unless (fboundp 'line-beginning-position) - (defalias 'line-beginning-position 'point-at-bol)) - (unless (fboundp 'line-end-position) - (defalias 'line-end-position 'point-at-eol)) - - (defun TeX-overlay-prioritize (start end) - "Calculate a priority for an overlay extending from START to END. -The calculated priority is lower than the minimum of priorities -of surrounding overlays and higher than the maximum of enclosed -overlays." - (let (inner-priority outer-priority - (prios (cons nil nil))) - (map-extents - #'(lambda (ov prios) - (and - (or (eq (extent-property ov 'category) 'TeX-fold) - (extent-property ov 'preview-state)) - (setcar prios - (max (or (car prios) 0) - (extent-property ov 'priority)))) - nil) - nil start end prios 'start-and-end-in-region 'priority) - (map-extents - #'(lambda (ov prios) - (and - (or (eq (extent-property ov 'category) 'TeX-fold) - (extent-property ov 'preview-state)) - (setcdr prios - (min (or (cdr prios) most-positive-fixnum) - (extent-property ov 'priority)))) - nil) - nil start end prios - '(start-and-end-in-region negate-in-region) 'priority) - (setq inner-priority (car prios) outer-priority (cdr prios)) - (cond ((and inner-priority (not outer-priority)) - (+ inner-priority TeX-overlay-priority-step)) - ((and (not inner-priority) outer-priority) - (/ outer-priority 2)) - ((and inner-priority outer-priority) - (+ (/ (- outer-priority inner-priority) 2) inner-priority)) - (t TeX-overlay-priority-step)))) ) - - -(if (fboundp 'completing-read-multiple) - (defalias 'TeX-completing-read-multiple 'completing-read-multiple) - (defun TeX-completing-read-multiple - (prompt table &optional predicate require-match initial-input - hist def inherit-input-method) - "Poor mans implementation of Emacs' `completing-read-multiple' for XEmacs. -The XEmacs package edit-utils-2.32 includes `crm.el'." - (multi-prompt "," nil prompt table predicate require-match initial-input - hist))) - -(if (fboundp 'line-number-at-pos) - (defalias 'TeX-line-number-at-pos 'line-number-at-pos) - ;; `line-number-at-pos' from `simple.el' in Emacs CVS (2006-06-07) - (defun TeX-line-number-at-pos (&optional pos) - "Return (narrowed) buffer line number at position POS. -If POS is nil, use current buffer location." - (let ((opoint (or pos (point))) start) - (save-excursion - (goto-char (point-min)) - (setq start (point)) - (goto-char opoint) - (forward-line 0) - (1+ (count-lines start (point))))))) - -;;; Special support for GNU Emacs - -(unless (featurep 'xemacs) - - (defun TeX-read-string (prompt &optional initial-input history default-value) - (read-string prompt initial-input history default-value t)) - - (defun TeX-mark-active () - ;; In FSF 19 mark-active indicates if mark is active. - mark-active) - - (defun TeX-active-mark () - (and transient-mark-mode mark-active)) - - (defun TeX-activate-region () - nil) - - (defun TeX-overlay-prioritize (start end) - "Calculate a priority for an overlay extending from START to END. -The calculated priority is lower than the minimum of priorities -of surrounding overlays and higher than the maximum of enclosed -overlays." - (let (outer-priority inner-priority ov-priority) - (dolist (ov (overlays-in start end)) - (when (or (eq (overlay-get ov 'category) 'TeX-fold) - (overlay-get ov 'preview-state)) - (setq ov-priority (overlay-get ov 'priority)) - (if (>= (overlay-start ov) start) - (setq inner-priority (max ov-priority (or inner-priority - ov-priority))) - (setq outer-priority (min ov-priority (or outer-priority - ov-priority)))))) - (cond ((and inner-priority (not outer-priority)) - (+ inner-priority TeX-overlay-priority-step)) - ((and (not inner-priority) outer-priority) - (/ outer-priority 2)) - ((and inner-priority outer-priority) - (+ (/ (- outer-priority inner-priority) 2) inner-priority)) - (t TeX-overlay-priority-step)))) ) - -(defun TeX-delete-dups-by-car (alist &optional keep-list) - "Return a list of all elements in ALIST, but each car only once. -Elements of KEEP-LIST are not removed even if duplicate." - ;; Copy of `reftex-uniquify-by-car' (written by David Kastrup). - (setq keep-list (sort (copy-sequence keep-list) #'string<)) - (setq alist (sort (copy-sequence alist) - (lambda (a b) - (string< (car a) (car b))))) - (let ((new alist) elt) - (while new - (setq elt (caar new)) - (while (and keep-list (string< (car keep-list) elt)) - (setq keep-list (cdr keep-list))) - (unless (and keep-list (string= elt (car keep-list))) - (while (string= elt (car (cadr new))) - (setcdr new (cddr new)))) - (setq new (cdr new)))) - alist) - -(defun TeX-delete-duplicate-strings (list) - "Return a list of all strings in LIST, but each only once." - (setq list (TeX-sort-strings list)) - (let ((new list) elt) - (while new - (setq elt (car new)) - (while (string= elt (cadr new)) - (setcdr new (cddr new))) - (setq new (cdr new)))) - list) - -(defun TeX-sort-strings (list) - "Return sorted list of all strings in LIST." - (sort (copy-sequence list) #'string<)) - -;;; Buffer - -(defgroup TeX-output nil - "Parsing TeX output." - :prefix "TeX-" - :group 'AUCTeX) - -(defcustom TeX-display-help t - "Control type of help display when stepping through errors with \\[TeX-next-error]. -If t display help buffer. If nil display message about error in -echo area. If `expert' display output buffer with raw processor output." - :group 'TeX-output - :type '(choice (const :tag "Help buffer" t) - (const :tag "Echo area" nil) - (const :tag "Output buffer" expert))) - -(defcustom TeX-debug-bad-boxes nil - "Non-nil means also find overfull/underfull box warnings with \\[TeX-next-error]." - :group 'TeX-output - :type 'boolean) - -(defcustom TeX-debug-warnings nil - "Non-nil means also find LaTeX or package warnings with \\[TeX-next-error]." - :group 'TeX-output - :type 'boolean) - -(defun TeX-toggle-debug-bad-boxes () - "Toggle if the debugger should display \"bad boxes\" too." - (interactive) - (setq TeX-debug-bad-boxes (not TeX-debug-bad-boxes)) - (message (concat "TeX-debug-bad-boxes: " - (if TeX-debug-bad-boxes "on" "off")))) - -(defun TeX-toggle-debug-warnings () - "Toggle if the debugger should display warnings too." - (interactive) - (setq TeX-debug-warnings (not TeX-debug-warnings)) - (message (concat "TeX-debug-warnings: " - (if TeX-debug-warnings "on" "off")))) - -;;; Mode names. - -(defvar TeX-base-mode-name nil - "Base name of mode.") -(make-variable-buffer-local 'TeX-base-mode-name) - -(defun TeX-set-mode-name (&optional changed local reset) - "Build and set the mode name. -The base mode name will be concatenated with indicators for -helper modes where appropriate. - -If CHANGED is non-nil, it indicates which global mode -may have changed so that all corresponding buffers -without a local value might get their name updated. -A value of t will thus update all buffer names. - -If LOCAL is non-nil and CHANGED is buffer-local, only -a local change has been performed and only the local -name is to be updated. - -If RESET is non-nil, `TeX-command-next' is reset to -`TeX-command-default' in updated buffers." - (if (and changed - (not (and local (local-variable-p changed (current-buffer))))) - (dolist (buffer (buffer-list)) - (and (local-variable-p 'TeX-mode-p buffer) - (not (local-variable-p changed buffer)) - (with-current-buffer buffer (TeX-set-mode-name nil nil reset)))) - (if TeX-mode-p - (let ((trailing-flags - (concat - (and (boundp 'TeX-fold-mode) TeX-fold-mode "F") - (and (boundp 'LaTeX-math-mode) LaTeX-math-mode "M") - (and TeX-PDF-mode "P") - (and TeX-interactive-mode "I") - (and TeX-source-correlate-mode "S")))) - (setq mode-name (concat TeX-base-mode-name - (when (> (length trailing-flags) 0) - (concat "/" trailing-flags)))) - (when reset - (TeX-process-set-variable (TeX-master-file) - 'TeX-command-next TeX-command-default) - (TeX-process-set-variable (TeX-region-file) - 'TeX-command-next TeX-command-default)) - (set-buffer-modified-p (buffer-modified-p)))))) - -(defun TeX-mode-prefix () - "Return the prefix of the current mode as string." - (cdr (assoc major-mode '((plain-tex-mode . "plain-TeX") - (latex-mode . "LaTeX") - (doctex-mode . "docTeX") - (texinfo-mode . "Texinfo") - (context-mode . "ConTeXt"))))) - -;;; Viewing - -(defgroup TeX-view nil - "Calling viewers from AUCTeX." - :group 'TeX-command) - -(defcustom TeX-view-style - `((,(concat - "^" (regexp-opt '("a4paper" "a4dutch" "a4wide" "sem-a4")) "$") - "%(o?)xdvi %dS -paper a4 %d") - (,(concat "^" (regexp-opt '("a5paper" "a5comb")) "$") - "%(o?)xdvi %dS -paper a5 %d") - ("^b5paper$" "%(o?)xdvi %dS -paper b5 %d") - ("^letterpaper$" "%(o?)xdvi %dS -paper us %d") - ("^legalpaper$" "%(o?)xdvi %dS -paper legal %d") - ("^executivepaper$" "%(o?)xdvi %dS -paper 7.25x10.5in %d") - ("^landscape$" "%(o?)xdvi %dS -paper a4r -s 0 %d") - ;; The latest xdvi can show embedded postscript. If you don't - ;; have that, uncomment next line. - ;; ("^epsf$" "ghostview %f") - ("." "%(o?)xdvi %dS %d")) - "List of style options and view options. - -If the first element (a regular expression) matches the name of -one of the style files, any occurrence of the string `%v' in a -command in `TeX-command-list' will be replaced with the second -element. The first match is used, if no match is found the `%v' -is replaced with the empty string. - -As a default, the \"View\" command in `TeX-command-list' is set -to `%V'. This means that `TeX-output-view-style' will be -consulted before `TeX-view-style'. Only if no match is found in -`TeX-output-view-style' the settings in `TeX-view-style' will be -considered. If you want to bypass `TeX-output-view-style', which -is not recommended because it is more powerful than -`TeX-view-style', use `%v' in the \"View\" command." - :group 'TeX-view - :type '(repeat (group regexp (string :tag "Command")))) - -(defcustom TeX-output-view-style - `(("^dvi$" ("^landscape$" "^pstricks$\\|^pst-\\|^psfrag$") - "%(o?)dvips -t landscape %d -o && gv %f") - ("^dvi$" "^pstricks$\\|^pst-\\|^psfrag$" "%(o?)dvips %d -o && gv %f") - ("^dvi$" (,(concat - "^" (regexp-opt '("a4paper" "a4dutch" "a4wide" "sem-a4")) "$") - "^landscape$") - "%(o?)xdvi %dS -paper a4r -s 0 %d") - ("^dvi$" ,(concat - "^" (regexp-opt '("a4paper" "a4dutch" "a4wide" "sem-a4")) "$") - "%(o?)xdvi %dS -paper a4 %d") - ("^dvi$" (,(concat "^" (regexp-opt '("a5paper" "a5comb")) "$") - "^landscape$") - "%(o?)xdvi %dS -paper a5r -s 0 %d") - ("^dvi$" ,(concat "^" (regexp-opt '("a5paper" "a5comb")) "$") - "%(o?)xdvi %dS -paper a5 %d") - ("^dvi$" "^b5paper$" "%(o?)xdvi %dS -paper b5 %d") - ("^dvi$" "^letterpaper$" "%(o?)xdvi %dS -paper us %d") - ("^dvi$" "^legalpaper$" "%(o?)xdvi %dS -paper legal %d") - ("^dvi$" "^executivepaper$" "%(o?)xdvi %dS -paper 7.25x10.5in %d") - ("^dvi$" "." "%(o?)xdvi %dS %d") - ("^pdf$" "." "xpdf -remote %s -raise %o %(outpage)") - ("^html?$" "." "netscape %o")) - "List of output file extensions and view options. - -If the first element (a regular expression) matches the output -file extension, and the second element (a regular expression) -matches the name of one of the style options, any occurrence of -the string `%V' in a command in `TeX-command-list' will be -replaced with the third element. The first match is used; if no -match is found the `%V' is replaced with `%v'. The outcome of `%v' -is determined by the settings in `TeX-view-style' which therefore -serves as a fallback for `TeX-output-view-style'. The second -element may also be a list of regular expressions, in which case -all the regular expressions must match for the element to apply." - :group 'TeX-view - :type '(repeat (group - (regexp :tag "Extension") - (choice regexp (repeat :tag "List" regexp)) - (string :tag "Command")))) - -;;; Viewing (new implementation) - -(defvar TeX-view-predicate-list-builtin - '((output-dvi - (string-match "dvi" (TeX-output-extension))) - (output-pdf - (string-match "pdf" (TeX-output-extension))) - (output-html - (string-match "html" (TeX-output-extension))) - (style-pstricks - (TeX-match-style "^pstricks$\\|^pst-\\|^psfrag$")) - (engine-omega - (eq TeX-engine 'omega)) - (engine-xetex - (eq TeX-engine 'xetex)) - (mode-io-correlate - TeX-source-correlate-mode) - (paper-landscape - (TeX-match-style "\\`landscape\\'")) - (paper-portrait - (not (TeX-match-style "\\`landscape\\'"))) - (paper-a4 - (TeX-match-style "\\`a4paper\\|a4dutch\\|a4wide\\|sem-a4\\'")) - (paper-a5 - (TeX-match-style "\\`a5paper\\|a5comb\\'")) - (paper-b5 - (TeX-match-style "\\`b5paper\\'")) - (paper-letter - (TeX-match-style "\\`letterpaper\\'")) - (paper-legal - (TeX-match-style "\\`legalpaper\\'")) - (paper-executive - (TeX-match-style "\\`executivepaper\\'"))) - "Alist of built-in predicates for viewer selection and invocation. -See the doc string of `TeX-view-predicate-list' for a short -description of each predicate.") - -(defcustom TeX-view-predicate-list nil - "Alist of predicates for viewer selection and invocation. -The key of each list item is a symbol and the value a Lisp form -to be evaluated. The form should return nil if the predicate is -not fulfilled. - -Built-in predicates provided in `TeX-view-predicate-list-builtin' -can be overwritten by defining predicates with the same symbol. - -The following built-in predicates are available: - `output-dvi': The output is a DVI file. - `output-pdf': The output is a PDF file. - `output-html': The output is an HTML file. - `style-pstricks': The document loads a PSTricks package. - `engine-omega': The Omega engine is used for typesetting. - `engine-xetex': The XeTeX engine is used for typesetting. - `mode-io-correlate': TeX Source Correlate mode is active. - `paper-landscape': The document is typeset in landscape orientation. - `paper-portrait': The document is not typeset in landscape orientation. - `paper-a4': The paper format is A4. - `paper-a5': The paper format is A5. - `paper-b5': The paper format is B5. - `paper-letter': The paper format is letter. - `paper-legal': The paper format is legal. - `paper-executive': The paper format is executive." - :group 'TeX-view - :type '(alist :key-type symbol :value-type (group sexp))) - -(defvar TeX-view-program-list-builtin - (cond - ((eq system-type 'windows-nt) - '(("Yap" ("yap -1" (mode-io-correlate " -s %n%b") " %o")) - ("dvips and start" "dvips %d -o && start \"\" %f") - ("start" "start \"\" %o"))) -;; XXX: We need the advice of a Mac OS X user to configure this -;; correctly and test it. -;; ((eq system-type 'darwin) -;; '(("Preview.app" "open -a Preview.app %o") -;; ("Skim" "open -a Skim.app %o") -;; ("displayline" "displayline %n %o %b") -;; ("open" "open %o"))) - (t - '(("xdvi" ("%(o?)xdvi" - (mode-io-correlate " -sourceposition \"%n %b\" -editor \"%cS\"") - ((paper-a4 paper-portrait) " -paper a4") - ((paper-a4 paper-landscape) " -paper a4r") - ((paper-a5 paper-portrait) " -paper a5") - ((paper-a5 paper-landscape) " -paper a5r") - (paper-b5 " -paper b5") - (paper-letter " -paper us") - (paper-legal " -paper legal") - (paper-executive " -paper 7.25x10.5in") - " %d")) - ("dvips and gv" "%(o?)dvips %d -o && gv %f") - ("gv" "gv %o") - ("xpdf" ("xpdf -remote %s -raise %o" (mode-io-correlate " %(outpage)"))) - ("Evince" ("evince" (mode-io-correlate " -p %(outpage)") " %o")) - ("xdg-open" "xdg-open %o")))) - "Alist of built-in viewer specifications. -This variable should not be changed by the user who can use -`TeX-view-program-list' to add new viewers or overwrite the -definition of built-in ones. The latter variable also contains a -description of the data format.") - -(defcustom TeX-view-program-list nil - "Alist of viewer specifications. -This variable can be used to specify how a viewer is to be -invoked and thereby add new viewers on top of the built-in list -of viewers defined in `TeX-view-program-list-builtin' or override -entries in the latter. - -The car of each item is a string with a user-readable name. The -second element can be a command line to be run as a process or a -Lisp function to be executed. The command line can either be -specified as a single string or a list of strings and two-part -lists. The first element of the two-part lists is a symbol or a -list of symbols referring to one or more of the predicates in -`TeX-view-predicate-list' or `TeX-view-predicate-list-builtin'. -The second part of the two-part lists is a command line part. -The command line for the viewer is constructed by concatenating -the command line parts. Parts with a predicate are only -considered if the predicate was evaluated with a positive result. -Note that the command line can contain placeholders as defined in -`TeX-expand-list' which are expanded before the viewer is called. - -The use of a function as the second element only works if the -View command in `TeX-command-list' makes use of the hook -`TeX-run-discard-or-function'. - -Note: Predicates defined in the current Emacs session will only -show up in the customization interface for this variable after -restarting Emacs." - :group 'TeX-view - :type - `(alist - :key-type (string :tag "Name") - :value-type - (choice - (group :tag "Command" (string :tag "Command")) - (group :tag "Command parts" - (repeat - :tag "Command parts" - (choice - (string :tag "Command part") - (list :tag "Predicate and command part" - ,(let (list) - ;; Build the list of available predicates. - (mapc (lambda (spec) - (add-to-list 'list `(const ,(car spec)))) - (append TeX-view-predicate-list - TeX-view-predicate-list-builtin)) - ;; Sort the list alphabetically. - (setq list (sort list - (lambda (a b) - (string< - (downcase (symbol-name (cadr a))) - (downcase (symbol-name (cadr b))))))) - `(choice - (choice :tag "Predicate" ,@list) - (repeat :tag "List of predicates" - (choice :tag "Predicate" ,@list)))) - (string :tag "Command part"))))) - (group :tag "Function" function)))) - -;; XXX: Regarding a possibility to (manually) run an update command, -;; one could support this through `TeX-view' by letting it temporarily -;; set a variable which is checked with a predicate in the viewer -;; selection. If the check is positive, the update command is run -;; instead of the normal viewer command. Direct support through the -;; View command would require a predicate which knows when an update -;; has to be done. -(defcustom TeX-view-program-selection - (cond - ((eq system-type 'windows-nt) - '(((output-dvi style-pstricks) "dvips and start") - (output-dvi "Yap") - (output-pdf "start") - (output-html "start"))) -;; XXX: We need the advice of a Mac OS X user to configure this -;; correctly and test it. -;; ((eq system-type 'darwin) -;; '((output-dvi "open") -;; (output-pdf "open") -;; (output-html "open"))) - (t - '(((output-dvi style-pstricks) "dvips and gv") - (output-dvi "xdvi") - (output-pdf "Evince") - (output-html "xdg-open")))) - "Alist of predicates and viewers. -Each entry consists of a list with two elements. The first -element is a symbol or list of symbols referring to predicates as -defined in `TeX-view-predicate-list' or -`TeX-view-predicate-list-builtin'. The second element is a -string referring to the name of a viewer as defined in -`TeX-view-program-list' or `TeX-view-program-list-builtin'. - -When a viewer is called for, the entries are evaluated in turn -and the viewer related to the first entry all predicates of which -are evaluated positively is chosen." - :group 'TeX-view - :type `(alist :key-type - ;; Offer list of defined predicates. - ,(let (list) - (mapc (lambda (spec) - (add-to-list 'list `(const ,(car spec)))) - (append TeX-view-predicate-list - TeX-view-predicate-list-builtin)) - (setq list (sort list - (lambda (a b) - (string< - (downcase (symbol-name (cadr a))) - (downcase (symbol-name (cadr b))))))) - `(choice (choice :tag "Single predicate" ,@list) - (repeat :tag "Multiple predicates" - (choice ,@list)))) - :value-type - ;; Offer list of defined viewers. - (group (choice :tag "Viewer" - ,@(let (list) - (mapc (lambda (spec) - (add-to-list 'list - `(const ,(car spec)))) - (append TeX-view-program-list - TeX-view-program-list-builtin)) - (sort list - (lambda (a b) - (string< (downcase (cadr a)) - (downcase (cadr b)))))))))) - -(defun TeX-match-style (regexp) - "Check if a style matching REGEXP is active." - (TeX-member regexp (TeX-style-list) 'string-match)) - -(defun TeX-view-match-predicate (predicate) - "Check if PREDICATE is true. -PREDICATE can be a symbol or a list of symbols defined in -`TeX-view-predicate-list-builtin' or `TeX-view-predicate-list'. -In case of a single symbol, return t if the predicate is true, -nil otherwise. In case of a list of symbols, return t if all -predicates are true, nil otherwise." - (let ((pred-symbols (if (listp predicate) predicate (list predicate))) - (pred-defs (append TeX-view-predicate-list - TeX-view-predicate-list-builtin)) - (result t) - elt) - (while (and (setq elt (pop pred-symbols)) result) - (unless (eval (cadr (assq elt pred-defs))) - (setq result nil))) - result)) - -(defun TeX-view-command-raw () - "Choose a viewer and return its unexpanded command string." - (let ((selection TeX-view-program-selection) - entry viewer spec command) - ;; Find the appropriate viewer. - (while (and (setq entry (pop selection)) (not viewer)) - (when (TeX-view-match-predicate (car entry)) - (setq viewer (cadr entry)))) - (unless viewer - (error "No matching viewer found")) - ;; Get the command line or function spec. - (setq spec (cadr (assoc viewer (append TeX-view-program-list - TeX-view-program-list-builtin)))) - (cond ((functionp spec) - ;; Converting the function call to a string is ugly, but - ;; the backend currently only supports strings. - (prin1-to-string spec)) - ((stringp spec) - spec) - (t - ;; Build the unexpanded command line. Pieces with predicates are - ;; only added if the predicate is evaluated positively. - (dolist (elt spec) - (cond ((stringp elt) - (setq command (concat command elt))) - ((listp elt) - (when (TeX-view-match-predicate (car elt)) - (setq command (concat command (cadr elt))))))) - command)))) - -;;; Engine - -(defvar TeX-engine-alist-builtin - '((default "Default" TeX-command LaTeX-command ConTeXt-engine) - (xetex "XeTeX" "xetex" "xelatex" "xetex") - (luatex "LuaTeX" "luatex" "lualatex" "luatex") - (omega "Omega" TeX-Omega-command LaTeX-Omega-command ConTeXt-Omega-engine)) - "Alist of built-in TeX engines and associated commands. -For a description of the format see `TeX-engine-alist'.") - -(defcustom TeX-engine-alist nil - "Alist of TeX engines and associated commands. -Each entry is a list with a maximum of five elements. The first -element is a symbol used to identify the engine. The second is a -string describing the engine. The third is the command to be -used for plain TeX. The fourth is the command to be used for -LaTeX. The fifth is the command to be used for the --engine -parameter of ConTeXt's texexec program. Each command can either -be a variable or a string. An empty string or nil means there is -no command available. - -You can override a built-in engine defined in the variable -`TeX-engine-alist-builtin' by adding an entry beginning with the -same symbol as the built-in entry to `TeX-engine-alist'." - :group 'TeX-command - :type '(repeat (group symbol - (string :tag "Name") - (choice :tag "Plain TeX command" string variable) - (choice :tag "LaTeX command" string variable) - (choice :tag "ConTeXt command" string variable)))) - -(defun TeX-engine-alist () - "Return an alist of TeX engines. -The function appends the built-in engine specs from -`TeX-engine-alist-builtin' and the user-defined engines from -`TeX-engine-alist' and deletes any entries from the built-in part -where an entry with the same car exists in the user-defined part." - (TeX-delete-dups-by-car (append TeX-engine-alist TeX-engine-alist-builtin))) - -(defcustom TeX-engine 'default - (concat "Type of TeX engine to use. -It should be one of the following symbols:\n\n" - (mapconcat (lambda (x) (format "* `%s'" (car x))) - (TeX-engine-alist) "\n")) - :group 'TeX-command - :type `(choice ,@(mapcar (lambda (x) - `(const :tag ,(nth 1 x) ,(car x))) - (TeX-engine-alist)))) -(make-variable-buffer-local 'TeX-engine) -(put 'TeX-engine 'safe-local-variable - (lambda (arg) (memq arg (mapcar 'car TeX-engine-alist-builtin)))) - -(defun TeX-engine-set (type) - (concat "Set TeX engine to TYPE. -TYPE can be one of the following symbols:\n" - (mapconcat (lambda (x) (format "* `%s'" (car x))) - (TeX-engine-alist) "\n")) - (interactive (list (completing-read "Engine: " - (mapcar (lambda (x) - (symbol-name (car x))) - (TeX-engine-alist)) - nil t))) - (when (stringp type) - (setq type (intern type))) - (setq TeX-engine type) - ;; Automatically enable or disable TeX PDF mode as a convenience - (cond ((eq type 'xetex) (TeX-PDF-mode 1)) - ((eq type 'omega) (TeX-PDF-mode 0)))) - -(define-minor-mode TeX-Omega-mode - "Minor mode for using the Omega engine." - nil nil nil - :group 'TeX-command - (TeX-engine-set (if TeX-Omega-mode 'omega 'default))) -(defalias 'tex-omega-mode 'TeX-Omega-mode) -(TeX--call-3/2 #'make-obsolete 'TeX-Omega-mode 'TeX-engine-set "before 11.86") -(TeX--call-3/2 #'make-obsolete-variable 'TeX-Omega-mode - 'TeX-engine "before 11.86") - -;;; Forward and inverse search - -(defcustom TeX-source-correlate-method 'auto - "Method to use for enabling forward and inverse search. -This can be `source-specials' if source specials should be used, -`synctex' if SyncTeX should be used, or`auto' if AUCTeX should -decide. - -Setting this variable does not take effect if TeX Source -Correlate mode has already been active. Restart Emacs in this -case." - :type '(choice (const auto) (const synctex) (const source-specials)) - :group 'TeX-view) - -(defvar TeX-source-correlate-method-active nil - "Method actually used for forward and inverse search.") - -(defvar TeX-source-correlate-output-page-function nil - "Symbol of function returning an output page relating to buffer position. -The function should take no arguments and return the page numer -as a string.") -(make-variable-buffer-local 'TeX-source-correlate-output-page-function) - -(defcustom TeX-source-correlate-start-server 'ask - "Control if server should be started for inverse search." - :type '(choice (const :tag "Always" t) - (const :tag "Never" nil) - (const :tag "Ask" ask)) - :group 'TeX-view) -(when (fboundp 'defvaralias) - (defvaralias 'TeX-source-specials-view-start-server - 'TeX-source-correlate-start-server)) - -(defvar TeX-source-correlate-start-server-asked nil - "Keep track if question about server start search was asked.") - -(defvar TeX-source-correlate-start-server-flag nil - "If non-nil, `TeX-source-correlate-start-server-maybe' will start a server. -Code related to features requiring a server, e.g. for inverse -search, can set the variable.") - -(defun TeX-source-correlate-gnuserv-p () - "Guess whether to use gnuserv when a server is requested." - (cond ((and (boundp 'gnuserv-process) - (processp gnuserv-process))) - ((and (boundp 'server-process) - (processp server-process)) - nil) - ((featurep 'xemacs)))) - -(defun TeX-source-correlate-server-enabled-p () - "Return non-nil if Emacs server or gnuserv is enabled." - (let* ((gnuserv-p (TeX-source-correlate-gnuserv-p)) - (process (if gnuserv-p 'gnuserv-process 'server-process))) - (and (boundp process) (processp (symbol-value process))))) - -(defun TeX-source-correlate-start-server-maybe () - "Start Emacs server or gnuserv if a feature using it is enabled. -This is the case if `TeX-source-correlate-start-server-flag' is non-nil." - (when (and TeX-source-correlate-start-server-flag - (not (TeX-source-correlate-server-enabled-p))) - (let* ((gnuserv-p (TeX-source-correlate-gnuserv-p)) - (start (if gnuserv-p 'gnuserv-start 'server-start))) - (cond - ;; Server should be started unconditionally - ((eq TeX-source-correlate-start-server t) - (funcall start)) - ;; Ask user if server is to be started - ((and (eq TeX-source-correlate-start-server 'ask) - (not TeX-source-correlate-start-server-asked) - (prog1 - (y-or-n-p (format "Start %s for inverse search in viewer? " - (if gnuserv-p - "gnuserv" - "Emacs server"))) - (setq TeX-source-correlate-start-server-asked t))) - (funcall start)))))) - -(defun TeX-source-correlate-determine-method () - "Determine which method is available for forward and inverse search." - (let ((help (condition-case nil - (with-output-to-string - (call-process LaTeX-command - nil (list standard-output nil) nil "--help")) - (error "")))) - (if (string-match "^[ ]*-synctex" help) - 'synctex - 'source-specials))) - -(defun TeX-source-correlate-expand-options () - "Return TeX engine command line option for forward search facilities. -The return value depends on the value of `TeX-source-correlate-mode'. -If this is nil, an empty string will be returned." - (if TeX-source-correlate-mode - (if (eq TeX-source-correlate-method-active 'source-specials) - (concat TeX-source-specials-tex-flags - (if TeX-source-specials-places - ;; -src-specials=WHERE: insert source specials - ;; in certain places of the DVI file. WHERE is a - ;; comma-separated value list: cr display hbox - ;; math par parend vbox - (concat "=" (mapconcat 'identity - TeX-source-specials-places ",")))) - TeX-synctex-tex-flags) - "")) - -(defvar TeX-source-correlate-map - (let ((map (make-sparse-keymap))) - ;; (if (featurep 'xemacs) - ;; (define-key map [(control button1)] #'TeX-view-mouse) - ;; (define-key map [C-down-mouse-1] #'TeX-view-mouse)) - map) - "Keymap for `TeX-source-correlate-mode'. -You could use this for unusual mouse bindings.") - -(define-minor-mode TeX-source-correlate-mode - "Minor mode for forward and inverse search. - -If enabled, the viewer can be advised to show the output page -corresponding to the point in the source and vice versa. - -The method to be used can be controlled with the variable -`TeX-source-correlate-method'. Currently source specials or -SyncTeX are recognized." - :group 'TeX-view - ;; Since this is a global minor mode and we don't want to require - ;; tex.el when the mode variable is set, the mode function is called - ;; explicitely (if necessary) in `VirTeX-common-initialization'. We - ;; do it there because otherwise `kill-all-local-variables' would - ;; reset `TeX-source-correlate-output-page-function' which is - ;; buffer-local. - :global t - (set-keymap-parent TeX-mode-map (and TeX-source-correlate-mode - TeX-source-correlate-map)) - (TeX-set-mode-name 'TeX-source-correlate-mode t t) - (setq TeX-source-correlate-start-server-flag TeX-source-correlate-mode) - (unless TeX-source-correlate-method-active - (setq TeX-source-correlate-method-active - (if (eq TeX-source-correlate-method 'auto) - (TeX-source-correlate-determine-method) - TeX-source-correlate-method))) - (when (eq TeX-source-correlate-method-active 'synctex) - (setq TeX-source-correlate-output-page-function - (when TeX-source-correlate-mode - 'TeX-synctex-output-page)))) -(defalias 'TeX-source-specials-mode 'TeX-source-correlate-mode) -(TeX--call-3/2 #'make-obsolete 'TeX-source-specials-mode - 'TeX-source-correlate-mode "before 11.86") -(defalias 'tex-source-correlate-mode 'TeX-source-correlate-mode) -(put 'TeX-source-correlate-mode 'safe-local-variable 'TeX-booleanp) -;; We do not want the custom variable to require tex.el. This is only -;; necessary if AUCTeX was compiled with Emacs 21. -(put 'TeX-source-correlate-mode 'custom-requests nil) -(setq minor-mode-map-alist - (delq (assq 'TeX-source-correlate-mode minor-mode-map-alist) - minor-mode-map-alist)) - - -;;; Source Specials - -(defcustom TeX-source-specials-tex-flags "-src-specials" - "Extra flags to pass to TeX commands to generate source specials." - :group 'TeX-view - :type 'string) - -(defcustom TeX-source-specials-places nil - "List of places where to insert source specials into the DVI file. -If nil, use (La)TeX's defaults." - :group 'TeX-view - :type '(list (set :inline t - ;; :tag "Options known to work" - ;; cr display hbox math par parend vbox - (const "cr") - (const "display") - (const "hbox") - (const "math") - (const "par") - (const "parend") - (const "vbox")) - (repeat :inline t - :tag "Other options" - (string)))) - -(defcustom TeX-source-specials-view-position-flags - "-sourceposition \"%n %b\"" - "Flags to pass to the DVI viewer commands for the position in the source." - :group 'TeX-view - :type 'string) - -(defcustom TeX-source-specials-view-editor-flags - "-editor \"%cS\"" - "Flags to pass to DVI viewer commands for inverse search." - :group 'TeX-view - :type 'string) - -(defcustom TeX-source-specials-view-gnuclient-flags - "-q +%%l %%f" - "Flags to pass to gnuclient for inverse search." - :group 'TeX-view - :type 'string) - -(defcustom TeX-source-specials-view-emacsclient-flags - "--no-wait +%%l %%f" - "Flags to emacsclient for inverse search." - :group 'TeX-view - :type 'string) - -;; FIXME: Make client binaries configurable. -(defun TeX-source-specials-view-expand-client () - "Return gnuclient or emacslient executable with options. -Return the full path to the executable if possible." - (let* ((gnuserv-p (TeX-source-correlate-gnuserv-p)) - (client-base (if gnuserv-p - "gnuclient" - "emacsclient")) - (client-full (and invocation-directory - (expand-file-name client-base - invocation-directory))) - (options (if gnuserv-p - TeX-source-specials-view-gnuclient-flags - TeX-source-specials-view-emacsclient-flags))) - (if (and client-full (file-executable-p client-full)) - (concat client-full " " options) - (concat client-base " " options)))) - -(defun TeX-source-specials-view-expand-options (&optional viewer) - "Return source specials command line option for viewer command. -The return value depends on the values of -`TeX-source-correlate-mode' and -`TeX-source-correlate-method-active'. If those are nil or not -`source-specials' respectively, an empty string will be -returned." - (if (and TeX-source-correlate-mode - (eq TeX-source-correlate-method-active 'source-specials)) - (concat TeX-source-specials-view-position-flags - (when (TeX-source-correlate-server-enabled-p) - (concat " " TeX-source-specials-view-editor-flags))) - "")) - -;;; SyncTeX - -(defvar TeX-synctex-tex-flags "--synctex=1" - "Extra flags to pass to TeX commands to enable SyncTeX.") - -(defun TeX-synctex-output-page () - "Return the page corresponding to the current source position. -This method assumes that the document was compiled with SyncTeX -enabled and the `synctex' binary is available." - (let ((synctex-output - (with-output-to-string - (call-process "synctex" nil (list standard-output nil) nil "view" - "-i" (format "%s:%s:%s" (line-number-at-pos) - (current-column) - ;; The file name relative to the - ;; directory of the master file. - (file-relative-name - (buffer-file-name) - (file-name-directory - (TeX-active-master)))) - "-o" (TeX-active-master (TeX-output-extension)))))) - (when (string-match "Page:\\([0-9]+\\)" synctex-output) - (match-string 1 synctex-output)))) - -;;; Miscellaneous minor modes - -(defvar TeX-mode-p nil - "This indicates a TeX mode being active.") -(make-variable-buffer-local 'TeX-mode-p) - -(defun TeX-mode-set (var value) - (set-default var value) - (TeX-set-mode-name var nil t)) - -(defcustom TeX-PDF-mode nil nil - :group 'TeX-command - :set 'TeX-mode-set - :type 'boolean) -(put 'TeX-PDF-mode 'safe-local-variable 'TeX-booleanp) - -(define-minor-mode TeX-PDF-mode - "Minor mode for using PDFTeX. - -If enabled, PDFTeX will be used as an executable by default. -You can customize an initial value, and you can use the -function `TeX-global-PDF-mode' for toggling this value." - :group 'TeX-command - (when (eq TeX-engine 'omega) - (setq TeX-PDF-mode nil)) - (setq TeX-PDF-mode-parsed nil) - (TeX-set-mode-name nil nil t) - (setq TeX-output-extension - (if TeX-PDF-mode "pdf" "dvi"))) -(add-to-list 'minor-mode-alist '(TeX-PDF-mode "")) - -(defun TeX-global-PDF-mode (&optional arg) - "Toggle default for `TeX-PDF-mode'." - (interactive "P") - (prog1 - (setq-default TeX-PDF-mode - (if arg (> (prefix-numeric-value arg) 0) - (not (default-value 'TeX-PDF-mode)))) - (TeX-set-mode-name 'TeX-PDF-mode nil t))) - -(defalias 'tex-pdf-mode 'TeX-PDF-mode) - -(defvar TeX-PDF-mode-parsed nil - "Set if `TeX-PDF-mode' has come about by parsing.") - -(make-variable-buffer-local 'TeX-PDF-mode-parsed) - -(defun TeX-PDF-mode-parsed (arg) - "Change `TeX-PDF-mode' to ARG based on parsing. -If this conflicts with previous parsed settings, -just use the default. If an explicit setting is -already established, don't do anything." - -;; Basically we have the following situations: -;; TeX-PDF-mode-parsed (local-variable-p 'TeX-PDF-mode): -;; nil nil : virgin state -;; nil t : stably set state (possibly because of conflicting parse info) -;; t t : non-conflicting parsed info - - (if TeX-PDF-mode-parsed - (unless (eq TeX-PDF-mode arg) - (TeX-PDF-mode (if (default-value 'TeX-PDF-mode) 1 0))) - (unless (local-variable-p 'TeX-PDF-mode (current-buffer)) - (TeX-PDF-mode (if arg 1 0)) - (setq TeX-PDF-mode-parsed t)))) - -(defun TeX-PDF-mode-on () - "Use only from parsing routines." - (TeX-PDF-mode-parsed t)) - -(defun TeX-PDF-mode-off () - "Use only from parsing routines." - (TeX-PDF-mode-parsed nil)) - -(defcustom TeX-DVI-via-PDFTeX nil - "Whether to use PDFTeX also for producing DVI files." - :group 'TeX-command - :type 'boolean) - -(define-minor-mode TeX-interactive-mode - "Minor mode for interactive runs of TeX." - nil nil nil - :group 'TeX-command - (TeX-set-mode-name 'TeX-interactive-mode t t)) -(defalias 'tex-interactive-mode 'TeX-interactive-mode) -(add-to-list 'minor-mode-alist '(TeX-interactive-mode "")) - -;;; Commands - -(defgroup TeX-command-name nil - "Names for external commands in AUCTeX." - :group 'TeX-command) - -(defcustom TeX-command-BibTeX "BibTeX" - "*The name of the BibTeX entry in `TeX-command-list'." - :group 'TeX-command-name - :type 'string) - (make-variable-buffer-local 'TeX-command-BibTeX) - -(defcustom TeX-command-Show "View" - "*The default command to show (view or print) a TeX file. -Must be the car of an entry in `TeX-command-list'." - :group 'TeX-command-name - :type 'string) - (make-variable-buffer-local 'TeX-command-Show) - -(defcustom TeX-command-Print "Print" - "The name of the Print entry in `TeX-command-Print'." - :group 'TeX-command-name - :type 'string) - -(defcustom TeX-command-Queue "Queue" - "The name of the Queue entry in `TeX-command-Queue'." - :group 'TeX-command-name - :type 'string) - -(defvar TeX-trailer-start nil - "Regular expression delimiting start of trailer in a TeX file.") - - (make-variable-buffer-local 'TeX-trailer-start) - -(defvar TeX-header-end nil - "Regular expression delimiting end of header in a TeX file.") - - (make-variable-buffer-local 'TeX-header-end) - -(defvar TeX-command-default nil - "The default command for `TeX-command' in the current major mode.") - - (make-variable-buffer-local 'TeX-command-default) - -(put 'TeX-command-default 'safe-local-variable 'stringp) - -(defvar TeX-clean-default-intermediate-suffixes - '("\\.aux" "\\.bbl" "\\.blg" "\\.brf" "\\.fot" - "\\.glo" "\\.gls" "\\.idx" "\\.ilg" "\\.ind" - "\\.lof" "\\.log" "\\.lot" "\\.nav" "\\.out" - "\\.snm" "\\.toc" "\\.url" "\\.synctex\\.gz") - "List of regexps matching suffixes of files to be cleaned. -Used as a default in TeX, LaTeX and docTeX mode.") - -(defvar TeX-clean-default-output-suffixes - '("\\.dvi" "\\.pdf" "\\.ps" "\\.xdv") - "List of regexps matching suffixes of files to be cleaned. -Used as a default in TeX, LaTeX and docTeX mode.") - -(defcustom TeX-clean-confirm t - "If non-nil, ask before deleting files." - :type 'boolean - :group 'TeX-command) - -(autoload 'dired-mark-pop-up "dired") - -(defun TeX-clean (&optional arg) - "Delete generated files associated with current master and region files. -If prefix ARG is non-nil, not only remove intermediate but also -output files." - (interactive "P") - (let* ((mode-prefix (TeX-mode-prefix)) - (suffixes (append (symbol-value - (intern (concat mode-prefix - "-clean-intermediate-suffixes"))) - (when arg - (symbol-value - (intern (concat mode-prefix - "-clean-output-suffixes")))))) - (master (TeX-active-master)) - (master-dir (file-name-directory master)) - (regexp (concat "\\(" - (file-name-nondirectory master) "\\|" - (TeX-region-file nil t) - "\\)" - "\\(" - (mapconcat 'identity suffixes "\\|") - "\\)\\'" - "\\|" (TeX-region-file t t))) - (files (when regexp - (directory-files (or master-dir ".") nil regexp)))) - (if files - (when (or (not TeX-clean-confirm) - (condition-case nil - (dired-mark-pop-up " *Deletions*" 'delete - (if (> (length files) 1) - files - (cons t files)) - 'y-or-n-p "Delete files? ") - (wrong-type-argument ; e.g. with Emacs 21 - (y-or-n-p (format "Delete %S? " (car files)))))) - (dolist (file files) - (delete-file (concat master-dir file)))) - (message "No files to be deleted")))) - - -;;; Master File - -(defcustom TeX-master t - "*The master file associated with the current buffer. -If the file being edited is actually included from another file, you -can tell AUCTeX the name of the master file by setting this variable. -If there are multiple levels of nesting, specify the top level file. - -If this variable is nil, AUCTeX will query you for the name. - -If the variable is t, AUCTeX will assume the file is a master file -itself. - -If the variable is 'shared, AUCTeX will query for the name, but not -change the file. - -If the variable is 'dwim, AUCTeX will try to avoid querying by -attempting to `do what I mean'; and then change the file. - -It is suggested that you use the File Variables (see the info node in -the Emacs manual) to set this variable permanently for each file." - :group 'TeX-command - :group 'TeX-parse - :type '(choice (const :tag "Query" nil) - (const :tag "This file" t) - (const :tag "Shared" shared) - (const :tag "Dwim" dwim) - (string :format "%v"))) -(make-variable-buffer-local 'TeX-master) -(put 'TeX-master 'safe-local-variable - '(lambda (x) - (or (stringp x) - (member x (quote (t nil shared dwim)))))) - -(defcustom TeX-one-master "\\.\\(texi?\\|dtx\\)$" - "*Regular expression matching ordinary TeX files. - -You should set this variable to match the name of all files, where -automatically adding a file variable with the name of the master file -is a good idea. When AUCTeX adds the name of the master file as a -file variable, it does not need to ask next time you edit the file. - -If you dislike AUCTeX automatically modifying your files, you can set -this variable to \"\"." - :group 'TeX-command - :type 'regexp) - -(defvar TeX-convert-master t - "*If not nil, automatically convert ``Master:'' lines to file variables. -This will be done when AUCTeX first try to use the master file.") - -;; Can be let-bound temporarily in order to inhibit the master file question -;; by using its value instead in case `TeX-master' is nil or 'shared. -(defvar TeX-transient-master nil) - -(defun TeX-dwim-master () - "Find a likely `TeX-master'." - (let ((dir default-directory)) - (dolist (buf (buffer-list)) - (when (with-current-buffer buf - (and (equal dir default-directory) - (stringp TeX-master))) - (return (with-current-buffer buf TeX-master)))))) - -(defun TeX-master-file-ask () - "Ask for master file, set `TeX-master' and add local variables." - (interactive) - (if (TeX-local-master-p) - (error "Master file already set") - (let* ((default (TeX-dwim-master)) - (name (or (and (eq 'dwim TeX-master) default) - (condition-case nil - (read-file-name (format "Master file: (default %s) " - (or default "this file")) - nil default) - (quit ""))))) - (cond ((string= name "") - (setq TeX-master t)) - ((string= name default) - (setq TeX-master default) - (TeX-add-local-master)) - ((or - ;; Default `read-file-name' proposes and buffer visits a file. - (string= (expand-file-name name) (buffer-file-name)) - ;; Default of `read-file-name' and buffer does not visit a file. - (string= name default-directory) - ;; User typed in an empty minibuffer. - (string= name "")) - (setq TeX-master t) - (TeX-add-local-master)) - (t - (setq TeX-master (TeX-strip-extension (file-relative-name name) - (list TeX-default-extension) - 'path)) - (TeX-add-local-master)))))) - -(defun TeX-master-file (&optional extension nondirectory ask) - "Set and return the name of the master file for the current document. - -If optional argument EXTENSION is non-nil, add that file extension to -the name. Special value t means use `TeX-default-extension'. - -If optional second argument NONDIRECTORY is non-nil, do not include -the directory. - -If optional third argument ASK is non-nil, ask the user for the -name of master file if it cannot be determined otherwise. - -Currently it will check for the presence of a ``Master:'' line in -the beginning of the file, but that feature will be phased out." - (interactive) - (if (eq extension t) - (setq extension TeX-default-extension)) - (let ((my-name (if (buffer-file-name) - (TeX-strip-extension nil (list TeX-default-extension) t) - ""))) - (save-excursion - (save-restriction - (widen) - (goto-char (point-min)) - (cond - ((and TeX-transient-master - (or (not TeX-master) (eq TeX-master 'shared))) - (setq TeX-master TeX-transient-master)) - ;; Special value 't means it is own master (a free file). - ((equal TeX-master my-name) - (setq TeX-master t)) - - ;; For files shared between many documents. - ((and (eq 'shared TeX-master) ask) - (setq TeX-master - (let* ((default (TeX-dwim-master)) - (name (read-file-name - (format "Master file: (default %s) " - (or default "this file")) - nil default))) - (cond ((string= name default) - default) - ((or - ;; Default `read-file-name' proposes and - ;; buffer visits a file. - (string= (expand-file-name name) - (buffer-file-name)) - ;; Default of `read-file-name' and - ;; buffer does not visit a file. - (string= name default-directory) - ;; User typed in an empty minibuffer. - (string= name "")) - t) - (t - (TeX-strip-extension - name (list TeX-default-extension) 'path)))))) - - ;; We might already know the name. - ((or (eq TeX-master t) (stringp TeX-master)) TeX-master) - - ;; Support the ``Master:'' line (under protest!) - ((re-search-forward - "^%% *[Mm]aster:?[ \t]*\\([^ \t\n]+\\)" 500 t) - (setq TeX-master - (TeX-strip-extension (TeX-match-buffer 1) - (list TeX-default-extension))) - (if TeX-convert-master - (progn - (beginning-of-line) - (kill-line 1) - (TeX-add-local-master)))) - - ;; Ask the user (but add it as a local variable). - (ask (TeX-master-file-ask))))) - - (let ((name (if (stringp TeX-master) - TeX-master - my-name))) - - (if (TeX-match-extension name) - ;; If it already has an extension... - (if (equal extension TeX-default-extension) - ;; Use instead of the default extension - (setq extension nil) - ;; Otherwise drop it. - (setq name (TeX-strip-extension name)))) - - ;; Remove directory if needed. - (if nondirectory - (setq name (file-name-nondirectory name))) - - (if extension - (concat name "." extension) - name)))) - -(defun TeX-master-directory () - "Directory of master file." - (file-name-as-directory - (abbreviate-file-name - (substitute-in-file-name - (expand-file-name - (let ((dir (file-name-directory (TeX-master-file)))) - (if dir (directory-file-name dir) ".")) - (and buffer-file-name - (file-name-directory buffer-file-name))))))) - -(defun TeX-add-local-master () - "Add local variable for `TeX-master'." - (when (and (buffer-file-name) - (string-match TeX-one-master - (file-name-nondirectory (buffer-file-name))) - (not buffer-read-only)) - (goto-char (point-max)) - (if (re-search-backward (concat "^\\([^\n]+\\)Local " "Variables:") - (- (point-max) 3000) t) - (let ((prefix (TeX-match-buffer 1))) - (re-search-forward (regexp-quote (concat prefix - "End:"))) - (beginning-of-line 1) - (insert prefix "TeX-master: " (prin1-to-string TeX-master) "\n")) - (let ((comment-prefix (cond ((eq major-mode 'texinfo-mode) "@c ") - ((eq major-mode 'doctex-mode) "% ") - (t "%%% "))) - (mode (concat (and (boundp 'japanese-TeX-mode) japanese-TeX-mode - "japanese-") - (substring (symbol-name major-mode) 0 -5)))) - (newline) - (when (eq major-mode 'doctex-mode) - (insert comment-prefix TeX-esc "endinput\n")) - (insert - comment-prefix "Local " "Variables: \n" - comment-prefix "mode: " mode "\n" - comment-prefix "TeX-master: " (prin1-to-string TeX-master) "\n" - comment-prefix "End: \n"))))) - -(defun TeX-local-master-p () - "Return non-nil if there is a `TeX-master' entry in local variables spec. -Return nil otherwise." - (save-excursion - ;; XXX: Checking -*- line necessary as well? - (goto-char (point-max)) - (search-backward "\n\^L" (max (- (point-max) 3000) (point-min)) 'move) - (re-search-forward "^%+ *TeX-master:" nil t))) - -;;; Style Paths - -(defcustom TeX-style-global (expand-file-name "style" TeX-data-directory) - "*Directory containing hand generated TeX information. - -These correspond to TeX macros shared by all users of a site." - :group 'TeX-file - :type 'directory) - -(defcustom TeX-auto-local "auto" - "*Directory containing automatically generated TeX information. - -This correspond to TeX macros found in the current directory, and must -be relative to that." - :group 'TeX-file - :type 'string) - -(defcustom TeX-style-local "style" - "*Directory containing hand generated TeX information. - -These correspond to TeX macros found in the current directory, and must -be relative to that." - :group 'TeX-file - :type 'string) - -(defun TeX-split-string (regexp string) - "Return a list of strings. -Given REGEXP the STRING is split into sections which in string was -seperated by REGEXP. - -Examples: - - (TeX-split-string \"\:\" \"abc:def:ghi\") - -> (\"abc\" \"def\" \"ghi\") - - (TeX-split-string \" +\" \"dvips -Plw -p3 -c4 testfile.dvi\") - - -> (\"dvips\" \"-Plw\" \"-p3\" \"-c4\" \"testfile.dvi\") - -If REGEXP is nil, or \"\", an error will occur." - - (let ((start 0) result match) - (while (setq match (string-match regexp string start)) - (push (substring string start match) result) - (setq start (match-end 0))) - (push (substring string start) result) - (nreverse result))) - -(defun TeX-parse-path (env) - "Return a list if private TeX directories found in environment variable ENV." - (let* ((value (getenv env)) - (entries (and value - (TeX-split-string - (if (string-match ";" value) ";" ":") - value))) - entry - answers) - (while entries - (setq entry (car entries)) - (setq entries (cdr entries)) - (setq entry (file-name-as-directory - (if (string-match "/?/?\\'" entry) - (substring entry 0 (match-beginning 0)) - entry))) - (or (not (file-name-absolute-p entry)) - (member entry (append '("/" "\\") TeX-macro-global)) - (setq answers (cons entry answers)))) - answers)) - -(defun TeX-macro-global () - "Return directories containing the site's TeX macro and style files." - (or (TeX-tree-expand '("$SYSTEXMF" "$TEXMFLOCAL" "$TEXMFMAIN" "$TEXMFDIST") - "latex" '("/tex/" "/bibtex/bst/")) - '("/usr/share/texmf/tex/" "/usr/share/texmf/bibtex/bst/"))) - -(defun TeX-macro-private () - "Return directories containing the user's TeX macro and style files." - (TeX-tree-expand '("$TEXMFHOME") "latex" '("/tex/" "/bibtex/bst/"))) - -(defun TeX-tree-expand (trees program subdirs) - "Return directories corresponding to the TeX trees TREES. -This is done calling `kpsewhich' where PROGRAM is passed as the -parameter for --progname. SUBDIRS are subdirectories which are -appended to the directories of the TeX trees." - (let (path-list path exit-status input-dir-list) - (condition-case nil - (catch 'success - (dotimes (i (safe-length trees)) - (setq path (with-output-to-string - (setq exit-status - (call-process - "kpsewhich" nil - (list standard-output nil) nil - "--progname" program - "--expand-braces" (nth i trees))))) - (if (zerop exit-status) - (progn (add-to-list 'path-list path) - (when (zerop i) (throw 'success nil))) - (setq path (with-output-to-string - (setq exit-status - (call-process - "kpsewhich" nil - (list standard-output nil) nil - "--progname" program - "--expand-path" (nth i trees))))) - (when (zerop exit-status) (add-to-list 'path-list path))))) - (error nil)) - (dolist (elt path-list) - (let ((separators (if (string-match "^[A-Za-z]:" elt) - "[\n\r;]" - "[\n\r:]"))) - (dolist (item (condition-case nil - (split-string elt separators t) - ;; COMPATIBILITY for XEmacs <= 21.4.15 - (error (delete "" (split-string elt separators))))) - (when (string-match "^!+" item) - (setq item (substring item (match-end 0) (length item)))) - (when (string-match "/+$" item) - (setq item (substring item 0 (match-beginning 0)))) - (dolist (subdir subdirs) - (when (file-exists-p (file-name-as-directory (concat item subdir))) - (add-to-list 'input-dir-list (concat item subdir))))))) - input-dir-list)) - -(defcustom TeX-macro-global (TeX-macro-global) - "Directories containing the site's TeX macro and style files." - :group 'TeX-file - :type '(repeat (directory :format "%v"))) - -(defcustom TeX-macro-private (or (append (TeX-parse-path "TEXINPUTS") - (TeX-parse-path "BIBINPUTS")) - (TeX-macro-private)) - "Directories where you store your personal TeX macros." - :group 'TeX-file - :type '(repeat (file :format "%v"))) - -(defcustom TeX-auto-private - (list (expand-file-name TeX-auto-local - (or (and (boundp 'user-emacs-directory) - (concat user-emacs-directory "auctex/")) - "~/.emacs.d/auctex/"))) - "List of directories containing automatically generated AUCTeX style files. - -These correspond to the personal TeX macros." - :group 'TeX-file - :type '(repeat (file :format "%v"))) - -(if (stringp TeX-auto-private) ;Backward compatibility - (setq TeX-auto-private (list TeX-auto-private))) - -(defcustom TeX-style-private - (list (expand-file-name TeX-style-local - (or (and (boundp 'user-emacs-directory) - (concat user-emacs-directory "auctex/")) - "~/.emacs.d/auctex/"))) - "List of directories containing hand-generated AUCTeX style files. - -These correspond to the personal TeX macros." - :group 'TeX-file - :type '(repeat (file :format "%v"))) - -(if (stringp TeX-style-private) ;Backward compatibility - (setq TeX-style-private (list TeX-style-private))) - -(defcustom TeX-style-path - (let ((path)) - ;; Put directories in an order where the more local files can - ;; override the more global ones. - (mapcar (lambda (file) (when file (add-to-list 'path file t))) - (append (list TeX-auto-global TeX-style-global) - TeX-auto-private TeX-style-private - (list TeX-auto-local TeX-style-local))) - path) - "List of directories to search for AUCTeX style files. -Per default the list is built from the values of the variables -`TeX-auto-global', `TeX-style-global', `TeX-auto-private', -`TeX-style-private', `TeX-auto-local', and `TeX-style-local'." - :group 'TeX-file - :type '(repeat (file :format "%v"))) - -(defcustom TeX-check-path - (append (list ".") TeX-macro-private TeX-macro-global) - "Directory path to search for dependencies. - -If nil, just check the current file. -Used when checking if any files have changed." - :group 'TeX-file - :type '(repeat (file :format "%v"))) - -;;; Style Files - -(defvar TeX-style-hook-list nil - "List of TeX style hooks currently loaded. - -Each entry is a list where the first element is the name of the style, -and the remaining elements are hooks to be run when that style is -active.") - -(defcustom TeX-byte-compile nil - "*Not nil means try to byte compile auto files before loading." - :group 'TeX-parse - :type 'boolean) - -(defun TeX-load-style (style) - "Search for and load each definition for STYLE in `TeX-style-path'." - (cond ((assoc style TeX-style-hook-list)) ; We already found it - ((string-match "\\`\\(.+[/\\]\\)\\([^/\\]*\\)\\'" style) ;Complex path - (let* ((dir (substring style (match-beginning 1) (match-end 1))) - (style (substring style (match-beginning 2) (match-end 2))) - (master-dir (if (stringp TeX-master) - (file-name-directory - (file-relative-name TeX-master)) - "./")) - (TeX-style-path (append (list (expand-file-name - TeX-auto-local dir) - (expand-file-name - TeX-auto-local master-dir) - (expand-file-name - TeX-style-local dir) - (expand-file-name - TeX-style-local master-dir)) - TeX-style-path))) - (TeX-load-style style))) - (t ;Relative path - ;; Insert empty list to mark the fact that we have searched. - (setq TeX-style-hook-list (cons (list style) TeX-style-hook-list)) - ;; Now check each element of the path - (dolist (name TeX-style-path) - (TeX-load-style-file (expand-file-name style name)))))) - -(defun TeX-load-style-file (file) - "Load FILE checking for a Lisp extensions." - (let ((el (concat file ".el")) - (elc (concat file ".elc"))) - (cond ((file-newer-than-file-p el elc) - (if (file-readable-p el) - (if (and TeX-byte-compile - (file-writable-p elc) - (save-excursion - ;; `byte-compile-file' switches buffer in Emacs 20.3. - (byte-compile-file el)) - (file-readable-p elc)) - (load-file elc) - (load-file el)))) - ((file-readable-p elc) - (load-file elc)) - ((file-readable-p el) - (load-file el))))) - -(defun TeX-add-style-hook (style hook) - "Give STYLE yet another HOOK to run." - (let ((entry (assoc style TeX-style-hook-list))) - (cond ((null entry) - ;; New style, add entry. - (setq TeX-style-hook-list (cons (list style hook) - TeX-style-hook-list))) - ((member hook entry) - ;; Old style, hook already there, do nothing. - nil) - (t - ;; Old style, new hook. - (setcdr entry (cons hook (cdr entry))))))) - -(defun TeX-unload-style (style) - "Forget that we once loaded STYLE." - (cond ((null (assoc style TeX-style-hook-list))) - ((equal (car (car TeX-style-hook-list)) style) - (setq TeX-style-hook-list (cdr TeX-style-hook-list))) - (t - (let ((entry TeX-style-hook-list)) - (while (not (equal (car (car (cdr entry))) style)) - (setq entry (cdr entry))) - (setcdr entry (cdr (cdr entry))))))) - -(defcustom TeX-virgin-style (if (and TeX-auto-global - (file-directory-p TeX-auto-global)) - "virtex" - "NoVirtexSymbols") - "Style all documents use." - :group 'TeX-parse - :type 'string) - -(defvar TeX-active-styles nil - "List of styles currently active in the document.") - (make-variable-buffer-local 'TeX-active-styles) - -(defun TeX-run-style-hooks (&rest styles) - "Run the TeX style hooks STYLES." - (mapcar (lambda (style) - ;; Avoid recursion. - (unless (TeX-member style TeX-active-styles 'string-equal) - (setq TeX-active-styles - (cons style TeX-active-styles)) - (TeX-load-style style) - (let ((default-directory default-directory)) - ;; Complex path. - (when (string-match "\\`\\(.+[/\\]\\)\\([^/\\]*\\)\\'" style) - ;; Set `default-directory' to directory of master - ;; file since style files not stored in the fixed - ;; style directories are usually located there. - (setq default-directory (save-match-data - (TeX-master-directory)) - style (substring style - (match-beginning 2) (match-end 2)))) - (mapcar 'funcall - (cdr-safe (assoc style TeX-style-hook-list)))))) - styles)) - -(defcustom TeX-parse-self nil - "Parse file after loading it if no style hook is found for it." - :group 'TeX-parse - :type 'boolean) - -(defvar TeX-style-hook-applied-p nil - "Nil, unless the style specific hooks have been applied.") - (make-variable-buffer-local 'TeX-style-hook-applied-p) - -(defvar TeX-update-style-hook nil - "Hook run as soon as style specific hooks were applied.") - -(defun TeX-update-style (&optional force) - "Run style specific hooks for the current document. - -Only do this if it has not been done before, or if optional argument -FORCE is not nil." - (unless (or (and (boundp 'TeX-auto-update) - (eq TeX-auto-update 'BibTeX)) ; Not a real TeX buffer - (and (not force) - TeX-style-hook-applied-p)) - (setq TeX-style-hook-applied-p t) - (message "Applying style hooks...") - (TeX-run-style-hooks (TeX-strip-extension nil nil t)) - ;; Run parent style hooks if it has a single parent that isn't itself. - (if (or (not (memq TeX-master '(nil t))) - (and (buffer-file-name) - (string-match TeX-one-master - (file-name-nondirectory (buffer-file-name))))) - (TeX-run-style-hooks (TeX-master-file))) - (if (and TeX-parse-self - (null (cdr-safe (assoc (TeX-strip-extension nil nil t) - TeX-style-hook-list)))) - (TeX-auto-apply)) - (run-hooks 'TeX-update-style-hook) - (message "Applying style hooks... done"))) - -(defvar TeX-remove-style-hook nil - "List of hooks to call when we remove the style specific information.") - (make-variable-buffer-local 'TeX-remove-style-hook) - -(defun TeX-remove-style () - "Remove all style specific information." - (setq TeX-style-hook-applied-p nil) - (run-hooks 'TeX-remove-style-hook) - (setq TeX-active-styles (list TeX-virgin-style))) - -(defun TeX-style-list () - "Return a list of all styles (subfiles) used by the current document." - (TeX-update-style) - TeX-active-styles) - -;;; Special Characters - -(defvar TeX-esc "\\" "The TeX escape character.") - (make-variable-buffer-local 'TeX-esc) - -(defvar TeX-grop "{" "The TeX group opening character.") - (make-variable-buffer-local 'TeX-grop) - -(defvar TeX-grcl "}" "The TeX group closing character.") - (make-variable-buffer-local 'TeX-grcl) - -(defcustom plain-TeX-enable-toolbar t - "Enable TeX tool bar in plain TeX mode." - :group 'TeX-tool-bar - :type 'boolean) - -(defun plain-TeX-maybe-install-toolbar () - "Conditionally install tool bar buttons for plain TeX mode. -Install tool bar if `plain-TeX-enable-toolbar' is non-nil." - (when plain-TeX-enable-toolbar - ;; Defined in `tex-bar.el': - (TeX-install-toolbar))) - -;;; Symbols - -;; Must be before keymaps. - -(defgroup TeX-macro nil - "Support for TeX macros in AUCTeX." - :prefix "TeX-" - :group 'AUCTeX) - -(defcustom TeX-complete-word 'ispell-complete-word - "*Function to call for completing non-macros in `tex-mode'." - :group 'TeX-macro) - -(defvar TeX-complete-list nil - "List of ways to complete the preceding text. - -Each entry is a list with the following elements: - -0. Regexp matching the preceding text. -1. A number indicating the subgroup in the regexp containing the text. -2. A function returning an alist of possible completions. -3. Text to append after a succesful completion. - -Or alternatively: - -0. Regexp matching the preceding text. -1. Function to do the actual completion.") - -(defun TeX-complete-symbol () - "Perform completion on TeX/LaTeX symbol preceding point." - (interactive "*") - (let ((list TeX-complete-list) - entry) - (while list - (setq entry (car list) - list (cdr list)) - (if (TeX-looking-at-backward (car entry) 250) - (setq list nil))) - (if (numberp (nth 1 entry)) - (let* ((sub (nth 1 entry)) - (close (nth 3 entry)) - (begin (match-beginning sub)) - (end (match-end sub)) - (pattern (TeX-match-buffer 0)) - (symbol (buffer-substring begin end)) - (list (funcall (nth 2 entry))) - (completion (try-completion symbol list))) - (cond ((eq completion t) - (and close - (not (looking-at (regexp-quote close))) - (insert close))) - ((null completion) - (error "Can't find completion for \"%s\"" pattern)) - ((not (string-equal symbol completion)) - (delete-region begin end) - (insert completion) - (and close - (eq (try-completion completion list) t) - (not (looking-at (regexp-quote close))) - (insert close))) - (t - (message "Making completion list...") - (let ((list (all-completions symbol list nil))) - (with-output-to-temp-buffer "*Completions*" - (display-completion-list list))) - (message "Making completion list...done")))) - (funcall (nth 1 entry))))) - -(defcustom TeX-default-macro "ref" - "*The default macro when creating new ones with `TeX-insert-macro'." - :group 'TeX-macro - :type 'string) - -(make-variable-buffer-local 'TeX-default-macro) - -(defcustom TeX-insert-braces t - "*If non-nil, append a empty pair of braces after inserting a macro." - :group 'TeX-macro - :type 'boolean) - -(defcustom TeX-insert-macro-default-style 'show-optional-args - "Specifies whether `TeX-insert-macro' will ask for all optional arguments. - -If set to the symbol `show-optional-args', `TeX-insert-macro' asks for -optional arguments of TeX marcos. If set to `mandatory-args-only', -`TeX-insert-macro' asks only for mandatory argument. - -When `TeX-insert-macro' is called with \\[universal-argument], it's the other -way round. - -Note that for some macros, there are special mechanisms, see e.g. -`LaTeX-includegraphics-options-alist'." - :group 'TeX-macro - :type '(choice (const mandatory-args-only) - (const show-optional-args))) - -(defvar TeX-arg-opening-brace nil - "String used as an opening brace for argument insertion. -The variable will be temporarily let-bound with the necessary value.") - -(defvar TeX-arg-closing-brace nil - "String used as a closing brace for argument insertion. -The variable will be temporarily let-bound with the necessary value.") - -(defvar TeX-after-insert-macro-hook nil - "A hook run after `TeX-insert-macro'.") - -(defvar TeX-macro-history nil) - -(defun TeX-insert-macro (symbol) - "Insert TeX macro SYMBOL with completion. - -AUCTeX knows of some macros and may query for extra arguments, depending on -the value of `TeX-insert-macro-default-style' and whether `TeX-insert-macro' -is called with \\[universal-argument]." - ;; When called with a prefix (C-u), only ask for mandatory arguments, - ;; i.e. all optional arguments are skipped. See `TeX-parse-arguments' for - ;; details. Note that this behavior may be changed in favor of a more - ;; flexible solution in the future, therefore we don't document it at the - ;; moment. - (interactive (list (completing-read (concat "Macro (default " - TeX-default-macro - "): " - TeX-esc) - (TeX-symbol-list) nil nil nil - 'TeX-macro-history))) - (cond ((string-equal symbol "") - (setq symbol TeX-default-macro)) - ((interactive-p) - (setq TeX-default-macro symbol))) - (TeX-parse-macro symbol (cdr-safe (assoc symbol (TeX-symbol-list)))) - (run-hooks 'TeX-after-insert-macro-hook)) - -(defvar TeX-electric-macro-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map minibuffer-local-completion-map) - (define-key map " " 'minibuffer-complete-and-exit) - map)) - -(defun TeX-electric-macro () - "Insert TeX macro with completion. - -AUCTeX knows of some macros, and may query for extra arguments. -Space will complete and exit." - (interactive) - (cond ((eq (preceding-char) ?\\) - (call-interactively 'self-insert-command)) - ((eq (preceding-char) ?.) - (let ((TeX-default-macro " ") - (minibuffer-local-completion-map TeX-electric-macro-map)) - (call-interactively 'TeX-insert-macro))) - (t - (let ((minibuffer-local-completion-map TeX-electric-macro-map)) - (call-interactively 'TeX-insert-macro))))) - -(defun TeX-parse-macro (symbol args) - "How to parse TeX macros which takes one or more arguments. - -First argument SYMBOL is the name of the macro. - -If called with no additional arguments, insert macro with point -inside braces. Otherwise, each argument of this function should -match an argument to the TeX macro. What is done depend on the -type of ARGS: - - string: Use the string as a prompt to prompt for the argument. - - number: Insert that many braces, leave point inside the first. - - nil: Insert empty braces. - - t: Insert empty braces, leave point between the braces. - - other symbols: Call the symbol as a function. You can define - your own hook, or use one of the predefined argument hooks. If - you add new hooks, you can assume that point is placed directly - after the previous argument, or after the macro name if this is - the first argument. Please leave point located after the - argument you are inserting. If you want point to be located - somewhere else after all hooks have been processed, set the value - of `exit-mark'. It will point nowhere, until the argument hook - set it. By convention, these hooks all start with `TeX-arg-'. - - list: If the car is a string, insert it as a prompt and the next - element as initial input. Otherwise, call the car of the list - with the remaining elements as arguments. - - vector: Optional argument. If it has more than one element, - parse it as a list, otherwise parse the only element as above. - Use square brackets instead of curly braces, and is not inserted - on empty user input." - - (if (and (TeX-active-mark) - (> (point) (mark))) - (exchange-point-and-mark)) - (insert TeX-esc symbol) - (let ((exit-mark (make-marker)) - (position (point))) - (TeX-parse-arguments args) - (cond ((marker-position exit-mark) - (goto-char (marker-position exit-mark)) - (set-marker exit-mark nil)) - ((and TeX-insert-braces - ;; Do not add braces for macros defined as `("foo" 0)' - (not (and (= (safe-length args) 1) - (numberp (car args)) - (= (car args) 0))) - (equal position (point)) - (string-match "[a-zA-Z]+" symbol) - (not (texmathp))) - (insert TeX-grop) - (if (TeX-active-mark) - (progn - (exchange-point-and-mark) - (insert TeX-grcl)) - (insert TeX-grcl) - (backward-char)))))) - -(defun TeX-arg-string (optional &optional prompt initial-input) - "Prompt for a string. - -If OPTIONAL is not nil then the PROMPT will start with ``(Optional) ''. -INITIAL-INPUT is a string to insert before reading input." - (TeX-argument-insert - (if (and (not optional) (TeX-active-mark)) - (let ((TeX-argument (buffer-substring (point) (mark)))) - (delete-region (point) (mark)) - TeX-argument) - (read-string (TeX-argument-prompt optional prompt "Text") initial-input)) - optional)) - -(defun TeX-parse-arguments (args) - "Parse TeX macro arguments ARGS. - -See `TeX-parse-macro' for details." - (let ((last-optional-rejected nil) - skip-opt) - ;; Maybe get rid of all optional arguments. See `TeX-insert-macro' for - ;; more comments. See `TeX-insert-macro-default-style'. - (when (or (and (eq TeX-insert-macro-default-style 'show-optional-args) - (equal current-prefix-arg '(4))) - (and (eq TeX-insert-macro-default-style 'mandatory-args-only) - (null (equal current-prefix-arg '(4))))) - (while (vectorp (car args)) - (setq args (cdr args)))) - - (while args - (if (vectorp (car args)) - (unless last-optional-rejected - (let ((TeX-arg-opening-brace LaTeX-optop) - (TeX-arg-closing-brace LaTeX-optcl)) - (TeX-parse-argument t (if (equal (length (car args)) 1) - (aref (car args) 0) - (append (car args) nil))))) - (let ((TeX-arg-opening-brace TeX-grop) - (TeX-arg-closing-brace TeX-grcl)) - (setq last-optional-rejected nil) - (TeX-parse-argument nil (car args)))) - (setq args (cdr args))))) - -(defun TeX-parse-argument (optional arg) - "Depending on OPTIONAL, insert TeX macro argument ARG. -If OPTIONAL is set, only insert if there is anything to insert, and -then use square brackets instead of curly braces. - -See `TeX-parse-macro' for details." - (let (insert-flag) - (cond ((stringp arg) - (TeX-arg-string optional arg) - (setq insert-flag t)) - ((numberp arg) - (unless (< arg 1) - (TeX-parse-argument optional t) - (while (> arg 1) - (TeX-parse-argument optional nil) - (setq arg (- arg 1))))) - ((null arg) - (insert TeX-arg-opening-brace) - (when (and (not optional) (TeX-active-mark)) - (exchange-point-and-mark)) - (insert TeX-arg-closing-brace) - (setq insert-flag t)) - ((eq arg t) - (insert TeX-arg-opening-brace) - (if (and (not optional) (TeX-active-mark)) - (progn - (exchange-point-and-mark)) - (set-marker exit-mark (point))) - (insert TeX-arg-closing-brace) - (setq insert-flag t)) - ((symbolp arg) - (funcall arg optional)) - ((listp arg) - (let ((head (car arg)) - (tail (cdr arg))) - (cond ((stringp head) - (apply 'TeX-arg-string optional arg)) - ((symbolp head) - (apply head optional tail)) - (t (error "Unknown list argument type %s" - (prin1-to-string head)))))) - (t (error "Unknown argument type %s" (prin1-to-string arg)))) - (when (and insert-flag (not optional) (TeX-active-mark)) - (TeX-deactivate-mark)))) - -(defun TeX-argument-insert (name optional &optional prefix) - "Insert NAME surrounded by curly braces. - -If OPTIONAL, only insert it if not empty, and then use square brackets. -If PREFIX is given, insert it before NAME." - (if (and optional (string-equal name "")) - (setq last-optional-rejected t) - (insert TeX-arg-opening-brace) - (if prefix - (insert prefix)) - (if (and (string-equal name "") - (null (marker-position exit-mark))) - (set-marker exit-mark (point)) - (insert name)) - (insert TeX-arg-closing-brace))) - -(defun TeX-argument-prompt (optional prompt default &optional complete) - "Return a argument prompt. - -If OPTIONAL is not nil then the prompt will start with ``(Optional) ''. - -PROMPT will be used if not nil, otherwise use DEFAULT. - -Unless optional argument COMPLETE is non-nil, ``: '' will be appended." - (concat (if optional "(Optional) " "") - (if prompt prompt default) - (if complete "" ": "))) - -(defun TeX-string-divide-number-unit (string) - "Divide number and unit in STRING. -Return the number as car and unit as cdr." - (if (string-match "[0-9]*\\.?[0-9]+" string) - (list (substring string 0 (string-match "[^.0-9]" string)) - (substring string (if (string-match "[^.0-9]" string) - (string-match "[^.0-9]" string) - (length string)))) - (list "" string))) - -(defcustom TeX-default-unit-for-image "cm" - "Default unit when prompting for an image size." - :group 'TeX-macro - :type '(choice (const "cm") - (const "in") - (const "\\linewidth") - (string :tag "Other"))) - -(defun TeX-arg-maybe (symbol list form) - "Evaluates FORM, if SYMBOL is an element of LIST." - (when (memq symbol list) - (eval form))) - -(defun TeX-arg-free (optional &rest args) - "Parse its arguments but use no braces when they are inserted." - (let ((TeX-arg-opening-brace "") - (TeX-arg-closing-brace "")) - (if (equal (length args) 1) - (TeX-parse-argument optional (car args)) - (TeX-parse-argument optional args)))) - -(defun TeX-arg-literal (optional &rest args) - "Insert its arguments ARGS into the buffer. -Used for specifying extra syntax for a macro." - ;; FIXME: What is the purpose of OPTIONAL here? -- rs - (apply 'insert args)) - - -;;; Font Locking - -(defcustom TeX-install-font-lock 'font-latex-setup - "Function to call to install font lock support. -Choose `ignore' if you don't want AUCTeX to install support for font locking." - :group 'TeX-misc - :type '(radio (function-item font-latex-setup) - (function-item tex-font-setup) - (function-item ignore) - (function :tag "Other"))) - -;;; The Mode - -(defvar TeX-format-list - '(("JLATEX" japanese-latex-mode - "\\\\\\(documentstyle\\|documentclass\\)[^%\n]*{\\(j[s-]?\\|t\\)\ -\\(article\\|report\\|book\\|slides\\)") - ("JTEX" japanese-plain-tex-mode - "-- string likely in Japanese TeX --") - ("AMSTEX" ams-tex-mode - "\\\\document\\b") - ("CONTEXT" context-mode - "\\\\\\(start\\(text\\|tekst\\|proje[ck]t\\|proiect\\|\ -produ[ck]t\\|produs\\|environment\\|omgeving\\|umgebung\\|prostredi\\|mediu\\|\ -component\\|onderdeel\\|komponent[ea]\\|componenta\\)\ -\\|inizia\\(testo\\|progetto\\|prodotto\\|ambiente\\|componente\\)\ -\\)\\|%.*?interface=") - ("LATEX" latex-mode - "\\\\\\(begin\\|\\(?:sub\\)\\{0,2\\}section\\|chapter\\|documentstyle\\|\ -documentclass\\)\\b") - ("TEX" plain-tex-mode ".")) - "*List of format packages to consider when choosing a TeX mode. - -A list with an entry for each format package available at the site. - -Each entry is a list with three elements. - -1. The name of the format package. -2. The name of the major mode. -3. A regexp typically matched in the beginning of the file. - -When entering `tex-mode', each regexp is tried in turn in order to find -the major mode to be used.") - -(defcustom TeX-default-mode 'latex-mode - "*Mode to enter for a new file when it can't be determined otherwise." - :group 'TeX-misc - :type '(radio (function-item latex-mode) - (function-item plain-tex-mode) - (function :tag "Other"))) - -(defcustom TeX-force-default-mode nil - "*If set to nil, try to infer the mode of the file from its content." - :group 'TeX-misc - :type 'boolean) - -;;;###autoload -(defun TeX-tex-mode () - "Major mode in AUCTeX for editing TeX or LaTeX files. -Tries to guess whether this file is for plain TeX or LaTeX. - -The algorithm is as follows: - - 1) if the file is empty or `TeX-force-default-mode' is not set to nil, - `TeX-default-mode' is chosen - 2) If \\documentstyle or \\begin{, \\section{, \\part{ or \\chapter{ is - found, `latex-mode' is selected. - 3) Otherwise, use `plain-tex-mode'" - (interactive) - - (funcall (if (or (equal (buffer-size) 0) - TeX-force-default-mode) - TeX-default-mode - (save-excursion - (goto-char (point-min)) - (let ((comment-start-skip ;Used by TeX-in-comment - (concat - "\\(\\(^\\|[^\\\n]\\)\\(" - (regexp-quote TeX-esc) - (regexp-quote TeX-esc) - "\\)*\\)\\(%+ *\\)")) - (entry TeX-format-list) - answer) - (while (and entry (not answer)) - (if (re-search-forward (nth 2 (car entry)) - 10000 t) - (if (not (TeX-in-comment)) - (setq answer (nth 1 (car entry)))) - (setq entry (cdr entry)))) - (if answer - answer - TeX-default-mode)))))) - -(defun VirTeX-common-initialization () - "Perform basic initialization." - (kill-all-local-variables) - (setq TeX-mode-p t) - (setq TeX-output-extension (if TeX-PDF-mode "pdf" "dvi")) - (setq local-abbrev-table text-mode-abbrev-table) - (setq indent-tabs-mode nil) - - ;; Ispell support - (make-local-variable 'ispell-parser) - (setq ispell-parser 'tex) - (make-local-variable 'ispell-tex-p) - (setq ispell-tex-p t) - - ;; Redefine some standard variables - (make-local-variable 'paragraph-start) - (make-local-variable 'paragraph-separate) - (make-local-variable 'comment-start) - (setq comment-start "%") - (make-local-variable 'comment-start-skip) - (setq comment-start-skip - (concat - "\\(\\(^\\|[^\\\n]\\)\\(" - (regexp-quote TeX-esc) - (regexp-quote TeX-esc) - "\\)*\\)\\(%+[ \t]*\\)")) - (set (make-local-variable 'comment-end-skip) "[ \t]*\\(\\s>\\|\n\\)") - (set (make-local-variable 'comment-use-syntax) t) - ;; `comment-padding' is defined here as an integer for compatibility - ;; reasons because older Emacsen could not cope with a string. - (make-local-variable 'comment-padding) - (setq comment-padding 1) - ;; Removed as commenting in (La)TeX is done with one `%' not two - ;; (make-local-variable 'comment-add) - ;; (setq comment-add 1) ;default to `%%' in comment-region - (make-local-variable 'comment-indent-function) - (setq comment-indent-function 'TeX-comment-indent) - (make-local-variable 'comment-multi-line) - (setq comment-multi-line nil) - (make-local-variable 'compile-command) - (unless (boundp 'compile-command) - (setq compile-command "make")) - (make-local-variable 'words-include-escapes) - (setq words-include-escapes nil) - - ;; Make TAB stand out - ;; (make-local-variable 'buffer-display-table) - ;; (setq buffer-display-table (if standard-display-table - ;; (copy-sequence standard-display-table) - ;; (make-display-table))) - ;; (aset buffer-display-table ?\t (apply 'vector (append "" nil))) - - ;; Symbol completion. - (make-local-variable 'TeX-complete-list) - (setq TeX-complete-list - (list (list "\\\\\\([a-zA-Z]*\\)" - 1 'TeX-symbol-list (if TeX-insert-braces "{}")) - (list "" TeX-complete-word))) - - (funcall TeX-install-font-lock) - - ;; We want this to be early in the list, so we do not add it before - ;; we enter TeX mode the first time. - (if (boundp 'local-write-file-hooks) - (add-hook 'local-write-file-hooks 'TeX-safe-auto-write) - (add-hook 'write-file-hooks 'TeX-safe-auto-write)) - (make-local-variable 'TeX-auto-update) - (setq TeX-auto-update t) - - ;; Minor modes - (when TeX-source-correlate-mode - (TeX-source-correlate-mode 1)) - - ;; Let `TeX-master-file' be called after a new file was opened and - ;; call `TeX-update-style' on any file opened. (The addition to the - ;; hook has to be made here because its local value will be deleted - ;; by `kill-all-local-variables' if it is added e.g. in `tex-mode'.) - ;; - ;; `TeX-update-style' has to be called before - ;; `global-font-lock-mode', which may also be specified in - ;; `find-file-hooks', gets called. Otherwise style-based - ;; fontification will break (in XEmacs). That means, `add-hook' - ;; cannot be called with a non-nil value of the APPEND argument. - ;; - ;; `(TeX-master-file nil nil t)' has to be called *before* - ;; `TeX-update-style' as the latter will call `TeX-master-file' - ;; without the `ask' bit set. - (when (and (featurep 'xemacs) (not (emacs-version>= 21 5))) - (make-local-hook 'find-file-hooks)) - (add-hook 'find-file-hooks - (lambda () - ;; Check if we are looking at a new or shared file. - (when (or (not (file-exists-p (buffer-file-name))) - (eq TeX-master 'shared)) - (TeX-master-file nil nil t)) - (TeX-update-style t)) nil t)) - -;;; Plain TeX mode - -(defcustom plain-TeX-clean-intermediate-suffixes - TeX-clean-default-intermediate-suffixes - "List of regexps matching suffixes of intermediate files to be deleted. -The regexps will be anchored at the end of the file name to be matched, -i.e. you do _not_ have to cater for this yourself by adding \\\\' or $." - :type '(repeat regexp) - :group 'TeX-command) - -(defcustom plain-TeX-clean-output-suffixes TeX-clean-default-output-suffixes - "List of regexps matching suffixes of output files to be deleted. -The regexps will be anchored at the end of the file name to be matched, -i.e. you do _not_ have to cater for this yourself by adding \\\\' or $." - :type '(repeat regexp) - :group 'TeX-command) - -(defcustom plain-TeX-mode-hook nil - "A hook run in plain TeX mode buffers." - :type 'hook - :group 'TeX-misc) - -;;;###autoload -(defun TeX-plain-tex-mode () - "Major mode in AUCTeX for editing plain TeX files. -See info under AUCTeX for documentation. - -Special commands: -\\{plain-TeX-mode-map} - -Entering `plain-tex-mode' calls the value of `text-mode-hook', -then the value of `TeX-mode-hook', and then the value -of plain-TeX-mode-hook." - (interactive) - (plain-TeX-common-initialization) - (setq major-mode 'plain-tex-mode) - (use-local-map plain-TeX-mode-map) - (easy-menu-add plain-TeX-mode-menu plain-TeX-mode-map) - (easy-menu-add plain-TeX-mode-command-menu plain-TeX-mode-map) - (setq TeX-base-mode-name "TeX") - (setq TeX-command-default "TeX") - (setq TeX-sentinel-default-function 'TeX-TeX-sentinel) - (add-hook 'tool-bar-mode-on-hook 'plain-TeX-maybe-install-toolbar nil t) - (when (if (featurep 'xemacs) - (featurep 'toolbar) - (and (boundp 'tool-bar-mode) tool-bar-mode)) - (plain-TeX-maybe-install-toolbar)) - (TeX-run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'plain-TeX-mode-hook) - (TeX-set-mode-name)) - -(defun plain-TeX-common-initialization () - "Common initialization for plain TeX like modes." - (VirTeX-common-initialization) - (set-syntax-table TeX-mode-syntax-table) - (setq paragraph-start - (concat - "\\(^[ \t]*$" - "\\|" (regexp-quote TeX-esc) "par\\|" - "^[ \t]*" - (regexp-quote TeX-esc) - "\\(" - "begin\\|end\\|part\\|chapter\\|" - "section\\|subsection\\|subsubsection\\|" - "paragraph\\|include\\|includeonly\\|" - "tableofcontents\\|appendix\\|label\\|caption\\|" - "\\[\\|\\]" ; display math delimitors - "\\)" - "\\|" - "^[ \t]*\\$\\$" ; display math delimitor - "\\)" )) - (setq paragraph-separate - (concat - "[ \t]*" - "\\(" - (regexp-quote TeX-esc) "par\\|" - "%\\|" - "$\\|" - "\\$\\$\\|" - (regexp-quote TeX-esc) - "\\(" - "begin\\|end\\|label\\|caption\\|part\\|chapter\\|" - "section\\|subsection\\|subsubsection\\|" - "paragraph\\|include\\|includeonly\\|" - "tableofcontents\\|appendix\\|" (regexp-quote TeX-esc) - "\\)" - "\\)")) - (setq TeX-header-end (regexp-quote "%**end of header")) - (setq TeX-trailer-start (regexp-quote (concat TeX-esc "bye"))) - (TeX-run-style-hooks "TEX")) - -;;; Hilighting - -(if (boundp 'hilit-patterns-alist) - (let ((latex-patterns (cdr-safe (assq 'latex-mode hilit-patterns-alist))) - (plain-tex-patterns (cdr-safe (assq 'plain-tex-mode - hilit-patterns-alist)))) - (if (and latex-patterns plain-tex-patterns) - (setq hilit-patterns-alist - (append (list (cons 'ams-tex-mode plain-tex-patterns)) - hilit-patterns-alist))))) - -;;; Parsing - -(defgroup TeX-parse nil - "Parsing TeX files from AUCTeX." - :group 'AUCTeX) - -(defvar TeX-auto-parser '((styles TeX-auto-file TeX-run-style-hooks))) -;; Alist of parsed information. -;; Each entry is a list with the following elements: -;; -;; 0. Name of information type. -;; 1. Name of temporary variable used when parsing. -;; 2. Name of function to add information to add to #3. -;; 3. Name of variable holding buffer local information. -;; 4. Name of variable indicating that #3 has changed. - - -(defconst TeX-auto-parser-temporary 1) -(defconst TeX-auto-parser-add 2) -(defconst TeX-auto-parser-local 3) -(defconst TeX-auto-parser-change 4) - -(defun TeX-auto-add-type (name prefix &optional plural) - "Add information about NAME to the parser using PREFIX. - -Optional third argument PLURAL is the plural form of TYPE. -By default just add an `s'. - -This function create a set of variables and functions to maintain a -separate type of information in the parser." - (let* ((names (or plural (concat name "s"))) - (tmp (intern (concat prefix "-auto-" name))) - (add (intern (concat prefix "-add-" names))) - (local (intern (concat prefix "-" name "-list"))) - (change (intern (concat prefix "-" name "-changed")))) - (setq TeX-auto-parser - (cons (list name tmp add local change) TeX-auto-parser)) - (set local nil) - (make-variable-buffer-local local) - (set change nil) - (make-variable-buffer-local change) - (fset add `(lambda (&rest entries) - ,(concat "Add information about " (upcase name) - " to the current buffer. -Generated by `TeX-auto-add-type'.") - (TeX-auto-add-information ,name entries))) - (fset local `(lambda nil - ,(concat "List of " names - " active in the current buffer. -Generated by `TeX-auto-add-type'.") - (TeX-auto-list-information ,name))) - (add-hook 'TeX-remove-style-hook - `(lambda nil (setq ,(symbol-name local) nil))))) - -(defun TeX-auto-add-information (name entries) - "For NAME in `TeX-auto-parser' add ENTRIES." - (let* ((entry (assoc name TeX-auto-parser)) - (change (nth TeX-auto-parser-change entry)) - (change-value (symbol-value change)) - (local (nth TeX-auto-parser-local entry)) - (local-value (symbol-value local))) - (if change-value - (set local (cons entries local-value)) - (set change t) - (set local (list entries local-value))))) - -(defun TeX-auto-list-information (name) - "Return information in `TeX-auto-parser' about NAME." - (TeX-update-style) - (let* ((entry (assoc name TeX-auto-parser)) - (change (nth TeX-auto-parser-change entry)) - (change-value (symbol-value change)) - (local (nth TeX-auto-parser-local entry))) - (if (not change-value) - () - (set change nil) - ;; Sort it - (message "Sorting %s..." name) - (set local - (sort (mapcar 'TeX-listify (apply 'append (symbol-value local))) - 'TeX-car-string-lessp)) - ;; Make it unique - (message "Removing duplicates...") - (let ((entry (symbol-value local))) - (while (and entry (cdr entry)) - (let ((this (car entry)) - (next (car (cdr entry)))) - (if (not (string-equal (car this) (car next))) - (setq entry (cdr entry)) - ;; We have two equal symbols. Use the one with - ;; most arguments. - (if (> (length next) (length this)) - (setcdr this (cdr next))) - (setcdr entry (cdr (cdr entry))))))) - (message "Removing duplicates... done")) - (symbol-value local))) - -(TeX-auto-add-type "symbol" "TeX") - -(defvar TeX-auto-apply-hook nil - "Hook run when a buffer is parsed and the information is applied.") - -(defun TeX-auto-apply () - "Parse and apply TeX information in the current buffer." - (TeX-auto-parse) - (run-hooks 'TeX-auto-apply-hook) - (mapcar 'TeX-auto-apply-entry TeX-auto-parser)) - -(defun TeX-auto-apply-entry (entry) - "Apply the information in ENTRY in `TeX-auto-parser'." - (let ((value (symbol-value (nth TeX-auto-parser-temporary entry))) - (add (nth TeX-auto-parser-add entry))) - (if value (apply add value)))) - -(defun TeX-safe-auto-write () - "Call `TeX-auto-write' safely." - (condition-case name - (and (boundp 'TeX-auto-update) - TeX-auto-update - (TeX-auto-write)) - (error nil)) - ;; Continue with the other write file hooks. - nil) - -(defcustom TeX-auto-save nil - "*Automatically save style information when saving the buffer." - :group 'TeX-parse - :type 'boolean) - -(defcustom TeX-auto-untabify nil - "*Automatically untabify when saving the buffer." - :group 'TeX-parse - :type 'boolean) - -(defun TeX-auto-write () - "Save all relevant TeX information from the current buffer." - (if TeX-auto-untabify - (untabify (point-min) (point-max))) - (if (and TeX-auto-save TeX-auto-local) - (let* ((file (expand-file-name - (concat - (file-name-as-directory TeX-auto-local) - (TeX-strip-extension nil TeX-all-extensions t) - ".el") - (TeX-master-directory))) - (dir (file-name-directory file))) - ;; Create auto directory if possible. - (if (not (file-exists-p dir)) - (condition-case name - (make-directory dir) - (error nil))) - (if (file-writable-p file) - (save-excursion - (TeX-update-style) - (TeX-auto-store file)) - (message "Can't write style information."))))) - -(defcustom TeX-macro-default (car-safe TeX-macro-private) - "*Default directory to search for TeX macros." - :group 'TeX-file - :type 'directory) - -(defcustom TeX-auto-default (car-safe TeX-auto-private) - "*Default directory to place automatically generated TeX information." - :group 'TeX-file - :type 'directory) - -;;;###autoload -(defun TeX-auto-generate (tex auto) - "Generate style file for TEX and store it in AUTO. -If TEX is a directory, generate style files for all files in the directory." - (interactive (list (setq TeX-macro-default - (expand-file-name (read-file-name - "TeX file or directory: " - TeX-macro-default - TeX-macro-default 'confirm))) - (setq TeX-auto-default - (expand-file-name (read-file-name - "AUTO lisp directory: " - TeX-auto-default - TeX-auto-default 'confirm))))) - (cond ((not (file-readable-p tex))) - ((string-match TeX-ignore-file tex)) - ((file-directory-p tex) - (let ((files (directory-files (expand-file-name tex))) - (default-directory (file-name-as-directory - (expand-file-name tex))) - (TeX-file-recurse (cond ((symbolp TeX-file-recurse) - TeX-file-recurse) - ((zerop TeX-file-recurse) - nil) - ((1- TeX-file-recurse))))) - (mapcar (lambda (file) - (if (or TeX-file-recurse - (not (file-directory-p file))) - (TeX-auto-generate file auto))) - files))) - ((not (file-newer-than-file-p - tex - (concat (file-name-as-directory auto) - (TeX-strip-extension tex TeX-all-extensions t) - ".el")))) - ((TeX-match-extension tex (append TeX-file-extensions - BibTeX-file-extensions)) - (save-excursion - (set-buffer (let (enable-local-eval) - (find-file-noselect tex))) - (message "Parsing %s..." tex) - (TeX-auto-store (concat (file-name-as-directory auto) - (TeX-strip-extension tex - TeX-all-extensions - t) - ".el")) - (kill-buffer (current-buffer)) - (message "Parsing %s... done" tex))))) - -;;;###autoload -(defun TeX-auto-generate-global () - "Create global auto directory for global TeX macro definitions." - (interactive) - (unless (file-directory-p TeX-auto-global) - (make-directory TeX-auto-global)) - (let ((TeX-file-extensions '("cls" "sty")) - (BibTeX-file-extensions nil)) - (mapc (lambda (macro) (TeX-auto-generate macro TeX-auto-global)) - TeX-macro-global)) - (byte-recompile-directory TeX-auto-global 0)) - -(defun TeX-auto-store (file) - "Extract information for AUCTeX from current buffer and store it in FILE." - (TeX-auto-parse) - - (if (member nil (mapcar 'TeX-auto-entry-clear-p TeX-auto-parser)) - (let ((style (TeX-strip-extension nil TeX-all-extensions t))) - (TeX-unload-style style) - (save-excursion - (set-buffer (generate-new-buffer file)) - (erase-buffer) - (insert "(TeX-add-style-hook \"" style "\"\n" - " (lambda ()") - (mapc (lambda (el) (TeX-auto-insert el style)) - TeX-auto-parser) - (insert "))\n\n") - (write-region (point-min) (point-max) file nil 'silent) - (kill-buffer (current-buffer)))) - (if (file-exists-p (concat file "c")) - (delete-file (concat file "c"))) - (if (file-exists-p file) - (delete-file file)))) - -(defun TeX-auto-entry-clear-p (entry) - "Check if the temporary for `TeX-auto-parser' entry ENTRY is clear." - ;; FIXME: This doc-string isn't clear to me. -- rs - (null (symbol-value (nth TeX-auto-parser-temporary entry)))) - -(defun TeX-auto-insert (entry &optional skip) - "Insert code to initialize ENTRY from `TeX-auto-parser'. - -If SKIP is not-nil, don't insert code for SKIP." - (let ((name (symbol-name (nth TeX-auto-parser-add entry))) - (list (symbol-value (nth TeX-auto-parser-temporary entry)))) - (unless (null list) - (insert "\n (" name) - (dolist (el list) - (cond ((and (stringp el) (not (string= el skip))) - (insert "\n ") - (insert (prin1-to-string el))) - ((not (stringp el)) - (insert "\n ") - (insert "'" (prin1-to-string el))))) - (insert ")")))) - -(defvar TeX-auto-ignore - '("csname" "filedate" "fileversion" "docdate" "next" "labelitemi" - "labelitemii" "labelitemiii" "labelitemiv" "labelitemv" - "labelenumi" "labelenumii" "labelenumiii" "labelenumiv" - "labelenumv" "theenumi" "theenumii" "theenumiii" "theenumiv" - "theenumv" "document" "par" "do" "expandafter") - "List of symbols to ignore when scanning a TeX style file.") - -(defun TeX-auto-add-regexp (regexp) - "Add REGEXP to `TeX-auto-regexp-list' if not already a member." - (if (symbolp TeX-auto-regexp-list) - (setq TeX-auto-regexp-list (symbol-value TeX-auto-regexp-list))) - (or (memq regexp TeX-auto-regexp-list) - (setq TeX-auto-regexp-list (cons regexp TeX-auto-regexp-list)))) - -(defvar TeX-auto-empty-regexp-list - '(("\\(\\'\\`\\)" 1 ignore)) - "List of regular expressions guaranteed to match nothing.") - -(defvar TeX-token-char - (if (featurep 'mule) - "\\(?:[a-zA-Z]\\|\\cj\\)" - "[a-zA-Z]") - "Regexp matching a character in a TeX macro. - -Please use a shy group if you use a grouping construct, because -the functions/variables which use `TeX-token-char' expect not to -alter the numbering of any ordinary, non-shy groups.") - -(defvar plain-TeX-auto-regexp-list - (let ((token TeX-token-char)) - `((,(concat "\\\\def\\\\\\(" token "+\\)[^a-zA-Z@]") 1 TeX-auto-symbol-check) - (,(concat "\\\\let\\\\\\(" token "+\\)[^a-zA-Z@]") 1 TeX-auto-symbol-check) - (,(concat "\\\\font\\\\\\(" token "+\\)[^a-zA-Z@]") 1 TeX-auto-symbol) - (,(concat "\\\\chardef\\\\\\(" token "+\\)[^a-zA-Z@]") 1 TeX-auto-symbol) - (,(concat "\\\\new\\(?:count\\|dimen\\|muskip\\|skip\\)\\\\\\(" token "+\\)[^a-zA-Z@]") - 1 TeX-auto-symbol) - (,(concat "\\\\newfont{?\\\\\\(" token "+\\)}?") 1 TeX-auto-symbol) - (,(concat "\\\\typein\\[\\\\\\(" token "+\\)\\]") 1 TeX-auto-symbol) - ("\\\\input +\\(\\.*[^#%\\\\\\.\n\r]+\\)\\(\\.[^#%\\\\\\.\n\r]+\\)?" - 1 TeX-auto-file) - (,(concat "\\\\mathchardef\\\\\\(" token "+\\)[^a-zA-Z@]") 1 TeX-auto-symbol))) - "List of regular expression matching common LaTeX macro definitions.") - -(defvar TeX-auto-full-regexp-list plain-TeX-auto-regexp-list - "Full list of regular expression matching TeX macro definitions.") - -(defvar TeX-auto-prepare-hook nil - "List of hooks to be called before parsing a TeX file.") - -(defvar TeX-auto-cleanup-hook nil - "List of hooks to be called after parsing a TeX file.") - -(defcustom TeX-auto-parse-length 999999 - "Maximal length of TeX file (in characters) that will be parsed." - :group 'TeX-parse - :type 'integer) - (make-variable-buffer-local 'TeX-auto-parse-length) - -(defcustom TeX-auto-x-parse-length 0 - "Maximum length of TeX file that will be parsed additionally. -Use `TeX-auto-x-regexp-list' for parsing the region between -`TeX-auto-parse-length' and this value." - :group 'TeX-parse - :type 'integer) - (make-variable-buffer-local 'TeX-auto-x-parse-length) - -(defcustom TeX-auto-x-regexp-list 'LaTeX-auto-label-regexp-list - "List of regular expressions used for additional parsing. -See `TeX-auto-x-parse-length'." - :type '(radio (variable-item TeX-auto-empty-regexp-list) - (variable-item TeX-auto-full-regexp-list) - (variable-item plain-TeX-auto-regexp-list) - (variable-item LaTeX-auto-minimal-regexp-list) - (variable-item LaTeX-auto-label-regexp-list) - (variable-item LaTeX-auto-regexp-list) - (symbol :tag "Other") - (repeat :tag "Specify" - (group (regexp :tag "Match") - (sexp :tag "Groups") - symbol))) - :group 'TeX-parse) - (make-variable-buffer-local 'TeX-auto-x-regexp-list) - -(defun TeX-regexp-group-count (regexp) - "Return number of groups in a REGEXP. This is not foolproof: -you should not use something like `[\\(]' for a character range." - (let (start (n 0)) - (while (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\\\([^?]" - regexp start) - (setq start (- (match-end 0) 2) - n (1+ n))) - n)) - -(defun TeX-auto-parse-region (regexp-list beg end) - "Parse TeX information according to REGEXP-LIST between BEG and END." - (if (symbolp regexp-list) - (setq regexp-list (and (boundp regexp-list) (symbol-value regexp-list)))) - (if regexp-list - ;; Extract the information. - (let* (groups - (count 1) - (regexp (concat "\\(" - (mapconcat - (lambda(x) - (push (cons count x) groups) - (setq count - (+ 1 count - (TeX-regexp-group-count (car x)))) - (car x)) - regexp-list "\\)\\|\\(") - "\\)")) - syms - lst) - (setq count 0) - (goto-char (if end (min end (point-max)) (point-max))) - (while (re-search-backward regexp beg t) - (let* ((entry (cdr (TeX-member nil groups - (lambda (a b) - (match-beginning (car b)))))) - (symbol (nth 2 entry)) - (match (nth 1 entry))) - (unless (TeX-in-comment) - (looking-at (nth 0 entry)) - (if (fboundp symbol) - (funcall symbol match) - (puthash (if (listp match) - (mapcar #'TeX-match-buffer match) - (TeX-match-buffer match)) - (setq count (1- count)) - (cdr (or (assq symbol syms) - (car (push - (cons symbol - (make-hash-table :test 'equal)) - syms))))))))) - (setq count 0) - (dolist (symbol syms) - (setq lst (symbol-value (car symbol))) - (while lst - (puthash (pop lst) - (setq count (1+ count)) - (cdr symbol))) - (maphash (lambda (key value) - (push (cons value key) lst)) - (cdr symbol)) - (clrhash (cdr symbol)) - (set (car symbol) (mapcar #'cdr (sort lst #'car-less-than-car))))))) - - -(defun TeX-auto-parse () - "Parse TeX information in current buffer. - -Call the functions in `TeX-auto-prepare-hook' before parsing, and the -functions in `TeX-auto-cleanup-hook' after parsing." - - (let ((case-fold-search nil)) - - (mapc 'TeX-auto-clear-entry TeX-auto-parser) - (run-hooks 'TeX-auto-prepare-hook) - - (save-excursion - (and (> TeX-auto-x-parse-length TeX-auto-parse-length) - (> (point-max) TeX-auto-parse-length) - (TeX-auto-parse-region TeX-auto-x-regexp-list - TeX-auto-parse-length - TeX-auto-x-parse-length)) - (TeX-auto-parse-region TeX-auto-regexp-list - nil TeX-auto-parse-length)) - - ;; Cleanup ignored symbols. - - ;; NOTE: This is O(N M) where it could be O(N log N + M log M) if we - ;; sorted the lists first. - (while (member (car TeX-auto-symbol) TeX-auto-ignore) - (setq TeX-auto-symbol (cdr TeX-auto-symbol))) - (let ((list TeX-auto-symbol)) - (while (and list (cdr list)) - (if (member (car (cdr list)) TeX-auto-ignore) - (setcdr list (cdr (cdr list))) - (setq list (cdr list))))) - - (run-hooks 'TeX-auto-cleanup-hook))) - -(defun TeX-auto-clear-entry (entry) - "Set the temporary variable in ENTRY to nil." - (set (nth TeX-auto-parser-temporary entry) nil)) - -(defvar LaTeX-auto-end-symbol nil) - -(defun TeX-auto-symbol-check (match) - "Add MATCH to TeX-auto-symbols. -Check for potential LaTeX environments." - (let ((symbol (if (listp match) - (mapcar 'TeX-match-buffer match) - (TeX-match-buffer match)))) - (if (and (stringp symbol) - (string-match "^end\\(.+\\)$" symbol)) - (add-to-list 'LaTeX-auto-end-symbol - (substring symbol (match-beginning 1) (match-end 1))) - (if (listp symbol) - (dolist (elt symbol) - (add-to-list 'TeX-auto-symbol elt)) - (add-to-list 'TeX-auto-symbol symbol))))) - -;;; Utilities -;; -;; Some of these functions has little to do with TeX, but nonetheless we -;; should use the "TeX-" prefix to avoid name clashes. - -(defcustom TeX-auto-regexp-list 'TeX-auto-full-regexp-list - "*List of regular expressions used for parsing the current file." - :type '(radio (variable-item TeX-auto-empty-regexp-list) - (variable-item TeX-auto-full-regexp-list) - (variable-item plain-TeX-auto-regexp-list) - (variable-item LaTeX-auto-minimal-regexp-list) - (variable-item LaTeX-auto-label-regexp-list) - (variable-item LaTeX-auto-regexp-list) - (symbol :tag "Other") - (repeat :tag "Specify" - (group (regexp :tag "Match") - (sexp :tag "Groups") - symbol))) - :group 'TeX-parse) - (make-variable-buffer-local 'TeX-auto-regexp-list) - -(defgroup TeX-file-extension nil - "File extensions recognized by AUCTeX." - :group 'TeX-file) - -(defcustom TeX-file-extensions '("tex" "sty" "cls" "ltx" "texi" "texinfo" "dtx") - "*File extensions used by manually generated TeX files." - :group 'TeX-file-extension - :type '(repeat (string :format "%v"))) - -(defcustom TeX-all-extensions '("[^.\n]+") - "All possible file extensions." - :group 'TeX-file-extension - :type '(repeat (regexp :format "%v"))) - -(defcustom TeX-default-extension "tex" - "*Default extension for TeX files." - :group 'TeX-file-extension - :type 'string) - - (make-variable-buffer-local 'TeX-default-extension) - -(defcustom docTeX-default-extension "dtx" - "*Default extension for docTeX files." - :group 'TeX-file-extension - :type 'string) - -(defvar TeX-output-extension nil - "Extension of TeX output file. -This is either a string or a list with -a string as element. Its value is obtained from `TeX-command-output-list'. -Access to the value should be through the function `TeX-output-extension'.") - - (make-variable-buffer-local 'TeX-output-extension) - -(defcustom BibTeX-file-extensions '("bib") - "Valid file extensions for BibTeX files." - :group 'TeX-file-extension - :type '(repeat (string :format "%v"))) - -(defcustom BibTeX-style-extensions '("bst") - "Valid file extensions for BibTeX styles." - :group 'TeX-file-extension - :type '(repeat (string :format "%v"))) - -(defcustom TeX-ignore-file "\\(^\\|[/\\]\\)\\(\\.\\|\\.\\.\\|RCS\\|SCCS\\|CVS\\|babel\\..*\\)$" - "Regular expression matching file names to ignore. - -These files or directories will not be considered when searching for -TeX files in a directory." - :group 'TeX-parse - :type 'regexp) - -(defcustom TeX-file-recurse t - "*Whether to search TeX directories recursively. -nil means do not recurse, a positive integer means go that far deep in the -directory hierarchy, t means recurse indefinitely." - :group 'TeX-parse - :type '(choice (const :tag "On" t) - (const :tag "Off" nil) - (integer :tag "Depth" :value 1))) - -(defun TeX-match-extension (file &optional extensions) - "Return non-nil if FILE has one of EXTENSIONS. - -If EXTENSIONS is not specified or nil, the value of -`TeX-file-extensions' is used instead." - - (if (null extensions) - (setq extensions TeX-file-extensions)) - - (let ((regexp (concat "\\.\\(" - (mapconcat 'identity extensions "\\|") - "\\)$")) - (case-fold-search t)) - (string-match regexp file))) - -(defun TeX-strip-extension (&optional string extensions nodir nostrip) - "Return STRING without any trailing extension in EXTENSIONS. -If NODIR is t, also remove directory part of STRING. -If NODIR is `path', remove directory part of STRING if it is equal to -the current directory, `TeX-macro-private' or `TeX-macro-global'. -If NOSTRIP is set, do not remove extension after all. -STRING defaults to the name of the current buffer. -EXTENSIONS defaults to `TeX-file-extensions'." - - (if (null string) - (setq string (or (buffer-file-name) ""))) - - (if (null extensions) - (setq extensions TeX-file-extensions)) - - (let* ((strip (if (and (not nostrip) - (TeX-match-extension string extensions)) - (substring string 0 (match-beginning 0)) - string)) - (dir (expand-file-name (or (file-name-directory strip) "./")))) - (if (or (eq nodir t) - (string-equal dir (expand-file-name "./")) - (member dir TeX-macro-global) - (member dir TeX-macro-private)) - (file-name-nondirectory strip) - strip))) - -(defcustom TeX-kpathsea-path-delimiter t - "Path delimiter for kpathsea output. -t means autodetect, nil means kpathsea is disabled." - :group 'TeX-file - :type '(choice (const ":") - (const ";") - (const :tag "Autodetect" t) - (const :tag "Off" nil))) - -(defcustom TeX-kpathsea-format-alist - '(("tex" "${TEXINPUTS.latex}" TeX-file-extensions) - ("sty" "${TEXINPUTS.latex}" '("sty")) - ("dvi" "${TEXDOCS}" '("dvi" "pdf" "ps" "txt" "html" - "dvi.gz" "pdf.gz" "ps.gz" "txt.gz" "html.gz" - "dvi.bz2" "pdf.bz2" "ps.bz2" "txt.bz2" "html.bz2")) - ("eps" "${TEXINPUTS}" LaTeX-includegraphics-extensions) - ("pdf" "${TEXINPUTS}" LaTeX-includegraphics-extensions) - ("png" "${TEXINPUTS}" LaTeX-includegraphics-extensions) - ("jpg" "${TEXINPUTS}" LaTeX-includegraphics-extensions) - ("jpeg" "${TEXINPUTS}" LaTeX-includegraphics-extensions) - ("bib" "$BIBINPUTS" BibTeX-file-extensions) - ("bst" "$BSTINPUTS" BibTeX-style-extensions)) - "Formats to search for expansion using kpathsea. -The key of the alist represents the name of the format. The -first element of the cdr of the alist is string to expand by the -respective kpathsea program and the second element is a list of -file extensions to match." - :group 'TeX-file - :type '(alist :key-type string :value-type (group string sexp))) - -;; FIXME: Despite the first parameter named `extensions', -;; `TeX-search-files-kpathsea' basically treats this as a format -;; specifier. Only the first element in the respective list will be -;; used to determine the search paths and file extensions with the -;; help of `TeX-kpathsea-format-alist'. Out of these differences -;; arises a need to unify the behavior of `TeX-search-files' and -;; `TeX-search-files-kpathsea' and their treatment of parameters. -;; Additionally `TeX-search-files-kpathsea' should be made more -;; general to work with other platforms and TeX systems as well. -(defun TeX-search-files-kpathsea (extensions nodir strip) - "The kpathsea-enabled version of `TeX-search-files'. -Except for DIRECTORIES (a kpathsea string), the arguments for -EXTENSIONS, NODIR and STRIP are explained there." - (and TeX-kpathsea-path-delimiter - (catch 'no-kpathsea - (let* ((format-spec (assoc (car extensions) - TeX-kpathsea-format-alist)) - (dirs (with-output-to-string - (unless (zerop - (call-process - "kpsewhich" nil (list standard-output nil) - nil - (concat - "-expand-path=" - (nth 1 format-spec)))) - (if (eq TeX-kpathsea-path-delimiter t) - (throw 'no-kpathsea - (setq TeX-kpathsea-path-delimiter nil)) - (error "kpsewhich error"))))) - result) - (when (eq TeX-kpathsea-path-delimiter t) - (setq TeX-kpathsea-path-delimiter - (cond ((string-match ";" dirs) - ";") - ((string-match ":" dirs) - ":")))) - (unless TeX-kpathsea-path-delimiter - (throw 'no-kpathsea nil)) - (setq dirs (split-string dirs (concat "[\n\r" - TeX-kpathsea-path-delimiter - "]+"))) - (setq extensions (concat "\\." - (regexp-opt (eval (nth 2 format-spec)) t) - "\\'")) - (setq result - (apply #'append - (mapcar - (lambda(x) (directory-files x - (not nodir) - extensions)) - dirs))) - (if strip - (mapcar (lambda(x) - (if (string-match extensions x) - (substring x 0 (match-beginning 0)) - x)) - result) - result))))) - -(defun TeX-search-files (&optional directories extensions nodir strip) - "Return a list of all reachable files in DIRECTORIES ending with EXTENSIONS. -If optional argument NODIR is set, remove directory part. -If optional argument STRIP is set, remove file extension. -If optional argument DIRECTORIES is set, search in those directories. -Otherwise, search in all TeX macro directories. -If optional argument EXTENSIONS is not set, use `TeX-file-extensions'" - (if (null extensions) - (setq extensions TeX-file-extensions)) - (or (TeX-search-files-kpathsea extensions nodir strip) - (progn - (if (null directories) - (setq directories - (cons "./" (append TeX-macro-private TeX-macro-global)))) - (let (match - (TeX-file-recurse (cond ((symbolp TeX-file-recurse) - TeX-file-recurse) - ((zerop TeX-file-recurse) - nil) - ((1- TeX-file-recurse))))) - (while directories - (let* ((directory (car directories)) - (content (and directory - (file-readable-p directory) - (file-directory-p directory) - (directory-files directory)))) - (setq directories (cdr directories)) - (while content - (let ((file (concat directory (car content)))) - (setq content (cdr content)) - (cond ((string-match TeX-ignore-file file)) - ((not (file-readable-p file))) - ((file-directory-p file) - (if TeX-file-recurse - (setq match - (append match - (TeX-search-files - (list (file-name-as-directory file)) - extensions - nodir strip))))) - ((TeX-match-extension file extensions) - (setq match (cons (TeX-strip-extension file - extensions - nodir - (not strip)) - match)))))))) - match)))) - -(defun TeX-car-string-lessp (s1 s2) - "Compare the cars of S1 and S2 in lexicographic order. -Return t if first is less than second in lexicographic order." - (string-lessp (car s1) (car s2))) - -(defun TeX-listify (elt) - "Return a newly created list with element ELT. -If ELT already is a list, return ELT." - (if (listp elt) elt (list elt))) - -(defun TeX-member (elt list how) - "Return the member ELT in LIST. Comparison done with HOW. -Return nil if ELT is not a member of LIST." - (while (and list (not (funcall how elt (car list)))) - (setq list (cdr list))) - (car-safe list)) - -(defun TeX-elt-of-list-member (elts list) - "Return non-nil if an element of ELTS is a member of LIST." - (catch 'found - (dolist (elt elts) - (when (member elt list) - (throw 'found t))))) - -(defun TeX-assoc (key list) - "Return non-nil if KEY is `equal' to the car of an element of LIST. -Like assoc, except case insensitive." - (let ((case-fold-search t)) - (TeX-member key list - (lambda (a b) - (string-match (concat "^" (regexp-quote a) "$") - (car b)))))) - -(defun TeX-match-buffer (n) - "Return the substring corresponding to the N'th match. -See `match-data' for details." - (if (match-beginning n) - (buffer-substring-no-properties (match-beginning n) (match-end n)) - "")) - -(defun TeX-function-p (arg) - "Return non-nil if ARG is callable as a function." - (or (and (fboundp 'byte-code-function-p) - (byte-code-function-p arg)) - (and (listp arg) - (eq (car arg) 'lambda)) - (and (symbolp arg) - (fboundp arg)))) - -(defun TeX-booleanp (arg) - "Return non-nil if ARG is t or nil." - (memq arg '(t nil))) - -(defun TeX-looking-at-backward (regexp &optional limit) - "Return non-nil if the text before point matches REGEXP. -Optional second argument LIMIT gives a max number of characters -to look backward for." - (let ((pos (point))) - (save-excursion - (and (re-search-backward regexp - (if limit (max (point-min) (- (point) limit))) - t) - (eq (match-end 0) pos))))) - -(defun TeX-current-line () - "The current line number." - (format "%d" (1+ (TeX-current-offset)))) - -(defun TeX-current-file-name-master-relative () - "Return current filename, relative to master directory." - (file-relative-name - (buffer-file-name) - (TeX-master-directory))) - -(defun TeX-near-bobp () - "Return t iff there's nothing but whitespace between (bob) and (point)." - (save-excursion - (skip-chars-backward " \t\n") - (bobp))) - -(defun TeX-deactivate-mark () - "Deactivate the mark. -This is a compatibility function which works both in Emacs and -XEmacs. In XEmacs the region is deactivated instead of the -mark which is sort of equivalent." - (if (featurep 'xemacs) - (zmacs-deactivate-region) - (deactivate-mark))) - -(defalias 'TeX-run-mode-hooks - (if (fboundp 'run-mode-hooks) 'run-mode-hooks 'run-hooks)) - - -;;; Syntax Table - -(defvar TeX-mode-syntax-table (make-syntax-table) - "Syntax table used while in TeX mode.") - - (make-variable-buffer-local 'TeX-mode-syntax-table) - -(progn ; Define TeX-mode-syntax-table. - (modify-syntax-entry (string-to-char TeX-esc) - "\\" TeX-mode-syntax-table) - (modify-syntax-entry ?\f ">" TeX-mode-syntax-table) - (modify-syntax-entry ?\n ">" TeX-mode-syntax-table) - (modify-syntax-entry (string-to-char TeX-grop) - (concat "(" TeX-grcl) - TeX-mode-syntax-table) - (modify-syntax-entry (string-to-char TeX-grcl) - (concat ")" TeX-grop) - TeX-mode-syntax-table) - (modify-syntax-entry ?% "<" TeX-mode-syntax-table) - (modify-syntax-entry ?\" "." TeX-mode-syntax-table) - (modify-syntax-entry ?& "." TeX-mode-syntax-table) - (modify-syntax-entry ?_ "." TeX-mode-syntax-table) - (modify-syntax-entry ?@ "_" TeX-mode-syntax-table) - (modify-syntax-entry ?~ "." TeX-mode-syntax-table) - (modify-syntax-entry ?$ "$" TeX-mode-syntax-table) - (modify-syntax-entry ?' "w" TeX-mode-syntax-table) - (modify-syntax-entry ?« "." TeX-mode-syntax-table) - (modify-syntax-entry ?» "." TeX-mode-syntax-table)) - -;;; Menu Support - -(defvar TeX-command-current 'TeX-command-master - "Specify whether to run command on master, buffer or region.") -;; Function used to run external command. - -(defun TeX-command-select-master () - "Determine that the next command will be on the master file." - (interactive) - (message "Next command will be on the master file.") - (setq TeX-command-current 'TeX-command-master)) - -(defun TeX-command-select-buffer () - "Determine that the next command will be on the buffer." - (interactive) - (message "Next command will be on the buffer") - (setq TeX-command-current 'TeX-command-buffer)) - -(defun TeX-command-select-region () - "Determine that the next command will be on the region." - (interactive) - (message "Next command will be on the region") - (setq TeX-command-current 'TeX-command-region)) - -(defvar TeX-command-force nil) -;; If non-nil, TeX-command-query will return the value of this -;; variable instead of quering the user. - -(defun TeX-command-menu (name) - "Execute `TeX-command-list' NAME from a menu." - (let ((TeX-command-force name)) - (funcall TeX-command-current))) - -(defun TeX-command-menu-print (printer command name) - "Print on PRINTER using method COMMAND to run NAME." - (let ((TeX-printer-default (unless (string= printer "Other") printer)) - (TeX-printer-list (and (string= printer "Other") TeX-printer-list)) - (TeX-print-command command) - (TeX-queue-command command)) - (TeX-command-menu name))) - -(defun TeX-command-menu-printer-entry (entry lookup command name) - "Return `TeX-printer-list' ENTRY as a menu item." - (vector (nth 0 entry) - (list 'TeX-command-menu-print - (nth 0 entry) - (or (nth lookup entry) command) - name))) - -(defun TeX-command-menu-entry (entry) - "Return `TeX-command-list' ENTRY as a menu item." - (let ((name (car entry))) - (cond ((and (string-equal name TeX-command-Print) - TeX-printer-list) - (cons TeX-command-Print - (mapcar (lambda (entry) - (TeX-command-menu-printer-entry - entry 1 TeX-print-command name)) - (append TeX-printer-list '(("Other")))))) - ((and (string-equal name TeX-command-Queue) - TeX-printer-list) - (cons TeX-command-Queue - (mapcar (lambda (entry) - (TeX-command-menu-printer-entry - entry 2 TeX-queue-command name)) - (append TeX-printer-list '(("Other")))))) - (t - (vconcat `(,name (TeX-command-menu ,name)) - (nthcdr 5 entry)))))) - -(defconst TeX-command-menu-name "Command" - "Name to be displayed for the command menu in all modes defined by AUCTeX.") - -;;; Keymap - -(defcustom TeX-electric-escape nil - "If non-nil, ``\\'' will be bound to `TeX-electric-macro'." - :group 'TeX-macro - :type 'boolean) - -(defcustom TeX-electric-sub-and-superscript nil - "If non-nil, insert braces after typing `^' and `_' in math mode." - :group 'TeX-macro - :type 'boolean) - -(defcustom TeX-newline-function 'newline - "Function to be called upon pressing `RET'." - :group 'TeX-indentation - :type '(choice (const newline) - (const newline-and-indent) - (const reindent-then-newline-and-indent) - (sexp :tag "Other"))) - -(defun TeX-insert-backslash (arg) - "Either insert typed key ARG times or call `TeX-electric-macro'. -`TeX-electric-macro' will be called if `TeX-electric-escape' is non-nil." - (interactive "*p") - (if TeX-electric-escape - (TeX-electric-macro) - (self-insert-command arg))) - -(defun TeX-insert-sub-or-superscript (arg) - "Insert typed key ARG times and possibly a pair of braces. -Brace insertion is only done if point is in a math construct and -`TeX-electric-sub-and-superscript' has a non-nil value." - (interactive "*p") - (self-insert-command arg) - (when (and TeX-electric-sub-and-superscript (texmathp)) - (insert (concat TeX-grop TeX-grcl)) - (backward-char))) - -(defun TeX-newline () - "Call the function specified by the variable `TeX-newline-function'." - (interactive) (funcall TeX-newline-function)) - -(defvar TeX-mode-map - (let ((map (make-sparse-keymap))) - ;; Standard - ;; (define-key map "\177" 'backward-delete-char-untabify) - (define-key map "\C-c}" 'up-list) - (define-key map "\C-c#" 'TeX-normal-mode) - (define-key map "\C-c\C-n" 'TeX-normal-mode) - (define-key map "\C-c?" 'TeX-doc) - (define-key map "\C-c\C-i" 'TeX-goto-info-page) - (define-key map "\r" 'TeX-newline) - - ;; From tex.el - (define-key map "\"" 'TeX-insert-quote) - (define-key map "$" 'TeX-insert-dollar) - ;; Removed because LaTeX 2e have a better solution to italic correction. - ;; (define-key map "." 'TeX-insert-punctuation) - ;; (define-key map "," 'TeX-insert-punctuation) - (define-key map "\C-c{" 'TeX-insert-braces) - (define-key map "\C-c\C-f" 'TeX-font) - (define-key map "\C-c\C-m" 'TeX-insert-macro) - (define-key map "\\" 'TeX-insert-backslash) - (define-key map "^" 'TeX-insert-sub-or-superscript) - (define-key map "_" 'TeX-insert-sub-or-superscript) - (define-key map "\e\t" 'TeX-complete-symbol) ;*** Emacs 19 way - - (define-key map "\C-c'" 'TeX-comment-or-uncomment-paragraph) ;*** Old way - (define-key map "\C-c:" 'TeX-comment-or-uncomment-region) ;*** Old way - (define-key map "\C-c\"" 'TeX-uncomment) ;*** Old way - - (define-key map "\C-c;" 'TeX-comment-or-uncomment-region) - (define-key map "\C-c%" 'TeX-comment-or-uncomment-paragraph) - - (define-key map "\C-c\C-t\C-p" 'TeX-PDF-mode) - (define-key map "\C-c\C-t\C-i" 'TeX-interactive-mode) - (define-key map "\C-c\C-t\C-s" 'TeX-source-correlate-mode) - (define-key map "\C-c\C-t\C-r" 'TeX-pin-region) - (define-key map "\C-c\C-w" 'TeX-toggle-debug-bad-boxes); to be removed - (define-key map "\C-c\C-t\C-b" 'TeX-toggle-debug-bad-boxes) - (define-key map "\C-c\C-t\C-w" 'TeX-toggle-debug-warnings) - (define-key map "\C-c\C-v" 'TeX-view) - ;; From tex-buf.el - (define-key map "\C-c\C-d" 'TeX-save-document) - (define-key map "\C-c\C-r" 'TeX-command-region) - (define-key map "\C-c\C-b" 'TeX-command-buffer) - (define-key map "\C-c\C-c" 'TeX-command-master) - (define-key map "\C-c\C-k" 'TeX-kill-job) - (define-key map "\C-c\C-l" 'TeX-recenter-output-buffer) - (define-key map "\C-c^" 'TeX-home-buffer) - (define-key map "\C-c`" 'TeX-next-error) - ;; Remap bindings of `next-error' - (if (featurep 'xemacs) - (substitute-key-definition 'next-error 'TeX-next-error map global-map) - (define-key map [remap next-error] 'TeX-next-error)) - ;; Remap bindings of `previous-error' - (if (featurep 'xemacs) - (substitute-key-definition 'previous-error 'TeX-previous-error - map global-map) - (define-key map [remap previous-error] 'TeX-previous-error)) - ;; From tex-fold.el - (define-key map "\C-c\C-o\C-f" 'TeX-fold-mode) - - ;; Multifile - (define-key map "\C-c_" 'TeX-master-file-ask) ;*** temporary - map) - "Keymap for common TeX and LaTeX commands.") - -(defvar plain-TeX-mode-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map TeX-mode-map) - map) - "Keymap used in plain TeX mode.") - -(defun TeX-mode-specific-command-menu (mode) - "Return a Command menu specific to the major MODE." - ;; COMPATIBILITY for Emacs < 21 - (if (and (not (featurep 'xemacs)) - (= emacs-major-version 20)) - (cons TeX-command-menu-name - (TeX-mode-specific-command-menu-entries mode)) - (list TeX-command-menu-name - :filter `(lambda (&rest ignored) - (TeX-mode-specific-command-menu-entries ',mode)) - "Bug."))) - -(defun TeX-mode-specific-command-menu-entries (mode) - "Return the entries for a Command menu specific to the major MODE." - (append - (TeX-menu-with-help - `("Command on" - [ "Master File" TeX-command-select-master - :keys "C-c C-c" :style radio - :selected (eq TeX-command-current 'TeX-command-master) - :help "Commands in this menu work on the Master File"] - [ "Buffer" TeX-command-select-buffer - :keys "C-c C-b" :style radio - :selected (eq TeX-command-current 'TeX-command-buffer) - :help "Commands in this menu work on the current buffer"] - [ "Region" TeX-command-select-region - :keys "C-c C-r" :style radio - :selected (eq TeX-command-current 'TeX-command-region) - :help "Commands in this menu work on the region"] - [ "Fix the Region" TeX-pin-region - :active (or (if prefix-arg - (<= (prefix-numeric-value prefix-arg) 0) - (and (boundp 'TeX-command-region-begin) - (markerp TeX-command-region-begin))) - (TeX-mark-active)) - ;;:visible (eq TeX-command-current 'TeX-command-region) - :style toggle - :selected (and (boundp 'TeX-command-region-begin) - (markerp TeX-command-region-begin)) - :help "Fix the region for \"Command on Region\""] - "-" - ["Recenter Output Buffer" TeX-recenter-output-buffer - :help "Show the output of current TeX process"] - ["Kill Job" TeX-kill-job - :help "Kill the current TeX process"] - ["Next Error" TeX-next-error - :help "Jump to the next error of the last TeX run"] - ["Quick View" TeX-view - :help "Start a viewer without prompting"] - "-" - ("TeXing Options" - ,@(mapcar (lambda (x) - (let ((symbol (car x)) (name (nth 1 x))) - `[ ,(format "Use %s engine" name) (TeX-engine-set ',symbol) - :style radio :selected (eq TeX-engine ',symbol) - :help ,(format "Use %s engine for compiling" name) ])) - (TeX-engine-alist)) - "-" - [ "Generate PDF" TeX-PDF-mode - :style toggle :selected TeX-PDF-mode - :active (not (eq TeX-engine 'omega)) - :help "Use PDFTeX to generate PDF instead of DVI"] - [ "Run Interactively" TeX-interactive-mode - :style toggle :selected TeX-interactive-mode :keys "C-c C-t C-i" - :help "Stop on errors in a TeX run"] - [ "Correlate I/O" TeX-source-correlate-mode - :style toggle :selected TeX-source-correlate-mode - :help "Enable forward and inverse search in the previewer"] - ["Debug Bad Boxes" TeX-toggle-debug-bad-boxes - :style toggle :selected TeX-debug-bad-boxes :keys "C-c C-t C-b" - :help "Make \"Next Error\" show overfull and underfull boxes"] - ["Debug Warnings" TeX-toggle-debug-warnings - :style toggle :selected TeX-debug-warnings - :help "Make \"Next Error\" show warnings"]))) - (let ((file 'TeX-command-on-current));; is this actually needed? - (TeX-maybe-remove-help - (delq nil - (mapcar 'TeX-command-menu-entry - (TeX-mode-specific-command-list mode))))))) - -(defun TeX-mode-specific-command-list (mode) - "Return the list of commands available in the given MODE." - (let ((full-list TeX-command-list) - out-list - entry) - (while (setq entry (pop full-list)) - ;; `(nth 4 entry)' may be either an atom in case of which the - ;; entry should be present in any mode or a list of major modes. - (if (or (atom (nth 4 entry)) - (memq mode (nth 4 entry))) - (push entry out-list))) - (nreverse out-list))) - -(defvar TeX-fold-menu - (TeX-menu-with-help - '("Show/Hide" - ["Fold Mode" TeX-fold-mode - :style toggle - :selected (and (boundp 'TeX-fold-mode) TeX-fold-mode) - :help "Toggle folding mode"] - "-" - ["Hide All in Current Buffer" TeX-fold-buffer - :active (and (boundp 'TeX-fold-mode) TeX-fold-mode) - :help "Hide all configured TeX constructs in the current buffer"] - ["Hide All in Current Region" TeX-fold-region - :active (and (boundp 'TeX-fold-mode) TeX-fold-mode) - :help "Hide all configured TeX constructs in the marked region"] - ["Hide All in Current Paragraph" TeX-fold-paragraph - :active (and (boundp 'TeX-fold-mode) TeX-fold-mode) - :help "Hide all configured TeX constructs in the paragraph containing point"] - ["Hide Current Macro" TeX-fold-macro - :active (and (boundp 'TeX-fold-mode) TeX-fold-mode) - :help "Hide the macro containing point"] - ["Hide Current Environment" TeX-fold-env - :visible (not (eq major-mode 'plain-tex-mode)) - :active (and (boundp 'TeX-fold-mode) TeX-fold-mode) - :help "Hide the environment containing point"] - ["Hide Current Comment" TeX-fold-comment - :active (and (boundp 'TeX-fold-mode) TeX-fold-mode) - :help "Hide the comment containing point"] - "-" - ["Show All in Current Buffer" TeX-fold-clearout-buffer - :active (and (boundp 'TeX-fold-mode) TeX-fold-mode) - :help "Permanently show all folded content again"] - ["Show All in Current Region" TeX-fold-clearout-region - :active (and (boundp 'TeX-fold-mode) TeX-fold-mode) - :help "Permanently show all folded content in marked region"] - ["Show All in Current Paragraph" TeX-fold-clearout-paragraph - :active (and (boundp 'TeX-fold-mode) TeX-fold-mode) - :help "Permanently show all folded content in paragraph containing point"] - ["Show Current Item" TeX-fold-clearout-item - :active (and (boundp 'TeX-fold-mode) TeX-fold-mode) - :help "Permanently show the item containing point"] - "-" - ["Hide or Show Current Item" TeX-fold-dwim - :active (and (boundp 'TeX-fold-mode) TeX-fold-mode) - :help "Hide or show the item containing point"])) - "Menu definition for commands from tex-fold.el.") - - -;;; Menus for plain TeX mode -(easy-menu-define plain-TeX-mode-command-menu - plain-TeX-mode-map - "Command menu used in TeX mode." - (TeX-mode-specific-command-menu 'plain-tex-mode)) - -(defvar TeX-customization-menu nil) - -(defvar TeX-common-menu-entries - (TeX-menu-with-help - `(("Multifile/Parsing" - ["Switch to Master File" TeX-home-buffer - :help "Switch to buffer of Master File, or buffer of last TeX command"] - ["Save Document" TeX-save-document - :help "Save all buffers associated with the current Master File"] - ["Set Master File" TeX-master-file-ask - :active (not (TeX-local-master-p)) - :help "Set the main file to run TeX commands on"] - ["Reset Buffer" TeX-normal-mode - :help "Save and reparse the current buffer for style information"] - ["Reset AUCTeX" (TeX-normal-mode t) :keys "C-u C-c C-n" - :help "Reset buffer and reload AUCTeX style files"]) - ["Find Documentation..." TeX-doc - :help "Get help on commands, packages, or TeX-related topics in general"] - ["Read the AUCTeX Manual" TeX-goto-info-page - :help "Everything worth reading"] - ("Customize AUCTeX" - ["Browse Options" - (customize-group 'AUCTeX) - :help "Open the customization buffer for AUCTeX"] - ["Extend this Menu" - (progn - (easy-menu-add-item - nil - ;; Ugly hack because docTeX mode uses the LaTeX menu. - (list (if (eq major-mode 'doctex-mode) "LaTeX" TeX-base-mode-name)) - (or TeX-customization-menu - (setq TeX-customization-menu - (customize-menu-create 'AUCTeX "Customize AUCTeX"))))) - :help "Make this menu a full-blown customization menu"]) - ["Report AUCTeX Bug" TeX-submit-bug-report - :help ,(format "Problems with AUCTeX %s? Mail us!" - AUCTeX-version)]))) - -(defvar plain-TeX-menu-entries - (TeX-menu-with-help - `(["Macro..." TeX-insert-macro - :help "Insert a macro and possibly arguments"] - ["Complete" TeX-complete-symbol - :help "Complete the current macro"] - "-" - ("Insert Font" - ["Emphasize" (TeX-font nil ?\C-e) :keys "C-c C-f C-e"] - ["Bold" (TeX-font nil ?\C-b) :keys "C-c C-f C-b"] - ["Typewriter" (TeX-font nil ?\C-t) :keys "C-c C-f C-t"] - ["Small Caps" (TeX-font nil ?\C-c) :keys "C-c C-f C-c"] - ["Sans Serif" (TeX-font nil ?\C-f) :keys "C-c C-f C-f"] - ["Italic" (TeX-font nil ?\C-i) :keys "C-c C-f C-i"] - ["Slanted" (TeX-font nil ?\C-s) :keys "C-c C-f C-s"] - ["Roman" (TeX-font nil ?\C-r) :keys "C-c C-f C-r"] - ["Calligraphic" (TeX-font nil ?\C-a) :keys "C-c C-f C-a"]) - ("Replace Font" - ["Emphasize" (TeX-font t ?\C-e) :keys "C-u C-c C-f C-e"] - ["Bold" (TeX-font t ?\C-b) :keys "C-u C-c C-f C-b"] - ["Typewriter" (TeX-font t ?\C-t) :keys "C-u C-c C-f C-t"] - ["Small Caps" (TeX-font t ?\C-c) :keys "C-u C-c C-f C-c"] - ["Sans Serif" (TeX-font t ?\C-f) :keys "C-u C-c C-f C-f"] - ["Italic" (TeX-font t ?\C-i) :keys "C-u C-c C-f C-i"] - ["Slanted" (TeX-font t ?\C-s) :keys "C-u C-c C-f C-s"] - ["Roman" (TeX-font t ?\C-r) :keys "C-u C-c C-f C-r"] - ["Calligraphic" (TeX-font t ?\C-a) :keys "C-u C-c C-f C-a"]) - ["Delete Font" (TeX-font t ?\C-d) :keys "C-c C-f C-d"] - "-" - ["Comment or Uncomment Region" TeX-comment-or-uncomment-region - :help "Comment or uncomment the currently selected region"] - ["Comment or Uncomment Paragraph" TeX-comment-or-uncomment-paragraph - :help "Comment or uncomment the paragraph containing point"] - ,TeX-fold-menu - "-" . ,TeX-common-menu-entries))) - -(easy-menu-define plain-TeX-mode-menu - plain-TeX-mode-map - "Menu used in plain TeX mode." - (cons "TeX" plain-TeX-menu-entries)) - -;;; AmSTeX - -(defvar AmSTeX-mode-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map TeX-mode-map) - map) - "Keymap used in `AmSTeX-mode'.") - -;; Menu for AmSTeX mode -(easy-menu-define AmSTeX-mode-command-menu - AmSTeX-mode-map - "Command menu used in AmsTeX mode." - (TeX-mode-specific-command-menu 'ams-tex-mode)) - -(easy-menu-define AmSTeX-mode-menu - AmSTeX-mode-map - "Menu used in AMS-TeX mode." - (cons "AmS-TeX" plain-TeX-menu-entries)) - -;;;###autoload -(defun ams-tex-mode () - "Major mode in AUCTeX for editing AmS-TeX files. -See info under AUCTeX for documentation. - -Special commands: -\\{AmSTeX-mode-map} - -Entering AmS-tex-mode calls the value of `text-mode-hook', -then the value of `TeX-mode-hook', and then the value -of `AmS-TeX-mode-hook'." - (interactive) - (plain-TeX-common-initialization) - (setq major-mode 'ams-tex-mode) - (use-local-map AmSTeX-mode-map) - - ;; Menu - (easy-menu-add AmSTeX-mode-menu AmSTeX-mode-map) - (easy-menu-add AmSTeX-mode-command-menu AmSTeX-mode-map) - - (setq TeX-base-mode-name "AmS-TeX") - (setq TeX-command-default "AmSTeX") - (TeX-run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'AmS-TeX-mode-hook) - (TeX-set-mode-name)) - - -;;; Verbatim constructs - -(defvar TeX-verbatim-p-function nil - "Mode-specific function to be called by `TeX-verbatim-p'.") -(make-variable-buffer-local 'TeX-verbatim-p-function) - -;; XXX: We only have an implementation for LaTeX mode at the moment (Oct 2009). -(defun TeX-verbatim-p (&optional pos) - "Return non-nil if position POS is in a verbatim-like construct. -A mode-specific implementation is required. If it is not -available, the function always returns nil." - (when TeX-verbatim-p-function - (funcall TeX-verbatim-p-function))) - - -;;; Comments - -(defvar TeX-comment-start-regexp "%" - "Regular expression matching a comment starter. -Unlike the variable `comment-start-skip' it should not match any -whitespace after the comment starter or any character before it.") -(make-variable-buffer-local 'TeX-comment-start-regexp) - -(defun TeX-comment-region (beg end &optional arg) - "Comment each line in the region from BEG to END. -Numeric prefix arg ARG means use ARG comment characters. -If ARG is negative, delete that many comment characters instead." - (interactive "*r\nP") - ;; `comment-padding' will not be recognized in XEmacs' (21.4) - ;; `comment-region', so we temporarily modify `comment-start' to get - ;; proper spacing. Unfortunately we have to check for the XEmacs - ;; version and cannot test if `comment-padding' is bound as this - ;; gets initialized in `VirTeX-common-initialization'. - (let ((comment-start (if (and (featurep 'xemacs) - (= emacs-major-version 21) - (<= emacs-minor-version 4)) - (concat comment-start (TeX-comment-padding-string)) - comment-start))) - (comment-region beg end arg))) - -(eval-and-compile - ;; COMPATIBILITY for Emacs <= 21.3 - (if (fboundp 'comment-or-uncomment-region) - (defalias 'TeX-comment-or-uncomment-region 'comment-or-uncomment-region) - ;; The following function was copied from `newcomment.el' on - ;; 2004-01-30 and adapted accordingly - (defun TeX-comment-or-uncomment-region (beg end &optional arg) - "Comment or uncomment a the region from BEG to END. -Call `TeX-comment-region', unless the region only consists of -comments, in which case call `TeX-uncomment-region'. If a prefix -arg ARG is given, it is passed on to the respective function." - (interactive "*r\nP") - (funcall (if (save-excursion ;; check for already commented region - (goto-char beg) - (TeX-comment-forward (point-max)) - (<= end (point))) - 'TeX-uncomment-region 'TeX-comment-region) - beg end arg))) - - ;; COMPATIBILITY for Emacs <= 20. (Introduced in 21.1?) - (if (fboundp 'uncomment-region) - (defalias 'TeX-uncomment-region 'uncomment-region) - (defun TeX-uncomment-region (beg end &optional arg) - "Remove comment characters from the beginning of each line -in the region from BEG to END. Numeric prefix arg ARG means use -ARG comment characters. If ARG is negative, delete that many -comment characters instead." - (interactive "*r\nP") - (or arg - ;; Determine the number of comment characters at the - ;; beginning of the first commented line. - (setq arg - (save-excursion - (goto-char beg) - (re-search-forward - (concat "^" TeX-comment-start-regexp "+") end t) - (length (match-string 0))))) - (comment-region beg end (- arg))))) - -(defun TeX-uncomment () - "Delete comment characters from the beginning of each line in a comment." - (interactive) - (save-excursion - ;; Find first comment line - (beginning-of-line) - (while (and (looking-at (concat "^[ \t]*" TeX-comment-start-regexp)) - (not (bobp))) - (forward-line -1)) - (let ((beg (point))) - (forward-line 1) - ;; Find last comment line - (while (and (looking-at (concat "^[ \t]*" TeX-comment-start-regexp)) - (not (eobp))) - (forward-line 1)) - ;; Uncomment region - (TeX-uncomment-region beg (point))))) - -(defun TeX-comment-or-uncomment-paragraph () - "Comment or uncomment current paragraph." - (interactive) - (if (TeX-in-commented-line) - (TeX-uncomment) - (save-excursion - (beginning-of-line) - ;; Don't do anything if we are in an empty line. If this line - ;; is followed by a lot of commented lines, this shall prevent - ;; that mark-paragraph skips over these lines and marks a - ;; paragraph outside the visible window which might get - ;; commented without the user noticing. - (unless (looking-at "^[ \t]*$") - (mark-paragraph) - (TeX-comment-region (point) (mark)))))) - -(defun TeX-in-comment () - "Return non-nil if point is in a comment." - (if (or (bolp) - (null comment-start-skip) - (eq (preceding-char) ?\r)) - nil - (save-excursion - (save-match-data - (let ((pos (point))) - (beginning-of-line) - (and (or (looking-at comment-start-skip) - (re-search-forward comment-start-skip pos t)) - (not (TeX-verbatim-p)))))))) - -(defun TeX-in-commented-line () - "Return non-nil if point is in a line consisting only of a comment. -The comment can be preceded by whitespace. This means that -`TeX-in-commented-line' is more general than `TeX-in-line-comment' -which will not match commented lines with leading whitespace. But -`TeX-in-commented-line' will match commented lines without leading -whitespace as well." - (save-excursion - (forward-line 0) - (skip-chars-forward " \t") - (string= (buffer-substring-no-properties - (point) (min (point-max) (+ (point) (length comment-start)))) - comment-start))) - -(defun TeX-in-line-comment () - "Return non-nil if point is in a line comment. -A line comment is a comment starting in column one, i.e. there is -no whitespace before the comment sign." - (save-excursion - (forward-line 0) - (string= (buffer-substring-no-properties - (point) (min (point-max) (+ (point) (length comment-start)))) - comment-start))) - -(defun TeX-comment-prefix () - "Return the comment prefix of the current line. -If there are no comment starters after potential whitespace at -the beginning of the line, return nil." - (save-excursion - (beginning-of-line) - (save-match-data - (when (looking-at (concat "\\([ \t]*" TeX-comment-start-regexp "+\\)+")) - (match-string 0))))) - -(defun TeX-forward-comment-skip (&optional count limit) - "Move forward to the next comment skip. -This may be a switch between commented and not commented adjacent -lines or between lines with different comment prefixes. With -argument COUNT do it COUNT times. If argument LIMIT is given, do -not move point further than this value." - (unless count (setq count 1)) - ;; A value of 0 is nonsense. - (when (= count 0) (setq count 1)) - (unless limit (setq limit (point-max))) - (dotimes (i (abs count)) - (if (< count 0) - (forward-line -1) - (beginning-of-line)) - (let ((prefix (when (looking-at (concat "\\([ \t]*" - TeX-comment-start-regexp "+\\)+")) - (buffer-substring (+ (line-beginning-position) - (current-indentation)) - (match-end 0))))) - (while (save-excursion - (and (if (> count 0) - (<= (point) limit) - (>= (point) limit)) - (zerop (if (> count 0) - (forward-line 1) - (forward-line -1))) - (if prefix - (if (looking-at (concat "\\([ \t]*" - TeX-comment-start-regexp - "+\\)+")) - ;; If the preceding line is a commented line - ;; as well, check if the prefixes are - ;; identical. - (string= prefix - (buffer-substring - (+ (line-beginning-position) - (current-indentation)) - (match-end 0))) - nil) - (not (looking-at (concat "[ \t]*" - TeX-comment-start-regexp)))))) - (if (> count 0) - (forward-line 1) - (forward-line -1))) - (if (> count 0) - (forward-line 1))))) - -(defun TeX-backward-comment-skip (&optional count limit) - "Move backward to the next comment skip. -This may be a switch between commented and not commented adjacent -lines or between lines with different comment prefixes. With -argument COUNT do it COUNT times. If argument LIMIT is given, do -not move point to a position less than this value." - (unless count (setq count 1)) - (when (= count 0) (setq count 1)) - (unless limit (setq limit (point-min))) - (TeX-forward-comment-skip (- count) limit)) - -;; Taken from `comment-forward' in Emacs' CVS on 2006-12-26. Used as -;; a compatibility function for XEmacs 21.4. -(defun TeX-comment-forward (&optional n) - "Skip forward over N comments. -Just like `forward-comment' but only for positive N -and can use regexps instead of syntax." - (when (fboundp 'comment-normalize-vars) - (comment-normalize-vars)) - (if (fboundp 'comment-forward) - (comment-forward n) - (setq n (or n 1)) - (if (< n 0) (error "No comment-backward") - (if comment-use-syntax (forward-comment n) - (while (> n 0) - (setq n - (if (or (forward-comment 1) - (and (looking-at comment-start-skip) - (goto-char (match-end 0)) - (re-search-forward comment-end-skip nil 'move))) - (1- n) -1))) - (= n 0))))) - -(defun TeX-comment-padding-string () - "Return comment padding as a string. -The variable `comment-padding' can hold an integer or a string. -This function will return the appropriate string representation -regardless of its data type." - (if (integerp comment-padding) - (make-string comment-padding ? ) - comment-padding)) - - -;;; Indentation - -(defgroup TeX-indentation nil - "Indentation of TeX buffers in AUCTeX." - :group 'AUCTeX) - -(defcustom TeX-brace-indent-level 2 - "*The level of indentation produced by an open brace." - :group 'TeX-indentation - :type 'integer) - -(defun TeX-comment-indent () - "Determine the indentation of a comment." - (if (looking-at "%%%") - (current-column) - (skip-chars-backward " \t") - (max (if (bolp) 0 (1+ (current-column))) - comment-column))) - -(defun TeX-brace-count-line () - "Count number of open/closed braces." - (save-excursion - (let ((count 0) (limit (line-end-position)) char) - (while (progn - (skip-chars-forward "^{}\\\\" limit) - (when (and (< (point) limit) (not (TeX-in-comment))) - (setq char (char-after)) - (forward-char) - (cond ((eq char ?\{) - (setq count (+ count TeX-brace-indent-level))) - ((eq char ?\}) - (setq count (- count TeX-brace-indent-level))) - ((eq char ?\\) - (when (< (point) limit) - (forward-char) - t)))))) - count))) - -;;; Navigation - -(defvar TeX-search-syntax-table - (let ((table (make-syntax-table (make-char-table (if (featurep 'xemacs) - 'syntax - 'syntax-table))))) - ;; Preset mode-independent syntax entries. (Mode-dependent - ;; entries are set in the function `TeX-search-syntax-table'.) - ;; ?\", ?\( and ?\) explicitely get whitespace syntax because - ;; Emacs 21.3 and XEmacs don't generate a completely empty syntax - ;; table. - (dolist (elt '((?\f . ">") (?\n . ">") (?\" . " ") (?\( . " ") (?\) . " "))) - (modify-syntax-entry (car elt) (cdr elt) table)) - table) - "Syntax table used for searching purposes. -It should be accessed through the function `TeX-search-syntax-table'.") - -(defun TeX-search-syntax-table (&rest args) - "Return a syntax table for searching purposes. -ARGS may be a list of characters. For each of them the -respective predefined syntax is set. Currently the parenthetical -characters ?{, ?}, ?[, ?], ?\(, ?\), ?<, and ?> are supported. -The syntax of each of these characters not specified will be -reset to \" \"." - (let ((char-syntax-alist '((?\{ . "(}") (?\} . "){") - (?\[ . "(]") (?\] . ")[") - (?\( . "()") (?\) . ")(") - (?\< . "(>") (?\> . ")<")))) - ;; Clean entries possibly set before. - (modify-syntax-entry ?\\ " " TeX-search-syntax-table) - (modify-syntax-entry ?@ " " TeX-search-syntax-table) - (modify-syntax-entry ?\% " " TeX-search-syntax-table) - ;; Preset mode-dependent syntax entries. (Mode-independent entries - ;; are set when the variable `TeX-search-syntax-table' is created.) - (modify-syntax-entry (string-to-char TeX-esc) "\\" TeX-search-syntax-table) - (unless (eq major-mode 'texinfo-mode) - (modify-syntax-entry ?\% "<" TeX-search-syntax-table)) - ;; Clean up the entries which can be specified as arguments. - (dolist (elt char-syntax-alist) - (modify-syntax-entry (car elt) " " TeX-search-syntax-table)) - ;; Now set what we got. - (dolist (elt args) - (unless (assoc elt char-syntax-alist) (error "Char not supported")) - (modify-syntax-entry elt (cdr (assoc elt char-syntax-alist)) - TeX-search-syntax-table)) - ;; Return the syntax table. - TeX-search-syntax-table)) - -(defun TeX-find-balanced-brace (&optional count depth limit) - "Return the position of a balanced brace in a TeX group. -The function scans forward COUNT parenthetical groupings. -Default is 1. If COUNT is negative, it searches backwards. With -optional DEPTH>=1, find that outer level. If LIMIT is non-nil, -do not search further than this position in the buffer." - (let ((count (if count - (if (= count 0) (error "COUNT has to be <> 0") count) - 1)) - (depth (if depth - (if (< depth 1) (error "DEPTH has to be > 0") depth) - 1))) - (save-restriction - (when limit - (if (> count 0) - (narrow-to-region (point-min) limit) - (narrow-to-region limit (point-max)))) - (with-syntax-table (TeX-search-syntax-table ?\{ ?\}) - (condition-case nil - (scan-lists (point) count depth) - (error nil)))))) - -(defun TeX-find-closing-brace (&optional depth limit) - "Return the position of the closing brace in a TeX group. -The function assumes that point is inside the group, i.e. after -an opening brace. With optional DEPTH>=1, find that outer level. -If LIMIT is non-nil, do not search further down than this -position in the buffer." - (TeX-find-balanced-brace 1 depth limit)) - -(defun TeX-find-opening-brace (&optional depth limit) - "Return the position of the opening brace in a TeX group. -The function assumes that point is inside the group, i.e. before -a closing brace. With optional DEPTH>=1, find that outer level. -If LIMIT is non-nil, do not search further up than this position -in the buffer." - (TeX-find-balanced-brace -1 depth limit)) - -(defun TeX-find-macro-boundaries (&optional lower-bound) - "Return a list containing the start and end of a macro. -If LOWER-BOUND is given, do not search backward further than this -point in buffer. Arguments enclosed in brackets or braces are -considered part of the macro." - (save-restriction - (when lower-bound - (narrow-to-region lower-bound (point-max))) - (let ((orig-point (point)) - start-point) - ;; Point is located directly at the start of a macro. (-!-\foo{bar}) - (when (and (eq (char-after) (aref TeX-esc 0)) - (not (TeX-escaped-p))) - (setq start-point (point))) - ;; Point is located on a macro. (\fo-!-o{bar}) - (unless start-point - (save-excursion - (skip-chars-backward "A-Za-z@*") - (when (and (eq (char-before) (aref TeX-esc 0)) - (not (TeX-escaped-p (1- (point))))) - (setq start-point (1- (point)))))) - ;; Point is located in the argument of a macro. (\foo{ba-!-r}) - (unless start-point - (save-excursion - (catch 'abort - (let ((parse-sexp-ignore-comments t)) - (when (condition-case nil (progn (up-list) t) (error nil)) - (while (progn - (condition-case nil (backward-sexp) - (error (throw 'abort nil))) - (forward-comment -1) - (and (memq (char-before) '(?\] ?\})) - (not (TeX-escaped-p (1- (point))))))) - (skip-chars-backward "A-Za-z@*") - (when (and (eq (char-before) (aref TeX-esc 0)) - (not (TeX-escaped-p (1- (point))))) - (setq start-point (1- (point))))))))) - ;; Search forward for the end of the macro. - (when start-point - (save-excursion - (goto-char (TeX-find-macro-end-helper start-point)) - (if (< orig-point (point)) - (cons start-point (point)) - nil)))))) - -(defun TeX-find-macro-end-helper (start) - "Find the end of a macro given its START. -START is the position just before the starting token of the macro. -If the macro is followed by square brackets or curly braces, -those will be considered part of it." - (save-excursion - (save-match-data - (catch 'found - (goto-char (1+ start)) - (if (zerop (skip-chars-forward "A-Za-z@")) - (forward-char) - (skip-chars-forward "*")) - (while (not (eobp)) - (cond - ;; Skip over pairs of square brackets - ((or (looking-at "[ \t]*\n?\\(\\[\\)") ; Be conservative: Consider - ; only consecutive lines. - (and (looking-at (concat "[ \t]*" TeX-comment-start-regexp)) - (save-excursion - (forward-line 1) - (looking-at "[ \t]*\\(\\[\\)")))) - (goto-char (match-beginning 1)) - (condition-case nil - (forward-sexp) - (scan-error (throw 'found (point))))) - ;; Skip over pairs of curly braces - ((or (looking-at "[ \t]*\n?{") ; Be conservative: Consider - ; only consecutive lines. - (and (looking-at (concat "[ \t]*" TeX-comment-start-regexp)) - (save-excursion - (forward-line 1) - (looking-at "[ \t]*{")))) - (goto-char (match-end 0)) - (goto-char (or (TeX-find-closing-brace) - ;; If we cannot find a regular end, use the - ;; next whitespace. - (save-excursion (skip-chars-forward "^ \t\n") - (point)))) - (when (eobp) (throw 'found (point)))) - (t - (throw 'found (point))))))))) - -(defun TeX-find-macro-start (&optional limit) - "Return the start of a macro. -If LIMIT is given, do not search backward further than this point -in buffer. Arguments enclosed in brackets or braces are -considered part of the macro." - (car (TeX-find-macro-boundaries limit))) - -(defun TeX-find-macro-end () - "Return the end of a macro. -Arguments enclosed in brackets or braces are considered part of -the macro." - (cdr (TeX-find-macro-boundaries))) - -(defun TeX-search-forward-unescaped (string &optional bound noerror) - "Search forward from point for unescaped STRING. -The optional argument BOUND limits the search to the respective -buffer position. -If NOERROR is non-nil, return nil if the search failed instead of -throwing an error. -A pattern is escaped, if it is preceded by an odd number of escape -characters." - (TeX-search-unescaped string 'forward nil bound noerror)) - -(defun TeX-search-backward-unescaped (string &optional bound noerror) - "Search backward from point for unescaped STRING. -The optional argument BOUND limits the search to the respective -buffer position. -If NOERROR is non-nil, return nil if the search failed instead of -throwing an error. -A pattern is escaped, if it is preceded by an odd number of escape -characters." - (TeX-search-unescaped string 'backward nil bound noerror)) - -(defun TeX-re-search-forward-unescaped (regexp &optional bound noerror) - "Search forward from point for unescaped regular expression REGEXP. -The optional argument BOUND limits the search to the respective -buffer position. -If NOERROR is non-nil, return nil if the search failed instead of -throwing an error. -A pattern is escaped, if it is preceded by an odd number of escape -characters." - (TeX-search-unescaped regexp 'forward t bound noerror)) - -(defun TeX-search-unescaped (pattern - &optional direction regexp-flag bound noerror) - "Search for unescaped PATTERN in a certain DIRECTION. -DIRECTION can be indicated by the symbols 'forward and 'backward. -If DIRECTION is omitted, a forward search is carried out. -If REGEXP-FLAG is non-nil, PATTERN may be a regular expression, -otherwise a string. -The optional argument BOUND limits the search to the respective -buffer position. -If NOERROR is non-nil, return nil if the search failed instead of -throwing an error. -A pattern is escaped, if it is preceded by an odd number of escape -characters." - (let ((search-fun (if (eq direction 'backward) - (if regexp-flag 're-search-backward 'search-backward) - (if regexp-flag 're-search-forward 'search-forward)))) - (catch 'found - (while (funcall search-fun pattern bound noerror) - (when (not (TeX-escaped-p (match-beginning 0))) - (throw 'found (point))))))) - -(defun TeX-escaped-p (&optional pos) - "Return t if the character at position POS is escaped. -If POS is omitted, examine the character at point. -A character is escaped if it is preceded by an odd number of -escape characters, such as \"\\\" in LaTeX." - (save-excursion - (when pos (goto-char pos)) - (not (zerop (mod (skip-chars-backward (regexp-quote TeX-esc)) 2))))) - -(defun TeX-current-macro () - "Return the name of the macro containing point, nil if there is none." - (let ((macro-start (TeX-find-macro-start))) - (when macro-start - (save-excursion - (goto-char macro-start) - (forward-char (length TeX-esc)) - (buffer-substring-no-properties - (point) (progn (skip-chars-forward "@A-Za-z") (point))))))) - -(defvar TeX-search-forward-comment-start-function nil - "Function to find the start of a comment. -The function should accept an optional argument for specifying -the limit of the search. It should return the position just -before the comment if one is found and nil otherwise. Point -should not be moved.") -(make-variable-buffer-local 'TeX-search-forward-comment-start-function) - -(defun TeX-search-forward-comment-start (&optional limit) - "Search forward for a comment start from current position till LIMIT. -If LIMIT is omitted, search till the end of the buffer. - -The search relies on `TeX-comment-start-regexp' being set -correctly for the current mode. - -Set `TeX-search-forward-comment-start-defun' in order to override -the default implementation." - (if TeX-search-forward-comment-start-function - (funcall TeX-search-forward-comment-start-function limit) - (setq limit (or limit (point-max))) - (when (TeX-re-search-forward-unescaped TeX-comment-start-regexp limit t) - (match-beginning 0)))) - -;;; Fonts - -(defcustom TeX-font-list '((?\C-b "{\\bf " "}") - (?\C-c "{\\sc " "}") - (?\C-e "{\\em " "\\/}") - (?\C-i "{\\it " "\\/}") - (?\C-r "{\\rm " "}") - (?\C-s "{\\sl " "\\/}") - (?\C-t "{\\tt " "}") - (?\C-d "" "" t)) - "List of fonts used by `TeX-font'. - -Each entry is a list. -The first element is the key to activate the font. -The second element is the string to insert before point, and the third -element is the string to insert after point. -If the fourth and fifth element are strings, they specify the prefix and -suffix to be used in math mode. -An optional fourth (or sixth) element means always replace if t." - :group 'TeX-macro - :type '(repeat - (group - :value (?\C-a "" "") - (character :tag "Key") - (string :tag "Prefix") - (string :tag "Suffix") - (option (group - :inline t - (string :tag "Math Prefix") - (string :tag "Math Suffix"))) - (option (sexp :format "Replace\n" :value t))))) - -(defvar TeX-font-replace-function 'TeX-font-replace - "Determines the function which is called when a font should be replaced.") - -(defun TeX-describe-font-entry (entry) - "A textual description of an ENTRY in `TeX-font-list'." - (concat (format "%16s " (key-description (char-to-string (nth 0 entry)))) - (if (or (eq t (nth 3 entry)) (eq t (nth 5 entry))) - "-- delete font" - (format "%14s %-3s %14s %-3s" - (nth 1 entry) (nth 2 entry) - (if (stringp (nth 3 entry)) (nth 3 entry) "") - (if (stringp (nth 4 entry)) (nth 4 entry) ""))))) - -(defun TeX-font (replace what) - "Insert template for font change command. -If REPLACE is not nil, replace current font. WHAT determines the font -to use, as specified by `TeX-font-list'." - (interactive "*P\nc") - (TeX-update-style) - (let* ((entry (assoc what TeX-font-list)) - (in-math (texmathp)) - (before (nth 1 entry)) - (after (nth 2 entry))) - (setq replace (or replace (eq t (nth 3 entry)) (eq t (nth 5 entry)))) - (if (and in-math (stringp (nth 3 entry))) - (setq before (nth 3 entry) - after (nth 4 entry))) - (cond ((null entry) - (let ((help (concat - "Font list: " - "KEY TEXTFONT MATHFONT\n\n" - (mapconcat 'TeX-describe-font-entry - TeX-font-list "\n")))) - (with-output-to-temp-buffer "*Help*" - (set-buffer "*Help*") - (insert help)))) - (replace - (funcall TeX-font-replace-function before after)) - ((TeX-active-mark) - (save-excursion - (cond ((> (mark) (point)) - (insert before) - (goto-char (mark)) - (insert after)) - (t - (insert after) - (goto-char (mark)) - (insert before))))) - (t - (insert before) - (save-excursion - (insert after)))))) - -(defun TeX-font-replace (start end) - "Replace font specification around point with START and END. -For modes with font specifications like `{\\font text}'. -See also `TeX-font-replace-macro' and `TeX-font-replace-function'." - (save-excursion - (while (not (looking-at "{\\\\[a-zA-Z]+ ")) - (up-list -1)) - (forward-sexp) - (save-excursion - (replace-match start t t)) - (if (save-excursion - (backward-char 3) - (if (looking-at (regexp-quote "\\/}")) - (progn - (delete-char 3) - nil) - t)) - (delete-backward-char 1)) - (insert end))) - -(defun TeX-font-replace-macro (start end) - "Replace font specification around point with START and END. -For modes with font specifications like `\\font{text}'. -See also `TeX-font-replace' and `TeX-font-replace-function'." - (let ((font-list TeX-font-list) - cmds strings regexp) - (while font-list - (setq strings (cdr (car font-list)) - font-list (cdr font-list)) - (and (stringp (car strings)) (null (string= (car strings) "")) - (setq cmds (cons (car strings) cmds))) - (setq strings (cdr (cdr strings))) - (and (stringp (car strings)) (null (string= (car strings) "")) - (setq cmds (cons (car strings) cmds)))) - (setq regexp (mapconcat 'regexp-quote cmds "\\|")) - (save-excursion - (catch 'done - (while t - (if (/= ?\\ (following-char)) - (skip-chars-backward "a-zA-Z ")) - (skip-chars-backward (regexp-quote TeX-esc)) - (if (looking-at regexp) - (throw 'done t) - (up-list -1)))) - ;; Use stripped syntax table in order to get stuff like "\emph{(}" right. - (with-syntax-table (TeX-search-syntax-table ?\{ ?\}) - (forward-sexp 2)) - (save-excursion - (replace-match start t t)) - (delete-backward-char 1) - (insert end)))) - -;;; Dollars -;; -;; Rewritten from scratch with use of `texmathp' by -;; Carsten Dominik - -(defvar TeX-symbol-marker nil) - -(defvar TeX-symbol-marker-pos 0) - -;; The following constants are no longer used, but kept in case some -;; foreign code uses any of them. -(defvar TeX-dollar-sign ?$ - "*Character used to enter and leave math mode in TeX.") -(defconst TeX-dollar-string (char-to-string TeX-dollar-sign)) -(defconst TeX-dollar-regexp - (concat "^" (regexp-quote TeX-dollar-string) "\\|[^" TeX-esc "]" - (regexp-quote TeX-dollar-string))) - -(defcustom TeX-math-toggle-off-input-method t - "*If non-nil, auto toggle off CJK input methods when entering math mode." - :group 'TeX-macro - :type 'boolean) - -(defcustom TeX-math-close-double-dollar nil - "If non-nil close double dollar math by typing a single `$'." - :group 'TeX-macro - :type 'boolean) - -(defun TeX-insert-dollar (&optional arg) - "Insert dollar sign. - -If current math mode was not entered with a dollar, refuse to -insert one. Show matching dollar sign if this dollar sign ends -the TeX math mode and `blink-matching-paren' is non-nil. Ensure -double dollar signs match up correctly by inserting extra dollar -signs when needed. - -With raw \\[universal-argument] prefix, insert exactly one dollar -sign. With optional ARG, insert that many dollar signs." - (interactive "P") - (cond - ((and arg (listp arg)) - ;; C-u always inserts one - (insert "$")) - (arg - ;; Numerical arg inserts that many - (insert (make-string (prefix-numeric-value arg) ?\$))) - ((TeX-escaped-p) - ;; This is escaped with `\', so just insert one. - (insert "$")) - ((texmathp) - ;; We are inside math mode - (if (and (stringp (car texmathp-why)) - (string-equal (substring (car texmathp-why) 0 1) "\$")) - ;; Math mode was turned on with $ or $$ - so finish it accordingly. - (progn - (if TeX-math-close-double-dollar - (insert (car texmathp-why)) - (insert "$")) - (when (and blink-matching-paren - (or (string= (car texmathp-why) "$") - (zerop (mod (save-excursion - (skip-chars-backward "$")) 2)))) - (save-excursion - (goto-char (cdr texmathp-why)) - (if (pos-visible-in-window-p) - (sit-for 1) - (message "Matches %s" - (buffer-substring - (point) (progn (end-of-line) (point)))))))) - ;; Math mode was not entered with dollar - we cannot finish it with one. - (message "Math mode started with `%s' cannot be closed with dollar" - (car texmathp-why)) - (insert "$"))) - (t - ;; Just somewhere in the text. - (insert "$"))) - (TeX-math-input-method-off)) - -(defvar TeX-math-input-method-off-regexp - "^\\(chinese\\|japanese\\|korean\\bulgarian\\russian\\)" - "Regexp matching input methods to be deactivated when entering math mode.") - -(defun TeX-math-input-method-off () - "Toggle off input method when entering math mode." - (and TeX-math-toggle-off-input-method - (texmathp) - (boundp 'current-input-method) current-input-method - (string-match TeX-math-input-method-off-regexp current-input-method) - (inactivate-input-method))) - -;;; Simple Commands - -(defun TeX-normal-mode (arg) - "Remove all information about this buffer, and apply the style hooks again. -Save buffer first including style information. -With optional argument ARG, also reload the style hooks." - ;; FIXME: Shouldn't it be (&optional arg)? -- rs - (interactive "*P") - (if arg - (setq TeX-style-hook-list nil - BibTeX-global-style-files nil - BibTeX-global-files nil - TeX-global-input-files nil)) - (let ((TeX-auto-save t)) - (if (buffer-modified-p) - (save-buffer) - (TeX-auto-write))) - (normal-mode) - ;; See also addition to `find-file-hooks' in `VirTeX-common-initialization'. - (when (eq TeX-master 'shared) (TeX-master-file nil nil t)) - (TeX-update-style t)) - -(defgroup TeX-quote nil - "Quoting in AUCTeX." - :group 'AUCTeX) - -(defcustom TeX-open-quote "``" - "String inserted by typing \\[TeX-insert-quote] to open a quotation." - :group 'TeX-quote - :type 'string) - -(defcustom TeX-close-quote "''" - "String inserted by typing \\[TeX-insert-quote] to close a quotation." - :group 'TeX-quote - :type 'string) - -(defcustom TeX-quote-after-quote nil - "Behaviour of \\[TeX-insert-quote]. -Nil means standard behaviour; when non-nil, opening and closing -quotes are inserted only after \"." - :group 'TeX-quote - :type 'boolean) - -(defcustom TeX-quote-language-alist nil - "Alist for overriding the default language-specific quote insertion. -First element in each item is the name of the language as set by -the language style file as a string. Second element is the -opening quotation mark. Third elemxent is the closing quotation -mark. Opening and closing quotation marks can be specified -directly as strings or as functions returning a string. Fourth -element is a boolean specifying insertion behavior, overriding -`TeX-quote-after-quote'. See Info node `(auctex)European' for -valid languages." - :group 'TeX-quote - :link '(custom-manual "(auctex)European") - :type '(repeat (group (choice - (const "czech") - (const "danish") - (const "dutch") - (const "german") - (const "ngerman") - (const "french") ;; not frenchb or francais - (const "italian") - (const "polish") - (const "slovak") - (const "swedish") - (string :tag "Other Language")) - (choice :tag "Opening quotation mark" string function) - (choice :tag "Closing quotation mark" string function) - (boolean :tag "Insert plain quote first" :value t)))) - -(defvar TeX-quote-language nil - "If non-nil determines behavior of quote insertion. -It is usually set by language-related style files. Its value has -the same structure as the elements of `TeX-quote-language-alist'. -The symbol 'override can be used as its car in order to override -the settings of style files. Style files should therefore check -if this symbol is present and not alter `TeX-quote-language' if -it is.") -(make-variable-buffer-local 'TeX-quote-language) - -(defun TeX-insert-quote (force) - "Insert the appropriate quotation marks for TeX. -Inserts the value of `TeX-open-quote' (normally ``) or `TeX-close-quote' -\(normally '') depending on the context. If `TeX-quote-after-quote' -is non-nil, this insertion works only after \". -With prefix argument FORCE, always inserts \" characters." - (interactive "*P") - (if (or force - ;; Do not insert TeX quotes in verbatim, math or comment constructs. - (and (fboundp 'font-latex-faces-present-p) - (font-latex-faces-present-p '(font-latex-verbatim-face - font-latex-math-face - font-lock-comment-face)) - (font-latex-faces-present-p '(font-latex-verbatim-face - font-latex-math-face - font-lock-comment-face) - (1- (point)))) - (texmathp) - (and (TeX-in-comment) (not (eq major-mode 'doctex-mode)))) - (self-insert-command (prefix-numeric-value force)) - (TeX-update-style) - (let* ((lang-override (if (eq (car TeX-quote-language) 'override) - TeX-quote-language - (assoc (car TeX-quote-language) - TeX-quote-language-alist))) - (lang (or lang-override TeX-quote-language)) - (open-quote (if lang (nth 1 lang) TeX-open-quote)) - (close-quote (if lang (nth 2 lang) TeX-close-quote)) - (q-after-q (if lang (nth 3 lang) TeX-quote-after-quote))) - (when (functionp open-quote) - (setq open-quote (funcall open-quote))) - (when (functionp close-quote) - (setq close-quote (funcall close-quote))) - (if q-after-q - (insert (cond ((bobp) - ?\") - ((save-excursion - (TeX-looking-at-backward - (concat (regexp-quote open-quote) "\\|" - (regexp-quote close-quote)) - (max (length open-quote) (length close-quote)))) - (delete-backward-char (length (match-string 0))) - "\"\"") - ((< (save-excursion (skip-chars-backward "\"")) -1) - ?\") - ((not (= (preceding-char) ?\")) - ?\") - ((save-excursion - (forward-char -1) - (bobp)) - (delete-backward-char 1) - open-quote) - ((save-excursion - (forward-char -2) ;;; at -1 there is double quote - (looking-at "[ \t\n]\\|\\s(")) - (delete-backward-char 1) - open-quote) - (t - (delete-backward-char 1) - close-quote))) - (insert (cond ((bobp) - open-quote) - ((= (preceding-char) (string-to-char TeX-esc)) - ?\") - ((= (preceding-char) ?\") - ?\") - ((save-excursion - (forward-char (- (length open-quote))) - (looking-at (regexp-quote open-quote))) - (delete-backward-char (length open-quote)) - ?\") - ((save-excursion - (forward-char (- (length close-quote))) - (looking-at (regexp-quote close-quote))) - (delete-backward-char (length close-quote)) - ?\") - ((save-excursion - (forward-char -1) - (looking-at "[ \t\n]\\|\\s(")) - open-quote) - (t - close-quote))))))) - -(defun TeX-insert-punctuation () - "Insert point or comma, cleaning up preceding space." - (interactive) - (expand-abbrev) - (if (TeX-looking-at-backward "\\\\/\\(}+\\)" 50) - (replace-match "\\1" t)) - (call-interactively 'self-insert-command)) - -(defun TeX-insert-braces (arg) - "Make a pair of braces around next ARG sexps and leave point inside. -No argument is equivalent to zero: just insert braces and leave point -between. - -If there is an active region, ARG will be ignored, braces will be -inserted around the region, and point will be left after the -closing brace." - (interactive "P") - (if (TeX-active-mark) - (progn - (if (< (point) (mark)) - (exchange-point-and-mark)) - (insert TeX-grcl) - (save-excursion - (goto-char (mark)) - (insert TeX-grop))) - (insert TeX-grop) - (save-excursion - (if arg (forward-sexp (prefix-numeric-value arg))) - (insert TeX-grcl)))) - -;;;###autoload -(defun TeX-submit-bug-report () - "Submit a bug report on AUCTeX via mail. - -Don't hesitate to report any problems or inaccurate documentation. - -If you don't have setup sending mail from (X)Emacs, please copy the -output buffer into your mail program, as it gives us important -information about your AUCTeX version and AUCTeX configuration." - (interactive) - (require 'reporter) - (let ((reporter-prompt-for-summary-p "Bug report subject: ")) - (reporter-submit-bug-report - "bug-auctex@gnu.org" - AUCTeX-version - (list 'AUCTeX-date - 'window-system - 'LaTeX-version - 'TeX-style-path - 'TeX-auto-save - 'TeX-parse-self - 'TeX-master - 'TeX-command-list) - nil nil - "Remember to cover the basics, that is, what you expected to happen and -what in fact did happen. - -Be sure to consult the FAQ section in the manual before submitting -a bug report. In addition check if the bug is reproducable with an -up-to-date version of AUCTeX. So please upgrade to the version -available from http://www.gnu.org/software/auctex/ if your -installation is older than the one available from the web site. - -If the bug is triggered by a specific \(La\)TeX file, you should try -to produce a minimal sample file showing the problem and include it -in your report. - -Your bug report will be posted to the AUCTeX bug reporting list. -------------------------------------------------------------------------"))) - - -;;; Documentation - -(defun TeX-goto-info-page () - "Read documentation for AUCTeX in the info system." - (interactive) - (info "auctex")) - -(autoload 'info-lookup->completions "info-look") - -(defvar TeX-doc-backend-alist - '((texdoc (plain-tex-mode latex-mode doctex-mode ams-tex-mode context-mode) - (lambda () - (when (executable-find "texdoc") - (TeX-search-files - ;; Explicitely supply doc directory for - ;; non-kpathsea-based TeX systems. - (unless (stringp TeX-kpathsea-path-delimiter) - (or (TeX-tree-expand - '("$SYSTEXMF" "$TEXMFLOCAL" "$TEXMFMAIN" "$TEXMFDIST") - "latex" '("/doc/")) - `(,@TeX-macro-global ,@TeX-macro-private))) - '("dvi" "pdf" "ps" "txt" "html") t t))) - (lambda (doc) - ;; texdoc in MiKTeX requires --view in order to start - ;; the viewer instead of an intermediate web page. - (call-process "texdoc" nil 0 nil "--view" doc))) - (latex-info (latex-mode) - (lambda () - (when (condition-case nil - (save-window-excursion - (let ((buf (generate-new-buffer-name "*info*"))) - (info "latex" buf) - (kill-buffer buf)) - t) - (error nil)) - (mapcar (lambda (x) - (let ((x (car x))) - (if (string-match "\\`\\\\" x) - (substring x 1) x))) - (info-lookup->completions 'symbol 'latex-mode)))) - (lambda (doc) - (info-lookup-symbol (concat "\\" doc) 'latex-mode))) - (texinfo-info (texinfo-mode) - (lambda () - (when (condition-case nil - (save-window-excursion - (let ((buf (generate-new-buffer-name "*info*"))) - (info "texinfo" buf) - (kill-buffer buf)) - t) - (error nil)) - (mapcar (lambda (x) - (let ((x (car x))) - (if (string-match "\\`@" x) - (substring x 1) x))) - (info-lookup->completions 'symbol - 'texinfo-mode)))) - (lambda (doc) - (info-lookup-symbol (concat "@" doc) 'texinfo-mode)))) - "Alist of backends used for looking up documentation. -Each item consists of four elements. - -The first is a symbol describing the backend's name. - -The second is a list of modes the backend should be activated in. - -The third is a function returning a list of documents available -to the backend. It should return nil if the backend is not -available, e.g. if a required executable is not present on the -system in question. - -The fourth is a function for displaying the documentation. The -function should accept a single argument, the chosen package, -command, or document name.") - -(defun TeX-doc (&optional name) - "Display documentation for string NAME. -NAME may be a package, a command, or a document." - (interactive) - (let (docs) - ;; Build the lists of available documentation used for completion. - (dolist (elt TeX-doc-backend-alist) - (when (memq major-mode (nth 1 elt)) - (let ((completions (funcall (nth 2 elt)))) - (unless (null completions) - (add-to-list 'docs (cons completions (nth 0 elt))))))) - (if (null docs) - (progn - (if (executable-find "texdoc") - ;; Fallback if we did not find anything via the backend list. - (let ((doc (read-from-minibuffer "Input for `texdoc': "))) - (when doc (call-process "texdoc" nil 0 nil "--view" doc))) - ;; Give up. - (message "No documentation found"))) - ;; Ask the user about the package, command, or document. - (when (and (interactive-p) - (or (not name) (string= name ""))) - (let ((symbol (thing-at-point 'symbol)) - contained completions doc) - ;; Is the symbol at point contained in the lists of available - ;; documentation? - (setq contained (catch 'found - (dolist (elt docs) - (when (member symbol (car elt)) - (throw 'found t))))) - ;; Setup completion list in a format suitable for `completing-read'. - (dolist (elt docs) - (setq completions (nconc (mapcar 'list (car elt)) completions))) - ;; Query user. - (setq doc (completing-read - (if contained - (format "Package, command, or document (default %s): " - symbol) - "Package, command, or document: ") - completions)) - (setq name (if (string= doc "") symbol doc)))) - (if (not name) - (message "No documentation specified") - ;; XXX: Provide way to choose in case a symbol can be found in - ;; more than one backend. - (let* ((backend (catch 'found - (dolist (elt docs) - (when (member name (car elt)) - (throw 'found (cdr elt))))))) - (if backend - (funcall (nth 3 (assoc backend TeX-doc-backend-alist)) name) - (message "Documentation not found"))))))) - - -;;; Ispell Support - -;; FIXME: Document those functions and variables. -- rs - -;; The FSF ispell.el use this. -(defun ispell-tex-buffer-p () - (and (boundp 'ispell-tex-p) ispell-tex-p)) - -;; The FSF ispell.el might one day use this. -(setq ispell-enable-tex-parser t) - -(defun TeX-run-ispell (command string file) - "Run ispell on current TeX buffer." - (cond ((and (string-equal file (TeX-region-file)) - (fboundp 'ispell-region)) - (call-interactively 'ispell-region)) - ((string-equal file (TeX-region-file)) - (call-interactively 'spell-region)) - ((fboundp 'ispell-buffer) - (ispell-buffer)) - ((fboundp 'ispell) - (ispell)) - (t - (spell-buffer)))) - -(defun TeX-ispell-document (name) - "Run ispell on all open files belonging to the current document." - (interactive (list (TeX-master-file))) - (if (string-equal name "") - (setq name (TeX-master-file))) - - (let ((found nil) - (regexp (concat "\\`\\(" - (mapconcat (lambda (dir) - (regexp-quote - (expand-file-name - (file-name-as-directory dir)))) - (append (when (file-name-directory name) - (list (file-name-directory name))) - TeX-check-path) - "\\|") - "\\).*\\(" - (mapconcat 'regexp-quote - (cons (file-name-nondirectory name) - (TeX-style-list)) "\\|") - "\\)\\.\\(" - (mapconcat 'regexp-quote TeX-file-extensions "\\|") - "\\)\\'")) - (buffers (buffer-list))) - (while buffers - (let* ((buffer (car buffers)) - (name (buffer-file-name buffer))) - (setq buffers (cdr buffers)) - (if (and name (string-match regexp name)) - (progn - (save-excursion (switch-to-buffer buffer) (ispell-buffer)) - (setq found t))))))) - -;; Some versions of ispell 3 use this. -(defvar ispell-tex-major-modes nil) -(setq ispell-tex-major-modes - (append '(plain-tex-mode ams-tex-mode latex-mode doctex-mode) - ispell-tex-major-modes)) - - -;;; Special provisions for other modes and libraries - -;; desktop-locals-to-save is broken by design. Don't have -;; buffer-local values of it. -(eval-after-load "desktop" - '(progn - (dolist (elt '(TeX-master)) - (unless (member elt (default-value 'desktop-locals-to-save)) - (setq-default desktop-locals-to-save - (cons elt (default-value 'desktop-locals-to-save))))) - (add-hook 'desktop-after-read-hook '(lambda () - (TeX-set-mode-name t))))) - -;; delsel.el, `delete-selection-mode' -(put 'TeX-newline 'delete-selection t) -(put 'TeX-insert-dollar 'delete-selection t) -(put 'TeX-insert-quote 'delete-selection t) -(put 'TeX-insert-backslash 'delete-selection t) - -(provide 'tex) - -;; Local Variables: -;; coding: iso-8859-1 -;; End: - -;;; tex.el ends here diff --git a/packages/auctex/texmathp.el b/packages/auctex/texmathp.el deleted file mode 100644 index b7bb7f467..000000000 --- a/packages/auctex/texmathp.el +++ /dev/null @@ -1,411 +0,0 @@ -;;; texmathp.el -- Code to check if point is inside LaTeX math environment - -;; Copyright (C) 1998, 2004 Free Software Foundation, Inc. - -;; Author: Carsten Dominik -;; Maintainer: auctex-devel@gnu.org -;; Keywords: tex - -;; This file is part of AUCTeX. - -;; AUCTeX is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; AUCTeX is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with AUCTeX; see the file COPYING. If not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -;; 02110-1301, USA. - -;;; Commentary: -;; -;; This code provides a function to determine if point in a buffer is -;; inside a (La)TeX math environment. This is not trivial since many -;; different ways are used to switch between the two. Examples: -;; -;; \begin{equation} ... \end{equation} -;; $ ... $ -;; $$ ... $$ -;; \[ ... \] -;; \ensuremath{...} -;; \mbox{...} -;; -;; To install, put this file on your load-path and compile it. -;; -;; To use this in a Lisp program, do -;; -;; (require 'texmathp) -;; -;; You can then write code like this: -;; -;; (if (texmathp) ...) -;; -;; The call to `texmathp' leaves some extra information in the -;; variable `texmathp-why'. It's value is a cons cell (MATCH . POSITION), -;; specifying which command at what position is responsible for math -;; mode being on or off. -;; -;; To configure which macros and environments influence LaTeX math mode, -;; customize the variable `texmathp-tex-commands'. By default -;; it recognizes the LaTeX core as well as AMS-LaTeX (see the variable -;; `texmathp-tex-commands-default', also as an example). -;; -;; To try out the code interactively, use `M-x texmathp RET'. -;; -;; Of course, in order to work this function has to assume that the -;; LaTeX above point is syntactically correct. In particular: -;; -;; o The different math delimiters are paired correctly. Thus if -;; you do things like "\begin{equation} $" or "\[ ... \)" -;; the result of (texmathp) is undefined. It is in fact possible -;; in LaTeX to pair \[ with $$ and \( with $, but this will confuse -;; texmathp (and human readers as well). -;; -;; o However, texmathp will correctly work with nested delimiters. -;; Something like the following will be parsed correctly at any point: -;; -;; \begin{equation} -;; x = y \mbox{abc \ensuremath{\alpha} cba $2^3$} -;; \end{equation} -;; -;; o texmathp is somewhat forgiving if you have an empty line inside -;; the current math environment, which is not legal in TeX but may -;; easily happen during editing. Depending upon the variable -;; `texmathp-search-n-paragraphs' several paragraphs are checked -;; backwards, by default 2. Paragraph here means something limited -;; by an empty line. -;;-------------------------------------------------------------------------- -;; -;; BUGS: -;; -;; If any of the the special macros like \mbox or \ensuremath has optional -;; arguments, math mode inside these optional arguments is *not* influenced -;; by the macro. -;;-------------------------------------------------------------------------- - -;;; Code: - -(defgroup texmathp nil - "Testing TeX and LaTeX documents for math mode." - :tag "Test For TeX and LaTeX Math Mode" - :prefix "texmathp-" - :group 'tex) - -;; Some internal variables which are computed from `texmathp-tex-commands' -;; and `texmathp-tex-commands-default'. -(defvar texmathp-environments nil) -(defvar texmathp-macros nil) -(defvar texmathp-onoff-regexp nil) -(defvar texmathp-toggle-regexp nil) -(defvar texmathp-tex-commands1 nil) -(defvar texmathp-memory nil) - -(defvar texmathp-tex-commands) ; silence the compiler - -(defvar texmathp-tex-commands-default - '(;; Plain TeX - ("$$" sw-toggle) ("$" sw-toggle) - ("\\hbox" arg-off) - ("\\vbox" arg-off) - ("\\vtop" arg-off) - ("\\vcenter" arg-off) - - ;; Standard LaTeX - ("equation" env-on) ("equation*" env-on) - ("eqnarray" env-on) ("eqnarray*" env-on) - ("math" env-on) - ("displaymath" env-on) - ("minipage" env-off) - ("\\fbox" arg-off) - ("\\mbox" arg-off) - ("\\framebox" arg-off) - ("\\label" arg-off) - ("\\textrm" arg-off) - ("\\(" sw-on) ("\\)" sw-off) - ("\\[" sw-on) ("\\]" sw-off) - ("\\ensuremath" arg-on) - - ;; AMS-LaTeX - ("align" env-on) ("align*" env-on) - ("gather" env-on) ("gather*" env-on) - ("multline" env-on) ("multline*" env-on) - ("flalign" env-on) ("flalign*" env-on) - ("alignat" env-on) ("alignat*" env-on) - ("xalignat" env-on) ("xalignat*" env-on) - ("xxalignat" env-on) ("\\boxed" arg-on) - ("\\text" arg-off) ("\\intertext" arg-off)) - "The default entries for `texmathp-tex-commands', which see.") - -(defun texmathp-compile () - "Compile the value of `texmathp-tex-commands' into the internal lists. -Call this when you have changed the value of that variable without using -customize (customize calls it when setting the variable)." - (interactive) - ;; Extract lists and regexp. - (setq texmathp-macros nil texmathp-environments nil) - (setq texmathp-memory - (cons texmathp-tex-commands texmathp-tex-commands-default)) - (setq texmathp-tex-commands1 (append texmathp-tex-commands - texmathp-tex-commands-default)) - (let ((list (reverse texmathp-tex-commands1)) - var entry type switches togglers) - (while (setq entry (car list)) - (setq type (nth 1 entry) - list (cdr list) - var (cond ((memq type '(env-on env-off)) 'texmathp-environments) - ((memq type '(arg-on arg-off)) 'texmathp-macros) - ((memq type '(sw-on sw-off)) 'switches) - ((memq type '(sw-toggle)) 'togglers))) - (set var (cons (car entry) (symbol-value var)))) - (setq texmathp-onoff-regexp - (concat "[^\\\\]\\(" - (mapconcat 'regexp-quote switches "\\|") - "\\)") - texmathp-toggle-regexp - (concat "\\([^\\\\\\$]\\|\\`\\)\\(" - (mapconcat 'regexp-quote togglers "\\|") - "\\)")))) - -(defcustom texmathp-tex-commands nil - "List of environments and macros influencing (La)TeX math mode. -This user-defined list is used in addition to LaTeX and AMSLaTeX defaults. -The structure of each entry is (NAME TYPE) - -- The first item in each entry is the name of an environment or macro. - If it's a macro, include the backslash. - -- The second item is a symbol indicating how the command works: - `env-on' Environment: turns math mode for its body on - `env-off' Environment: turns math mode for its body off - `arg-on' Command: turns math mode for its arguments on - `arg-off' Command: turns math mode for its arguments off - `sw-on' Switch: turns math-mode of following text on - `sw-off' Switch: turns math-mode of following text off - `sw-toggle' Switch: toggles math mode of following text" - :group 'texmathp - :set '(lambda (symbol value) (set-default symbol value) (texmathp-compile)) - :type - '(repeat - (list :value ("" env-on) - (string :tag "Name") - (choice :tag "Type" - (const :tag "Environment: turns math mode for its body on" env-on) - (const :tag "Environment: turns math mode for its body off" env-off) - (const :tag "Command: turns math mode for its argument on" arg-on) - (const :tag "Command: turns math-mode for its argument off" arg-off) - (const :tag "Switch: turns math-mode of following text on" sw-on) - (const :tag "Switch: turns math-mode of following text off" sw-off) - (const :tag "Switch: toggles math mode of following text" sw-toggle))))) - -(defcustom texmathp-search-n-paragraphs 2 - "*Number of paragraphs to check before point. -Normally, you cannot have an empty line in a math environment in (La)TeX. -The fastest method to test for math mode is then limiting the search -backward to the nearest empty line. -However, during editing it happens that such lines exist temporarily. -Therefore we look a little further. This variable determines how many -empty lines we go back to fix the search limit." - :group 'texmathp - :type 'number) - -(defcustom texmathp-allow-detached-args nil - "*Non-nil means, allow arguments of macros to be detached by whitespace. -When this is t, `aaa' will be interpreted as an argument of \bb in the -following construct: \bbb [xxx] {aaa} -This is legal in TeX. The disadvantage is that any number of braces expressions -will be considered arguments of the macro independent of its definition." - :group 'texmathp - :type 'boolean) - -(defvar texmathp-why nil - "After a call to `texmathp' this variable shows why math-mode is on or off. -The value is a cons cell (MATCH . POSITION). -MATCH is a string like a car of an entry in `texmathp-tex-commands', e.q. -\"equation\" or \"\\ensuremath\" or \"\\[\" or \"$\". -POSITION is the buffer position of the match. If there was no match, -it points to the limit used for searches, usually two paragraphs up.") - -;; We need our own syntax table to play with the syntax of () [] and {} -;; For speed reasons we define it statically instead of copying it each time. -(defvar texmathp-syntax-table - (let ((table (make-syntax-table))) - (mapc (lambda (x) (modify-syntax-entry (car x) (cdr x) table)) - '((?\\ . "\\") (?\f .">") (?\n . ">") (?% . "<") - (?\[ . ".") (?\] . ".") (?\{ . "(}") (?\} . "){") - (?\( . ".") (?\) . ".") (?\" . ".") (?& . ".") (?_ . ".") - (?@ . "_") (?~ . " ") (?$ . "$") (?' . "w"))) - table) - "Syntax table used while texmathp is parsing.") - -;;;###autoload -(defun texmathp () - "Determine if point is inside (La)TeX math mode. -Returns t or nil. Additional info is placed into `texmathp-why'. -The functions assumes that you have (almost) syntactically correct (La)TeX in -the buffer. -See the variable `texmathp-tex-commands' about which commands are checked." - (interactive) - (let* ((pos (point)) math-on sw-match - (bound (save-excursion - (if (re-search-backward "[\n\t][ \t]*[\n\r]" - nil 1 texmathp-search-n-paragraphs) - (match-beginning 0) - (point-min)))) - (mac-match (texmathp-match-macro bound)) - (env-match (texmathp-match-environment - (if (and mac-match (> (cdr mac-match) bound)) - (cdr mac-match) - bound))) - (match (cons nil bound))) - - ;; Select the nearer match - (and env-match (setq match env-match)) - (and mac-match (> (cdr mac-match) (cdr match)) (setq match mac-match)) - (setq math-on (memq (nth 1 (assoc (car match) texmathp-tex-commands1)) - '(env-on arg-on))) - - ;; Check for switches - (and (not math-on) - (setq sw-match (texmathp-match-switch bound)) - (> (cdr sw-match) (cdr match)) - (eq (nth 1 (assoc (car sw-match) texmathp-tex-commands1)) 'sw-on) - (setq match sw-match math-on t)) - - ;; Check for togglers - (if (not math-on) - (save-excursion - (goto-char (cdr match)) - (while (re-search-forward texmathp-toggle-regexp pos t) - (if (setq math-on (not math-on)) - (setq sw-match (cons (match-string 2) (match-beginning 2))) - (setq sw-match nil))) - (and math-on sw-match (setq match sw-match)))) - - ;; Store info, show as message when interactive, and return - (setq texmathp-why match) - (and (interactive-p) - (message "math-mode is %s: %s begins at buffer position %d" - (if math-on "on" "off") - (or (car match) "new paragraph") - (cdr match))) - (and math-on t))) - -(defun texmathp-match-environment (bound) - "Find out if point is inside any of the math environments. -Limit searched to BOUND. The return value is like (\"equation\" . (point))." - (catch 'exit - (save-excursion - (and (null texmathp-environments) (throw 'exit nil)) - ;; Check if the line we are starting with is a commented one. - (let ((orig-comment-flag - ;; Could be replaced by `TeX-in-commented-line'. - (progn - (save-excursion - (beginning-of-line) - (skip-chars-forward " \t") - (string= (buffer-substring-no-properties - (point) (min (point-max) - (+ (point) (length comment-start)))) - comment-start)))) - end-list env) - (while (re-search-backward "\\\\\\(begin\\|end\\)[ \t]*{\\([^}]+\\)}" - bound t) - ;; Check if the match found is inside of a comment. - (let ((current-comment-flag - ;; Could be replaced by `TeX-in-comment'. - (when (save-match-data - (re-search-backward comment-start-skip - (line-beginning-position) t)) - ;; We need a t for comparison with `orig-comment-flag', - ;; not a number. - t))) - ;; Only consider matching alternatives with respect to - ;; "in-commentness", i.e. if we started with a comment - ;; only consider matches which are in comments as well and - ;; vice versa. - (when (eq orig-comment-flag current-comment-flag) - (setq env (buffer-substring-no-properties - (match-beginning 2) (match-end 2))) - (cond ((string= (match-string 1) "end") - (setq end-list (cons env end-list))) - ((equal env (car end-list)) - (setq end-list (cdr end-list))) - ((member env texmathp-environments) - (throw 'exit (cons env (point)))))))) - nil)))) - -(defun texmathp-match-macro (bound) - "Find out if point is within the arguments of any of the Math macros. -Limit searches to BOUND. The return value is like (\"\\macro\" . (point))." - (catch 'exit - (and (null texmathp-macros) (throw 'exit nil)) - (let (pos cmd (syntax-table (syntax-table))) - (unwind-protect - (save-restriction - (save-excursion - (set-syntax-table texmathp-syntax-table) - (narrow-to-region (max 1 bound) (point)) - ;; Move back out of the current parenthesis - (while (condition-case nil (progn (up-list -1) t) (error nil)) - ;; Move back over any touching sexps (in fact also non-touching) - (while - (and - (cond - ((memq (preceding-char) '(?\] ?\}))) - ((and - texmathp-allow-detached-args - (re-search-backward - "[]}][ \t]*[\n\r]?\\([ \t]*%[^\n\r]*[\n\r]\\)*[ \t]*\\=" - bound t)) - (goto-char (1+ (match-beginning 0))) t)) - (if (eq (preceding-char) ?\}) - ;; Jump back over {} - (condition-case nil - (progn (backward-sexp) t) - (error nil)) - ;; Jump back over []. Modify syntax temporarily for this. - (unwind-protect - (progn - (modify-syntax-entry ?\{ ".") - (modify-syntax-entry ?\} ".") - (modify-syntax-entry ?\[ "(]") - (modify-syntax-entry ?\] ")[") - (condition-case nil - (progn (backward-sexp) t) - (error nil))) - (modify-syntax-entry ?\{ "(}") - (modify-syntax-entry ?\} "){") - (modify-syntax-entry ?\[ ".") - (modify-syntax-entry ?\] ".") - nil)))) - (setq pos (point)) - (and (memq (following-char) '(?\[ ?\{)) - (re-search-backward "\\\\[*a-zA-Z]+\\=" nil t) - (setq cmd (buffer-substring-no-properties - (match-beginning 0) (match-end 0))) - (member cmd texmathp-macros) - (throw 'exit (cons cmd (point)))) - (goto-char pos)) - (throw 'exit nil))) - (set-syntax-table syntax-table))))) - -;;;###autoload -(defun texmathp-match-switch (bound) - "Search backward for any of the math switches. -Limit searched to BOUND." - ;; The return value is like ("\\(" . (point)). - (save-excursion - (if (re-search-backward texmathp-onoff-regexp bound t) - (cons (buffer-substring-no-properties (match-beginning 1) (match-end 1)) - (match-beginning 1)) - nil))) - -(provide 'texmathp) - -;;; texmathp.el ends here diff --git a/packages/auctex/toolbar-x.el b/packages/auctex/toolbar-x.el deleted file mode 100644 index ef4edc890..000000000 --- a/packages/auctex/toolbar-x.el +++ /dev/null @@ -1,2154 +0,0 @@ -;;; toolbar-x.el --- fancy toolbar handling in Emacs and XEmacs - -;; Copyright (C) 2004, 2005, 2008 Free Software Foundation, Inc. - -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 3 of -;; the License, or (at your option) any later version. - -;; This program is distributed in the hope that it will be -;; useful, but WITHOUT ANY WARRANTY; without even the implied -;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -;; PURPOSE. See the GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public -;; License along with this program; if not, write to the Free -;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, -;; MA 02110-1301 USA - -;;; Author: Miguel Vinicius Santini Frasson - -;;; Commentary: -;; This program implements a common interface to display toolbar -;; buttons in both Emacs and XEmacs. A toolbar should be basicly -;; defined by a image and a command to run when the button is pressed, -;; and additional properties could be added. This is the idea of this -;; program. See the documentation of function -;; `toolbarx-install-toolbar' for a description of how to specify -;; toolbars. - -;;; Features: - -;; * Button properties are given in the toolbar definition (BUTTON -;; paramenter in `toolbarx-install-toolbar') and/or in an alist with -;; associates the symbol with properties (MEANING-ALIST paramenter in -;; `toolbarx-install-toolbar'). - -;; * Supported properties: -;; - All editors: `:insert', `:image', `:command', `:help', `:enable', -;; `:append-command' and `:prepend-command'; -;; - Emacs only: `:visible' and `:button'; -;; - XEmacs only: `:toolbar'. -;; For the precise value-type for each property, see documentation of -;; the function `toolbarx-install-toolbar'. -;; (ps: properties that are particular to an editor are just ignored -;; the other editor flavour.) - -;; * Button properties may depend on the editor flavour, if the value -;; is a vector; the first element will be used for Emacs and the 2nd -;; for XEmacs. Example: `:image ["new" toolbar-file-icon]' - -;; * Properties can have value specified by function (with no -;; argument) or variables that evaluate to an object of the correct -;; type for a particular property. The evaluation is done when the -;; roolbar is refresh (a call of `toolbarx-refresh'.) -;; (ps: this is valid only for properties that *not* have \`form\' as -;; value type.) - -;; * On `refresh time' (a call `toolbarx-refresh', necessary when the -;; toolbar should change), the `:insert' property (if present) is -;; evaluated to decide if button will be displayed. - -;; Properties can be distributed to several buttons, using \`groups\'. -;; Example: (for (bar baz :toolbar (bottom . top) :insert foo-form) -;; means that `foo', `bar' and `baz' have `:insert foo-form' and `bar' and -;; `baz' have the property `:toolbar (bottom . top)'. (ps: this type -;; of value for the `:toolbar' property (XEmacs only) means that the -;; buttons will be in the bottom toolbar unless the default toolbar is -;; in the bottom, and in this case, this buttons go to the top -;; toolbar). - -;; * (Part of) the toolbar definition can be stored in a variable, -;; evaluated in `installation time'. See `:eval-group' on the -;; documentation of the function `toolbarx-install-toolbar'. - -;; * It is possible to define sets of buttons that appear according to -;; an option selected in a dropdown menu. See `:dropdown-group' on -;; the documentation of the function `toolbarx-install-toolbar'. - -;;; Rough description of the implementation -;; There are 3 \`engines\' implemented: - -;; == the 1st one (parsing) parses the toolbar definition -;; independently of editor flavour and store the parsed buttons with -;; their properties, in the same order that they appear in the -;; definitions, in a variable `toolbarx-internal-button-switches'; - -;; == the 2nd one (refresh for Emacs) inserts buttons in the Emacs -;; toolbar in the same order that they appear in the definitions; -;; buttons with a `:insert' property value that evaluates to nil are -;; ignored; if a (real) button does not have at least (valid) image -;; and command properties, they are silently ignored; - -;; == the 3rd engine (refresh for XEmacs) is similar to the 2nd, but -;; inserts buttons in XEmacs. - -;;; History: - -;; This program was motivated by the intention of implementation of a -;; good toolbar for AUCTeX, that would work in both Emacs and XEmacs. -;; Since toolbars are very different in behaviour and implementation -;; (for instance, in Emacs one can display as many toolbar buttons as -;; wanted, because it becomes mult-line, and in XEmacs, there is one -;; line, but toolbars and all sides of a frame.) - - -;;; Code: - -;; Note that this just gives a useful default. Icons are expected to -;; be in subdirectory "images" or "toolbar" relative to the load-path. -;; Packages loading toolbarx are advised to explicitly add their own -;; searchpath with add-to-list here even when they fulfill that -;; criterion: another package might have loaded toolbar-x previously -;; when load-path was not yet correctly set. The default setting -;; really caters only for toolbar-x' stock icons. - -(defvar toolbarx-image-path - (nconc - (delq nil (mapcar #'(lambda(x) - (and x - (member - (file-name-nondirectory - (directory-file-name x)) - '("toolbar" "images")) - ;;(file-directory-p x) - x)) - load-path)) - (list data-directory)) - "List of directories where toolbarx finds its images.") - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; First engine: Parsing buttons - -;; it obtains button information, process it and stores result in -;; `toolbarx-internal-button-switches', which is a list with 1st -;; element the symbol `:switches', the 2nd element as a list of -;; processed buttons, and the 3rd element is used for Emacs to store -;; the keys used in ``constant'' buttons. - -;; The 2nd element of `toolbarx-internal-button-switches' is a list -;; where each element is either: -;; * a button-list, that is, a list with elements to define a button. -;; * a list where 1st elem is `:insert' and 2nd is a form, and the -;; following elements are in the same format of the 2nd element of -;; `toolbarx-internal-button-switches'. - -(defun toolbarx-make-string-from-symbol (symbol) - "Return a string from the name of a SYMBOL. -Upcase initials and replace dashes by spaces." - (let* ((str (upcase-initials (symbol-name symbol))) - (str2)) - (dolist (i (append str nil)) - (if (eq i 45) ; if dash, push space - (push 32 str2) - (push i str2))) ; else push identical - (concat (nreverse str2)))) - -(defun toolbarx-make-symbol-from-string (string) - "Return a (intern) symbol from STRING. -Downcase string and replace spaces by dashes." - (let* ((str1 (append (downcase string) nil)) - (str2)) - (dolist (i str1) - (if (eq i 32) ; if dash, push space - (push 45 str2) - (push i str2))) - (intern (concat (nreverse str2))))) - -(defun toolbarx-good-option-list-p (option-list valid-options) - "Non-nil means the OPTION-LIST is of form (OPT FORM ... OPT FORM). -Each OPT is member of VALID-OPTIONS and OPT are pairwise -different. OPTION-LIST equal to nil is a good option list." - (let ((elt-in-valid t) - (temp-opt-list option-list) - (list-diff) - (n (/ (length option-list) 2))) - (dotimes (i n) - (when (> i 0) - (setq temp-opt-list (cddr temp-opt-list))) - (add-to-list 'list-diff - (car temp-opt-list)) - (setq elt-in-valid (and elt-in-valid - (memq (car temp-opt-list) - valid-options)))) - (and elt-in-valid ; options are on VALID-OPTOPNS - ;; OPTION-LIST has all option different from each other - (eq (length list-diff) n) - ;; OPTION-LIST has even number of elements - (eq (% (length option-list) 2) 0)))) - -(defun toolbarx-separate-options (group-list valid-options &optional check) - "Return a cons cell with non-options and options of GROUP-LIST. -The options-part is the largest tail of the list GROUP-LIST that -has an element of VALID-OPTIONS (the comparation is made with -`memq'.) The non-options-part is the beginning of GROUP-LIST -less its tail. Return a cons cell which `car' is the -non-options-part and the `cdr' is the options-part. - -If CHECK is non-nil, the tail is the largest that yield non-nil -when applied to `toolbarx-good-option-list-p'." - (let ((maximal) - (temp)) - (dolist (i valid-options) - (setq temp (memq i group-list)) - (when (and (> (length temp) (length maximal)) - (if check - (toolbarx-good-option-list-p temp valid-options) - t)) - (setq maximal (memq i group-list)))) - (cons (butlast group-list (length maximal)) maximal))) - - -(defun toolbarx-merge-props (inner-props outer-props override add) - "Merge property lists INNER-PROPS and OUTER-PROPS. -INNER-PROPS and OUTER-PROPS are two lists in the format - (PROP VAL PROP VAL ... PROP VAL). -Returns a list with properties and values merged. - -OVERRIDE and ADD are supposed to be lists of symbols. The value -of a property in OVERRIDE is the one on OUTER-PROPS or -INNER-PROPS, but if the property is in both, the value in -INNER-PROPS is used. The value of a property in ADD will be a -list with first element the symbol `:add-value-list' and the rest -are the properties, inner properties first." - (let* ((merged) - (inner-prop) - (outer-prop)) - (dolist (prop override) - (if (memq prop inner-props) - (setq merged (append merged - (list prop (cadr (memq prop inner-props))))) - (when (memq prop outer-props) - (setq merged (append merged - (list prop (cadr (memq prop outer-props)))))))) - (dolist (prop add merged) - (setq inner-prop (memq prop inner-props)) - (when inner-prop - (if (and (listp (cadr inner-prop)) - (eq (car (cadr inner-prop)) :add-value-list)) - (setq inner-prop (cdr (cadr inner-prop))) - (setq inner-prop (list (cadr inner-prop))))) - (setq outer-prop (memq prop outer-props)) - (when outer-prop - (if (and (listp (cadr outer-prop)) - (eq (car (cadr outer-prop)) :add-value-list)) - (setq outer-prop (cdr (cadr outer-prop))) - (setq outer-prop (list (cadr outer-prop))))) - (when (append inner-prop outer-prop) - (setq merged (append merged - (list prop (cons :add-value-list - (append inner-prop - outer-prop))))))))) - -(defun toolbarx-make-command (comm prep app) - "Return a command made from COMM, PREP and APP. -COMM is a command or a form. PREP and APP are forms. If PREP or -APP are non-nil, they are added to the resulting command at the -beginning and end, respectively. If both are nil and COMM is a -command, COMM is returned." - (let ((comm-is-command (commandp comm))) - (if (and (not prep) - (not app) - comm-is-command) - comm - (append '(lambda nil (interactive)) - (when prep (list prep)) - (when comm - (if comm-is-command - `((call-interactively (function ,comm))) - (list comm))) - (when app (list app)))))) - -;; in Emacs, menus are made of keymaps (vectors are possible, but editors -;; handle `menu titles' differently) meanwhile in XEmacs, menus are lists of -;; vectors - -(defun toolbarx-emacs-mount-popup-menu - (strings var type &optional title save) - "Return an interactive `lambda'-expression that shows a popup menu. -This function is the action of `toolbarx-mount-popup-menu' if -inside Emacs. See documentation of that function for more." - ;; making the menu keymap by adding each menu-item definition - ;; see (info "(elisp)Menu keymaps") - (let* ((keymap (make-sparse-keymap title)) - (count 1) - (used-symbols '(nil)) - (key) - (real-type (if (eq type 'toggle) 'toggle 'radio)) - (real-save (when save (if (eq save 'offer) 'offer 'always)))) - ;; warn if type is not `radio' ot `toggle'; use `radio' if incorrect. - (unless (eq type real-type) - (display-warning 'toolbarx - (format (concat "TYPE should be symbols `radio' or " - "`toggle', but %s found; using `radio'") - type))) - ;; warn if save is not `nil', `offer' or `always'; use nil when incorrect - (unless (eq save real-save) - (setq real-save nil) - (display-warning 'toolbarx - (format (concat "SAVE should be symbols `nil', " - "`offer' or `always', but %s found; " - "using `nil'") - save))) - (dolist (i strings) - ;; finding a new symbol - (let* ((aux-count 0) - (i-symb (toolbarx-make-symbol-from-string i))) - (setq key i-symb) - (while (memq key used-symbols) - (setq aux-count (1+ aux-count)) - (setq key (intern (format "%s-%d" i-symb aux-count)))) - (setq used-symbols (cons key used-symbols))) - (define-key-after keymap (vector key) - `(menu-item ,i - ,(append - `(lambda nil (interactive) - ,(if (eq real-type 'radio) - `(setq ,var ,count) - `(if (memq ,count ,var) - (setq ,var (delete ,count ,var)) - (setq ,var (sort (cons ,count ,var) '<)))) - (toolbarx-refresh)) - (when (eq real-save 'always) - `((customize-save-variable - (quote ,var) ,var))) - `(,var)) - :button ,(if (eq real-type 'radio) - `(:radio eq ,var ,count) - `(:toggle memq ,count ,var)))) - (setq count (1+ count))) - (when (eq real-save 'offer) - (define-key-after keymap [sep] '(menu-item "--shadow-etched-in-dash")) - (let* ((aux-count 0) - (i-symb 'custom-save)) - (setq key i-symb) - (while (memq key used-symbols) - (setq aux-count (1+ aux-count)) - (setq key (intern (format "%s-%d" i-symb aux-count)))) - (setq used-symbols (cons key used-symbols))) - (define-key-after keymap (vector key) - `(menu-item "Save state of this menu" - (lambda nil (interactive) - (customize-save-variable (quote ,var) ,var))))) - ;; returns a `lambda'-expression - `(lambda nil (interactive) (popup-menu (quote ,keymap))))) - -(defun toolbarx-xemacs-mount-popup-menu - (strings var type &optional title save) - "Return an interactive `lambda'-expression that shows a popup menu. -This function is the action of `toolbarx-mount-popup-menu' if -inside XEmacs. See documentation of that function for more." - (let* ((menu (if (and title (stringp title)) - (list title) - (setq title nil) - (list "Dropdown menu"))) - (count 0) - (menu-item) - (menu-callback) - (real-type (if (eq type 'toggle) 'toggle 'radio)) - (real-save (when save (if (eq save 'offer) 'offer 'always)))) - ;; warn if type is not `radio' ot `toggle'; use `radio' if incorrect. - (unless (eq type real-type) - (warn (concat "TYPE should be symbols `radio' or `toggle', " - "but %s found; using `radio'") type)) - ;; warn if save is not `nil', `offer' or `always'; use nil when incorrect - (unless (eq save real-save) - (setq real-save nil) - (display-warning 'toolbarx - (format (concat "SAVE should be symbols `nil', " - "`offer' or `always', but %s found; " - "using `nil'") - save))) - ;; making the menu list of vectors - (dolist (str strings) - (setq count (1+ count)) - (setq menu-callback (list 'progn - (if (eq real-type 'radio) - `(setq ,var ,count) - `(if (memq ,count ,var) - (setq ,var (delete ,count ,var)) - (setq ,var (sort (cons ,count ,var) '<)))) - '(toolbarx-refresh))) - (when (eq real-save 'always) - (setq menu-callback (append menu-callback - (list (list 'customize-save-variable - (list 'quote var) var))))) - (setq menu-item (vector str menu-callback - :style real-type - :selected (if (eq real-type 'radio) - `(eq ,var ,count) - `(memq ,count ,var)))) - (setq menu (append menu (list menu-item)))) - (when (eq real-save 'offer) - (setq menu (append menu (list "--:shadowEtchedInDash"))) - (setq menu (append menu (list - (vector - "Save state of this menu" - `(customize-save-variable (quote ,var) - ,var)))))) - ;; returnung the lambda-expression - `(lambda nil (interactive) - (let ((popup-menu-titles ,(if title t nil))) - (popup-menu (quote ,menu)))))) - -(defun toolbarx-mount-popup-menu (strings var type &optional title save) - "Return a command that show a popup menu. -The return is a `lambda'-expression with a interactive declaration. - -STRINGS is a list of strings which will be the itens of the menu. - -VAR is a symbol that is set when an item is clicked. TYPE should -be one of the symbols `radio' or `toggle': `radio' means that the -nth item is selected if VAR is `n' and this item sets VAR to `n'; -`toggle' means that VAR should be a list of integers and the nth -item is selected if `n' belongs to VAR. The item inserts or -deletes `n' from VAR. - -TITLE is a string (the title of the popup menu) or nil for no -title. - -SAVE is one of the symbols nil, `offer' or `always'. If value -is nil, do not try to save anything. If it is `offer', a menu -item is added offering the user the possibiity to save state of -that dropdown menu for future sesseions (using `custom'). If it -is `always', state is saved every time that a item is clicked." - (if (featurep 'xemacs) - (toolbarx-xemacs-mount-popup-menu strings var type title save) - (toolbarx-emacs-mount-popup-menu strings var type title save))) - -(defun toolbarx-option-value (opt) - "Return option value according to Emacs flavour. -If OPT is a vector, return first element if in Emacs or -second if in XEmacs. Otherwise, return OPT. -If OPT is vector and length is smaller than the necessary (like -if in XEmacs and vector has length 1), then nil is returned." - (if (vectorp opt) - (if (featurep 'xemacs) - (when (> (length opt) 1) - (aref opt 1)) - (when (> (length opt) 0) - (aref opt 0))) - opt)) - -(defun toolbarx-eval-function-or-symbol (object type-test-func) - "Return a cons cell (GOOD-OBJ . VAL). -GOOD-OBJ non-nil means that VAL is a valid value, according to -the car of the result of TYPE-TEST-FUNCTION, that should return a -cons cell in the same format as the return of this function. - -If OBJECT applied to TYPE-TEST-FUNC return (GOOD-OBJ . VAL), and -GOOD-OBJ is non-nil, return that. Else, check if OBJECT is a -function. If so, evaluate and test again with TYPE-TEST-FUNC. If -not a function or if GOOD-OBJ is again nil, test if OBJECT is a -bound symbol, evaluate that and return the result of -TYPE-TEST-FUNC." - (let* ((ret (funcall type-test-func object))) - (unless (car ret) - (if (functionp object) - (progn - (setq ret (funcall type-test-func (funcall object))) - (unless (car ret) - (when (and (symbolp object) (boundp object)) - (setq ret (funcall type-test-func (symbol-value object)))))) - ;; ok, obj is not function; try symbol - (when (and (symbolp object) (boundp object)) - (setq ret (funcall type-test-func (symbol-value object)))))) - ret)) - -(defun toolbarx-test-image-type (obj) - "Return a cons cell (GOOD-OBJ . VAL). -GOOD-OBJ is non-nil if OBJ yields a valid image object VAL (see -documentation of function `toolbarx-process-symbol')." - (let ((toolbarx-test-image-type-simple - (lambda (img) - (let* ((val (toolbarx-option-value img)) - (all-obj-ok t) - (good-obj - (if (featurep 'xemacs) - ;; if XEmacs - (or (stringp val) ; a string - (glyphp val) ; or a glyph - (and (symbolp val) ; or a symbol bound to a - (boundp val) ; glyph-list - (check-toolbar-button-syntax - (vector val - (lambda nil (interactive)) - nil nil) t)) - (and (listp val) ; or a glyph-or-string list - (> (length val) 0) - (< (length val) 7) - (dolist (i val all-obj-ok) - (setq all-obj-ok - (and all-obj-ok - (or (not i) - (stringp i) - (glyphp i))))))) - ;; if Emacs - (or (stringp val) ; string - (and (consp val) ; or image descriptor - (eq (car val) 'image)) - (and (symbolp val) ; or a symbol bound to a - (boundp val) ; image descriptor - ; (defined with `defimage') - (consp (eval val)) - (eq (car (eval val)) 'image)) - (and (listp val) ; or list with 4 strings or - ; image descriptors - (= (length val) 4) - (dolist (i val all-obj-ok) - (setq all-obj-ok - (and all-obj-ok - (or (stringp i) - (and (consp i) - (eq (car i) - 'image))))))))))) - (cons good-obj val))))) - (toolbarx-eval-function-or-symbol obj toolbarx-test-image-type-simple))) - -(defun toolbarx-test-button-type (obj) - "Return a cons cell (GOOD-OBJ . VAL). -GOOD-OBJ is non-nil if OBJ yields a valid button object VAL (see -documentation of function `toolbarx-process-symbol')." - (let ((toolbarx-test-button-type-simple - (lambda (but) - (let* ((val (toolbarx-option-value but)) - (good-obj (if (featurep 'xemacs) - ;; if XEmacs - t - ;; if Emacs - (and (consp val) - (memq (car val) '(:toggle :radio)))))) - (cons good-obj val))))) - (toolbarx-eval-function-or-symbol obj toolbarx-test-button-type-simple))) - -(defun toolbarx-test-any-type (obj) - "Return a cons cell (t . VAL). -If OBJ is vector, return VAL according to editor. Else, return -OBJ, because it is a form anyway." - (cons t (toolbarx-option-value obj))) - -(defun toolbarx-test-string-or-nil (obj) - "Return a cons cell (GOOD-OBJ . VAL). -GOOD-OBJ is non-nil if OBJ yields a valid help object VAL (see -documentation of function `toolbarx-process-symbol')." - (let ((toolbarx-test-string-or-nil-simple - (lambda (obj) - (let* ((val (toolbarx-option-value obj)) - (good-obj (or (stringp val) - (not val)))) - (cons good-obj val))))) - (toolbarx-eval-function-or-symbol obj toolbarx-test-string-or-nil-simple))) - -(defun toolbarx-test-toolbar-type (obj) - "Return a cons cell (GOOD-OBJ . VAL). -GOOD-OBJ is non-nil if OBJ yields a valid toolbar property object -VAL (see documentation of function `toolbarx-process-symbol')." - (let ((toolbarx-test-toolbar-type-simple - (lambda (obj) - (let* ((val (toolbarx-option-value obj)) - (all-but-def-opts '(top bottom left right)) - (all-opts '(default top bottom left right)) - (good-obj - (if (featurep 'xemacs) - ;; if XEmacs - (if (symbolp val) - (memq val all-opts) - (and (consp val) - (memq (car val) all-but-def-opts) - (memq (cdr val) all-but-def-opts))) - ;; if Emacs - t))) - (cons good-obj val))))) - (toolbarx-eval-function-or-symbol obj toolbarx-test-toolbar-type-simple))) - -(defun toolbarx-test-dropdown-type (obj) - "Return a cons cell (GOOD-OBJ . VAL). -GOOD-OBJ is non-nil if OBJ yields a valid `:type' property object -VAL of a dropdown group (see documentation of function -`toolbarx-process-dropdown-group'." - (let ((toolbarx-test-dropdown-type-simple - (lambda (obj) - (let* ((val (toolbarx-option-value obj)) - (good-obj (memq val '(radio toggle)))) - (cons good-obj val))))) - (toolbarx-eval-function-or-symbol obj toolbarx-test-dropdown-type-simple))) - -(defun toolbarx-test-symbol (obj) - "Return a cons cell (GOOD-OBJ . VAL). -GOOD-OBJ is non-nil if OBJ yields a valid `:variable' property -object VAL of a dropdown group (see documentation of function -`toolbarx-process-dropdown-group'." - (let ((toolbarx-test-symbol-simple - (lambda (obj) - (let* ((val (toolbarx-option-value obj)) - (good-obj (symbolp val))) - (cons good-obj val))))) - (toolbarx-eval-function-or-symbol obj toolbarx-test-symbol-simple))) - -(defun toolbarx-test-dropdown-default (obj) - "Return a cons cell (GOOD-OBJ . VAL). -GOOD-OBJ is non-nil if OBJ yields a valid `:default' property -object VAL of a dropdown group (see documentation of function -`toolbarx-process-dropdown-group'." - (let ((toolbarx-test-dropdown-default-simple - (lambda (obj) - (let* ((val (toolbarx-option-value obj)) - (good-obj (or (integerp val) - (and (listp val) - (let ((ok t)) - (dolist (i val ok) - (setq ok (and ok (integerp i))))))))) - (cons good-obj val))))) - (toolbarx-eval-function-or-symbol obj - toolbarx-test-dropdown-default-simple))) - -(defun toolbarx-test-dropdown-save (obj) - "Return a cons cell (GOOD-OBJ . VAL). -GOOD-OBJ is non-nil if OBJ yields a valid `:save' property -object VAL of a dropdown group (see documentation of function -`toolbarx-process-dropdown-group'." - (let ((toolbarx-test-dropdown-save-simple - (lambda (obj) - (let* ((val (toolbarx-option-value obj)) - (good-obj (memq val '(nil offer always)))) - (cons good-obj val))))) - (toolbarx-eval-function-or-symbol obj toolbarx-test-dropdown-save-simple))) - -(defconst toolbarx-button-props - (let* ((props-types-alist - '((:image toolbarx-test-image-type) - (:command toolbarx-test-any-type) - (:enable toolbarx-test-any-type) - (:visible toolbarx-test-any-type) - (:help toolbarx-test-string-or-nil) - (:insert toolbarx-test-any-type . and) - (:toolbar toolbarx-test-toolbar-type) - (:button toolbarx-test-button-type) - (:append-command toolbarx-test-any-type . progn) - (:prepend-command toolbarx-test-any-type . progn))) - (possible-props (nreverse (let* ((props ())) - (dolist (p props-types-alist props) - (setq props (cons (car p) props)))))) - (props-override (nreverse (let* ((props ())) - (dolist (p props-types-alist props) - (unless (cddr p) - (setq props (cons (car p) props))))))) - (props-add (nreverse (let* ((props ())) - (dolist (p props-types-alist props) - (when (cddr p) - (setq props (cons (car p) props)))))))) - (list props-types-alist possible-props props-override props-add)) - "List yielding all encarnations of properties of a button. -First element: alist, where each element is of form - (PROP . (TYPE-TEST-FUNCTION . ADD-OR-NIL)) -Second is a list with all properties. -Third, a list with properties that override when merging. -Fourth, a list of lists, each in the format (PROP ADD).") - -(defconst toolbarx-dropdown-props - ;; for naming dropdown properties see `Convention' in the doc string - (let* ((props-types-alist - '((:type toolbarx-test-dropdown-type) - (:variable toolbarx-test-symbol) - (:default toolbarx-test-dropdown-default) - (:save toolbarx-test-dropdown-save) - (:title toolbarx-test-string-or-nil) - (:dropdown-image toolbarx-test-image-type) - (:dropdown-enable toolbarx-test-any-type) - (:dropdown-visible toolbarx-test-any-type) - (:dropdown-insert toolbarx-test-any-type . and) - (:dropdown-help toolbarx-test-string-or-nil) - (:dropdown-toolbar toolbarx-test-toolbar-type) - (:dropdown-append-command toolbarx-test-any-type . progn) - (:dropdown-prepend-command toolbarx-test-any-type . progn))) - (possible-props (nreverse (let* ((props ())) - (dolist (p props-types-alist props) - (setq props (cons (car p) props)))))) - (props-override (nreverse (let* ((props ())) - (dolist (p props-types-alist props) - (unless (cddr p) - (setq props (cons (car p) props))))))) - (props-add (nreverse (let* ((props ())) - (dolist (p props-types-alist props) - (when (cddr p) - (setq props (cons (car p) props)))))))) - (list props-types-alist possible-props props-override props-add)) - "List yielding all encarnations of properties of a dropdown group. -First element: alist, where each element is of form - (PROP . (TYPE-TEST-FUNCTION . ADD-OR-NIL)) -Second is a list with all properties. -Third, a list with properties that override when merging. -Fourth, a list of lists, each in the format (PROP ADD). - -Convention: properties for the dropdown button should be formed -with the strings \":dropdown-\" with the button property name -without `:'. This is used on the implementation.") - -(defun toolbarx-process-group-without-insert (group-without-props - merged-props-without-insert - meaning-alist switches) - "Return an updated version of SWITCHES. -GROUP-WITHOUT-PROPS and MERGED-PROPS-WITHOUT-INSERT are -preprocessed variables in `toolbarx-process-group'." - (let ((current-switches switches)) - (dolist (i group-without-props current-switches) - (setq i (toolbarx-option-value i)) - (if (symbolp i) - (setq current-switches - (toolbarx-process-symbol i meaning-alist - merged-props-without-insert - current-switches)) - (when (listp i) - (setq current-switches - (toolbarx-process-group i meaning-alist - merged-props-without-insert - current-switches))))))) - -(defun toolbarx-process-group (group meaning-alist props switches) - "Return an updated version of SWITCHES. -Append to already processed buttons (stored in SWITCHES) a -processed version of GROUP. Groups are useful to distribute -properties. External properties are given in PROPS, and merged -with the internal properties that are in the end of GROUP. If -properties (after merge) contain a `:insert' property, return a -list where the first and second elements are `:insert' and its -value, and after that a list in the same format as SWITCHES." - (cond - ;; if DROPDOWN group - ((eq (car group) :dropdown-group) - (toolbarx-process-dropdown-group group meaning-alist props switches)) - ;; if EVAL group - ((eq (car group) :eval-group) - (let ((current-switches switches)) - (dolist (elt (cdr group) current-switches) - (let ((eval-elt (eval elt))) - (setq current-switches - (toolbarx-process-group (if (listp eval-elt) - eval-elt - (list eval-elt)) - meaning-alist props - current-switches)))))) - ;; if normal group - (t - (let* ((splited-props - (toolbarx-separate-options - group (append (nth 1 toolbarx-button-props) - (nth 1 toolbarx-dropdown-props)))) - (intern-props (cdr splited-props)) - (group-without-props (car splited-props)) - (merged-props - (toolbarx-merge-props intern-props props - (append (nth 2 toolbarx-button-props) - (nth 2 toolbarx-dropdown-props)) - (append (nth 3 toolbarx-button-props) - (nth 3 toolbarx-dropdown-props))))) - ;; check whether merged props have an `:insert' - (if (memq :insert merged-props) - ;; if yes, prepend switches with a (:insert cond elements) - (let* ((memq-ins (memq :insert merged-props)) - (ins-val (if (and (listp (cadr memq-ins)) - (eq :add-value-list - (car (cadr memq-ins)))) - ;; if property is add-value property - (let* ((p (assq - :insert - (nth 0 toolbarx-button-props))) - (add-list (list (cddr p))) - (prop-good-val)) - (dolist (val (cdr (cadr memq-ins))) - (setq prop-good-val (funcall (cadr p) val)) - (when (car prop-good-val) - (setq add-list (cons (cdr prop-good-val) - add-list)))) - ;; return: (nreverse add-list) - (setq add-list (nreverse add-list)) - (if (eq 2 (length add-list)) - (cadr add-list) ; just 1 value, no - add-list)) ; add-function - ;; if property is not add-value - (cadr memq-ins))) - (merged-props-without-insert - (append (butlast merged-props (length memq-ins)) - (cddr memq-ins))) - (group-switches - (toolbarx-process-group-without-insert - group-without-props merged-props-without-insert - meaning-alist nil))) - ;; return - (nreverse (cons (append (list :insert ins-val) - group-switches) - (nreverse switches)))) - ;; if not, just append what is processed to switches - (toolbarx-process-group-without-insert group-without-props - merged-props meaning-alist - switches)))))) - -(defun toolbarx-process-symbol (symbol meaning-alist props switches) - "Process a button given by SYMBOL in MEANING-ALIST. -The processed button is appended in SWITCHES, which is returned. -Look for a association of SYMBOL in MEANING-ALIST for collecting -properties. Such association is a list that represents either a -normal button (a description of the button) or an alias -group (the symbol is an alias for a group of buttons). PROPS is -a externel list of properties that are merged and then applied to -the button. Scope is given by GLOBAL-FLAG." - ;; there are 3 situations: symbol is :new-line, there is an alias group - ;; or a normal button - (let ((button-assq (cdr (assq symbol meaning-alist)))) - (cond - ((eq (car button-assq) :alias) - ;; button association is ALIAS GROUP is passed to - ;; `toolbarx-process-group' as is but without the car. - ;; return: (toolbarx-process-group... returns updates switch - (toolbarx-process-group (cdr button-assq) meaning-alist props switches)) - (t - ;; NORMAL BUTTON (association is a list of properties) - ;; - ;; properties need to be processed, that is, merge internal - ;; and external (given by PROPS) properties - (let* (;; button properties defined in `toolbarx-button-props' - (props-override (nth 2 toolbarx-button-props)) - (props-add (nth 3 toolbarx-button-props)) - ;; split considering also dropdown-group properties - (button-assq-split - (toolbarx-separate-options - button-assq - (append (nth 1 toolbarx-button-props) - (nth 1 toolbarx-dropdown-props)))) - (button-split-no-props (car button-assq-split)) - (button-split-props (cdr button-assq-split)) - ;; if there is no :image or :command in the props, - ;; try to get them from no-props part - (button-image-no-prop - (unless (memq :image button-split-props) - (when (> (length button-split-no-props) 0) - (list :image (nth 0 button-split-no-props))))) - (button-command-no-prop - (unless (memq :command button-split-props) - (when (> (length button-split-no-props) 1) - (list :command (nth 1 button-split-no-props))))) - (button-props (append button-split-props - button-image-no-prop - button-command-no-prop)) - ;; merge props - (merged-props (toolbarx-merge-props button-props props - props-override - props-add))) - ;; return: - (nreverse (cons (cons symbol merged-props) (nreverse switches)))))))) - -(defun toolbarx-process-dropdown-group (dropdown meaning-alist props switches) - "Process buttons that appear according to dropdown menu. -Process a dropdown group DROPDOWN with meaning alist -MEANING-ALIST, external property list PROP and GLOBAL-FLAG -specifying scope. For a complete description, see documentation -of `toolbarx-install-toolbar'. The processed buttons are stored -in the end of SWITCHES, which is returned." - (let* ((dropdown-group (if (eq (car dropdown) :dropdown-group) - (cdr dropdown) - dropdown)) - (dropdown-list-splited - (toolbarx-separate-options dropdown-group - (append - (nth 1 toolbarx-button-props) - (nth 1 toolbarx-dropdown-props)))) - (dropdown-list (car dropdown-list-splited)) - (dropdown-props (cdr dropdown-list-splited)) - (merged-props - (toolbarx-merge-props dropdown-props props - (append (nth 2 toolbarx-button-props) - (nth 2 toolbarx-dropdown-props)) - (append (nth 3 toolbarx-button-props) - (nth 3 toolbarx-dropdown-props)))) - (merged-props-button-only - (let* ((props-button-only) - (prop)) - (dolist (p (nth 1 toolbarx-button-props) props-button-only) - (setq prop (memq p merged-props)) - (when prop - (setq props-button-only - (append (list p (cadr prop)) - props-button-only)))))) - (merged-props-dropdown-only - (let* ((props-dropdown-only) - (prop)) - (dolist (p (nth 1 toolbarx-dropdown-props) props-dropdown-only) - (setq prop (memq p merged-props)) - (when prop - (setq props-dropdown-only - (append (list p (cadr prop)) - props-dropdown-only)))))) - ;; get value for each property and check type ONLY for props that do - ;; not concern the dropdown button, like `:type', `:save', etc. The - ;; props that concern the button are going to be handled in refresh - ;; time. - (filtered-dropdown-group-props-only - (let* ((filtered-props-temp) - (prop-good-val) - (prop)) - (save-match-data - (dolist (p (nth 0 toolbarx-dropdown-props) filtered-props-temp) - (unless (string-match "^:dropdown-.*$" - (symbol-name (car p))) - ;; property -> (car p) - ;; test type function -> (cadr p) - (setq prop (memq (car p) merged-props-dropdown-only)) - ;; if so, check if value is of correct type - (when prop - (setq prop-good-val (funcall (cadr p) (cadr prop))) - (if (car prop-good-val) - (setq filtered-props-temp - (append filtered-props-temp - (list (car p) (cdr prop-good-val)))) - (display-warning - 'toolbarx - (format (concat "Wrong type for value in " - "property `%s' in dropdown group") - (car p)))))))))) - ;; properties for the dropdown button from dropdown merged properties - (dropdown-button-props - (let* ((props)) - (save-match-data - (dolist (pr (nth 1 toolbarx-dropdown-props)) - (when (and (memq pr merged-props-dropdown-only) - (string-match "^:dropdown-\\(.*\\)$" - (symbol-name pr))) - (let* ((new-pr (intern (concat ":" - (substring (symbol-name pr) - (match-beginning 1) - (match-end 1))))) - (val (cadr (memq pr merged-props-dropdown-only)))) - (setq props (append (list new-pr val) props)))))) - (unless (memq :image props) - (setq props (append (list :image "dropdown") props))) - props)) - (dropdown-button-without-command - (cons 'dropdown dropdown-button-props)) - ;; `:type' defaults to `radio' - (type (if (memq :type filtered-dropdown-group-props-only) - (cadr (memq :type filtered-dropdown-group-props-only)) - 'radio)) - ;; `:default' defaults to 1 or nil depending on `type' - ;; if type is toggle and default is not a list, but a - ;; integer, set as the list with integer - (default - (let* ((memq-default (memq :default - filtered-dropdown-group-props-only)) - (def-temp (cadr memq-default)) - (default-temp (if memq-default - def-temp - (if (eq type 'radio) 1 (list 1))))) - default-temp)) - ;; `:save' defaults to nil and require `:variable' - (save (let* ((save-temp - (when (memq :save filtered-dropdown-group-props-only) - (cadr (memq :save - filtered-dropdown-group-props-only))))) - (if (and save-temp - (not (memq :variable - filtered-dropdown-group-props-only))) - (progn - (display-warning - 'toolbarx - (concat "`:save' property with non-nil value should " - "be used only with the `:variable' property; " - "using value nil for `:save'.")) - nil) - save-temp))) - ;; `:title' defaults to nil - (title (when (memq :title filtered-dropdown-group-props-only) - (cadr (memq :title filtered-dropdown-group-props-only)))) - ;; the menu variable is buildt from the `:variable' option or - ;; make a symbol not used - (variable (if (memq :variable filtered-dropdown-group-props-only) - (cadr (memq :variable - filtered-dropdown-group-props-only)) - (let* ((count 0) - (symb (intern (format - "toolbarx-internal-menu-var-%d" - count)))) - (while (boundp symb) - (setq count (1+ count)) - (setq symb - (intern (format "toolbarx-internal-menu-var-%d" - count)))) - symb))) - ;; auxiliary variables - (list-strings) - (list-buttons)) - ;; setting `variable' - (if save - (custom-declare-variable - variable default - "Used as variable of dropdown menu defined with `toolbarx'.") - (when (not (boundp variable)) - (set variable default))) - ;; now check `variable' content - (set variable - (let ((val (eval variable))) - (if (eq type 'toggle) - (if (listp val) - val - (if (integerp val) - (list val) - (list 1))) - ;; then, type is radio - (if (integerp val) - val - (if (and val - (listp val) - (integerp (car val))) - (car val) - 1))))) - ;; === buiding `list-strings' and `list-buttons' === - ;; if only symbols, build `list-strings' and `list-buttons' from symbols - (if (let ((only-symbols-flag t)) - (dolist (i dropdown-list only-symbols-flag) - (setq only-symbols-flag (and only-symbols-flag (symbolp i))))) - (let ((count 0)) - (dolist (i dropdown-list) - ;; list-strings and list-buttons are buildt reversed - (setq list-strings (cons (toolbarx-make-string-from-symbol i) - list-strings)) - (setq count (1+ count)) - (setq list-buttons (cons (list i - :insert - (if (eq type 'radio) - (list 'eq count variable) - (list 'memq count variable))) - list-buttons)))) - ;; if not, the it must start with string - (unless (stringp (car dropdown-list)) - (error "%s %s %s" - "If not all itens on dropdown are symbols, then a string" - "must come before each set of buttons; no string found" - "in first position.")) - (let ((count 0) - (elem) - (temp-list-buttons)) - (while dropdown-list - (setq elem (car dropdown-list)) - (setq dropdown-list (cdr dropdown-list)) - (if (stringp elem) - ;; if string, output `temp-list-buttons' and prepair it again - (progn - ;; list-strings and list-buttons are buildt reversed - (setq list-strings (cons elem list-strings)) - (when temp-list-buttons - (setq list-buttons (cons (append (nreverse temp-list-buttons) - (list :insert - (if (eq type 'radio) - (list 'eq count - variable) - (list 'memq count - variable)))) - list-buttons))) - (setq temp-list-buttons nil) - (setq count (1+ count))) - ;; else, if not string, just insert it to `temp-list-buttons' - ;; which is also buildt reversed - (setq temp-list-buttons (cons elem temp-list-buttons)))) - ;; output last temp list, left behind - (when temp-list-buttons - (setq list-buttons (cons (append (nreverse - temp-list-buttons) - (list - :insert (if (eq type 'radio) - (list 'eq count - variable) - (list 'memq count - variable)))) - list-buttons))))) - ;; lists were made reversed (elements inserted at the beginning) - (setq list-strings (nreverse list-strings)) - (setq list-buttons (nreverse list-buttons)) - ;; now, pass `list-buttons' as a group to `toolbarx-process-group' - (let ((current-switches switches)) - (setq current-switches - (toolbarx-process-group list-buttons meaning-alist - merged-props ; pass non-processed props - current-switches)) - (setq current-switches - ;; outputing dropdown button - (toolbarx-process-group (append dropdown-button-without-command - (list :command - (toolbarx-mount-popup-menu - list-strings variable type - title save))) - meaning-alist merged-props-button-only - switches)) - current-switches))) - - - -;; Still functions `toolbarx-install-toolbar' and `toolbarx-refresh'to -;; complete the parsing engine. Since they interface with other engines, -;; they must come in the end. - -;;; How a image is made, giving a string as (part of) file name. - -;; look at function `image-type-available-p' for Emacs !!!! - -(defun toolbarx-find-image (image) - "Return image descriptor or glyph for IMAGE. -In Emacs, return an image descriptor for IMAGE. In XEmacs, -return a glyph. - -IMAGE is string. Usually IMAGE neither contains a directory nor -an extension. If the extension is omitted, `xpm', `xbm' and -`pbm' are tried. If the directory is omitted, -`toolbarx-image-path' is searched." - ;; `find-image' in Emacs 21 looks in `load-path' and `data-directory'. In - ;; Emacs 22, we have `image-load-path' which includes `load-path' and - ;; `data-directory'. - ;; - ;; If there's some API in XEmacs to find the images, we should use it - ;; instead of locate-library. - ;; - ;; Emacs 22 has locate-file, but the other Emacsen don't. The - ;; following should hopefully get us to all images ultimately. - - (let ((file)) - (dolist (i '("" ".xpm" ".xbm" ".pbm")) - (unless file - (setq file (locate-library (concat image i) t toolbarx-image-path)))) - (if (featurep 'xemacs) - (and file (make-glyph file)) - (if file - (create-image file) - (find-image `((:type xpm :file ,(concat image ".xpm")) - (:type xbm :file ,(concat image ".xbm")) - (:type pbm :file ,(concat image ".pbm")))))))) - -;; next variable interfaces between parsing and display engines -(defvar toolbarx-internal-button-switches nil - "Store the list of processed buttons, used by `toolbarx-refresh'. -This variable can store different values for the different buffers.") - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Second engine: display parsed buttons in Emacs - -(defun toolbarx-emacs-add-button (button used-keys keymap) - "Insert a button where BUTTON is its description. -USED-KEYS should be a list of symbols, where the first element is -`:used-symbols'. This list should store the symbols of the -buttons already inserted. This list is changed by side effect. -KEYMAP is the keymap where the menu-item corresponding to the -tool-bal button is going to be inserted. Insertion is made in -the end of KEYMAP. - -BUTTON should be a list of form (SYMBOL . PROP-LIST). SYMBOL is -a symbol that \"names\" this button. PROP-LIST is a list in the -format (PROP VAL ... PROP VAL). The supported properties are -`:image', `:command', `:append-command', `:prepend-command', -`:help', `:enable', `:visible', `:button', `:insert' and -`:toolbar'. For a description of properties, see documentation of -function `toolbar-install-toolbar'." - (let* ((symbol (nth 0 button)) - (used-keys-list (when used-keys - (cdr used-keys))) - (filtered-props - (let* ((filtered-props-temp) - (prop-good-val) - (prop)) - (dolist (p (nth 0 toolbarx-button-props) filtered-props-temp) - ;; property -> (car p) - ;; test type function -> (cadr p) - ;; add-function -> (cddr p) - (setq prop (memq (car p) button)) - ;; if so, check if value is of correct type - (when prop - ;; if property is of add-type, them the value is a list - ;; (:add-value-list VAL VAL). Each VAL should be checked. - (if (and (cddr p) (eq :add-value-list (car (cadr prop)))) - (let* ((add-list (list (cddr p)))) - (dolist (val (cdr (cadr prop))) - (setq prop-good-val (funcall (cadr p) val)) - (when (car prop-good-val) - (setq add-list (cons (cdr prop-good-val) add-list)))) - (setq add-list (nreverse add-list)) - (when (eq 2 (length add-list)) ; just 1 value, no - ; add-function - (setq add-list (cadr add-list))) - (setq filtered-props-temp (append - (list (car p) add-list) - filtered-props-temp))) - ;; if override-property - (setq prop-good-val (funcall (cadr p) (cadr prop))) - (when (car prop-good-val) - (setq filtered-props-temp (append - (list (car p) - (cdr prop-good-val)) - filtered-props-temp)))))))) - (insert (or (not (memq :insert filtered-props)) - ;; (memq :insert filtered-props) - (eval (nth 1 (memq :insert filtered-props)))))) - (when insert - (cond - (t - ;; symbol is not :new-line, therefore a normal button - (let* ((image (cadr (memq :image filtered-props))) - (image-descriptor - (when (memq :image filtered-props) - (cond - ((stringp image) ; string - (toolbarx-find-image image)) - ((and (consp image) ; or image descriptor - (eq (car image) 'image)) - image) - ((and (symbolp image) ; or a symbol bound to a - (boundp image) ; image descriptor (defined - ; with `defimage')g - (consp (eval image)) - (eq (car (eval image)) 'image)) - (eval image)) - (t ; otherwise, must be a list - ; with 4 strings or image - ; descriptors - (apply 'vector (mapcar (lambda (img) - (if (stringp img) - (toolbarx-find-image img) - img)) - image)))))) - (command - (let* ((com (nth 1 (memq :command filtered-props))) - (app (nth 1 (memq :append-command filtered-props))) - (prep (nth 1 (memq :prepend-command filtered-props)))) - (when (or com app prep) - (toolbarx-make-command com prep app)))) - (help (cons (memq :help filtered-props) - (cadr (memq :help filtered-props)))) - (enable (cons (memq :enable filtered-props) - (cadr (memq :enable filtered-props)))) - (visible (cons (memq :visible filtered-props) - (cadr (memq :visible filtered-props)))) - (button (cons (memq :button filtered-props) - (cadr (memq :button filtered-props)))) - (menuitem (append - (list 'menu-item - (toolbarx-make-string-from-symbol symbol) - command - :image image-descriptor) - (when (car help) - (list :help (cdr help))) - (when (car enable) - (list :enable (cdr enable))) - (when (car visible) - (list :visible (cdr visible))) - (when (car button) - (list :button (cdr button))))) - (key-not-used - (let* ((count 0) - (symb symbol)) - (while (memq symb used-keys-list) - (setq count (1+ count)) - (setq symb (intern (format "%s-%d" symbol count)))) - symb))) - (when (and image-descriptor command) - (setq used-keys-list (cons key-not-used used-keys-list)) - (define-key-after keymap - (vector key-not-used) menuitem)))))) - (when used-keys (setcdr used-keys used-keys-list)))) - - -(defun toolbarx-emacs-refresh-process-button-or-insert-list (switches - used-keys - keymap) - "Process SWITCHES, inserting buttons in `tool-bar-map'. -If a button is actually a `:insert' clause group (if `car' is -`:insert') and evaluation of `cdr' yields non-nil, process `cddr' -recursively as SWITCHES. USED-KEYS is a list which `car' is -`:used-symbols' and which `cdr' is a list of symbols that have already -been used as keys in the keymap `tool-bar-map'." - (dolist (button switches) - (if (eq (car button) :insert) - (when (eval (cadr button)) - (toolbarx-emacs-refresh-process-button-or-insert-list (cddr button) - used-keys - keymap)) - (toolbarx-emacs-add-button button used-keys keymap)))) - - - -(defun toolbarx-emacs-refresh (&optional global-flag) - "Refresh and redraw the toolbar in Emacs. -If GLOBAL-FLAG is non-nil, the default value of toolbar switches -is used and the default value of `toolbarx-map' is changed." - (let* ((switches (if global-flag - (if (default-boundp 'toolbarx-internal-button-switches) - (default-value 'toolbarx-internal-button-switches) - toolbarx-internal-button-switches) - toolbarx-internal-button-switches)) - (used-keys (list :used-symbols nil)) - (tool-bar-map-temp (make-sparse-keymap))) - (toolbarx-emacs-refresh-process-button-or-insert-list switches used-keys - tool-bar-map-temp) - (if global-flag - (setq-default tool-bar-map tool-bar-map-temp) - (setq tool-bar-map tool-bar-map-temp)))) - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Third engine: display parsed buttons in XEmacs - -(defun toolbarx-xemacs-image-properties (image) - "Return a list of properties of IMAGE. -IMAGE should be a string or a list of one to six strings or -glyphs or nil, or a symbol bound to a list of one to six -glyphs (them must be a valid image list, like one created with -the function `toolbar-make-button-list'). Return a -list (GLYPH-LIST HEIGHT WIDTH) where HEIGHT (resp. WIDTH) is the -maximum of the heights (resp. widths) of all glyphs (or strings -converted to glyphs) in GLYPH-LIST. If IMAGE is not a list, it -is treated as a list with IMAGE as only element. Strings are -converted to glyphs with the function `toolbarx-find-image'. If, -after possible string-to-glyph convertions, the list of glyphs -has nil as first element, GLYPH-LIST becomes nil." - (let* ((glyph-list - (if (symbolp image) ; if symbol, them must be a - ; valid image list, like - ; created by function - ; `toolbar-make-button-list' - (eval image) - (let ((img-list (if (listp image) - image - (list image))) - (glyph-list-temp)) - ;; glyph-list-temp - (setq glyph-list-temp - (dolist (glyph img-list (nreverse glyph-list-temp)) - (if (stringp glyph) - (setq glyph-list-temp - (cons (toolbarx-find-image glyph) - glyph-list-temp)) - (setq glyph-list-temp (cons glyph glyph-list-temp))))) - (unless (car glyph-list-temp) - (setq glyph-list-temp nil)) - glyph-list-temp))) - (usable-buttons - ;; computing inheritage - (let* ((usable-temp)) - (if toolbar-captioned-p ; problematic point :-( - (progn - ;; CAP-UP: cap-up -> up - (setq usable-temp (cons (cond - ((nth 3 glyph-list)) - ((nth 0 glyph-list))) - usable-temp)) - ;; CAP-DOWN: cap-down -> cap-up -> down -> up - (setq usable-temp (cons (cond - ((nth 4 glyph-list)) - ((nth 3 glyph-list)) - ((nth 1 glyph-list)) - ((nth 0 glyph-list))) - usable-temp)) - ;; CAP-DISABLED: cap-disabled -> cap-up -> disabled -> up - (setq usable-temp (cons (cond - ((nth 5 glyph-list)) - ((nth 3 glyph-list)) - ((nth 2 glyph-list)) - ((nth 0 glyph-list))) - usable-temp))) - ;; UP: up - (setq usable-temp (cons (nth 0 glyph-list) usable-temp)) - ;; DOWN: down -> up - (setq usable-temp (cons (cond - ((nth 1 glyph-list)) - ((nth 0 glyph-list))) - usable-temp)) - ;; DISABLED: disabled -> up - (setq usable-temp (cons (cond - ((nth 2 glyph-list)) - ((nth 0 glyph-list))) - usable-temp))) - usable-temp)) - (height (apply 'max 0 (mapcar (lambda (glyph) - (if glyph - (glyph-height glyph) - 0)) - usable-buttons))) - (width (apply 'max 0 (mapcar (lambda (glyph) - (if glyph - (glyph-width glyph) - 0)) - usable-buttons)))) - (list (if (symbolp image) image glyph-list) height width))) - - - -(defun toolbarx-xemacs-button-properties (button) - "Return a list of properties of BUTTON. -The result is either nil (if not to be inserted) or a list in the format - (TOOLBAR HEIGHT WIDTH BUTTON-DESCRIPTION) -where - -TOOLBAR is one of the symbols `default', `top', `right', `bottom' - or `left'. - -HEIGHT and WIDTH are the maximal dimentions of all the glyphs - involved. - -BUTTON-DESCRIPTION is button definition in XEmacs; see the - documentation of variable `default-toolbar'." - (let* ((filtered-props - (let* ((filtered-props-temp) - (prop-good-val) - (prop)) - (dolist (p (nth 0 toolbarx-button-props) filtered-props-temp) - ;; property -> (car p) - ;; test type function -> (cadr p) - ;; add-function -> (cddr p) - (setq prop (memq (car p) button)) - ;; if so, check if value is of correct type - (when prop - ;; if property is of add-type, them the value is a list - ;; (:add-value-list VAL VAL). Each VAL should be checked. - (if (and (cddr p) (eq :add-value-list (car (cadr prop)))) - (let* ((add-list (list (cddr p)))) - (dolist (val (cdr (cadr prop))) - (setq prop-good-val (funcall (cadr p) val)) - (when (car prop-good-val) - (setq add-list (cons (cdr prop-good-val) add-list)))) - (setq add-list (nreverse add-list)) - (when (eq 2 (length add-list)) ; just 1 value, no - ; add-function - (setq add-list (cadr add-list))) - (setq filtered-props-temp (append - (list (car p) add-list) - filtered-props-temp))) - ;; if override-property - (setq prop-good-val (funcall (cadr p) (cadr prop))) - (when (car prop-good-val) - (setq filtered-props-temp (append - (list (car p) - (cdr prop-good-val)) - filtered-props-temp)))))))) - (insert (or (not (memq :insert filtered-props)) - ;; (memq :insert filtered-props) holds - (eval (nth 1 (memq :insert filtered-props)))))) - (when insert - (let* ((image-props (toolbarx-xemacs-image-properties - (cadr (memq :image filtered-props)))) - (glyph-list (car image-props)) - (image-height (nth 1 image-props)) - (image-width (nth 2 image-props)) - (command - (let* ((com (nth 1 (memq :command filtered-props))) - (app (nth 1 (memq :append-command filtered-props))) - (prep (nth 1 (memq :prepend-command filtered-props)))) - (when (or com app prep) - (toolbarx-make-command com prep app)))) - ;; enable defaults to `t' - (enable (if (memq :enable filtered-props) - (cadr (memq :enable filtered-props)) - t)) - ;; help defaults to nil - (help (when (memq :help filtered-props) - (cadr (memq :help filtered-props)))) - ;; toolbar defaults to `default' - (toolbar-prop (cons (memq :toolbar filtered-props) - (cadr (memq :toolbar filtered-props)))) - (toolbar (if (car toolbar-prop) - (if (symbolp (cdr toolbar-prop)) - (cdr toolbar-prop) - ;; (cdr toolbar-prop) is cons cell - (if (eq (cadr toolbar-prop) - (default-toolbar-position)) - (cddr toolbar-prop) - (cadr toolbar-prop))) - 'default))) - (when glyph-list - (list toolbar image-height image-width - (vector glyph-list command enable help))))))) - -(defun toolbarx-xemacs-refresh-process-button-or-insert-list (switches - toolbar-props) - "Process SWITCHES, returning an updated version of TOOLBAR-PROPS. -TOOLBAR-PROPS should be a list with 12 elements, each one representing -properties (in this order) `locale', `default', `top', `right', -`bottom', `left', `default-height', `default-width', `top-height', -`right-width', `bottom-height' and `left-width'. The return is a list -with the same properties updated. - -NB: Buttons (vectors) are inserted in front of the lists -represented by `default', `top', `right', `bottom' and `left', so -the lists are built reversed." - (let ((locale (nth 0 toolbar-props)) - (default (nth 1 toolbar-props)) - (top (nth 2 toolbar-props)) - (right (nth 3 toolbar-props)) - (bottom (nth 4 toolbar-props)) - (left (nth 5 toolbar-props)) - (default-height (nth 6 toolbar-props)) - (default-width (nth 7 toolbar-props)) - (top-height (nth 8 toolbar-props)) - (right-width (nth 9 toolbar-props)) - (bottom-height (nth 10 toolbar-props)) - (left-width (nth 11 toolbar-props)) - (toolbar-props-temp)) - (dolist (button switches) - (if (eq (car button) :insert) - (when (eval (cadr button)) - ;; if insert group, process `cddr' - (progn - (setq toolbar-props-temp - (toolbarx-xemacs-refresh-process-button-or-insert-list - (cddr button) - (list locale default top right bottom left - default-height default-width top-height - right-width bottom-height left-width))) - (setq default (nth 1 toolbar-props-temp)) - (setq top (nth 2 toolbar-props-temp)) - (setq right (nth 3 toolbar-props-temp)) - (setq bottom (nth 4 toolbar-props-temp)) - (setq left (nth 5 toolbar-props-temp)) - (setq default-height (nth 6 toolbar-props-temp)) - (setq default-width (nth 7 toolbar-props-temp)) - (setq top-height (nth 8 toolbar-props-temp)) - (setq right-width (nth 9 toolbar-props-temp)) - (setq bottom-height (nth 10 toolbar-props-temp)) - (setq left-width (nth 11 toolbar-props-temp)))) - ;; else, if normal button - (let* ((button-props (toolbarx-xemacs-button-properties button)) - (toolbar (nth 0 button-props)) - (height (nth 1 button-props)) - (width (nth 2 button-props)) - (button-description (nth 3 button-props))) - (when button-props - (cond - ;; default - ((eq toolbar 'default) - (setq default (cons button-description default)) - (setq default-height (max default-height height)) - (setq default-width (max default-width width))) - ;; top - ((eq toolbar 'top) - (setq top (cons button-description top)) - (setq top-height (max top-height height))) - ;; right - ((eq toolbar 'right) - (setq right (cons button-description right)) - (setq right-width (max right-width width))) - ;; bottom - ((eq toolbar 'bottom) - (setq bottom (cons button-description bottom)) - (setq bottom-height (max bottom-height height))) - ;; left - ((eq toolbar 'left) - (setq left (cons button-description left)) - (setq left-width (max left-width width)))))))) - ;; return a list similar to toolbar-props - (list locale default top right bottom left default-height - default-width top-height right-width bottom-height left-width))) - - -(defun toolbarx-xemacs-refresh (&optional global-flag) - "Refresh the toolbar in XEmacs." - (let* ((switches (if global-flag - (if (default-boundp 'toolbarx-internal-button-switches) - (default-value 'toolbarx-internal-button-switches) - toolbarx-internal-button-switches) - toolbarx-internal-button-switches)) - (locale (if global-flag 'global (current-buffer))) - (toolbar-init (list locale ; locale - nil ; default - nil ; top - nil ; right - nil ; bottom - nil ; left - 0 ; default-height - 0 ; default-width - 0 ; top-height - 0 ; right-width - 0 ; bottom-height - 0)) ; left-width - (toolbar-props - (toolbarx-xemacs-refresh-process-button-or-insert-list switches - toolbar-init)) - ;; NB: Buttons (vectors) are inserted in front of the lists - ;; represented by `default', `top', `right', `bottom' and - ;; `left', so the lists are built reversed. - (default (nreverse (nth 1 toolbar-props))) - (top (nreverse (nth 2 toolbar-props))) - (right (nreverse (nth 3 toolbar-props))) - (bottom (nreverse (nth 4 toolbar-props))) - (left (nreverse (nth 5 toolbar-props))) - (default-height (nth 6 toolbar-props)) - (default-width (nth 7 toolbar-props)) - (top-height (nth 8 toolbar-props)) - (right-width (nth 9 toolbar-props)) - (bottom-height (nth 10 toolbar-props)) - (left-width (nth 11 toolbar-props)) - (button-raised-border 2) - (default-border (specifier-instance default-toolbar-border-width)) - (top-border (specifier-instance top-toolbar-border-width)) - (right-border (specifier-instance right-toolbar-border-width)) - (bottom-border (specifier-instance bottom-toolbar-border-width)) - (left-border (specifier-instance left-toolbar-border-width))) - ;; adding borders - (when default - (setq default-height (+ (* 2 button-raised-border) - (* 2 default-border) - default-height)) - (setq default-width (+ (* 2 button-raised-border) - (* 2 default-border) - default-width))) - (when top - (setq top-height (+ (* 2 button-raised-border) - (* 2 top-border) - top-height))) - (when right - (setq right-width (+ (* 2 button-raised-border) - (* 2 right-border) - right-width))) - (when bottom - (setq bottom-height (+ (* 2 button-raised-border) - (* 2 bottom-border) - bottom-height))) - (when left - (setq left-width (+ (* 2 button-raised-border) - (* 2 left-border) - left-width))) - ;; deal with specifiers - ;; - remove all specifiers for toolbars witout buttons - (if default - (progn - ;; Only activate the tool bar if it is already visible. - (when toolbar-visible-p - (set-specifier default-toolbar-visible-p (not (not default)) locale) - (if (memq (default-toolbar-position) '(top bottom)) - (set-specifier default-toolbar-height default-height locale) - (set-specifier default-toolbar-width default-width locale))) - (set-specifier default-toolbar default locale)) - (remove-specifier default-toolbar locale) - (remove-specifier default-toolbar-visible-p locale) - (remove-specifier default-toolbar-height locale) - (remove-specifier default-toolbar-width locale)) - (if top - (progn - (set-specifier top-toolbar-visible-p (not (not top)) locale) - (set-specifier top-toolbar-height top-height locale) - (set-specifier top-toolbar top locale)) - (remove-specifier top-toolbar locale) - (remove-specifier top-toolbar-visible-p locale) - (remove-specifier top-toolbar-height locale)) - (if right - (progn - (set-specifier right-toolbar-visible-p (not (not right)) - locale) - (set-specifier right-toolbar-width right-width locale) - (set-specifier right-toolbar right locale)) - (remove-specifier right-toolbar locale) - (remove-specifier right-toolbar-visible-p locale) - (remove-specifier right-toolbar-width locale)) - (if bottom - (progn - (set-specifier bottom-toolbar-visible-p (not (not bottom)) locale) - (set-specifier bottom-toolbar-height bottom-height locale) - (set-specifier bottom-toolbar bottom locale)) - (remove-specifier bottom-toolbar locale) - (remove-specifier bottom-toolbar-visible-p locale) - (remove-specifier bottom-toolbar-height locale)) - (if left - (progn - (set-specifier left-toolbar-visible-p (not (not left)) locale) - (set-specifier left-toolbar-width left-width locale) - (set-specifier left-toolbar left locale)) - (remove-specifier left-toolbar locale) - (remove-specifier left-toolbar-visible-p locale) - (remove-specifier left-toolbar-width locale)))) - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; finishing parsing engine - -(defun toolbarx-refresh (&optional global-flag) - "Redraw the toolbar, peviously installed with `toolbarx'. -Force global refresh if GLOBAL-FLAG is non-nil." - (interactive "P") - (if (featurep 'xemacs) - (toolbarx-xemacs-refresh global-flag) - (toolbarx-emacs-refresh global-flag))) - -;;;###autoload (autoload 'toolbarx-install-toolbar "toolbar-x") - -(defun toolbarx-install-toolbar (buttons &optional meaning-alist global-flag) - "Install toolbar buttons given in BUTTONS. -Button properties are optionally given in MEANING-ALIST. If -GLOBAL-FLAG is non-nil, toolbar is installed globally (on every -buffer that does not have a toolbar set locally). BUTTONS is a -list of format - (ELEM ... ELEM . PROPS), -where each ELEM is either - - - a list in the same format od BUTTONS, which is going to be - refered as a *group*; groups are used to distribute properties - recursively to its elements; there are groups with special - format for special purpose: *dropdown groups* and also *eval - groups*. - - - a symbol, which could be associated in MEANING-ALIST with a - list of button properties (symbol + properties = a *button*) - or associated to a special kind of group (an *alias group*). - - - a vector, which elements are on the previous formats (but not - another vector); this is useful to specify different - ingredients to the toolbar depending if editor is Emacs or - XEmacs; the first element will be used in Emacs; the second - element is going to be used in XEmacs. - -Meaning alist -============= - -MEANING-ALIST is a list where each element is in one of the -formats (SYMB . BUTTON-PROPS-LIST) or (SYMB . ALIAS-GROUP). -BUTTON-PROPS-LIST is a list in one of the formats - (IMAGE COMMAND PROP VAL PROP VAL ... PROP VAL) or - (PROP VAL PROP VAL ... PROP VAL). -The IMAGE is going to be used as the `:image' property of the -button (see button properties bellow), and COMMAND shall be used -as the `:command' property of the button. Each PROP is one of -the button properties, and VAL is its respective value. -ALIAS-GROUP is a list which first element is the symbol `:alias' -and the cdr shall be processed as a group. - -However, a symbol is not required to have an association in -MEANING-ALIST, which is only a way to specify properties to a -button. One can use groups to specify properties. Nil is a good -MEANING-ALIST. - -Buttons -======= - -A toolbar button in `toolbarx' is the set with a symbol and -properties used to display the button, like a image and a command -to call when the button is pressed (which are the minimal -elements that a button should have.) The supported properties -for buttons and their `basic types' (see note on how values of -properties are obtained!) are: - - :image -- in Emacs, either a string or image descriptor (see - info for a definition), or a variable bound to a image - descriptor (like those defined with `defimage') or a list of 4 - strings or image descriptors; in XEmacs, either a string or a - glyph, or a symbol bount to a glyph, or a list of at least 1 - and at most 6 strings or glyphs or nil (not the first element - though); defines the image file displayed by the button. If - it is a string, the image file found with that name (always - using the function `toolbarx-find-image' to make the - \`internal\' image descriptor) is used as button image. For - the other formats, the button image is handled in the same way - as it is treated by the editors; see info nodes bellow for a - description of the capabilities of each editor - Emacs: info file \"elisp\", node \"Tool Bar\" (see `:image' - property); - PS: a *vector* of four strings is used in the Emacs - Lisp documentation as the `more ellaborated' image - property format, but here we reserve vectors to - provide editor-dependent values; this motivates our - choice for a list instead of vector (however, - internally the list becomes a vector when displaying - the button). - XEmacs: info file \"lispref\", node \"Toolbar Descriptor - Format\" (see GLYPH-LIST) or the documentation of - the variable `default-toolbar'; check the inheritage - in case of a ommited glyph or nil instead of glyph. - - :command -- a form; if the form happens to be a command, it will - be called with `call-interactively'. - - :append-command -- a form added to the end of the value of - `:command'. - - :prepend-command -- a form added at the beginning of the value - of `:command'. - - :help -- either a string or nil; defined the help string of the - button; - - :enable -- a form, evaluated constantly by both editors to - determine if a button is active (enabled) or not. - - :visible -- in Emacs, a form that is evaluated constantly to - determine if a button is visible; in XEmacs, this property is - ignored. - - :button -- in Emacs, a cons cell (TYPE . SELECTED) where the - TYPE should be `:toggle' or `:radio' and the cdr should be a - form. SELECTED is evaluated to determine when the button is - selected. This property is ignored in XEmacs. - - :insert -- a form that is evaluated every time that the toolbar - is refresh (a call of `toolbarx-refresh') to determine if the - button is inserted or just ignored (until next refresh). - - :toolbar -- in XEmacs, either one of the symbols `default', - `top', `bottom', `left', `right', or a cons cell - (POS . POS-AVOID-DEFAULT) where POS and POS-AVOID-DEFAULT - should be one of the symbols `top', `bottom', `left', `right'; - if a symbol, the button will be inserted in one of these - toolbars; if a cons cell, button will be inserted in toolbar - POS unless the position of the default toolbar is POS (then, - the default toolbar would override the position-specific - toolbar), and in this case, button will be inserted in toolbar - POS-AVOID-DEFAULT; in Emacs, this property is meaningless, and - therefore ignored. Hint of use of this property: in a - program, use or everything with `default' and the cons format - to avoid the default toolbar, or use only the position - specific buttons (symbols that are not `default'), because of - the `overriding' system in XEmacs, when a position-specific - toolbar overrides the default toolbar; for instance, if you - put a button in the default toolbar and another in the top - toolbar (and the default toolbar is in the top), then *only* - the ones in the top toolbar will be visible! - -How to specify a button -======================= - -One can specify a button by its symbol or by a group to specify -properties. For example, - BUTTON = - ( foo - (bar :image [\"bar-Emacs\" \"bar-XEmacs\"] - :command bar-function :help \"Bar help string\") - :insert foo-bar ) - MEANING-ALIST = ( (foo :image \"foo\" :command foo-function) ) -specifiy two buttons `foo' and `bar', each one with its necessary -:image and :command properties, and both use the :insert property -specified ate the end of BUTTONS (because groups distribute -properties to all its elements). `foo' and `bar' will be -inserted only if `foo-bar' evaluation yields non-nil. `bar' used -a different :image property depending if editor is Emacs or -XEmacs. - -Note on how values of properties are obtained -============================================= - -For each property PROP, its value should be either: - i) a vector of 2 elements; then each element should be of the - basic type of PROP. - ii) an element on the basic type of PROP. - iii) a function (that does not need arguments); it is evaluated - and the return should be ot type i) or ii) above - iv) a symbol bound to a element of type i) or ii). - -The type is cheched in the order i), ii) iii) and iv). This -evaluations are done every time that the oolbar is refresh. - -Ps.: in order to specify a vector as value of a property (like -the :image in Emacs), it is necessary to provide the vector as -element of another vector. - -Special groups -============== - -Eval groups ------------ - -If the first element of a group is the symbol `:eval-group', each -element is evaluated (with `eval'), put inside a list and -processed like a group. Eval groups are useful to store -definition of buttons in a variable. - -Dropdown groups ---------------- - -The idea is to specify a set of buttons that appear when a -determined menu item of a dropdown menu is active. The dropdown -menu appears when a button (by default with a triangle pointing -down) is clicked. This button is called `dropdown button'. The -dropdown button appears on the left of the currently visible -buttons of the dropdown group. - -A dropdown group is a list which first element is the symbol -`:dropdown-group' and in one of the following formats - (:dropdown-group SYMBOL-1 ... SYMBOL-n PROP-1 VAL-1 ... PROP-k VAL-k) -or - (:dropdown-group - STRING-1 ITEM-11 ... ITEM-1n - STRING-2 ITEM-21 ... ITEM-2m - . . . - STRING-n ITEM-n1 ... ITEM-np - PROP-1 VAL-1 ... PROP-j VAL-j) -where - SYMBOL-* is a symbol that defines a button in MEANING-ALIST; - STRING-* is a string that will appear in the dropdown menu; - ITEM-* is any format that define buttons or groups. - -\(a dropdown group of first format is internally converted to the -second by making strings from the symbols and each symbol is the -item) - -The same rules for obtaining property values, described above, -apply here. Properties are also distributed by groups. The -supported properties and their basic type are: - - :type -- one of the symbols `radio' (default) or `toggle'; if - type is radio, only one of the itens may be active, and if - type is toggle, any item number of itens can be active. - - :variable -- a symbol; it is the variable that govern the - dropdown button; every time the value should be an integer - starting from 1 (if type is radio) or a list of integers (if - type is toggle). The Nth set of buttons is :insert'ed. - - :default -- determines the default value when the menu is - installed; it is ignored if a value was saved with custom; it - defaults to 1 if type is radio or nil if type is toggle. If - value is a integer and type is `toggle', value used is a list - with that integer. - - :save -- one of the symbols nil (default), `offer' or - `always'; determined if it is possible for the user to save - the which menu itens are active, for a next session. If value - is `offer', a item (offering to save) is added to the - popup menu. If the value is `always', every time that a item - is selected, the variable is saved. If value is nil, variable - shall not be saved. If value is non-nil then `:variable' is - mandatory. - - :title -- a string or nil; if a string, the popup menu will show - is as menu title; if nil, no title is shown. - - :dropdown-help -- a string or nil; the help string of the - dropdown button. - - :dropdown-image -- in Emacs, either a string or a vector of 4 - strings; in XEmacs, either a string or a glyph or a list of at - least 1 and at most 6 strings or glyphs; defines the image - file displayed by the dropdown button; by default, it is the - string \"dropdown\". - - :dropdown-append-command, - :dropdownprepend-command -- a form; append or prepend forms to - the command that shows the dropdown menu, allowing extra code - to run before or after the menu appears (remember that every - menu item clicked refresh the toolbar.) - - :dropdown-enable -- a form; evaluated constantly by both editors - to determine if the dropdown button is active (enabled) or - not. - - :dropdown-visible -- a form; in Emacs, it is evaluated - constantly to determine if the dropdown button is visible; in - XEmacs, this property is ignored. - - :dropdown-toolbar -- in XEmacs, one of the symbols `default', - `opposite', `top', `bottom', `left' or `right'; ignored in - Emacs; in XEmacs, the toolbar where the dropdown button will - appear. - -Also, if the symbol `dropdown' is associted in MEANING-ALIST -with some properties, these properties override (or add) with -higher precedence. - -Special buttons -=============== - -If the symbol of a button is `:new-line', it is inserted -a (faked) return, and the next button will be displayed a next -line of buttons. The only property supported for this button is -`:insert'. This feature is available only in Emacs. In XEmacs, -this button is ignored." - (let ((switches (toolbarx-process-group buttons meaning-alist nil nil))) - (if global-flag - (setq-default toolbarx-internal-button-switches - switches) - (set (make-local-variable 'toolbarx-internal-button-switches) - switches) - (unless (featurep 'xemacs) - (make-local-variable 'tool-bar-map)))) - (toolbarx-refresh global-flag)) - - -(defconst toolbarx-default-toolbar-meaning-alist - `((separator :image "sep" :command t :enable nil :help "") - - (,(if (and (not (featurep 'xemacs)) (>= emacs-major-version 22)) - 'new-file - 'open-file) - :image ["new" toolbar-file-icon] - :command [find-file toolbar-open] - :enable [(not (window-minibuffer-p - (frame-selected-window menu-updating-frame))) - t] - :help ["Specify a new file's name, to edit the file" "Visit new file"]) - - ,(when (and (not (featurep 'xemacs)) (>= emacs-major-version 22)) - '(open-file :image ["open" toolbar-file-icon] - :command [menu-find-file-existing toolbar-open] - :enable [(not (window-minibuffer-p - (frame-selected-window menu-updating-frame))) - t] - :help ["Read a file into an Emacs buffer" "Open a file"])) - - (dired :image [,(if (>= emacs-major-version 22) - "diropen" - "open") - toolbar-folder-icon] - :command [dired toolbar-dired] - :help ["Read a directory, operate on its files" "Edit a directory"]) - - (save-buffer :image ["save" toolbar-disk-icon] - :command [save-buffer toolbar-save] - :enable [(and - (buffer-modified-p) - (buffer-file-name) - (not (window-minibuffer-p - (frame-selected-window menu-updating-frame)))) - t] - :help ["Save current buffer to its file" "Save buffer"] - :visible (or buffer-file-name - (not (eq 'special - (get major-mode 'mode-class))))) - - ;; Emacs only - (write-file :image "saveas" - :command write-file - :enable (not - (window-minibuffer-p - (frame-selected-window menu-updating-frame))) - :insert [t nil] - :help "Write current buffer to another file" - :visible (or buffer-file-name - (not (eq 'special (get major-mode 'mode-class))))) - - (undo :image ["undo" toolbar-undo-icon] - :command [undo toolbar-undo] - :enable [(and (not buffer-read-only) - (not (eq t buffer-undo-list)) - (if (eq last-command 'undo) - pending-undo-list - (consp buffer-undo-list))) - t] - :help ["Undo last operation" "Undo edit"] - :visible (not (eq 'special (get major-mode 'mode-class)))) - - (cut :image ["cut" toolbar-cut-icon] - :help ["Delete text in region and copy it to the clipboard" - "Kill region"] - :command [clipboard-kill-region toolbar-cut] - :visible (not (eq 'special (get major-mode 'mode-class)))) - - (copy :image ["copy" toolbar-copy-icon] - :help ["Copy text in region to the clipboard" "Copy region"] - :command [clipboard-kill-ring-save toolbar-copy]) - - (paste :image ["paste" toolbar-paste-icon] - :help ["Paste text from clipboard" "Paste from clipboard"] - :command [clipboard-yank toolbar-paste] - :visible (not (eq 'special (get major-mode 'mode-class)))) - - ;; Emacs only - (search-forward :command nonincremental-search-forward - :help "Search forward for a string" - :image "search" - :insert [t nil]) - - (search-replace - :image ["search-replace" toolbar-replace-icon] - :command [query-replace toolbar-replace] - :help ["Replace string interactively, ask about each occurrence" - "Search & Replace"]) - - (print-buffer :image ["print" toolbar-printer-icon] - :command [print-buffer toolbar-print] - :help ["Print current buffer with page headings" - "Print buffer"]) - - ;; Emacs only - (customize :image "preferences" - :command customize - :help "Edit preferences (customize)" - :insert [t nil]) - - ;; Emacs only - (help :image "help" - :command (lambda () (interactive) (popup-menu menu-bar-help-menu)) - :help "Pop up the Help menu" - :insert [t nil]) - - ;; Emacs only - (kill-buffer :command kill-this-buffer - :enable (kill-this-buffer-enabled-p) - :help "Discard current buffer" - :image "close" - :insert [t nil]) - - ;; Emacs only - (exit-emacs :image "exit" - :command save-buffers-kill-emacs - :help "Offer to save unsaved buffers, then exit Emacs" - :insert [t nil]) - - (spell-buffer :image ["spell" toolbar-spell-icon] - :command [ispell-buffer toolbar-ispell] - :help ["Check spelling of selected buffer" "Check spelling"]) - - (info :image ["info" toolbar-info-icon] - :command [info toolbar-info] - :help ["Enter Info, the documentation browser" "Info documentation"]) - - ;; XEmacs only - (mail :image toolbar-mail-icon - :command toolbar-mail - :help "Read mail" - :insert [nil t]) - - ;; XEmacs only - (compile :image toolbar-compile-icon - :command toolbar-compile - :help "Start a compilation" - :insert [nil t]) - - ;; XEmacs only - (debug :image toolbar-debug-icon - :command toolbar-debug - :help "Start a debugger" - :insert [nil t]) - - ;; XEmacs only - (news :image toolbar-news-icon - :command toolbar-news - :help "Read news" - :insert [nil t])) - "A meaning alist with definition of the default buttons. -The following buttons are available: - -* Both Emacs and XEmacs: `open-file', `dired', `save-buffer', - `undo', `cut', `copy', `paste', `search-replace', `print-buffer', - `spell-buffer', `info'. - -* Emacs only: `new-file' (Emacs 22+) `write-file', `search-forward', - `customize', `help', `kill-buffer', `exit-emacs'. - -* XEmacs only: `mail', `compile', `debug', `news'. - -To reproduce the default toolbar in both editors with use as BUTTON -in `toolbarx-install-toolbar': - -\(toolbarx-install-toolbar - '([(open-file dired kill-buffer save-buffer write-file undo cut - copy paste search-forward print-buffer customize help) - (open-file dired save-buffer print-buffer cut copy paste undo - spell-buffer search-replace mail info compile debug news)]) - toolbarx-default-toolbar-meaning-alist) - -Ps.: there are more buttons available than suggested in the -expression above.") - -(provide 'toolbar-x) - -;;; toolbar-x.el ends here -- 2.39.2