branch: main commit 1fc2c7a3150bf217918b1198a233b9d59e5cf2fc Merge: 5f45de1f 3fdeb4b8 Author: Tassilo Horn <t...@gnu.org> Commit: Tassilo Horn <t...@gnu.org>
Merge branch 'master' into elpa --- ChangeLog | 128 ++++++++++++++++++++++++++++++++++++++ Makefile.in | 13 ++-- context-nl.el | 15 +++-- font-latex.el | 6 +- latex.el | 22 +++++-- latex/README | 64 +++++++++++++++++++ preview.el | 9 +-- style/array.el | 53 +++++++++++++++- style/beamer.el | 1 + style/environ.el | 127 ++++++++++++++++++++++++++++++++++++++ style/listings.el | 67 +++++++++++++++++--- style/mnras.el | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++++ style/nameref.el | 19 +++--- style/newpxmath.el | 74 ++++++++++++++++++++++ style/newpxtext.el | 81 ++++++++++++++++++++++++ style/pdfpages.el | 135 ++++++++++++++++++++++++++++++++++++++++ style/tabularx.el | 8 ++- style/tabulary.el | 6 +- style/textpos.el | 111 +++++++++++++++++++++++++++++++++ style/vwcol.el | 71 +++++++++++++++++++++ tex-buf.el | 9 ++- tex.el | 59 +++++++++++------- 22 files changed, 1180 insertions(+), 74 deletions(-) diff --git a/ChangeLog b/ChangeLog index b426d6e4..8cc76566 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,131 @@ +2015-08-07 Tassilo Horn <t...@gnu.org> + + * latex.el (TeX-latex-mode): Call `LaTeX-preview-setup' + unconditionally instead of calling it from `LaTeX-mode-hook' which + breaks things if that hook is customized (bug#21188). + + * preview.el.in: Don't add `LaTeX-preview-setup' to + `LaTeX-mode-hook'. + +2015-07-21 Arash Esbati <esb...@gmx.de> + + * style/nameref.el ("nameref"): Add missing commands `\nameref*' + and `\Nameref'. + + * style/textpos.el ("textpos"): Fix the name of the provided env's + which is `textblock' and not `textpos'. + +2015-07-18 Arash Esbati <esb...@gmx.de> + + * latex.el (LaTeX-common-initialization): Query for the default + value of first arg when (re-)defining new environments. + + * Makefile.in (STYLESRC): Add new style. + + * style/vwcol.el: New file. + + * Makefile.in (STYLESRC): Add new style. + + * style/textpos.el: New file. + + * Makefile.in (STYLESRC): Add new style. + + * style/environ.el: New file. + + * style/tabulary.el ("tabulary"): Add `LCRJ' to + `LaTeX-array-column-letters'. + + * style/tabularx.el ("tabularx"): Add `X' to + `LaTeX-array-column-letters'. + + * style/array.el: Parse user-defined new column types and add them + to `LaTeX-array-column-letters'. + +2015-07-09 Mos� Giordano <m...@gnu.org> + + * latex/README: restore file deleted by mistake when preview/ + directory has been moved to top level. + + * Makefile.in: Use everywhere $(MAKE) in place of make. + +2015-06-21 Mos� Giordano <m...@gnu.org> + + * tex-buf.el (TeX-LaTeX-sentinel): Add support for hf-tikz + messages. + + * style/mnras.el: New style file. + + * Makefile.in (STYLESRC): Activate it. + +2015-06-14 Arash Esbati <esb...@gmx.de> + + * style/pdfpages.el ("pdfpages"): Restrict suggested files to + *.pdf files. File name should be relative to master file + directory. + +2015-06-13 Mos� Giordano <m...@gnu.org> + + * tex-buf.el (TeX-LaTeX-sentinel-has-warnings, TeX-parse-error): + Cater for packages with digits in their names (e.g., fixltx2e, + which emits a warning from TeX Live 2015). + +2015-06-09 Tassilo Horn <t...@gnu.org> + + * tex.el (TeX-evince-dbus-p): Explicitly bind dbus-debug to nil in + order to really ignore dbus errors with dbus-ignore-errors. + +2015-06-05 Arash Esbati <esb...@gmx.de> + + * Makefile.in (STYLESRC): Add new style. + + * style/pdfpages.el: New file. + + * style/listings.el (LaTeX-listings-auto-cleanup): Add support for + the optional argument of env's defined with `\lstnewenvironment'. + (LaTeX-listing-lstnewenvironment-regexp): Ditto. + +2015-06-05 Ikumi Keita <ik...@ikumi.que.jp> + + * tex.el (featurep): Restore compatibility with emacs versions + which don't have `activate-mark' (Emacs <= 22). + +2015-06-02 Arash Esbati <esb...@gmx.de> + + * latex.el (LaTeX-auto-cleanup): Prepare so that an optional + environment arg is also queried. + +2015-06-01 Tassilo Horn <t...@gnu.org> + + * latex.el (LaTeX-auto-env-args-with-opt): New variable for + collecting environments with an optional argument. + (LaTeX-auto-regexp-list): Use it. + (LaTeX-auto-cleanup): Initialize \newenvironment{foo}[n][d]{}{} + with the n-1 remaining mandatory arguments. + +2015-05-29 Nicolas Richard <youngf...@members.fsf.org> + + * latex.el (LaTeX-backward-paragraph): Make it work in narrowed + buffers. Fixes bug#20685. + +2015-05-18 Orlando Iovino <orlando.iov...@yahoo.it> (tiny change) + + * style/beamer.el ("beamer"): Add `subtitle' to the `slide-title' + class. + +2015-05-16 Arash Esbati <esb...@gmx.de> + + * Makefile.in (STYLESRC): Add new styles. + + * style/newpxmath.el: New file. + + * style/newpxtext.el: New file. + + * font-latex.el (font-latex-set-syntactic-keywords): Allow for + multiple mandatory argument for a verbatim environment. + + * style/listings.el ("listings"): Add support for parsing new + env's defined with `\lstnewenvironment' command. + 2015-05-08 Tassilo Horn <t...@gnu.org> * Version 11.88.6 released. diff --git a/Makefile.in b/Makefile.in index 76cef3c6..853c2b3d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -147,7 +147,10 @@ STYLESRC = style/prosper.el \ style/tcolorbox.el style/color.el style/expl3.el \ style/bidibeamer.el style/enumitem.el style/caption.el \ style/geometry.el style/ltablex.el style/ltxtable.el \ - style/mn2e.el style/colortbl.el style/attachfile.el + style/mn2e.el style/colortbl.el style/attachfile.el \ + style/newpxtext.el style/newpxmath.el style/pdfpages.el \ + style/mnras.el style/environ.el style/textpos.el \ + style/vwcol.el STYLEELC = $(STYLESRC:.el=.elc) @@ -503,7 +506,7 @@ xemacs-package: check-tag $(CP_A) auctex-$(TAG) $(XEMACS_BUILD_DIR) cd $(XEMACS_BUILD_DIR) \ && ./configure INSTALL_INFO=: TEXHASH=: --with-xemacs --with-packagedir=`pwd`/xemacs-package --without-texmf-dir --with-auto-dir=etc/auctex/auto \ - && make all install-man install && cd xemacs-package && tar -cf - --owner=root --group=root . | gzip --best > $(FTPDIR)/auctex-$(TAG)-pkg.tar.gz + && $(MAKE) all install-man install && cd xemacs-package && tar -cf - --owner=root --group=root . | gzip --best > $(FTPDIR)/auctex-$(TAG)-pkg.tar.gz # Pre-compiled AUCTeX package for Emacs on Windows WBUILDDIR=$(PWD)/windows-package @@ -563,9 +566,9 @@ windows-package: check-tag --without-texmf-dir --with-emacs=$(WEMACS) \ --with-lispdir=$(WBUILDDIR)/emacs-$(WEMACSVER)/$(WEMACSSITELISP) \ --datarootdir=$(WBUILDDIR)/emacs-$(WEMACSVER)/$(WEMACSDATAROOTDIR) \ - && make \ + && $(MAKE) \ && sed -i -e 's/"\/[^\n]\+/(expand-file-name "..\/var\/auctex" (file-name-directory load-file-name))/' tex-site.el \ - && make install + && $(MAKE) install # Create the package test -d $(FTPDIR) || mkdir -p $(FTPDIR) rm -f $(FTPDIR)/$(WPACKAGE) @@ -620,7 +623,7 @@ preview-ball: check-tag # Use TAG_EXPORT if set (for snapshots) git archive $${TAG_EXPORT:=`echo release_$(TAG) | sed 's/[.]/_/g'`} \ latex/ | tar -xC $(PREVIEW_BUILD_DIR) --strip-components=1 - cd $(PREVIEW_BUILD_DIR) && make -f ../latex/Makefile preview.ins preview.pdf + cd $(PREVIEW_BUILD_DIR) && $(MAKE) -f ../latex/Makefile preview.ins preview.pdf chmod -R go-w+rX $(PREVIEW_BUILD_DIR) test -d $(CTANDIR) || mkdir -p $(CTANDIR) # CTAN requires a top level directory "preview/" for the archive. diff --git a/context-nl.el b/context-nl.el index 9ddebe9a..6d69b3b9 100644 --- a/context-nl.el +++ b/context-nl.el @@ -120,17 +120,20 @@ ;; 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 +(defvar ConTeXt-numbered-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.") + "List of the names of ConTeXt numbered sections for its nl interface.") + +(defvar ConTeXt-unnumbered-section-list-nl + '(("titel" 1) + ("onderwerp" 2) + ("subonderwerp" 3) + ("subsubsubsubject" 4)) + "List of the names of ConTeXt unnumbered sections for its nl interface.") (defvar ConTeXt-text-nl "tekst" "The ConTeXt nl interface body text group.") diff --git a/font-latex.el b/font-latex.el index ed953d38..0bcc039c 100644 --- a/font-latex.el +++ b/font-latex.el @@ -918,9 +918,9 @@ have changed." ;; package). "\\(?:\\[[^\]\[]*\\(?:\\[[^\]\[]*\\][^\]\[]*\\)*\\]\\)?" ;; After the optional argument, there may also be - ;; another mandatory argument (e.g. with VerbatimOut or - ;; the minted envs). - "\\(?:{[^}]+}\\)?" + ;; another mandatory argument(s) (e.g. with VerbatimOut or + ;; the minted envs or defined with `lstnewenvironment'). + "\\(?:{[^}]+}\\)*" "\\(\n\\)") (1 "|" t))) (add-to-list 'font-latex-syntactic-keywords diff --git a/latex.el b/latex.el index 187f1b62..fee3f8b7 100644 --- a/latex.el +++ b/latex.el @@ -1370,6 +1370,7 @@ right number." (defvar LaTeX-auto-arguments nil) (defvar LaTeX-auto-optional nil) (defvar LaTeX-auto-env-args nil) +(defvar LaTeX-auto-env-args-with-opt nil) (TeX-auto-add-type "label" "LaTeX") (TeX-auto-add-type "bibitem" "LaTeX") @@ -1463,7 +1464,7 @@ This is necessary since index entries may contain commands and stuff.") (,(concat "\\\\\\(?:new\\|provide\\)command\\*?{?\\\\\\(" token "+\\)}?") 1 TeX-auto-symbol) (,(concat "\\\\newenvironment\\*?{?\\(" token "+\\)}?\\[\\([0-9]+\\)\\]\\[") - 1 LaTeX-auto-environment) + (1 2) LaTeX-auto-env-args-with-opt) (,(concat "\\\\newenvironment\\*?{?\\(" token "+\\)}?\\[\\([0-9]+\\)\\]") (1 2) LaTeX-auto-env-args) (,(concat "\\\\newenvironment\\*?{?\\(" token "+\\)}?") @@ -1690,6 +1691,12 @@ The value is actually the tail of the list of options given to PACKAGE." (list (nth 0 entry) (string-to-number (nth 1 entry))))) LaTeX-auto-env-args) + ;; Ditto for environments with an optional arg + (mapc (lambda (entry) + (add-to-list 'LaTeX-auto-environment + (list (nth 0 entry) 'LaTeX-env-args (vector "argument") + (1- (string-to-number (nth 1 entry)))))) + LaTeX-auto-env-args-with-opt) ;; Cleanup use of def to add environments ;; NOTE: This uses an O(N^2) algorithm, while an O(N log N) @@ -4475,10 +4482,7 @@ If COUNT is non-nil, do it COUNT times." "[@A-Za-z]+\\|[ \t]*\\($\\|" TeX-comment-start-regexp "\\)")) (progn - (when (string= (buffer-substring-no-properties - (point) (+ (point) - (length TeX-esc))) - TeX-esc) + (when (looking-at (regexp-quote TeX-esc)) (goto-char (TeX-find-macro-end))) (forward-line 1) (when (< (point) start) @@ -5738,6 +5742,9 @@ This happens when \\left is inserted." ;;;###autoload (add-to-list 'auto-mode-alist '("\\.hva\\'" . latex-mode)) +(when (fboundp 'declare-function) + (declare-function LaTeX-preview-setup "preview")) + ;;;###autoload (defun TeX-latex-mode () "Major mode in AUCTeX for editing LaTeX files. @@ -5769,6 +5776,7 @@ of `LaTeX-mode-hook'." (if (local-variable-p 'LaTeX-biblatex-use-Biber (current-buffer)) (setq LaTeX-using-Biber LaTeX-biblatex-use-Biber))) nil t) (TeX-run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'LaTeX-mode-hook) + (LaTeX-preview-setup) (TeX-set-mode-name) ;; Defeat filladapt (if (and (boundp 'filladapt-mode) @@ -6223,6 +6231,10 @@ i.e. you do _not_ have to cater for this yourself by adding \\\\' or $." [ "Number of arguments" ] [ "Default value for first argument" ] t) '("renewcommand*" TeX-arg-macro [ "Number of arguments" ] [ "Default value for first argument" ] t) + '("newenvironment" TeX-arg-define-environment + [ "Number of arguments" ] [ "Default value for first argument" ] t t) + '("renewenvironment" TeX-arg-environment + [ "Number of arguments" ] [ "Default value for first argument" ] t t) '("usepackage" LaTeX-arg-usepackage) '("RequirePackage" LaTeX-arg-usepackage) '("ProvidesPackage" (TeX-arg-file-name-sans-extension "Package name") diff --git a/latex/README b/latex/README new file mode 100644 index 00000000..0d0e8a80 --- /dev/null +++ b/latex/README @@ -0,0 +1,64 @@ +The preview.sty style file +========================== + +Purpose +------- + +The main purpose of the preview package is the extraction of selected +elements from a LaTeX source, like formulas or graphics, into separate +pages of a DVI file. A flexible and convenient interface allows it to +specify what commands and constructs should be extracted. 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. + +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 and pst-pdf +packages, the tbook XML system and some other tools. + +Availability +------------ + +The preview package is being developed along and distributed with +AUCTeX. It can therefore be obtained as part of AUCTeX distribution +files available at <URL:ftp://ftp.gnu.org/pub/gnu/auctex/> or its +mirror at <CTAN:support/auctex>. CTAN also provides a standalone +version at <CTAN:macros/latex/contrib/preview>. The project page at +<URL:http://savannah.gnu.org/projects/auctex/> offers downloads and +anonymous CVS access for cutting edge versions. For more information +about the preview package please refer to the home page of AUCTeX at +<URL:http://www.gnu.org/software/auctex/>. + +Installation +------------ + +To install the preview style file on its own without the entire AUCTeX +package, run +tex preview.ins +If preview.ins happens to be missing, you can regenerate it by running +tex docstrip +on preview.dtx with the option `installer'. + +Running TeX on preview.ins will then extract further files: +preview.drv which you can run through LaTeX in order to get the +documentation for preview.sty, preview.sty itself, a bunch of option +files with extension .def and a few configuration files with extension +.cfg. In case your docstrip configuration has not already taken care +of that, install the files with extension .sty, .def and .cfg to a +location where LaTeX will be able to find them, generate the +documentation and have fun. + +The license of the original file is the GPL which you'll find a copy +of in the complete AUCTeX distribution. The distribution will also +unpack and install the respective LaTeX files with an +autoconf-supported mechanism, so you might consider using that. + +Bug reporting +------------- + +Please report problems to <URL:mailto:bug-auc...@gnu.org>, including a +small example file which uses the \listfiles statement, and the +resulting log file. + +David Kastrup diff --git a/preview.el b/preview.el index eb5e1dec..1afb45ec 100644 --- a/preview.el +++ b/preview.el @@ -2571,20 +2571,13 @@ later while in use." (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) + "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)) diff --git a/style/array.el b/style/array.el index 51a27e88..058eb921 100644 --- a/style/array.el +++ b/style/array.el @@ -1,6 +1,6 @@ ;;; array.el --- AUCTeX style for `array.sty' -;; Copyright (C) 2013 Free Software Foundation, Inc. +;; Copyright (C) 2013, 2015 Free Software Foundation, Inc. ;; Author: Mads Jensen <m...@inducks.org> ;; Maintainer: auctex-devel@gnu.org @@ -29,11 +29,57 @@ ;;; Code: +(require 'tex) + +(TeX-auto-add-type "array-newcolumntype" "LaTeX") + +(defvar LaTeX-array-newcolumntype-regexp + '("\\\\newcolumntype{\\([a-zA-Z]+\\)}" + 1 LaTeX-auto-array-newcolumntype) + "Matches the argument of `\\newcolumntype' from `array' +package.") + +(defun LaTeX-array-auto-prepare () + "Clear `LaTeX-auto-array-newcolumntype' before parsing." + (setq LaTeX-auto-array-newcolumntype nil)) + +(defun LaTeX-array-auto-cleanup () + "Move parsed column specification from +`LaTeX-auto-array-newcolumntype' to `LaTeX-array-column-letters'." + (when (LaTeX-array-newcolumntype-list) + (LaTeX-array-update-column-letters))) + +(defun LaTeX-array-update-column-letters () + "Update and uniquify the value of `LaTeX-array-column-letters' +and make it buffer local. " + (set (make-local-variable 'LaTeX-array-column-letters) + (mapconcat 'identity + (TeX-delete-duplicate-strings + (split-string + (concat LaTeX-array-column-letters + (mapconcat 'car (LaTeX-array-newcolumntype-list) "")) + "" t)) + ""))) + +(add-hook 'TeX-auto-prepare-hook #'LaTeX-array-auto-prepare t) +(add-hook 'TeX-auto-cleanup-hook #'LaTeX-array-auto-cleanup t) +(add-hook 'TeX-update-style-hook #'TeX-auto-parse t) + (TeX-add-style-hook "array" (lambda () + + (TeX-auto-add-regexp LaTeX-array-newcolumntype-regexp) + (TeX-add-symbols - '("newcolumntype" "Column type" [ "Number of arguments" ] t) + '("newcolumntype" + (TeX-arg-eval + (lambda () + (let ((col (TeX-read-string "Column type: "))) + (LaTeX-add-array-newcolumntypes col) + (LaTeX-array-update-column-letters) + (format "%s" col)))) + [ "Number of arguments" ] t) '("showcols" 0) '("firsthline" 0) '("lasthline" 0)) @@ -43,7 +89,8 @@ (LaTeX-add-lengths "extratabsurround" "extrarowheight") ;; `array.sty' adds some new column specification letters. - (set (make-local-variable 'LaTeX-array-column-letters) "clrpmb")) + (set (make-local-variable 'LaTeX-array-column-letters) + (concat LaTeX-array-column-letters "m" "b"))) LaTeX-dialect) (defvar LaTeX-array-package-options nil diff --git a/style/beamer.el b/style/beamer.el index 58bef382..30cb328d 100644 --- a/style/beamer.el +++ b/style/beamer.el @@ -178,6 +178,7 @@ (when (and (featurep 'font-latex) (eq TeX-install-font-lock 'font-latex-setup)) (font-latex-add-keywords '(("title" "[{") + ("subtitle" "[{") ("author" "[{") ("date" "[{") ("frametitle" "<[{")) 'slide-title) diff --git a/style/environ.el b/style/environ.el new file mode 100644 index 00000000..bac82fc2 --- /dev/null +++ b/style/environ.el @@ -0,0 +1,127 @@ +;;; environ.el --- AUCTeX style for `environ.sty' version v0.3 + +;; Copyright (C) 2015 Free Software Foundation, Inc. + +;; Author: Arash Esbati <esbati'at'gmx.de> +;; Maintainer: auctex-devel@gnu.org +;; Created: 2015-07-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 `environ.sty' version v0.3 from +;; 2014/05/04. `environ.sty' is part of TeXLive. + +;; Name of new env's defined with `\NewEnviron' are automatically +;; added to list of known env's, e.g.: +;; +;; \NewEnviron{test}{<macro code>} +;; +;; `test' will be in completion list upon `C-c C-e'. + +;; More sophisticated definions must go through AUCTeX's parser, e.g.: +;; +;; \NewEnviron{test}[2][]{<macro code>} +;; +;; After a definition like this, you have to invoke `C-c C-n' to get +;; the correct completion. + +;;; Code: + +(defvar LaTeX-auto-environ-NewEnviron nil + "Temporary for parsing the arguments of `\\NewEnviron' +from `environ' package.") + +(defvar LaTeX-environ-NewEnviron-regexp + `(,(concat "\\\\\\(?:Ren\\|N\\)ewEnviron" + "[ \t\n\r]*{\\([A-Za-z0-9]+\\)}%?" + "[ \t\n\r]*\\[?\\([0-9]?\\)\\]?%?" + "[ \t\n\r]*\\(\\[\\)?") + (1 2 3) LaTeX-auto-environ-NewEnviron) + "Matches the argument of `\\NewEnviron' and `\\RenewEnviron' +from `environ.sty'.") + +(defun LaTeX-environ-auto-prepare () + "Clear temporary variable from `environ.sty' before parsing." + (setq LaTeX-auto-environ-NewEnviron nil)) + +(defun LaTeX-environ-auto-cleanup () + "Process the parsed results of `\\NewEnviron'." + (dolist (env-args LaTeX-auto-environ-NewEnviron) + (let ((env (car env-args)) + (args (cadr env-args)) + (opt (nth 2 env-args))) + (cond (;; opt. 1st argument and mandatory argument(s) + (and args (not (string-equal args "")) + opt (not (string-equal opt ""))) + (add-to-list 'LaTeX-auto-environment + (list env 'LaTeX-env-args (vector "argument") + (1- (string-to-number args))))) + (;; mandatory argument(s) only + (and args (not (string-equal args "")) + (string-equal opt "")) + (add-to-list 'LaTeX-auto-environment + (list env (string-to-number args)))) + (t ; No args + (add-to-list 'LaTeX-auto-environment (list env))))))) + +(add-hook 'TeX-auto-prepare-hook #'LaTeX-environ-auto-prepare t) +(add-hook 'TeX-auto-cleanup-hook #'LaTeX-environ-auto-cleanup t) +(add-hook 'TeX-update-style-hook #'TeX-auto-parse t) + +(defun TeX-arg-environ-final-code (_optional) + "Query for the presence of optional `final code' as argument to +`\\NewEnviron' and insert the appropriate brackets." + (let ((fincode (y-or-n-p "With optional final code?"))) + (when fincode + (insert "[]")))) + +(TeX-add-style-hook + "environ" + (lambda () + + ;; Add it to the parser + (TeX-auto-add-regexp LaTeX-environ-NewEnviron-regexp) + + (TeX-add-symbols + + ;; \NewEnviron{<name>}[<No.args>][<Opt.arg.>]{<Macro code>}[<Final code>] + '("NewEnviron" + (TeX-arg-define-environment "Environment") + [ "Number of arguments" ] [ "argument" ] t TeX-arg-environ-final-code) + + '("RenewEnviron" + (TeX-arg-environment "Environment") + [ "Number of arguments" ] [ "argument" ] t TeX-arg-environ-final-code) + + ;; Insert a pair of braces and we're done + '("environfinalcode" t) + + ;; Pre-defined + '("BODY") + + ;; Define another macro instead of \BODY + '("environbodyname" TeX-arg-define-macro))) + LaTeX-dialect) + +(defvar LaTeX-environ-package-options nil + "Package options for the environ package.") + +;;; environ.el ends here diff --git a/style/listings.el b/style/listings.el index ace5c97d..f9aee451 100644 --- a/style/listings.el +++ b/style/listings.el @@ -1,6 +1,6 @@ ;;; listings.el --- AUCTeX style for `listings.sty' -;; Copyright (C) 2004, 2005, 2009, 2013 Free Software Foundation, Inc. +;; Copyright (C) 2004, 2005, 2009, 2013, 2015 Free Software Foundation, Inc. ;; Author: Ralf Angeli <ang...@iwi.uni-sb.de> ;; Maintainer: auctex-devel@gnu.org @@ -28,6 +28,9 @@ ;; This file adds support for `listings.sty'. ;; +;; May 2015: The style detects new environments defined with +;; `\lstnewenvironment'. Users need to invoke `C-c C-n' for this. +;; ;; FIXME: Please make me more sophisticated! ;;; Code: @@ -142,8 +145,8 @@ ("indexstyle") ;; Column alignment ("columns" ("fixed" "flexible" "fullflexible" "spaceflexible")) ; - ; Also supports an optional - ; argument with {c,l,r}. + ; Also supports an optional + ; argument with {c,l,r}. ("flexiblecolumns" ("true" "false")) ("keepspaces" ("true" "false")) ("basewidth") @@ -217,9 +220,55 @@ ("multicolumn")) "Key=value options for listings macros and environments.") +(defvar LaTeX-auto-listings-lstnewenvironment nil + "Temporary for parsing the arguments of `\\lstnewenvironment' +from `listings' package.") + +(defvar LaTeX-listing-lstnewenvironment-regexp + `(,(concat "\\\\lstnewenvironment" + "[ \t\n\r]*{\\([A-Za-z0-9]+\\)}%?" + "[ \t\n\r]*\\[?\\([0-9]?\\)\\]?%?" + "[ \t\n\r]*\\(\\[\\)?") + (1 2 3) LaTeX-auto-listings-lstnewenvironment) + "Matches the argument of `\\lstnewenvironment' from `listings.sty'.") + +(defun LaTeX-listings-auto-prepare () + "Clear temporary variable from `listings.sty' before parsing." + (setq LaTeX-auto-listings-lstnewenvironment nil)) + +(defun LaTeX-listings-auto-cleanup () + "Process the parsed results of `\\lstnewenvironment'." + (dolist (env-args LaTeX-auto-listings-lstnewenvironment) + (let ((env (car env-args)) + (args (cadr env-args)) + (opt (nth 2 env-args))) + (cond (;; opt. 1st argument and mandatory argument(s) + (and args (not (string-equal args "")) + opt (not (string-equal opt ""))) + (add-to-list 'LaTeX-auto-environment + (list env 'LaTeX-env-args (vector "argument") + (1- (string-to-number args))))) + (;; mandatory argument(s) only + (and args (not (string-equal args "")) + (string-equal opt "")) + (add-to-list 'LaTeX-auto-environment + (list env (string-to-number args)))) + (t ; No args + (add-to-list 'LaTeX-auto-environment (list env)))) + (add-to-list 'LaTeX-indent-environment-list `(,env current-indentation)) + (add-to-list 'LaTeX-verbatim-environments-local env)))) + +(add-hook 'TeX-auto-prepare-hook #'LaTeX-listings-auto-prepare t) +(add-hook 'TeX-auto-cleanup-hook #'LaTeX-listings-auto-cleanup t) +(add-hook 'TeX-update-style-hook #'TeX-auto-parse t) + (TeX-add-style-hook "listings" (lambda () + + ;; Add it to the parser + (TeX-auto-add-regexp LaTeX-listing-lstnewenvironment-regexp) + ;; New symbols (TeX-add-symbols '("lstalias" ["Alias dialect"] "Alias" ["Dialect"] "Language") @@ -236,10 +285,10 @@ ;; 4.17 Short Inline Listing Commands '("lstMakeShortInline" [ "Options" ] "Character") '("lstDeleteShortInline" "Character") - + "lstgrinddeffile" "lstaspectfiles" "lstlanguagefiles" "lstlistingname" "lstlistlistingname") - + ;; New environments (LaTeX-add-environments '("lstlisting" LaTeX-env-args @@ -272,11 +321,11 @@ (font-lock-set-defaults))) LaTeX-dialect) -(defvar LaTeX-listings-package-options '("draft" "final" "savemem" +(defvar LaTeX-listings-package-options '("draft" "final" "savemem" "noaspects" - ;; procnames is mentioned in - ;; Section 5.2 - "procnames") + ;; procnames is mentioned in + ;; Section 5.2 + "procnames") "Package options for the listings package.") ;;; listings.el ends here diff --git a/style/mnras.el b/style/mnras.el new file mode 100644 index 00000000..9f2ab33d --- /dev/null +++ b/style/mnras.el @@ -0,0 +1,176 @@ +;;; mnras.el --- AUCTeX style for `mnras.cls' version 3.0. + +;; Copyright (C) 2015 Free Software Foundation, Inc. + +;; Maintainer: auctex-devel@gnu.org +;; Author: Mosè Giordano <m...@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 `mnras.cls' version 3.0. + +;;; Code: + +(TeX-add-style-hook + "mnras" + (lambda () + (if (LaTeX-provided-class-options-member "mnras" "usegraphicx") + (TeX-run-style-hooks "graphicx")) + (if (LaTeX-provided-class-options-member "mnras" "usenatbib") + (TeX-run-style-hooks "natbib")) + (if (LaTeX-provided-class-options-member "mnras" "usedcolumn") + (TeX-run-style-hooks "dcolumn")) + (TeX-run-style-hooks + "geometry" + "fixltx2e" + "hyperref") + (TeX-add-symbols + ;; 5 Title page + '("title" ["Short title"] "Long title") + '("author" ["Short author(s)"] (LaTeX-arg-author "Long author(s)")) + "newauthor" + ;; 7.2 Special symbols + '("bmath" 1) + '("mathbfit" 1) + '("mathbfss" 1) + ;; 7.2 Special symbols -- Table 1 + "sun" + "earth" + "degr" + "diameter" + "sq" + "fd" + "fh" + "fm" + "fs" + "fdg" + "farcm" + "farcs" + "fp" + "arcmin" + "arcsec" + "micron" + ;; 7.2 Special symbols -- Table 2 + "upi" + "umu" + "upartial" + "leqslant" + "geqslant" + "la" + "ga" + "getsto" + "cor" + "lid" + "gid" + "sol" + "sog" + "lse" + "gse" + "grole" + "leogr" + "loa" + "goa" + ;; 7.3 Ions + '("ion" 2) + ;; A Journal abbreviations -- Table A1 + "aap" + "astap" + "aapr" + "aaps" + "actaa" + "afz" + "aj" + "ao" + "applopt" + "aplett" + "apj" + "apjl" + "apjlett" + "apjs" + "apjsupp" + "apss" + "araa" + "arep" + "aspc" + "azh" + "baas" + "bac" + "bain" + "caa" + "cjaa" + "fcp" + "gca" + "grl" + "iaucirc" + "icarus" + "japa" + "jcap" + "jcp" + "jgr" + "jqsrt" + "jrasc" + "memras" + "memsai" + "mnassa" + "na" + "nar" + "nat" + "nphysa" + "pra" + "prb" + "prc" + "prd" + "pre" + "prl" + "pasa" + "pasp" + "pasj" + "physrep" + "physscr" + "planss" + "procspie" + "rmxaa" + "qjras" + "sci" + "skytel" + "solphys" + "sovast" + "ssr" + "zap") + + (LaTeX-add-environments + "keywords" + "proof") + + ;; Fontification + (when (and (featurep 'font-latex) + (eq TeX-install-font-lock 'font-latex-setup)) + (font-latex-add-keywords '(("author" "[{") + ("title" "[{") + ("newauthor")) + 'function)))) + +(defvar LaTeX-mnras-class-options + '("letters" "onecolumn" "doublespacing" "referee" "galley" "landscape" + "usenatbib" "usegraphicx" "useAMS" "usedcolumn") + "Package options for the mnras package.") + +;; mnras.el ends here diff --git a/style/nameref.el b/style/nameref.el index d09ddbe0..49e72021 100644 --- a/style/nameref.el +++ b/style/nameref.el @@ -1,6 +1,6 @@ ;;; nameref.el --- AUCTeX style for `nameref.sty' -;; Copyright (C) 2013 Free Software Foundation, Inc. +;; Copyright (C) 2013, 2015 Free Software Foundation, Inc. ;; Author: Mads Jensen <m...@inducks.org> ;; Maintainer: auctex-devel@gnu.org @@ -33,17 +33,22 @@ "nameref" (lambda () (TeX-add-symbols - '("nameref" TeX-arg-ref)) - + '("nameref" TeX-arg-ref) + '("nameref*" TeX-arg-ref) + '("Nameref" TeX-arg-ref)) + (setq TeX-complete-list - (append '(("\\\\nameref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}")) - TeX-complete-list)) - + (append + '(("\\\\\\(?:N\\|n\\)ameref\\*?{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}")) + TeX-complete-list)) + ;, 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 '(("nameref" "{")) 'reference))) + (font-latex-add-keywords '(("nameref" "*{") + ("Nameref" "{")) + 'reference))) LaTeX-dialect) (defvar LaTeX-nameref-package-options nil diff --git a/style/newpxmath.el b/style/newpxmath.el new file mode 100644 index 00000000..c9496db0 --- /dev/null +++ b/style/newpxmath.el @@ -0,0 +1,74 @@ +;;; newpxmath.el --- AUCTeX style for `newpxmath.sty' (v1.232) + +;; Copyright (C) 2015 Free Software Foundation, Inc. + +;; Author: Arash Esbati <esbati'at'gmx.de> +;; Maintainer: auctex-devel@gnu.org +;; Created: 2015-05-02 +;; 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 `newpxmath.sty' (v1.232) from 2015/04/07. +;; `newpxmath.sty' is part of TeXLive. + +;;; Code: + +(TeX-add-style-hook + "newpxmath" + (lambda () + + ;; Run style hook for amsmath + (TeX-run-style-hooks "amsmath") + + ;; New symbols + (TeX-add-symbols + '("overgroup" t) + '("undergroup" t) + '("overgroupra" t) + '("overgroupla" t) + '("undergroupra" t) + '("undergroupla" t) + '("widering" t) + '("widearc" t) + '("wideOarc" t) + '("uppartial" 0) + '("upvarkappa" 0) + '("varmathbb" "Character") + '("vmathbb" "Character") + '("vvmathbb" "Character"))) + LaTeX-dialect) + +(defvar LaTeX-newpxmath-package-options + '("varg" + "cmintegrals" + "uprightGreek" + "slantedGreek" + "cmbraces" + "bigdelims" + "varbb" + "vvarbb" + "nosymbolsc" + "amssymbols" + "noamssymbols" + "frenchmath") + "Package options for the newpxmath package.") + +;;; newpxmath.el ends here diff --git a/style/newpxtext.el b/style/newpxtext.el new file mode 100644 index 00000000..3bb9ab8d --- /dev/null +++ b/style/newpxtext.el @@ -0,0 +1,81 @@ +;;; newpxtext.el --- AUCTeX style for `newpxtext.sty' (v1.232) + +;; Copyright (C) 2015 Free Software Foundation, Inc. + +;; Author: Arash Esbati <esbati'at'gmx.de> +;; Maintainer: auctex-devel@gnu.org +;; Created: 2015-05-02 +;; 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 `newpxtext.sty' (v1.232) from 2015/04/15. +;; `newpxtext.sty' is part of TeXLive. + +;;; Code: + +(TeX-add-style-hook + "newpxtext" + (lambda () + + ;; Run style hook for various packages loaded by newpxtext + (TeX-run-style-hooks "textcomp" "fontaxes") + + ;; New symbols + (TeX-add-symbols + '("useosf" 0) ; Only preamble command + '("useproportional" 0) ; Only preamble command + '("lfstyle" -1) ; lf declaration + '("tlfstyle" -1) ; tlf declaration + '("osfstyle" -1) ; osf declaration + '("tosfstyle" -1) ; tosf declaration + '("sustyle" -1) ; sup style declaration + '("textlf" t) ; lf command + '("texttlf" t) ; tlf command + '("textosf" t) ; osf command + '("texttosf" t) ; tosf command + '("textsu" t)) ; sup style command + + ;; Fontification + (when (and (featurep 'font-latex) + (eq TeX-install-font-lock 'font-latex-setup)) + (font-latex-add-keywords '(("textlf" "{") + ("texttlf" "{") + ("textosf" "{") + ("texttosf" "{") + ("textsu" "{")) + 'type-command) + (font-latex-add-keywords '(("lfstyle" "") + ("tlfstyle" "") + ("osfstyle" "") + ("tosfstyle" "") + ("sustyle" "")) + 'type-declaration))) + LaTeX-dialect) + +(defvar LaTeX-newpxtext-package-options + '("defaultsups" "scosf" "largesc" + "scaled" "helvratio" + "tighter" "looser" "spacing" "stretch" "shrink" + "lining" "lf" "oldstyle" "osf" "tabular" + "p" "proportional" "theoremfont") + "Package options for the newpxtext package.") + +;;; newpxtext.el ends here diff --git a/style/pdfpages.el b/style/pdfpages.el new file mode 100644 index 00000000..d0346680 --- /dev/null +++ b/style/pdfpages.el @@ -0,0 +1,135 @@ +;;; pdfpages.el --- AUCTeX style for `pdfpages.sty' (v0.4v) + +;; Copyright (C) 2015 Free Software Foundation, Inc. + +;; Author: Arash Esbati <esbati'at'gmx.de> +;; Maintainer: auctex-devel@gnu.org +;; Created: 2015-05-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 `pdfpages.sty' (v0.4v) from 2013/08/25. +;; `pdfpages.sty' is part of TeXLive. + +;; Thanks to Andreas Matthias for testing this style and writing +;; `pdfpages.sty' in the first place. + +;;; Code: +(defvar LaTeX-pdfpages-key-val-options + '(;; Main options: + ("pages" ("-")) + ("nup") + ("landscape" ("true" "false")) + ;; Layout options: + ("delta") + ("offset") + ("frame" ("true" "false")) + ("column" ("true" "false")) + ("columnstrict" ("true" "false")) + ("openright" ("true" "false")) + ("pagecommand") + ("turn" ("true" "false")) + ("noautoscale" ("true" "false")) + ("fitpaper" ("true" "false")) + ("reflect" ("true" "false")) + ("signature") + ("signature*") + ("booklet" ("true" "false")) + ("picturecommand") + ("picturecommand*") + ("pagetemplate") + ("templatesize") + ("rotateoversize" ("true" "false")) + ("doublepages" ("true" "false")) + ("doublepagestwist" ("true" "false")) + ("doublepagestwistodd" ("true" "false")) + ("doublepagestwist*" ("true" "false")) + ("doublepagestwistodd*" ("true" "false")) + ("duplicatepages") + ;; Miscellaneous options: + ("lastpage") + ;; Hypertext options: + ("link" ("true" "false")) + ("linkname") + ("thread" ("true" "false")) + ("threadname") + ("linktodoc" ("true" "false")) + ;; Additional hypertext options: + ("linkfit" ("Fit" "FitH " "FitV " "FitB" "FitBH " "FitBV " "Region")) + ("linktodocfit" ("/Fit" "/FitH " "/FitV " "/FitB" "/FitBH " "/FitBV " "/Region")) + ("newwindow" ("true" "false")) + ("linkfilename") + ;; Experimental options: (Syntax may change in future versions!) + ("addtotoc") + ("addtolist") + ("survey" ("true" "false")) + ("survey-nolink" ("true" "false")) + ("xr-prefix")) + "Key=value options for pdfpages macros.") + +(TeX-add-style-hook + "pdfpages" + (lambda () + ;; Run style hook for packages loaded by pdfpages; all packages + ;; are required for running LaTeX, but not necessary within AUCTeX + (TeX-run-style-hooks "graphicx" "eso-pic" "everyshi" "ifthen" "calc") + + (TeX-add-symbols + ;; \includepdf[<options>]{<filename>} + '("includepdf" + [TeX-arg-key-val LaTeX-pdfpages-key-val-options] + (TeX-arg-eval + (lambda () + (let ((pdffile (file-relative-name + (read-file-name + "File to include: " nil nil nil nil + (lambda (pdfs) + (string-match "\\.pdf$" pdfs))) + (TeX-master-directory)))) + (format "%s" pdffile))))) + + ;; \includepdfmerge[<options>]{<file-page-list>} + ;; The mandatory argument is complex, we just insert a pair of + ;; braces and leave the rest to the user + '("includepdfmerge" + [TeX-arg-key-val LaTeX-pdfpages-key-val-options] t) + + ;; \includepdfset{<options>} + '("includepdfset" + (TeX-arg-key-val LaTeX-pdfpages-key-val-options)) + + '("threadinfodict" 0)) + + ;; Fontification + (when (and (featurep 'font-latex) + (eq TeX-install-font-lock 'font-latex-setup)) + (font-latex-add-keywords '(("includepdfset" "{")) + 'function) + (font-latex-add-keywords '(("includepdf" "[{") + ("includepdfmerge" "[{")) + 'reference))) + LaTeX-dialect) + +(defvar LaTeX-pdfpages-package-options + '("final" "draft" "enable-survey") + "Prompt for package options for the pdfpages package.") + +;;; pdfpages.el ends here diff --git a/style/tabularx.el b/style/tabularx.el index a0f3ee32..5cfebc83 100644 --- a/style/tabularx.el +++ b/style/tabularx.el @@ -1,6 +1,6 @@ ;;; tabularx.el --- AUCTeX style for the tabularx package. -;; Copyright (C) 2009, 2013 Free Software Foundation, Inc. +;; Copyright (C) 2009, 2013, 2015 Free Software Foundation, Inc. ;; Author: Ralf Angeli <ang...@caeruleus.net> ;; Maintainer: auctex-devel@gnu.org @@ -55,7 +55,11 @@ '("tabularx" LaTeX-env-tabular*)) ;; `tabularx' requires array to define the column types - (TeX-run-style-hooks "array")) + (TeX-run-style-hooks "array") + + ;; `tabularx.sty' adds one new column specification letter. + (set (make-local-variable 'LaTeX-array-column-letters) + (concat LaTeX-array-column-letters "X"))) LaTeX-dialect) ;;; tabularx.el ends here diff --git a/style/tabulary.el b/style/tabulary.el index c17b96e8..30e3a64d 100644 --- a/style/tabulary.el +++ b/style/tabulary.el @@ -52,7 +52,11 @@ '("tabulary" LaTeX-env-tabular*)) ;; `tabulary' requires the array package - (TeX-run-style-hooks "array")) + (TeX-run-style-hooks "array") + + ;; `tabulary.sty' adds some new column specification letters. + (set (make-local-variable 'LaTeX-array-column-letters) + (concat LaTeX-array-column-letters "L" "C" "R" "J"))) LaTeX-dialect) ;;; tabulary.el ends here diff --git a/style/textpos.el b/style/textpos.el new file mode 100644 index 00000000..c2f3e19c --- /dev/null +++ b/style/textpos.el @@ -0,0 +1,111 @@ +;;; textpos.el --- AUCTeX style for `textpos.sty' version v1.7j + +;; Copyright (C) 2015 Free Software Foundation, Inc. + +;; Author: Arash Esbati <esbati'at'gmx.de> +;; Maintainer: auctex-devel@gnu.org +;; Created: 2015-07-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 `textpos.sty' version v1.7j from +;; 2014/01/03. `textpos.sty' is part of TeXLive. + +;;; Code: + +(defun LaTeX-env-arg-textpos-textblock (env) + "Query for the arguments of `textblock' environment and insert +them." + (let* ((hsize (TeX-read-string "Width: ")) + (ho (TeX-read-string "(Optional) X reference point: ")) + (vo (when (not (string-equal ho "")) + (TeX-read-string "Y reference point: "))) + (hpos (TeX-read-string "X placement point: ")) + (vpos (TeX-read-string "Y placement point: "))) + (LaTeX-insert-environment + env + (concat + (when (and hsize (not (string-equal hsize ""))) + (format "{%s}" hsize)) + (when (and ho (not (string-equal ho "")) + vo (not (string-equal vo ""))) + (format "[%s,%s]" ho vo)) + (when (and hpos (not (string-equal hpos "")) + vpos (not (string-equal vpos ""))) + (format "(%s,%s)" hpos vpos)))))) + +(defun LaTeX-arg-textpos-tpgrid (optional) + "Query and insert the optional argument of `\\TPGrid'." + (let* ((x (TeX-read-string "(Optional) X start coordinate: ")) + (y (when (not (string-equal x "")) + (TeX-read-string "Y start coordinate: ")))) + (when (and (not (string-equal x "")) + (not (string-equal y ""))) + (TeX-argument-insert (format "%s,%s" x y) optional)))) + +(TeX-add-style-hook + "textpos" + (lambda () + + (TeX-run-style-hooks "everyshi" "color") + + (LaTeX-add-environments + ;; \begin{textblock}{<hsize>}[<ho>,<vo>](<hpos>,<vpos>) ... \end{textblock} + '("textblock" LaTeX-env-arg-textpos-textblock) + '("textblock*" LaTeX-env-arg-textpos-textblock)) + + (TeX-add-symbols + '("TPGrid" [ LaTeX-arg-textpos-tpgrid ] + "Horizontal fraction" "Vertical fraction") + + '("TPMargin" (TeX-arg-length "Margin around textblock")) + '("TPMargin*" (TeX-arg-length "Margin around textblock")) + + ;; We ignore the `\textblock...color' (i.e. without `u') versions + '("textblockcolour" + (TeX-arg-eval + (lambda () + (let ((color (completing-read "Color name: " + (LaTeX-color-definecolor-list)))) + (format "%s" color))))) + + '("textblockrulecolour" + (TeX-arg-eval + (lambda () + (let ((color (completing-read "Color name: " + (LaTeX-color-definecolor-list)))) + (format "%s" color))))) + + '("TPshowboxestrue") + '("TPshowboxesfalse") + + '("textblocklabel" t) + '("textblockorigin" "Horizontal position" "Vertical position")) + + ;; Add the lengths defined by textpos.sty + (LaTeX-add-lengths "TPHorizModule" "TPVertModule" "TPboxrulesize")) + LaTeX-dialect) + +(defvar LaTeX-textpos-package-options + '("showboxes" "noshowtext" "absolute" "overlay" "verbose" "quiet") + "Package options for the textpos package.") + +;;; textpos.el ends here diff --git a/style/vwcol.el b/style/vwcol.el new file mode 100644 index 00000000..0a74edf8 --- /dev/null +++ b/style/vwcol.el @@ -0,0 +1,71 @@ +;;; vwcol.el --- AUCTeX style for `vwcol.sty' (v0.2) + +;; Copyright (C) 2015 Free Software Foundation, Inc. + +;; Author: Arash Esbati <esbati'at'gmx.de> +;; Maintainer: auctex-devel@gnu.org +;; Created: 2015-07-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 `vwcol.sty' (v0.2) from 2015/02/10. +;; `vwcol.sty' is part of TeXLive. + +;;; Code: + +(defvar LaTeX-vwcol-key-val-options + '(("widths") + ("sep" ("fill")) + ("presep" ("true" "false")) + ("postsep" ("true" "false")) + ("sidesep" ("true" "false")) + ("rule" ("none" "0pt")) + ("prerule" ("true" "false")) + ("postrule" ("true" "false")) + ("siderule" ("true" "false")) + ("justify" ("ragged" "flush" "raggedleft" "center")) + ("rulecolor") + ("indent") + ("lines")) + "Key=value options for vwcol macros and environments.") + +(TeX-add-style-hook + "vwcol" + (lambda () + + (LaTeX-add-environments + '("vwcol" LaTeX-env-args + [ TeX-arg-key-val LaTeX-vwcol-key-val-options ])) + + (TeX-add-symbols + '("vwcolsetup" (TeX-arg-key-val LaTeX-vwcol-key-val-options))) + + ;; Fontification + (when (and (featurep 'font-latex) + (eq TeX-install-font-lock 'font-latex-setup)) + (font-latex-add-keywords '(("vwcolsetup" "{")) + 'function))) + LaTeX-dialect) + +(defvar LaTeX-vwcol-package-options '("quiet") + "Package options for the vwcol package.") + +;;; vwcol.el ends here diff --git a/tex-buf.el b/tex-buf.el index c61ffafe..b5ed3656 100644 --- a/tex-buf.el +++ b/tex-buf.el @@ -1014,7 +1014,7 @@ 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))) + "^\\(LaTeX [A-Za-z]*\\|Package [A-Za-z0-9]+ \\)Warning:" nil t))) (defun TeX-LaTeX-sentinel-has-bad-boxes () "Return non-nil, if LaTeX output indicates overfull or underfull boxes." @@ -1098,6 +1098,11 @@ 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 "^hf-TikZ Warning: Mark '.*' changed\\. \ +Rerun to get mark in right position\\." nil t) + (message + "%s" "You should run LaTeX again to get TikZ marks in right position") + (setq TeX-command-next TeX-command-default)) ((re-search-forward "^\\(\\*\\* \\)?J?I?p?\\(La\\|Sli\\)TeX\\(2e\\)? \ \\(Version\\|ver\\.\\|<[0-9/]*>\\)" nil t) @@ -1748,7 +1753,7 @@ Return non-nil if an error or warning is found." "^\\(\\(?:Overfull\\|Underfull\\|Tight\\|Loose\\)\ \\\\.*?[0-9]+--[0-9]+\\)\\|" ;; LaTeX warning - "^\\(LaTeX [A-Za-z]*\\|Package [A-Za-z]+ \\)Warning:.*")) + "^\\(LaTeX [A-Za-z]*\\|Package [A-Za-z0-9]+ \\)Warning:.*")) (error-found nil)) (while (cond diff --git a/tex.el b/tex.el index ae4bb3d1..07fa371c 100644 --- a/tex.el +++ b/tex.el @@ -763,7 +763,19 @@ If POS is nil, use current buffer location." (defun TeX-activate-region () (setq deactivate-mark nil) - (activate-mark)) + (if (fboundp 'activate-mark) + (activate-mark) + ;; COMPATIBILITY for Emacs <= 22 + ;; This part is adopted from `activate-mark' of Emacs 24.5. + (when (mark t) + (unless (and transient-mark-mode mark-active + (mark)) + (force-mode-line-update) ;Refresh toolbar (bug#16382). + (setq mark-active t) + (unless transient-mark-mode + (setq transient-mark-mode 'lambda)) + (if (boundp 'activate-mark-hook) + (run-hooks 'activate-mark-hook)))))) (defun TeX-overlay-prioritize (start end) "Calculate a priority for an overlay extending from START to END. @@ -1073,28 +1085,29 @@ given, only the minimal requirements needed by backward search are checked. If OPTIONS include `:forward', which is currently the only option, then additional requirements needed by forward search are checked, too." - (and (featurep 'dbusbind) - (require 'dbus nil :no-error) - (dbus-ignore-errors (dbus-get-unique-name :session)) - (dbus-ping :session "org.gnome.evince.Daemon") - (executable-find "evince") - (or (not (memq :forward options)) - (let ((spec (dbus-introspect-get-method - :session "org.gnome.evince.Daemon" - "/org/gnome/evince/Daemon" - "org.gnome.evince.Daemon" - "FindDocument"))) - ;; FindDocument must exist, and its signature must be (String, - ;; Boolean, String). Evince versions between 2.30 and 2.91.x - ;; didn't have the Boolean spawn argument we need to start evince - ;; initially. - (and spec - (equal '("s" "b" "s") - (delq nil (mapcar (lambda (elem) - (when (and (listp elem) - (eq (car elem) 'arg)) - (cdr (caar (cdr elem))))) - spec)))))))) + (let ((dbus-debug nil)) + (and (featurep 'dbusbind) + (require 'dbus nil :no-error) + (dbus-ignore-errors (dbus-get-unique-name :session)) + (dbus-ping :session "org.gnome.evince.Daemon") + (executable-find "evince") + (or (not (memq :forward options)) + (let ((spec (dbus-introspect-get-method + :session "org.gnome.evince.Daemon" + "/org/gnome/evince/Daemon" + "org.gnome.evince.Daemon" + "FindDocument"))) + ;; FindDocument must exist, and its signature must be (String, + ;; Boolean, String). Evince versions between 2.30 and 2.91.x + ;; didn't have the Boolean spawn argument we need to start evince + ;; initially. + (and spec + (equal '("s" "b" "s") + (delq nil (mapcar (lambda (elem) + (when (and (listp elem) + (eq (car elem) 'arg)) + (cdr (caar (cdr elem))))) + spec))))))))) (defun TeX-pdf-tools-sync-view () "Focus the focused page/paragraph in `pdf-view-mode'.