auctex-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-diffs] [elpa] externals/auctex 0844fa2 7/7: Merge remote-trackin


From: Tassilo Horn
Subject: [AUCTeX-diffs] [elpa] externals/auctex 0844fa2 7/7: Merge remote-tracking branch 'origin/master' into externals/auctex
Date: Tue, 29 Dec 2020 12:13:44 -0500 (EST)

branch: externals/auctex
commit 0844fa20e8286d744d7d05fe02429f915323d31d
Merge: b7c3a5f d4165cf
Author: Tassilo Horn <tsdh@gnu.org>
Commit: Tassilo Horn <tsdh@gnu.org>

    Merge remote-tracking branch 'origin/master' into externals/auctex
---
 .dir-locals.el                    |   18 +
 bib-cite.el                       | 1490 ++++++------
 context.el                        |  888 +++----
 font-latex.el                     | 1754 +++++++-------
 latex.el                          | 4616 +++++++++++++++++++------------------
 multi-prompt.el                   |  138 +-
 plain-tex.el                      |   58 +-
 preview.el                        | 3620 ++++++++++++++---------------
 style/Alegreya.el                 |   28 +-
 style/AlegreyaSans.el             |   34 +-
 style/CJK.el                      |    2 +-
 style/FiraMono.el                 |   24 +-
 style/FiraSans.el                 |   34 +-
 style/MinionPro.el                |   10 +-
 style/MyriadPro.el                |   20 +-
 style/XCharter.el                 |   18 +-
 style/acro.el                     |   92 +-
 style/acronym.el                  |   64 +-
 style/algorithm.el                |   18 +-
 style/alltt.el                    |    6 +-
 style/alphanum.el                 |   62 +-
 style/amsfonts.el                 |   14 +-
 style/amsmath.el                  |  122 +-
 style/amsopn.el                   |    4 +-
 style/amstex.el                   |   16 +-
 style/amsthm.el                   |   92 +-
 style/appendix.el                 |    4 +-
 style/arabxetex.el                |   76 +-
 style/array.el                    |   32 +-
 style/article.el                  |    2 +-
 style/attachfile.el               |   28 +-
 style/babel.el                    |  264 +--
 style/baskervaldx.el              |   28 +-
 style/beamer.el                   |  266 +--
 style/biblatex.el                 |  360 +--
 style/bicaption.el                |  144 +-
 style/bidi.el                     |   36 +-
 style/bm.el                       |   40 +-
 style/book.el                     |    2 +-
 style/booktabs.el                 |   28 +-
 style/breqn.el                    |   28 +-
 style/bulgarian.el                |    6 +-
 style/captcont.el                 |    6 +-
 style/caption.el                  |  332 +--
 style/changelog.el                |  120 +-
 style/cleveref.el                 |   98 +-
 style/color.el                    |  178 +-
 style/colortbl.el                 |   36 +-
 style/commath.el                  |   28 +-
 style/comment.el                  |   32 +-
 style/csquotes.el                 |  358 +--
 style/currvita.el                 |   12 +-
 style/danish.el                   |    4 +-
 style/dashundergaps.el            |   34 +-
 style/dcolumn.el                  |    2 +-
 style/dinbrief.el                 |  268 +--
 style/dk-bib.el                   |   38 +-
 style/doc.el                      |   80 +-
 style/emp.el                      |   58 +-
 style/empheq.el                   |  348 +--
 style/enumitem.el                 |  264 +--
 style/environ.el                  |   50 +-
 style/epigraph.el                 |   32 +-
 style/erewhon.el                  |   34 +-
 style/exam.el                     |   86 +-
 style/expl3.el                    |    8 +-
 style/fancyhdr.el                 |    6 +-
 style/fancyref.el                 |   34 +-
 style/fancyvrb.el                 |  576 ++---
 style/fbb.el                      |   26 +-
 style/fbox.el                     |   10 +-
 style/filecontents.el             |   10 +-
 style/flashcards.el               |   16 +-
 style/floatrow.el                 |  494 ++--
 style/foils.el                    |   16 +-
 style/fontaxes.el                 |    4 +-
 style/fontenc.el                  |    6 +-
 style/fontspec.el                 |  254 +-
 style/footmisc.el                 |    6 +-
 style/french.el                   |    6 +-
 style/frenchb.el                  |   10 +-
 style/fvextra.el                  |   70 +-
 style/geometry.el                 |   62 +-
 style/german.el                   |   34 +-
 style/gloss-italian.el            |   26 +-
 style/graphicx.el                 |  224 +-
 style/harvard.el                  |   74 +-
 style/hologo.el                   |  172 +-
 style/hyperref.el                 |   42 +-
 style/icelandic.el                |    4 +-
 style/ifluatex.el                 |   10 +-
 style/imakeidx.el                 |   14 +-
 style/index.el                    |   28 +-
 style/inputenc.el                 |   66 +-
 style/italian.el                  |   20 +-
 style/jarticle.el                 |    2 +-
 style/jbook.el                    |    2 +-
 style/jreport.el                  |    2 +-
 style/jsarticle.el                |    2 +-
 style/jsbook.el                   |    6 +-
 style/jsreport.el                 |    2 +-
 style/jurabib.el                  |  172 +-
 style/kpfonts.el                  |  178 +-
 style/latexinfo.el                |  214 +-
 style/letter.el                   |  160 +-
 style/lettrine.el                 |   18 +-
 style/listings.el                 |  176 +-
 style/longtable.el                |   30 +-
 style/ltugboat.el                 |   92 +-
 style/ltxguide.el                 |   24 +-
 style/ltxtable.el                 |   26 +-
 style/luacode.el                  |   20 +-
 style/luatextra.el                |    6 +-
 style/makeidx.el                  |    8 +-
 style/marginnote.el               |    8 +-
 style/mathtools.el                |  234 +-
 style/mdframed.el                 |  200 +-
 style/mdwlist.el                  |   18 +-
 style/menukeys.el                 |  488 ++--
 style/metalogo.el                 |   36 +-
 style/mflogo.el                   |   10 +-
 style/minted.el                   |  260 +--
 style/mn2e.el                     |   44 +-
 style/mnras.el                    |   12 +-
 style/moodle.el                   |  164 +-
 style/multind.el                  |   24 +-
 style/multirow.el                 |    6 +-
 style/nameref.el                  |   20 +-
 style/natbib.el                   |  164 +-
 style/newfloat.el                 |  124 +-
 style/newpxtext.el                |   10 +-
 style/newtxtext.el                |   10 +-
 style/newtxttt.el                 |   12 +-
 style/ngerman.el                  |   34 +-
 style/nicefrac.el                 |    6 +-
 style/nomencl.el                  |    8 +-
 style/ntheorem.el                 |  276 +--
 style/ocg-p.el                    |   70 +-
 style/ocgx.el                     |   14 +-
 style/overpic.el                  |   48 +-
 style/paracol.el                  |  162 +-
 style/paralist.el                 |   24 +-
 style/pdfpages.el                 |   24 +-
 style/pdfsync.el                  |   88 +-
 style/plext.el                    |   36 +-
 style/polski.el                   |    4 +-
 style/polyglossia.el              |  146 +-
 style/preview.el                  |   28 +-
 style/prosper.el                  |   34 +-
 style/psfig.el                    |   40 +-
 style/pst-node.el                 |    8 +-
 style/pst-plot.el                 |    2 +-
 style/pstricks.el                 |   22 +-
 style/pythontex.el                |  416 ++--
 style/ragged2e.el                 |   14 +-
 style/relsize.el                  |   20 +-
 style/report.el                   |    2 +-
 style/revtex4-2.el                |  102 +-
 style/scholax.el                  |   32 +-
 style/scrbase.el                  |  308 +--
 style/scrbook.el                  |   60 +-
 style/scrlttr2.el                 |  124 +-
 style/scrpage2.el                 |   88 +-
 style/scrreprt.el                 |   18 +-
 style/setspace.el                 |    8 +-
 style/shortvrb.el                 |   16 +-
 style/siunitx.el                  |  102 +-
 style/slides.el                   |    4 +-
 style/slovak.el                   |    4 +-
 style/sourcecodepro.el            |   24 +-
 style/splitidx.el                 |  160 +-
 style/subcaption.el               |   92 +-
 style/subfigure.el                |   44 +-
 style/subfiles.el                 |   28 +-
 style/swedish.el                  |    2 +-
 style/tabularx.el                 |    4 +-
 style/tabulary.el                 |    4 +-
 style/tcolorbox.el                |  256 +-
 style/tcolorboxlib-raster.el      |   98 +-
 style/tex-live.el                 |  108 +-
 style/textpos.el                  |   68 +-
 style/theorem.el                  |   62 +-
 style/thm-restate.el              |   26 +-
 style/thmtools.el                 |  186 +-
 style/tikz.el                     |   12 +-
 style/titleps.el                  |  104 +-
 style/titlesec.el                 |  114 +-
 style/titletoc.el                 |   56 +-
 style/transparent.el              |   10 +-
 style/ulem.el                     |   42 +-
 style/unicode-math.el             |   22 +-
 style/units.el                    |    6 +-
 style/url.el                      |   44 +-
 style/varioref.el                 |   40 +-
 style/verbatim.el                 |   12 +-
 style/virtex.el                   |  142 +-
 style/vwcol.el                    |    8 +-
 style/wrapfig.el                  |  116 +-
 style/xcolor.el                   |  330 +--
 style/xkcdcolors.el               | 1902 +++++++--------
 style/xltabular.el                |   26 +-
 style/xparse.el                   |  252 +-
 style/xspace.el                   |   12 +-
 style/zlmtt.el                    |    4 +-
 tests/japanese/error-parsing.el   |   46 +-
 tests/japanese/parse-timing.el    |   10 +-
 tests/japanese/preview-latex.el   |  226 +-
 tests/latex/font-latex-test.el    |   16 +-
 tests/latex/latex-test.el         |  184 +-
 tests/latex/preview-latex-test.el |    8 +-
 tests/latex/texmathp-test.el      |   24 +-
 tests/tex/command-expansion.el    |   96 +-
 tests/tex/error-parsing.el        |   66 +-
 tests/tex/navigation.el           |    2 +-
 tests/tex/path-expansion.el       |    6 +-
 tex-bar.el                        |  468 ++--
 tex-buf.el                        | 2720 +++++++++++-----------
 tex-fold.el                       |  732 +++---
 tex-font.el                       |  206 +-
 tex-info.el                       |  398 ++--
 tex-ispell.el                     |   30 +-
 tex-jp.el                         |  530 ++---
 tex-mik.el                        |    2 +-
 tex-site.el.in                    |   58 +-
 tex-style.el                      |  174 +-
 tex-wizard.el                     |   94 +-
 tex.el                            | 4380 +++++++++++++++++------------------
 texmathp.el                       |  258 +--
 toolbar-x.el                      | 1500 ++++++------
 229 files changed, 20739 insertions(+), 20699 deletions(-)

diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644
index 0000000..58cf88a
--- /dev/null
+++ b/.dir-locals.el
@@ -0,0 +1,18 @@
+;;; Directory Local Variables
+;;; For more information see (info "(emacs) Directory Variables")
+
+((nil . ((bug-reference-url-format . "https://debbugs.gnu.org/%s";)
+         (fill-column . 70)
+         (sentence-end-double-space . t)
+         (tab-width . 8)))
+ (change-log-mode . ((mode . bug-reference)
+                     (add-log-time-zone-rule . t)
+                     (fill-column . 74)))
+ (emacs-lisp-mode . ((mode . bug-reference-prog)
+                     (electric-quote-comment . nil)
+                     (electric-quote-string . nil)
+                     (indent-tabs-mode . nil)))
+ (texinfo-mode . ((mode . bug-reference-prog)
+                  (electric-quote-comment . nil)
+                  (electric-quote-string . nil)
+                  (fill-column . 74))))
diff --git a/bib-cite.el b/bib-cite.el
index 122a35e..095ccf5 100644
--- a/bib-cite.el
+++ b/bib-cite.el
@@ -596,11 +596,11 @@
 
 ;; Silence the compiler:
 (declare-function dired-replace-in-string "ext:dired"
-                 (regexp newtext string))
+                  (regexp newtext string))
 (declare-function dired-split "ext:dired-aux"
-                 (pat str &optional limit))
+                  (pat str &optional limit))
 (declare-function reftex-view-crossref "ext:reftex-dcr"
-                 (&optional arg auto-how fail-quietly))
+                  (&optional arg auto-how fail-quietly))
 
 (defgroup bib-cite nil
   "bib-cite, LaTeX minor-mode to display \\cite, \\ref and \\label commands."
@@ -625,8 +625,8 @@ 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)))
+                 (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."
@@ -638,7 +638,7 @@ You may use `switch-to-buffer' 
`switch-to-buffer-other-window' or
 If nil, do not display info."
   :group 'bib-cite
   :type '(radio (const :tag "Don't display info" nil)
-               string))
+                string))
 
 (defcustom bib-bibtex-env-variable "BIBINPUTS"
   "Environment variable setting the path where BiBTeX input files are found.
@@ -665,7 +665,7 @@ directory.  You may set this variable to let bib-cite find 
these .aux files."
   :type '(repeat (file :format "%v")))
 
 (defcustom bib-dos-or-os2-variable (or (equal 'emx system-type)
-                                      (equal 'ms-dos 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.
@@ -756,22 +756,22 @@ runs bib-find, and [mouse-3] runs bib-display."
   (interactive "P")
   (set (make-local-variable 'bib-cite-minor-mode)
        (if arg
-          (> (prefix-numeric-value arg) 0)
-        (not bib-cite-minor-mode)))
+           (> (prefix-numeric-value arg) 0)
+         (not bib-cite-minor-mode)))
   (cond
    (bib-cite-minor-mode                 ;Setup the minor-mode
     ;; Christoph Wedler's <wedler@fmi.uni-passau.de> suggestion for xemacs
     ;; Added for version 2.19
     (if (boundp 'tags-always-exact)
-       (progn
-         (set (make-local-variable 'tags-always-exact) nil)))
+        (progn
+          (set (make-local-variable 'tags-always-exact) nil)))
     ;; mouse overlay
     (if bib-highlight-mouse-t
-       (progn
-         (bib-cite-setup-highlight-mouse-keymap)
-         (bib-highlight-mouse)
-         (add-hook 'after-change-functions
-                   'bib-cite-setup-mouse-function nil t))))
+        (progn
+          (bib-cite-setup-highlight-mouse-keymap)
+          (bib-highlight-mouse)
+          (add-hook 'after-change-functions
+                    'bib-cite-setup-mouse-function nil t))))
    (t
    ;;;Undo the minor-mode
     ;; mouse overlay
@@ -780,7 +780,7 @@ runs bib-find, and [mouse-3] runs bib-display."
       ;; 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))))))
+                              '(mouse-face t local-map t))))))
 
 ;;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
@@ -794,24 +794,24 @@ runs bib-find, and [mouse-3] runs bib-display."
    ;;; 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))))
-         ;; 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)))
+        (let ((m (copy-keymap (current-local-map))))
+          ;; 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 ()
@@ -822,10 +822,10 @@ runs bib-find, and [mouse-3] runs bib-display."
   (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)))))
+        (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)))
@@ -853,11 +853,11 @@ runs bib-find, and [mouse-3] runs bib-display."
 ;; Install ourselves:
 (or (assq 'bib-cite-minor-mode minor-mode-alist)
     (setq minor-mode-alist
-         (cons '(bib-cite-minor-mode " BCite") 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)))
+          (cons (cons 'bib-cite-minor-mode bib-cite-minor-mode-map)
+                minor-mode-map-alist)))
 
 
 ;; Following from bibtex.el
@@ -914,7 +914,7 @@ 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
+        ^Display-all-citations          ^Display-this-citation
 
 If text under cursor is a \\ref command, then display environment associated
 with its matching \\label command.
@@ -932,7 +932,7 @@ A TAGS file is created and used for multi-file documents 
under auctex."
     (cond
      ;; reftex doesn't handle label->ref
      ((and bib-cite-use-reftex-view-crossref
-          (memq kind '(ref cite)))
+           (memq kind '(ref cite)))
       ;;;FIXME: reftex doesn't want point on \ref or \cite part, but on keyword
       (require 'reftex)
       (reftex-view-crossref nil))
@@ -947,7 +947,7 @@ A TAGS file is created and used for multi-file documents 
under auctex."
 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
+                        ^Display-this-citation
 
 If text under cursor is a \\ref command, then point is moved to its matching
 \\label command.
@@ -965,7 +965,7 @@ A TAGS file is created and used for multi-file documents 
under auctex."
     (cond
      ;; reftex doesn't handle label->ref
      ((and bib-cite-use-reftex-view-crossref
-          (memq kind '(ref cite)))
+           (memq kind '(ref cite)))
       (require 'reftex)
       (reftex-view-crossref t))
      ((eq kind 'cite)
@@ -986,21 +986,21 @@ find the next occurrence of a regexp."
       ;; FIXME: This check for `xref-find-definitions' should be
       ;; removed once AUCTeX requires Emacs >= 25.1
       (let ((func (if (fboundp 'xref-find-definitions)
-                     'xref-find-definitions
-                   'find-tag)))
-       (if prev-p
-           (funcall func t '- t)
-         (funcall func t t t)))
+                      'xref-find-definitions
+                    'find-tag)))
+        (if prev-p
+            (funcall func t '- t)
+          (funcall func 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))))
+        ;;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)
@@ -1026,40 +1026,40 @@ 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))))
+                       (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))))
     (with-current-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))))
+                  (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*"
-         (mapc #'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")))))
+          (message "Sorry, no matches found.")
+        (with-output-to-temp-buffer "*Help*"
+          (mapc #'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)))))
+          (kill-buffer bib-buffer)))))
 
 (defvar bib-document-citekeys-obarray-warnings nil
   "Bib-cite internal variable.")
@@ -1079,53 +1079,53 @@ 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)))
+                               (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)))
+            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.")))))
+        (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)))
+           (not (facep 'red-bold)))
       (progn
-       (copy-face 'bold 'red-bold)
-       (set-face-foreground 'red-bold "red")))
+        (copy-face 'bold 'red-bold)
+        (set-face-foreground 'red-bold "red")))
   (with-current-buffer "*Help*"
     (let ((before-change-functions) (after-change-functions))
       (put-text-property (point-min)(or limit (point-max))
-                        'face 'red-bold))))
+                         'face 'red-bold))))
 
 (defun bib-cite--fontify-help ()
   ;; FIXME: This looks ugly and incorrect.
@@ -1164,14 +1164,14 @@ to create a bibtex file containing only the references 
used in the document."
       ;; (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 ((?$ . "\""))))))
-       (bib-cite--fontify-help))))))
+             (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 ((?$ . "\""))))))
+        (bib-cite--fontify-help))))))
 
 (defvar bib-document-TeX-files-warnings nil
   "Bib-cite internal variable.")
@@ -1185,10 +1185,10 @@ 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)))
+         (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))
@@ -1199,12 +1199,12 @@ See variables bib-etags-command and bib-etags-filename"
        (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.
-       (with-current-buffer the-tags-buffer
-         (revert-buffer t t)))
+        (with-current-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))
+        (visit-tags-table the-tags-file))
 
     ;(set (make-local-variable 'tags-file-name) the-tags-file))
     ;; above should not be needed
@@ -1217,16 +1217,16 @@ See variables bib-etags-command and bib-etags-filename"
     ;;  To get around this.  I'm setting this variable in the TAGS buffer.
     ;; (Changed by Anders Stenman)
     (if (get-file-buffer the-tags-file)
-       (with-current-buffer (get-file-buffer the-tags-file)
-         (set (make-local-variable 'tags-file-name) the-tags-file))))
+        (with-current-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))))
+        (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."
@@ -1234,10 +1234,10 @@ See variables bib-etags-command and bib-etags-filename"
       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)))))
+          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."
@@ -1253,39 +1253,39 @@ See variables bib-etags-command and bib-etags-filename"
   ;;      )
   (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?
+          (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...
+      (setq bib-ext-list nil)           ;Reconstructed below...
       ;; 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)))
+        (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))
-       (let ((before-change-functions) (after-change-functions)
-             ;;(this-overlay (make-overlay s e))
-             )
+          (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))
+        (let ((before-change-functions) (after-change-functions)
+              ;;(this-overlay (make-overlay s e))
+              )
 ;;;  Even using overlays doesn'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)
-         ))
+          (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 ()
@@ -1295,10 +1295,10 @@ See variables bib-etags-command and bib-etags-filename"
   (if (setq bib-highlight-mouse-t (not bib-highlight-mouse-t))
       (bib-highlight-mouse)
     (let ((modified (buffer-modified-p))
-         (inhibit-read-only t))
+          (inhibit-read-only t))
       (let ((before-change-functions) (after-change-functions))
-       (remove-text-properties (point-min) (point-max)
-                               '(mouse-face local-map)))
+        (remove-text-properties (point-min) (point-max)
+                                '(mouse-face local-map)))
       (set-buffer-modified-p modified))))
 
 (defun bib-label-help-echo (object)
@@ -1312,11 +1312,11 @@ See variables bib-etags-command and bib-etags-filename"
 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"))))
+           (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))))
 
 ;;----------------------------------------------------------------------------
@@ -1329,27 +1329,27 @@ Example with cursor located over cite command or 
arguments:
    ^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))
+           (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))))
+          (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))))
+          "*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))
+          (bib-cite-fontify-red the-warn-point))
       (kill-buffer bib-buffer)
       (kill-buffer work-buffer))))
 
@@ -1360,32 +1360,32 @@ 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"
+                        ^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))
+        (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)))
+         (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)))
+                (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)))
+                               (regexp-quote the-key)
+                               "[ ,\n]") nil t)))
 
 ;;--------------------------------------------------------------------------
 ;; Function for bib-apropos
@@ -1396,11 +1396,11 @@ e.g.: \cite{Wadhams81,Bourke.et.al87,SchneiderBudeus94}
     (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)))))))
+             (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
@@ -1413,7 +1413,7 @@ 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")
+        (message "No name given")
       (bib-display-or-find-label the-regexp t))))
 
 (defun bib-find-label ()
@@ -1435,7 +1435,7 @@ If within a multi-file document (in auctex only)
      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")
+        (message "No name given")
       (bib-display-or-find-label the-regexp nil))))
 
 ;;--------------------------------------------------------------------------
@@ -1444,59 +1444,59 @@ If within a multi-file document (in auctex only)
 (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))
+         (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
+        (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))))))
+        (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))
+        (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)))
+          ;;(switch-to-buffer new-buffer)
+          (funcall bib-switch-to-buffer-function new-buffer)))
     (if (bib-Is-hidden)
-       (save-excursion
-         (beginning-of-line)
-         (show-entry)))))
+        (save-excursion
+          (beginning-of-line)
+          (show-entry)))))
 
 (defvar bib-label-prompt-map
   (let ((map (make-sparse-keymap)))
@@ -1508,36 +1508,36 @@ If within a multi-file document (in auctex only)
   "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))
+             (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)))))
+            (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)))))
+            (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
-             (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
-         (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)))))))
+             (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
+              (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
+          (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."
@@ -1546,34 +1546,34 @@ If within a multi-file document (in auctex only)
     (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)))))
+        (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))
+        (delete-char 1))
     (with-output-to-temp-buffer "*Help*"
       (princ (buffer-substring (point-min) (point-max))))
     (bib-cite-fontify-help-as-latex)
     (kill-buffer "*BiBTemp*"))
    (t
     (with-output-to-temp-buffer ;     display the ref's context
-       "*Help*"
+        "*Help*"
       (princ
        (buffer-substring (save-excursion (forward-line -2)(point))
-                        (save-excursion (forward-line 3)(point)))))
+                         (save-excursion (forward-line 3)(point)))))
     (bib-cite-fontify-help-as-latex))))
 
 (defun bib-display-this-environment ()
@@ -1592,48 +1592,48 @@ Does not save excursion."
 ;;    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))
+        (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))
+                (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)))
+           (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))
+        (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 <steiner@cs.uni-sb.de> patch
-          "\\(^\\|\^M\\)[ \t]*\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*?\
+           "\\(^\\|\^M\\)[ 
\t]*\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*?\
 {\\([^}]*\\)}"
-          nil t)
-         (message (match-string 0))
-       (error
-        "Sorry, could not find an environment or section declaration")))))
+           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.")
@@ -1660,16 +1660,16 @@ into
   (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))))
+            ((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))
 
@@ -1684,160 +1684,160 @@ into
 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
+        (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))
+        (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))
+        (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))))
+        (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...
@@ -1857,42 +1857,42 @@ Comparison is case-insensitive."
     (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)))))
+          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)))
+          (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"))))
+               (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 ()
@@ -1903,23 +1903,23 @@ Comparison is case-insensitive."
       ;; 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)))))
+                                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")))))
+          keys-obarray
+        (error "Sorry, could not find any citation keys in this buffer")))))
 
 ;;---------------------------------------------------------------------------
 ;; Multi-file document programming requirements:
@@ -1949,31 +1949,31 @@ Comparison is case-insensitive."
 If no master file, then return current default."
   (let ((masterfile (bib-master-file)))
     (if masterfile
-       (file-name-directory (expand-file-name (TeX-master-file)))
+        (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 (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)
@@ -2012,41 +2012,41 @@ 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)))
+         (dir (and masterfile (file-name-directory masterfile)))
+         (tex-buffer (get-buffer-create "*tex-document*"))
+         (the-list (list masterfile)))
     (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)")))
+        (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)")))
     (with-current-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))))))
+                                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)))
 
@@ -2058,76 +2058,76 @@ 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))
+        (master-aux))
     (if (not master-tex)
-       nil                             ;Not a multifile document.  No need...
+        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))
+          (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)))
+           (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)))
-       (with-current-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)
+            (keys-obarray (make-vector 201 0)))
+        (with-current-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))))
+          ;; 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)))
+                       (concat (match-string 1 texname) "." ext)
+                     (concat texname "." ext)))
+         (sansdir (file-name-nondirectory filename)))
     (if (file-exists-p filename)
-       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))))))
+        (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.
@@ -2135,17 +2135,17 @@ 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)))
+         (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))
+        (bib-etags master))
     (or (equal the-tags-file-name tags-file-name) ;make sure it's current
-       (visit-tags-table the-tags-file-name))
+        (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...
     (setq new-buffer (find-tag-noselect tag nil t))
-                                       ; -> Seems to set buffer to TAGS
+                                        ; -> Seems to set buffer to TAGS
     (set-buffer the-buffer)
     new-buffer))
 
@@ -2169,16 +2169,16 @@ 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))
+                           (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))
+                      (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))
     (with-current-buffer bib-buffer
       ;; such that forward-sexp works with embeeded \" in german,
       ;; and unbalanced ()
@@ -2194,37 +2194,37 @@ accents embeded in bibtex entries."
       (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
+            (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-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))))
+            (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
-         (with-current-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"))))
+          (with-current-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"))
+        (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 ()
@@ -2235,22 +2235,22 @@ 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")
+                                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)))))
+            (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)))))
 
 (defvar TeX-auto-save)
 (defvar TeX-auto-update)
@@ -2280,7 +2280,7 @@ although BiBTeX doesn't allow it!"
     ;; 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))
+        (setq TeX-header-end LaTeX-header-end))
 
     (TeX-auto-write)))
 
@@ -2293,35 +2293,35 @@ although BiBTeX doesn't allow it!"
   ;;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))
+        (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)))
+          (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))))
+            (setq the-list nil)
+        (setq filespec nil)
+        (setq the-list (cdr the-list))))
     (if filespec
-       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))))
+        (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)
@@ -2329,7 +2329,7 @@ although BiBTeX doesn't allow it!"
 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.
+              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)))
@@ -2337,26 +2337,26 @@ If FIRST-FILE is t, stop after first file is found."
   (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)))))
+             (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))
 
@@ -2380,12 +2380,12 @@ If FIRST-FILE is t, stop after first file is found."
       ;; 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)))))
+        (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
@@ -2400,29 +2400,29 @@ sections which in string was seperated by REGEXP.
 Examples:
 
       (TeX-split-string \"\:\" \"abc:def:ghi\")
-         -> (\"abc\" \"def\" \"ghi\")
+          -> (\"abc\" \"def\" \"ghi\")
 
       (TeX-split-string \" *\" \"dvips -Plw -p3 -c4 testfile.dvi\")
 
-         -> (\"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))))
+             (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 (match-string 1 file))
       (file-directory-p file))))
 
 (defun psg-list-env (env)
@@ -2436,13 +2436,13 @@ bib-dos-or-os2-variable affects:
   (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)))))
+                      (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)))))
       (cl-loop for x in entries if (bib-cite-file-directory-p x) collect x))))
 
 (provide 'bib-cite)
diff --git a/context.el b/context.el
index 6f150d5..cb285ff 100644
--- a/context.el
+++ b/context.el
@@ -177,9 +177,9 @@
 (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"))))
+                   "ConTeXt-project-"
+                   (nth N ConTeXt-project-structure-list)
+                   "-insert"))))
 
 (defun ConTeXt-project-project-insert ()
   "Insert a basic template for a new ConTeXt project."
@@ -199,38 +199,38 @@
   "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")
+            "% 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")
+            (nth 1 ConTeXt-project-structure-list) " myenvironment\n\n")
     (insert "% Put environment charateristics that must be defined at the "
-           "highest level here\n\n")
+            "highest level here\n\n")
     (insert TeX-esc (ConTeXt-environment-stop-name)
-           (nth 1 ConTeXt-project-structure-list))))
+            (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")
+            (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")
+            "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))))
+            (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")
+            (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")
@@ -238,7 +238,7 @@
     (insert "% ... text here ...")
     (newline 2)
     (insert TeX-esc (ConTeXt-environment-stop-name)
-           (nth 3 ConTeXt-project-structure-list))))
+            (nth 3 ConTeXt-project-structure-list))))
 
 
 ;;; Section blocks
@@ -269,19 +269,19 @@ 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
+        0 : part
+        1 : chapter
+        2 : section
+        3 : subsection
+        4 : subsubsection
+        5 : subsubsubsection
 
 Or:
 
-       0 : title
-       1 : subject
-       2 : subsubject
-       3 : subsubsubject
+        0 : title
+        1 : subject
+        2 : subsubject
+        3 : subsubsubject
 
 The following variables can be set to customize:
 
@@ -290,22 +290,22 @@ The following variables can be set to customize:
 
   (interactive "*P")
   (let* ((val (prefix-numeric-value arg))
-        (ConTeXt-level (cond ((null arg)
-                              (ConTeXt-current-section))
-                             ((listp arg)
-                              (ConTeXt-down-section))
-                             ((< val 0)
-                              (ConTeXt-up-section (- val)))
-                             (t val)))
-        (ConTeXt-name (ConTeXt-numbered-section-name ConTeXt-level))
-        (ConTeXt-title "")
+         (ConTeXt-level (cond ((null arg)
+                               (ConTeXt-current-section))
+                              ((listp arg)
+                               (ConTeXt-down-section))
+                              ((< val 0)
+                               (ConTeXt-up-section (- val)))
+                              (t val)))
+         (ConTeXt-name (ConTeXt-numbered-section-name ConTeXt-level))
+         (ConTeXt-title "")
          (ConTeXt-reference nil)
-        (ConTeXt-done-mark (make-marker)))
+         (ConTeXt-done-mark (make-marker)))
     (newline)
     (run-hooks 'ConTeXt-numbered-section-hook)
     (newline)
     (if (marker-position ConTeXt-done-mark)
-       (goto-char (marker-position ConTeXt-done-mark)))
+        (goto-char (marker-position ConTeXt-done-mark)))
     (set-marker ConTeXt-done-mark nil)))
 
 ;; LaTeX has a max function here, which makes no sense.
@@ -315,9 +315,9 @@ The following variables can be set to customize:
 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)))))
+         (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.
@@ -326,31 +326,31 @@ 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))
+          (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))))
+          (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)
+        (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))))))
+        (while (and (>= (ConTeXt-current-section) current)
+                    (re-search-backward outline-regexp
+                                        nil t)))
+        (ConTeXt-up-section (1- arg))))))
 
 (defvar ConTeXt-numbered-section-list ()
   "ConTeXt-XX-section-list where XX is the current interface.")
@@ -365,17 +365,17 @@ section."
 (defun ConTeXt-numbered-section-name (level)
   "Return the name of the section corresponding to LEVEL."
   (let ((entry (TeX-member level ConTeXt-numbered-section-list
-                          (function (lambda (a b) (equal a (nth 1 b)))))))
+                           (function (lambda (a b) (equal a (nth 1 b)))))))
     (if entry
-       (nth 0 entry)
+        (nth 0 entry)
       nil)))
 
 (defun ConTeXt-unnumbered-section-name (level)
   "Return the name of the section corresponding to LEVEL."
   (let ((entry (TeX-member level ConTeXt-unnumbered-section-list
-                          (function (lambda (a b) (equal a (nth 1 b)))))))
+                           (function (lambda (a b) (equal a (nth 1 b)))))))
     (if entry
-       (nth 0 entry)
+        (nth 0 entry)
       nil)))
 
 (defun ConTeXt-numbered-section-level (name)
@@ -430,10 +430,10 @@ ConTeXt-section-ref: Insert a reference for this section 
command.
 To get a full featured `ConTeXt-section' command, insert
 
  (setq ConTeXt-numbered-section-hook
-                        '(ConTeXt-numbered-section-heading
-                                ConTeXt-section-title
-                                ConTeXt-section-section
-                                ConTeXt-section-ref))
+                         '(ConTeXt-numbered-section-heading
+                                 ConTeXt-section-title
+                                 ConTeXt-section-section
+                                 ConTeXt-section-ref))
 
 in your .emacs file."
   :group 'ConTeXt-macro
@@ -478,10 +478,10 @@ ConTeXt-section-ref: Insert a reference for this section 
command.
 To get a full featured `ConTeXt-section' command, insert
 
  (setq ConTeXt-unnumbered-section-hook
-                        '(ConTeXt-unnumbered-section-heading
-                                ConTeXt-section-title
-                                ConTeXt-section-section
-                                ConTeXt-section-ref))
+                         '(ConTeXt-unnumbered-section-heading
+                                 ConTeXt-section-title
+                                 ConTeXt-section-section
+                                 ConTeXt-section-ref))
 
 in your .emacs file."
   :group 'ConTeXt-macro
@@ -505,24 +505,24 @@ in your .emacs file."
 Insert this hook into `ConTeXt-numbered-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 " ConTeXt-name "): ")
-                ConTeXt-numbered-section-list
-                nil nil nil)))
+                 (concat "Select level (default " ConTeXt-name "): ")
+                 ConTeXt-numbered-section-list
+                 nil nil nil)))
     ;; Update name
     (if (not (zerop (length string)))
-       (setq ConTeXt-name string))))
+        (setq ConTeXt-name string))))
 
 (defun ConTeXt-unnumbered-section-heading ()
   "Hook to prompt for ConTeXt section name.
 Insert this hook into `ConTeXt-unnumbered-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 " ConTeXt-name "): ")
-                ConTeXt-unnumbered-section-list
-                nil nil nil)))
+                 (concat "Select level (default " ConTeXt-name "): ")
+                 ConTeXt-unnumbered-section-list
+                 nil nil nil)))
     ;; Update name
     (if (not (zerop (length string)))
-       (setq ConTeXt-name string))))
+        (setq ConTeXt-name string))))
 
 (defun ConTeXt-section-title ()
   "Hook to prompt for ConTeXt section title.
@@ -538,12 +538,12 @@ which sets the `ConTeXt-name', `ConTeXt-title', and
 assumes the section already is inserted."
   (insert TeX-esc ConTeXt-name)
   (cond ((null ConTeXt-reference))
-       ((zerop (length ConTeXt-reference))
-        (insert ConTeXt-optop)
-        (set-marker ConTeXt-done-mark (point))
-        (insert ConTeXt-optcl))
-       (t
-        (insert ConTeXt-optop ConTeXt-reference ConTeXt-optcl)))
+        ((zerop (length ConTeXt-reference))
+         (insert ConTeXt-optop)
+         (set-marker ConTeXt-done-mark (point))
+         (insert ConTeXt-optcl))
+        (t
+         (insert ConTeXt-optop ConTeXt-reference ConTeXt-optcl)))
   (insert TeX-grop)
   (if (zerop (length ConTeXt-title))
       (set-marker ConTeXt-done-mark (point)))
@@ -559,9 +559,9 @@ Insert this hook into `ConTeXt-numbered-section-hook' to 
prompt for a label to b
 inserted after the sectioning command."
   (setq ConTeXt-reference
         (completing-read
-        (TeX-argument-prompt t nil
-                             "Comma separated list of references")
-        (LaTeX-label-list) nil nil))
+         (TeX-argument-prompt t nil
+                              "Comma separated list of references")
+         (LaTeX-label-list) nil nil))
   ;; No reference or empty string entered?
   (if (string-equal "" ConTeXt-reference)
       (setq ConTeXt-reference nil)))
@@ -575,43 +575,43 @@ inserted after the sectioning command."
    ((with-current-buffer TeX-command-buffer
       (string= ConTeXt-Mark-version "IV"))
     (cond ((TeX-TeX-sentinel-check process name))
-         ((re-search-forward "fatal error: " nil t)
-          (message (concat name ": problems after "
-                           (TeX-current-pages)))
-          (setq TeX-command-next TeX-command-default))
-         (t
-          (message (concat name ": successfully formatted "
-                           (TeX-current-pages)))
-          (setq TeX-command-next TeX-command-Show))))
+          ((re-search-forward "fatal error: " nil t)
+           (message (concat name ": problems after "
+                            (TeX-current-pages)))
+           (setq TeX-command-next TeX-command-default))
+          (t
+           (message (concat name ": successfully formatted "
+                            (TeX-current-pages)))
+           (setq TeX-command-next TeX-command-Show))))
    ;; Mark II
    (t
     (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)))))
+          ((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)))))
   (unless TeX-error-list
     (run-hook-with-args 'TeX-after-compilation-finished-functions
-                       (with-current-buffer TeX-command-buffer
-                         (expand-file-name
-                          (TeX-active-master (TeX-output-extension)))))))
+                        (with-current-buffer TeX-command-buffer
+                          (expand-file-name
+                           (TeX-active-master (TeX-output-extension)))))))
 
 
 ;;; Environments
@@ -634,7 +634,7 @@ inserted after the sectioning command."
   (setq ConTeXt-menu-changed t))
 
 ;; (defvar ConTeXt-environment-list ()
-;;     "ConTeXt-environment-list-XX where XX is the current interface.")
+;;      "ConTeXt-environment-list-XX where XX is the current interface.")
 
 (defvar ConTeXt-environment-history nil)
 
@@ -642,35 +642,35 @@ inserted after the sectioning command."
   "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))))
+         "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))))
+         "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* ((default (cond
-                  ((TeX-near-bobp) "text")
-                  (t ConTeXt-default-environment)))
-        (environment
-         (completing-read (concat "Environment type (default " default "): ")
-                          ConTeXt-environment-list nil nil nil
-                          'ConTeXt-environment-history default)))
+                   ((TeX-near-bobp) "text")
+                   (t ConTeXt-default-environment)))
+         (environment
+          (completing-read (concat "Environment type (default " default "): ")
+                           ConTeXt-environment-list nil nil nil
+                           'ConTeXt-environment-history default)))
     ;; Use `environment' as default for the next time only if it is different
     ;; from the current default.
     (unless (equal environment default)
@@ -678,28 +678,28 @@ With optional ARG, modify current environment."
 
     (let ((entry (assoc environment ConTeXt-environment-list)))
       (if (null entry)
-         (ConTeXt-add-environments (list environment)))
+          (ConTeXt-add-environments (list environment)))
 
       (if arg
-         (ConTeXt-modify-environment environment)
-       (ConTeXt-environment-menu environment)))))
+          (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)))
+                                (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)))
+                               (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)))
 
@@ -708,27 +708,27 @@ With optional ARG, modify current 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))))))
+           (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."
@@ -737,9 +737,9 @@ With optional ARG, modify current environment."
   (let ((empty-line (looking-at "[ \t]*$")))
     (end-of-line)
     (if (not empty-line)
-       (newline)))
+        (newline)))
   (insert TeX-esc (ConTeXt-environment-stop-name)
-         (ConTeXt-current-environment))
+          (ConTeXt-current-environment))
   ;; indent broken, so don't do it.
   ;;(indent-according-to-mode)
   (end-of-line)
@@ -748,26 +748,26 @@ With optional ARG, modify current environment."
 (defun ConTeXt-insert-environment (environment &optional extra)
   "Insert ENVIRONMENT, with optional argument EXTRA."
   (if (and (TeX-active-mark)
-          (not (eq (mark) (point))))
+           (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))
-       )
+        (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))
+        (newline))
     (insert TeX-esc (ConTeXt-environment-start-name) environment)
     (indent-according-to-mode)
     (if extra (insert extra))
@@ -776,7 +776,7 @@ With optional ARG, modify current environment."
     (newline)
     (insert TeX-esc (ConTeXt-environment-stop-name) environment)
     (or (looking-at "[ \t]*$")
-       (save-excursion (newline-and-indent)))
+        (save-excursion (newline-and-indent)))
     (indent-according-to-mode)
     (end-of-line 0)))
 
@@ -833,7 +833,7 @@ An entry looks like: (\"environment\" . function)")
   "Takes current environment and does something on it (todo: documentation)."
   (interactive)
   (let ((fun (cdr (assoc (ConTeXt-current-environment)
-                        ConTeXt-environment-helper))))
+                         ConTeXt-environment-helper))))
     (when (functionp fun)
       (funcall fun))))
 
@@ -851,7 +851,7 @@ An entry looks like: (\"environment\" . function)")
 (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]*"))
+              (looking-at "\\\\stop[a-zA-Z]*"))
     (ConTeXt-last-unended-start)))
 
 (defun ConTeXt-mark-environment (&optional inner)
@@ -873,31 +873,31 @@ 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))
+                        "\\("
+                        (ConTeXt-environment-start-name)
+                        "\\|"
+                        (ConTeXt-environment-stop-name)
+                        "\\)"
+                        ))
+        (level 1))
     ;;jump over the \start... when at the beginning of it.
     (when (looking-at (concat (regexp-quote TeX-esc)
-                             (ConTeXt-environment-start-name)))
+                              (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))))))
+                (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)
+        (beginning-of-line)
       (skip-chars-forward "a-zA-Z"))))
 
 (defun ConTeXt-find-matching-start (&optional inner)
@@ -905,22 +905,22 @@ If INNER is non-nil, go to the point just past before
 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))
+                        "\\("
+                        (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))))))
+                (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
@@ -932,17 +932,17 @@ If INNER is non-nil, go to the point just past the 
\\start... macro."
       ;; 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))))
+        (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))
+        (goto-char pos))
       (unless (bolp)
-       (forward-line)))))
+        (forward-line)))))
 
 ;;; items
 
@@ -975,16 +975,16 @@ If INNER is non-nil, go to the point just past the 
\\start... macro."
 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))
+          (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))))
+                              (LaTeX-label-list))))
     (if (and definition (not (string-equal "" ref)))
-       (LaTeX-add-labels ref))
+        (LaTeX-add-labels ref))
     (ConTeXt-argument-insert ref optional)))
 
 (defun ConTeXt-arg-define-ref (&optional prompt)
@@ -994,7 +994,7 @@ If OPTIONAL, only insert it if not empty, and then use 
square brackets."
 (defun ConTeXt-arg-setup (optional &optional prompt)
   "Prompt for setup arguments."
   (let ((setup (read-from-minibuffer
-               (TeX-argument-prompt optional prompt "Setup"))))
+                (TeX-argument-prompt optional prompt "Setup"))))
     (ConTeXt-argument-insert setup t)))
 
 
@@ -1077,33 +1077,33 @@ header is at the start of a line."
 (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")))))))
+        ((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))
+                           (?\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.
@@ -1115,16 +1115,16 @@ 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)))))
+           (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
@@ -1133,7 +1133,7 @@ An optional fourth (or sixth) element means always 
replace if t."
   "Guess a name for the current header line."
   (save-excursion
     (if (re-search-forward "{\\([^\}]*\\)}" (point-at-eol) t)
-       (match-string 1)
+        (match-string 1)
       (buffer-substring-no-properties (point) (point-at-eol)))))
 
 ;; This imenu also includes commented out chapters. Perhaps a feature
@@ -1147,12 +1147,12 @@ An optional fourth (or sixth) element means always 
replace if t."
     (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))))
+             (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))
 
 
@@ -1177,13 +1177,13 @@ An optional fourth (or sixth) element means always 
replace if t."
   (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))))
+           (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))))))
+          (indent-line-to indent)
+        (save-excursion (indent-line-to indent))))))
 
 (defun ConTeXt-find-indent (&optional virtual)
   "Find the proper indentation of text after point.
@@ -1195,81 +1195,81 @@ else.  There might be text before point."
     (or
      ;; Trust the current indentation, if such info is applicable.
      (and virtual (>= (current-indentation) (current-column))
-         (current-indentation))
+          (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)))
+         (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)
+           (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))))
+                                  (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 (or (> (current-column) (current-indentation))
-                       ;; Continue going back if we are
-                       ;; at a hanging optional group.
-                       (looking-at (regexp-quote ConTeXt-optop)))
-              (backward-sexp 1)))
-        (scan-error
-         (setq up-list-pos (nth 2 err))))
+           (progn
+             (backward-sexp 1)
+             (while (or (> (current-column) (current-indentation))
+                        ;; Continue going back if we are
+                        ;; at a hanging optional group.
+                        (looking-at (regexp-quote ConTeXt-optop)))
+               (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))))))))))
+        ((= (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
@@ -1277,7 +1277,7 @@ else.  There might be text before point."
 (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]*\=\"[^\"]*\"\\)*>\\|</[_A-Za-z][-:_A-Za-z0-9]*>")
-             (looking-at "</[_A-Za-z][-:._A-Za-z0-9]*>"))
+              (looking-at "</[_A-Za-z][-:._A-Za-z0-9]*>"))
     (ConTeXt-last-unended-start-xml)))
 
 (defun ConTeXt-close-xml-tag ()
@@ -1286,8 +1286,8 @@ else.  There might be text before point."
   (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")))
+          (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))))
@@ -1309,7 +1309,7 @@ else.  There might be text before point."
     (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 "\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
@@ -1429,20 +1429,20 @@ else.  There might be text before point."
   "Enable or disable section ENTRY from `ConTeXt-section-list'."
   (let ((level (nth 1 entry)))
     (set (ConTeXt-section-enable-symbol level)
-        (>= level ConTeXt-largest-level))))
+         (>= level ConTeXt-largest-level))))
 
 (defun ConTeXt-numbered-section-menu (level)
   "Insert numbered section from menu."
   (let ((ConTeXt-numbered-section-hook
          (delq 'ConTeXt-numbered-section-heading
-              (copy-sequence ConTeXt-numbered-section-hook))))
+               (copy-sequence ConTeXt-numbered-section-hook))))
     (ConTeXt-section level)))
 
 (defun ConTeXt-unnumbered-section-menu (level)
   "Insert unnumbered section from menu."
   (let ((ConTeXt-unnumbered-section-hook
          (delq 'ConTeXt-unnumbered-section-heading
-              (copy-sequence ConTeXt-unnumbered-section-hook))))
+               (copy-sequence ConTeXt-unnumbered-section-hook))))
     (ConTeXt-section level)))
 
 (defun ConTeXt-numbered-section-menu-entry (entry)
@@ -1465,8 +1465,8 @@ else.  There might be text before point."
   (interactive)
   (if (fboundp 'etexshow)
       (let ()
-       (require 'etexshow)
-       (funcall (symbol-function 'etexshow-cmd)))
+        (require 'etexshow)
+        (funcall (symbol-function 'etexshow-cmd)))
     (error "etexshow is not installed.  Get it from http://levana.de/emacs/";)))
 
 ;; menu itself
@@ -1541,71 +1541,71 @@ else.  There might be text before point."
       (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 section menu...done")
-       (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 environment menu...done")
-       (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 modify environment menu...done")
-       (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 define menu...done")
-       (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 setup menu...done")
-       (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 referencing menu...done")
-       (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 other macro's menu...done")
-       (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 project structure menu...done")
-       (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 block menu...done")
-       (message "Updating section menu...")
-       (easy-menu-change '("ConTeXt") ConTeXt-numbered-section-menu-name
-                         (LaTeX-split-long-menu
-                          (mapcar #'ConTeXt-numbered-section-menu-entry
-                                  ConTeXt-numbered-section-list)))
-       (easy-menu-change '("ConTeXt") ConTeXt-unnumbered-section-menu-name
-                         (LaTeX-split-long-menu
-                          (mapcar #'ConTeXt-unnumbered-section-menu-entry
-                                  ConTeXt-unnumbered-section-list)))
-       (message "Updating section menu...done")
-       (and menu (easy-menu-return-item ConTeXt-mode-menu menu))
-       )))
+        (TeX-update-style)
+        (setq ConTeXt-menu-changed nil)
+        (message "Updating section menu...")
+        (mapc #'ConTeXt-section-enable ConTeXt-section-list)
+        (message "Updating section menu...done")
+        (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 environment menu...done")
+        (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 modify environment menu...done")
+        (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 define menu...done")
+        (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 setup menu...done")
+        (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 referencing menu...done")
+        (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 other macro's menu...done")
+        (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 project structure menu...done")
+        (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 block menu...done")
+        (message "Updating section menu...")
+        (easy-menu-change '("ConTeXt") ConTeXt-numbered-section-menu-name
+                          (LaTeX-split-long-menu
+                           (mapcar #'ConTeXt-numbered-section-menu-entry
+                                   ConTeXt-numbered-section-list)))
+        (easy-menu-change '("ConTeXt") ConTeXt-unnumbered-section-menu-name
+                          (LaTeX-split-long-menu
+                           (mapcar #'ConTeXt-unnumbered-section-menu-entry
+                                   ConTeXt-unnumbered-section-list)))
+        (message "Updating section menu...done")
+        (and menu (easy-menu-return-item ConTeXt-mode-menu menu))
+        )))
 
 ;;; Option expander
 
@@ -1629,7 +1629,7 @@ Use `ConTeXt-Mark-version' to choose the command."
    ((string= ConTeXt-Mark-version "IV")
     (concat
      (if TeX-source-correlate-mode
-        "--synctex=1 ")
+         "--synctex=1 ")
      (unless TeX-interactive-mode
        ConTeXt-texexec-option-nonstop)))
    ;; In any other case fall back on Mark II.
@@ -1637,14 +1637,14 @@ Use `ConTeXt-Mark-version' to choose the command."
     (concat
      (let ((engine (eval (nth 4 (TeX-engine-in-engine-alist TeX-engine)))))
        (when engine
-        (format "--engine=%s " 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)))
+               (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)))))
 
@@ -1718,7 +1718,7 @@ i.e. you do _not_ have to cater for this yourself by 
adding \\\\' or $."
   (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)))))
+                                              ConTeXt-current-interface)))))
 
   ;; Create certain regular expressions based on language
   (setq ConTeXt-indent-item-re (concat "\\\\\\(" (mapconcat #'identity 
ConTeXt-item-list "\\|") "\\)\\>"))
@@ -1744,16 +1744,16 @@ i.e. you do _not_ have to cater for this yourself by 
adding \\\\' or $."
   (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
-        "$\\)"))
+        (concat
+         "[ \t]*\\("
+         (ConTeXt-paragraph-commands-regexp) "\\|"
+         "\\$\\$\\|" ; Plain TeX display math
+         "$\\)"))
   (setq paragraph-separate
-       (concat
-        "[ \t]*\\("
-        "\\$\\$" ; Plain TeX display math
-        "\\|$\\)"))
+        (concat
+         "[ \t]*\\("
+         "\\$\\$" ; Plain TeX display math
+         "\\|$\\)"))
 
   ;; Keybindings and menu
   (use-local-map ConTeXt-mode-map)
@@ -1771,7 +1771,7 @@ i.e. you do _not_ have to cater for this yourself by 
adding \\\\' or $."
   (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))
+        TeX-trailer-start (ConTeXt-trailer-start))
 
   ;; font switch support
   (set (make-local-variable 'TeX-font-list) ConTeXt-font-list)
@@ -1791,16 +1791,16 @@ i.e. you do _not_ have to cater for this yourself by 
adding \\\\' or $."
   (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)))))
+          (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)
diff --git a/font-latex.el b/font-latex.el
index 6c1110f..bf258f1 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -129,15 +129,15 @@ QUOTES has to be a list adhering to the format of an 
element of
 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)))
+        (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)
@@ -179,55 +179,55 @@ Switching from `color' to a number or vice versa does not 
take
 effect unless you call \\[font-lock-fontify-buffer] or restart
 Emacs."
   :type '(choice (number :tag "Scale factor")
-                (const color))
+                 (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)))
+         (set-default symbol value)
+         (unless (eq value 'color)
+           (font-latex-update-sectioning-faces font-latex-sectioning-max 
value)))
   :group 'font-latex)
 
 (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)
-                          ;; Make sure `height-scale' is a floating point
-                          ;; number because `set-face-attribute' treats
-                          ;; integers differently from floating points.
-                          (float font-latex-fontify-sectioning)
-                        1.1)))
+                           ;; Make sure `height-scale' is a floating point
+                           ;; number because `set-face-attribute' treats
+                           ;; integers differently from floating points.
+                           (float 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))))
+           (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.
-       (set-face-attribute face-name nil :height  height-scale)))))
+        (set-face-attribute face-name nil :height  height-scale)))))
 
 (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)
-                          ;; Make sure `height-scale' is a floating point
-                          ;; number because the integer type is treated
-                          ;; differently.
-                          (float font-latex-fontify-sectioning)
-                        1.1)))
+                           ;; Make sure `height-scale' is a floating point
+                           ;; number because the integer type is treated
+                           ;; differently.
+                           (float font-latex-fontify-sectioning)
+                         1.1)))
   (dotimes (num max)
     (let* ((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)))))
+           (face-name (intern (format "font-latex-sectioning-%s-face" num)))
+           (f-inherit (intern (format "font-latex-sectioning-%s-face" (1+ 
num)))))
       (eval
        `(defface ,face-name
-         '((t (:height ,height-scale :inherit ,f-inherit)))
-         (format "Face for sectioning commands at level %s.
+          '((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)))))
+          :group 'font-latex-highlighting-faces)))))
 
 (font-latex-make-sectioning-faces font-latex-sectioning-max)
 
@@ -364,38 +364,38 @@ variable `font-latex-fontify-sectioning'." ',num)
     ("sectioning-0"
      (("part" "*[{"))
      (if (eq font-latex-fontify-sectioning 'color)
-        'font-lock-type-face
+         '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-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-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-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-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-lock-type-face
        'font-latex-sectioning-5-face)
      2 command)
     ("slide-title" () font-latex-slide-title-face 2 command)
@@ -467,30 +467,30 @@ Valid entries are \"warning\", \"variable\", 
\"biblatexnoarg\",
 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
-                                  (let ((face (nth 2 spec)))
-                                    (if (symbolp face) face (eval face))))
-                                 "'.\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-string)))
-                          ,(car spec)))
-                font-latex-built-in-keyword-classes)))
+                 (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
+                                   (let ((face (nth 2 spec)))
+                                     (if (symbolp face) face (eval face))))
+                                  "'.\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-string)))
+                           ,(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.
@@ -508,40 +508,40 @@ use."
   ;; (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.
+         (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) (fboundp (car face)))
-                        face
-                       `',face)
-                    limit)))))
-       ((eq type 'declaration)
-        (eval `(defun ,(intern (concat prefix name)) (limit)
-                 ,(concat "Fontify `" prefix name "' up to LIMIT.
+                  (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) (fboundp (car face)))
+                         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.
+                  (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)))))))
+                  (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'.
@@ -565,54 +565,54 @@ use."
   ;; (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)
-          (8 (font-latex-matched-face 8) append t)
-          (9 (font-latex-matched-face 9) append t)
-          (10 (font-latex-matched-face 10) append t)
-          (11 (font-latex-matched-face 11) 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)))))
+         `(,(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)
+           (8 (font-latex-matched-face 8) append t)
+           (9 (font-latex-matched-face 9) append t)
+           (10 (font-latex-matched-face 10) append t)
+           (11 (font-latex-matched-face 11) 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)))
+          (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'.\n\n"
-                       (if (eq type 'command)
-                           "\
+               ',keywords
+               ,(concat "Buffer-local keywords to add to `"
+                        prefix name "-keywords'.\n\n"
+                        (if (eq type 'command)
+                            "\
 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 described in the doc string of
 `font-latex-user-keyword-classes'."
-                         "\
+                          "\
 This must be a list where each element is a keyword string \(not a
 regular expression\) omitting the leading backslash.")
 
-                       "\n\n\
+                        "\n\n\
 This is an internal variable which should not be set directly.
 Use `font-latex-add-keywords' instead.
 
@@ -623,65 +623,65 @@ Generated by `font-latex-make-built-in-keywords'.")))
       ;; 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 "'.
+               ,(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)
-                        (push keyword multi-char-macros)
-                      (push keyword single-char-macros))))
-                (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) "\\)"))
-                         "\\)"))))))
+               (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)
+                         (push keyword multi-char-macros)
+                       (push keyword single-char-macros))))
+                 (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)
-                           "\
+               ,(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\
+                        "\n\n\
 Setting this variable directly does not take effect; restart
 Emacs.
 
 Generated by `font-latex-make-built-in-keywords'.")
-              :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))
+               :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)) nil
-              ,(concat "Regular expression to match " name
-                       " keywords.
+               ,(concat "Regular expression to match " name
+                        " keywords.
 
 Generated by `font-latex-make-built-in-keywords'")))
       (make-variable-buffer-local (intern (concat prefix name)))
@@ -691,13 +691,13 @@ Generated by `font-latex-make-built-in-keywords'")))
 
       ;; 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 'font-latex-keywords-2
-                      keywords-entry t))))))
+                             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 'font-latex-keywords-2
+                       keywords-entry t))))))
 (font-latex-make-built-in-keywords)
 
 (defcustom font-latex-user-keyword-classes nil
@@ -750,112 +750,112 @@ Setting this variable directly does not take effect;
 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"))))
-                      ,'(choice (face :tag "Face name")
-                                (custom-face-edit :tag "Face attributes"))
-                      (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))))
+                       (choice (repeat :tag "Keywords" (string :tag "Keyword"))
+                               (repeat
+                                :tag "Keywords with specs"
+                                (group (string :tag "Keyword")
+                                       (string :tag "Format specifier"))))
+                       ,'(choice (face :tag "Face name")
+                                 (custom-face-edit :tag "Face attributes"))
+                       (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
-                       ,(concat "Regular expression to match " (car elt)
-                                " keywords.
+         (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
+                        ,(concat "Regular expression to match " (car elt)
+                                 " keywords.
 
 Generated by `font-latex-user-keyword-classes'"))))
-            (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 "\\>")))))))))
+             (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)))
+            (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.
+        ;; 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-*
-       (font-latex-make-match-defun prefix name face type)
+        ;; defun font-latex-match-*
+        (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 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)
-            (font-latex-match-dollar-math 0 'font-latex-math-face keep)
-            (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.
-            ("\\(\\\\\\)end"
-             (1 (get-text-property (match-end 1) 'face) t))))
+           '(("\\(^\\|[^\\]\\)\\(&+\\)" 2 'font-latex-warning-face)
+             (font-latex-match-dollar-math 0 'font-latex-math-face keep)
+             (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.
+             ("\\(\\\\\\)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
-             (1 '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))
-            (font-latex-match-script-chars
-             (1 (font-latex-script-char (match-beginning 1)) prepend))))
+           '((font-latex-match-math-env
+              (0 'font-latex-warning-face t t)
+              (1 'font-latex-math-face append t))
+             (font-latex-match-math-envII
+              (1 '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))
+             (font-latex-match-script-chars
+              (1 (font-latex-script-char (match-beginning 1)) prepend))))
     (add-to-list 'font-latex-keywords-2 item t)))
 (font-latex-make-user-keywords)
 
@@ -874,7 +874,7 @@ 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))))
+         (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)))
@@ -908,13 +908,13 @@ If this variable is set to the symbol `invisible', then 
the
 effect is essentially like `multi-level' but additionally the
 script operators ^ and _ are not displayed."
   :type '(choice (boolean :tag "Enabled")
-                (const :tag "Multiple levels" multi-level)
-                (const :tag "Hide ^ and _" invisible))
+                 (const :tag "Multiple levels" multi-level)
+                 (const :tag "Hide ^ and _" invisible))
   :group 'font-latex)
 (put 'font-latex-fontify-script 'safe-local-variable
      (lambda (val)
        (or (booleanp val)
-          (memq val '(multi-level invisible)))))
+           (memq val '(multi-level invisible)))))
 
 (defcustom font-latex-fontify-script-max-level 3
   "Maximum scriptification level for which script faces are applied.
@@ -946,9 +946,9 @@ and y is smaller than x."
 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))))
+                       (const :tag "No lowering" nil))
+               (choice (sexp :tag "Superscript form")
+                       (const :tag "No raising" nil))))
 
 
 ;;; Syntactic keywords
@@ -973,88 +973,88 @@ 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))))
+                        (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)
+          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 "\\)}"
-                      ;; Some environments accept an optional and/or mandatory
-                      ;; argument that can span over more lines.  Between
-                      ;; "\begin{<envname>}" and the optional argument there
-                      ;; can be whitespaces and the newline can be commented
-                      ;; by a "%" character.
-                      "[ \t]*\\(?:%.*\n[ \t]*\\)?"
-                      ;; The following line of the regexp matches the optional
-                      ;; argument and allows for up to one level of brackets
-                      ;; inside the argument (e.g., the dialect of a language
-                      ;; in the `lstlisting' environment by the `listings'
-                      ;; package).
-                      "\\(?:\\[[^\]\[]*\\(?:\\[[^\]\[]*\\][^\]\[]*\\)*\\]\\)?"
-                      ;; After the optional argument, there may also be
-                      ;; another mandatory argument(s) (e.g. with VerbatimOut 
or
-                      ;; the minted envs or defined with `lstnewenvironment').
-                      "\\(?:{[^}]*}\\)*"
-                      ;; Now match the final newline.  The "." alternative
-                      ;; catches the case where verbatim content is written
-                      ;; immediately after the \begin{verbatim}.
-                      "\\(\n\\|.\\)")
-                    (1 "|" t)))
+                   `(,(concat
+                       "^[ \t]*\\\\begin *{\\(?:" verb-envs "\\)}"
+                       ;; Some environments accept an optional and/or mandatory
+                       ;; argument that can span over more lines.  Between
+                       ;; "\begin{<envname>}" and the optional argument there
+                       ;; can be whitespaces and the newline can be commented
+                       ;; by a "%" character.
+                       "[ \t]*\\(?:%.*\n[ \t]*\\)?"
+                       ;; The following line of the regexp matches the optional
+                       ;; argument and allows for up to one level of brackets
+                       ;; inside the argument (e.g., the dialect of a language
+                       ;; in the `lstlisting' environment by the `listings'
+                       ;; package).
+                       "\\(?:\\[[^\]\[]*\\(?:\\[[^\]\[]*\\][^\]\[]*\\)*\\]\\)?"
+                       ;; After the optional argument, there may also be
+                       ;; another mandatory argument(s) (e.g. with VerbatimOut 
or
+                       ;; the minted envs or defined with `lstnewenvironment').
+                       "\\(?:{[^}]*}\\)*"
+                       ;; Now match the final newline.  The "." alternative
+                       ;; catches the case where verbatim content is written
+                       ;; immediately after the \begin{verbatim}.
+                       "\\(\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 "\\(\\\\\\)end *{\\(?:" verb-envs "\\)}")
-                    (1 "|" t))))
+                   ;; 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 "\\(\\\\\\)end *{\\(?:" verb-envs "\\)}")
+                     (1 "|" t))))
     (unless (= (length verb-macros-with-delims) 0)
       (add-to-list 'font-latex-syntactic-keywords
-                  `(,(concat "\\\\\\(?:" verb-macros-with-delims "\\)"
-                             ;; Some macros take an optional
-                             ;; argument.  This is the same line as
-                             ;; above for environments.
-                             "\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?"
-                             ;; 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 "\""))))
+                   `(,(concat "\\\\\\(?:" verb-macros-with-delims "\\)"
+                              ;; Some macros take an optional
+                              ;; argument.  This is the same line as
+                              ;; above for environments.
+                              
"\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?"
+                              ;; 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 "\\)"
-                             ;; Some macros take an optional
-                             ;; argument.  This is the same line as
-                             ;; above for environments.
-                             "\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?"
-                             "\\({\\).*?[^\\]\\(?:\\\\\\\\\\)*\\(}\\)")
-                    (1 "|") (2 "|")))))
+                   `(,(concat "\\\\\\(?:" verb-macros-with-braces "\\)"
+                              ;; Some macros take an optional
+                              ;; argument.  This is the same line as
+                              ;; above for environments.
+                              
"\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?"
+                              "\\({\\).*?[^\\]\\(?:\\\\\\\\\\)*\\(}\\)")
+                     (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)))))))
+        (append font-latex-syntactic-keywords
+                ;; For docTeX comment-in-doc.
+                '(("\\(\\^\\)\\^A" (1 (font-latex-doctex-^^A)))))))
 
 
 ;;; Syntactic fontification
@@ -1068,8 +1068,8 @@ have changed."
 
 (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)))))
+                    ((assq :weight custom-face-attributes) '(:weight bold))
+                    (t '(:bold t)))))
     `((((class grayscale) (background light))
        (:foreground "DimGray" ,@font))
       (((class grayscale) (background dark))
@@ -1084,8 +1084,8 @@ have changed."
 
 (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)))))
+                    ((assq :slant custom-face-attributes) '(:slant italic))
+                    (t '(:italic t)))))
     `((((class grayscale) (background light))
        (:foreground "DimGray" ,@font))
       (((class grayscale) (background dark))
@@ -1100,8 +1100,8 @@ have changed."
 
 (defface font-latex-math-face
   (let ((font (cond ((assq :inherit custom-face-attributes)
-                    '(:inherit underline))
-                   (t '(:underline t)))))
+                     '(:inherit underline))
+                    (t '(:underline t)))))
     `((((class grayscale) (background light))
        (:foreground "DimGray" ,@font))
       (((class grayscale) (background dark))
@@ -1126,8 +1126,8 @@ have changed."
 
 (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)))))
+                    ((assq :slant custom-face-attributes) '(:slant italic))
+                    (t '(:italic t)))))
     `((((type tty) (class color))
        (:foreground "green"))
       (((class grayscale) (background light))
@@ -1144,8 +1144,8 @@ have changed."
 
 (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)))))
+                    ((assq :weight custom-face-attributes) '(:weight bold))
+                    (t '(:bold t)))))
     `((((class grayscale)(background light))
        (:foreground "DimGray" ,@font))
       (((class grayscale)(background dark))
@@ -1160,9 +1160,9 @@ have changed."
 
 (defface font-latex-verbatim-face
   (let ((font (if (and (assq :inherit custom-face-attributes)
-                      (facep 'fixed-pitch))
-                 '(:inherit fixed-pitch)
-               '(:family "courier"))))
+                       (facep 'fixed-pitch))
+                  '(:inherit fixed-pitch)
+                '(:family "courier"))))
     `((((class grayscale) (background light))
        (:foreground "DimGray" ,@font))
       (((class grayscale) (background dark))
@@ -1187,8 +1187,8 @@ have changed."
 
 (defface font-latex-script-char-face
   (let ((font (cond ((assq :inherit custom-face-attributes)
-                    '(:inherit underline))
-                   (t '(:underline t)))))
+                     '(:inherit underline))
+                    (t '(:underline t)))))
     `((((class grayscale) (background light))
        (:foreground "DarkGray" ,@font))
       (((class grayscale) (background dark))
@@ -1204,7 +1204,7 @@ have changed."
 (defface font-latex-slide-title-face
   (let* ((scale 1.2))
     `((t (:inherit (variable-pitch font-lock-type-face)
-                  :weight bold :height ,scale))))
+                   :weight bold :height ,scale))))
   "Face for slide titles."
   :group 'font-latex-highlighting-faces)
 
@@ -1257,21 +1257,21 @@ triggers Font Lock to recognize the change."
   ;; `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-mark-block-function . mark-paragraph)
-          (font-lock-fontify-region-function
-           . font-latex-fontify-region)
-          (font-lock-unfontify-region-function
-           . font-latex-unfontify-region)
+          `((font-latex-keywords font-latex-keywords-1 font-latex-keywords-2)
+            nil nil ,font-latex-syntax-alist nil))
+        (variables
+         '((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)
            (font-lock-extend-region-functions
             font-lock-extend-region-wholelines
             font-lock-extend-region-multiline
             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)
+            font-latex-extend-region-backwards-command-in-braces
+            font-latex-extend-region-backwards-quotation
+            font-latex-extend-region-backwards-math)
            (syntax-propertize-function
             . font-latex-syntax-propertize-function)
            (syntax-propertize-extend-region-functions
@@ -1281,15 +1281,15 @@ triggers Font Lock to recognize the change."
     (if (eq major-mode 'doctex-mode)
         (progn
           (setcar defaults (append (car defaults)
-                                  '(font-latex-doctex-keywords)))
+                                   '(font-latex-doctex-keywords)))
           (setq variables
-               (append variables
-                       '((font-lock-syntactic-face-function
-                          . font-latex-doctex-syntactic-face-function)))))
+                (append variables
+                        '((font-lock-syntactic-face-function
+                           . font-latex-doctex-syntactic-face-function)))))
       (setq variables
             (append variables
-                   '((font-lock-syntactic-face-function
-                      . font-latex-syntactic-face-function)))))
+                    '((font-lock-syntactic-face-function
+                       . font-latex-syntactic-face-function)))))
     ;; Set the defaults.
     (setq font-lock-defaults (append defaults variables)))
 
@@ -1341,8 +1341,8 @@ Take care when the actually fonfified region was extended 
beyond END."
     ;; COMPATIBILITY for older emacsen. Return value for jit-lock
     ;; is meaningful for only newer emacsen.
     (if (eq (car-safe res) 'jit-lock-bounds)
-       `(jit-lock-bounds ,(cadr res) .
-                         ,(max (cddr res) font-latex--updated-region-end)))))
+        `(jit-lock-bounds ,(cadr res) .
+                          ,(max (cddr res) font-latex--updated-region-end)))))
 
 ;; Copy and adaption of `tex-font-lock-unfontify-region' from
 ;; tex-mode.el in GNU Emacs on 2004-08-04.
@@ -1353,10 +1353,10 @@ Take care when the actually fonfified region was 
extended beyond END."
   (remove-list-of-text-properties beg end '(script-level invisible))
   (while (< beg end)
     (let ((next (next-single-property-change beg 'display nil end))
-         (prop (get-text-property beg 'display)))
+          (prop (get-text-property beg 'display)))
       (if (and (eq (car-safe prop) 'raise)
-              (null (cddr prop)))
-         (put-text-property beg next 'display nil))
+               (null (cddr prop)))
+          (put-text-property beg next 'display nil))
       (setq beg next))))
 
 (defun font-latex-after-hacking-local-variables ()
@@ -1372,9 +1372,9 @@ modified.  Such variables include
       ;; locals.  Note to self: directory-local variables are also added
       ;; to file-local-variables-alist.
       (let ((hacked-local-vars (mapcar #'car file-local-variables-alist)))
-       (or (memq 'LaTeX-verbatim-environments-local hacked-local-vars)
-           (memq 'LaTeX-verbatim-macros-with-braces-local hacked-local-vars)
-           (memq 'LaTeX-verbatim-macros-with-delims-local hacked-local-vars)))
+        (or (memq 'LaTeX-verbatim-environments-local hacked-local-vars)
+            (memq 'LaTeX-verbatim-macros-with-braces-local hacked-local-vars)
+            (memq 'LaTeX-verbatim-macros-with-delims-local hacked-local-vars)))
     ;; Ok, we need to refresh syntactic fontification.
     (font-latex-set-syntactic-keywords)))
 
@@ -1386,46 +1386,46 @@ 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))
+         (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))))
+         (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)))))))
+                   (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
+         t
        (goto-char init-point)
        nil))))
 
@@ -1433,34 +1433,34 @@ ignored during the search."
   "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 "\\")))
+          (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)))))))
+               (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))))
+         (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))))))
+        (when (memq item faces)
+          (throw 'member t))))))
 
 (defun font-latex-forward-comment ()
   "Like `forward-comment' but with special provisions for docTeX mode.
@@ -1468,11 +1468,11 @@ 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))
+        (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)))
 
 ;;; Match functions
@@ -1502,100 +1502,100 @@ Returns nil if none of KEYWORDS is found."
   (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 (list beg))
-              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
-         (goto-char (match-end 0))
-         ;; Check for starred macro if first spec is an asterisk or a
-         ;; plus sign in case of \defaultfontfeatures+ provided by
-         ;; fontspec.sty
-         (when (or (eq (car spec-list) ?*)
-                   (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.
-         (nconc match-data (list (point)))
-         (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-syntax-forward "_w"))
-                                        (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))
-         (store-match-data match-data)
-         (throw 'match t))))))
+                                            font-latex-verbatim-face)
+                                          (match-beginning 0))
+        (let* ((beg (match-beginning 0))
+               end                 ; Used for multiline text property.
+               (match-data (list beg))
+               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
+          (goto-char (match-end 0))
+          ;; Check for starred macro if first spec is an asterisk or a
+          ;; plus sign in case of \defaultfontfeatures+ provided by
+          ;; fontspec.sty
+          (when (or (eq (car spec-list) ?*)
+                    (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.
+          (nconc match-data (list (point)))
+          (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-syntax-forward "_w"))
+                                         (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))
+          (store-match-data match-data)
+          (throw 'match t))))))
 
 ;; Those are dynamically bound by font-lock.
 (defvar font-lock-beg)
@@ -1607,14 +1607,14 @@ Returns nil if none of KEYWORDS is found."
     (goto-char font-lock-end)
     (catch 'extend
       (while (TeX-search-backward-unescaped "}" font-lock-beg t)
-       (let ((macro-start
+        (let ((macro-start
                (TeX-find-macro-start
-               (max (point-min)
-                    (- font-lock-beg font-latex-multiline-boundary)))))
-         (when (and macro-start
-                    (< macro-start font-lock-beg))
+                (max (point-min)
+                     (- font-lock-beg font-latex-multiline-boundary)))))
+          (when (and macro-start
+                     (< macro-start font-lock-beg))
             (setq font-lock-beg macro-start)
-           (throw 'extend t)))))))
+            (throw 'extend t)))))))
 
 (defun font-latex-match-command-in-braces (keywords limit)
   "Search for command like {\\bfseries fubar} before LIMIT.
@@ -1626,36 +1626,36 @@ 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))
-             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 ?\{ ?\})
-                 (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))))))))
+                                            font-latex-verbatim-face)
+                                          (match-beginning 0))
+        (let ((kbeg (match-beginning 0)) (kend (match-end 1))
+              (beg  (match-end 0))
+              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 ?\{ ?\})
+                  (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 ()
   "Extend region backwards for commands in braces."
@@ -1663,22 +1663,22 @@ Returns nil if no command is found."
     (goto-char font-lock-end)
     (catch 'extend
       (while (TeX-search-backward-unescaped "}" font-lock-beg t)
-       (let ((group-start
+        (let ((group-start
                (TeX-find-opening-brace
-               nil (max (point-min)
-                        (- font-lock-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 font-lock-beg)
+                nil (max (point-min)
+                         (- font-lock-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 font-lock-beg)
               (setq font-lock-beg group-start)
-             (throw 'extend t))))))))
+              (throw 'extend t))))))))
 
 (defvar font-latex-match-simple-exclude-list
   '("-" "," "/" "&" "#" "_" "`" "'" "^" "~" "=" "." "\"")
@@ -1704,8 +1704,8 @@ cases.")
   ;; remove "_" from this list to get correct fontification for macros
   ;; like `\__module_foo:nnn'
   (let* ((search (lambda ()
-                  (TeX-re-search-forward-unescaped
-                   (concat
+                   (TeX-re-search-forward-unescaped
+                    (concat
                      ;; Chars directly after backslash
                      "\\\\\\(\\s_\\|\\sw\\|\\s.\\)"
                      ;; Start group of the following chars
@@ -1718,13 +1718,13 @@ cases.")
                                   "")
                      ;; End group
                      "]\\)*")
-                   limit t)))
-        (pos (funcall search)))
+                    limit t)))
+         (pos (funcall search)))
     (while (and pos
-               (member (match-string 1)
-                       (if (eq major-mode 'doctex-mode)
-                           (remove "_" font-latex-match-simple-exclude-list)
-                         font-latex-match-simple-exclude-list)))
+                (member (match-string 1)
+                        (if (eq major-mode 'doctex-mode)
+                            (remove "_" font-latex-match-simple-exclude-list)
+                          font-latex-match-simple-exclude-list)))
       (setq pos (funcall search)))
     pos))
 
@@ -1736,36 +1736,36 @@ Used for patterns like:
   (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 font-latex-multiline-boundary)
-                                     'move)
-                  (string= (match-string 1) close-tag))
-             ;; Found closing tag.
-             (let ((p (point)))
-               (if (< font-latex--updated-region-end limit)
-                   ;; *-extend-region-functions have extended the
-                   ;; limit already.
-                   (setq font-latex--updated-region-end limit))
-               ;; If the closing tag is beyond the current end of
-               ;; region, take care of it.
-               (when (< font-latex--updated-region-end p)
-                 (font-lock-unfontify-region font-latex--updated-region-end p)
-                 (setq font-latex--updated-region-end p))
-               (store-match-data (list beg beg beg p)))
-           ;; Did not find closing tag.
-           (goto-char (+ beg 2))
-           (store-match-data (list beg (point) (point) (point))))
-         (throw 'match t))))))
+                (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 font-latex-multiline-boundary)
+                                      'move)
+                   (string= (match-string 1) close-tag))
+              ;; Found closing tag.
+              (let ((p (point)))
+                (if (< font-latex--updated-region-end limit)
+                    ;; *-extend-region-functions have extended the
+                    ;; limit already.
+                    (setq font-latex--updated-region-end limit))
+                ;; If the closing tag is beyond the current end of
+                ;; region, take care of it.
+                (when (< font-latex--updated-region-end p)
+                  (font-lock-unfontify-region font-latex--updated-region-end p)
+                  (setq font-latex--updated-region-end p))
+                (store-match-data (list beg beg beg p)))
+            ;; Did not find closing tag.
+            (goto-char (+ beg 2))
+            (store-match-data (list beg (point) (point) (point))))
+          (throw 'match t))))))
 
 (require 'texmathp)
 (defcustom font-latex-math-environments nil
@@ -1797,21 +1797,21 @@ environments in `font-latex-math-environments'."
   (let (envs)
     (dolist (entry texmathp-tex-commands1)
       (if (and (eq 'env-on (cadr entry))
-              (not (string= "*" (substring (car entry) -1))))
-         (cl-pushnew (car entry) envs :test #'equal)))
+               (not (string= "*" (substring (car entry) -1))))
+          (cl-pushnew (car entry) envs :test #'equal)))
     (setq font-latex--match-math-envII-regexp
-         (concat "\\\\begin[ \t]*{"
-                 ;; Take user additions also into account.
-                 (regexp-opt (append font-latex-math-environments envs) t)
-                 ;; Subexpression 2 is used to build the \end{<env>}
-                 ;; construct later.
-                 "\\(\\*?}\\)"
-                 ;; Match an optional and possible mandatory
-                 ;; argument(s) as long as they are on the same line
-                 ;; with no spaces in-between. The content of optional
-                 ;; argument can span multiple lines.
-                 "\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?"
-                 "\\(?:{[^}]*}\\)*"))))
+          (concat "\\\\begin[ \t]*{"
+                  ;; Take user additions also into account.
+                  (regexp-opt (append font-latex-math-environments envs) t)
+                  ;; Subexpression 2 is used to build the \end{<env>}
+                  ;; construct later.
+                  "\\(\\*?}\\)"
+                  ;; Match an optional and possible mandatory
+                  ;; argument(s) as long as they are on the same line
+                  ;; with no spaces in-between. The content of optional
+                  ;; argument can span multiple lines.
+                  "\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?"
+                  "\\(?:{[^}]*}\\)*"))))
 
 ;; Initialize.
 (font-latex-update-math-env)
@@ -1829,23 +1829,23 @@ The \\begin{equation} incl. arguments in the same line 
and
 \\end{equation} are not fontified here."
   (when (re-search-forward font-latex--match-math-envII-regexp limit t)
     (let ((beg (match-end 0)) end
-         (beg-of-begin (match-beginning 0)))
+          (beg-of-begin (match-beginning 0)))
       (if (re-search-forward (concat "\\\\end[ \t]*{"
-                                    (regexp-quote
-                                     (buffer-substring-no-properties
-                                      (match-beginning 1)
-                                      (match-end 2))))
-                            (+ limit font-latex-multiline-boundary) 'move)
-         (progn
-           (setq end (match-beginning 0))
-           (if (< font-latex--updated-region-end limit)
-               (setq font-latex--updated-region-end limit))
-           (when (< font-latex--updated-region-end end)
-             (font-lock-unfontify-region font-latex--updated-region-end end)
-             (setq font-latex--updated-region-end end)))
-       (goto-char beg)
-       (setq end beg
-             beg-of-begin beg))
+                                     (regexp-quote
+                                      (buffer-substring-no-properties
+                                       (match-beginning 1)
+                                       (match-end 2))))
+                             (+ limit font-latex-multiline-boundary) 'move)
+          (progn
+            (setq end (match-beginning 0))
+            (if (< font-latex--updated-region-end limit)
+                (setq font-latex--updated-region-end limit))
+            (when (< font-latex--updated-region-end end)
+              (font-lock-unfontify-region font-latex--updated-region-end end)
+              (setq font-latex--updated-region-end end)))
+        (goto-char beg)
+        (setq end beg
+              beg-of-begin beg))
       ;; Store the position of "\begin{foo}" as (match-beginnig 0) so
       ;; that `font-lock-multiline' text property covers it. This keeps
       ;; editing inside multi-line optional argument sane.
@@ -1857,33 +1857,33 @@ The \\begin{equation} incl. arguments in the same line 
and
   (catch 'match
     (let (beg num)
       (while (font-latex-find-dollar-math limit)
-       ;; Found "$" which starts $...$ or $$...$$.
-       (setq beg (point)
-             ;; Go inside the math expression.
-             num (skip-chars-forward "$" limit))
-       ;; If those are three or more consecutive $, ignore them and
-       ;; search again.
-       (if (< num 3)
-           (if ;; Let's find the same number of live dollar signs.
-               (font-latex-find-dollar-math
-                ;; Hope that limit+font-latex-multiline-boundary
-                ;; doesn't fall just inside single "$$".
-                (+ limit font-latex-multiline-boundary) num)
-               ;; Found.
-               (progn
-                 (forward-char num)
-                 (let ((p (point)))
-                   (if (< font-latex--updated-region-end limit)
-                       (setq font-latex--updated-region-end limit))
-                   (when (< font-latex--updated-region-end p)
-                     (font-lock-unfontify-region
-                      font-latex--updated-region-end p)
-                     (setq font-latex--updated-region-end p))
-                   (set-match-data (list beg p)))
-                 (throw 'match t))
-             ;; Not found.
-             ;; That $ or $$ is probably unclosed in the buffer.
-             (throw 'match nil)))))))
+        ;; Found "$" which starts $...$ or $$...$$.
+        (setq beg (point)
+              ;; Go inside the math expression.
+              num (skip-chars-forward "$" limit))
+        ;; If those are three or more consecutive $, ignore them and
+        ;; search again.
+        (if (< num 3)
+            (if ;; Let's find the same number of live dollar signs.
+                (font-latex-find-dollar-math
+                 ;; Hope that limit+font-latex-multiline-boundary
+                 ;; doesn't fall just inside single "$$".
+                 (+ limit font-latex-multiline-boundary) num)
+                ;; Found.
+                (progn
+                  (forward-char num)
+                  (let ((p (point)))
+                    (if (< font-latex--updated-region-end limit)
+                        (setq font-latex--updated-region-end limit))
+                    (when (< font-latex--updated-region-end p)
+                      (font-lock-unfontify-region
+                       font-latex--updated-region-end p)
+                      (setq font-latex--updated-region-end p))
+                    (set-match-data (list beg p)))
+                  (throw 'match t))
+              ;; Not found.
+              ;; That $ or $$ is probably unclosed in the buffer.
+              (throw 'match nil)))))))
 
 (defun font-latex-find-dollar-math (limit &optional num)
   "Find dollar sign(s) before LIMIT.
@@ -1892,27 +1892,27 @@ Optional argument NUM, if non-nil, specifies the number 
of dollar
 signs to follow the point and must be 1 or 2."
   (catch 'found
     (while (progn
-            (skip-chars-forward "^$" limit)
-            (< (point) limit))
+             (skip-chars-forward "^$" limit)
+             (< (point) limit))
       ;; Found "$".
       ;; If that "$" is not our target, skip over it and search
       ;; again.
       (cond
        ;; check 1: Are we in a verbatim construct?
        ((nth 3 (syntax-ppss))
-       (skip-chars-forward "$" limit))
+        (skip-chars-forward "$" limit))
        ;; check 2: Else, is "$" escaped?
        ((TeX-escaped-p)
-       (forward-char 1))
+        (forward-char 1))
        ;; check 3: Else, is the number of the following "$" wrong?
        ;; This check cannot precede check 2 because "$1+2\$$" is
        ;; legal.
        ((and (eq num 2) (not (eq (char-after (1+ (point))) ?$)))
-       ;; If double dollars ($$) are followed by $, skip over that $.
-       ;; We need not care the case that single dollar ($) is
-       ;; followed by $$ because expressions like "$1+1$$2+2$" and
-       ;; "$1+2$$$3+3$$" are legal.
-       (forward-char 1))
+        ;; If double dollars ($$) are followed by $, skip over that $.
+        ;; We need not care the case that single dollar ($) is
+        ;; followed by $$ because expressions like "$1+1$$2+2$" and
+        ;; "$1+2$$$3+3$$" are legal.
+        (forward-char 1))
        ;; (Quote from bug#19589, with a bit of adaptation)
        ;;
        ;; > When I use environment variables (such as $HOME) in a .tex
@@ -1927,10 +1927,10 @@ signs to follow the point and must be 1 or 2."
        ;; state check.
        ;; ;; check 3: Else, is "$" in comments or verb-like construct?
        ;; ((nth 8 (syntax-ppss))
-       ;;      (skip-chars-forward "$" limit))
+       ;;       (skip-chars-forward "$" limit))
        (t
-       ;; That "$" is live one.
-       (throw 'found t))))))
+        ;; That "$" is live one.
+        (throw 'found t))))))
 
 (defun font-latex-extend-region-backwards-math ()
   "Extend region backwards for math environmets.
@@ -1965,19 +1965,19 @@ Take into account $...$, $$...$$, \\(...\\) and 
\\=\\[...\\], too."
         (goto-char end)
         (catch 'extend
           (while (re-search-backward
-                 (concat "\\\\end[ \t]*{" (regexp-opt envs t) "\\*?}") beg t)
-           (when (and (re-search-backward
-                       (concat  "\\\\begin[ \t]*{"
-                                (buffer-substring-no-properties
-                                 (match-beginning 1)
-                                 (match-end 0))
-                                ;; Match an optional and possible
-                                ;; mandatory argument(s)
-                                
"\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?"
-                                "\\(?:{[^}]*}\\)*")
-                       (- beg font-latex-multiline-boundary) t)
-                      (< (point) beg))
-             (throw 'extend (cons (point) end)))))))))
+                  (concat "\\\\end[ \t]*{" (regexp-opt envs t) "\\*?}") beg t)
+            (when (and (re-search-backward
+                        (concat  "\\\\begin[ \t]*{"
+                                 (buffer-substring-no-properties
+                                  (match-beginning 1)
+                                  (match-end 0))
+                                 ;; Match an optional and possible
+                                 ;; mandatory argument(s)
+                                 
"\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?"
+                                 "\\(?:{[^}]*}\\)*")
+                        (- beg font-latex-multiline-boundary) t)
+                       (< (point) beg))
+              (throw 'extend (cons (point) end)))))))))
 
 (defun font-latex-update-quote-list ()
   "Update quote list and regexp if value of `font-latex-quotes' changed."
@@ -1987,16 +1987,16 @@ Take into account $...$, $$...$$, \\(...\\) and 
\\=\\[...\\], too."
     ;; 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)
+          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 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))))
+          (regexp-opt (mapcar 'car font-latex-quote-list) t))))
 
 (defun font-latex-match-quotation (limit)
   "Match quote patterns up to LIMIT.
@@ -2010,45 +2010,45 @@ set to french, and >>german<< (and 8-bit) are used if 
set to german."
     ;; 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-no-properties 0))
-                (closing-quote
-                 (nth 1 (assoc opening-quote 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-no-properties 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)))
-             (let ((p (point)))
-               (if (< font-latex--updated-region-end limit)
-                   (setq font-latex--updated-region-end limit))
-               (when (< font-latex--updated-region-end p)
-                 (font-lock-unfontify-region
-                  font-latex--updated-region-end p)
-                 (setq font-latex--updated-region-end p))
-               (store-match-data (list beg p p p))))
-           (throw 'match t)))))))
+              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-no-properties 0))
+                 (closing-quote
+                  (nth 1 (assoc opening-quote 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-no-properties 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)))
+              (let ((p (point)))
+                (if (< font-latex--updated-region-end limit)
+                    (setq font-latex--updated-region-end limit))
+                (when (< font-latex--updated-region-end p)
+                  (font-lock-unfontify-region
+                   font-latex--updated-region-end p)
+                  (setq font-latex--updated-region-end p))
+                (store-match-data (list beg p p p))))
+            (throw 'match t)))))))
 
 (defun font-latex-extend-region-backwards-quotation ()
   "Extend region backwards for quotations."
@@ -2056,150 +2056,150 @@ set to french, and >>german<< (and 8-bit) are used if 
set to german."
     (font-latex-update-quote-list)
     (let ((regexp-end (regexp-opt (mapcar #'cadr font-latex-quote-list) t)))
       (save-excursion
-       (goto-char font-lock-end)
-       (catch 'extend
-         (while (re-search-backward regexp-end font-lock-beg t)
-           (let ((found-end (match-beginning 0))
-                 (closing-quote (match-string-no-properties 0))
-                 (nest-count 0)
-                 (point-of-surrender (- font-lock-beg
+        (goto-char font-lock-end)
+        (catch 'extend
+          (while (re-search-backward regexp-end font-lock-beg t)
+            (let ((found-end (match-beginning 0))
+                  (closing-quote (match-string-no-properties 0))
+                  (nest-count 0)
+                  (point-of-surrender (- font-lock-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 (if (re-search-backward (concat opening-quote "\\|"
-                                                    closing-quote)
-                                            point-of-surrender 'move)
-                        ;; Found quotes before point-of-surrender.
-                        (cond ((string= (match-string-no-properties 0)
-                                        closing-quote)
-                               ;; Encountered another closing quote.
-                               ;; Increase nest-count and continue
-                               ;; the inner loop.
-                               (setq nest-count (1+ nest-count)))
-                              ;; Found an opening quote.
-                              ((/= nest-count 0)
-                               ;; If in nest, decrease nest-count
-                               ;; and continue the inner loop.
-                               (setq nest-count (1- nest-count)))
-                              ;; Else we arrived at the opening quote
-                              ;; matching with the closing quote found
-                              ;; in the outer loop.
-                              ((< (point) font-lock-beg)
-                               ;; If that opening quote locates
-                               ;; before `font-lock-beg', break the
-                               ;; outer loop and extend the region.
-                               (setq font-lock-beg (point))
-                               (throw 'extend t))
-                              (t
-                               ;; Else terminate the inner loop and
-                               ;; continue the outer loop.
-                               nil))
-                      ;; Didn't find quotes before
-                      ;; point-of-surrender.
-                      ;; Go back just before the closing quote,
-                      ;; terminate the inner loop and
-                      ;; continue the outer loop.
-                      (goto-char found-end)
-                      nil)))))))))
+                  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 (if (re-search-backward (concat opening-quote "\\|"
+                                                     closing-quote)
+                                             point-of-surrender 'move)
+                         ;; Found quotes before point-of-surrender.
+                         (cond ((string= (match-string-no-properties 0)
+                                         closing-quote)
+                                ;; Encountered another closing quote.
+                                ;; Increase nest-count and continue
+                                ;; the inner loop.
+                                (setq nest-count (1+ nest-count)))
+                               ;; Found an opening quote.
+                               ((/= nest-count 0)
+                                ;; If in nest, decrease nest-count
+                                ;; and continue the inner loop.
+                                (setq nest-count (1- nest-count)))
+                               ;; Else we arrived at the opening quote
+                               ;; matching with the closing quote found
+                               ;; in the outer loop.
+                               ((< (point) font-lock-beg)
+                                ;; If that opening quote locates
+                                ;; before `font-lock-beg', break the
+                                ;; outer loop and extend the region.
+                                (setq font-lock-beg (point))
+                                (throw 'extend t))
+                               (t
+                                ;; Else terminate the inner loop and
+                                ;; continue the outer loop.
+                                nil))
+                       ;; Didn't find quotes before
+                       ;; point-of-surrender.
+                       ;; Go back just before the closing quote,
+                       ;; terminate the inner loop and
+                       ;; continue the outer loop.
+                       (goto-char found-end)
+                       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\\{}]\\|\
+             (re-search-forward "[_^] *\\([^\n\\{}]\\|\
 \\\\\\([a-zA-Z@]+\\|[^ \t\n]\\)\\|\\({\\)\\)" limit t))
     (if (and (not (memq font-latex-fontify-script '(multi-level invisible)))
-            (font-latex-faces-present-p '(font-latex-subscript-face
-                                          font-latex-superscript-face)))
-       ;; Apply subscript and superscript highlighting only once (in case
-       ;; font-latex-fontify-script is not 'multi-level) 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)))
+             (font-latex-faces-present-p '(font-latex-subscript-face
+                                           font-latex-superscript-face)))
+        ;; Apply subscript and superscript highlighting only once (in case
+        ;; font-latex-fontify-script is not 'multi-level) 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))))))
+        (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))
 
 (defun font-latex-match-script-chars (limit)
   "Match subscript and superscript chars up to LIMIT."
   (and (re-search-forward "[^_^]\\([_^]\\)" limit t)
        (let ((pos (match-beginning 1)))
-        (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))))))
+         (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))))))
 
 (defun font-latex--get-script-props (pos script-type)
   (let* ((old-raise (or (plist-get (get-text-property pos 'display) 'raise) 
0.0))
-        (new-level (1+ (or (get-text-property pos 'script-level) 0)))
-        (disp-props (copy-sequence (cl-case script-type
-                                     (:super (cdr font-latex-script-display))
-                                     (:sub   (car 
font-latex-script-display)))))
-        (new-disp-props (let ((raise (plist-get disp-props 'raise))
-                              (nl new-level))
-                          (if raise
-                              ;; This polynom approximates that the factor
-                              ;; which is multiplied with raise is 1 for nl=1,
-                              ;; 0.8 for nl=2, 0.64 for nl=3, etc. (so always
-                              ;; about 80% of the previous value).
-                              (plist-put disp-props 'raise
-                                         (+ old-raise
-                                            (* raise
-                                               (+ 1.1965254857142873
-                                                  (* nl -0.21841226666666758)
-                                                  (* nl nl 
0.012018514285714385)))))
-                            disp-props))))
+         (new-level (1+ (or (get-text-property pos 'script-level) 0)))
+         (disp-props (copy-sequence (cl-case script-type
+                                      (:super (cdr font-latex-script-display))
+                                      (:sub   (car 
font-latex-script-display)))))
+         (new-disp-props (let ((raise (plist-get disp-props 'raise))
+                               (nl new-level))
+                           (if raise
+                               ;; This polynom approximates that the factor
+                               ;; which is multiplied with raise is 1 for nl=1,
+                               ;; 0.8 for nl=2, 0.64 for nl=3, etc. (so always
+                               ;; about 80% of the previous value).
+                               (plist-put disp-props 'raise
+                                          (+ old-raise
+                                             (* raise
+                                                (+ 1.1965254857142873
+                                                   (* nl -0.21841226666666758)
+                                                   (* nl nl 
0.012018514285714385)))))
+                             disp-props))))
     `(face ,(if (<= new-level font-latex-fontify-script-max-level)
-               (cl-case script-type
-                 (:super 'font-latex-superscript-face)
-                 (:sub   'font-latex-subscript-face))
-             nil)
-          script-level ,new-level
-          display ,new-disp-props)))
+                (cl-case script-type
+                  (:super 'font-latex-superscript-face)
+                  (:sub   'font-latex-subscript-face))
+              nil)
+           script-level ,new-level
+           display ,new-disp-props)))
 
 ;; 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)))
+             (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)))
     (if (eq (char-after pos) ?_)
-       (font-latex--get-script-props pos :sub)
+        (font-latex--get-script-props pos :sub)
       (font-latex--get-script-props pos :super))))
 
 (defun font-latex-script-char (_pos)
   "Return face and display spec for subscript and superscript character at 
POS."
   `(face font-latex-script-char-face
-        ,@(when (eq font-latex-fontify-script 'invisible)
-            '(invisible t))))
+         ,@(when (eq font-latex-fontify-script 'invisible)
+             '(invisible t))))
 
 ;;; docTeX
 
@@ -2209,9 +2209,9 @@ set to french, and >>german<< (and 8-bit) are used if set 
to german."
 
 (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))))
+                  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)
 
@@ -2229,28 +2229,28 @@ set to french, and >>german<< (and 8-bit) are used if 
set to german."
 
 (defvar font-latex-doctex-keywords
   (append font-latex-keywords-2
-         '(("^%<[^>]*>" (0 font-latex-doctex-preprocessor-face t)))))
+          '(("^%<[^>]*>" (0 font-latex-doctex-preprocessor-face t)))))
 
 ;; 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.
-            (eval-when-compile (string-to-syntax "< b"))
-          (eval-when-compile (string-to-syntax ">"))))
-       (let ((end (line-end-position)))
-         (if (< end (point-max))
-             (put-text-property end (1+ end) 'syntax-table
-                                   (eval-when-compile
-                                     (string-to-syntax "> b")))))
-       (eval-when-compile (string-to-syntax "< b")))))
+        (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.
+             (eval-when-compile (string-to-syntax "< b"))
+           (eval-when-compile (string-to-syntax ">"))))
+        (let ((end (line-end-position)))
+          (if (< end (point-max))
+              (put-text-property end (1+ end) 'syntax-table
+                                 (eval-when-compile
+                                   (string-to-syntax "> b")))))
+        (eval-when-compile (string-to-syntax "< b")))))
 
 ;; Copy and adaptation of `doctex-font-lock-syntactic-face-function'
 ;; in `tex-mode.el' of CVS Emacs (March 2004)
@@ -2258,8 +2258,8 @@ set to french, and >>german<< (and 8-bit) are used if set 
to german."
   ;; 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))))
+          (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))
diff --git a/latex.el b/latex.el
index 29d8d0e..2a21802 100644
--- a/latex.el
+++ b/latex.el
@@ -39,11 +39,11 @@
 
 ;; Silence the compiler for functions:
 (declare-function outline-level "ext:outline"
-                 nil)
+                  nil)
 (declare-function outline-mark-subtree "ext:outline"
-                 nil)
+                  nil)
 (declare-function turn-off-filladapt-mode "ext:filladapt"
-                 nil)
+                  nil)
 
 ;; Silence the compiler for variables:
 (defvar outline-heading-alist)
@@ -86,28 +86,28 @@ This depends on `LaTeX-insert-into-comments'."
   (interactive)
   (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))
-           ;; `indent-new-comment-line' does nothing when
-           ;; `comment-auto-fill-only-comments' is non-il, so we must be sure
-           ;; to be in a comment before calling it.  In any other case
-           ;; `newline' is used.
-           ((TeX-in-comment)
-            (indent-new-comment-line))
-           (t
-            (newline)))
+                  (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))
+            ;; `indent-new-comment-line' does nothing when
+            ;; `comment-auto-fill-only-comments' is non-il, so we must be sure
+            ;; to be in a comment before calling it.  In any other case
+            ;; `newline' is used.
+            ((TeX-in-comment)
+             (indent-new-comment-line))
+            (t
+             (newline)))
     (newline)))
 
 
@@ -118,11 +118,11 @@ This depends on `LaTeX-insert-into-comments'."
 
 (progn ; set [] to match for LaTeX.
   (modify-syntax-entry (string-to-char LaTeX-optop)
-                      (concat "(" LaTeX-optcl)
-                      LaTeX-mode-syntax-table)
+                       (concat "(" LaTeX-optcl)
+                       LaTeX-mode-syntax-table)
   (modify-syntax-entry (string-to-char LaTeX-optcl)
-                      (concat ")" LaTeX-optop)
-                      LaTeX-mode-syntax-table))
+                       (concat ")" LaTeX-optop)
+                       LaTeX-mode-syntax-table))
 
 ;;; Sections
 
@@ -152,29 +152,29 @@ If ARG is positive or zero, use absolute level:
 
 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."
+`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))
-        (LaTeX-level (cond ((null arg)
-                            (LaTeX-current-section))
-                           ((listp arg)
-                            (LaTeX-down-section))
-                           ((< val 0)
-                            (LaTeX-up-section (- val)))
-                           (t val)))
-        (LaTeX-name (LaTeX-section-name LaTeX-level))
-        (LaTeX-toc nil)
-        (LaTeX-title (if (TeX-active-mark)
-                         (buffer-substring (region-beginning)
-                                           (region-end))
-                       ""))
-        (LaTeX-done-mark (make-marker)))
+         (LaTeX-level (cond ((null arg)
+                             (LaTeX-current-section))
+                            ((listp arg)
+                             (LaTeX-down-section))
+                            ((< val 0)
+                             (LaTeX-up-section (- val)))
+                            (t val)))
+         (LaTeX-name (LaTeX-section-name LaTeX-level))
+         (LaTeX-toc nil)
+         (LaTeX-title (if (TeX-active-mark)
+                          (buffer-substring (region-beginning)
+                                            (region-end))
+                        ""))
+         (LaTeX-done-mark (make-marker)))
     (run-hooks 'LaTeX-section-hook)
     (LaTeX-newline)
     (if (marker-position LaTeX-done-mark)
-       (goto-char (marker-position LaTeX-done-mark)))
+        (goto-char (marker-position LaTeX-done-mark)))
     (set-marker LaTeX-done-mark nil)))
 
 (defun LaTeX-current-section ()
@@ -182,9 +182,9 @@ The following variables can be set to customize:
 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)))))
+         (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.
@@ -193,39 +193,39 @@ 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)))
+          (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))))
+          (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)
+        (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))))))
+        (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))
+                             ("chapter" 1)
+                             ("section" 2)
+                             ("subsection" 3)
+                             ("subsubsection" 4)
+                             ("paragraph" 5)
+                             ("subparagraph" 6))
   "List which elements is the names of the sections used by LaTeX.")
 
 (defvar LaTeX-section-menu nil)
@@ -249,25 +249,25 @@ used in style files."
   (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)))))
+        (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))))))
+                           (lambda (a b) (equal a (nth 1 b))))))
     (if entry
-       (nth 0 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))))))
+                           (lambda (a b) (equal a (nth 0 b))))))
 
     (if entry
-       (nth 1 entry)
+        (nth 1 entry)
       nil)))
 
 (defcustom TeX-outline-extra nil
@@ -278,7 +278,7 @@ 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"))))
+                        (integer :tag "Level"))))
 
 (defun LaTeX-outline-regexp (&optional anywhere)
   "Return regexp for LaTeX sections.
@@ -286,17 +286,17 @@ the header.  See `LaTeX-section-list' for existing header 
levels."
 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))
+          "[ \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.")
@@ -318,11 +318,11 @@ order to let the menu filter regenerate it."
   (let ((offset (LaTeX-outline-offset)))
     (when (> offset 0)
       (let (lst)
-       (dolist (tup outline-heading-alist)
-         (setq lst (cons (cons (car tup)
-                               (+ offset (cdr tup)))
-                         lst)))
-       (setq outline-heading-alist (nreverse lst)))))
+        (dolist (tup outline-heading-alist)
+          (setq lst (cons (cons (car tup)
+                                (+ offset (cdr tup)))
+                          lst)))
+        (setq outline-heading-alist (nreverse lst)))))
   (setq LaTeX-section-menu nil))
 
 (defun LaTeX-outline-offset ()
@@ -333,7 +333,7 @@ order to let the menu filter regenerate it."
   "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)))))
+              (not (looking-at (nth 0 (car list)))))
     (setq list (cdr list)))
   (if list
       (nth 1 (car list))
@@ -341,47 +341,47 @@ If so, return the second element, otherwise return nil."
 
 (defvar LaTeX-header-end
   (concat "^[^%\n]*" (regexp-quote TeX-esc) "begin *"
-         TeX-grop "document" TeX-grcl)
+          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)
+          TeX-grop "document" TeX-grcl)
   "Default start of trailer marker for LaTeX documents.")
 
 (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 (outline-level)))))))
+        ((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 (outline-level)))))))
 
 (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)
+        (match-string 1)
       (buffer-substring (point) (min (point-max) (+ 20 (point)))))))
 
 (add-hook 'TeX-remove-style-hook
-         (lambda () (setq LaTeX-largest-level nil)))
+          (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-toc                ; Most people won't want this
     LaTeX-section-section
     LaTeX-section-label)
   "List of hooks to run when a new section is inserted.
@@ -418,19 +418,19 @@ 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))
+         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))
+             LaTeX-section-title
+             LaTeX-section-toc
+             LaTeX-section-section
+             LaTeX-section-label))
 
 
 (defcustom LaTeX-section-label
@@ -453,14 +453,14 @@ 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"))))))
+                 (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.
 
@@ -469,12 +469,12 @@ no label is inserted."
 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 " LaTeX-name "): ")
-                LaTeX-section-list
-                nil nil nil nil LaTeX-name)))
+                 (concat "Level (default " LaTeX-name "): ")
+                 LaTeX-section-list
+                 nil nil nil nil LaTeX-name)))
     ;; Update LaTeX-name
     (if (not (zerop (length string)))
-       (setq LaTeX-name string))
+        (setq LaTeX-name string))
     ;; Update level
     (setq LaTeX-level (LaTeX-section-level LaTeX-name))))
 
@@ -484,7 +484,7 @@ Insert this hook into `LaTeX-section-hook' to allow the 
user to change
 the title of the section inserted with `\\[LaTeX-section]."
   (setq LaTeX-title (TeX-read-string "Title: " LaTeX-title))
   (let ((region (and (TeX-active-mark)
-                    (cons (region-beginning) (region-end)))))
+                     (cons (region-beginning) (region-end)))))
     (when region (delete-region (car region) (cdr region)))))
 
 (defun LaTeX-section-toc ()
@@ -506,19 +506,19 @@ inserted."
   ;; 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))
+            (re-search-backward
+             (concat "^\\s-*\n\\s-*\\=\\|^\\s-*" (regexp-quote TeX-esc)
+                     "begin")
+             (line-beginning-position 0) t))
     (LaTeX-newline))
   (insert TeX-esc LaTeX-name)
   (cond ((null LaTeX-toc))
-       ((zerop (length LaTeX-toc))
-        (insert LaTeX-optop)
-        (set-marker LaTeX-done-mark (point))
-        (insert LaTeX-optcl))
-       (t
-        (insert LaTeX-optop LaTeX-toc LaTeX-optcl)))
+        ((zerop (length LaTeX-toc))
+         (insert LaTeX-optop)
+         (set-marker LaTeX-done-mark (point))
+         (insert LaTeX-optcl))
+        (t
+         (insert LaTeX-optop LaTeX-toc LaTeX-optcl)))
   (insert TeX-grop)
   (if (zerop (length LaTeX-title))
       (set-marker LaTeX-done-mark (point)))
@@ -588,15 +588,15 @@ It may be customized with the following variables:
 
   (interactive "*P")
   (let* ((default (cond
-                  ((TeX-near-bobp) "document")
-                  ((and LaTeX-default-document-environment
-                        (string-equal (LaTeX-current-environment) "document"))
-                   LaTeX-default-document-environment)
-                  (t LaTeX-default-environment)))
-        (environment (completing-read (concat "Environment type (default "
-                                              default "): ")
-                                      (LaTeX-environment-list-filtered) nil nil
-                                      nil 'LaTeX-environment-history default)))
+                   ((TeX-near-bobp) "document")
+                   ((and LaTeX-default-document-environment
+                         (string-equal (LaTeX-current-environment) "document"))
+                    LaTeX-default-document-environment)
+                   (t LaTeX-default-environment)))
+         (environment (completing-read (concat "Environment type (default "
+                                               default "): ")
+                                       (LaTeX-environment-list-filtered) nil 
nil
+                                       nil 'LaTeX-environment-history 
default)))
     ;; Use `environment' as default for the next time only if it is different
     ;; from the current default.
     (unless (equal environment default)
@@ -604,76 +604,76 @@ It may be customized with the following variables:
 
     (let ((entry (assoc environment (LaTeX-environment-list))))
       (if (null entry)
-         (LaTeX-add-environments (list environment)))
+          (LaTeX-add-environments (list environment)))
 
       (if arg
-         (LaTeX-modify-environment environment)
-       (LaTeX-environment-menu environment)))))
+          (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 (TeX-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))))))
+           (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 (TeX-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)))
+         (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)
+            (and (TeX-in-commented-line)
+                 (save-excursion (beginning-of-line 2)
+                                 (not (TeX-in-commented-line)))))
+        (LaTeX-newline)
       (unless (= (forward-line 1) 0)
-       (insert "\n")))
+        (insert "\n")))
     (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)))))
+        (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)))))
 
 (define-obsolete-variable-alias 'LaTeX-after-insert-env-hooks 
'LaTeX-after-insert-env-hook "11.89")
 
@@ -688,15 +688,15 @@ environment just inserted, the buffer position just before
 (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)
+        prefix content-start env-start env-end additional-indent)
     (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))))
+        (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.
     ;; - Open a new empty line for later insertion of "\begin{foo}" and
     ;;   put the point there.
@@ -704,39 +704,47 @@ environment just inserted, the buffer position just before
     ;;   point and EOL, send them into their new own line with possible
     ;;   comment prefix.
     (cond (;; When the entire line consists of whitespaces except
-          ;; possible prefix...
-          (save-excursion (beginning-of-line)
-                          (looking-at (concat prefix "[ \t]*$")))
-          ;; ...make the line empty and put the point there.
-          (delete-region (match-beginning 0) (match-end 0)))
-         (;; When there are only whitespaces except possible prefix
-          ;; between the point and BOL (including the case the point
-          ;; is at BOL)...
-          (TeX-looking-at-backward (if prefix
-                                       (concat "^\\(" prefix "\\)?[ \t]*")
-                                     "^[ \t]*")
-                                   (line-beginning-position))
-          ;; ...in this case, we have non-whitespace texts between
-          ;; the point and EOL, so send the entire line into a new
-          ;; next line and put the point on the empty line just
-          ;; created.
-          (beginning-of-line)
-          (newline)
-          (beginning-of-line 0))
-         (;; In all other cases...
-          t
-          ;; ...insert a new empty line after deleting all
-          ;; whitespaces around the point, put the point there...
-          (delete-horizontal-space)
-          (if (eolp)
-              (newline)
-            ;; ...and if there were at first any non-whitespace texts
-            ;; between (the original position of) the point and EOL,
-            ;; send them into a new next line with possible comment
-            ;; prefix.
-            (newline 2)
-            (when prefix (insert prefix))
-            (beginning-of-line 0))))
+           ;; possible prefix...
+           (save-excursion (beginning-of-line)
+                           (looking-at (concat prefix "[ \t]*$")))
+           ;; ...make the line empty and put the point there.
+           (delete-region (match-beginning 0) (match-end 0)))
+          (;; When there are only whitespaces except possible prefix
+           ;; between the point and BOL (including the case the point
+           ;; is at BOL)...
+           (TeX-looking-at-backward (if prefix
+                                        (concat "^\\(" prefix "\\)?[ \t]*")
+                                      "^[ \t]*")
+                                    (line-beginning-position))
+           ;; ...in this case, we have non-whitespace texts between
+           ;; the point and EOL, so send the entire line into a new
+           ;; next line and put the point on the empty line just
+           ;; created.
+           (beginning-of-line)
+           (newline)
+           (beginning-of-line 0)
+           ;; Take note that there are texts to be indented later
+           ;; unless the region is activated.
+           (unless active-mark
+             (setq additional-indent t)))
+          (;; In all other cases...
+           t
+           ;; ...insert a new empty line after deleting all
+           ;; whitespaces around the point, put the point there...
+           (delete-horizontal-space)
+           (if (eolp)
+               (newline)
+             ;; ...and if there were at first any non-whitespace texts
+             ;; between (the original position of) the point and EOL,
+             ;; send them into a new next line with possible comment
+             ;; prefix.
+             (newline 2)
+             (when prefix (insert prefix))
+             (beginning-of-line 0)
+             ;; Take note that there are texts to be indented later
+             ;; unless the region is activated.
+             (unless active-mark
+               (setq additional-indent t)))))
     ;; What to do with the line containing mark.
     ;; If there is active region...
     (when active-mark
@@ -746,43 +754,48 @@ environment just inserted, the buffer position just before
       ;;   mark and EOL, pass them over the empty line and put them on
       ;;   their own line with possible comment prefix.
       (save-excursion
-       (goto-char (mark))
-       (cond (;; When the entire line consists of whitespaces except
-              ;; possible prefix...
-              (save-excursion (beginning-of-line)
-                              (looking-at
-                               (if prefix
-                                   (concat "\\(" prefix "\\)?[ \t]*$")
-                                 "[ \t]*$")))
-              ;; ...make the line empty and put the mark there.
-              (delete-region (match-beginning 0) (match-end 0)))
-             (;; When there are only whitespaces except possible prefix
-              ;; between the mark and BOL (including the case the mark
-              ;; is at BOL)...
-              (TeX-looking-at-backward (if prefix
-                                           (concat "^\\(" prefix "\\)?[ \t]*")
-                                         "^[ \t]*")
-                                       (line-beginning-position))
-              ;; ...in this case, we have non-whitespace texts
-              ;; between the mark and EOL, so send the entire line
-              ;; into a new next line and put the mark on the empty
-              ;; line just created.
-              (beginning-of-line)
-              (set-mark (point))
-              (newline))
-             (;; In all other cases...
-              t
-              ;; ...make a new empty line after deleting all
-              ;; whitespaces around the mark, put the mark there...
-              (delete-horizontal-space)
-              (insert-before-markers "\n")
-              ;; ...and if there were at first any non-whitespace
-              ;; texts between (the original position of) the mark
-              ;; and EOL, send them into a new next line with
-              ;; possible comment prefix.
-              (unless (eolp)
-                (newline)
-                (when prefix (insert prefix)))))))
+        (goto-char (mark))
+        (cond (;; When the entire line consists of whitespaces except
+               ;; possible prefix...
+               (save-excursion (beginning-of-line)
+                               (looking-at
+                                (if prefix
+                                    (concat "\\(" prefix "\\)?[ \t]*$")
+                                  "[ \t]*$")))
+               ;; ...make the line empty and put the mark there.
+               (delete-region (match-beginning 0) (match-end 0)))
+              (;; When there are only whitespaces except possible prefix
+               ;; between the mark and BOL (including the case the mark
+               ;; is at BOL)...
+               (TeX-looking-at-backward (if prefix
+                                            (concat "^\\(" prefix "\\)?[ \t]*")
+                                          "^[ \t]*")
+                                        (line-beginning-position))
+               ;; ...in this case, we have non-whitespace texts
+               ;; between the mark and EOL, so send the entire line
+               ;; into a new next line and put the mark on the empty
+               ;; line just created.
+               (beginning-of-line)
+               (set-mark (point))
+               (newline)
+               ;; Take note that there are texts to be indented later.
+               (setq additional-indent t))
+              (;; In all other cases...
+               t
+               ;; ...make a new empty line after deleting all
+               ;; whitespaces around the mark, put the mark there...
+               (delete-horizontal-space)
+               (insert-before-markers "\n")
+               ;; ...and if there were at first any non-whitespace
+               ;; texts between (the original position of) the mark
+               ;; and EOL, send them into a new next line with
+               ;; possible comment prefix.
+               (unless (eolp)
+                 (newline)
+                 (when prefix (insert prefix))
+                 ;; Take note that there are texts to be indented
+                 ;; later.
+                 (setq additional-indent t))))))
     ;; Now insert the environment.
     (when prefix (insert prefix))
     (setq env-start (point))
@@ -799,31 +812,36 @@ environment just inserted, the buffer position just before
     (insert TeX-esc "end" TeX-grop environment TeX-grcl)
     (end-of-line 0)
     (if active-mark
-       (progn
-         (or (assoc environment LaTeX-indent-environment-list)
-             (if auto-fill-function
-                 ;; Fill the region only when `auto-fill-mode' is active.
-                 (LaTeX-fill-region content-start (line-beginning-position 
2))))
-         (set-mark content-start))
+        (progn
+          (or (assoc environment LaTeX-indent-environment-list)
+              (if auto-fill-function
+                  ;; Fill the region only when `auto-fill-mode' is active.
+                  (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))
+    ;; Indent \end{foo}.
+    (save-excursion (beginning-of-line 2) (indent-according-to-mode)
+                    (when additional-indent
+                      ;; Indent texts sent after the inserted
+                      ;; environment.
+                      (forward-line 1) (indent-according-to-mode)))
     (TeX-math-input-method-off)
     (setq env-end (save-excursion
-                   (search-forward
-                    (concat TeX-esc "end" TeX-grop
-                            environment TeX-grcl))
-                   (match-beginning 0)))
+                    (search-forward
+                     (concat TeX-esc "end" TeX-grop
+                             environment TeX-grcl))
+                    (match-beginning 0)))
     (run-hook-with-args 'LaTeX-after-insert-env-hooks
-                       environment env-start env-end)))
+                        environment env-start env-end)))
 
 (defun LaTeX-environment-name-regexp ()
   "Return the regexp matching the name of a LaTeX environment.
 This matches everything different from a TeX closing brace but
 allowing one level of TeX group braces."
   (concat "\\([^" (regexp-quote TeX-grcl) (regexp-quote TeX-grop) "]*\\("
-         (regexp-quote TeX-grop) "[^" (regexp-quote TeX-grcl)
-         (regexp-quote TeX-grop) "]*" (regexp-quote TeX-grcl) "\\)*[^"
-         (regexp-quote TeX-grcl) (regexp-quote TeX-grop) "]*\\)"))
+          (regexp-quote TeX-grop) "[^" (regexp-quote TeX-grcl)
+          (regexp-quote TeX-grop) "]*" (regexp-quote TeX-grcl) "\\)*[^"
+          (regexp-quote TeX-grcl) (regexp-quote TeX-grop) "]*\\)"))
 
 (defvar LaTeX-after-modify-env-hook nil
   "List of functions to be run at the end of `LaTeX-modify-environment'.
@@ -835,38 +853,38 @@ position just before \\begin and the position just before
 (defun LaTeX-modify-environment (environment)
   "Modify current ENVIRONMENT."
   (let ((goto-end (lambda ()
-                   (LaTeX-find-matching-end)
-                   (re-search-backward (concat (regexp-quote TeX-esc)
-                                               "end"
-                                               (regexp-quote TeX-grop)
-                                               "\\("
-                                               (LaTeX-environment-name-regexp)
-                                               "\\)"
-                                               (regexp-quote TeX-grcl))
-                                       (save-excursion (beginning-of-line 1) 
(point)))))
-       (goto-begin (lambda ()
-                     (LaTeX-find-matching-begin)
-                     (prog1 (point)
-                       (re-search-forward (concat (regexp-quote TeX-esc)
-                                                  "begin"
-                                                  (regexp-quote TeX-grop)
-                                                  "\\("
-                                                  
(LaTeX-environment-name-regexp)
-                                                  "\\)"
-                                                  (regexp-quote TeX-grcl))
-                                          (save-excursion (end-of-line 1) 
(point)))))))
+                    (LaTeX-find-matching-end)
+                    (re-search-backward (concat (regexp-quote TeX-esc)
+                                                "end"
+                                                (regexp-quote TeX-grop)
+                                                "\\("
+                                                (LaTeX-environment-name-regexp)
+                                                "\\)"
+                                                (regexp-quote TeX-grcl))
+                                        (save-excursion (beginning-of-line 1) 
(point)))))
+        (goto-begin (lambda ()
+                      (LaTeX-find-matching-begin)
+                      (prog1 (point)
+                        (re-search-forward (concat (regexp-quote TeX-esc)
+                                                   "begin"
+                                                   (regexp-quote TeX-grop)
+                                                   "\\("
+                                                   
(LaTeX-environment-name-regexp)
+                                                   "\\)"
+                                                   (regexp-quote TeX-grcl))
+                                           (save-excursion (end-of-line 1) 
(point)))))))
     (save-excursion
       (funcall goto-end)
       (let ((old-env (match-string 1)))
-       (replace-match environment t t nil 1)
-       (beginning-of-line 1)
-       (funcall goto-begin)
-       (replace-match environment t t nil 1)
-       (end-of-line 1)
-       (run-hook-with-args 'LaTeX-after-modify-env-hook
-                           environment old-env
-                           (save-excursion (funcall goto-begin))
-                           (progn (funcall goto-end) (point)))))))
+        (replace-match environment t t nil 1)
+        (beginning-of-line 1)
+        (funcall goto-begin)
+        (replace-match environment t t nil 1)
+        (end-of-line 1)
+        (run-hook-with-args 'LaTeX-after-modify-env-hook
+                            environment old-env
+                            (save-excursion (funcall goto-begin))
+                            (progn (funcall goto-end) (point)))))))
 
 (defvar LaTeX-syntactic-comments) ;; Defined further below.
 
@@ -882,24 +900,24 @@ 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)))
-        (case-fold-search nil))
+         (comment-prefix (and in-comment (TeX-comment-prefix)))
+         (case-fold-search nil))
     (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)))))
+                  (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)))))
+          "document"
+        (match-string-no-properties 2)))))
 
 (defun docTeX-in-macrocode-p ()
   "Determine if point is inside a macrocode environment."
@@ -907,9 +925,9 @@ work analogously."
     (save-excursion
       (re-search-backward
        (concat "^%    " (regexp-quote TeX-esc)
-              "\\(begin\\|end\\)[ \t]*{macrocode\\*?}") nil 'move)
+               "\\(begin\\|end\\)[ \t]*{macrocode\\*?}") nil 'move)
       (not (or (bobp)
-              (= (char-after (match-beginning 1)) ?e))))))
+               (= (char-after (match-beginning 1)) ?e))))))
 
 
 ;;; Environment Hooks
@@ -930,18 +948,18 @@ The compatibility argument IGNORE is ignored."
   (let ((found nil))
     (save-excursion
       (while (and (not found)
-                 (re-search-backward
-                  "\\\\documentclass\\(\\[[^]\n\r]*\\]\\)?\\({[^}]+}\\)"
-                  nil t))
-       (and (not (TeX-in-commented-line))
-            (setq found t))))
+                  (re-search-backward
+                   "\\\\documentclass\\(\\[[^]\n\r]*\\]\\)?\\({[^}]+}\\)"
+                   nil t))
+        (and (not (TeX-in-commented-line))
+             (setq found t))))
     (when (not found)
       (TeX-insert-macro "documentclass")
       (LaTeX-newline)
       (LaTeX-newline)
       ;; Add a newline only if some `\usepackage' has been inserted.
       (if (LaTeX-insert-usepackages)
-         (LaTeX-newline))
+          (LaTeX-newline))
       (LaTeX-newline)
       (end-of-line 0)))
   (LaTeX-insert-environment "document")
@@ -955,8 +973,8 @@ If nil, act like the empty string is given, but do not 
prompt.
 optional argument is omitted.)"
   :group 'LaTeX-environment
   :type '(choice (const :tag "Do not prompt" nil)
-                (const :tag "Empty" "")
-                (string :format "%v")))
+                 (const :tag "Empty" "")
+                 (string :format "%v")))
 (make-variable-buffer-local 'LaTeX-float)
 
 (defcustom LaTeX-top-caption-list nil
@@ -1015,8 +1033,8 @@ code listings and take a caption and label."
 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))
+                 (const :tag "Empty" "")
+                 string))
 (make-variable-buffer-local 'LaTeX-default-position)
 
 (defcustom LaTeX-equation-label "eq:"
@@ -1034,12 +1052,12 @@ If nil, act like the empty string is given, but do not 
prompt."
   (LaTeX-insert-environment environment)
   (if (TeX-active-mark)
       (progn
-       (LaTeX-find-matching-begin)
-       (end-of-line 1))
+        (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]*$"))
+                            "^[ \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'
@@ -1050,9 +1068,9 @@ If nil, act like the empty string is given, but do not 
prompt."
   ;; 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)))
+             (not (assoc environment LaTeX-indent-environment-list))
+             (> (- (line-end-position) (line-beginning-position))
+                (current-fill-column)))
     (LaTeX-fill-paragraph nil)))
 
 (defcustom LaTeX-label-alist
@@ -1074,8 +1092,8 @@ with an empty prefix, use the empty string \"\" as the 
CDR of the
 corresponding entry."
   :group 'LaTeX-label
   :type '(repeat (cons (string :tag "Environment")
-                      (choice (string :tag "Label prefix")
-                              (symbol :tag "Label prefix symbol")))))
+                       (choice (string :tag "Label prefix")
+                               (symbol :tag "Label prefix symbol")))))
 
 (make-variable-buffer-local 'LaTeX-label-alist)
 
@@ -1097,39 +1115,39 @@ If the optional NO-INSERT is non-nil, only the label is 
returned
 and no insertion happens.  Otherwise the inserted label is
 returned, nil if it is empty."
   (let ((TeX-read-label-prefix
-        (cond
-         ((eq type 'environment)
-          (cdr (assoc name LaTeX-label-alist)))
-         ((eq type 'section)
-          (if (assoc name LaTeX-section-list)
-              (if (stringp LaTeX-section-label)
-                  LaTeX-section-label
-                (and (listp LaTeX-section-label)
-                     (cdr (assoc name LaTeX-section-label))))
-            ""))
-         ((null type)
-          "")
-         (t
-          nil)))
-       label)
+         (cond
+          ((eq type 'environment)
+           (cdr (assoc name LaTeX-label-alist)))
+          ((eq type 'section)
+           (if (assoc name LaTeX-section-list)
+               (if (stringp LaTeX-section-label)
+                   LaTeX-section-label
+                 (and (listp LaTeX-section-label)
+                      (cdr (assoc name LaTeX-section-label))))
+             ""))
+          ((null type)
+           "")
+          (t
+           nil)))
+        label)
     (when (symbolp TeX-read-label-prefix)
       (setq TeX-read-label-prefix (symbol-value TeX-read-label-prefix)))
     (when TeX-read-label-prefix
       (if (and (fboundp LaTeX-label-function))
-         (funcall LaTeX-label-function name no-insert)
-       ;; Use completing-read as we do with `C-c C-m \label RET'
-       (setq label (TeX-read-label t "What label" t))
-       ;; No label or empty string entered?
-       (if (or (string= TeX-read-label-prefix label)
-               (string= "" label))
-           (setq label nil)
-         ;; We have a label; when NO-INSERT is nil, insert
-         ;; \label{label} in the buffer, add new label to list of
-         ;; known labels and return it
-         (unless no-insert
-           (insert TeX-esc "label" TeX-grop label TeX-grcl))
-         (LaTeX-add-labels label)
-         label)))))
+          (funcall LaTeX-label-function name no-insert)
+        ;; Use completing-read as we do with `C-c C-m \label RET'
+        (setq label (TeX-read-label t "What label" t))
+        ;; No label or empty string entered?
+        (if (or (string= TeX-read-label-prefix label)
+                (string= "" label))
+            (setq label nil)
+          ;; We have a label; when NO-INSERT is nil, insert
+          ;; \label{label} in the buffer, add new label to list of
+          ;; known labels and return it
+          (unless no-insert
+            (insert TeX-esc "label" TeX-grop label TeX-grcl))
+          (LaTeX-add-labels label)
+          label)))))
 
 (defcustom LaTeX-short-caption-prompt-length 40
   "The length that the caption of a figure should be before
@@ -1150,8 +1168,8 @@ If SHORT-CAPTION is non-nil pass it as an optional 
argument to
 
 (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
+  (let* ((float (and LaTeX-float                ; LaTeX-float can be nil, i.e.
+                                        ; do not prompt
                      (TeX-read-string "(Optional) Float position: " 
LaTeX-float)))
          (caption (TeX-read-string "Caption: "))
          (short-caption (when (>= (length caption) 
LaTeX-short-caption-prompt-length)
@@ -1162,15 +1180,15 @@ If SHORT-CAPTION is non-nil pass it as an optional 
argument to
          start-marker end-marker)
     (when active-mark
       (if (< (mark) (point))
-         (exchange-point-and-mark))
+          (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)))
+                              (unless (zerop (length float))
+                                (concat LaTeX-optop float
+                                        LaTeX-optcl)))
     (when active-mark (goto-char start-marker))
     (when center
       (insert TeX-esc "centering")
@@ -1180,57 +1198,57 @@ If SHORT-CAPTION is non-nil pass it as an optional 
argument to
     ;; Insert caption and ask for a label, do nothing if user skips caption
     (unless (zerop (length caption))
       (if (member environment LaTeX-top-caption-list)
-         ;; top caption
-         (progn
-           (insert (LaTeX-compose-caption-macro caption short-caption))
-           ;; If `auto-fill-mode' is active, fill the caption.
-           (if auto-fill-function (LaTeX-fill-paragraph))
-           (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 'environment)
-             (LaTeX-newline)
-             (indent-according-to-mode)))
-       ;; bottom caption (default)
-       (when active-mark (goto-char end-marker))
-       (save-excursion
-         (LaTeX-newline)
-         (indent-according-to-mode)
-         ;; If there is an active region point is before the backslash of
-         ;; "\end" macro, go one line upwards.
-         (when active-mark (forward-line -1) (indent-according-to-mode))
-         (insert (LaTeX-compose-caption-macro caption short-caption))
-         ;; If `auto-fill-mode' is active, fill the caption.
-         (if auto-fill-function (LaTeX-fill-paragraph))
-         ;; ask for a label and if necessary insert a new line between caption
-         ;; and label
-         (when (save-excursion (LaTeX-label environment 'environment))
-           (LaTeX-newline)
-           (indent-according-to-mode)))
-       ;; Insert an empty line between caption and marked region, if any.
-       (when active-mark (LaTeX-newline) (forward-line -1))
-       (indent-according-to-mode)))
+          ;; top caption
+          (progn
+            (insert (LaTeX-compose-caption-macro caption short-caption))
+            ;; If `auto-fill-mode' is active, fill the caption.
+            (if auto-fill-function (LaTeX-fill-paragraph))
+            (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 'environment)
+              (LaTeX-newline)
+              (indent-according-to-mode)))
+        ;; bottom caption (default)
+        (when active-mark (goto-char end-marker))
+        (save-excursion
+          (LaTeX-newline)
+          (indent-according-to-mode)
+          ;; If there is an active region point is before the backslash of
+          ;; "\end" macro, go one line upwards.
+          (when active-mark (forward-line -1) (indent-according-to-mode))
+          (insert (LaTeX-compose-caption-macro caption short-caption))
+          ;; If `auto-fill-mode' is active, fill the caption.
+          (if auto-fill-function (LaTeX-fill-paragraph))
+          ;; ask for a label and if necessary insert a new line between caption
+          ;; and label
+          (when (save-excursion (LaTeX-label environment 'environment))
+            (LaTeX-newline)
+            (indent-according-to-mode)))
+        ;; Insert an empty line between caption and marked region, if any.
+        (when active-mark (LaTeX-newline) (forward-line -1))
+        (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))
+               ;; Suppose an existing tabular environment should just
+               ;; be wrapped into a table if there is an active region.
+               (not active-mark))
       (LaTeX-environment-menu LaTeX-default-tabular-environment))))
 
 (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
-                 (TeX-read-string "(Optional) Position: " 
LaTeX-default-position)))
-       (fmt (TeX-read-string "Format: " LaTeX-default-format)))
+                                        ; be nil, i.e. do not prompt
+                  (TeX-read-string "(Optional) Position: " 
LaTeX-default-position)))
+        (fmt (TeX-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)))
+                              (concat
+                               (unless (zerop (length pos))
+                                 (concat LaTeX-optop pos LaTeX-optcl))
+                               (concat TeX-grop fmt TeX-grcl)))
     (LaTeX-item-array t)))
 
 (defun LaTeX-env-label (environment)
@@ -1244,7 +1262,7 @@ Just like array and tabular."
   "Insert ENVIRONMENT and the first item."
   (let ((label (TeX-read-string "Default Label: ")))
     (LaTeX-insert-environment environment
-                             (format "{%s}{}" label))
+                              (format "{%s}{}" label))
     (end-of-line 0)
     (delete-char 1)
     (delete-horizontal-space))
@@ -1253,58 +1271,58 @@ Just like array and tabular."
 (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
-                 (TeX-read-string "(Optional) Position: " 
LaTeX-default-position)))
-       (width (TeX-read-string "Width: " LaTeX-default-width)))
+                                        ; be nil, i.e. do not prompt
+                  (TeX-read-string "(Optional) Position: " 
LaTeX-default-position)))
+        (width (TeX-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)))))
+                              (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 (TeX-read-string "Width: " LaTeX-default-width))
-       (pos (and LaTeX-default-position ; LaTeX-default-position can
-                                       ; be nil, i.e. do not prompt
-                 (TeX-read-string "(Optional) Position: " 
LaTeX-default-position)))
-       (fmt (TeX-read-string "Format: " LaTeX-default-format)))
+        (pos (and LaTeX-default-position ; LaTeX-default-position can
+                                        ; be nil, i.e. do not prompt
+                  (TeX-read-string "(Optional) Position: " 
LaTeX-default-position)))
+        (fmt (TeX-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)))
+                              (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)))
     (LaTeX-item-tabular* t)))
 
 (defun LaTeX-env-picture (environment)
   "Insert ENVIRONMENT with width, height specifications."
   (let ((width (TeX-read-string "Width: "))
-       (height (TeX-read-string "Height: "))
-       (x-offset (TeX-read-string "X Offset: "))
-       (y-offset (TeX-read-string "Y Offset: ")))
+        (height (TeX-read-string "Height: "))
+        (x-offset (TeX-read-string "X Offset: "))
+        (y-offset (TeX-read-string "Y Offset: ")))
     (if (zerop (length x-offset))
-       (setq x-offset "0"))
+        (setq x-offset "0"))
     (if (zerop (length y-offset))
-       (setq y-offset "0"))
+        (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))))))
+                              (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
-                                   (TeX-read-string "Label for BibItem: " "99")
-                                   TeX-grcl))
+                            (concat TeX-grop
+                                    (TeX-read-string "Label for BibItem: " 
"99")
+                                    TeX-grcl))
   (end-of-line 0)
   (delete-char 1)
   (delete-horizontal-space)
@@ -1313,20 +1331,20 @@ Just like array and tabular."
 (defun LaTeX-env-contents (environment)
   "Insert ENVIRONMENT with optional argument and filename for contents."
   (let* ((opt '("overwrite" "force" "nosearch"))
-        (arg (mapconcat #'identity
-                        (TeX-completing-read-multiple
-                         (TeX-argument-prompt t nil "Options")
-                         (if (string= environment "filecontents*")
-                             opt
-                           (cons "noheader" opt)))
-                        ",")))
+         (arg (mapconcat #'identity
+                         (TeX-completing-read-multiple
+                          (TeX-argument-prompt t nil "Options")
+                          (if (string= environment "filecontents*")
+                              opt
+                            (cons "noheader" opt)))
+                         ",")))
     (LaTeX-insert-environment environment
-                             (concat
-                              (when (and arg (not (string= arg "")))
-                                (concat LaTeX-optop arg LaTeX-optcl))
-                              TeX-grop
-                              (TeX-read-string "File: ")
-                              TeX-grcl)))
+                              (concat
+                               (when (and arg (not (string= arg "")))
+                                 (concat LaTeX-optop arg LaTeX-optcl))
+                               TeX-grop
+                               (TeX-read-string "File: ")
+                               TeX-grcl)))
   (delete-horizontal-space))
 
 (defun LaTeX-env-args (environment &rest args)
@@ -1336,7 +1354,7 @@ Just like array and tabular."
     (LaTeX-find-matching-begin)
     (end-of-line)
     (let ((TeX-exit-mark (or TeX-exit-mark
-                            (make-marker))))
+                             (make-marker))))
       (TeX-parse-arguments args))))
 
 (defun LaTeX-env-label-as-keyval (_optional &optional keyword keyvals 
environment)
@@ -1348,10 +1366,10 @@ function searchs for key=val's itself.  ENVIRONMENT is 
a string
 with the name of environment, if non-nil, don't bother to find
 out."
   (let ((env-start (make-marker))
-       (body-start (make-marker))
-       (opt-start (make-marker))
-       (opt-end   (make-marker))
-       (currenv (or environment (LaTeX-current-environment))))
+        (body-start (make-marker))
+        (opt-start (make-marker))
+        (opt-end   (make-marker))
+        (currenv (or environment (LaTeX-current-environment))))
     ;; Save the starting point as we will come back here
     (set-marker body-start (point))
     ;; Go to the start of the current environment and save the position
@@ -1360,7 +1378,7 @@ out."
     ;; Check if an opt. argument is there; assume that it starts in
     ;; the same line and save the points in markers
     (when (re-search-forward
-          (concat "\\\\begin{" currenv "}[ \t]*\\[") body-start t)
+           (concat "\\\\begin{" currenv "}[ \t]*\\[") body-start t)
       (set-marker opt-start (1- (point)))
       (goto-char opt-start)
       (forward-sexp)
@@ -1368,40 +1386,40 @@ out."
     ;; If keyword argument is given and keyvals argument is not given,
     ;; parse the optional argument and put it into keyvals
     (when (and keyword
-              (marker-position opt-start)
-              (not keyvals))
+               (marker-position opt-start)
+               (not keyvals))
       (setq keyvals (buffer-substring-no-properties
-                    (1+ opt-start) opt-end)))
+                     (1+ opt-start) opt-end)))
     ;; If keyword is given, only insert a label when keyword is found
     ;; inside the keyvals.  If keyword is nil, then insert a label
     ;; anyways
     (if (stringp keyword)
-       (when (and (stringp keyvals)
-                  (not (string= keyvals ""))
-                  (string-match (concat keyword "[ \t]*=") keyvals))
-         (goto-char opt-end)
-         (let ((opt-label (LaTeX-label currenv 'environment t)))
-           (when opt-label
-             (insert (if (equal (preceding-char) ?,)
-                         "label="
-                       ",label=")
-                     TeX-grop opt-label TeX-grcl))))
+        (when (and (stringp keyvals)
+                   (not (string= keyvals ""))
+                   (string-match (concat keyword "[ \t]*=") keyvals))
+          (goto-char opt-end)
+          (let ((opt-label (LaTeX-label currenv 'environment t)))
+            (when opt-label
+              (insert (if (equal (preceding-char) ?,)
+                          "label="
+                        ",label=")
+                      TeX-grop opt-label TeX-grcl))))
       (let ((opt-label (LaTeX-label currenv 'environment t)))
-       (when opt-label
-         ;; Check if an opt. argument is found and go to the end if
-         (if (marker-position opt-end)
-             (progn
-               (goto-char opt-end)
-               (insert (if (equal (preceding-char) ?,)
-                           "label="
-                         ",label=")
-                       TeX-grop opt-label TeX-grcl))
-           ;; Otherwise start at the beginning of environment in
-           ;; order to not mess with any other mandatory arguments
-           ;; which can be there
-           (goto-char env-start)
-           (re-search-forward (concat "\\\\begin{" currenv "}"))
-           (insert LaTeX-optop "label=" TeX-grop opt-label TeX-grcl 
LaTeX-optcl)))))
+        (when opt-label
+          ;; Check if an opt. argument is found and go to the end if
+          (if (marker-position opt-end)
+              (progn
+                (goto-char opt-end)
+                (insert (if (equal (preceding-char) ?,)
+                            "label="
+                          ",label=")
+                        TeX-grop opt-label TeX-grcl))
+            ;; Otherwise start at the beginning of environment in
+            ;; order to not mess with any other mandatory arguments
+            ;; which can be there
+            (goto-char env-start)
+            (re-search-forward (concat "\\\\begin{" currenv "}"))
+            (insert LaTeX-optop "label=" TeX-grop opt-label TeX-grcl 
LaTeX-optcl)))))
     ;; Go to where we started and clean up the markers
     (goto-char body-start)
     (set-marker env-start nil)
@@ -1421,11 +1439,11 @@ 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)))
+               (> (point) (mark)))
       (exchange-point-and-mark))
     (unless (bolp) (LaTeX-newline))
     (if (assoc environment LaTeX-item-list)
-       (funcall (cdr (assoc environment LaTeX-item-list)))
+        (funcall (cdr (assoc environment LaTeX-item-list)))
       (TeX-insert-macro "item"))
     (indent-according-to-mode)))
 
@@ -1434,7 +1452,7 @@ You may use `LaTeX-item-list' to change the routines used 
to insert the item."
 (defun LaTeX-item-argument ()
   "Insert a new item with an optional argument."
   (let ((TeX-arg-item-label-p t)
-       (TeX-insert-macro-default-style 'show-optional-args))
+        (TeX-insert-macro-default-style 'show-optional-args))
     (TeX-insert-macro "item")))
 
 (defun LaTeX-item-bib ()
@@ -1502,28 +1520,28 @@ the text \"c@{,}p{5ex}\" between START and END 
specified two columns.
 
 FUNC should return nil if it cannot determine the number of ampersands."
   (let* ((cur (point))
-        (num
-         (save-excursion
-           (ignore-errors
-             (LaTeX-find-matching-begin)
-             ;; Skip over "\begin{xxx}" and possible whitespaces.
-             (forward-list 1)
-             (skip-chars-forward " \t")
-             ;; Skip over the text specified by REGEXP and whitespaces.
-             (when (let ((case-fold-search nil))
-                     (re-search-forward regexp cur))
-               (skip-chars-forward " \t")
-               (when (eq (following-char) ?{)
-                 ;; We have reached the target "{yyy}" part.
-                 (forward-char 1)
-                 ;; The next line doesn't move point, so point
-                 ;; is left just after the opening brace.
-                 (let ((pos (TeX-find-closing-brace)))
-                   (if pos
-                       ;; Calculate number of ampersands to be inserted.
-                       (funcall func (point) (1- pos))))))))))
+         (num
+          (save-excursion
+            (ignore-errors
+              (LaTeX-find-matching-begin)
+              ;; Skip over "\begin{xxx}" and possible whitespaces.
+              (forward-list 1)
+              (skip-chars-forward " \t")
+              ;; Skip over the text specified by REGEXP and whitespaces.
+              (when (let ((case-fold-search nil))
+                      (re-search-forward regexp cur))
+                (skip-chars-forward " \t")
+                (when (eq (following-char) ?{)
+                  ;; We have reached the target "{yyy}" part.
+                  (forward-char 1)
+                  ;; The next line doesn't move point, so point
+                  ;; is left just after the opening brace.
+                  (let ((pos (TeX-find-closing-brace)))
+                    (if pos
+                        ;; Calculate number of ampersands to be inserted.
+                        (funcall func (point) (1- pos))))))))))
     (if (natnump num)
-       (save-excursion (insert (make-string num ?&))))))
+        (save-excursion (insert (make-string num ?&))))))
 
 (defvar LaTeX-array-column-letters "clrp"
   "Column letters for array-like environments.
@@ -1544,39 +1562,39 @@ right number."
       (goto-char start)
       (while (< (setq p (point)) end)
 
-       ;; The below block accounts for one unit of move for
-       ;; one column.
-       (setq cols (+ cols
-                     ;; treat *-operator specially.
-                     (if (eq (following-char) ?*)
-                         ;; *-operator is there.
-                         (progn
-                           ;; pick up repetition number and count
-                           ;; how many columns are repeated.
-                           (re-search-forward
-                            "\\*[ \t\r\n%]*{[ \t\r\n%]*\\([0-9]+\\)[ 
\t\r\n%]*}" end)
-                           (let ((n (string-to-number
-                                     (match-string-no-properties 1)))
-                                 ;; get start and end of repeated spec.
-                                 (s (progn (down-list 1) (point)))
-                                 (e (progn (up-list 1) (1- (point)))))
-                             (* n (1+ (LaTeX-array-count-columns s e)))))
-                       ;; not *-operator.
-                       (skip-chars-forward
-                        LaTeX-array-column-letters end))))
-       ;; Do not skip over `*' (see above) and `[' (siunitx has `S[key=val]':):
-       (skip-chars-forward (concat
-                            "^" LaTeX-array-column-letters "*"
-                            TeX-grop LaTeX-optop) end)
-       (when (or (eq (following-char) ?\{)
-                 (eq (following-char) ?\[))
-         (forward-list 1))
-
-       ;; Not sure whether this is really necessary or not, but
-       ;; prepare for possible infinite loop anyway.
-       (when (eq p (point))
-         (setq cols nil)
-         (goto-char end)))
+        ;; The below block accounts for one unit of move for
+        ;; one column.
+        (setq cols (+ cols
+                      ;; treat *-operator specially.
+                      (if (eq (following-char) ?*)
+                          ;; *-operator is there.
+                          (progn
+                            ;; pick up repetition number and count
+                            ;; how many columns are repeated.
+                            (re-search-forward
+                             "\\*[ \t\r\n%]*{[ \t\r\n%]*\\([0-9]+\\)[ 
\t\r\n%]*}" end)
+                            (let ((n (string-to-number
+                                      (match-string-no-properties 1)))
+                                  ;; get start and end of repeated spec.
+                                  (s (progn (down-list 1) (point)))
+                                  (e (progn (up-list 1) (1- (point)))))
+                              (* n (1+ (LaTeX-array-count-columns s e)))))
+                        ;; not *-operator.
+                        (skip-chars-forward
+                         LaTeX-array-column-letters end))))
+        ;; Do not skip over `*' (see above) and `[' (siunitx has 
`S[key=val]':):
+        (skip-chars-forward (concat
+                             "^" LaTeX-array-column-letters "*"
+                             TeX-grop LaTeX-optop) end)
+        (when (or (eq (following-char) ?\{)
+                  (eq (following-char) ?\[))
+          (forward-list 1))
+
+        ;; Not sure whether this is really necessary or not, but
+        ;; prepare for possible infinite loop anyway.
+        (when (eq p (point))
+          (setq cols nil)
+          (goto-char end)))
       ;; The number of ampersands is one less than column.
       (if cols (1- cols)))))
 
@@ -1614,7 +1632,7 @@ right number."
 
 (defvar LaTeX-auto-index-regexp-list
    
'(("\\\\\\(index\\|glossary\\){\\([^}{]*\\({[^}{]*\\({[^}{]*\\({[^}{]*}[^}{]*\\)*}[^}{]*\\)*}[^}{]*\\)*\\)}"
-       2 LaTeX-auto-index-entry))
+        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.")
@@ -1674,29 +1692,29 @@ This is necessary since index entries may contain 
commands and stuff.")
   (append
    (let ((token TeX-token-char))
      `((,(concat "\\\\\\(?:new\\|provide\\)command\\*?{?\\\\\\(" token 
"+\\)}?\\[\\([0-9]+\\)\\]\\[\\([^\n\r]*\\)\\]")
-       (1 2 3) LaTeX-auto-optional)
+        (1 2 3) LaTeX-auto-optional)
        (,(concat "\\\\\\(?:new\\|provide\\)command\\*?{?\\\\\\(" token 
"+\\)}?\\[\\([0-9]+\\)\\]")
-       (1 2) LaTeX-auto-arguments)
+        (1 2) LaTeX-auto-arguments)
        (,(concat "\\\\\\(?:new\\|provide\\)command\\*?{?\\\\\\(" token 
"+\\)}?")
-       1 TeX-auto-symbol)
+        1 TeX-auto-symbol)
        (,(concat "\\\\newenvironment\\*?{?\\(" token 
"+\\)}?\\[\\([0-9]+\\)\\]\\[")
-       (1 2) LaTeX-auto-env-args-with-opt)
+        (1 2) LaTeX-auto-env-args-with-opt)
        (,(concat "\\\\newenvironment\\*?{?\\(" token 
"+\\)}?\\[\\([0-9]+\\)\\]")
-       (1 2) LaTeX-auto-env-args)
+        (1 2) LaTeX-auto-env-args)
        (,(concat "\\\\newenvironment\\*?{?\\(" token "+\\)}?")
-       1 LaTeX-auto-environment)
+        1 LaTeX-auto-environment)
        (,(concat "\\\\newtheorem{\\(" token "+\\)}") 1 LaTeX-auto-environment)
        ("\\\\input{\\(\\.*[^#}%\\\\\\.\n\r]+\\)\\(\\.[^#}%\\\\\\.\n\r]+\\)?}"
-       1 TeX-auto-file)
+        1 TeX-auto-file)
        ("\\\\include{\\(\\.*[^#}%\\\\\\.\n\r]+\\)\\(\\.[^#}%\\\\\\.\n\r]+\\)?}"
-       1 TeX-auto-file)
+        1 TeX-auto-file)
        (, (concat "\\\\bibitem{\\(" token "[^, \n\r\t%\"#'()={}]*\\)}")
-         1 LaTeX-auto-bibitem)
+          1 LaTeX-auto-bibitem)
        (, (concat "\\\\bibitem\\[[^][\n\r]+\\]{\\(" token "[^, 
\n\r\t%\"#'()={}]*\\)}")
-         1 LaTeX-auto-bibitem)
+          1 LaTeX-auto-bibitem)
        ("\\\\bibliography{\\([^#}\\\\\n\r]+\\)}" 1 LaTeX-auto-bibliography)
        ("\\\\addbibresource\\(?:\\[[^]]+\\]\\)?{\\([^#}\\\\\n\r]+\\)\\..+}"
-       1 LaTeX-auto-bibliography)
+        1 LaTeX-auto-bibliography)
        
("\\\\add\\(?:global\\|section\\)bib\\(?:\\[[^]]+\\]\\)?{\\([^#}\\\\\n\r\.]+\\)\\(?:\\..+\\)?}"
 1 LaTeX-auto-bibliography)
        ("\\\\newrefsection\\[\\([^]]+\\)\\]" 1 LaTeX-split-bibs)
        ("\\\\begin{refsection}\\[\\([^]]+\\)\\]" 1 LaTeX-split-bibs)))
@@ -1716,20 +1734,20 @@ Split the string at commas and remove Biber file 
extensions."
   (let ((bibs (TeX-split-string " *, *" (TeX-match-buffer match))))
     (dolist (bib bibs)
       (LaTeX-add-bibliographies (replace-regexp-in-string
-                                (concat "\\(?:\\."
-                                        (mapconcat #'identity
-                                                   TeX-Biber-file-extensions
-                                                   "\\|\\.")
-                                        "\\)")
-                                "" bib)))))
+                                 (concat "\\(?:\\."
+                                         (mapconcat #'identity
+                                                    TeX-Biber-file-extensions
+                                                    "\\|\\.")
+                                         "\\)")
+                                 "" bib)))))
 
 (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))
+        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)
 
@@ -1748,31 +1766,31 @@ The input string may include LaTeX comments and 
newlines."
       (goto-char (point-min))
       (setq start (point))
       (while (re-search-forward "[{ ,%\n\r]" nil t)
-       (setq match (match-string 0))
-       (cond
-        ;; Step over groups.  (Let's hope nobody uses escaped braces.)
-        ((string= match "{")
-         (up-list))
-        ;; Get rid of whitespace.
-        ((string= match " ")
-         (delete-region (1- (point))
-                        (save-excursion
-                          (skip-chars-forward " ")
-                          (point))))
-        ;; Add entry to output.
-        ((or (string= match ",") (= (point) (point-max)))
+        (setq match (match-string 0))
+        (cond
+         ;; Step over groups.  (Let's hope nobody uses escaped braces.)
+         ((string= match "{")
+          (up-list))
+         ;; Get rid of whitespace.
+         ((string= match " ")
+          (delete-region (1- (point))
+                         (save-excursion
+                           (skip-chars-forward " ")
+                           (point))))
+         ;; Add entry to output.
+         ((or (string= match ",") (= (point) (point-max)))
           (let ((entry (buffer-substring-no-properties
                         start (1- (point)))))
             (unless (member entry opts)
               (setq opts (append opts (list entry)))))
-         (setq start (point)))
-        ;; Get rid of comments.
-        ((string= match "%")
-         (delete-region (1- (point))
-                        (line-beginning-position 2)))
-        ;; Get rid of newlines.
-        ((or (string= match "\n") (string= match "\r"))
-         (delete-char -1)))))
+          (setq start (point)))
+         ;; Get rid of comments.
+         ((string= match "%")
+          (delete-region (1- (point))
+                         (line-beginning-position 2)))
+         ;; Get rid of newlines.
+         ((or (string= match "\n") (string= match "\r"))
+          (delete-char -1)))))
     opts))
 
 (defvar LaTeX-provided-class-options nil
@@ -1795,8 +1813,8 @@ The value is actually the tail of the list of options 
given to CLASS."
   "Check if a documentclass option matching REGEXP is active.
 Return first found class option matching REGEXP, or nil if not found."
   (TeX-member regexp (apply #'append
-                           (mapcar #'cdr LaTeX-provided-class-options))
-             'string-match))
+                            (mapcar #'cdr LaTeX-provided-class-options))
+              'string-match))
 
 (defvar LaTeX-provided-package-options nil
   "Alist of options provided to LaTeX packages.
@@ -1820,9 +1838,9 @@ The value is actually the tail of the list of options 
given to PACKAGE."
 
   ;; Cleanup BibTeX/Biber files
   (setq LaTeX-auto-bibliography
-       (apply 'append (mapcar (lambda (arg)
-                                (TeX-split-string "," arg))
-                              LaTeX-auto-bibliography)))
+        (apply 'append (mapcar (lambda (arg)
+                                 (TeX-split-string "," arg))
+                               LaTeX-auto-bibliography)))
 
   ;; Reset class and packages options for the current buffer
   (setq LaTeX-provided-class-options nil)
@@ -1832,118 +1850,118 @@ The value is actually the tail of the list of options 
given to PACKAGE."
   (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)))
+             (options (nth 0 entry))
+             (style (nth 1 entry))
+             (class (nth 2 entry)))
 
-       ;; Next document style.
-       (setq LaTeX-auto-style (cdr LaTeX-auto-style))
+        ;; Next document style.
+        (setq LaTeX-auto-style (cdr LaTeX-auto-style))
 
-       ;; Get the options.
-       (setq options (LaTeX-listify-package-options options))
+        ;; Get the options.
+        (setq options (LaTeX-listify-package-options options))
 
         ;; 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))
-             ;; Append style to the style list.
-             (add-to-list 'TeX-auto-file elt t)
+              ;; Append style to the style list.
+              (add-to-list 'TeX-auto-file elt t)
               ;; Append to `LaTeX-provided-package-options' the name of the
               ;; package and the options provided to it at load time.
-             (unless (equal options '(""))
-               (TeX-add-to-alist 'LaTeX-provided-package-options
-                                 (list (cons elt options)))))
-         ;; And a special "art10" style file combining style and size.
-         (add-to-list 'TeX-auto-file style t)
-         (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"))) t)
-         (unless (equal options '(""))
-           (TeX-add-to-alist 'LaTeX-provided-class-options
-                             (list (cons style options)))))
-
-       ;; The third argument if "class" indicates LaTeX2e features.
-       (cond ((or (string-equal class "class")
-                  (string-equal class "Class"))
-              (add-to-list 'TeX-auto-file "latex2e"))
-             ((string-equal class "style")
-              (add-to-list 'TeX-auto-file "latex2"))))))
+              (unless (equal options '(""))
+                (TeX-add-to-alist 'LaTeX-provided-package-options
+                                  (list (cons elt options)))))
+          ;; And a special "art10" style file combining style and size.
+          (add-to-list 'TeX-auto-file style t)
+          (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"))) t)
+          (unless (equal options '(""))
+            (TeX-add-to-alist 'LaTeX-provided-class-options
+                              (list (cons style options)))))
+
+        ;; The third argument if "class" indicates LaTeX2e features.
+        (cond ((or (string-equal class "class")
+                   (string-equal class "Class"))
+               (add-to-list 'TeX-auto-file "latex2e"))
+              ((string-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)
+          (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)
+          (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)
+          (add-to-list 'LaTeX-auto-environment
+                       (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)
+          (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)
   ;; 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))
+          (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)
 
@@ -2011,29 +2029,29 @@ defined and ask user for confirmation before 
proceeding."
   (let (label valid)
     (while (not valid)
       (setq label
-           (completing-read
-            (TeX-argument-prompt optional prompt "Key")
-            (LaTeX-label-list) nil nil TeX-read-label-prefix))
+            (completing-read
+             (TeX-argument-prompt optional prompt "Key")
+             (LaTeX-label-list) nil nil TeX-read-label-prefix))
       ;; If we're defining a label, check if it's already defined and
       ;; ask user for confirmation, otherwise ask again
       (cond ((and definition
-                 (assoc label (LaTeX-label-list)))
-            (ding)
-            (when (y-or-n-p
-                   ;; Emacs 24 compatibility
-                   (if (fboundp 'format-message)
-                       (format-message "Label `%s' exists. Use anyway? " label)
-                     (format "Label `%s' exists. Use anyway? " label)))
-              (setq valid t)))
-           (t
-            (setq valid t))))
+                  (assoc label (LaTeX-label-list)))
+             (ding)
+             (when (y-or-n-p
+                    ;; Emacs 24 compatibility
+                    (if (fboundp 'format-message)
+                        (format-message "Label `%s' exists. Use anyway? " 
label)
+                      (format "Label `%s' exists. Use anyway? " label)))
+               (setq valid t)))
+            (t
+             (setq valid t))))
     ;; Only add a newly defined label to list of known one if it is
     ;; not empty and not equal to `TeX-read-label-prefix', if given
     (when (and definition
-              (not (string-equal "" label))
-              (if TeX-read-label-prefix
-                  (not (string-equal TeX-read-label-prefix label))
-                t))
+               (not (string-equal "" label))
+               (if TeX-read-label-prefix
+                   (not (string-equal TeX-read-label-prefix label))
+                 t))
       (LaTeX-add-labels label))
     ;; Return label, can be empty string "", TeX-read-label-prefix
     ;; only "fig:" or the real thing like "fig:foo"
@@ -2076,10 +2094,10 @@ 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))))
+                                (LaTeX-index-entry-list))))
     (if (and (not (string-equal "" entry))
-            (not (member (list entry) (LaTeX-index-entry-list))))
-       (LaTeX-add-index-entries 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)
@@ -2091,12 +2109,12 @@ 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))))
+                                                     (concat "Macro: "
+                                                             TeX-esc)
+                                                     t)
+                                (TeX-symbol-list))))
     (if (and definition (not (string-equal "" macro)))
-       (TeX-add-symbols macro))
+        (TeX-add-symbols macro))
     (TeX-argument-insert macro optional TeX-esc)))
 
 (defun TeX-arg-environment (optional &optional prompt definition)
@@ -2106,10 +2124,10 @@ 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")
-                                     (LaTeX-environment-list))))
+                                                           "Environment")
+                                      (LaTeX-environment-list))))
     (if (and definition (not (string-equal "" environment)))
-       (LaTeX-add-environments environment))
+        (LaTeX-add-environments environment))
 
     (TeX-argument-insert environment optional)))
 
@@ -2120,7 +2138,7 @@ 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."
   (let ((items (multi-prompt "," t (TeX-argument-prompt optional prompt "Key")
-                            (LaTeX-bibitem-list))))
+                             (LaTeX-bibitem-list))))
     (apply 'LaTeX-add-bibitems items)
     (TeX-argument-insert (mapconcat 'identity items ",") optional optional)))
 
@@ -2131,10 +2149,10 @@ argument, otherwise as a mandatory one.  Use PROMPT as 
the prompt
 string.  If DEFINITION is non-nil, add the chosen counter to
 the list of defined counters."
   (let ((counter (completing-read (TeX-argument-prompt optional prompt
-                                                      "Counter")
-                                 (LaTeX-counter-list))))
+                                                       "Counter")
+                                  (LaTeX-counter-list))))
     (if (and definition (not (string-equal "" counter)))
-       (LaTeX-add-counters counter))
+        (LaTeX-add-counters counter))
     (TeX-argument-insert counter optional)))
 
 (defun TeX-arg-savebox (optional &optional prompt definition)
@@ -2144,8 +2162,8 @@ argument, otherwise as a mandatory one.  Use PROMPT as 
the prompt
 string.  If definition is non-nil, the savebox is added to the
 list of defined saveboxes."
   (let ((savebox (completing-read (TeX-argument-prompt optional prompt
-                                                      (concat "Savebox: "
-                                                              TeX-esc) t)
+                                                       (concat "Savebox: "
+                                                               TeX-esc) t)
                                    (LaTeX-savebox-list))))
     (if (and definition (not (zerop (length savebox))))
         (LaTeX-add-saveboxes savebox))
@@ -2159,19 +2177,19 @@ string.  If INITIAL-INPUT is non-nil, insert it in the 
minibuffer
 initially, with point positioned at the end.  If DEFINITION is
 non-nil, the length is added to the list of defined length."
   (let ((length (completing-read (TeX-argument-prompt optional prompt "Length")
-                                ;; A valid length can be a macro or a length of
-                                ;; the form <value><dimension>.  Input starting
-                                ;; with a `\' can be completed with length
-                                ;; macros.
-                                (mapcar (lambda(elt) (concat TeX-esc (car 
elt)))
-                                        (LaTeX-length-list))
-                                ;; Some macros takes as argument only a length
-                                ;; macro (e.g., `\setlength' in its first
-                                ;; argument, and `\newlength'), in this case is
-                                ;; convenient to set `\\' as initial input.
-                                nil nil initial-input)))
+                                 ;; A valid length can be a macro or a length 
of
+                                 ;; the form <value><dimension>.  Input 
starting
+                                 ;; with a `\' can be completed with length
+                                 ;; macros.
+                                 (mapcar (lambda(elt) (concat TeX-esc (car 
elt)))
+                                         (LaTeX-length-list))
+                                 ;; Some macros takes as argument only a length
+                                 ;; macro (e.g., `\setlength' in its first
+                                 ;; argument, and `\newlength'), in this case 
is
+                                 ;; convenient to set `\\' as initial input.
+                                 nil nil initial-input)))
     (if (and definition (not (zerop (length length))))
-       ;; Strip leading TeX-esc from macro name
+        ;; Strip leading TeX-esc from macro name
         (LaTeX-add-lengths (substring length 1)))
     (TeX-argument-insert length optional)))
 
@@ -2181,9 +2199,9 @@ 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))
+                                                            prompt "File")
+                                       "" "" nil)
+                       optional))
 
 (defun TeX-arg-file-name (optional &optional prompt)
   "Prompt for a file name.
@@ -2288,22 +2306,22 @@ string."
   (TeX-arg-length optional prompt "\\" t))
 
 (defcustom LaTeX-style-list '(("amsart")
-                             ("amsbook")
-                             ("article")
-                             ("beamer")
-                             ("book")
-                             ("dinbrief")
-                             ("foils")
-                             ("letter")
-                             ("memoir")
-                             ("minimal")
-                             ("prosper")
-                             ("report")
-                             ("scrartcl")
-                             ("scrbook")
-                             ("scrlttr2")
-                             ("scrreprt")
-                             ("slides"))
+                              ("amsbook")
+                              ("article")
+                              ("beamer")
+                              ("book")
+                              ("dinbrief")
+                              ("foils")
+                              ("letter")
+                              ("memoir")
+                              ("minimal")
+                              ("prosper")
+                              ("report")
+                              ("scrartcl")
+                              ("scrbook")
+                              ("scrlttr2")
+                              ("scrreprt")
+                              ("slides"))
   "List of document classes offered when inserting a document environment.
 
 If `TeX-arg-input-file-search' is set to `t', you will get
@@ -2338,49 +2356,49 @@ To insert a hook here, you must insert it in the 
appropiate style file.")
   "Insert arguments to documentclass.
 OPTIONAL and IGNORE are ignored."
   (let* ((TeX-file-extensions '("cls"))
-        (crm-separator ",")
-        style var options defopt optprmpt)
+         (crm-separator ",")
+         style var options defopt optprmpt)
     (unless LaTeX-global-class-files
       (setq LaTeX-global-class-files
-           (if (if (eq TeX-arg-input-file-search 'ask)
-                   (not (y-or-n-p "Find class yourself? "))
-                 TeX-arg-input-file-search)
-               (prog2
-                   (message "Searching for LaTeX classes...")
-                   (TeX-search-files-by-type 'texinputs 'global t t)
-                 (message "Searching for LaTeX classes...done"))
-             LaTeX-style-list)))
+            (if (if (eq TeX-arg-input-file-search 'ask)
+                    (not (y-or-n-p "Find class yourself? "))
+                  TeX-arg-input-file-search)
+                (prog2
+                    (message "Searching for LaTeX classes...")
+                    (TeX-search-files-by-type 'texinputs 'global t t)
+                  (message "Searching for LaTeX classes...done"))
+              LaTeX-style-list)))
     (setq style (completing-read
-                (concat "Document class (default " LaTeX-default-style "): ")
-                LaTeX-global-class-files nil nil nil nil LaTeX-default-style))
+                 (concat "Document class (default " LaTeX-default-style "): ")
+                 LaTeX-global-class-files nil nil nil nil LaTeX-default-style))
     ;; Clean up hook before use.
     (setq TeX-after-document-hook nil)
     (TeX-load-style style)
     (setq var (intern (format "LaTeX-%s-class-options" style)))
     (setq defopt (if (stringp LaTeX-default-options)
-                    LaTeX-default-options
-                  (mapconcat #'identity LaTeX-default-options ",")))
+                     LaTeX-default-options
+                   (mapconcat #'identity LaTeX-default-options ",")))
     (setq optprmpt
-         (if (and defopt (not (string-equal defopt "")))
-             (format "Options (default %s): " defopt) "Options: "))
+          (if (and defopt (not (string-equal defopt "")))
+              (format "Options (default %s): " defopt) "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
-                             optprmpt (mapcar 'list (symbol-value var)) nil nil
-                             nil nil defopt)
-                            ","))))
+                 (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
+                              optprmpt (mapcar 'list (symbol-value var)) nil 
nil
+                              nil nil defopt)
+                             ","))))
       (setq options (TeX-read-string optprmpt nil nil defopt)))
     (unless (zerop (length options))
       (insert LaTeX-optop options LaTeX-optcl)
       (let ((opts (LaTeX-listify-package-options options)))
-       (TeX-add-to-alist 'LaTeX-provided-class-options
-                         (list (cons style opts)))))
+        (TeX-add-to-alist 'LaTeX-provided-class-options
+                          (list (cons style opts)))))
     (insert TeX-grop style TeX-grcl))
 
   (TeX-update-style t)
@@ -2403,20 +2421,20 @@ If at least one package is provided, this function 
returns a cons
 cell, whose CAR is the list of packages and the CDR is the string
 of the options, nil otherwise."
   (let* ((TeX-file-extensions '("sty"))
-        (crm-separator ",")
-        packages var options)
+         (crm-separator ",")
+         packages var options)
     (unless TeX-global-input-files
       (if (if (eq TeX-arg-input-file-search 'ask)
-             (not (y-or-n-p "Find packages yourself? "))
-           TeX-arg-input-file-search)
-         (progn
-           (message "Searching for LaTeX packages...")
-           (setq TeX-global-input-files
-                 (mapcar 'list (TeX-search-files-by-type
-                                'texinputs 'global t t)))
-           (message "Searching for LaTeX packages...done"))))
+              (not (y-or-n-p "Find packages yourself? "))
+            TeX-arg-input-file-search)
+          (progn
+            (message "Searching for LaTeX packages...")
+            (setq TeX-global-input-files
+                  (mapcar 'list (TeX-search-files-by-type
+                                 'texinputs 'global t t)))
+            (message "Searching for LaTeX packages...done"))))
     (setq packages (TeX-completing-read-multiple
-                   "Packages: " TeX-global-input-files))
+                    "Packages: " TeX-global-input-files))
     ;; Clean up hook before use in `LaTeX-arg-usepackage-insert'.
     (setq LaTeX-after-usepackage-hook nil)
     (mapc #'TeX-load-style packages)
@@ -2424,24 +2442,24 @@ of the options, nil otherwise."
     ;; nil otherwise.
     (when packages
       (setq var (if (= 1 (length packages))
-                   (intern (format "LaTeX-%s-package-options" (car packages)))
-                 ;; Something like `\usepackage[options]{pkg1,pkg2,pkg3,...}' 
is
-                 ;; allowed (provided that pkg1, pkg2, pkg3, ... accept same
-                 ;; options).  When there is more than one package, set `var' 
to
-                 ;; a dummy value so next `if' enters else form.
-                 t))
+                    (intern (format "LaTeX-%s-package-options" (car packages)))
+                  ;; Something like `\usepackage[options]{pkg1,pkg2,pkg3,...}' 
is
+                  ;; allowed (provided that pkg1, pkg2, pkg3, ... accept same
+                  ;; options).  When there is more than one package, set `var' 
to
+                  ;; a dummy value so next `if' enters else form.
+                  t))
       (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 (TeX-read-string "Options: ")))
+                   (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 (TeX-read-string "Options: ")))
       (cons packages options))))
 
 (defun LaTeX-arg-usepackage-insert (packages options)
@@ -2449,9 +2467,9 @@ of the options, nil otherwise."
   (unless (zerop (length options))
     (let ((opts (LaTeX-listify-package-options options)))
       (mapc (lambda (elt)
-             (TeX-add-to-alist 'LaTeX-provided-package-options
-                               (list (cons elt opts))))
-           packages))
+              (TeX-add-to-alist 'LaTeX-provided-package-options
+                                (list (cons elt opts))))
+            packages))
     (insert LaTeX-optop options LaTeX-optcl))
   (insert TeX-grop (mapconcat 'identity packages ",") TeX-grcl)
   (run-hooks 'LaTeX-after-usepackage-hook)
@@ -2461,8 +2479,8 @@ of the options, nil otherwise."
   "Insert arguments to usepackage.
 OPTIONAL is ignored."
   (let* ((packages-options (LaTeX-arg-usepackage-read-packages-with-options))
-        (packages (car packages-options))
-        (options (cdr packages-options)))
+         (packages (car packages-options))
+         (options (cdr packages-options)))
     (LaTeX-arg-usepackage-insert packages options)))
 
 (defun LaTeX-insert-usepackages ()
@@ -2473,7 +2491,7 @@ Return t if at least one \\usepackage has been inserted, 
nil
 otherwise."
   (let (packages-options packages options (inserted nil))
     (while (setq packages-options
-                (LaTeX-arg-usepackage-read-packages-with-options))
+                 (LaTeX-arg-usepackage-read-packages-with-options))
       (setq packages (car packages-options))
       (setq options (cdr packages-options))
       (insert TeX-esc "usepackage")
@@ -2484,7 +2502,7 @@ otherwise."
 
 (defcustom LaTeX-search-files-type-alist
   '((texinputs "${TEXINPUTS.latex}" ("tex/generic/" "tex/latex/")
-              TeX-file-extensions)
+               TeX-file-extensions)
     (docs "${TEXDOCS}" ("doc/") TeX-doc-extensions)
     (graphics "${TEXINPUTS}" ("tex/") LaTeX-includegraphics-extensions)
     (bibinputs "${BIBINPUTS}" ("bibtex/bib/") BibTeX-file-extensions)
@@ -2505,14 +2523,14 @@ directory separator.
 Reset the mode for a change of this variable to take effect."
   :group 'TeX-file
   :type '(alist :key-type symbol
-               :value-type
-               (group (string :tag "Kpathsea variable")
-                      (choice :tag "Directories"
-                              (repeat :tag "TDS subdirectories" string)
-                              (repeat :tag "Absolute directories" directory)
-                              (repeat :tag "Variables" variable))
-                      (choice :tag "Extensions"
-                              variable (repeat string)))))
+                :value-type
+                (group (string :tag "Kpathsea variable")
+                       (choice :tag "Directories"
+                               (repeat :tag "TDS subdirectories" string)
+                               (repeat :tag "Absolute directories" directory)
+                               (repeat :tag "Variables" variable))
+                       (choice :tag "Extensions"
+                               variable (repeat string)))))
 
 (defun TeX-arg-input-file (optional &optional prompt local)
   "Prompt for a tex or sty file.
@@ -2521,29 +2539,29 @@ argument, otherwise as a mandatory one.  PROMPT is the 
prompt,
 LOCAL is a flag.  If the flag is set, only complete with local
 files."
   (let ((search (if (eq TeX-arg-input-file-search 'ask)
-                   (not (y-or-n-p "Find file yourself? "))
-                 TeX-arg-input-file-search))
-       file style)
+                    (not (y-or-n-p "Find file yourself? "))
+                  TeX-arg-input-file-search))
+        file style)
     (if search
-       (progn
-         (unless (or TeX-global-input-files local)
-           (message "Searching for files...")
-           (setq TeX-global-input-files
-                 (mapcar 'list (TeX-search-files-by-type
-                                'texinputs 'global t t)))
-           (message "Searching for files...done"))
-         (setq file (completing-read
-                     (TeX-argument-prompt optional prompt "File")
-                     (TeX-delete-dups-by-car
-                      (append (mapcar 'list (TeX-search-files-by-type
-                                             'texinputs 'local t t))
-                              (unless local
-                                TeX-global-input-files))))
-               style file))
+        (progn
+          (unless (or TeX-global-input-files local)
+            (message "Searching for files...")
+            (setq TeX-global-input-files
+                  (mapcar 'list (TeX-search-files-by-type
+                                 'texinputs 'global t t)))
+            (message "Searching for files...done"))
+          (setq file (completing-read
+                      (TeX-argument-prompt optional prompt "File")
+                      (TeX-delete-dups-by-car
+                       (append (mapcar 'list (TeX-search-files-by-type
+                                              'texinputs 'local t t))
+                               (unless local
+                                 TeX-global-input-files))))
+                style file))
       (setq file (read-file-name
-                 (TeX-argument-prompt optional prompt "File") nil ""))
+                  (TeX-argument-prompt optional prompt "File") nil ""))
       (unless (string-equal file "")
-       (setq file (file-relative-name file)))
+        (setq file (file-relative-name file)))
       (setq style (file-name-sans-extension (file-name-nondirectory file))))
     (unless (string-equal "" style)
       (TeX-run-style-hooks style))
@@ -2569,13 +2587,13 @@ string."
   (message "Searching for BibTeX styles...")
   (or BibTeX-global-style-files
       (setq BibTeX-global-style-files
-           (mapcar 'list (TeX-search-files-by-type 'bstinputs 'global t t))))
+            (mapcar 'list (TeX-search-files-by-type 'bstinputs 'global t t))))
   (message "Searching for BibTeX styles...done")
   (TeX-argument-insert
    (completing-read (TeX-argument-prompt optional prompt "BibTeX style")
-                   (append (mapcar 'list (TeX-search-files-by-type
-                                          'bstinputs 'local t t))
-                           BibTeX-global-style-files))
+                    (append (mapcar 'list (TeX-search-files-by-type
+                                           'bstinputs 'local t t))
+                            BibTeX-global-style-files))
    optional))
 
 (defvar BibTeX-global-files nil
@@ -2598,14 +2616,14 @@ string."
   (message "Searching for BibTeX files...")
   (or BibTeX-global-files
       (setq BibTeX-global-files
-           (mapcar 'list (TeX-search-files-by-type 'bibinputs 'global t t))))
+            (mapcar 'list (TeX-search-files-by-type 'bibinputs 'global t t))))
   (message "Searching for BibTeX files...done")
   (let ((styles (multi-prompt
-                "," t
-                (TeX-argument-prompt optional prompt "BibTeX files")
-                (append (mapcar 'list (TeX-search-files-by-type
-                                       'bibinputs 'local t t))
-                        BibTeX-global-files))))
+                 "," t
+                 (TeX-argument-prompt optional prompt "BibTeX files")
+                 (append (mapcar 'list (TeX-search-files-by-type
+                                        'bibinputs 'local t t))
+                         BibTeX-global-files))))
     (apply 'LaTeX-add-bibliographies styles)
     ;; Run style files associated to the bibliography database files in order 
to
     ;; immediately fill `LaTeX-bibitem-list'.
@@ -2619,8 +2637,8 @@ 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)
+                    '(("") ("l") ("r") ("t") ("b") ("tl") ("tr") ("bl") ("br"))
+                    nil t)
    optional))
 
 (defun TeX-arg-lr (optional &optional prompt)
@@ -2630,8 +2648,8 @@ 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)
+                    '(("") ("l") ("r"))
+                    nil t)
    optional))
 
 (defun TeX-arg-tb (optional &optional prompt)
@@ -2641,8 +2659,8 @@ 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)
+                    '(("") ("t") ("b"))
+                    nil t)
    optional))
 
 (defcustom TeX-date-format "%Y/%m/%d"
@@ -2658,8 +2676,8 @@ string."
   (let ((default (format-time-string TeX-date-format (current-time))))
     (TeX-argument-insert
      (TeX-read-string (TeX-argument-prompt
-                      optional prompt (format "Date (default %s)" default))
-                     nil nil default)
+                       optional prompt (format "Date (default %s)" default))
+                      nil nil default)
      optional)))
 
 (defun TeX-arg-version (optional &optional prompt)
@@ -2669,7 +2687,7 @@ insert the resulting value as an optional argument, 
otherwise as
 a mandatory one.  Use PROMPT as the prompt string."
   (TeX-argument-insert
    (TeX-read-string (TeX-argument-prompt optional prompt "Version")
-                   (format-time-string "%Y/%m/%d" (current-time)))
+                    (format-time-string "%Y/%m/%d" (current-time)))
    optional))
 
 (defun TeX-arg-pagestyle (optional &optional prompt definition)
@@ -2679,10 +2697,10 @@ argument, otherwise as a mandatory one.  Use PROMPT as 
the prompt
 string.  If DEFINITION is non-nil, add the chosen pagestyle to
 the list of defined pagestyles."
   (let ((pagestyle (completing-read (TeX-argument-prompt optional prompt
-                                                        "Pagestyle")
-                                   (LaTeX-pagestyle-list))))
+                                                         "Pagestyle")
+                                    (LaTeX-pagestyle-list))))
     (if (and definition (not (string-equal "" pagestyle)))
-       (LaTeX-add-pagestyles pagestyle))
+        (LaTeX-add-pagestyles pagestyle))
     (TeX-argument-insert pagestyle optional)))
 
 (defcustom LaTeX-default-verb-delimiter ?|
@@ -2694,14 +2712,14 @@ the list of defined pagestyles."
   "Prompt for delimiter and text.
 The compatibility argument OPTIONAL and IGNORE are ignored."
   (let ((del (read-quoted-char
-             (concat "Delimiter (default "
-                     (char-to-string LaTeX-default-verb-delimiter) "): "))))
+              (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))
+        (progn
+          (insert del)
+          (goto-char (mark))
+          (insert del))
       (insert del (read-from-minibuffer "Text: ") del))
     (setq LaTeX-default-verb-delimiter del)))
 
@@ -2712,25 +2730,25 @@ a string replacing the default one when asking the user 
for text.
 This function is intended for \\verb like macros which take their
 argument in delimiters like \"\| \|\" or braces \"\{ \}\"."
   (let ((del (read-quoted-char
-             (concat "Delimiter (default "
-                     (char-to-string LaTeX-default-verb-delimiter) "): "))))
+              (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))
-         ;; If the delimiter was an opening brace, close it with a
-         ;; brace, otherwise use the delimiter again
-         (insert (if (= del ?\{)
-                     ?\}
-                   del)))
+        (progn
+          (insert del)
+          (goto-char (mark))
+          ;; If the delimiter was an opening brace, close it with a
+          ;; brace, otherwise use the delimiter again
+          (insert (if (= del ?\{)
+                      ?\}
+                    del)))
       ;; Same thing again
       (insert del (read-from-minibuffer
-                  (TeX-argument-prompt optional prompt "Text"))
-             (if (= del ?\{)
-                 ?\}
-               del)))
+                   (TeX-argument-prompt optional prompt "Text"))
+              (if (= del ?\{)
+                  ?\}
+                del)))
     ;; Do not set `LaTeX-default-verb-delimiter' if the user input was
     ;; an opening brace.  This would give funny results for the next
     ;; "C-c C-m \verb RET"
@@ -2743,7 +2761,7 @@ argument in delimiters like \"\| \|\" or braces \"\{ 
\}\"."
 The numbers are surounded by parenthesizes and separated with a
 comma.  The compatibility argument OPTIONAL is ignored."
   (insert "(" (TeX-read-string (concat first  ": ")) ","
-         (TeX-read-string (concat second ": ")) ")"))
+          (TeX-read-string (concat second ": ")) ")"))
 
 (defun TeX-arg-size (optional)
   "Insert width and height as a pair.
@@ -2778,12 +2796,12 @@ 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"))))
+                       (string :tag "Left")
+                       (string :tag "Right"))))
 
 (defvar TeX-braces-association
   (append TeX-braces-user-association
-         TeX-braces-default-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.")
@@ -2829,13 +2847,13 @@ string."
                  (delete-char 1))))
     (let ((left-brace (completing-read
                        (TeX-argument-prompt optional prompt
-                                           "Which brace")
+                                            "Which brace")
                        TeX-left-right-braces)))
       (insert left-brace)
       (LaTeX-newline)
       (save-excursion
-       (if (TeX-active-mark)
-           (goto-char (mark)))
+        (if (TeX-active-mark)
+            (goto-char (mark)))
         (LaTeX-newline)
         (LaTeX-insert-corresponding-right-macro-and-brace
          left-macro left-brace optional prompt)
@@ -2853,19 +2871,19 @@ supply the corresponding macro such as \\right before 
the right brace macro."
   (when TeX-arg-right-insert-p
     (let (left-brace left-macro)
       (save-excursion
-       ;; Obtain left brace macro name such as "\langle".
-       (setq left-brace (buffer-substring-no-properties
-                         (point)
-                         (progn (backward-word) (backward-char)
-                                (point)))
-             ;; Obtain the name of preceding left macro, if any,
-             ;; such as "left", "bigl" etc.
-             left-macro (LaTeX--find-preceding-left-macro-name)))
+        ;; Obtain left brace macro name such as "\langle".
+        (setq left-brace (buffer-substring-no-properties
+                          (point)
+                          (progn (backward-word) (backward-char)
+                                 (point)))
+              ;; Obtain the name of preceding left macro, if any,
+              ;; such as "left", "bigl" etc.
+              left-macro (LaTeX--find-preceding-left-macro-name)))
       (save-excursion
-       (if (TeX-active-mark)
-           (goto-char (mark)))
-       (LaTeX-insert-corresponding-right-macro-and-brace
-        left-macro left-brace optional)))))
+        (if (TeX-active-mark)
+            (goto-char (mark)))
+        (LaTeX-insert-corresponding-right-macro-and-brace
+         left-macro left-brace optional)))))
 
 (defun LaTeX-insert-left-brace (arg)
   "Insert typed left brace ARG times and possibly a correspondig right brace.
@@ -2877,68 +2895,68 @@ Normally bound to keys \(, { and [."
   ;; the `delete-selection' property, just below this defun, accordingly.
   (let ((auto-p (and LaTeX-electric-left-right-brace (not arg))))
     (if (and auto-p
-            (TeX-active-mark)
-            (> (point) (mark)))
-       (exchange-point-and-mark))
+             (TeX-active-mark)
+             (> (point) (mark)))
+        (exchange-point-and-mark))
     (self-insert-command (prefix-numeric-value arg))
     (if auto-p
         (let ((lbrace (char-to-string last-command-event)) lmacro skip-p)
           (save-excursion
             (backward-char)
-           ;; The brace "{" is exceptional in two aspects.
-           ;; 1. "\{" should be considered as a single brace
-           ;;    like "(" and "[".
-           ;; 2. "\left{" is nonsense while "\left\{" and
-           ;;    "\left(" are not.
-           (if (string= lbrace TeX-grop)
-               ;; If "{" follows "\", set lbrace to "\{".
-               (if (TeX-escaped-p)
-                   (progn
-                     (backward-char)
-                     (setq lbrace (concat TeX-esc TeX-grop)))
-                 ;; Otherwise, don't search for left macros.
-                 (setq skip-p t)))
-           (unless skip-p
-             ;; Obtain the name of preceding left macro, if any,
-             ;; such as "left", "bigl" etc.
-             (setq lmacro (LaTeX--find-preceding-left-macro-name))))
+            ;; The brace "{" is exceptional in two aspects.
+            ;; 1. "\{" should be considered as a single brace
+            ;;    like "(" and "[".
+            ;; 2. "\left{" is nonsense while "\left\{" and
+            ;;    "\left(" are not.
+            (if (string= lbrace TeX-grop)
+                ;; If "{" follows "\", set lbrace to "\{".
+                (if (TeX-escaped-p)
+                    (progn
+                      (backward-char)
+                      (setq lbrace (concat TeX-esc TeX-grop)))
+                  ;; Otherwise, don't search for left macros.
+                  (setq skip-p t)))
+            (unless skip-p
+              ;; Obtain the name of preceding left macro, if any,
+              ;; such as "left", "bigl" etc.
+              (setq lmacro (LaTeX--find-preceding-left-macro-name))))
           (let ((TeX-arg-right-insert-p t)
                 ;; "{" and "}" are paired temporally so that typing
-               ;; a single "{" should insert a pair "{}".
+                ;; a single "{" should insert a pair "{}".
                 (TeX-braces-association
                  (cons (cons TeX-grop TeX-grcl) TeX-braces-association)))
-           (save-excursion
-             (if (TeX-active-mark)
-                 (goto-char (mark)))
-             (LaTeX-insert-corresponding-right-macro-and-brace
-              lmacro lbrace)))))))
+            (save-excursion
+              (if (TeX-active-mark)
+                  (goto-char (mark)))
+              (LaTeX-insert-corresponding-right-macro-and-brace
+               lmacro lbrace)))))))
 ;; Cater for `delete-selection-mode' (bug#36385)
 ;; See the header comment of delsel.el for detail.
 (put #'LaTeX-insert-left-brace 'delete-selection
      ;; COMPATIBILITY for Emacs < 24.3
      (if (and (= emacs-major-version 24)
-             (< emacs-minor-version 3))
-        ;; Emacs < 24.3 doesn't support a function as value of
-        ;; `delete-selection' property.
-        nil
+              (< emacs-minor-version 3))
+         ;; Emacs < 24.3 doesn't support a function as value of
+         ;; `delete-selection' property.
+         nil
        (lambda ()
-        ;; Consult `delete-selection' property when
-        ;; `LaTeX-insert-left-brace' works just the same as
-        ;; `self-insert-command'.
-        (and (or (not LaTeX-electric-left-right-brace)
-                 current-prefix-arg)
-             (let ((f (get #'self-insert-command 'delete-selection)))
-               ;; If `delete-selection' property of
-               ;; `self-insert-command' is one of the predefined
-               ;; special symbols, just return itself.
-               (if (memq f '(yank supersede kill t nil))
-                   ;; FIXME: if this list of special symbols is
-                   ;; extended in future delsel.el, this discrimination
-                   ;; will become wrong.
-                   f
-                 ;; Otherwise, call it as a function and return
-                 ;; its value.
-                 (funcall f)))))))
+         ;; Consult `delete-selection' property when
+         ;; `LaTeX-insert-left-brace' works just the same as
+         ;; `self-insert-command'.
+         (and (or (not LaTeX-electric-left-right-brace)
+                  current-prefix-arg)
+              (let ((f (get #'self-insert-command 'delete-selection)))
+                ;; If `delete-selection' property of
+                ;; `self-insert-command' is one of the predefined
+                ;; special symbols, just return itself.
+                (if (memq f '(yank supersede kill t nil))
+                    ;; FIXME: if this list of special symbols is
+                    ;; extended in future delsel.el, this discrimination
+                    ;; will become wrong.
+                    f
+                  ;; Otherwise, call it as a function and return
+                  ;; its value.
+                  (funcall f)))))))
 
 (defun LaTeX-insert-corresponding-right-macro-and-brace
   (lmacro lbrace &optional optional prompt)
@@ -2955,26 +2973,26 @@ is nil, consult user which brace should be used."
   ;;      form "\(" or "\[".
   ;;  (3) a string in CARs of `LaTeX-left-right-macros-association'.
   (let ((rmacro (cdr (assoc lmacro LaTeX-left-right-macros-association)))
-       (rbrace (cdr (assoc lbrace TeX-braces-association))))
+        (rbrace (cdr (assoc lbrace TeX-braces-association))))
     ;; Since braces like "\(" and "\)" should be paired, RMACRO
     ;; should be considered as null string in the case (2).
     (if (string= lmacro "")
-       (setq rmacro ""))
+        (setq rmacro ""))
     ;; Insert right macros such as "\right", "\bigr" etc., if necessary.
     ;; Even single "\" will be inserted so that "\)" or "\]" is
     ;; inserted after "\(", "\[".
     (if rmacro
-       (insert TeX-esc rmacro))
+        (insert TeX-esc rmacro))
     (cond
      ((and TeX-arg-right-insert-p rbrace)
       (insert rbrace))
      (rmacro
       (insert (completing-read
-              (TeX-argument-prompt
-               optional prompt
-               (format "Which brace (default %s)"
-                       (or rbrace "."))) TeX-left-right-braces
-                       nil nil nil nil (or rbrace ".")))))))
+               (TeX-argument-prompt
+                optional prompt
+                (format "Which brace (default %s)"
+                        (or rbrace "."))) TeX-left-right-braces
+                        nil nil nil nil (or rbrace ".")))))))
 
 (defun LaTeX--find-preceding-left-macro-name ()
   "Return the left macro name just before the point, if any.
@@ -2989,17 +3007,17 @@ If the point is just after unescaped `TeX-esc', return 
the null string."
   ;; {blah blah blah}-!- => nil
   ;; \\-!- => nil
   (let ((name (buffer-substring-no-properties
-              (point)
-              ;; This is only a helper function, so we do not
-              ;; preserve point by save-excursion.
-              (progn
-                ;; Assume left macro names consist of only A-Z and a-z.
-                (skip-chars-backward "A-Za-z")
-                (point)))))
+               (point)
+               ;; This is only a helper function, so we do not
+               ;; preserve point by save-excursion.
+               (progn
+                 ;; Assume left macro names consist of only A-Z and a-z.
+                 (skip-chars-backward "A-Za-z")
+                 (point)))))
     (if (and (TeX-escaped-p)
-            (or (string= name "")
-                (assoc name LaTeX-left-right-macros-association)))
-       name)))
+             (or (string= name "")
+                 (assoc name LaTeX-left-right-macros-association)))
+        name)))
 (define-obsolete-function-alias
   'LaTeX-find-preceeding-left-macro-name
   #'LaTeX--find-preceding-left-macro-name "AUCTeX 12.2"
@@ -3010,8 +3028,8 @@ If the point is just after unescaped `TeX-esc', return 
the null string."
 If nil, do not prompt at all."
   :group 'LaTeX-macro
   :type '(choice (const :tag "User name in Emacs" user-full-name)
-                (const :tag "Do not prompt" nil)
-                string))
+                 (const :tag "Do not prompt" nil)
+                 string))
 
 (defun LaTeX-arg-author (optional &optional prompt)
   "Prompt for author name.
@@ -3019,12 +3037,12 @@ Insert the given value as a TeX macro argument.  If 
OPTIONAL is
 non-nil, insert it as an optional argument.  Use PROMPT as the
 prompt string.  `LaTeX-default-author' is the initial input."
   (let ((author (if LaTeX-default-author
-                   (TeX-read-string
-                    (TeX-argument-prompt optional prompt "Author(s)")
-                    (if (symbolp LaTeX-default-author)
-                        (symbol-value LaTeX-default-author)
-                      LaTeX-default-author))
-                 "")))
+                    (TeX-read-string
+                     (TeX-argument-prompt optional prompt "Author(s)")
+                     (if (symbolp LaTeX-default-author)
+                         (symbol-value LaTeX-default-author)
+                       LaTeX-default-author))
+                  "")))
     (TeX-argument-insert author optional nil)))
 
 (defun TeX-read-key-val (optional key-val-alist &optional prompt)
@@ -3130,17 +3148,17 @@ values of the variable `LaTeX-verbatim-environments' as 
well.")
 (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))
+          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))
+          LaTeX-verbatim-macros-with-braces-local))
 
 (defun LaTeX-verbatim-environments ()
   "Return list of verbatim environments."
   (append LaTeX-verbatim-environments
-         LaTeX-verbatim-environments-local))
+          LaTeX-verbatim-environments-local))
 
 (defun LaTeX-verbatim-macro-boundaries ()
   "Return boundaries of verbatim macro.
@@ -3151,57 +3169,57 @@ 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)))
+          (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))))))
+        (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)))
-              (macro-end (match-end 0))
-              ;; XXX: Here we assume we are dealing with \verb which
-              ;; expects the delimiter right behind the command.
-              ;; However, \lstinline can also cope with whitespace as
-              ;; well as an optional argument after the command.
-              (delimiter (buffer-substring-no-properties
-                          macro-end (1+ macro-end))))
-         ;; Heuristic: If an opening brace is encountered, search for
-         ;; both the opening and the closing brace as an end marker.
-         ;; Like that the function should work for \verb|...| as well
-         ;; as for \url{...}.
-         (when (string= delimiter TeX-grop)
-           (setq delimiter (concat delimiter TeX-grcl)))
-         (goto-char (1+ macro-end))
-         (skip-chars-forward (concat "^" delimiter))
-         (when (<= orig (point))
-           (cons beg (1+ (point)))))))))
+        (let* ((beg (1- (point)))
+               (macro-end (match-end 0))
+               ;; XXX: Here we assume we are dealing with \verb which
+               ;; expects the delimiter right behind the command.
+               ;; However, \lstinline can also cope with whitespace as
+               ;; well as an optional argument after the command.
+               (delimiter (buffer-substring-no-properties
+                           macro-end (1+ macro-end))))
+          ;; Heuristic: If an opening brace is encountered, search for
+          ;; both the opening and the closing brace as an end marker.
+          ;; Like that the function should work for \verb|...| as well
+          ;; as for \url{...}.
+          (when (string= delimiter TeX-grop)
+            (setq delimiter (concat delimiter TeX-grcl)))
+          (goto-char (1+ macro-end))
+          (skip-chars-forward (concat "^" delimiter))
+          (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)))))))
+        (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)))))
+          (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
@@ -3301,7 +3319,7 @@ Environments present in this list are not filled by 
filling
 functions, see `LaTeX-fill-region-as-paragraph'."
   :group 'LaTeX-indentation
   :type '(repeat (list (string :tag "Environment")
-                      (option function))))
+                       (option function))))
 
 (defcustom LaTeX-indent-environment-check t
   "If non-nil, check for any special environments."
@@ -3318,7 +3336,7 @@ functions, see `LaTeX-fill-region-as-paragraph'."
   :group 'LaTeX-indentation
   :type 'regexp)
 (make-obsolete-variable 'LaTeX-verbatim-regexp 
'LaTeX-verbatim-environments-local
-                       "2014-12-19")
+                        "2014-12-19")
 
 (defcustom LaTeX-begin-regexp "begin\\b\\|\\["
   "Regexp matching macros considered begins."
@@ -3349,9 +3367,9 @@ value."
 
 (defvar docTeX-indent-inner-fixed
   `((,(concat (regexp-quote TeX-esc)
-            "\\(begin\\|end\\)[ \t]*{macrocode\\*?}") 4 t)
+             "\\(begin\\|end\\)[ \t]*{macrocode\\*?}") 4 t)
     (,(concat (regexp-quote TeX-esc)
-            "\\(begin\\|end\\)[ \t]*{\\(macro\\|environment\\)\\*?}") 0 nil))
+             "\\(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
@@ -3367,45 +3385,45 @@ 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))))))
+         ;; 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))))))
     (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))))))
+                  (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))))))
     (when (< (current-column) (save-excursion
-                               (LaTeX-back-to-indentation) (current-column)))
+                                (LaTeX-back-to-indentation) (current-column)))
       (LaTeX-back-to-indentation))))
 
 (defun LaTeX-indent-inner-do (inner-indent)
@@ -3442,63 +3460,63 @@ outer indentation in case of a commented line.  The 
symbols
   (save-excursion
     (LaTeX-back-to-indentation force-type)
     (let ((i 0)
-         (list-length (safe-length docTeX-indent-inner-fixed))
-         (case-fold-search nil)
-         entry
-         found)
+          (list-length (safe-length docTeX-indent-inner-fixed))
+          (case-fold-search nil)
+          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))))))
+            ((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
@@ -3506,27 +3524,27 @@ outer indentation in case of a commented line.  The 
symbols
   (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))))
+        (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.
@@ -3535,14 +3553,14 @@ 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)
+        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))
+          comment-current-flag (TeX-in-commented-line))
     (if comment-current-flag
-       (skip-chars-backward "%\n\t ")
+        (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
@@ -3554,88 +3572,88 @@ outer indentation in case of a commented line.  The 
symbols
     ;; 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)))
+                (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))
+          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)))))))
+                    (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.
@@ -3643,24 +3661,24 @@ 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))))))
+           (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))))
+        (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)))
 
@@ -3673,18 +3691,18 @@ 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))))
+               (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))
+        (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)))
 
 
@@ -3697,13 +3715,13 @@ recognized."
 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" \\\])))
+              (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
@@ -3739,70 +3757,70 @@ performed in that case."
   (interactive "*r\nP")
   (let ((end-marker (save-excursion (goto-char to) (point-marker))))
     (if (or (assoc (LaTeX-current-environment) LaTeX-indent-environment-list)
-           (member (TeX-current-macro) LaTeX-fill-excluded-macros)
-           ;; 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)
+            (member (TeX-current-macro) LaTeX-fill-excluded-macros)
+            ;; 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)))))))
+        (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)
+                                          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
@@ -3823,9 +3841,9 @@ 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))))
+                 (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))
 
@@ -3836,7 +3854,7 @@ space does not end a sentence, so don't break a line 
there."
   (skip-chars-forward " \t\n")
 
   (let ((from-plus-indent (point))
-       (oneleft nil))
+        (oneleft nil))
 
     (beginning-of-line)
     (setq from (point))
@@ -3846,11 +3864,11 @@ space does not end a sentence, so don't break a line 
there."
     (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-char -1)
-       (backward-char 1)
-       (setq oneleft t)))
+               (not (and use-hard-newlines
+                         (get-text-property (1- (point)) 'hard))))
+          (delete-char -1)
+        (backward-char 1)
+        (setq oneleft t)))
     (setq to (copy-marker (point) t))
     (goto-char from-plus-indent))
 
@@ -3863,124 +3881,124 @@ space does not end a sentence, so don't break a line 
there."
     (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)))
+                 (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)
-       ;; Delete the fill-prefix from every line.
-       (fill-delete-prefix from to fill-prefix)
-
-       (setq from (point))
-
-       ;; FROM, and point, are now before the text to fill,
-       ;; but after any fill prefix on the first line.
-
-       (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)))))
+      (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)
+        ;; Delete the fill-prefix from every line.
+        (fill-delete-prefix from to fill-prefix)
+
+        (setq from (point))
+
+        ;; FROM, and point, are now before the text to fill,
+        ;; but after any fill prefix on the first line.
+
+        (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))
@@ -3992,28 +4010,28 @@ space does not end a sentence, so don't break a line 
there."
   (fill-move-to-break-point linebeg)
   ;; 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))
+             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 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))))
+             (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
@@ -4022,152 +4040,152 @@ space does not end a sentence, so don't break a line 
there."
   ;; 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)))))
+        (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))))))
+                                        "\\(?:" 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)
+          (final-breakpoint (point))
+          start-point)
       (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)
-                            (skip-chars-forward "^ \n")
-                            (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 "$")
-                          (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)))))))))
+        (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)
+                             (skip-chars-forward "^ \n")
+                             (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 "$")
+                           (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
@@ -4179,10 +4197,10 @@ space does not end a sentence, so don't break a line 
there."
   (newline 1)
   ;; Give newline the properties of the space(s) it replaces
   (set-text-properties (1- (point)) (point)
-                      (text-properties-at (point)))
+                       (text-properties-at (point)))
   (and (looking-at "\\( [ \t]*\\)\\(\\c|\\)?")
        (or (aref (char-category-set (or (char-before (1- (point))) ?\000)) ?|)
-          (match-end 2))
+           (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.
@@ -4191,7 +4209,7 @@ space does not end a sentence, so don't break a line 
there."
   ;; an invisible newline.
   (if fill-nobreak-invisible
       (remove-text-properties (1- (point)) (point)
-                             '(invisible t)))
+                              '(invisible t)))
   ;; Insert the fill prefix.
   (and fill-prefix (not (equal fill-prefix ""))
        ;; Markers that were after the whitespace are now at point: insert
@@ -4212,168 +4230,168 @@ 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]*$")))
+        (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)
+          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)))
+          (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)))
+                                        (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)))
+        (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.
+                (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)))))))))
+        (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)
+        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)))
+                                           (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))))
+            (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)))))))
+                                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.
@@ -4383,28 +4401,28 @@ formatting."
   (interactive "*r\nP")
   (save-excursion
     (let ((to (set-marker (make-marker) to))
-         (next-par (make-marker)))
+          (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))))
+        (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 "Formatting%s...done" (or what "")))
 
@@ -4416,33 +4434,33 @@ If function is called inside a comment and
 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)))
-        (case-fold-search nil))
+         (level 1)
+         (in-comment (TeX-in-commented-line))
+         (comment-prefix (and in-comment (TeX-comment-prefix)))
+         (case-fold-search nil))
     (let ((pt (point)))
       (skip-chars-backward (concat "a-zA-Z \t" (regexp-quote TeX-grop)))
       (unless (bolp)
-       (backward-char 1)
-       (if (and (looking-at regexp)
-                (char-equal (char-after (1+ (match-beginning 0))) ?e))
-           (setq level 0)
-         (goto-char pt))))
+        (backward-char 1)
+        (if (and (looking-at regexp)
+                 (char-equal (char-after (1+ (match-beginning 0))) ?e))
+            (setq level 0)
+          (goto-char pt))))
     (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)))))
+                     (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)
-       (re-search-forward
-        (concat TeX-grop (LaTeX-environment-name-regexp) TeX-grcl))
+        (re-search-forward
+         (concat TeX-grop (LaTeX-environment-name-regexp) TeX-grcl))
       (error "Can't locate end of current environment"))))
 
 (defun LaTeX-find-matching-begin ()
@@ -4453,30 +4471,30 @@ If function is called inside a comment and
 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)))
-        (case-fold-search nil))
+         (level 1)
+         (in-comment (TeX-in-commented-line))
+         (comment-prefix (and in-comment (TeX-comment-prefix)))
+         (case-fold-search nil))
     (skip-chars-backward (concat "a-zA-Z \t" (regexp-quote TeX-grop)))
     (unless (bolp)
       (backward-char 1)
       (and (looking-at regexp)
-          (char-equal (char-after (1+ (match-beginning 0))) ?b)
-          (setq level 0)))
+           (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)))))
+                     (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"))))
+        (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.
@@ -4506,7 +4524,7 @@ environments."
     (LaTeX-mark-environment)
     (re-search-forward "{\\([^}]+\\)}")
     (LaTeX-fill-region (region-beginning) (region-end) justify
-                      (concat " environment " (TeX-match-buffer 1)))))
+                       (concat " environment " (TeX-match-buffer 1)))))
 
 (defun LaTeX-fill-section (justify)
   "Fill and indent current logical section as LaTeX text."
@@ -4515,7 +4533,7 @@ environments."
     (LaTeX-mark-section)
     (re-search-forward "{\\([^}]+\\)}")
     (LaTeX-fill-region (region-beginning) (region-end) justify
-                      (concat " section " (TeX-match-buffer 1)))))
+                       (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.
@@ -4528,19 +4546,19 @@ If the function `outline-mark-subtree' is not available,
 value of NO-SUBSECTIONS."
   (interactive "P")
   (if (or no-subsections
-         (not (fboundp 'outline-mark-subtree)))
+          (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)
-                                   "\\|\\`\\)")))
+        (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))
+               transient-mark-mode
+               (boundp 'mark-active)
+               (not mark-active))
       (setq mark-active t)
       (run-hooks 'activate-mark-hook)))
   (TeX-activate-region))
@@ -4574,16 +4592,16 @@ Regexp part containing TeX control words is postfixed 
with `\\b'
 to avoid ambiguities (e.g. \\par vs. \\parencite)."
   (let (cmds symbs)
     (dolist (mac (append LaTeX-paragraph-commands
-                        LaTeX-paragraph-commands-internal))
+                         LaTeX-paragraph-commands-internal))
       (if (string-match "[^a-zA-Z]" mac)
-         (push mac symbs)
-       (push mac cmds)))
+          (push mac symbs)
+        (push mac cmds)))
     (concat (regexp-quote TeX-esc) "\\(?:"
-           (regexp-opt cmds "\\(?:")
-           "\\b"
-           "\\|"
-           (regexp-opt symbs)
-           "\\)")))
+            (regexp-opt cmds "\\(?:")
+            "\\b"
+            "\\|"
+            (regexp-opt symbs)
+            "\\)")))
 
 (defvar LaTeX-paragraph-commands-regexp)
 
@@ -4594,8 +4612,8 @@ The list should contain macro names without the leading 
backslash."
   :type '(repeat (string))
   :set (lambda (symbol value)
          (set-default symbol value)
-        (setq LaTeX-paragraph-commands-regexp
-              (LaTeX-paragraph-commands-regexp-make))))
+         (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.")
@@ -4603,13 +4621,13 @@ The list should contain macro names without the leading 
backslash."
 (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
+        (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.
@@ -4632,21 +4650,21 @@ If COUNT is non-nil, do it COUNT times."
   (or count (setq count 1))
   (dotimes (_ 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)
+           (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
@@ -4657,27 +4675,27 @@ If COUNT is non-nil, do it COUNT times."
       ;;    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)))))))))
+               (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.
@@ -4686,65 +4704,65 @@ If COUNT is non-nil, do it COUNT times."
   (dotimes (_ 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 (looking-at (regexp-quote 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)))))))))
+               ;; 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 (looking-at (regexp-quote 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.
@@ -4756,13 +4774,13 @@ of verbatim constructs are not considered."
   (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))))
+        (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)))
 
 
@@ -4786,10 +4804,10 @@ 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))
+          (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 ()
@@ -5346,61 +5364,61 @@ MENU and CHARACTER, see `LaTeX-math-list' for details.")
 
 (defun LaTeX-math-initialize ()
   (let ((math (reverse (append LaTeX-math-list LaTeX-math-default)))
-       (map LaTeX-math-keymap)
-       (unicode (and LaTeX-math-menu-unicode (fboundp 'decode-char))))
+        (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)))))))))
+             (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)))))))))
     ;; Make the math prefix char available if it has not been used as a prefix.
     (unless (lookup-key map (LaTeX-math-abbrev-prefix))
       (define-key map (LaTeX-math-abbrev-prefix) 'self-insert-command))))
@@ -5430,22 +5448,22 @@ menu display.  When nil, no character is shown.
 See also `LaTeX-math-menu'."
   :group 'LaTeX-math
   :set (lambda (symbol value)
-        (set-default symbol value)
-        (LaTeX-math-initialize))
+         (set-default symbol value)
+         (LaTeX-math-initialize))
   :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")))))
+                                (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")))))
 
 (defvar LaTeX-math-mode-menu)
 (defvar LaTeX-math-mode-map)
@@ -5479,19 +5497,19 @@ commands are defined:
 If `TeX-electric-math' is non-nil wrap that symbols around the
 string."
   (let ((active (TeX-active-mark))
-       m closer)
+        m closer)
     (if (and active (> (point) (mark)))
-       (exchange-point-and-mark))
+        (exchange-point-and-mark))
     (when dollar
       (insert (or (car TeX-electric-math) "$"))
       (save-excursion
-       (if active (goto-char (mark)))
-       ;; Store closer string for later reference.
-       (setq closer (or (cdr TeX-electric-math) "$"))
-       (insert closer)
-       ;; Set temporal marker to decide whether to put the point
-       ;; after the math mode closer or not.
-       (setq m (point-marker))))
+        (if active (goto-char (mark)))
+        ;; Store closer string for later reference.
+        (setq closer (or (cdr TeX-electric-math) "$"))
+        (insert closer)
+        ;; Set temporal marker to decide whether to put the point
+        ;; after the math mode closer or not.
+        (setq m (point-marker))))
     (funcall LaTeX-math-insert-function string)
     (when dollar
       ;; If the above `LaTeX-math-insert-function' resulted in
@@ -5499,7 +5517,7 @@ string."
       ;; typing "`(", keep the point between them.  Otherwise
       ;; move the point after the math mode closer.
       (if (= m (+ (point) (length closer)))
-         (goto-char m))
+          (goto-char m))
       ;; Make temporal marker point nowhere not to slow down the
       ;; subsequent editing in the buffer.
       (set-marker m nil))))
@@ -5521,41 +5539,41 @@ char."
 (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))))
+                                (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))))
+                                (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)))
+          (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))))
+                                (integer :tag "Number of argument" :value 1))
+                        (repeat :tag "Math Macros" (string))))
   :group 'TeX-fold)
 
 ;;; Narrowing
@@ -5569,7 +5587,7 @@ environments."
   (save-excursion
     (widen)
     (let ((opoint (point))
-         beg end)
+          beg end)
       (dotimes (_ count) (LaTeX-find-matching-end))
       (setq end (point))
       (goto-char opoint)
@@ -5609,7 +5627,7 @@ environments."
     (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 "\e\r"    'LaTeX-insert-item)) ;*** Alias
     (define-key map "\C-c]" 'LaTeX-close-environment)
     (define-key map "\C-c\C-s" 'LaTeX-section)
 
@@ -5641,14 +5659,14 @@ environments."
 (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)))
+         (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))))
+                                  (copy-sequence LaTeX-section-hook))))
     (LaTeX-section level)))
 
 (defun LaTeX-section-menu-entry (entry)
@@ -5663,7 +5681,7 @@ into submenus of nearly equal length.  If nil, never 
split menu into
 submenus."
   :group 'LaTeX-environment
   :type '(choice (const :tag "no submenus" nil)
-                (integer)))
+                 (integer)))
 
 (defcustom LaTeX-submenu-name-format "%-12.12s ... %.12s"
   "Format specification of the submenu name.
@@ -5676,41 +5694,41 @@ 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)))
+                 (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
+            (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))))
+             (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))))
 
 (defun LaTeX-section-menu-filter (ignored)
   "Filter function for the section submenu in the mode menu.
@@ -5718,10 +5736,10 @@ 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)))))
+        (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)
@@ -5736,16 +5754,16 @@ corresponds to the variables 
`LaTeX-environment-menu-name' and
   (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))))))
+        (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))))))))
+        (setq LaTeX-environment-modify-menu
+              (LaTeX-split-long-menu
+               (mapcar 'LaTeX-environment-modify-menu-entry
+                       (LaTeX-environment-list))))))))
 
 (defadvice LaTeX-add-environments (after LaTeX-invalidate-environment-menu 
(&rest environments) activate)
   "Add ENVIRONMENTS to the list of known environments.
@@ -5769,11 +5787,11 @@ regenerated by the respective menu filter."
     ["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)))
+           :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)))
+           :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
@@ -5870,16 +5888,16 @@ regenerated by the respective menu filter."
   "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)))))
+          (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
@@ -5915,9 +5933,9 @@ used instead of `LaTeX-babel-hyphen'.  The third element 
is the
 value overriding `LaTeX-babel-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))))
+                :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.
@@ -5936,46 +5954,46 @@ 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))
+          (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)))
+                        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-char (- hyphen-length))
-                  (insert "--"))
-         (delete-char (- hyphen-length))
-         (call-interactively 'self-insert-command)))
+                                   (point))
+                 hyphen)
+        (if h-after-h
+            (progn (delete-char (- hyphen-length))
+                   (insert "--"))
+          (delete-char (- hyphen-length))
+          (call-interactively 'self-insert-command)))
        ;; -- --> [+]-
        ((string= (buffer-substring (max (- (point) 2) (point-min))
-                                  (point))
-                "--")
-       (call-interactively 'self-insert-command))
+                                   (point))
+                 "--")
+        (call-interactively 'self-insert-command))
        ;; - --> "= / [+]-
        ((eq (char-before) ?-)
-       (if h-after-h
-           (progn (delete-char -1)
-                  (insert hyphen))
-         (call-interactively 'self-insert-command)))
+        (if h-after-h
+            (progn (delete-char -1)
+                   (insert hyphen))
+          (call-interactively 'self-insert-command)))
        (h-after-h
-       (call-interactively 'self-insert-command))
+        (call-interactively 'self-insert-command))
        (t (insert hyphen))))))
 ;; Cater for Delete Selection mode
 (put 'LaTeX-babel-insert-hyphen 'delete-selection t)
@@ -6065,28 +6083,28 @@ of `LaTeX-mode-hook'."
   ;; `TeX-update-style-hook' before toolbarx-refresh, otherwise the 
bibliography
   ;; button could be wrongly set.
   (add-hook 'TeX-update-style-hook
-           (lambda ()
-             (if (local-variable-p 'LaTeX-biblatex-use-Biber (current-buffer))
-                 (setq LaTeX-using-Biber LaTeX-biblatex-use-Biber))) nil t)
+            (lambda ()
+              (if (local-variable-p 'LaTeX-biblatex-use-Biber (current-buffer))
+                  (setq LaTeX-using-Biber LaTeX-biblatex-use-Biber))) nil t)
 
   ;; Run style hooks associated with class options.
   (add-hook 'TeX-update-style-hook
-           (lambda ()
-             (let ((TeX-style-hook-dialect :classopt)
-                   ;; Don't record class option names in
-                   ;; `TeX-active-styles'.
-                   (TeX-active-styles nil))
-               (apply #'TeX-run-style-hooks
-                      (apply #'append
-                             (mapcar #'cdr LaTeX-provided-class-options)))))
-           nil t)
+            (lambda ()
+              (let ((TeX-style-hook-dialect :classopt)
+                    ;; Don't record class option names in
+                    ;; `TeX-active-styles'.
+                    (TeX-active-styles nil))
+                (apply #'TeX-run-style-hooks
+                       (apply #'append
+                              (mapcar #'cdr LaTeX-provided-class-options)))))
+            nil t)
   (run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'LaTeX-mode-hook)
   (when (fboundp 'LaTeX-preview-setup)
     (LaTeX-preview-setup))
   (TeX-set-mode-name)
   ;; Defeat filladapt
   (if (and (boundp 'filladapt-mode)
-          filladapt-mode)
+           filladapt-mode)
       (turn-off-filladapt-mode))
   (when (< 25 emacs-major-version)
     ;; Set up flymake backend, see latex-flymake.el
@@ -6109,8 +6127,8 @@ runs the hooks in `docTeX-mode-hook'."
   (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 "\\(?:%\\(?:<[^>]+>\\)?\\)")
+        paragraph-separate (concat paragraph-separate "\\|%<")
+        TeX-comment-start-regexp "\\(?:%\\(?:<[^>]+>\\)?\\)")
   (setq TeX-base-mode-name "docTeX")
   (TeX-set-mode-name)
   (funcall TeX-install-font-lock))
@@ -6144,8 +6162,8 @@ i.e. you do _not_ have to cater for this yourself by 
adding \\\\' or $."
 
 (defcustom LaTeX-clean-intermediate-suffixes
   (append TeX-clean-default-intermediate-suffixes
-         ;; These are extensions of files created by makeglossaries.
-         '("\\.acn" "\\.acr" "\\.alg" "\\.glg" "\\.ist"))
+          ;; These are extensions of files created by makeglossaries.
+          '("\\.acn" "\\.acr" "\\.alg" "\\.glg" "\\.ist"))
   "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 $."
@@ -6187,7 +6205,7 @@ function would return non-nil and `(match-string 1)' 
would return
       (setq LaTeX-largest-level (LaTeX-section-level "section")))
 
   (setq TeX-header-end LaTeX-header-end
-       TeX-trailer-start LaTeX-trailer-start)
+        TeX-trailer-start LaTeX-trailer-start)
   (set (make-local-variable 'TeX-style-hook-dialect) TeX-dialect)
 
   (require 'outline)
@@ -6195,60 +6213,60 @@ function would return non-nil and `(match-string 1)' 
would return
   (set (make-local-variable '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)))
+          (mapcar (lambda (x)
+                    (cons (concat "\\" (nth 0 x)) (nth 1 x)))
+                  LaTeX-section-list)))
 
   (set (make-local-variable '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
-        "\\|$\\)"))
+        (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)
+        'LaTeX-search-forward-comment-start)
   (set (make-local-variable 'TeX-search-files-type-alist)
        LaTeX-search-files-type-alist)
 
   (set (make-local-variable 'LaTeX-item-list) '(("description" . 
LaTeX-item-argument)
-                                               ("thebibliography" . 
LaTeX-item-bib)
-                                               ("array" . LaTeX-item-array)
-                                               ("tabular" . LaTeX-item-array)
-                                               ("tabular*" . 
LaTeX-item-tabular*)))
+                                                ("thebibliography" . 
LaTeX-item-bib)
+                                                ("array" . LaTeX-item-array)
+                                                ("tabular" . LaTeX-item-array)
+                                                ("tabular*" . 
LaTeX-item-tabular*)))
 
   (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)
-                 ("\\\\[Rr]ef{\\([^{}\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-filtered "}")
-                 ("\\\\end{\\([A-Za-z]*\\)" 1 LaTeX-environment-list-filtered 
"}")
-                 ("\\\\renewcommand\\*?{\\\\\\([A-Za-z]*\\)"
-                  1 TeX-symbol-list-filtered "}")
-                 ("\\\\renewenvironment\\*?{\\([A-Za-z]*\\)"
-                  1 LaTeX-environment-list-filtered "}")
+        (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)
+                  ("\\\\[Rr]ef{\\([^{}\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-filtered "}")
+                  ("\\\\end{\\([A-Za-z]*\\)" 1 LaTeX-environment-list-filtered 
"}")
+                  ("\\\\renewcommand\\*?{\\\\\\([A-Za-z]*\\)"
+                   1 TeX-symbol-list-filtered "}")
+                  ("\\\\renewenvironment\\*?{\\([A-Za-z]*\\)"
+                   1 LaTeX-environment-list-filtered "}")
                   ("\\\\\\(this\\)?pagestyle{\\([A-Za-z]*\\)"
-                  2 LaTeX-pagestyle-list "}")
-                 (LaTeX--after-math-macro-prefix-p
-                  1 (lambda ()
-                      (append (mapcar #'cadr LaTeX-math-list)
-                              (mapcar #'cadr LaTeX-math-default)))
-                  (if TeX-insert-braces "{}")))
-               TeX-complete-list))
+                   2 LaTeX-pagestyle-list "}")
+                  (LaTeX--after-math-macro-prefix-p
+                   1 (lambda ()
+                       (append (mapcar #'cadr LaTeX-math-list)
+                               (mapcar #'cadr LaTeX-math-default)))
+                   (if TeX-insert-braces "{}")))
+                TeX-complete-list))
 
   (LaTeX-add-environments
    '("document" LaTeX-env-document)
@@ -6292,13 +6310,13 @@ function would return non-nil and `(match-string 1)' 
would return
 
   ;; `latex.ltx' defines the following counters
   (LaTeX-add-counters "page" "equation" "enumi" "enumii" "enumiii"
-                     "enumiv" "footnote" "mpfootnote")
+                      "enumiv" "footnote" "mpfootnote")
 
   (LaTeX-add-lengths "arraycolsep" "arrayrulewidth" "baselineskip" 
"baselinestretch"
-                    "bibindent" "columnsep" "columnwidth" "doublerulesep"
-                    "evensidemargin" "linewidth" "oddsidemargin" "paperwidth"
-                    "paperheight" "parindent" "parskip" "tabcolsep"
-                    "textheight" "textwidth" "topmargin" "unitlength")
+                     "bibindent" "columnsep" "columnwidth" "doublerulesep"
+                     "evensidemargin" "linewidth" "oddsidemargin" "paperwidth"
+                     "paperheight" "parindent" "parskip" "tabcolsep"
+                     "textheight" "textwidth" "topmargin" "unitlength")
 
   (TeX-add-symbols
    '("addtocounter" TeX-arg-counter "Value")
@@ -6336,11 +6354,11 @@ function would return non-nil and `(match-string 1)' 
would return
    '("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"))
-                      "") ])
+                                       (backward-char 2)
+                                       (preceding-char)) ?\])
+                                 ()
+                               (TeX-arg-counter t "Within counter"))
+                       "") ])
    '("newfont" TeX-arg-define-macro t)
    '("circle" "Diameter")
    '("circle*" "Diameter")
@@ -6348,15 +6366,15 @@ function would return non-nil and `(match-string 1)' 
would return
      [ 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)))
+                 (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)))
+                (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")
@@ -6375,10 +6393,10 @@ function would return non-nil and `(match-string 1)' 
would return
    '("multicolumn" "Columns" "Format" t)
    '("item"
      (TeX-arg-conditional (or TeX-arg-item-label-p
-                             (string-equal (LaTeX-current-environment)
-                                           "description"))
-                         ([ "Item label" ])
-                         ())
+                              (string-equal (LaTeX-current-environment)
+                                            "description"))
+                          ([ "Item label" ])
+                          ())
      (TeX-arg-literal " "))
    '("bibitem" [ "Bibitem label" ] TeX-arg-define-cite)
    '("cite"
@@ -6429,8 +6447,8 @@ function would return non-nil and `(match-string 1)' 
would return
    '("thanks" t)
    '("title" t)
    '("pagenumbering" (TeX-arg-eval
-                     completing-read "Numbering style: "
-                     '(("arabic") ("roman") ("Roman") ("alph") ("Alph"))))
+                      completing-read "Numbering style: "
+                      '(("arabic") ("roman") ("Roman") ("alph") ("Alph"))))
    '("pagestyle" TeX-arg-pagestyle)
    '("markboth" t nil)
    '("markright" t)
@@ -6707,31 +6725,31 @@ function would return non-nil and `(match-string 1)' 
would return
      '("RequirePackage" LaTeX-arg-usepackage)
      '("ProvidesPackage" (TeX-arg-file-name-sans-extension "Package name")
        [ TeX-arg-conditional (y-or-n-p "Insert version? ")
-        ([ TeX-arg-version ]) nil])
+         ([ TeX-arg-version ]) nil])
      '("ProvidesClass" (TeX-arg-file-name-sans-extension "Class name")
        [ TeX-arg-conditional (y-or-n-p "Insert version? ")
-        ([ TeX-arg-version ]) nil])
+         ([ TeX-arg-version ]) nil])
      '("ProvidesFile" (TeX-arg-file-name "File name")
        [ TeX-arg-conditional (y-or-n-p "Insert version? ")
-        ([ TeX-arg-version ]) nil ])
+         ([ TeX-arg-version ]) nil ])
      '("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-dialect)
+                      ;; 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-dialect)
 
   (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))
-                     TeX-dialect)
+                      ;; 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))
+                      TeX-dialect)
 
   ;; There must be something better-suited, but I don't understand the
   ;; parsing properly.  -- dak
@@ -6739,11 +6757,11 @@ function would return non-nil and `(match-string 1)' 
would return
   (TeX-add-style-hook "pdftricks" #'TeX-PDF-mode-on :classopt)
   (TeX-add-style-hook "pst-pdf" #'TeX-PDF-mode-on :classopt)
   (TeX-add-style-hook "dvips"
-                     (lambda ()
-                       ;; Leave at user's choice whether to disable
-                       ;; `TeX-PDF-mode' or not.
-                       (setq TeX-PDF-from-DVI "Dvips"))
-                     :classopt)
+                      (lambda ()
+                        ;; Leave at user's choice whether to disable
+                        ;; `TeX-PDF-mode' or not.
+                        (setq TeX-PDF-from-DVI "Dvips"))
+                      :classopt)
   ;; 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)
@@ -6751,20 +6769,20 @@ function would return non-nil and `(match-string 1)' 
would return
   (TeX-add-style-hook "dvipdf" #'TeX-PDF-mode-off :classopt)
   (TeX-add-style-hook "dvipdfm" #'TeX-PDF-mode-off :classopt)
   (TeX-add-style-hook "dvipdfmx"
-                     (lambda ()
-                       (TeX-PDF-mode-on)
-                       ;; XeLaTeX normally don't use dvipdfmx
-                       ;; explicitly.
-                       (unless (eq TeX-engine 'xetex)
-                         (setq TeX-PDF-from-DVI "Dvipdfmx")))
-                     :classopt)
+                      (lambda ()
+                        (TeX-PDF-mode-on)
+                        ;; XeLaTeX normally don't use dvipdfmx
+                        ;; explicitly.
+                        (unless (eq TeX-engine 'xetex)
+                          (setq TeX-PDF-from-DVI "Dvipdfmx")))
+                      :classopt)
   ;;  (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)) :classopt)
+                                (TeX-PDF-mode-on)
+                                (TeX-PDF-mode-off)) :classopt)
   ;; 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.
@@ -6787,7 +6805,7 @@ function would return non-nil and `(match-string 1)' 
would return
   ;; play nice with `electric-pair-mode' which is a global minor mode as of
   ;; emacs 24.4.
   (when (and LaTeX-electric-left-right-brace
-            (boundp 'electric-pair-mode))
+             (boundp 'electric-pair-mode))
     (set (make-local-variable 'electric-pair-mode) nil))
 
   ;; Initialization of `add-log-current-defun-function':
@@ -6798,16 +6816,16 @@ function would return non-nil and `(match-string 1)' 
would return
   "Imenu support function for LaTeX."
   (TeX-update-style)
   (let (entries
-       (regexp (LaTeX-outline-regexp)))
+        (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))))
+             (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
@@ -6821,42 +6839,42 @@ function would return non-nil and `(match-string 1)' 
would return
   (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))
+        (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")))
+           "\\\\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 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 "["
+                (mapconcat (lambda (x) x)
+                           (nreverse 2eoptlist) ",") "]"))
     (insert "{" docstyle "}\n")
     (if 2epackages
-       (insert "\\usepackage{"
-               (mapconcat (lambda (x) x)
-                          (nreverse 2epackages) "}\n\\usepackage{") "}\n"))
+        (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)
+          (goto-char (point-min))
+          (while (re-search-forward "\\\\blackandwhite{" nil t)
             (replace-match "\\\\input{" nil nil)))))
   (TeX-normal-mode nil))
 
@@ -6873,16 +6891,16 @@ function would return non-nil and `(match-string 1)' 
would return
       (LaTeX-env-beginning-pos-col)
     (let* ((cur-pos (point)))
       (save-excursion
-       (if (re-search-backward "\\\\\\\\" beg-pos t)
-           (let ((cur-idx (how-many "[^\\]&" (point) cur-pos)))
-             (goto-char beg-pos)
-             (re-search-forward "[^\\]&" cur-pos t (+ 1 cur-idx))
-             ;; If the above searchs fails, i.e. no "&" found,
-             ;; (- (current-column) 1) returns -1, which is wrong.  So
-             ;; we use a fallback (+ 2 beg-col) whenever this happens:
-             (max (- (current-column) 1)
-                  (+ 2 beg-col)))
-         (+ 2 beg-col))))))
+        (if (re-search-backward "\\\\\\\\" beg-pos t)
+            (let ((cur-idx (how-many "[^\\]&" (point) cur-pos)))
+              (goto-char beg-pos)
+              (re-search-forward "[^\\]&" cur-pos t (+ 1 cur-idx))
+              ;; If the above searchs fails, i.e. no "&" found,
+              ;; (- (current-column) 1) returns -1, which is wrong.  So
+              ;; we use a fallback (+ 2 beg-col) whenever this happens:
+              (max (- (current-column) 1)
+                   (+ 2 beg-col)))
+          (+ 2 beg-col))))))
 
 (defun LaTeX-indent-tabular ()
   "Return indent column for the current tabular-like line."
@@ -6890,31 +6908,31 @@ function would return non-nil and `(match-string 1)' 
would return
       (beg-pos . beg-col)
       (LaTeX-env-beginning-pos-col)
     (let ((tabular-like-end-regex
-          (format "\\\\end{%s}"
-                  (regexp-opt
-                   (let (out)
-                     (mapc (lambda (x)
+           (format "\\\\end{%s}"
+                   (regexp-opt
+                    (let (out)
+                      (mapc (lambda (x)
                               (when (eq (cadr x) 'LaTeX-indent-tabular)
                                 (push (car x) out)))
                             LaTeX-indent-environment-list)
-                     out)))))
+                      out)))))
       (cond ((looking-at tabular-like-end-regex)
-            beg-col)
+             beg-col)
 
-           ((looking-at "\\\\\\\\")
-            (+ 2 beg-col))
+            ((looking-at "\\\\\\\\")
+             (+ 2 beg-col))
 
-           ((looking-at "&")
-            (LaTeX-hanging-ampersand-position))
+            ((looking-at "&")
+             (LaTeX-hanging-ampersand-position))
 
-           (t
-            (+ 2
-               (let ((any-col (save-excursion
-                                (when (re-search-backward "\\\\\\\\\\|[^\\]&" 
beg-pos t)
-                                  (current-column)))))
-                 (if (and any-col (= ?& (char-before (match-end 0))))
-                     (1+ any-col)
-                   beg-col))))))))
+            (t
+             (+ 2
+                (let ((any-col (save-excursion
+                                 (when (re-search-backward "\\\\\\\\\\|[^\\]&" 
beg-pos t)
+                                   (current-column)))))
+                  (if (and any-col (= ?& (char-before (match-end 0))))
+                      (1+ any-col)
+                    beg-col))))))))
 
 ;; Utilities:
 
@@ -6927,13 +6945,13 @@ arguments are queried and inserted.  For examples, 
check the
 functions `TeX-arg-color' (style/color.el) or
 `LaTeX-arg-bicaption-bicaption' (style/bicaption.el)."
   `(unless (if (eq TeX-insert-macro-default-style 'show-all-optional-args)
-              (equal current-prefix-arg '(4))
-            (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))))
-             TeX-last-optional-rejected))
+               (equal current-prefix-arg '(4))
+             (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))))
+              TeX-last-optional-rejected))
      ,@body))
 
 (defun LaTeX-extract-key-value-label (&optional key num)
@@ -6961,19 +6979,19 @@ wrapped in \\(?:...\\)? then."
    ;; If KEY is the symbol none, don't look for any key=val:
    (unless (eq key 'none)
      (concat "\\<"
-            ;; Match the key, default is label
-            (or key "label")
-            ;; Optional spaces
-            "[[:space:]]*=[[:space:]]*"
-            ;; Match the value; braces around the value are optional
-            "{?\\("
-            ;; Cater for NUM which sets the regexp group
-            (when (and num (integerp num))
-              (concat "?" (number-to-string num) ":"))
-            ;; One of these chars terminates the value
-            "[^] ,}\r\n\t%]+"
-            ;; Close the group
-            "\\)}?"))
+             ;; Match the key, default is label
+             (or key "label")
+             ;; Optional spaces
+             "[[:space:]]*=[[:space:]]*"
+             ;; Match the value; braces around the value are optional
+             "{?\\("
+             ;; Cater for NUM which sets the regexp group
+             (when (and num (integerp num))
+               (concat "?" (number-to-string num) ":"))
+             ;; One of these chars terminates the value
+             "[^] ,}\r\n\t%]+"
+             ;; Close the group
+             "\\)}?"))
    ;; We are done.  Just search until the next closing bracket
    "[^]]*\\]"))
 
diff --git a/multi-prompt.el b/multi-prompt.el
index 98c6dab..9f5729e 100644
--- a/multi-prompt.el
+++ b/multi-prompt.el
@@ -41,59 +41,59 @@
 
 ;;;###autoload
 (defun multi-prompt (separator
-                    unique prompt table
-                    &optional mp-predicate require-match initial history)
+                     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)))
+                     minibuffer-local-must-match-map
+                   minibuffer-local-completion-map))
+        (new-map (make-sparse-keymap)))
     (set-keymap-parent new-map old-map)
     (define-key new-map separator (if require-match
-                                     'multi-prompt-next-must-match
-                                   'multi-prompt-next))
+                                      '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)
-          (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)))))))))
+           (minibuffer-local-must-match-map new-map)
+           (multi-prompt-found 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 (string= answer "")
-         multi-prompt-found
-       (nreverse (cons answer multi-prompt-found))))))
+          multi-prompt-found
+        (nreverse (cons answer multi-prompt-found))))))
 
 (defun multi-prompt-delete ()
   (interactive)
@@ -118,7 +118,7 @@ are the arguments to `completing-read'.  See that."
     (let ((content (buffer-substring-no-properties (point-min) (point-max))))
       (when (or ;; (not require-match)
                 (assoc content minibuffer-completion-table))
-       (throw 'multi-prompt-next content)))))
+        (throw 'multi-prompt-next content)))))
 
 
 ;;; Support for key=value completion
@@ -156,14 +156,14 @@ 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)))
+            last beg
+            beg (match-end 0)))
     (completion-table-with-context
      (substring string 0 beg)
      (if (not matched)
-        multi-prompt-completion-table
+         multi-prompt-completion-table
        (cadr (assoc (substring string last (1- beg))
-                   multi-prompt-completion-table)))
+                    multi-prompt-completion-table)))
      (substring string beg)
      predicate
      flag)))
@@ -173,10 +173,10 @@ Functions'."
 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))
+            (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)
@@ -184,8 +184,8 @@ the alist elements."
 
 ;;;###autoload
 (defun multi-prompt-key-value
-  (prompt table &optional predicate require-match initial-input
-         hist def inherit-input-method)
+    (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
@@ -198,22 +198,22 @@ DEF, and INHERIT-INPUT-METHOD.
 
 The return value is the string as entered in the minibuffer."
   (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)))
+         (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))
 
diff --git a/plain-tex.el b/plain-tex.el
index af1a74d..f2eaea8 100644
--- a/plain-tex.el
+++ b/plain-tex.el
@@ -148,36 +148,36 @@ of `plain-TeX-mode-hook'."
   (setq local-abbrev-table plain-tex-mode-abbrev-table)
   (set (make-local-variable 'TeX-style-hook-dialect) plain-TeX-dialect)
   (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\\|\\(?:item\\)?item"
-        "\\)"
-        "\\|"
-        "[ \t]*\\$\\$"         ; display math delimitor
-        "\\)" ))
+        (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\\|\\(?:item\\)?item"
+         "\\)"
+         "\\|"
+         "[ \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)
-        "\\)"
-        "\\)"))
+        (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-add-symbols
diff --git a/preview.el b/preview.el
index a24bd91..2150a44 100644
--- a/preview.el
+++ b/preview.el
@@ -73,24 +73,24 @@ preview-latex's bug reporting commands will probably not 
work.")))
 (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))))))
+          ;; 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.
@@ -169,17 +169,17 @@ spec to avoid unnecessary evaluation time."
      (place preview-gs-place)
      (close preview-dvipng-close))
     (png (open preview-gs-open)
-        (place preview-gs-place)
-        (close preview-gs-close))
+         (place preview-gs-place)
+         (close preview-gs-close))
     (jpeg (open preview-gs-open)
-         (place preview-gs-place)
-         (close preview-gs-close))
+          (place preview-gs-place)
+          (close preview-gs-close))
     (pnm (open preview-gs-open)
-         (place preview-gs-place)
-         (close preview-gs-close))
+          (place preview-gs-place)
+          (close preview-gs-close))
     (tiff (open preview-gs-open)
-         (place preview-gs-place)
-         (close preview-gs-close)))
+          (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
@@ -196,13 +196,13 @@ 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 \
+                :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))))
+                       :options (open place close))))
 
 (defcustom preview-gs-image-type-alist
   '((png png "-sDEVICE=png16m")
@@ -216,16 +216,16 @@ 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))))
+                       (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"))))
+                (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'.
@@ -235,8 +235,8 @@ 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))))))
+                    (cdr (assq preview-image-type
+                               preview-image-creators))))))
     (when hook
       (apply (car hook) (append (cdr hook) rest)))))
 
@@ -257,7 +257,7 @@ that is."
   "Extract EPS bounding box vector from FILENAME."
   (with-temp-buffer
     (insert-file-contents-literally filename nil 0 preview-bb-filesize
-                                   t)
+                                    t)
     (goto-char (point-min))
     (when (search-forward-regexp "%%BoundingBox:\
  +\\([-+]?[0-9.]+\\)\
@@ -266,8 +266,8 @@ that is."
  +\\([-+]?[0-9.]+\\)" nil t)
       (vector
        (if preview-preserve-indentation
-          (min 72 (string-to-number (match-string 1)))
-        (string-to-number (match-string 1)))
+           (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))
@@ -312,24 +312,24 @@ LIST consists of TeX dimensions in sp (1/65536 TeX 
point)."
   (and
    (consp list)
    (let* ((dims (vconcat (mapcar
-                         #'(lambda (x)
-                             (/ x 65781.76))
+                          #'(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))
+          (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))))
+                    (vector (- preview-TeX-bb-border)
+                            (- preview-TeX-bb-border)
+                            preview-TeX-bb-border
+                            preview-TeX-bb-border))))
      (dotimes (i 4)
        (aset box i (+ (aref box i) (aref border i))))
      box)))
@@ -339,10 +339,10 @@ LIST consists of TeX dimensions in sp (1/65536 TeX 
point)."
       (executable-find "rungs")
       ;; The MikTeX builtin GS
       (let ((gs (executable-find "mgs")))
-       ;; Check if mgs is functional for external non-MikTeX apps.
-       ;; See 
http://blog.miktex.org/post/2005/04/07/Starting-mgsexe-at-the-DOS-Prompt.aspx
-       (when (and gs (= 0 (shell-command (concat (shell-quote-argument gs) " 
-q -dNODISPLAY -c quit"))))
-         gs))
+        ;; Check if mgs is functional for external non-MikTeX apps.
+        ;; See 
http://blog.miktex.org/post/2005/04/07/Starting-mgsexe-at-the-DOS-Prompt.aspx
+        (when (and gs (= 0 (shell-command (concat (shell-quote-argument gs) " 
-q -dNODISPLAY -c quit"))))
+          gs))
       ;; Windows ghostscript
       (executable-find "GSWIN32C.EXE")
       ;; standard GhostScript
@@ -352,9 +352,9 @@ LIST consists of TeX dimensions in sp (1/65536 TeX point)."
   :type 'string)
 
 (defcustom preview-gs-options '("-q" "-dDELAYSAFER" "-dNOPAUSE"
-                               "-DNOPLATFONTS" "-dPrinted"
-                               "-dTextAlphaBits=4"
-                               "-dGraphicsAlphaBits=4")
+                                "-DNOPLATFONTS" "-dPrinted"
+                                "-dTextAlphaBits=4"
+                                "-dGraphicsAlphaBits=4")
   "Options with which to call gs for conversion from EPS.
 See also `preview-gs-command'."
   :group 'preview-gs
@@ -379,12 +379,12 @@ 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"))
+          :match-alternatives
+          ((lambda (value) (and
+                            (integerp value)
+                            (> value 0)
+                            (< value 10))))
+          :tag "small number"))
 
 (defvar preview-gs-answer nil
   "Accumulated answer of Ghostscript process.")
@@ -435,8 +435,8 @@ dots per inch.  Buffer-local to rendering buffer.")
 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))))
+          (/ (* scale xres) (preview-get-magnification))
+          (/ (* scale yres) (preview-get-magnification))))
 
 (defun preview-gs-behead-outstanding (err)
   "Remove leading element of outstanding queue after error.
@@ -477,19 +477,19 @@ of a cell used for string concatenation."
     (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))
+           (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))
@@ -536,8 +536,8 @@ 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)))
+                 (const gif)
+                 (symbol :tag "Other" :value png)))
 
 (defcustom preview-dvips-command
   "dvips -Pwww -i -E %d -o %m/preview.000"
@@ -562,7 +562,7 @@ if you customize this."
   (mapc #'preview-delete preview-gs-outstanding)
   (dolist (ov preview-gs-queue)
     (if (overlay-get ov 'queued)
-       (preview-delete ov)))
+        (preview-delete ov)))
   (setq preview-gs-outstanding nil)
   (setq preview-gs-queue nil))
 
@@ -576,18 +576,18 @@ 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))
+                                  (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)))))
+        (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)
@@ -596,9 +596,9 @@ 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))
+        (signal (car preview-error-condition) (cdr preview-error-condition))
       (setq preview-error-condition nil
-           compilation-in-progress (delq process compilation-in-progress)))))
+            compilation-in-progress (delq process compilation-in-progress)))))
 
 (defcustom preview-pdf-color-adjust-method t
   "Method to adjust colors of images generated from PDF.
@@ -639,9 +639,9 @@ are written in the image although they may not match with 
your
 Emacs color well."
   :group 'preview-appearance
   :type '(choice
-         (const :tag "Adjust to Emacs color (gs > 9.27)" t)
-         (const :tag "Compatibility for gs =< 9.27" compatible)
-         (const :tag "No adjustment (B/W, for gs 9.27)" nil)))
+          (const :tag "Adjust to Emacs color (gs > 9.27)" t)
+          (const :tag "Compatibility for gs =< 9.27" compatible)
+          (const :tag "No adjustment (B/W, for gs 9.27)" nil)))
 
 (defun preview-gs-sentinel (process string)
   "Sentinel function for rendering process.
@@ -649,53 +649,53 @@ 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)))))))
+        (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))
 
@@ -707,42 +707,42 @@ Gets the usual PROCESS and STRING parameters, see
     (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))))))
+             (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)))
+        (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 "-sOutputFile=%s"
-                           (file-relative-name
-                            (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)))
+           (outfile (format "-sOutputFile=%s"
+                            (file-relative-name
+                             (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")
+                             (mapconcat #'shell-quote-argument
+                                        (append
+                                         (list preview-gs-command
+                                               outfile)
+                                         preview-gs-command-line)
+                                        " ") "''\n")
       (setq preview-gs-answer "")
       (set-process-query-on-exit-flag process nil)
       (set-process-sentinel process #'preview-gs-sentinel)
@@ -761,10 +761,10 @@ SETUP may contain a parser setup function."
     (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-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\
 <</BeginPage{currentpagedevice/PageSize get dup 0 get 1 ne exch 1 get 1 ne or\
@@ -773,19 +773,19 @@ null eq{pop{pop}bind}if def\
 {pop}{setpagedevice}{ifelse exec}\
 stopped{handleerror quit}if \
 .preview-ST aload pop restore}bind def "
-                 (preview-gs-color-string
-                  preview-colors
-                  ;; Compatibility for gs 9.27 with non-trivial
-                  ;; foreground color and dark background.
-                  ;; Suppress color adjustment with PDF backend
-                  ;; when `preview-pdf-color-adjust-method' is nil.
-                  (and (not preview-pdf-color-adjust-method)
-                       ;; The switch `preview-parsed-pdfoutput' isn't
-                       ;; set before parsing the latex output, so use
-                       ;; heuristic here.
-                       (with-current-buffer TeX-command-buffer
-                         (and TeX-PDF-mode
-                              (not (TeX-PDF-from-DVI))))))))
+                  (preview-gs-color-string
+                   preview-colors
+                   ;; Compatibility for gs 9.27 with non-trivial
+                   ;; foreground color and dark background.
+                   ;; Suppress color adjustment with PDF backend
+                   ;; when `preview-pdf-color-adjust-method' is nil.
+                   (and (not preview-pdf-color-adjust-method)
+                        ;; The switch `preview-parsed-pdfoutput' isn't
+                        ;; set before parsing the latex output, so use
+                        ;; heuristic here.
+                        (with-current-buffer TeX-command-buffer
+                          (and TeX-PDF-mode
+                               (not (TeX-PDF-from-DVI))))))))
     (preview-gs-queue-empty)
     (preview-parse-messages (or setup #'preview-gs-dvips-process-setup))))
 
@@ -799,69 +799,69 @@ to Ghostscript floats."
   "Return a string that patches PDF foreground color to work properly."
   (let ((fg (aref colors 1)))
     (if fg
-       (cond ((eq preview-pdf-color-adjust-method t)
-              ;; New code for gs > 9.27.
-              ;; This assumes DELAYBIND feature, which is known to be
-              ;; broken in gs 9.27 (and possibly, < 9.27).
-              ;; 
<URL:https://lists.gnu.org/archive/html/auctex-devel/2019-07/msg00000.html>
-              ;; DELAYBIND is sometimes mentioned in association with
-              ;; security holes in the changelog of Ghostscript:
-              ;; <URL:https://www.ghostscript.com/doc/9.27/History9.htm>
-              ;; Thus we might have to be prepared for removal of this
-              ;; feature in future Ghostscript.
-              (concat
-               "/initgraphics {
+        (cond ((eq preview-pdf-color-adjust-method t)
+               ;; New code for gs > 9.27.
+               ;; This assumes DELAYBIND feature, which is known to be
+               ;; broken in gs 9.27 (and possibly, < 9.27).
+               ;; 
<URL:https://lists.gnu.org/archive/html/auctex-devel/2019-07/msg00000.html>
+               ;; DELAYBIND is sometimes mentioned in association with
+               ;; security holes in the changelog of Ghostscript:
+               ;; <URL:https://www.ghostscript.com/doc/9.27/History9.htm>
+               ;; Thus we might have to be prepared for removal of this
+               ;; feature in future Ghostscript.
+               (concat
+                "/initgraphics {
   //initgraphics
   /RG where {
     pop "
-               (mapconcat #'preview-gs-color-value fg " ")
-               " 3 copy rg RG
+                (mapconcat #'preview-gs-color-value fg " ")
+                " 3 copy rg RG
   } if
 } bind def .bindnow "))
-             ((eq preview-pdf-color-adjust-method 'compatible)
-              ;; Traditional code for gs < 9.27.
-              (concat
-               "/GS_PDF_ProcSet GS_PDF_ProcSet dup maxlength dict copy dup 
begin\
+              ((eq preview-pdf-color-adjust-method 'compatible)
+               ;; Traditional code for gs < 9.27.
+               (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 "))
-             (;; Do nothing otherwise.
-              t
-              "")))))
+                (mapconcat #'preview-gs-color-value fg " ")
+                " 3 copy rg RG}bind store end readonly store "))
+              (;; Do nothing otherwise.
+               t
+               "")))))
 
 (defun preview-gs-color-string (colors &optional suppress-fgbg)
   "Return a string setting up COLORS.
 If optional argument SUPPRESS-FGBG is non-nil, behave as if FG/BG
 colors were just the default value."
   (let ((bg (and (not suppress-fgbg)
-                (aref colors 0)))
-       (fg (and (not suppress-fgbg)
-                (aref colors 1)))
-       (mask (aref colors 2))
-       (border (aref colors 3)))
+                 (aref colors 0)))
+        (fg (and (not suppress-fgbg)
+                 (aref colors 1)))
+        (mask (aref colors 2))
+        (border (aref colors 3)))
     (concat
      (and (or (and mask border) (and bg (not fg)))
-         "gsave ")
+          "gsave ")
      (and bg
-        (concat
-         (mapconcat #'preview-gs-color-value bg " ")
-         " setrgbcolor clippath fill "))
+         (concat
+          (mapconcat #'preview-gs-color-value bg " ")
+          " setrgbcolor clippath fill "))
      (and mask border
-        (format "%s setrgbcolor false setstrokeadjust %g \
+         (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.
+                 (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 ")
+          "grestore ")
      (and fg
-         (concat
-          (mapconcat #'preview-gs-color-value fg " ")
-          " setrgbcolor")))))
+          (concat
+           (mapconcat #'preview-gs-color-value fg " ")
+           " setrgbcolor")))))
 
 (defun preview-dvipng-color-string (colors res)
   "Return color setup tokens for dvipng.
@@ -874,16 +874,16 @@ Pure borderless black-on-white will return an empty 
string."
        (border (aref colors 3)))
     (concat
      (and bg
-         (format "--bg \"rgb %s\" "
-                 (mapconcat #'preview-gs-color-value bg " ")))
+          (format "--bg \"rgb %s\" "
+                  (mapconcat #'preview-gs-color-value bg " ")))
      (and fg
-         (format "--fg \"rgb %s\" "
-                 (mapconcat #'preview-gs-color-value fg " ")))
+          (format "--fg \"rgb %s\" "
+                  (mapconcat #'preview-gs-color-value fg " ")))
      (and mask border
-         (format "--bd \"rgb %s\" "
-                 (mapconcat #'preview-gs-color-value mask " ")))
+          (format "--bd \"rgb %s\" "
+                  (mapconcat #'preview-gs-color-value mask " ")))
      (and border
-         (format "--bd %d" (max 1 (round (/ (* res border) 72.0))))))))
+          (format "--bd %d" (max 1 (round (/ (* res border) 72.0))))))))
 
 (defsubst preview-supports-image-type (imagetype)
   "Check if IMAGETYPE is supported."
@@ -893,47 +893,47 @@ Pure borderless black-on-white will return an empty 
string."
   "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))
+           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)))))
+                                 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))))
+            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)))))
+                                 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))
+          (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))
+             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))))
+          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)))
+          preview-gs-image-type)))
 
 (defun preview-dvips-abort ()
   "Abort a Dvips run."
@@ -941,12 +941,12 @@ Pure borderless black-on-white will return an empty 
string."
   (condition-case nil
       (delete-file
        (let ((gsfile preview-gs-file))
-        (with-current-buffer TeX-command-buffer
-          (funcall (car gsfile) "dvi" t))))
+         (with-current-buffer TeX-command-buffer
+           (funcall (car gsfile) "dvi" t))))
     (file-error nil))
   (when preview-ps-file
     (condition-case nil
-       (preview-delete-file preview-ps-file)
+        (preview-delete-file preview-ps-file)
       (file-error nil)))
   (setq TeX-sentinel-function nil))
 
@@ -959,27 +959,27 @@ 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" t)))
-                (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))))
+            (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" t)))
+                 (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))
 
@@ -989,29 +989,29 @@ 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)
-              ;; Add DELAYBIND option for adjustment of foreground
-              ;; color to work.
-              (if (eq preview-pdf-color-adjust-method t)
-                  (setq preview-gs-command-line (append
-                                                 preview-gs-command-line
-                                                 '("-dDELAYBIND"))))
-              (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))))
+        (cond ((eq status 'exit)
+               (delete-process process)
+               (setq TeX-sentinel-function nil)
+               ;; Add DELAYBIND option for adjustment of foreground
+               ;; color to work.
+               (if (eq preview-pdf-color-adjust-method t)
+                   (setq preview-gs-command-line (append
+                                                  preview-gs-command-line
+                                                  '("-dDELAYBIND"))))
+               (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))
 
@@ -1020,30 +1020,30 @@ The usual PROCESS and COMMAND arguments for
   (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))
+          (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)))))
+        (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.
@@ -1051,14 +1051,14 @@ 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))))
+        (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))
 
@@ -1068,23 +1068,23 @@ The usual PROCESS and COMMAND arguments for
       (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))))))
+        (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.
@@ -1094,41 +1094,41 @@ the pages.  Page 0 corresponds to the initialization 
section."
     (set-buffer-multibyte nil)
     (insert-file-contents-literally file)
     (let ((last-pt (point-min))
-         trailer
-         pagelist
-         lastbegin
-         pt
-         case-fold-search
-         (level 0))
+          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))))
+        (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))
+        (error "Unmatched %%%%BeginDocument in `%s' at offset %d"
+               file lastbegin))
       (push (list last-pt
-                 (- (or trailer (point-max)) last-pt)) pagelist)
+                  (- (or trailer (point-max)) last-pt)) pagelist)
       (vconcat (nreverse pagelist)))))
 
 (defun preview-gs-dsc-cvx (page dsc)
@@ -1138,7 +1138,7 @@ 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))))
+            (1- (car curpage)) (nth 1 curpage))))
 
 (defun preview-ps-quote-filename (str &optional nonrel)
   "Make a PostScript string from filename STR.
@@ -1148,36 +1148,36 @@ NONREL is not NIL."
   (let ((index 0))
     (while (setq index (string-match "[\\()]" str index))
       (setq str (replace-match "\\\\\\&" t nil str)
-           index (+ 2 index)))
+            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)))
-        (all-files (if (and (consp (car preview-ps-file))
-                            (consp (caar preview-ps-file)))
-                       (caar preview-ps-file)
-                     (list file))))
+                   (if (consp (caar preview-ps-file))
+                       (car (last (caar preview-ps-file)))
+                     (caar preview-ps-file))
+                 (car preview-ps-file)))
+         (all-files (if (and (consp (car preview-ps-file))
+                             (consp (caar preview-ps-file)))
+                        (caar preview-ps-file)
+                      (list file))))
     (setq preview-gs-dsc (preview-dsc-parse file))
     (setq preview-gs-init-string
-         ;; Add commands for revised file access controls introduced
-         ;; after gs 9.27 (bug#37719)
-         (concat (format "systemdict /.addcontrolpath known {%s} if\n"
-                         (mapconcat (lambda (f)
-                                      (format "/PermitFileReading %s 
.addcontrolpath"
-                                              (preview-ps-quote-filename f)))
-                                    all-files "\n"))
-                 (format "{<</PermitFileReading[%s]>> setuserparams \
+          ;; Add commands for revised file access controls introduced
+          ;; after gs 9.27 (bug#37719)
+          (concat (format "systemdict /.addcontrolpath known {%s} if\n"
+                          (mapconcat (lambda (f)
+                                       (format "/PermitFileReading %s 
.addcontrolpath"
+                                               (preview-ps-quote-filename f)))
+                                     all-files "\n"))
+                  (format "{<</PermitFileReading[%s]>> setuserparams \
 .locksafe} stopped pop "
-                         (mapconcat #'preview-ps-quote-filename all-files ""))
-                 preview-gs-init-string
-                 (format " %s(r)file /.preview-ST 1 index def %s exec 
.preview-ST "
-                         (preview-ps-quote-filename file)
-                         (preview-gs-dsc-cvx 0 preview-gs-dsc))))))
+                          (mapconcat #'preview-ps-quote-filename all-files ""))
+                  preview-gs-init-string
+                  (format " %s(r)file /.preview-ST 1 index def %s exec 
.preview-ST "
+                          (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.
@@ -1195,7 +1195,7 @@ is located."
   ;; We must return t.
   (preview-remove-urgentization ov)
   (when (and (overlay-get ov 'queued)
-            (overlay-buffer ov))
+             (overlay-buffer ov))
     (with-current-buffer buff
       (push ov preview-gs-queue)))
   t)
@@ -1233,16 +1233,16 @@ 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))))
+               (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))
+               (vector box nil snippet))
   (overlay-put ov 'preview-image
-              (list (preview-icon-copy preview-nonready-icon)))
+               (list (preview-icon-copy preview-nonready-icon)))
   (preview-add-urgentization #'preview-gs-urgentize ov run-buffer)
   (list ov))
 
@@ -1266,21 +1266,21 @@ are functions to call on preview's clicks."
      ,@(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)))
+          `(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)))
 
 (defun preview-mouse-open-error (string)
   "Display STRING in a new view buffer on click."
   (let ((buff (get-buffer-create
-              "*Preview-Ghostscript-Error*")))
+               "*Preview-Ghostscript-Error*")))
     (with-current-buffer buff
       (kill-all-local-variables)
       (set (make-local-variable 'view-exit-action) #'kill-buffer)
@@ -1296,15 +1296,15 @@ Place point at POSITION, else beginning of file."
   (let ((default-mode
           ;; FIXME: Yuck!  Just arrange for the file name to have the right
           ;; extension instead!
-         (assoc-default "x.ps" auto-mode-alist #'string-match))
-       (buff (get-file-buffer file)))
+          (assoc-default "x.ps" auto-mode-alist #'string-match))
+        (buff (get-file-buffer file)))
     (save-excursion
       (if buff
-         (pop-to-buffer buff)
-       (view-file-other-window file))
+          (pop-to-buffer buff)
+        (view-file-other-window file))
       (if (and (eq major-mode (default-value 'major-mode))
-              default-mode)
-         (funcall default-mode))
+               default-mode)
+          (funcall default-mode))
       (goto-char (or position (point-min)))
       (message "%s" (substitute-command-keys "\
 Try \\[ps-run-start] \\[ps-run-buffer] and \
@@ -1318,48 +1318,48 @@ Try \\[ps-run-start] \\[ps-run-buffer] and \
   ;; line is for "[...].prv/tmpXXXXXX/pr1-2.png" while the error is
   ;; raised for "[...].prv/tmpXXXXXX/pr1-1.png".  (c.f. bug#37719)
   (let* ((filenames (overlay-get ov 'filenames))
-        (file (car (nth 0 filenames)))
-        ;; FIXME: This format isn't equal to actual invocation of gs
-        ;; command constructed in `preview-gs-restart', which
-        ;; contains "%d".
-        (outfile (format "-sOutputFile=%s"
-                         (file-relative-name
-                          (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
+         (file (car (nth 0 filenames)))
+         ;; FIXME: This format isn't equal to actual invocation of gs
+         ;; command constructed in `preview-gs-restart', which
+         ;; contains "%d".
+         (outfile (format "-sOutputFile=%s"
+                          (file-relative-name
+                           (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)))]))))))
+           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)))
 
@@ -1370,91 +1370,91 @@ 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 ))))
+        (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)))))
+        (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)))
+                   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 \
+        (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))))))
+                             (- (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)))))
+          (process-send-eof process)
+        (error nil)))))
 
 (defun preview-hook-enquiry (hook)
   "Gets a value from a configured hook.
@@ -1463,16 +1463,16 @@ 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)))
+         (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)))
 
 (defun preview-inherited-face-attribute (face attribute &optional inherit)
   "Fetch face attribute while adhering to inheritance.
@@ -1487,9 +1487,9 @@ 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)))
+                 (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'.
@@ -1504,17 +1504,17 @@ This is for matching screen font size and previews."
            (number :tag "Other" :value 11.0)))
 
 (defcustom preview-document-pt-list '(preview-parsed-font-size
-                                     preview-auctex-font-size
-                                     preview-default-document-pt)
+                                      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))))
+            ;; 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.
@@ -1522,14 +1522,14 @@ 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."
   (let* ((regexp "\\`\\([0-9]+\\)pt\\'")
-        (option
-         (or
-          (LaTeX-match-class-option regexp)
-          ;; We don't have `LaTeX-match-package-option'.
-          (TeX-member regexp
-                      (apply #'append
-                             (mapcar #'cdr LaTeX-provided-package-options))
-                      #'string-match))))
+         (option
+          (or
+           (LaTeX-match-class-option regexp)
+           ;; We don't have `LaTeX-match-package-option'.
+           (TeX-member regexp
+                       (apply #'append
+                              (mapcar #'cdr LaTeX-provided-package-options))
+                       #'string-match))))
     (if option (string-to-number (match-string 1 option)))))
 
 (defsubst preview-document-pt ()
@@ -1543,8 +1543,8 @@ 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))))
+                                              'default) 10.0)
+        (preview-document-pt))))
 
 (defvar preview-min-spec)
 
@@ -1555,42 +1555,42 @@ The first spec that is workable (given the current 
setting of
 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)))))))
+          (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))))))
+                (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))))))
+           (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))))
+         (if (> value preview-min-spec)
+             (throw 'preview-filter-specs nil)
+           (preview-filter-specs-1 args))))
 
 (put 'preview-filter-specs :file
      #'(lambda (_keyword value &rest args)
-        `(:file ,(expand-file-name value (expand-file-name "images"
-                                                           TeX-data-directory))
-                ,@(preview-filter-specs-1 args))))
+         `(:file ,(expand-file-name value (expand-file-name "images"
+                                                            
TeX-data-directory))
+                 ,@(preview-filter-specs-1 args))))
 
 (defun preview-ascent-from-bb (bb)
   "This calculates the image ascent from its bounding box.
@@ -1603,16 +1603,16 @@ numbers (can be float if available)."
   ;; If not, something is amiss.  We just use 100 in that case.
 
   (let ((bottom (aref bb 1))
-       (top (aref bb 3)))
+        (top (aref bb 3)))
     (if (and (<= bottom 720)
-            (> top 720))
-       (round (* 100.0 (/ (- top 720.0) (- top bottom))))
+             (> top 720))
+        (round (* 100.0 (/ (- top 720.0) (- top bottom))))
       100)))
 
 (defface preview-face '((((background dark))
-                        (:background "dark slate gray"))
-                       (t
-                        (:background "beige")))
+                         (:background "dark slate gray"))
+                        (t
+                         (:background "beige")))
   "Face to use for the preview source."
   :group 'preview-appearance)
 
@@ -1623,7 +1623,7 @@ Fallback to :inherit and 'default implemented."
 
 (defcustom preview-auto-reveal
   '(eval (preview-arrived-via (key-binding [left]) (key-binding [right])
-                             'backward-char 'forward-char))
+                              'backward-char 'forward-char))
   "Cause previews to open automatically when entered.
 Possibilities are:
 T autoopens,
@@ -1639,15 +1639,15 @@ 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)))))
+                 (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.
@@ -1657,13 +1657,13 @@ 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)
+         (and (boundp mode)
               (symbol-value mode)))
-       ((integerp mode)
-        (and distance (/= 0 distance) (<= (abs distance) mode)))
-       ((consp mode)
-        (apply (car mode) (cdr mode)))
-       (t 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.
@@ -1671,7 +1671,7 @@ Returns non-NIL if called by one of the commands in LIST."
   (memq this-command list))
 
 (defcustom preview-equality-transforms '(identity
-                                        preview-canonical-spaces)
+                                         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
@@ -1685,14 +1685,14 @@ considered unchanged."
 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))))
+                 (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
@@ -1712,20 +1712,20 @@ 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")))
+                 (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)))))
+         (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
@@ -1733,7 +1733,7 @@ Consults `preview-transparent-color'."
     :type ,type
     :ascent ,ascent
     ,@(and border
-          '(:mask (heuristic t)))))
+           '(:mask (heuristic t)))))
 
 (defun preview-create-icon (file type ascent border)
   "Create an icon from FILE, image TYPE, ASCENT and BORDER."
@@ -1744,23 +1744,23 @@ Consults `preview-transparent-color'."
 (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))))
+           `(image :type ,value
+                   ,@(preview-filter-specs-1 args))
+         (throw 'preview-filter-specs nil))))
 
 (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))))))
+         (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))))))
 
 ;; No defcustom here: does not seem to make sense.
 
@@ -1785,8 +1785,8 @@ 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)))))))
+          (car (cdr dispro))
+        (overlay-put ov 'display (cdr (cdr dispro)))))))
 
 (defvar preview-overlay nil)
 
@@ -1839,26 +1839,26 @@ 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)
+                    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))))))))
+           (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.
@@ -1876,12 +1876,12 @@ This stores the old contents of the overlay in the
 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 t)
       (overlay-put ov 'preview-prechange
-                  (save-restriction
-                    (widen)
-                    (buffer-substring-no-properties
-                     (overlay-start ov) (overlay-end ov)))))
+                   (save-restriction
+                     (widen)
+                     (buffer-substring-no-properties
+                      (overlay-start ov) (overlay-end ov)))))
     (push ov preview-change-list)))
 
 (defun preview-check-changes ()
@@ -1889,20 +1889,20 @@ find it at some later point of time."
 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)))))
+        (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))
@@ -1914,8 +1914,8 @@ 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))))
+        (if (eq (overlay-get ov 'preview-state) 'active)
+            (move-overlay ov end (overlay-end ov))))
     (preview-register-change ov)))
 
 (defun preview-handle-insert-behind
@@ -1926,8 +1926,8 @@ 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)))
+        (if (eq (overlay-get ov 'preview-state) 'active)
+            (move-overlay ov (overlay-start ov) beg)))
     (preview-register-change ov)))
 
 (defun preview-handle-modification
@@ -1947,39 +1947,39 @@ 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)))
+        (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)))
+          (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))))
+          (apply 'preview-add-urgentization old-urgent))))
   (if event
       (preview-restore-position
        ov
        (if (windowp event)
-          event
-        (posn-window (event-start event))))))
+           event
+         (posn-window (event-start event))))))
 
 (defvar preview-marker (make-marker)
   "Marker for fake intangibility.")
@@ -2009,59 +2009,59 @@ 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))))))
+          (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)))))
+          (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)))))
+              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)))))
+               (or (null pos)
+                   (and
+                    (> pos (overlay-start ovr))
+                    (< pos (overlay-end ovr)))))
       (preview-toggle ovr)
       (push ovr preview-temporary-opened))))
 
@@ -2076,11 +2076,11 @@ overlays not in the active window."
   :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))
+         (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)
 
 (defun preview-relaxed-string= (&rest args)
@@ -2100,29 +2100,29 @@ Removes comments and collapses white space, except for 
multiple newlines."
     (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))
+                                   arg pos))
       (setq arg (replace-match (if (match-beginning 2) " " "\n") t t arg 0)
-           pos (1+ pos)))
+            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)))))
+          (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)))
+        (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")
+                                        "array" "bmatrix" "cases"
+                                        "gathered" "matrix" "pmatrix"
+                                        "smallmatrix" "split"
+                                        "subarray" "vmatrix")
   "Environments not to be previewed on their own."
   :group 'preview-latex
   :type '(repeat string))
@@ -2134,22 +2134,22 @@ 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)))
+          (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 ()
@@ -2168,31 +2168,31 @@ active (`transient-mark-mode'), it is run through 
`preview-region'."
       (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)))))
+                                (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)))))
+                      (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
-          "\
+           (overlay-get ov 'preview-map)
+           preview-icon
+           "\
 %s regenerates preview
 %s more options"
-          `(lambda() (interactive) (preview-regenerate ,ov)))
+           `(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" ""))))))
+          (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."
@@ -2205,7 +2205,7 @@ active (`transient-mark-mode'), it is run through 
`preview-region'."
   (overlay-put ovr 'preview-state 'disabled)
   (dolist (filename (overlay-get ovr 'filenames))
     (condition-case nil
-       (preview-delete-file filename)
+        (preview-delete-file filename)
       (file-error nil))
     (overlay-put ovr 'filenames nil)))
 
@@ -2218,8 +2218,8 @@ a hook in some cases"
     (delete-overlay ovr)
     (dolist (filename filenames)
       (condition-case nil
-         (preview-delete-file filename)
-       (file-error nil)))))
+          (preview-delete-file filename)
+        (file-error nil)))))
 
 (defun preview-clearout (&optional start end timestamp)
   "Clear out all previews in the current region.
@@ -2230,11 +2230,11 @@ 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))))
+                           (or end (point-max))))
     (and (overlay-get ov 'preview-state)
-        (not (and timestamp
-                  (equal timestamp (overlay-get ov 'timestamp))))
-        (preview-delete ov))))
+         (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."
@@ -2254,26 +2254,26 @@ with a `timestamp' property of it are kept."
   "Clearout any preview at point."
   (interactive)
   (preview-clearout (max (point-min) (1- (point)))
-                   (min (point-max) (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))))
+         (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))))))
+        (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.
@@ -2301,9 +2301,9 @@ kept."
 
 (defun preview-extract-counters (ctr)
   (setq preview-last-counter
-       (prog1 (copy-sequence ctr)
-         (dolist (elt preview-last-counter)
-           (setq ctr (delete elt ctr)))))
+        (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)
@@ -2313,15 +2313,15 @@ kept."
     (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))))))))
+        (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
@@ -2338,13 +2338,13 @@ on first use.")
   (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))))))))
+          (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.
@@ -2354,21 +2354,21 @@ Remove them if they have expired."
     (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)))))))
+          (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)
@@ -2377,37 +2377,37 @@ 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)))))
+                                   (with-current-buffer ,(current-buffer)
+                                     (preview-buffer-restore-internal
+                                      ',buffer-misc)))))
 
 (defun desktop-buffer-preview (file-name _buffer-name misc)
   "Hook function for restoring persistent previews into a buffer."
   (when (and file-name (file-readable-p file-name))
     (let ((buf (find-file-noselect file-name)))
       (if (eq (car misc) 'preview)
-         (with-current-buffer buf
-           (preview-buffer-restore misc)
-           buf)
-       buf))))
+          (with-current-buffer buf
+            (preview-buffer-restore 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))
+                    '(latex-mode . desktop-buffer-preview))
      (add-hook 'desktop-buffer-handlers '(lambda ()
-                                          (desktop-buffer-preview
-                                           desktop-buffer-file-name
-                                           desktop-buffer-name
-                                           desktop-buffer-misc)))))
+                                           (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)))
+                 (const :tag "Don't cache" nil)
+                 (const :tag "Ask" ask)))
 
 (defvar preview-dumped-alist nil
   "Alist of dumped masters.
@@ -2434,17 +2434,17 @@ 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
-                          "\
+                           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" ""))))))
+         (widen)
+         (goto-char (overlay-start ov))
+         (if (bolp) "\n" ""))))))
 
 (defun preview-dvipng-place-all ()
   "Place all images dvipng has created, if any.
@@ -2452,51 +2452,51 @@ 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))))
+                 (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))))
+        (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" t))))
-       (file-error nil)))))
+          (let ((gsfile preview-gs-file))
+            (delete-file
+             (with-current-buffer TeX-command-buffer
+               (funcall (car gsfile) "dvi" t))))
+        (file-error nil)))))
 
 (defun preview-active-string (ov)
   "Generate before-string for active image overlay OV."
@@ -2515,13 +2515,13 @@ 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)
+        (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)))
+          tempdir)))
 
 (defun preview-attach-filename (attached file)
   "Attaches the absolute file name ATTACHED to FILE."
@@ -2536,28 +2536,28 @@ 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 (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)))))))))
+        (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)
+                                      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
@@ -2575,20 +2575,20 @@ to the close hook."
     (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))))
+                 (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)
+                  place-opts)
       (overlay-put ov 'strings
-                  (list (preview-active-string ov)))
+                   (list (preview-active-string ov)))
       (preview-toggle ov t))))
 
 ;; The following is a brutal hack.  It relies on `begin' being let to
@@ -2601,31 +2601,31 @@ Factored out because of compatibility macros XEmacs 
would
 not use in advice."
   (or (car (get-char-property begin 'preview-counters))
       (cdr (get-char-property (max (point-min)
-                                  (1- begin))
-                             'preview-counters))
+                                   (1- begin))
+                              'preview-counters))
       (cdr (get-char-property
-           (max (point-min)
-                (1- (previous-single-char-property-change
-                     begin
-                     'preview-counters)))
-           'preview-counters))
+            (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))))
+            (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)))
+         (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
@@ -2643,52 +2643,52 @@ if any."
       (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))))))
+        (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)))
+              (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 '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))))
+                   (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 '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))
+                                           image))
       (overlay-put ov 'strings
-                  (list (preview-active-string ov)))
+                   (list (preview-active-string ov)))
       (overlay-put ov 'timestamp timestamp)
       (preview-toggle ov t)))
   tempdirlist)
@@ -2699,25 +2699,25 @@ 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 "\\(\\$\\$?\
+        (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)))
+            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"))
+                                          (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."
@@ -2730,8 +2730,8 @@ These are passed regardless of whether there is an 
explicit
   :type 'boolean)
 
 (defcustom preview-default-option-list '("displaymath" "floats"
-                                        "graphics" "textmath" "sections"
-                                        "footnotes")
+                                         "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
@@ -2739,33 +2739,33 @@ 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
+                    :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))))
+                    (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]")
+                                      "]{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
@@ -2795,7 +2795,7 @@ See description of `TeX-command-list' for details."
   (info "(preview-latex)"))
 
 (eval-after-load 'info '(add-to-list 'Info-file-list-for-emacs
-                                    '("preview" . "preview-latex")))
+                                     '("preview" . "preview-latex")))
 
 (defvar preview-map
   (let ((map (make-sparse-keymap)))
@@ -2827,38 +2827,38 @@ See description of `TeX-command-list' for details."
 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 ((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 (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))))
 
@@ -2875,36 +2875,36 @@ 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
+                     (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))))))
+                         (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."
@@ -2930,19 +2930,19 @@ filename=%s>
 This will be fine for prepending to a `TEXINPUTS' style
 environment variable, including an initial `.' at the front."
   (if (or (zerop (length preview-TeX-style-dir))
-         (member (substring preview-TeX-style-dir -1) '(";" ":")))
+          (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 ":"))))
+           (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)
@@ -2950,26 +2950,26 @@ environment variable, including an initial `.' at the 
front."
 With prefix argument REMOVE, remove it again."
   (interactive "P")
   (let ((case-fold-search nil)
-       (preview-TeX-style-dir (preview-TeX-style-cooked))
-       pattern)
+        (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))))))))
+        (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))))))))))
+        (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.
@@ -2993,18 +2993,18 @@ 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)))
+         (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")))
+                 (string :tag "Style directory or TEXINPUTS path")))
 
 ;;;###autoload
 (defun preview-install-styles (dir &optional force-overwrite
-                                  force-save)
+                                   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
@@ -3019,25 +3019,25 @@ 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")))
+                 (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))))
+                              ((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))
+             (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)))
 
@@ -3052,20 +3052,20 @@ pp")
   (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")))
+                  :image ,preview-tb-icon
+                  :help "Preview on/off at point")))
   (when buffer-file-name
     (let* ((filename (expand-file-name buffer-file-name))
-          format-cons)
+           format-cons)
       (when (string-match (concat "\\." TeX-default-extension "\\'")
-                         filename)
-       (setq filename (substring filename 0 (match-beginning 0))))
+                          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)))))
+        (preview-unwatch-preamble format-cons)
+        (preview-watch-preamble (current-buffer)
+                                (cadr format-cons)
+                                format-cons)))))
 
 ;;;###autoload
 (defun LaTeX-preview-setup ()
@@ -3074,64 +3074,64 @@ This is called by `LaTeX-mode-hook' and changes AUCTeX 
variables
 to add the preview functionality."
   ;; This has to be done only once.
   (unless (and (boundp 'LaTeX-mode-hook)
-              (memq #'preview-mode-setup LaTeX-mode-hook))
+               (memq #'preview-mode-setup LaTeX-mode-hook))
     (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 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 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]))
+        "Generate previews"
+        ["(or toggle) at point" preview-at-point]
+        ["for environment" preview-environment]
+        ["for section" preview-section]
+        ["for region" preview-region 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 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))
+        (preview-mode-setup))
     (if (boundp 'desktop-buffer-misc)
-       (preview-buffer-restore 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))
+        (mapc #'delete-file
+              (directory-files dir t "\\`pr" t))
+        (delete-directory dir))
     (error (message "Deletion of `%s' failed: %s" dir
-                   (error-message-string err)))))
+                    (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))))
+        (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.
@@ -3146,30 +3146,30 @@ 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))
+        (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))
+          (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))))))
+             (file-name-nondirectory (nth 0 TeX-active-tempdir))))))
 
 (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))
+                  (car (push (list (match-string 2 string)) list)))
+              (match-string 1 string))
       (setq pos (match-end 1)))
     list))
 
@@ -3206,25 +3206,25 @@ will not get matched, usually."
     ;; converted to byte sequence, and decoded by the file coding
     ;; system.
     (setq string
-         (preview--decode-^^ab string buffer-file-coding-system))
+          (preview--decode-^^ab string buffer-file-coding-system))
 
     ;; Then, control characters are taken into account.
     (while (string-match "\\^\\{2,\\}\\([@-_?]\\)" string)
       (setq output
-           (concat output
-                   (regexp-quote (substring string
-                                            0
-                                            (- (match-beginning 1) 2)))
-                   (concat
-                    "\\(?:" (regexp-quote
-                             (substring string
-                                        (- (match-beginning 1) 2)
-                                        (match-end 0)))
-                    "\\|"
-                    (char-to-string
-                     (logxor (aref string (match-beginning 1)) 64))
-                    "\\)"))
-           string (substring string (match-end 0))))
+            (concat output
+                    (regexp-quote (substring string
+                                             0
+                                             (- (match-beginning 1) 2)))
+                    (concat
+                     "\\(?:" (regexp-quote
+                              (substring string
+                                         (- (match-beginning 1) 2)
+                                         (match-end 0)))
+                     "\\|"
+                     (char-to-string
+                      (logxor (aref string (match-beginning 1)) 64))
+                     "\\)"))
+            string (substring string (match-end 0))))
     (setq output (concat output (regexp-quote string)))
     output))
 
@@ -3248,14 +3248,14 @@ Return a new string."
     ;; naive expectation.
     (while (string-match "[^[:multibyte:]]+" string)
       (setq result
-           (concat result
-                   (substring string 0 (match-beginning 0))
-                   (let ((text
-                          (save-match-data
-                            (preview--convert-^^ab
-                             (match-string 0 string)))))
-                     (decode-coding-string text coding-system)))
-           string (substring string (match-end 0))))
+            (concat result
+                    (substring string 0 (match-beginning 0))
+                    (let ((text
+                           (save-match-data
+                             (preview--convert-^^ab
+                              (match-string 0 string)))))
+                      (decode-coding-string text coding-system)))
+            string (substring string (match-end 0))))
     (setq result (concat result string))
     result))
 
@@ -3267,14 +3267,14 @@ Return a new string."
   (let ((result ""))
     (while (string-match "\\^\\^[8-9a-f][0-9a-f]" string)
       (setq result
-           (concat result
-                   (substring string 0 (match-beginning 0))
-                   (let ((byte (string-to-number
-                                (substring string
-                                           (+ (match-beginning 0) 2)
-                                           (match-end 0)) 16)))
-                     (byte-to-string byte)))
-           string (substring string (match-end 0))))
+            (concat result
+                    (substring string 0 (match-beginning 0))
+                    (let ((byte (string-to-number
+                                 (substring string
+                                            (+ (match-beginning 0) 2)
+                                            (match-end 0)) 16)))
+                      (byte-to-string byte)))
+            string (substring string (match-end 0))))
     (setq result (concat result string))
     result))
 
@@ -3287,27 +3287,27 @@ 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
-         offset
-         parsestate (case-fold-search nil)
-         (run-buffer (current-buffer))
-         (run-directory default-directory)
-         tempdir
-         close-data
-         open-data
-         fast-hook
-         slow-hook)
+          file line
+          (lsnippet 0) lstart (lfile "") lline lbuffer lpoint
+          lcounters
+          string after-string
+          offset
+          parsestate (case-fold-search nil)
+          (run-buffer (current-buffer))
+          (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))
+        (set (nth 1 var) nil))
       (goto-char (point-min))
       (unwind-protect
-         (progn
-           (while
-               (re-search-forward "\
+          (progn
+            (while
+                (re-search-forward "\
 ^\\(!\\|\\(.*?\\):[0-9]+:\\) \\|\
 \(\\(/*\
 \\(?:\\.+[^()\r\n{} /]*\\|[^()\r\n{} ./]+\
@@ -3352,34 +3352,34 @@ name(\\([^)]+\\))\\)\\|\
 ;;;   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 "\
+              (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)
-
-                           ;; And the line number to position the cursor.
+                    (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)
+
+                            ;; And the line number to position the cursor.
                             line (progn
                                    (setq lpoint (point))
                                    (end-of-line)
@@ -3391,217 +3391,217 @@ name(\\([^)]+\\))\\)\\|\
 \[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)))
-
-                           ;; 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 "<none>")
-                                    (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 (mapc #'funcall slow-hook))
-                         (error (preview-log-error err "Translation hook")))
-                       (push (vector file (+ line offset)
-                                     string after-string
-                                     snippet box counters)
+                            ;; 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)))
+
+                            ;; 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 "<none>")
+                                     (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 (mapc #'funcall 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 "<none>")
-                                 (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)))))
+                  ;; 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 "<none>")
+                                  (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-char (point-min))
                         (forward-line (1- 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))
-                                "\\)"
-                                (setq after-string
-                                      (preview-error-quote
-                                       after-string)))
-                        (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))))))
+                      (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))
+                                 "\\)"
+                                 (setq after-string
+                                       (preview-error-quote
+                                        after-string)))
+                         (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.
@@ -3609,34 +3609,34 @@ 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)
+              (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)))))
+                  (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)))
+        preview-resolution (nth 1 geometry)
+        preview-colors (nth 2 geometry)))
 
 (defun preview-get-colors ()
   "Return colors from the current display.
@@ -3646,142 +3646,142 @@ 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)))
+                          'preview-reference-face :background 'default)))
        (fg (color-values (preview-inherited-face-attribute
-                         'preview-reference-face :foreground 'default)))
+                          'preview-reference-face :foreground 'default)))
        (mask (preview-get-heuristic-mask)))
     (if (equal '(65535 65535 65535) bg)
-       (setq bg nil))
+        (setq bg nil))
     (if (equal '(0 0 0) fg)
-       (setq fg nil))
+        (setq fg nil))
     (unless (and (numberp preview-transparent-border)
-                (consp mask) (integerp (car mask)))
+                 (consp mask) (integerp (car mask)))
       (setq mask nil))
     (vector bg fg mask preview-transparent-border)))
 
 (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)
-                               " " colors resolution)
-                     (setq tempdir TeX-active-tempdir))))
-        (name "Preview-DviPNG"))
+         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)
+                                " " 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)))
+          (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)
+        (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")
       (force-mode-line-update)
       (call-process TeX-shell nil (current-buffer) nil
-                   TeX-shell-command-option
-                   command))))
+                    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))
-                     (setq tempdir TeX-active-tempdir))))
-        (name "Preview-DviPS"))
+         tempdir
+         (command (with-current-buffer TeX-command-buffer
+                    (prog1
+                        (TeX-command-expand (if fast
+                                                preview-fast-dvips-command
+                                              preview-dvips-command))
+                      (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)
+                               (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)))
+          (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)
+        (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")
       (force-mode-line-update)
       (call-process TeX-shell nil (current-buffer) nil
-                   TeX-shell-command-option
-                   command))))
+                    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)
-                     (setq tempdir TeX-active-tempdir
-                           pdfsource (funcall (car file) "pdf" t)))))
-        (name "Preview-PDF2DSC"))
+         tempdir
+         pdfsource
+         (command (with-current-buffer TeX-command-buffer
+                    (prog1
+                        (TeX-command-expand preview-pdf2dsc-command)
+                      (setq tempdir TeX-active-tempdir
+                            pdfsource (funcall (car file) "pdf" t)))))
+         (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)
+                           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)))
+          (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)
+        (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")
       (force-mode-line-update)
       (call-process TeX-shell nil (current-buffer) nil
-                   TeX-shell-command-option
-                   command))))
+                    TeX-shell-command-option
+                    command))))
 
 (defun preview-TeX-inline-sentinel (process _name)
   "Sentinel function for preview.
@@ -3790,18 +3790,18 @@ 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))
+        (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"))))
+        (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-call-hook 'open)
+        (error (preview-log-error err "LaTeX" process)))
       (preview-reraise-error process))))
 
 (defcustom preview-format-extensions '(".fmt" ".efmt")
@@ -3816,19 +3816,19 @@ 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)))
+        (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_"
+              (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)
@@ -3841,15 +3841,15 @@ and strings get evaluated as replacement strings."
     (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) ""))))))
+             (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
@@ -3866,12 +3866,12 @@ of any command starting with `pdf'.")
 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")))))))
+          (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)
 
@@ -3885,8 +3885,8 @@ This is passed through `preview-do-replacements'."
   "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))))))
+          (choice (symbol :tag "Named replacement")
+                  (cons string (repeat (choice symbol string))))))
 
 (defcustom preview-undump-replacements
   ;; If -kanji option exists, pick it up as the second match.
@@ -3895,15 +3895,15 @@ This is passed through `preview-do-replacements'."
 \\(?: +\\(?:\\(--?kanji[= ][^ ]+\\)\\|-\\(?:[^ 
\\\"]\\|\\\\.\\|\"[^\"]*\"\\)*\\)\\)*.*\
  \"\\\\input\" \"\\\\detokenize{\" \\(.*\\) \"}\"\\'"
      . ("\\1 \\2 -interaction=nonstopmode -file-line-error "
-       preview-format-name " \"/AUCTEXINPUT{\" \\3 \"}\"")))
+        preview-format-name " \"/AUCTEXINPUT{\" \\3 \"}\"")))
   ;; See the ini file code below in `preview-cache-preamble' for the
   ;; weird /AUCTEXINPUT construct.  In short, it is crafted so that
   ;; dumped format file can read file of non-ascii name.
   "Use a dumped format for reading preamble."
   :group 'preview-latex
   :type '(repeat
-         (choice (symbol :tag "Named replacement")
-                 (cons string (repeat (choice symbol string))))))
+          (choice (symbol :tag "Named replacement")
+                  (cons string (repeat (choice symbol string))))))
 
 
 (defun preview-cache-preamble (&optional format-cons)
@@ -3917,26 +3917,26 @@ 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))
-                  preview-dump-replacements))
-        (preview-auto-cache-preamble nil))
+          (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))
+                   preview-dump-replacements))
+         (preview-auto-cache-preamble nil))
     (unless (and (consp (cdr format-cons))
-                (string= command (cadr format-cons)))
+                 (string= command (cadr format-cons)))
       (unless format-cons
-       (setq format-cons (assoc format-name preview-dumped-alist)))
+        (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))
+          (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 "\\let\\PREVIEWdump\\dump\\def\\dump{%
@@ -3949,21 +3949,21 @@ If FORMAT-CONS is non-nil, a previous format may get 
reused."
       (TeX-save-document master)
       (setq TeX-current-process-region-p nil)
       (prog1 (preview-generate-preview 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)))))))
+        (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.
@@ -3973,9 +3973,9 @@ 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))))))
+          (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))
@@ -3984,24 +3984,24 @@ stored in `preview-dumped-alist'."
   "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)
-                      "<none>")
-                    (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))))))
+                     (buffer-substring begin end)
+                     (if buffer-file-name
+                         (file-name-nondirectory buffer-file-name)
+                       "<none>")
+                     (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))))))
   (setq TeX-current-process-region-p t)
   (preview-generate-preview (TeX-region-file)
-                           (preview-do-replacements
-                            (TeX-command-expand
-                             (preview-string-expand preview-LaTeX-command))
-                            preview-LaTeX-command-replacements)))
+                            (preview-do-replacements
+                             (TeX-command-expand
+                              (preview-string-expand preview-LaTeX-command))
+                             preview-LaTeX-command-replacements)))
 
 (defun preview-buffer ()
   "Run preview on current buffer."
@@ -4022,14 +4022,14 @@ stored in `preview-dumped-alist'."
   "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))))))))
+                (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."
@@ -4053,15 +4053,15 @@ environments is selected."
   (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))
+        (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))
+                     preview-inner-environments)
+        (LaTeX-find-matching-begin))
       (if (string= currenv "document")
-         (error "No enclosing outer environment found"))
+          (error "No enclosing outer environment found"))
       (preview-region
        (save-excursion (LaTeX-find-matching-begin) (point))
        (save-excursion (LaTeX-find-matching-end) (point))))))
@@ -4080,45 +4080,45 @@ to use.
 
 It returns the started process."
   (let* ((geometry (preview-get-geometry))
-        (commandbuff (current-buffer))
-        (pr-file (cons
-                  'TeX-active-master
-                  (file-name-nondirectory file)))
-        (master (TeX-master-file))
-        (master-file (expand-file-name master))
-        (dumped-cons (assoc master-file
-                            preview-dumped-alist))
-        process)
+         (commandbuff (current-buffer))
+         (pr-file (cons
+                   'TeX-active-master
+                   (file-name-nondirectory 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))
+                                    (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)))))))
+        (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))))
+        (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)
+                                    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'.
@@ -4127,42 +4127,42 @@ internal parameters, STR may be a log to insert into 
the current log."
   (set-buffer commandbuff)
   (let*
       ((preview-format-name (shell-quote-argument
-                            (concat "&"
-                                    (preview-dump-file-name
-                                     (file-name-nondirectory master)))))
+                             (concat "&"
+                                     (preview-dump-file-name
+                                      (file-name-nondirectory master)))))
        (process-environment (copy-sequence process-environment))
        (process
-       (progn
-         ;; Fix Bug#20773, Bug#27088.
-         ;; Make LaTeX not to insert newline in lines necessary to
-         ;; identify Bounding Boxes.
-         (setenv "max_print_line" "1000")
-         (TeX-run-command
-          "Preview-LaTeX"
-          (if (consp (cdr dumped-cons))
-              (preview-do-replacements
-               command
-               preview-undump-replacements)
-            command) file))))
+        (progn
+          ;; Fix Bug#20773, Bug#27088.
+          ;; Make LaTeX not to insert newline in lines necessary to
+          ;; identify Bounding Boxes.
+          (setenv "max_print_line" "1000")
+          (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)
-         (TeX-parse-reset)
-         (setq TeX-parse-function 'TeX-parse-TeX)
-         (if TeX-process-asynchronous
-             process
-           (TeX-synchronous-sentinel "Preview-LaTeX" file process)))
+        (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)
+          (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)))))
+             (delete-process process)
+             (preview-reraise-error process)))))
 
 (defconst preview-version AUCTeX-version
   "Preview version.
@@ -4174,62 +4174,62 @@ If not a regular release, the date of the last change.")
 (defun preview-dump-state (buffer)
   (condition-case nil
       (progn
-       (unless (local-variable-p 'TeX-command-buffer (current-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")))
+        (unless (local-variable-p 'TeX-command-buffer (current-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"
-     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
+       (interactive)
+       (let ((reporter-prompt-for-summary-p "Bug report subject: "))
+         (reporter-submit-bug-report
+          "bug-auctex@gnu.org"
+          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."
-     )))
+          )))
 
 (provide 'preview)
 ;;; preview.el ends here
diff --git a/style/Alegreya.el b/style/Alegreya.el
index 61034b3..84adaa5 100644
--- a/style/Alegreya.el
+++ b/style/Alegreya.el
@@ -36,8 +36,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (TeX-add-style-hook
  "Alegreya"
@@ -48,7 +48,7 @@
 
    ;; Load `fontaxes' or `fontspec' dep. on `type1' option:
    (if (or (LaTeX-provided-package-options-member "Alegreya" "type1")
-          (LaTeX-provided-package-options-member "Alegreya" "type1=true"))
+           (LaTeX-provided-package-options-member "Alegreya" "type1=true"))
        (TeX-run-style-hooks "fontaxes")
      (TeX-run-style-hooks "fontspec"))
 
@@ -69,19 +69,19 @@
 
    ;; Fontification
    (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
+              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("textsu"    "{")
-                               ("textin"    "{"))
-                             'type-command)
+                                ("textin"    "{"))
+                              'type-command)
      (font-latex-add-keywords '(("Alegreya"      "")
-                               ("AlegreyaBlack" "")
-                               ("AlegreyaLF"    "")
-                               ("AlegreyaOsF"   "")
-                               ("AlegreyaTLF"   "")
-                               ("AlegreyaTOsF"  "")
-                               ("sufigures"     "")
-                               ("infigures"     ""))
-                             'type-declaration)))
+                                ("AlegreyaBlack" "")
+                                ("AlegreyaLF"    "")
+                                ("AlegreyaOsF"   "")
+                                ("AlegreyaTLF"   "")
+                                ("AlegreyaTOsF"  "")
+                                ("sufigures"     "")
+                                ("infigures"     ""))
+                              'type-declaration)))
  TeX-dialect)
 
 (defvar LaTeX-Alegreya-package-options-list
diff --git a/style/AlegreyaSans.el b/style/AlegreyaSans.el
index 653442e..3b31527 100644
--- a/style/AlegreyaSans.el
+++ b/style/AlegreyaSans.el
@@ -36,8 +36,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (TeX-add-style-hook
  "AlegreyaSans"
@@ -48,7 +48,7 @@
 
    ;; Load `fontaxes' or `fontspec' dep. on `type1' option:
    (if (or (LaTeX-provided-package-options-member "AlegreyaSans" "type1")
-          (LaTeX-provided-package-options-member "AlegreyaSans" "type1=true"))
+           (LaTeX-provided-package-options-member "AlegreyaSans" "type1=true"))
        (TeX-run-style-hooks "fontaxes")
      (TeX-run-style-hooks "fontspec"))
 
@@ -73,22 +73,22 @@
 
    ;; Fontification
    (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
+              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("textsu"    "{")
-                               ("textin"    "{"))
-                             'type-command)
+                                ("textin"    "{"))
+                              'type-command)
      (font-latex-add-keywords '(("AlegreyaSans"           "")
-                               ("AlegreyaSansLF"         "")
-                               ("AlegreyaSansOsF"        "")
-                               ("AlegreyaSansTLF"        "")
-                               ("AlegreyaSansTOsF"       "")
-                               ("AlegreyaSansLight"      "")
-                               ("AlegreyaSansMedium"     "")
-                               ("AlegreyaSansExtraBold"  "")
-                               ("AlegreyaSansBlack"      "")
-                               ("sufigures"              "")
-                               ("infigures"              ""))
-                             'type-declaration)))
+                                ("AlegreyaSansLF"         "")
+                                ("AlegreyaSansOsF"        "")
+                                ("AlegreyaSansTLF"        "")
+                                ("AlegreyaSansTOsF"       "")
+                                ("AlegreyaSansLight"      "")
+                                ("AlegreyaSansMedium"     "")
+                                ("AlegreyaSansExtraBold"  "")
+                                ("AlegreyaSansBlack"      "")
+                                ("sufigures"              "")
+                                ("infigures"              ""))
+                              'type-declaration)))
  TeX-dialect)
 
 (defvar LaTeX-AlegreyaSans-package-options-list
diff --git a/style/CJK.el b/style/CJK.el
index c676c7c..446e431 100644
--- a/style/CJK.el
+++ b/style/CJK.el
@@ -52,7 +52,7 @@ The function can be used for CJK and CJK* environments."
     (let ((font-enc (TeX-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)))
+                                    (mapcar 'list LaTeX-CJK-enc-list)))
     (format "{%s}" (TeX-read-string "Font family: ")))))
 
 (TeX-add-style-hook
diff --git a/style/FiraMono.el b/style/FiraMono.el
index 1cdb871..a612291 100644
--- a/style/FiraMono.el
+++ b/style/FiraMono.el
@@ -36,8 +36,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (TeX-add-style-hook
  "FiraMono"
@@ -59,20 +59,20 @@
 
    ;; Fontification
    (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
+              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("sufigures"        "")
-                               ("firamonooldstyle" "")
-                               ("firamonolining"   "")
-                               ("firamonomedium"   ""))
-                             'type-declaration)))
+                                ("firamonooldstyle" "")
+                                ("firamonolining"   "")
+                                ("firamonomedium"   ""))
+                              'type-declaration)))
  TeX-dialect)
 
 (defvar LaTeX-FiraMono-package-options '("scaled" "scale"
-                                        "type1"
-                                        "lining" "lf"
-                                        "oldstyle" "osf"
-                                        "nomap"
-                                        "medium" "mb")
+                                         "type1"
+                                         "lining" "lf"
+                                         "oldstyle" "osf"
+                                         "nomap"
+                                         "medium" "mb")
   "Package options for the FiraMono package.")
 
 ;;; FiraMono.el ends here
diff --git a/style/FiraSans.el b/style/FiraSans.el
index ff5ce51..10ac530 100644
--- a/style/FiraSans.el
+++ b/style/FiraSans.el
@@ -36,8 +36,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (TeX-add-style-hook
  "FiraSans"
@@ -69,22 +69,22 @@
 
    ;; Fontification
    (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
+              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("sufigures"        "")
-                               ("firaoldstyle"     "")
-                               ("firalining"       "")
-                               ("firatabular"      "")
-                               ("firaproportional" "")
-                               ("firathin"         "")
-                               ("firalight"        "")
-                               ("firaextralight"   "")
-                               ("firaultralight"   "")
-                               ("firamedium"       "")
-                               ("firabook"         "")
-                               ("firasemibold"     "")
-                               ("firaextrabold"    "")
-                               ("firaheavy"        ""))
-                             'type-declaration)))
+                                ("firaoldstyle"     "")
+                                ("firalining"       "")
+                                ("firatabular"      "")
+                                ("firaproportional" "")
+                                ("firathin"         "")
+                                ("firalight"        "")
+                                ("firaextralight"   "")
+                                ("firaultralight"   "")
+                                ("firamedium"       "")
+                                ("firabook"         "")
+                                ("firasemibold"     "")
+                                ("firaextrabold"    "")
+                                ("firaheavy"        ""))
+                              'type-declaration)))
  TeX-dialect)
 
 (defvar LaTeX-FiraSans-package-options
diff --git a/style/MinionPro.el b/style/MinionPro.el
index 7dc5546..ff76329 100644
--- a/style/MinionPro.el
+++ b/style/MinionPro.el
@@ -36,8 +36,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (TeX-add-style-hook
  "MinionPro"
@@ -53,10 +53,10 @@
 
    ;; Fontification
    (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
+              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("smallfrac" "{{")
-                               ("slantfrac" "{{"))
-                             'textual)))
+                                ("slantfrac" "{{"))
+                              'textual)))
  TeX-dialect)
 
 (defvar LaTeX-MinionPro-package-options
diff --git a/style/MyriadPro.el b/style/MyriadPro.el
index ff76fe0..0f3de7d 100644
--- a/style/MyriadPro.el
+++ b/style/MyriadPro.el
@@ -38,8 +38,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (TeX-add-style-hook
  "MyriadPro"
@@ -56,24 +56,24 @@
 
    ;; More control over spacing in `\slantfrac':
    (LaTeX-add-lengths "MdSlantfracSpacingBeforeSlash"
-                     "MdSlantfracSpacingAfterSlash")
+                      "MdSlantfracSpacingAfterSlash")
 
    ;; `\mathversion' is available with sansmath option
    (when (LaTeX-provided-package-options-member "MyriadPro" "sansmath")
      (TeX-add-symbols
       '("mathversion"
-       (TeX-arg-eval completing-read "Math version: "
-                     '(("sans")        ("sansbold")
-                       ("sanstabular") ("sansboldtabular"))))))
+        (TeX-arg-eval completing-read "Math version: "
+                      '(("sans")        ("sansbold")
+                        ("sanstabular") ("sansboldtabular"))))))
 
    ;; Fontification
    (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
+              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("smallfrac"   "{{")
-                               ("slantfrac"   "{{"))
-                             'textual)
+                                ("slantfrac"   "{{"))
+                              'textual)
      (font-latex-add-keywords '(("mathversion" "{"))
-                             'variable)))
+                              'variable)))
  TeX-dialect)
 
 (defvar LaTeX-MyriadPro-package-options
diff --git a/style/XCharter.el b/style/XCharter.el
index 9c1bd39..6f35b36 100644
--- a/style/XCharter.el
+++ b/style/XCharter.el
@@ -35,8 +35,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (TeX-add-style-hook
  "XCharter"
@@ -72,18 +72,18 @@
    (when (and (featurep 'font-latex)
               (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("textsu"    "{")
-                               ("textin"    "{")
+                                ("textin"    "{")
                                 ("textlf"    "{")
                                 ("textosf"   "{")
                                 ("textosfI"  "{")
-                               ("textnumerator"   "{")
-                               ("textnu"          "{")
-                               ("textdenominator" "{")
-                               ("textde"          "{")
-                               ("textfrac"        "{{"))
+                                ("textnumerator"   "{")
+                                ("textnu"          "{")
+                                ("textdenominator" "{")
+                                ("textde"          "{")
+                                ("textfrac"        "{{"))
                               'type-command)
      (font-latex-add-keywords '(("sustyle"   "")
-                               ("instyle"   "")
+                                ("instyle"   "")
                                 ("lfstyle"   "")
                                 ("osfstyle"  ""))
                               'type-declaration)))
diff --git a/style/acro.el b/style/acro.el
index a39221a..6d80642 100644
--- a/style/acro.el
+++ b/style/acro.el
@@ -34,8 +34,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (defvar LaTeX-acro-package-options-list
   '(;; General Options
@@ -63,7 +63,7 @@
     ("list-long-format")
     ("extra-format")
     ("first-style" ("default" "plain" "empty" "square" "short" "reversed"
-                   "plain-reversed" "footnote" "sidenote"))
+                    "plain-reversed" "footnote" "sidenote"))
     ("extra-style" ("default" "plain" "comma" "paren" "bracket"))
     ("plural-ending")
     ;; Options Regarding the List
@@ -75,9 +75,9 @@
     ("next-pages")
     ("list-type" ("table" "itemize" "description"))
     ("list-style" ("list" "tabular" "longtable" "extra-tabular" 
"extra-longtable"
-                  "extra-tabular-rev" "extra-longtable-rev"))
+                   "extra-tabular-rev" "extra-longtable-rev"))
     ("list-header" ("chapter" "chapter*" "section" "section*" "subsection"
-                   "subsection*" "addchap" "addsec"))
+                    "subsection*" "addchap" "addsec"))
     ("list-name")
     ("list-table-width")
     ("list-caps" ("true" "false")))
@@ -102,10 +102,10 @@
 `LaTeX-acro-list' and to `TeX-auto-symbol' if option `macros' is
 set to `true'."
   (mapc (lambda (acronym)
-         (add-to-list 'LaTeX-acro-acronym-list (list acronym)))
-       LaTeX-auto-acro-acronym)
+          (add-to-list 'LaTeX-acro-acronym-list (list acronym)))
+        LaTeX-auto-acro-acronym)
   (when (or (LaTeX-provided-package-options-member "acro" "macros")
-           (LaTeX-provided-package-options-member "acro" "macros=true"))
+            (LaTeX-provided-package-options-member "acro" "macros=true"))
     (add-to-list 'TeX-auto-symbol LaTeX-auto-acro-acronym)))
 
 (add-hook 'TeX-auto-prepare-hook #'LaTeX-acro-prepare t)
@@ -122,10 +122,10 @@ argument, otherwise as a mandatory one.  Use PROMPT as 
the prompt
 string.  If DEFINITION is non-nil, add the chosen acronym to the
 list of defined acronyms."
   (let ((acronym (completing-read (TeX-argument-prompt optional prompt 
"Acronym")
-                                 (LaTeX-acro-acronym-list) nil nil nil
-                                 'LaTeX-acro-acronym-history)))
+                                  (LaTeX-acro-acronym-list) nil nil nil
+                                  'LaTeX-acro-acronym-history)))
     (if (and definition (not (string-equal "" acronym)))
-       (LaTeX-add-acro-acronyms acronym))
+        (LaTeX-add-acro-acronyms acronym))
     (TeX-argument-insert acronym optional optional)))
 
 (defun LaTeX-arg-define-acro-acronym (optional &optional prompt)
@@ -160,7 +160,7 @@ be a list with strings to be used as values for the key."
   ;; Remove <SPC> key binding from map used in `multi-prompt-key-value' (called
   ;; by `TeX-arg-key-val') with `require-match' set to `nil'.
   (let ((crm-local-completion-map
-        (remove (assoc 32 crm-local-completion-map) crm-local-completion-map)))
+         (remove (assoc 32 crm-local-completion-map) 
crm-local-completion-map)))
     (TeX-arg-key-val optional key-val-alist prompt)))
 
 (TeX-add-style-hook
@@ -171,7 +171,7 @@ be a list with strings to be used as values for the key."
     ;; Creating New Acronyms
     '("DeclareAcronym" LaTeX-arg-define-acro-acronym
       (LaTeX-arg-acro-key-val "Definition of acronym (k=v)"
-                             LaTeX-acro-declareacronym-keys))
+                              LaTeX-acro-declareacronym-keys))
     ;; Using the Acronyms
     '("ac" LaTeX-arg-acro-acronym)
     '("ac*" LaTeX-arg-acro-acronym)
@@ -257,40 +257,40 @@ be a list with strings to be used as values for the key."
 
    ;; Fontification
    (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
+              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("DeclareAcronym" "{{")
-                               ("ac" "*{")
-                               ("Ac" "*{")
-                               ("acs" "*{")
-                               ("acl" "*{")
-                               ("Acl" "*{")
-                               ("aca" "*{")
-                               ("acf" "*{")
-                               ("Acf" "*{")
-                               ("acp" "*{")
-                               ("Acp" "*{")
-                               ("acsp" "*{")
-                               ("aclp" "*{")
-                               ("Aclp" "*{")
-                               ("acap" "*{")
-                               ("acfp" "*{")
-                               ("Acfp" "*{")
-                               ("acflike" "*{")
-                               ("acfplike" "*{")
-                               ("iac" "*{")
-                               ("Iac" "*{")
-                               ("iacs" "*{")
-                               ("Iacs" "*{")
-                               ("iaca" "*{")
-                               ("Iaca" "*{")
-                               ("iacl" "*{")
-                               ("Iacl" "*{")
-                               ("iacf" "*{")
-                               ("Iacf" "*{")
-                               ("iacflike" "*{")
-                               ("Iacflike" "*{")
-                               ("acuse" "{"))
-                             'function)))
+                                ("ac" "*{")
+                                ("Ac" "*{")
+                                ("acs" "*{")
+                                ("acl" "*{")
+                                ("Acl" "*{")
+                                ("aca" "*{")
+                                ("acf" "*{")
+                                ("Acf" "*{")
+                                ("acp" "*{")
+                                ("Acp" "*{")
+                                ("acsp" "*{")
+                                ("aclp" "*{")
+                                ("Aclp" "*{")
+                                ("acap" "*{")
+                                ("acfp" "*{")
+                                ("Acfp" "*{")
+                                ("acflike" "*{")
+                                ("acfplike" "*{")
+                                ("iac" "*{")
+                                ("Iac" "*{")
+                                ("iacs" "*{")
+                                ("Iacs" "*{")
+                                ("iaca" "*{")
+                                ("Iaca" "*{")
+                                ("iacl" "*{")
+                                ("Iacl" "*{")
+                                ("iacf" "*{")
+                                ("Iacf" "*{")
+                                ("iacflike" "*{")
+                                ("Iacflike" "*{")
+                                ("acuse" "{"))
+                              'function)))
  TeX-dialect)
 
 (defun LaTeX-acro-package-options ()
diff --git a/style/acronym.el b/style/acronym.el
index d86debe..a99fa85 100644
--- a/style/acronym.el
+++ b/style/acronym.el
@@ -34,8 +34,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (TeX-auto-add-type "acronym" "LaTeX")
 
@@ -54,8 +54,8 @@
 (defun LaTeX-acronym-cleanup ()
   "Move acronyms from `LaTeX-auto-acronym' to `LaTeX-acronym-list'."
   (mapc (lambda (acronym)
-         (add-to-list 'LaTeX-acronym-list (list acronym)))
-       LaTeX-auto-acronym))
+          (add-to-list 'LaTeX-acronym-list (list acronym)))
+        LaTeX-auto-acronym))
 
 (add-hook 'TeX-auto-prepare-hook #'LaTeX-acronym-prepare t)
 (add-hook 'TeX-auto-cleanup-hook #'LaTeX-acronym-cleanup t)
@@ -73,10 +73,10 @@ argument, otherwise as a mandatory one.  Use PROMPT as the 
prompt
 string.  If DEFINITION is non-nil, add the chosen acronym to the
 list of defined acronyms."
   (let ((acronym (completing-read (TeX-argument-prompt optional prompt 
"Acronym")
-                                 (LaTeX-acronym-list) nil nil nil
-                                 'LaTeX-acronym-acronym-history)))
+                                  (LaTeX-acronym-list) nil nil nil
+                                  'LaTeX-acronym-acronym-history)))
     (if (and definition (not (string-equal "" acronym)))
-       (LaTeX-add-acronyms acronym))
+        (LaTeX-add-acronyms acronym))
     (TeX-argument-insert acronym optional optional)))
 
 (defun LaTeX-arg-define-acronym-acronym (optional &optional prompt)
@@ -150,32 +150,32 @@ string."
 
    ;; Fontification
    (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
+              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("ac" "*{")
-                               ("acf" "*{")
-                               ("acs" "*{")
-                               ("acl" "*{")
-                               ("acp" "*{")
-                               ("acfp" "*{")
-                               ("acsp" "*{")
-                               ("aclp" "*{")
-                               ("acfi" "*{")
-                               ("acused" "{")
-                               ("acsu" "*{")
-                               ("aclu" "*{")
-                               ("iac" "*{")
-                               ("Iac" "*{")
-                               ("acro" "{[{")
-                               ("acroextra" "{")
-                               ("newacro" "{[{")
-                               ("acrodef" "{[{")
-                               ("acroindefinite" "{{{")
-                               ("acrodefindefinite" "{{{")
-                               ("newacroindefinite" "{{{")
-                               ("acroplural" "{[{")
-                               ("acrodefplural" "{[{")
-                               ("newacroplural" "{[{"))
-                             'function)))
+                                ("acf" "*{")
+                                ("acs" "*{")
+                                ("acl" "*{")
+                                ("acp" "*{")
+                                ("acfp" "*{")
+                                ("acsp" "*{")
+                                ("aclp" "*{")
+                                ("acfi" "*{")
+                                ("acused" "{")
+                                ("acsu" "*{")
+                                ("aclu" "*{")
+                                ("iac" "*{")
+                                ("Iac" "*{")
+                                ("acro" "{[{")
+                                ("acroextra" "{")
+                                ("newacro" "{[{")
+                                ("acrodef" "{[{")
+                                ("acroindefinite" "{{{")
+                                ("acrodefindefinite" "{{{")
+                                ("newacroindefinite" "{{{")
+                                ("acroplural" "{[{")
+                                ("acrodefplural" "{[{")
+                                ("newacroplural" "{[{"))
+                              'function)))
  TeX-dialect)
 
 (defvar LaTeX-acronym-package-options
diff --git a/style/algorithm.el b/style/algorithm.el
index 10e8530..c493c82 100644
--- a/style/algorithm.el
+++ b/style/algorithm.el
@@ -39,23 +39,23 @@
 (defun LaTeX-env-algorithm (environment)
   "Insert a algorithm-like ENVIRONMENT with caption and label."
   (let* ((pos (completing-read (TeX-argument-prompt t nil "Position")
-                              '(("H"))))
-        (caption (TeX-read-string "Caption: "))
-        (short-caption (when (>= (length caption) 
LaTeX-short-caption-prompt-length)
-                         (TeX-read-string "(Optional) Short caption: "))))
+                               '(("H"))))
+         (caption (TeX-read-string "Caption: "))
+         (short-caption (when (>= (length caption) 
LaTeX-short-caption-prompt-length)
+                          (TeX-read-string "(Optional) Short caption: "))))
     (LaTeX-insert-environment environment
-                             (concat
-                              (unless (zerop (length pos))
-                                (concat LaTeX-optop pos LaTeX-optcl))))
+                              (concat
+                               (unless (zerop (length pos))
+                                 (concat LaTeX-optop pos LaTeX-optcl))))
     ;; top caption -- do nothing if user skips caption
     (unless (zerop (length caption))
       ;; insert `\caption[short-caption]{caption':
       (insert TeX-esc "caption")
       (when (and short-caption (not (string= short-caption "")))
-       (insert LaTeX-optop short-caption LaTeX-optcl))
+        (insert LaTeX-optop short-caption LaTeX-optcl))
       (insert TeX-grop caption)
       ;; ask for a label and insert it
-;      (LaTeX-label environment 'environment)
+                                        ;      (LaTeX-label environment 
'environment)
       ;; the longtable `\caption' is equivalent to a
       ;; `\multicolumn', so it needs a `\\' at the
       ;; end of the line.  Prior to that, add } to
diff --git a/style/alltt.el b/style/alltt.el
index 2b9af53..57d1ab2 100644
--- a/style/alltt.el
+++ b/style/alltt.el
@@ -35,18 +35,18 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-set-syntactic-keywords
-                 "font-latex")
+                  "font-latex")
 
 (TeX-add-style-hook
  "alltt"
  (lambda ()
    (LaTeX-add-environments "alltt")
    (add-to-list (make-local-variable 'LaTeX-indent-environment-list)
-               '("alltt" current-indentation) t)
+                '("alltt" current-indentation) t)
    (add-to-list 'LaTeX-verbatim-environments-local "alltt")
    ;; Fontification
    (when (and (fboundp 'font-latex-set-syntactic-keywords)
-             (eq TeX-install-font-lock 'font-latex-setup))
+              (eq TeX-install-font-lock 'font-latex-setup))
      ;; Tell font-lock about the update.
      (font-latex-set-syntactic-keywords)))
  TeX-dialect)
diff --git a/style/alphanum.el b/style/alphanum.el
index b198128..cc24c3b 100644
--- a/style/alphanum.el
+++ b/style/alphanum.el
@@ -42,35 +42,35 @@
 (defvar reftex-section-regexp)
 
 (defun reftex-get-section-level-alphanum ()
-  (save-excursion                      ; preserve position
-    (save-match-data            ; preserve matching data (important!)
+  (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))))
+      (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"
@@ -86,9 +86,9 @@
       ("sub" 0))
     t)
    (setq LaTeX-section-label
-        '(("part" . "part:")
-          ("toc" . "sec:")
-          ("sub" . "sec:")))
+         '(("part" . "part:")
+           ("toc" . "sec:")
+           ("sub" . "sec:")))
    ;;
    ;; ****************** reftex part ******************
    ;; this won't work in multifile documents, but at least there is
@@ -96,8 +96,8 @@
 
    (if (fboundp 'reftex-add-section-levels)
        (reftex-add-section-levels
-       '(("toc" .  reftex-get-section-level-alphanum)
-         ("sub" .  reftex-get-section-level-alphanum)))))
+        '(("toc" .  reftex-get-section-level-alphanum)
+          ("sub" .  reftex-get-section-level-alphanum)))))
  TeX-dialect)
 
 ;; Local Variables:
diff --git a/style/amsfonts.el b/style/amsfonts.el
index eb4c2e5..03556e7 100644
--- a/style/amsfonts.el
+++ b/style/amsfonts.el
@@ -34,8 +34,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (TeX-add-style-hook
  "amsfonts"
@@ -44,14 +44,14 @@
     '("bold" 1))
    ;; New math font by `amsfonts'.
    (setq TeX-font-list
-        (append
-         TeX-font-list
-         '((?\C-k "" "" "\\mathfrak{" "}"))))
+         (append
+          TeX-font-list
+          '((?\C-k "" "" "\\mathfrak{" "}"))))
    ;; Fontification
    (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
+              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("bold" "{"))
-                             'bold-command)))
+                              'bold-command)))
  TeX-dialect)
 
 ;; The `psamsfonts' option is obsolete in AMSFonts v3
diff --git a/style/amsmath.el b/style/amsmath.el
index 4cde128..6f51588 100644
--- a/style/amsmath.el
+++ b/style/amsmath.el
@@ -35,8 +35,8 @@
 
 ;; Fontification
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (TeX-add-style-hook
  "amsmath"
@@ -109,55 +109,55 @@
     "iint" "iiint" "iiiint" "idotsint")
 
    (setq LaTeX-item-list
-        (append '(("split"    . LaTeX-item-equation)
-                  ("multline" . LaTeX-item-equation)
-                  ("multline*" . LaTeX-item-equation)
-                  ("gather"   . LaTeX-item-equation)
-                  ("gather*"  . LaTeX-item-equation)
-                  ("gathered" . LaTeX-item-equation)
-                  ("align"    . LaTeX-item-equation)
-                  ("align*"   . LaTeX-item-equation)
-                  ("aligned"  . LaTeX-item-equation)
-                  ("alignat"  . LaTeX-item-equation-alignat)
-                  ("alignat*" . LaTeX-item-equation-alignat)
-                  ("xalignat"  . LaTeX-item-equation-alignat)
-                  ("xalignat*" . LaTeX-item-equation-alignat)
-                  ("xxalignat" . LaTeX-item-equation-alignat)
-                  ("alignedat" . LaTeX-item-equation-alignat)
-                  ("flalign"  . LaTeX-item-equation)
-                  ("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)
-                  ("subarray" . LaTeX-item-equation)
-                  ("cases"    . LaTeX-item-equation))
-                LaTeX-item-list))
+         (append '(("split"    . LaTeX-item-equation)
+                   ("multline" . LaTeX-item-equation)
+                   ("multline*" . LaTeX-item-equation)
+                   ("gather"   . LaTeX-item-equation)
+                   ("gather*"  . LaTeX-item-equation)
+                   ("gathered" . LaTeX-item-equation)
+                   ("align"    . LaTeX-item-equation)
+                   ("align*"   . LaTeX-item-equation)
+                   ("aligned"  . LaTeX-item-equation)
+                   ("alignat"  . LaTeX-item-equation-alignat)
+                   ("alignat*" . LaTeX-item-equation-alignat)
+                   ("xalignat"  . LaTeX-item-equation-alignat)
+                   ("xalignat*" . LaTeX-item-equation-alignat)
+                   ("xxalignat" . LaTeX-item-equation-alignat)
+                   ("alignedat" . LaTeX-item-equation-alignat)
+                   ("flalign"  . LaTeX-item-equation)
+                   ("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)
+                   ("subarray" . 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 amsmath environments to `LaTeX-label-alist', in order not to
-        ;; override possible custome values.
-        (append LaTeX-label-alist
-                '(("align"      . LaTeX-amsmath-label)
-                  ("alignat"    . LaTeX-amsmath-label)
-                  ("xalignat"   . LaTeX-amsmath-label)
-                  ("multline"   . LaTeX-amsmath-label)
-                  ("flalign"    . LaTeX-amsmath-label)
-                  ("gather"     . LaTeX-amsmath-label))))
+         ;; Append amsmath environments to `LaTeX-label-alist', in order not to
+         ;; override possible custome values.
+         (append LaTeX-label-alist
+                 '(("align"      . LaTeX-amsmath-label)
+                   ("alignat"    . LaTeX-amsmath-label)
+                   ("xalignat"   . LaTeX-amsmath-label)
+                   ("multline"   . LaTeX-amsmath-label)
+                   ("flalign"    . LaTeX-amsmath-label)
+                   ("gather"     . LaTeX-amsmath-label))))
 
    (set (make-local-variable 'TeX-braces-association)
-       (append '(("\\lvert" . "\\rvert")
-                 ("\\lVert" . "\\rVert"))
-               TeX-braces-association))
+        (append '(("\\lvert" . "\\rvert")
+                  ("\\lVert" . "\\rVert"))
+                TeX-braces-association))
    (set (make-local-variable 'TeX-left-right-braces)
-       (append '(("\\lvert") ("\\rvert") ("\\lVert") ("\\rVert"))
-               TeX-left-right-braces))
+        (append '(("\\lvert") ("\\rvert") ("\\lVert") ("\\rVert"))
+                TeX-left-right-braces))
 
    ;; amsmath includes amstext, amsbsy, & amsopn.
    ;; So we run their hooks, too.
@@ -169,24 +169,24 @@
 
    ;; Add \eqref to `reftex-ref-style-alist' and associate it to `e'
    (when (and (boundp 'reftex-ref-style-alist)
-             ;; check if Emacs is already equipped with this
-             (not (assoc "AMSmath" reftex-ref-style-alist)))
+              ;; check if Emacs is already equipped with this
+              (not (assoc "AMSmath" reftex-ref-style-alist)))
      ;; Append it to a local version in order to avoid a clash with
      ;; user settings
      (add-to-list (make-local-variable 'reftex-ref-style-alist)
-                 '("AMSmath" "amsmath" (("\\eqref" ?e)))
-                 t))
+                  '("AMSmath" "amsmath" (("\\eqref" ?e)))
+                  t))
 
    ;; Activate `AMSmath' when `LaTeX-reftex-ref-style-auto-activate'
    ;; is non-nil
    (and LaTeX-reftex-ref-style-auto-activate
-       (fboundp 'reftex-ref-style-activate)
-       (reftex-ref-style-activate "AMSmath"))
+        (fboundp 'reftex-ref-style-activate)
+        (reftex-ref-style-activate "AMSmath"))
 
    (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
+              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("boxed" "{"))
-                             'math-command)))
+                              'math-command)))
  TeX-dialect)
 
 (defun LaTeX-amsmath-env-alignat (env)
@@ -200,7 +200,7 @@ Insert suitable number of ampersands also if possible."
   "Insert ENV with position and column number specifications.
 Insert suitable number of ampersands also if possible."
   (let ((where (TeX-read-string "(Optional) Vertical position (t or b): "))
-       (ncols (TeX-read-string "Number of columns: ")))
+        (ncols (TeX-read-string "Number of columns: ")))
     (unless (string= where "")
       (setq where (concat LaTeX-optop where LaTeX-optcl)))
     (LaTeX-insert-environment env (concat where TeX-grop ncols TeX-grcl))
@@ -220,7 +220,7 @@ If SUPPRESS is non-nil, do not insert line break macro."
     (indent-according-to-mode))
   (let ((env (LaTeX-current-environment)))
     (when (and (assoc env LaTeX-label-alist)
-              (LaTeX-label env 'environment))
+               (LaTeX-label env 'environment))
       (LaTeX-newline)
       (indent-according-to-mode))))
 
@@ -234,8 +234,8 @@ If SUPPRESS is non-nil, do not insert line break macro."
   (LaTeX-item-equation suppress)
   (LaTeX-insert-ampersands
    (concat "\\(?:"
-          (regexp-quote LaTeX-optop) "[tb]" (regexp-quote LaTeX-optcl)
-          "\\)?")
+           (regexp-quote LaTeX-optop) "[tb]" (regexp-quote LaTeX-optcl)
+           "\\)?")
    'LaTeX-amsmath-alignat-number-of-ampersands))
 
 (defun LaTeX-amsmath-alignat-number-of-ampersands (start end)
@@ -246,13 +246,13 @@ START and END."
     (if (integerp num) (+ num num -1))))
 
 (defvar LaTeX-amsmath-package-options '("intlimits" "nointlimits"
-                                       "sumlimits" "nosumlimits"
-                                       "namelimits" "nonamelimits"
-                                       "leqno" "reqno" "centertags"
-                                       "tbtags" "cmex10" "fleqn" "?"
-                                       "alignedleftspaceyes"
-                                       "alignedleftspaceno"
-                                       "alignedleftspaceyesifneg")
+                                        "sumlimits" "nosumlimits"
+                                        "namelimits" "nonamelimits"
+                                        "leqno" "reqno" "centertags"
+                                        "tbtags" "cmex10" "fleqn" "?"
+                                        "alignedleftspaceyes"
+                                        "alignedleftspaceno"
+                                        "alignedleftspaceyesifneg")
   "Package options for the amsmath package.")
 
 ;;; amsmath.el ends here.
diff --git a/style/amsopn.el b/style/amsopn.el
index fd2c5fc..10572bd 100644
--- a/style/amsopn.el
+++ b/style/amsopn.el
@@ -45,8 +45,8 @@
     '("operatorname*" t))
 
    (add-to-list 'LaTeX-auto-regexp-list
-               '("\\\\DeclareMathOperator\\*?{?\\\\\\([A-Za-z0-9]+\\)}?"
-                 1 TeX-auto-symbol)))
+                '("\\\\DeclareMathOperator\\*?{?\\\\\\([A-Za-z0-9]+\\)}?"
+                  1 TeX-auto-symbol)))
  TeX-dialect
  )
 
diff --git a/style/amstex.el b/style/amstex.el
index c9c1b9b..7588935 100644
--- a/style/amstex.el
+++ b/style/amstex.el
@@ -51,13 +51,13 @@
  TeX-dialect)
 
 (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.")
+                                       "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/style/amsthm.el b/style/amsthm.el
index a71feda..a009ae0 100644
--- a/style/amsthm.el
+++ b/style/amsthm.el
@@ -36,8 +36,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (defvar LaTeX-amsthm-package-options nil
   "Package options for the amsthm package.")
@@ -62,15 +62,15 @@
 If OPTIONAL is non-nil, insert the resulting value as an optional
 argument.  Use PROMPT as the prompt string."
   (let* ((crm-separator (regexp-quote TeX-esc))
-        (fontdecl (mapconcat #'identity
-                             (TeX-completing-read-multiple
-                              (TeX-argument-prompt optional prompt "Font: \\" 
t)
-                              LaTeX-amsthm-fontdecl)
-                             TeX-esc)))
+         (fontdecl (mapconcat #'identity
+                              (TeX-completing-read-multiple
+                               (TeX-argument-prompt optional prompt "Font: \\" 
t)
+                               LaTeX-amsthm-fontdecl)
+                              TeX-esc)))
     (TeX-argument-insert fontdecl
-                        optional
-                        (when (and fontdecl (not (string= fontdecl "")))
-                          TeX-esc))))
+                         optional
+                         (when (and fontdecl (not (string= fontdecl "")))
+                           TeX-esc))))
 
 (defun LaTeX-amsthm-env-label (environment)
   "Insert ENVIRONMENT, query for an optional argument and prompt
@@ -84,14 +84,14 @@ RefTeX users should customize or add ENVIRONMENT to
 
   (add-to-list \\='LaTeX-label-alist \\='(\"lemma\" . \"lem:\"))
   (add-to-list \\='reftex-label-alist
-              \\='(\"lemma\" ?m \"lem:\" \"~\\ref{%s}\"
-                nil (\"Lemma\" \"lemma\") nil))"
+               \\='(\"lemma\" ?m \"lem:\" \"~\\ref{%s}\"
+                 nil (\"Lemma\" \"lemma\") nil))"
   (let ((opthead (TeX-read-string
-                 (TeX-argument-prompt t nil "Heading"))))
+                  (TeX-argument-prompt t nil "Heading"))))
     (LaTeX-insert-environment environment
-                             (when (and opthead
-                                        (not (string= opthead "")))
-                               (format "[%s]" opthead))))
+                              (when (and opthead
+                                         (not (string= opthead "")))
+                                (format "[%s]" opthead))))
   (when (LaTeX-label environment 'environment)
     (LaTeX-newline)
     (indent-according-to-mode)))
@@ -123,8 +123,8 @@ make them available as new environments."
  (lambda ()
    ;; Add the pre-defined styles:
    (LaTeX-add-amsthm-newtheoremstyles "definition"
-                                     "plain"
-                                     "remark")
+                                      "plain"
+                                      "remark")
 
    (LaTeX-add-environments
     '("proof" LaTeX-amsthm-env-label))
@@ -134,45 +134,45 @@ make them available as new environments."
     '("newtheorem"
       (TeX-arg-eval
        (lambda ()
-        (let ((nthm (TeX-read-string
-                     (TeX-argument-prompt nil nil "Environment"))))
-          (LaTeX-add-amsthm-newtheorems nthm)
-          (LaTeX-add-environments (list nthm 'LaTeX-amsthm-env-label))
-          (format "%s" nthm))))
+         (let ((nthm (TeX-read-string
+                      (TeX-argument-prompt nil nil "Environment"))))
+           (LaTeX-add-amsthm-newtheorems nthm)
+           (LaTeX-add-environments (list nthm 'LaTeX-amsthm-env-label))
+           (format "%s" nthm))))
       [ 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"))
-                       "") ])
+                                        (backward-char 2)
+                                        (preceding-char)) ?\])
+                                  ()
+                                (TeX-arg-counter t "Within counter"))
+                        "") ])
 
     '("newtheorem*"
       (TeX-arg-eval
        (lambda ()
-        (let ((nthm (TeX-read-string
-                     (TeX-argument-prompt nil nil "Environment")))
-              (heading (TeX-read-string
-                        (TeX-argument-prompt nil nil "Heading"))))
-          (LaTeX-add-amsthm-newtheorems nthm)
-          (LaTeX-add-environments (list nthm 'LaTeX-amsthm-env-label))
-          (insert (concat TeX-grop nthm TeX-grcl))
-          (format "%s" heading)))))
+         (let ((nthm (TeX-read-string
+                      (TeX-argument-prompt nil nil "Environment")))
+               (heading (TeX-read-string
+                         (TeX-argument-prompt nil nil "Heading"))))
+           (LaTeX-add-amsthm-newtheorems nthm)
+           (LaTeX-add-environments (list nthm 'LaTeX-amsthm-env-label))
+           (insert (concat TeX-grop nthm TeX-grcl))
+           (format "%s" heading)))))
 
     '("theoremstyle"
       (TeX-arg-eval completing-read
-                   (TeX-argument-prompt nil nil "Style")
-                   (LaTeX-amsthm-newtheoremstyle-list)))
+                    (TeX-argument-prompt nil nil "Style")
+                    (LaTeX-amsthm-newtheoremstyle-list)))
     "qedhere"
     "swapnumbers"
 
     '("newtheoremstyle"
       (TeX-arg-eval
        (lambda ()
-        (let ((nthmstyle (TeX-read-string
-                          (TeX-argument-prompt nil nil "Style name"))))
-          (LaTeX-add-amsthm-newtheoremstyles nthmstyle)
-          (format "%s" nthmstyle))))
+         (let ((nthmstyle (TeX-read-string
+                           (TeX-argument-prompt nil nil "Style name"))))
+           (LaTeX-add-amsthm-newtheoremstyles nthmstyle)
+           (format "%s" nthmstyle))))
       (TeX-arg-length "Space above")
       (TeX-arg-length "Space below")
       (LaTeX-arg-amsthm-fontdecl "Body font: \\")
@@ -191,11 +191,11 @@ make them available as new environments."
 
    ;; Fontification
    (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
+              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("newtheorem"      "*{[{[")
-                               ("theoremstyle"    "{")
-                               ("newtheoremstyle" "{{{{{{{{{"))
-                             'function)))
+                                ("theoremstyle"    "{")
+                                ("newtheoremstyle" "{{{{{{{{{"))
+                              'function)))
  TeX-dialect)
 
 ;;; amsthm.el ends here
diff --git a/style/appendix.el b/style/appendix.el
index 1df68a6..406aef5 100644
--- a/style/appendix.el
+++ b/style/appendix.el
@@ -69,11 +69,11 @@
    ;; Don't indent the content inside \(sub\)?appendices environments:
    (unless (string-match "appendices" LaTeX-document-regexp)
      (set (make-local-variable 'LaTeX-document-regexp)
-         (concat LaTeX-document-regexp "\\|\\(?:sub\\)?appendices"))))
+          (concat LaTeX-document-regexp "\\|\\(?:sub\\)?appendices"))))
  TeX-dialect)
 
 (defvar LaTeX-appendix-package-options '("toc" "page" "title"
-                                        "titletoc" "header")
+                                         "titletoc" "header")
   "Package options for the appendix package.")
 
 ;;; appendix.el ends here
diff --git a/style/arabxetex.el b/style/arabxetex.el
index ed4cd03..05068a4 100644
--- a/style/arabxetex.el
+++ b/style/arabxetex.el
@@ -36,8 +36,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 (declare-function TeX-check-engine-add-engines
                   "tex-buf"
                   (&rest engines))
@@ -56,44 +56,44 @@
 
    ;; New macros & environments:
    (let ((langs '("arab"
-                 "farsi" "persian"
-                 "urdu"
-                 "sindhi"
-                 "pashto"
-                 "ottoman" "turk"
-                 "kurdisch"
-                 "kashmiri"
-                 "malay" "jawi"
-                 "uighur")))
+                  "farsi" "persian"
+                  "urdu"
+                  "sindhi"
+                  "pashto"
+                  "ottoman" "turk"
+                  "kurdisch"
+                  "kashmiri"
+                  "malay" "jawi"
+                  "uighur")))
      ;; Add \text<language>[option]{...}
      (mapc #'TeX-add-symbols
-          (mapcar
-           (lambda (symbol)
-             (list symbol
-                   [ TeX-arg-eval completing-read
-                                  (TeX-argument-prompt t nil "Mode")
-                                  LaTeX-arabxetex-package-options ]
-                   t))
-           (mapcar (lambda (lang) (concat "text" lang)) langs)))
+           (mapcar
+            (lambda (symbol)
+              (list symbol
+                    [ TeX-arg-eval completing-read
+                      (TeX-argument-prompt t nil "Mode")
+                      LaTeX-arabxetex-package-options ]
+                    t))
+            (mapcar (lambda (lang) (concat "text" lang)) langs)))
      ;;
      ;; Add \begin{<language>}[option] ... \end{<language>}
      (mapc #'LaTeX-add-environments
-          (mapcar
-           (lambda (environment)
-             (list environment
-                   #'LaTeX-env-args
-                   [ TeX-arg-eval completing-read
-                                  (TeX-argument-prompt t nil "Mode")
-                                  LaTeX-arabxetex-package-options ]))
-           langs))
+           (mapcar
+            (lambda (environment)
+              (list environment
+                    #'LaTeX-env-args
+                    [ TeX-arg-eval completing-read
+                      (TeX-argument-prompt t nil "Mode")
+                      LaTeX-arabxetex-package-options ]))
+            langs))
      ;;
      ;; Fontification
      (when (and (featurep 'font-latex)
-               (eq TeX-install-font-lock 'font-latex-setup))
+                (eq TeX-install-font-lock 'font-latex-setup))
        (font-latex-add-keywords (mapcar (lambda (lang)
-                                         (list (concat "text" lang) "[{"))
-                                       langs)
-                               'textual)))
+                                          (list (concat "text" lang) "[{"))
+                                        langs)
+                                'textual)))
 
    ;; Other macros:
    (TeX-add-symbols
@@ -103,20 +103,20 @@
     ;; 3.3 Transliteration
     '("SetTranslitConvention"
       (TeX-arg-eval completing-read
-                   (TeX-argument-prompt nil nil "Mapping")
-                   '("dmg" "loc")))
+                    (TeX-argument-prompt nil nil "Mapping")
+                    '("dmg" "loc")))
     '("SetTranslitStyle" "Style"))
 
    ;; Fontification
    (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
+              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("textLR" "{"))
-                             'textual)
+                              'textual)
      (font-latex-add-keywords '(("aemph"  "{"))
-                             'italic-command)
+                              'italic-command)
      (font-latex-add-keywords '(("SetTranslitConvention" "{")
-                               ("SetTranslitStyle"      "{"))
-                             'function)))
+                                ("SetTranslitStyle"      "{"))
+                              'function)))
  TeX-dialect)
 
 (defvar LaTeX-arabxetex-package-options
diff --git a/style/array.el b/style/array.el
index 4b3f1d4..b944103 100644
--- a/style/array.el
+++ b/style/array.el
@@ -34,8 +34,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (TeX-auto-add-type "array-newcolumntype" "LaTeX")
 
@@ -47,7 +47,7 @@ package.")
 
 (defun LaTeX-array-auto-prepare ()
   "Clear `LaTeX-auto-array-newcolumntype' before parsing."
-  (setq        LaTeX-auto-array-newcolumntype nil))
+  (setq LaTeX-auto-array-newcolumntype nil))
 
 (defun LaTeX-array-auto-cleanup ()
   "Move parsed column specification from
@@ -60,12 +60,12 @@ package.")
 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))
-                 "")))
+                  (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)
@@ -81,10 +81,10 @@ and make it buffer local. "
     '("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))))
+         (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)
@@ -96,13 +96,13 @@ and make it buffer local. "
 
    ;; `array.sty' adds some new column specification letters.
    (set (make-local-variable 'LaTeX-array-column-letters)
-       (concat LaTeX-array-column-letters "m" "b" "w" "W"))
+        (concat LaTeX-array-column-letters "m" "b" "w" "W"))
 
    ;; Fontification
    (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
+              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("newcolumntype" "{[{"))
-                             'function)))
+                              'function)))
  TeX-dialect)
 
 (defvar LaTeX-array-package-options nil
diff --git a/style/article.el b/style/article.el
index aa4d764..1278ddb 100644
--- a/style/article.el
+++ b/style/article.el
@@ -16,7 +16,7 @@
  (lambda ()
    (LaTeX-largest-level-set "section")
    (LaTeX-add-counters "part" "section" "subsection" "subsubsection" 
"paragraph"
-                      "subparagraph" "figure" "table")
+                       "subparagraph" "figure" "table")
    (LaTeX-add-pagestyles "headings" "myheadings")
    (LaTeX-add-environments "abstract"))
  TeX-dialect)
diff --git a/style/attachfile.el b/style/attachfile.el
index 8f077be..c090b5a 100644
--- a/style/attachfile.el
+++ b/style/attachfile.el
@@ -35,8 +35,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (defvar LaTeX-attachfile-key-val-options
   '(("appearance" ("true" "false"))
@@ -84,9 +84,9 @@
       [TeX-arg-key-val LaTeX-attachfile-key-val-options]
       (TeX-arg-eval
        (lambda ()
-        (let ((atfi (file-relative-name
-                     (read-file-name "File to attach: "))))
-          (format "%s" atfi)))))
+         (let ((atfi (file-relative-name
+                      (read-file-name "File to attach: "))))
+           (format "%s" atfi)))))
 
     ;; \noattachfile[<options>]
     '("noattachfile"
@@ -97,9 +97,9 @@
       [TeX-arg-key-val LaTeX-attachfile-key-val-options]
       (TeX-arg-eval
        (lambda ()
-        (let ((atfi (file-relative-name
-                     (read-file-name "File to attach: "))))
-          (format "%s" atfi))))
+         (let ((atfi (file-relative-name
+                      (read-file-name "File to attach: "))))
+           (format "%s" atfi))))
       t)
 
     ;; \notextattachfile[<options>]{<text>}
@@ -112,13 +112,13 @@
 
    ;; Fontification
    (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
+              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("attachfilesetup"  "{")
-                               ("attachfile"       "[{")
-                               ("noattachfile"     "[")
-                               ("textattachfile"   "[{{")
-                               ("notextattachfile" "[{"))
-                             'function)))
+                                ("attachfile"       "[{")
+                                ("noattachfile"     "[")
+                                ("textattachfile"   "[{{")
+                                ("notextattachfile" "[{"))
+                              'function)))
  TeX-dialect)
 
 (defvar LaTeX-attachfile-package-options nil
diff --git a/style/babel.el b/style/babel.el
index 43f19ab..e8f792c 100644
--- a/style/babel.el
+++ b/style/babel.el
@@ -38,8 +38,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (defvar LaTeX-babel-language-list
   '("afrikaans"
@@ -109,31 +109,31 @@
   (let (main-language active-languages)
     ;; Loop over options provided to class and `babel' package at load time.
     (dolist (elt (append
-                 ;; In most cases there is only one element in the alist, if
-                 ;; there is more than one element, the first one should
-                 ;; contain the class options of the current buffer.  So we can
-                 ;; take the car of `LaTeX-provided-class-options'.
-                 (cdr (car LaTeX-provided-class-options))
-                 (cdr (assoc "babel" LaTeX-provided-package-options))))
+                  ;; In most cases there is only one element in the alist, if
+                  ;; there is more than one element, the first one should
+                  ;; contain the class options of the current buffer.  So we 
can
+                  ;; take the car of `LaTeX-provided-class-options'.
+                  (cdr (car LaTeX-provided-class-options))
+                  (cdr (assoc "babel" LaTeX-provided-package-options))))
       (setq elt (TeX-split-string "=" elt))
       (if (equal (car elt) "main")
-         ;; Starting from version 3.9 of `babel' package, languages can be set
-         ;; with the following syntax:
-         ;;   \usepackage[latin.medieval,main=danish,spanish.notilde]{babel}
-         ;; with `danish' being the default language.  When the default
-         ;; language is set with the `main' option, we record it and append to
-         ;; the list at the end.
-         (setq main-language (car (cdr elt)))
-       ;; Get rid of the modifiers (`medieval' and `notilde' in the above
-       ;; example).
-       (setq elt (car (TeX-split-string "\\." (car elt))))
-       (if (member elt LaTeX-babel-language-list)
-           ;; Append element to `active-languages' to respect loading order.
-           ;; `babel' package uses as default language the last loaded one,
-           ;; except if it is set with the `main' option.
-           (cl-pushnew elt active-languages :test #'equal))))
+          ;; Starting from version 3.9 of `babel' package, languages can be set
+          ;; with the following syntax:
+          ;;   \usepackage[latin.medieval,main=danish,spanish.notilde]{babel}
+          ;; with `danish' being the default language.  When the default
+          ;; language is set with the `main' option, we record it and append to
+          ;; the list at the end.
+          (setq main-language (car (cdr elt)))
+        ;; Get rid of the modifiers (`medieval' and `notilde' in the above
+        ;; example).
+        (setq elt (car (TeX-split-string "\\." (car elt))))
+        (if (member elt LaTeX-babel-language-list)
+            ;; Append element to `active-languages' to respect loading order.
+            ;; `babel' package uses as default language the last loaded one,
+            ;; except if it is set with the `main' option.
+            (cl-pushnew elt active-languages :test #'equal))))
     (if main-language
-       (cl-pushnew main-language active-languages :test #'equal))
+        (cl-pushnew main-language active-languages :test #'equal))
     (nreverse active-languages)))
 
 ;; Setup for \babeltags: Note that the macro is \babeltags, we use
@@ -153,36 +153,36 @@
       ;; Clean up the parsed results from characters we don't want;
       ;; also remove possible comment lines
       (setq results
-           (replace-regexp-in-string
-            "\\(%.*$\\|[ \n\r\t]\\)" ""
-            (mapconcat #'car (LaTeX-babel-babeltag-list) ",")))
+            (replace-regexp-in-string
+             "\\(%.*$\\|[ \n\r\t]\\)" ""
+             (mapconcat #'car (LaTeX-babel-babeltag-list) ",")))
       ;; Look if \babeltags was issued once with multiple entries or
       ;; more than once in the document:
       (if (string-match-p "," results)
-         (progn
-           (dolist (elt (split-string results "," t))
-             (setq tag (car (split-string elt "=" t)))
-             (push tag tags)
-             (push (list (concat "text" tag) t) cmds)
-             (push (list tag -1) cmds)))
-       ;; One \babeltags with one entry only
-       (setq tag (car (split-string results "=" t)))
-       (push tag tags)
-       (push (list (concat "text" tag) t) cmds)
-       (push (list tag -1) cmds))
+          (progn
+            (dolist (elt (split-string results "," t))
+              (setq tag (car (split-string elt "=" t)))
+              (push tag tags)
+              (push (list (concat "text" tag) t) cmds)
+              (push (list tag -1) cmds)))
+        ;; One \babeltags with one entry only
+        (setq tag (car (split-string results "=" t)))
+        (push tag tags)
+        (push (list (concat "text" tag) t) cmds)
+        (push (list tag -1) cmds))
       (mapc #'TeX-add-symbols cmds)
       (mapc #'LaTeX-add-environments tags)
       ;; Fontification
       (when (and (featurep 'font-latex)
-                (eq TeX-install-font-lock 'font-latex-setup))
-       (font-latex-add-keywords (mapcar (lambda (x)
-                                          (list (concat "text" x)  "{"))
-                                        tags)
-                                'textual)
-       (font-latex-add-keywords (mapcar (lambda (x)
-                                          (list x  ""))
-                                        tags)
-                                'type-declaration)))))
+                 (eq TeX-install-font-lock 'font-latex-setup))
+        (font-latex-add-keywords (mapcar (lambda (x)
+                                           (list (concat "text" x)  "{"))
+                                         tags)
+                                 'textual)
+        (font-latex-add-keywords (mapcar (lambda (x)
+                                           (list x  ""))
+                                         tags)
+                                 'type-declaration)))))
 
 ;; Setup for \babelfont:
 (TeX-auto-add-type "babel-babelfont" "LaTeX")
@@ -198,27 +198,27 @@
     (dolist (elt (mapcar #'car (LaTeX-babel-babelfont-list)))
       ;; Don't do anything for standard font-families:
       (unless (member elt '("rm" "sf" "tt"))
-       ;; Define \<font>family, \<font>default and \text<font>:
-       (let ((fam (concat elt "family"))
-             (def (concat elt "default"))
-             (mac (concat "text" elt)))
-         (apply #'TeX-add-symbols
-                `((,fam -1)
-                  (,def -1)
-                  (,mac t)))
-         ;; Cater for fontification:
-         (when (and (featurep 'font-latex)
-                    (eq TeX-install-font-lock 'font-latex-setup))
-           (font-latex-add-keywords `((,fam "")
-                                      (,def ""))
-                                    'type-declaration)
-           (font-latex-add-keywords `((,mac "{"))
-                                    'type-command)))))))
+        ;; Define \<font>family, \<font>default and \text<font>:
+        (let ((fam (concat elt "family"))
+              (def (concat elt "default"))
+              (mac (concat "text" elt)))
+          (apply #'TeX-add-symbols
+                 `((,fam -1)
+                   (,def -1)
+                   (,mac t)))
+          ;; Cater for fontification:
+          (when (and (featurep 'font-latex)
+                     (eq TeX-install-font-lock 'font-latex-setup))
+            (font-latex-add-keywords `((,fam "")
+                                       (,def ""))
+                                     'type-declaration)
+            (font-latex-add-keywords `((,mac "{"))
+                                     'type-command)))))))
 
 (defun LaTeX-babel-auto-prepare ()
   "Clear `LaTeX-auto-babel-babel*' before parsing."
   (setq LaTeX-auto-babel-babeltag  nil
-       LaTeX-auto-babel-babelfont nil))
+        LaTeX-auto-babel-babelfont nil))
 
 (defun LaTeX-babel-auto-cleanup ()
   "Process parsed elements."
@@ -241,7 +241,7 @@
   "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)))))
+                                       (LaTeX-babel-active-languages)))))
 
 (defun LaTeX-babel-load-languages ()
   "Load style files of babel active languages."
@@ -269,15 +269,15 @@
     ;; 1.9 More on selection
     '("babeltags" t)
     '("babelensure" (TeX-arg-key-val
-                    (("include") ("exclude")
-                     ("fontenc" (;; 128+ glyph encodings (text)
-                                 "OT1" "OT2" "OT3" "OT4" "OT6"
-                                 ;; 256 glyph encodings (text)
-                                 "T1" "T2A" "T2B" "T2C" "T3" "T4" "T5"
-                                 ;; 256 glyph encodings (text extended)
-                                 "X2"
-                                 ;; Other encodings
-                                 "LY1" "LV1" "LGR"))))
+                     (("include") ("exclude")
+                      ("fontenc" (;; 128+ glyph encodings (text)
+                                  "OT1" "OT2" "OT3" "OT4" "OT6"
+                                  ;; 256 glyph encodings (text)
+                                  "T1" "T2A" "T2B" "T2C" "T3" "T4" "T5"
+                                  ;; 256 glyph encodings (text extended)
+                                  "X2"
+                                  ;; Other encodings
+                                  "LY1" "LV1" "LGR"))))
       TeX-arg-babel-lang)
     ;; 1.10 Shorthands
     '("shorthandon"    "Shorthands list")
@@ -287,9 +287,9 @@
     '("useshorthands*" "Character")
     '("defineshorthand"
       [ TeX-arg-eval mapconcat #'identity
-                    (TeX-completing-read-multiple
-                     (TeX-argument-prompt t nil "Language(s)")
-                     (LaTeX-babel-active-languages)) ""]
+        (TeX-completing-read-multiple
+         (TeX-argument-prompt t nil "Language(s)")
+         (LaTeX-babel-active-languages)) ""]
       t nil)
     '("aliasshorthand"   "Original" "Alias")
     '("languageshorthands" TeX-arg-babel-lang)
@@ -299,32 +299,32 @@
     ;; 1.12 The base option
     '("AfterBabelLanguage"
       (TeX-arg-eval completing-read
-                   (TeX-argument-prompt nil nil "Language")
-                   LaTeX-babel-language-list)
+                    (TeX-argument-prompt nil nil "Language")
+                    LaTeX-babel-language-list)
       t)
 
     ;; 1.14 Selecting fonts
     '("babelfont"
       [ TeX-arg-eval mapconcat #'identity
-                    (TeX-completing-read-multiple
-                     (TeX-argument-prompt t nil "Language(s)")
-                     LaTeX-babel-language-list)
-                    "," ]
+        (TeX-completing-read-multiple
+         (TeX-argument-prompt t nil "Language(s)")
+         LaTeX-babel-language-list)
+        "," ]
       (TeX-arg-eval let ((fontfam (completing-read
-                                  (TeX-argument-prompt nil nil "font family")
-                                  '("rm" "sf" "tt"))))
-                   ;; Make sure `tex-buf.el' is also loaded otherwise
-                   ;; `TeX-check-engine-add-engines' is not defined.
-                   ;; Then load `fontspec.el' and make sure the
-                   ;; key-vals are up to date.
-                   (unless (member "fontspec" (TeX-style-list))
-                     (require 'tex-buf)
-                     (TeX-check-engine-add-engines 'luatex 'xetex)
-                     (TeX-run-style-hooks "fontspec")
-                     (LaTeX-fontspec-auto-cleanup))
-                   (LaTeX-add-babel-babelfonts fontfam)
-                   (LaTeX-babel-cleanup-babelfont)
-                   (format "%s" fontfam))
+                                   (TeX-argument-prompt nil nil "font family")
+                                   '("rm" "sf" "tt"))))
+                    ;; Make sure `tex-buf.el' is also loaded otherwise
+                    ;; `TeX-check-engine-add-engines' is not defined.
+                    ;; Then load `fontspec.el' and make sure the
+                    ;; key-vals are up to date.
+                    (unless (member "fontspec" (TeX-style-list))
+                      (require 'tex-buf)
+                      (TeX-check-engine-add-engines 'luatex 'xetex)
+                      (TeX-run-style-hooks "fontspec")
+                      (LaTeX-fontspec-auto-cleanup))
+                    (LaTeX-add-babel-babelfonts fontfam)
+                    (LaTeX-babel-cleanup-babelfont)
+                    (format "%s" fontfam))
       [ TeX-arg-key-val LaTeX-fontspec-font-features-local]
       LaTeX-fontspec-arg-font)
 
@@ -332,8 +332,8 @@
     '("babelprovide"
       [ TeX-arg-key-val LaTeX-babel-babelprovide-key-val-options ]
       (TeX-arg-eval completing-read
-                   (TeX-argument-prompt nil nil "Language")
-                   LaTeX-babel-language-list))
+                    (TeX-argument-prompt nil nil "Language")
+                    LaTeX-babel-language-list))
 
     ;; 1.18 Getting the current language name
     '("languagename" 0)
@@ -342,19 +342,19 @@
     ;; 1.19 Hyphenation and line breaking
     '("babelhyphen"
       (TeX-arg-eval completing-read
-                   (TeX-argument-prompt nil nil "Type/Text")
-                   '("soft" "hard" "repeat" "empty")))
+                    (TeX-argument-prompt nil nil "Type/Text")
+                    '("soft" "hard" "repeat" "empty")))
     '("babelhyphen*"
       (TeX-arg-eval completing-read
-                   (TeX-argument-prompt nil nil "Type/Text")
-                   '("soft" "hard" "repeat" "empty")))
+                    (TeX-argument-prompt nil nil "Type/Text")
+                    '("soft" "hard" "repeat" "empty")))
 
     '("babelhyphenation"
       [ TeX-arg-eval mapconcat #'identity
-                    (TeX-completing-read-multiple
-                     (TeX-argument-prompt nil nil "Language(s)")
-                     LaTeX-babel-language-list)
-                    "," ]
+        (TeX-completing-read-multiple
+         (TeX-argument-prompt nil nil "Language(s)")
+         LaTeX-babel-language-list)
+        "," ]
       t)
 
     ;; 1.20 Selecting scripts
@@ -371,29 +371,29 @@
 
    ;; Fontification
    (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
+              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("selectlanguage"     "{")
-                               ("foreignlanguage"    "{{")
-                               ("babeltags"          "{")
-                               ("babelensure"        "{{")
-                               ("shorthandon"        "{")
-                               ("shorthandoff"       "*{")
-                               ("useshorthands"      "*{")
-                               ("languageshorthands" "{")
-                               ("babelshorthand"     "{")
-                               ("AfterBabelLanguage" "{")
-                               ("babelfont"          "[{[{")
-                               ("babelprovide"       "[{")
-                               ("languagename"       "")
-                               ("iflanguage"         "{{{")
-                               ("babelhyphen"        "*{")
-                               ("babelhyphenation"   "[{")
-                               ("ensureascii"        "{"))
-                             'function)
+                                ("foreignlanguage"    "{{")
+                                ("babeltags"          "{")
+                                ("babelensure"        "{{")
+                                ("shorthandon"        "{")
+                                ("shorthandoff"       "*{")
+                                ("useshorthands"      "*{")
+                                ("languageshorthands" "{")
+                                ("babelshorthand"     "{")
+                                ("AfterBabelLanguage" "{")
+                                ("babelfont"          "[{[{")
+                                ("babelprovide"       "[{")
+                                ("languagename"       "")
+                                ("iflanguage"         "{{{")
+                                ("babelhyphen"        "*{")
+                                ("babelhyphenation"   "[{")
+                                ("ensureascii"        "{"))
+                              'function)
      (font-latex-add-keywords '(("defineshorthand"    "[{{")
-                               ("aliasshorthand"     "{{")
-                               ("languageattribute"  "{{"))
-                             'variable)))
+                                ("aliasshorthand"     "{{")
+                                ("languageattribute"  "{{"))
+                              'variable)))
  TeX-dialect)
 
 (defun LaTeX-babel-package-options ()
@@ -417,13 +417,13 @@
       ("nocase")
       ("silent")
       ("strings" ("generic" "unicode" "encoded"
-                 "OT1" "OT2" "OT3" "OT4" "OT6"
-                 "T1"  "T2A" "T2B" "T2C" "T3" "T4" "T5"
-                 "X2"  "LY1" "LV1" "LGR"))
+                  "OT1" "OT2" "OT3" "OT4" "OT6"
+                  "T1"  "T2A" "T2B" "T2C" "T3" "T4" "T5"
+                  "X2"  "LY1" "LV1" "LGR"))
       ("hyphenmap" ("off" "main" "select" "other" "other*"))
       ("bidi" ("default" "basic" "basic-r" "bidi-l" "bidi-r"))
       ("layout" ("sectioning" "counters" "lists" "captions"
-                "contents" "footnotes" "columns" "extras"))
+                 "contents" "footnotes" "columns" "extras"))
       ("base"))
     (mapcar #'list LaTeX-babel-language-list))))
 
diff --git a/style/baskervaldx.el b/style/baskervaldx.el
index ed347d9..dce6c5f 100644
--- a/style/baskervaldx.el
+++ b/style/baskervaldx.el
@@ -35,8 +35,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (TeX-add-style-hook
  "baskervaldx"
@@ -66,21 +66,21 @@
 
    ;; Fontification
    (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
+              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("textlf"    "{")
-                               ("texttlf"   "{")
-                               ("textosf"   "{")
-                               ("texttosf"  "{")
-                               ("textsu"    "{"))
-                             'type-command)
+                                ("texttlf"   "{")
+                                ("textosf"   "{")
+                                ("texttosf"  "{")
+                                ("textsu"    "{"))
+                              'type-command)
      (font-latex-add-keywords '(("lfstyle"   "")
-                               ("tlfstyle"  "")
-                               ("osfstyle"  "")
-                               ("tosfstyle" "")
-                               ("sufigures" ""))
-                             'type-declaration)
+                                ("tlfstyle"  "")
+                                ("osfstyle"  "")
+                                ("tosfstyle" "")
+                                ("sufigures" ""))
+                              'type-declaration)
      (font-latex-add-keywords '(("swshape"   ""))
-                             'bold-declaration)))
+                              'bold-declaration)))
  TeX-dialect)
 
 (defvar LaTeX-baskervaldx-package-options
diff --git a/style/beamer.el b/style/beamer.el
index d84d275..ea9ed4e 100644
--- a/style/beamer.el
+++ b/style/beamer.el
@@ -34,30 +34,30 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (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
+               (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]")))))))
+        (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]")))))))
 
 (defvar LaTeX-beamer-frametitle-history nil
   "History of frame titles in beamer.")
@@ -68,19 +68,19 @@
    (add-hook 'LaTeX-after-insert-env-hook 'LaTeX-beamer-after-insert-env nil t)
 
    (TeX-run-style-hooks "amsmath" "amssymb" "amsthm" "color" "geometry"
-                       "hyperref" "inputenc" "translator" "xcolor")
+                        "hyperref" "inputenc" "translator" "xcolor")
 
    (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)))
+           '(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))
+         (append '(("itemize" . LaTeX-item-beamer)
+                   ("enumerate" . LaTeX-item-beamer))
+                 LaTeX-item-list))
 
    (setq LaTeX-default-document-environment "frame")
 
@@ -137,58 +137,58 @@
     '("alertblock" 1)
     '("beamerboxesrounded" 1)
     '("block" (lambda (env &rest ignore)
-               (LaTeX-insert-environment
-                env (format "{%s}" (TeX-read-string "Title: ")))))
+                (LaTeX-insert-environment
+                 env (format "{%s}" (TeX-read-string "Title: ")))))
     '("column" "Width")
     "columns"
     "columnsonlytextwidth"
     '("exampleblock" 1)
     '("frame"  (lambda (env &rest ignore)
-                (let ((title (TeX-read-string "(Optional) Title: " nil
-                                              
'LaTeX-beamer-frametitle-history)))
-                  (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))))))
+                 (let ((title (TeX-read-string "(Optional) Title: " nil
+                                               
'LaTeX-beamer-frametitle-history)))
+                   (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 (TeX-read-string "(Optional) Overlay: ")))
-                    (unless (zerop (length overlay))
-                      (format "<%s>" overlay))))))
+                  (LaTeX-insert-environment
+                   env
+                   (let ((overlay (TeX-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 (TeX-read-string "(Optional) Area width: ")))
-                       (unless (zerop (length width))
-                         (format "[%s]" width))))))
+                     (LaTeX-insert-environment
+                      env
+                      (let ((width (TeX-read-string "(Optional) Area width: 
")))
+                        (unless (zerop (length width))
+                          (format "[%s]" width))))))
     "semiverbatim")
 
    (LaTeX-largest-level-set "section")
    (LaTeX-add-counters "lecture" "part" "section" "subsection" "subsubsection"
-                      "subsectionslide" "framenumber" "figure" "table"
-                      "beamerpauses")
+                       "subsectionslide" "framenumber" "figure" "table"
+                       "beamerpauses")
    (LaTeX-add-pagestyles "navigation")
    (add-to-list (make-local-variable 'LaTeX-indent-environment-list)
-               '("semiverbatim" current-indentation) t)
+                '("semiverbatim" current-indentation) t)
    (add-to-list 'LaTeX-verbatim-environments-local "semiverbatim")
 
    ;; Fontification
    (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
+              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("title" "[{")
-                               ("subtitle" "[{")
-                               ("author" "[{")
-                               ("date" "[{")
-                               ("frametitle" "<[{")) 'slide-title)))
+                                ("subtitle" "[{")
+                                ("author" "[{")
+                                ("date" "[{")
+                                ("frametitle" "<[{")) 'slide-title)))
  TeX-dialect)
 
 (defun TeX-arg-beamer-overlay-spec (optional &optional prompt)
@@ -209,7 +209,7 @@ one."
   (let ((title (TeX-read-string "Title: " nil 
'LaTeX-beamer-frametitle-history)))
     (if (not (zerop (length title)))
         (insert TeX-grop TeX-esc "frametitle" TeX-grop
-               title TeX-grcl TeX-grcl)
+                title TeX-grcl TeX-grcl)
       (insert TeX-grop TeX-grcl))))
 
 (defun LaTeX-item-beamer ()
@@ -244,25 +244,25 @@ 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)))))
+         (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))))))
+             (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."
@@ -270,16 +270,16 @@ also be a string.  Then the length of the string is used."
    (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))))
+            (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))
 
@@ -289,16 +289,16 @@ also be a string.  Then the length of the string is used."
    (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))))
+            (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))
 
@@ -308,16 +308,16 @@ also be a string.  Then the length of the string is used."
    (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))))
+            (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))
 
@@ -327,16 +327,16 @@ also be a string.  Then the length of the string is used."
    (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))))
+            (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))
 
@@ -346,16 +346,16 @@ also be a string.  Then the length of the string is used."
    (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))))
+            (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))
 
@@ -363,15 +363,15 @@ also be a string.  Then the length of the string is used."
   "Read the beamer class options from the user."
   (TeX-load-style "hyperref")
   (TeX-read-key-val t '(("usepdftitle" ("false")) ("envcountsect")
-                       ("notheorems") ("noamsthm") ("compress") ("t") ("c")
-                       ("leqno") ("fleqn") ("handout") ("trans") ("pdftex")
-                       ("nativepdf") ("pdfmark") ("dvips") ("dviwindo")
-                       ("dvipsone") ("vtex") ("ps2pdf") ("ignorenonframetext")
-                       ("noamssymb") ("bigger") ("smaller") ("8pt") ("9pt")
-                       ("10pt") ("11pt") ("12pt") ("14pt") ("17pt") ("20pt")
-                       ("draft") ("CJK") ("cjk") ("pgf")
-                       ("hyperref" LaTeX-hyperref-package-options-list)
-                       ("color") ("xcolor") ("ucs") ("utf8x") ("utf8")
-                       ("aspectratio" ("1610" "169" "149" "54" "43" "32")))))
+                        ("notheorems") ("noamsthm") ("compress") ("t") ("c")
+                        ("leqno") ("fleqn") ("handout") ("trans") ("pdftex")
+                        ("nativepdf") ("pdfmark") ("dvips") ("dviwindo")
+                        ("dvipsone") ("vtex") ("ps2pdf") ("ignorenonframetext")
+                        ("noamssymb") ("bigger") ("smaller") ("8pt") ("9pt")
+                        ("10pt") ("11pt") ("12pt") ("14pt") ("17pt") ("20pt")
+                        ("draft") ("CJK") ("cjk") ("pgf")
+                        ("hyperref" LaTeX-hyperref-package-options-list)
+                        ("color") ("xcolor") ("ucs") ("utf8x") ("utf8")
+                        ("aspectratio" ("1610" "169" "149" "54" "43" "32")))))
 
 ;;; beamer.el ends here
diff --git a/style/biblatex.el b/style/biblatex.el
index e1e803d..10e76ec 100644
--- a/style/biblatex.el
+++ b/style/biblatex.el
@@ -35,8 +35,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (defvar reftex-cite-format-builtin)
 
@@ -76,7 +76,7 @@
     ("autocite" ("plain" "inline" "footnote" "superscript"))
     ("autopunct" ("true" "false"))
     ("language" (append LaTeX-biblatex-language-list
-                       '("autobib" "autocite" "auto")))
+                        '("autobib" "autocite" "auto")))
     ("clearlang" ("true" "false"))
     ("autolang" ("none" "hyphen" "other" "other*" "langname"))
     ("block" ("none" "space" "par" "nbpar" "ragged"))
@@ -85,7 +85,7 @@
     ("backref" ("true" "false"))
     ("backrefstyle" ("none" "three" "two" "two+" "three+" "all+"))
     ("backrefsetstyle" ("setonly" "memonly" "setormem" "setandmem" "memandset"
-                       "setplusmem"))
+                        "setplusmem"))
     ("indexing" ("true" "false" "cite" "bib"))
     ("loadfiles" ("true" "false"))
     ("refsection" ("none" "part" "chapter" "section" "subsection"))
@@ -135,7 +135,7 @@
     ("labeldate" ("true" "false"))
     ("singletitle" ("true" "false"))
     ("uniquename" ("true" "false" "init" "full" "allinit" "allfull" "mininit"
-                  "minfull"))
+                   "minfull"))
     ("uniquelist" ("true" "false" "minyear")))
   "Key=value options for ExecuteBibliographyOptions macro of the biblatex 
package.")
 
@@ -161,22 +161,22 @@ argument, otherwise as a mandatory one.  Use PROMPT as 
the prompt
 string."
   (let (files inputs database)
     (if LaTeX-using-Biber
-       (setq files 'TeX-Biber-global-files
-             inputs 'biberinputs)
+        (setq files 'TeX-Biber-global-files
+              inputs 'biberinputs)
       (setq files 'BibTeX-global-files
-           inputs 'bibinputs))
+            inputs 'bibinputs))
     (setq files 'TeX-Biber-global-files
-         inputs 'biberinputs)
+          inputs 'biberinputs)
     (message "Searching for BibLaTeX files...")
     (or (symbol-value files)
-       (set files (mapcar 'list (TeX-search-files-by-type
-                                 'biberinputs 'global t nil))))
+        (set files (mapcar 'list (TeX-search-files-by-type
+                                  'biberinputs 'global t nil))))
     (message "Searching for BibLaTeX files...done")
     (setq database (completing-read
-                   (TeX-argument-prompt optional prompt "BibLaTeX files")
-                   (append (mapcar 'list (TeX-search-files-by-type
-                                          inputs 'local t nil))
-                           (symbol-value files))))
+                    (TeX-argument-prompt optional prompt "BibLaTeX files")
+                    (append (mapcar 'list (TeX-search-files-by-type
+                                           inputs 'local t nil))
+                            (symbol-value files))))
     (LaTeX-add-bibliographies database)
     ;; Run style file associated to the bibliography database file in order to
     ;; immediately fill `LaTeX-bibitem-list'.  We need to strip the extension
@@ -194,59 +194,59 @@ for citation keys."
   ;; Prompt for global prenote and postnote.
   (and TeX-arg-cite-note-p (not current-prefix-arg)
        (let ((TeX-arg-opening-brace "(")
-            (TeX-arg-closing-brace ")")
-            (prenote (TeX-read-string
-                      (TeX-argument-prompt t nil "Global prenote"))))
-        (TeX-argument-insert prenote t)
-        ;; If the prenote is empty the postnote is optional, otherwise it's
-        ;; mandatory.
-        (TeX-argument-insert
-         (TeX-read-string (TeX-argument-prompt t nil "Global postnote"))
-         (equal prenote ""))))
+             (TeX-arg-closing-brace ")")
+             (prenote (TeX-read-string
+                       (TeX-argument-prompt t nil "Global prenote"))))
+         (TeX-argument-insert prenote t)
+         ;; If the prenote is empty the postnote is optional, otherwise it's
+         ;; mandatory.
+         (TeX-argument-insert
+          (TeX-read-string (TeX-argument-prompt t nil "Global postnote"))
+          (equal prenote ""))))
   (let ((items t) (noinsert nil))
     (while items
       ;; Prompt for prenote and postnote of the current keys.
       (and TeX-arg-cite-note-p (not current-prefix-arg)
-          (let ((TeX-arg-opening-brace "[")
-                (TeX-arg-closing-brace "]")
-                (prenote (TeX-read-string
-                          (TeX-argument-prompt t nil "Prenote"))))
-            (TeX-argument-insert prenote t)
-            ;; If the prenote is empty the postnote is optional, otherwise it's
-            ;; mandatory.
-            (TeX-argument-insert
-             (TeX-read-string (TeX-argument-prompt t nil "Postnote"))
-             (equal prenote ""))))
+           (let ((TeX-arg-opening-brace "[")
+                 (TeX-arg-closing-brace "]")
+                 (prenote (TeX-read-string
+                           (TeX-argument-prompt t nil "Prenote"))))
+             (TeX-argument-insert prenote t)
+             ;; If the prenote is empty the postnote is optional, otherwise 
it's
+             ;; mandatory.
+             (TeX-argument-insert
+              (TeX-read-string (TeX-argument-prompt t nil "Postnote"))
+              (equal prenote ""))))
       (setq items (if (and (fboundp 'reftex-citation)
-                          (fboundp 'reftex-plug-flag)
-                          (reftex-plug-flag 3))
-                     ;; Use RefTeX when enabled.
-                     (reftex-citation t)
-                   ;; Multiple citation keys in each argument are allowed.
-                   (TeX-completing-read-multiple
-                    (TeX-argument-prompt optional prompt "Key(s)")
-                    (LaTeX-bibitem-list))))
+                           (fboundp 'reftex-plug-flag)
+                           (reftex-plug-flag 3))
+                      ;; Use RefTeX when enabled.
+                      (reftex-citation t)
+                    ;; Multiple citation keys in each argument are allowed.
+                    (TeX-completing-read-multiple
+                     (TeX-argument-prompt optional prompt "Key(s)")
+                     (LaTeX-bibitem-list))))
       (apply 'LaTeX-add-bibitems items)
       ;; If input is empty, insert an empty group only the first time, when
       ;; `noinsert' flag is nil.
       (unless (and (not items) noinsert)
-       (TeX-argument-insert (mapconcat 'identity items ",") optional))
+        (TeX-argument-insert (mapconcat 'identity items ",") optional))
       (setq noinsert t))))
 
 (defun LaTeX-arg-biblatex-natbib-notes (optional)
   "Prompt for two note arguments of a natbib compat citation command."
   (when TeX-arg-cite-note-p
       (let ((pre (TeX-read-string
-                 (TeX-argument-prompt optional nil "Prenote")))
-           (post (TeX-read-string
-                  (TeX-argument-prompt optional nil "Postnote"))))
-       (TeX-argument-insert pre optional)
-       (TeX-argument-insert post optional)
-       ;; pre is given, post is empty: Make sure that we insert an
-       ;; extra pair of `[]', otherwise pre becomes post
-       (when (and pre (not (string= pre ""))
-                  (string= post ""))
-         (insert LaTeX-optop LaTeX-optcl)))))
+                  (TeX-argument-prompt optional nil "Prenote")))
+            (post (TeX-read-string
+                   (TeX-argument-prompt optional nil "Postnote"))))
+        (TeX-argument-insert pre optional)
+        (TeX-argument-insert post optional)
+        ;; pre is given, post is empty: Make sure that we insert an
+        ;; extra pair of `[]', otherwise pre becomes post
+        (when (and pre (not (string= pre ""))
+                   (string= post ""))
+          (insert LaTeX-optop LaTeX-optcl)))))
 
 (TeX-add-style-hook
  "biblatex"
@@ -256,14 +256,14 @@ for citation keys."
    ;; the backend can be overridden by setting `LaTeX-biblatex-use-Biber' as a
    ;; local variable.
    (setq LaTeX-using-Biber
-        (if (local-variable-p 'LaTeX-biblatex-use-Biber (current-buffer))
-            LaTeX-biblatex-use-Biber
-          (not (or (LaTeX-provided-package-options-member
-                    "biblatex" "backend=bibtex")
-                   (LaTeX-provided-package-options-member
-                    "biblatex" "backend=bibtex8")
-                   (LaTeX-provided-package-options-member
-                    "biblatex" "backend=bibtexu")))))
+         (if (local-variable-p 'LaTeX-biblatex-use-Biber (current-buffer))
+             LaTeX-biblatex-use-Biber
+           (not (or (LaTeX-provided-package-options-member
+                     "biblatex" "backend=bibtex")
+                    (LaTeX-provided-package-options-member
+                     "biblatex" "backend=bibtex8")
+                    (LaTeX-provided-package-options-member
+                     "biblatex" "backend=bibtexu")))))
 
    (TeX-run-style-hooks
     "etoolbox"
@@ -277,8 +277,8 @@ for citation keys."
     ;; Setting Package Options
     '("ExecuteBibliographyOptions"
       [TeX-arg-eval  mapconcat 'identity
-                    (TeX-completing-read-multiple
-                     "Entry type: " LaTeX-biblatex-entrytype) ","]
+                     (TeX-completing-read-multiple
+                      "Entry type: " LaTeX-biblatex-entrytype) ","]
       (TeX-arg-key-val LaTeX-biblatex-executebibliographyoptions-options))
     ;;; Bibliography Commands
     ;; Resources
@@ -291,11 +291,11 @@ for citation keys."
     ;; The Bibliography
     '("printbibliography"
       [TeX-arg-key-val (("env") ("heading") ("title") ("prenote") ("postnote")
-                       ("section") ("segment") ("sorting") ("type") ("nottype")
-                       ("subtype") ("notsubtype") ("keyword") ("notkeyword")
-                       ("categoy") ("notcategory") ("filter") ("check")
-                       ("prefixnumbers") ("resetnumbers" ("true" "false"))
-                       ("omitnumbers" ("true" "false")))])
+                        ("section") ("segment") ("sorting") ("type") 
("nottype")
+                        ("subtype") ("notsubtype") ("keyword") ("notkeyword")
+                        ("categoy") ("notcategory") ("filter") ("check")
+                        ("prefixnumbers") ("resetnumbers" ("true" "false"))
+                        ("omitnumbers" ("true" "false")))])
     '("bibbysection"
       [TeX-arg-key-val (("env") ("heading") ("prenote") ("postnote"))])
     '("bibbysegment"
@@ -307,9 +307,9 @@ for citation keys."
     ;; The List of Shorthands
     '("printshorthands"
       [TeX-arg-key-val (("env") ("heading") ("title") ("prenote") ("postnote")
-                       ("section") ("segment") ("sorting") ("type") ("nottype")
-                       ("subtype") ("notsubtype") ("keyword") ("notkeyword")
-                       ("categoy") ("notcategory") ("filter") ("check"))])
+                        ("section") ("segment") ("sorting") ("type") 
("nottype")
+                        ("subtype") ("notsubtype") ("keyword") ("notkeyword")
+                        ("categoy") ("notcategory") ("filter") ("check"))])
     ;; Bibliography Sections
     '("newrefsection" ["Resources"])
     "endrefsection"
@@ -330,35 +330,35 @@ for citation keys."
     ;; Dynamic Entry Sets
     '("defbibentryset" "Set"
       (TeX-arg-eval mapconcat 'identity (TeX-completing-read-multiple
-                                        "Keys: " (LaTeX-bibitem-list)) ","))
+                                         "Keys: " (LaTeX-bibitem-list)) ","))
     ;;; Citation Commands
     '("cite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                 (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
+                                  (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
     '("Cite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                 (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
+                                  (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
     '("parencite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("Parencite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("footcite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                     (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("footcitetext" (TeX-arg-conditional TeX-arg-cite-note-p
-                                         (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                          (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     ;; Style-specific Commands
     '("textcite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                     (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("Textcite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                     (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("smartcite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("Smartcite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("cite*" (TeX-arg-conditional TeX-arg-cite-note-p
-                                  (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
+                                   (["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
     '("parencite*" (TeX-arg-conditional TeX-arg-cite-note-p
-                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                        (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("supercite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     ;; Qualified Citation Lists
     '("cites" LaTeX-arg-biblatex-cites)
     '("Cites" LaTeX-arg-biblatex-cites)
@@ -373,45 +373,45 @@ for citation keys."
     '("supercites" LaTeX-arg-biblatex-cites)
     ;; Style-independent Commands
     '("autocite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                     (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("Autocite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                     (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("autocite*" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("Autocite*" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("autocites" LaTeX-arg-biblatex-cites)
     '("Autocites" LaTeX-arg-biblatex-cites)
     ;; Text Commands
     '("citeauthor" (TeX-arg-conditional TeX-arg-cite-note-p
-                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                        (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("Citeauthor" (TeX-arg-conditional TeX-arg-cite-note-p
-                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                        (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("citeauthor*" (TeX-arg-conditional TeX-arg-cite-note-p
-                                        (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                         (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("Citeauthor*" (TeX-arg-conditional TeX-arg-cite-note-p
-                                        (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                         (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("citetitle" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("citetitle*" (TeX-arg-conditional TeX-arg-cite-note-p
-                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                        (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("citeyear" (TeX-arg-conditional TeX-arg-cite-note-p
-                                     (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("citeyear*" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("citedate" (TeX-arg-conditional TeX-arg-cite-note-p
-                                     (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("citedate*" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("citeurl" (TeX-arg-conditional TeX-arg-cite-note-p
-                                    (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                     (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("parentext" "Text")
     '("brackettext" "Text")
     ;; Special Commands
     '("fullcite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                     (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("footfullcite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                         (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                          (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("volcite"
       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
       (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
@@ -449,15 +449,15 @@ for citation keys."
       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
       (TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
     '("notecite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                     (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("Notecite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                     (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("pnotecite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("Pnotecite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     '("fnotecite" (TeX-arg-conditional TeX-arg-cite-note-p
-                                      (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
+                                       (["Prenote"] ["Postnote"]) ()) 
TeX-arg-cite)
     ;; Low-level Commands
     '("citename"
       (TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"] ["Postnote"]) ())
@@ -495,49 +495,49 @@ for citation keys."
 
    ;; § 3.8.9 natbib Compatibility Commands
    (when (or (LaTeX-provided-package-options-member "biblatex" "natbib")
-            (LaTeX-provided-package-options-member "biblatex" "natbib=true"))
+             (LaTeX-provided-package-options-member "biblatex" "natbib=true"))
      (let ((cmds '(("citet" . 1) ("citet*" . 1)
-                  ("Citet" . 1) ("Citet*" . 1)
-                  ("citep" . 2) ("citep*" . 2)
-                  ("Citep" . 2) ("Citep*" . 2)
-                  ("citealt" . 1) ("citealt*" . 1)
-                  ("Citealt" . 1) ("Citealt*" . 1)
-                  ("citealp" . 2) ("citealp*" . 2)
-                  ("Citealp" . 2) ("Citealp*" . 2))))
+                   ("Citet" . 1) ("Citet*" . 1)
+                   ("citep" . 2) ("citep*" . 2)
+                   ("Citep" . 2) ("Citep*" . 2)
+                   ("citealt" . 1) ("citealt*" . 1)
+                   ("Citealt" . 1) ("Citealt*" . 1)
+                   ("citealp" . 2) ("citealp*" . 2)
+                   ("Citealp" . 2) ("Citealp*" . 2))))
        ;; Taken from natbib.el:
        (apply
-       #'TeX-add-symbols
-       (mapcar
-        (lambda (cmd)
-          (cond
-           ((= (cdr cmd) 1)
-            ;; Just one optional argument, the post note
-            (list
-             (car cmd)
-             '(TeX-arg-conditional TeX-arg-cite-note-p (["Postnote"]) nil)
-             'TeX-arg-cite))
-           ((= (cdr cmd) 2)
-            ;; Pre and post notes
-            (list
-             (car cmd)
-             '(TeX-arg-conditional TeX-arg-cite-note-p
-                                   ([LaTeX-arg-biblatex-natbib-notes])
-                                 nil)
-             'TeX-arg-cite))))
-        cmds))
+        #'TeX-add-symbols
+        (mapcar
+         (lambda (cmd)
+           (cond
+            ((= (cdr cmd) 1)
+             ;; Just one optional argument, the post note
+             (list
+              (car cmd)
+              '(TeX-arg-conditional TeX-arg-cite-note-p (["Postnote"]) nil)
+              'TeX-arg-cite))
+            ((= (cdr cmd) 2)
+             ;; Pre and post notes
+             (list
+              (car cmd)
+              '(TeX-arg-conditional TeX-arg-cite-note-p
+                                    ([LaTeX-arg-biblatex-natbib-notes])
+                                  nil)
+              'TeX-arg-cite))))
+         cmds))
 
      ;; Fontification for compat macros does not go into `font-latex.el':
      (when (and (featurep 'font-latex)
-               (eq TeX-install-font-lock 'font-latex-setup))
+                (eq TeX-install-font-lock 'font-latex-setup))
        (font-latex-add-keywords '(("citet"        "*[[{")
-                                 ("Citet"        "*[[{")
-                                 ("citep"        "*[[{")
-                                 ("Citep"        "*[[{")
-                                 ("citealt"      "*[[{")
-                                 ("Citealt"      "*[[{")
-                                 ("citealp"      "*[[{")
-                                 ("Citealp"      "*[[{"))
-                               'biblatex))))
+                                  ("Citet"        "*[[{")
+                                  ("citep"        "*[[{")
+                                  ("Citep"        "*[[{")
+                                  ("citealt"      "*[[{")
+                                  ("Citealt"      "*[[{")
+                                  ("citealp"      "*[[{")
+                                  ("Citealp"      "*[[{"))
+                                'biblatex))))
 
    (LaTeX-add-environments
     ;;; Bibliography commands
@@ -566,34 +566,34 @@ for citation keys."
    ;; Tell RefTeX: If package option `natbib' is given, activate that
    ;; format, otherwise stick with `biblatex':
    (when (and LaTeX-reftex-cite-format-auto-activate
-             (fboundp 'reftex-set-cite-format))
+              (fboundp 'reftex-set-cite-format))
      (if (or (LaTeX-provided-package-options-member "biblatex" "natbib")
-            (LaTeX-provided-package-options-member "biblatex" "natbib=true"))
-        (reftex-set-cite-format 'natbib)
+             (LaTeX-provided-package-options-member "biblatex" "natbib=true"))
+         (reftex-set-cite-format 'natbib)
        ;; The entry `biblatex' is defined in
        ;; `reftex-cite-format-builtin' in reftex-vars.el which will be
        ;; part of Emacs >= 25.3.  So check here if we find an entry,
        ;; otherwise do it manually for older Emacsen.
        (if (assoc 'biblatex reftex-cite-format-builtin)
-          (reftex-set-cite-format 'biblatex)
-        (reftex-set-cite-format
-         '((?\C-m . "\\cite[][]{%l}")
-           (?C    . "\\cite*[][]{%l}")
-           (?t    . "\\textcite[][]{%l}")
-           (?T    . "\\textcite*[][]{%l}")
-           (?p    . "\\parencite[][]{%l}")
-           (?P    . "\\parencite*[][]{%l}")
-           (?f    . "\\footcite[][]{%l}")
-           (?s    . "\\smartcite[][]{%l}")
-           (?u    . "\\autocite[][]{%l}")
-           (?U    . "\\autocite*[][]{%l}")
-           (?a    . "\\citeauthor{%l}")
-           (?A    . "\\citeauthor*{%l}")
-           (?i    . "\\citetitle{%l}")
-           (?I    . "\\citetitle*{%l}")
-           (?y    . "\\citeyear{%l}")
-           (?Y    . "\\citeyear*{%l}")
-           (?n    . "\\nocite{%l}")))))))
+           (reftex-set-cite-format 'biblatex)
+         (reftex-set-cite-format
+          '((?\C-m . "\\cite[][]{%l}")
+            (?C    . "\\cite*[][]{%l}")
+            (?t    . "\\textcite[][]{%l}")
+            (?T    . "\\textcite*[][]{%l}")
+            (?p    . "\\parencite[][]{%l}")
+            (?P    . "\\parencite*[][]{%l}")
+            (?f    . "\\footcite[][]{%l}")
+            (?s    . "\\smartcite[][]{%l}")
+            (?u    . "\\autocite[][]{%l}")
+            (?U    . "\\autocite*[][]{%l}")
+            (?a    . "\\citeauthor{%l}")
+            (?A    . "\\citeauthor*{%l}")
+            (?i    . "\\citetitle{%l}")
+            (?I    . "\\citetitle*{%l}")
+            (?y    . "\\citeyear{%l}")
+            (?Y    . "\\citeyear*{%l}")
+            (?n    . "\\nocite{%l}")))))))
  TeX-dialect)
 
 (defvar LaTeX-biblatex-package-options-list
@@ -623,24 +623,24 @@ for citation keys."
   "Prompt for package options for the biblatex package."
   (unless BibLaTeX-global-style-files
     (if (if (eq TeX-arg-input-file-search 'ask)
-           (not (y-or-n-p "Find BibLaTeX style yourself? "))
-         TeX-arg-input-file-search)
-       ;; ...then, search for BibLaTeX styles.
-       (progn
-         (message "Searching for BibLaTeX styles...")
-         (setq BibLaTeX-global-style-files
-               (TeX-search-files-by-type 'bbxinputs 'global t t))
-         (message "Searching for BibLaTeX styles...done"))
+            (not (y-or-n-p "Find BibLaTeX style yourself? "))
+          TeX-arg-input-file-search)
+        ;; ...then, search for BibLaTeX styles.
+        (progn
+          (message "Searching for BibLaTeX styles...")
+          (setq BibLaTeX-global-style-files
+                (TeX-search-files-by-type 'bbxinputs 'global t t))
+          (message "Searching for BibLaTeX styles...done"))
       ;; ...else, use for completion only standard BibLaTeX styles (see §3.3 of
       ;; Biblatex reference manual).
       (setq BibLaTeX-global-style-files
-           '("numeric" "numeric-comp" "numeric-verb" "alphabetic"
-             "alphabetic-verb" "authoryear" "authoryear-comp" "authoryear-ibid"
-             "authoryear-icomp" "authortitle" "authortitle-comp"
-             "authortitle-ibid" "authortitle-icomp" "authortitle-terse"
-             "authortitle-tcomp" "authortitle-ticomp" "verbose" "verbose-ibid"
-             "verbose-note" "verbose-inote" "verbose-trad1" "verbose-trad2"
-             "verbose-trad3" "reading" "draft" "debug"))))
+            '("numeric" "numeric-comp" "numeric-verb" "alphabetic"
+              "alphabetic-verb" "authoryear" "authoryear-comp" 
"authoryear-ibid"
+              "authoryear-icomp" "authortitle" "authortitle-comp"
+              "authortitle-ibid" "authortitle-icomp" "authortitle-terse"
+              "authortitle-tcomp" "authortitle-ticomp" "verbose" "verbose-ibid"
+              "verbose-note" "verbose-inote" "verbose-trad1" "verbose-trad2"
+              "verbose-trad3" "reading" "draft" "debug"))))
   (TeX-read-key-val t LaTeX-biblatex-package-options-list))
 
 ;;; biblatex.el ends here
diff --git a/style/bicaption.el b/style/bicaption.el
index 0918b56..b8d6cb7 100644
--- a/style/bicaption.el
+++ b/style/bicaption.el
@@ -39,8 +39,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (declare-function LaTeX-babel-active-languages "babel" ())
 (declare-function LaTeX-polyglossia-active-languages "polyglossia" ())
@@ -68,35 +68,35 @@ arguments."
   ;; \bicaptionbox[<list entry #1>]{<heading #1>}[<list entry #2>]{<heading 
#2>}
   ;;              [<width>][<inner-pos>]{<contents>}
   (let* (;; \bisubcaption needs an environment, "minipage" will be
-        ;; popular.  If so, check next higher environment to find out
-        ;; where we are
-        (currenv (if (string= (LaTeX-current-environment) "minipage")
-                     (LaTeX-current-environment 2)
-                   (LaTeX-current-environment)))
-        (captionI (TeX-read-string
-                   (TeX-argument-prompt
-                    optional (when prompt
-                               (concat "1. " prompt "bicaption"))
-                    "1. bicaption")))
-        (short-captionI
-         (when (and (not star)
-                    (>= (length captionI) LaTeX-short-caption-prompt-length))
-           (TeX-read-string
-            (TeX-argument-prompt t (when prompt
-                                     (concat "Short 1. " prompt "bicaption"))
-                                 "Short 1. bicaption"))))
-        (captionII (TeX-read-string
-                    (TeX-argument-prompt
-                     optional (when prompt
-                                (concat "2. " prompt "bicaption"))
-                     "2. bicaption")))
-        (short-captionII
-         (when (and (not star)
-                    (>= (length captionII) LaTeX-short-caption-prompt-length))
-           (TeX-read-string
-            (TeX-argument-prompt t (when prompt
-                                     (concat "Short 2. " prompt "bicaption"))
-                                 "Short 2. bicaption")))))
+         ;; popular.  If so, check next higher environment to find out
+         ;; where we are
+         (currenv (if (string= (LaTeX-current-environment) "minipage")
+                      (LaTeX-current-environment 2)
+                    (LaTeX-current-environment)))
+         (captionI (TeX-read-string
+                    (TeX-argument-prompt
+                     optional (when prompt
+                                (concat "1. " prompt "bicaption"))
+                     "1. bicaption")))
+         (short-captionI
+          (when (and (not star)
+                     (>= (length captionI) LaTeX-short-caption-prompt-length))
+            (TeX-read-string
+             (TeX-argument-prompt t (when prompt
+                                      (concat "Short 1. " prompt "bicaption"))
+                                  "Short 1. bicaption"))))
+         (captionII (TeX-read-string
+                     (TeX-argument-prompt
+                      optional (when prompt
+                                 (concat "2. " prompt "bicaption"))
+                      "2. bicaption")))
+         (short-captionII
+          (when (and (not star)
+                     (>= (length captionII) LaTeX-short-caption-prompt-length))
+            (TeX-read-string
+             (TeX-argument-prompt t (when prompt
+                                      (concat "Short 2. " prompt "bicaption"))
+                                  "Short 2. bicaption")))))
     (indent-according-to-mode)
     ;; Insert short & regular 1. caption
     (when (and short-captionI (not (string= short-captionI "")))
@@ -116,25 +116,25 @@ arguments."
     ;; Insert width & pos in case of captionbox macros:
     (when cap-box
       (let* ((TeX-arg-opening-brace "[")
-            (TeX-arg-closing-brace "]")
-            (TeX-last-optional-rejected nil)
-            (width (LaTeX-check-insert-macro-default-style
-                    (completing-read (TeX-argument-prompt t nil "Width")
-                                     (mapcar (lambda (elt) (concat TeX-esc 
(car elt)))
-                                             (LaTeX-length-list)))))
-            (TeX-last-optional-rejected (or (not width)
-                                            (and width (string= width ""))))
-            (inpos (LaTeX-check-insert-macro-default-style
-                    (if (and width (not (string-equal width "")))
-                        (completing-read (TeX-argument-prompt t nil "Inner 
position")
-                                         '("c" "l" "r" "s"))
-                      ""))))
-       (and width (TeX-argument-insert width t))
-       (and inpos (TeX-argument-insert inpos t))))
+             (TeX-arg-closing-brace "]")
+             (TeX-last-optional-rejected nil)
+             (width (LaTeX-check-insert-macro-default-style
+                     (completing-read (TeX-argument-prompt t nil "Width")
+                                      (mapcar (lambda (elt) (concat TeX-esc 
(car elt)))
+                                              (LaTeX-length-list)))))
+             (TeX-last-optional-rejected (or (not width)
+                                             (and width (string= width ""))))
+             (inpos (LaTeX-check-insert-macro-default-style
+                     (if (and width (not (string-equal width "")))
+                         (completing-read (TeX-argument-prompt t nil "Inner 
position")
+                                          '("c" "l" "r" "s"))
+                       ""))))
+        (and width (TeX-argument-insert width t))
+        (and inpos (TeX-argument-insert inpos t))))
     (LaTeX-fill-paragraph)
     ;; Insert label -- a new line is inserted only if label is there:
     (when (and (not label-inside) (not star)
-              (save-excursion (LaTeX-label currenv 'environment)))
+               (save-excursion (LaTeX-label currenv 'environment)))
       (LaTeX-newline)
       (indent-according-to-mode)
       (end-of-line))))
@@ -144,14 +144,14 @@ arguments."
 When OPTIONAL is non-nil, include both as optional arguments in
 square brackets."
   (let* ((flttype (completing-read (TeX-argument-prompt optional nil "Float 
type")
-                                 LaTeX-caption-supported-float-types))
-        (biflt (if (and (not (or (string= flttype "bi")
-                                 (string= flttype "bi-first")
-                                 (string= flttype "bi-second")))
-                        flttype (not (string= flttype "")))
-                   (completing-read (TeX-argument-prompt optional nil 
"Bicaption type")
-                                    '("bi" "bi-first" "bi-second"))
-                 "")))
+                                  LaTeX-caption-supported-float-types))
+         (biflt (if (and (not (or (string= flttype "bi")
+                                  (string= flttype "bi-first")
+                                  (string= flttype "bi-second")))
+                         flttype (not (string= flttype "")))
+                    (completing-read (TeX-argument-prompt optional nil 
"Bicaption type")
+                                     '("bi" "bi-first" "bi-second"))
+                  "")))
     (TeX-argument-insert flttype optional)
     (TeX-argument-insert biflt optional)))
 
@@ -175,32 +175,32 @@ square brackets."
 
    ;; \bi(sub)?caption(box)? macros should get their own lines
    (LaTeX-paragraph-commands-add-locally '("bicaption"    "bicaptionbox"
-                                          "bisubcaption" "bisubcaptionbox"))
+                                           "bisubcaption" "bisubcaptionbox"))
 
    ;; Fontification
    (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
+              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("bicaption"       "*[{[{")
-                               ("bicaptionbox"    "*[{[{[[")
-                               ("bisubcaption"    "*[{[{")
-                               ("bisubcaptionbox" "*[{[{[["))
-                             'textual)))
+                                ("bicaptionbox"    "*[{[{[[")
+                                ("bisubcaption"    "*[{[{")
+                                ("bisubcaptionbox" "*[{[{[["))
+                              'textual)))
  TeX-dialect)
 
 (defun LaTeX-bicaption-package-options ()
   "Prompt for package options for the bicaption package."
   (TeX-load-style "caption")
   (TeX-read-key-val t
-                   (append
-                    `(,(list "language"
-                             (cond ((and (member "babel" (TeX-style-list))
-                                         (LaTeX-babel-active-languages))
-                                    (butlast (LaTeX-babel-active-languages)))
-                                   ((and (member "polyglossia" 
(TeX-style-list))
-                                         (LaTeX-polyglossia-active-languages))
-                                    (butlast (LaTeX-babel-active-languages)))
-                                   (t nil))))
-                    LaTeX-bicaption-key-val-options
-                    LaTeX-caption-key-val-options)))
+                    (append
+                     `(,(list "language"
+                              (cond ((and (member "babel" (TeX-style-list))
+                                          (LaTeX-babel-active-languages))
+                                     (butlast (LaTeX-babel-active-languages)))
+                                    ((and (member "polyglossia" 
(TeX-style-list))
+                                          (LaTeX-polyglossia-active-languages))
+                                     (butlast (LaTeX-babel-active-languages)))
+                                    (t nil))))
+                     LaTeX-bicaption-key-val-options
+                     LaTeX-caption-key-val-options)))
 
 ;;; bicaption.el ends here
diff --git a/style/bidi.el b/style/bidi.el
index 287bbfd..6f1f0b3 100644
--- a/style/bidi.el
+++ b/style/bidi.el
@@ -34,8 +34,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 (declare-function TeX-check-engine-add-engines
                   "tex-buf"
                   (&rest engines))
@@ -176,25 +176,25 @@
 
    ;; Fontification
    (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
+              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("LR"        "{")
-                               ("LRE"       "{")
-                               ("RLE"       "{")
-                               ("RL"        "{")
-                               ("LTRthanks" "{")
-                               ("RTLthanks" "{"))
-                             'textual)
+                                ("LRE"       "{")
+                                ("RLE"       "{")
+                                ("RL"        "{")
+                                ("LTRthanks" "{")
+                                ("RTLthanks" "{"))
+                              'textual)
      (font-latex-add-keywords '(("LTRfootnote"     "[{")
-                               ("RTLfootnote"     "[{")
-                               ("LTRfootnotetext" "[{")
-                               ("RTLfootnotetext" "[{")
-                               ("LTRmarginpar"    "[{")
-                               ("RTLmarginpar"    "[{"))
-                             'reference)
+                                ("RTLfootnote"     "[{")
+                                ("LTRfootnotetext" "[{")
+                                ("RTLfootnotetext" "[{")
+                                ("LTRmarginpar"    "[{")
+                                ("RTLmarginpar"    "[{"))
+                              'reference)
      (font-latex-add-keywords '(("XeTeX"   "")
-                               ("XeLaTeX" "")
-                               ("SepMark" "{"))
-                             'function)))
+                                ("XeLaTeX" "")
+                                ("SepMark" "{"))
+                              'function)))
  TeX-dialect)
 
 ;;; bidi.el ends here
diff --git a/style/bm.el b/style/bm.el
index 5ded3ac..7b9cd11 100644
--- a/style/bm.el
+++ b/style/bm.el
@@ -33,28 +33,28 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (TeX-add-style-hook "bm"
- (lambda ()
-   (TeX-add-symbols
-    '("bm" 1)
-    '("hm" 1)
-    '("DeclareBoldMathCommand" [ "Math version" ] TeX-arg-define-macro "Math 
expression")
-    '("bmdefine" TeX-arg-define-macro "Math expression")
-    '("hmdefine" TeX-arg-define-macro "Math expression"))
-   ;; Fontification
-   (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
-     (font-latex-add-keywords '(("bm" "{")
-                               ("hm" "{"))
-                             'bold-command)
-     (font-latex-add-keywords '(("DeclareBoldMathCommand" "[|{\\{")
-                               ("bmdefine" "|{\\{")
-                               ("hmdefine" "|{\\{"))
-                             'function)))
- TeX-dialect)
+                    (lambda ()
+                      (TeX-add-symbols
+                       '("bm" 1)
+                       '("hm" 1)
+                       '("DeclareBoldMathCommand" [ "Math version" ] 
TeX-arg-define-macro "Math expression")
+                       '("bmdefine" TeX-arg-define-macro "Math expression")
+                       '("hmdefine" TeX-arg-define-macro "Math expression"))
+                      ;; Fontification
+                      (when (and (featurep 'font-latex)
+                                 (eq TeX-install-font-lock 'font-latex-setup))
+                        (font-latex-add-keywords '(("bm" "{")
+                                                   ("hm" "{"))
+                                                 'bold-command)
+                        (font-latex-add-keywords '(("DeclareBoldMathCommand" 
"[|{\\{")
+                                                   ("bmdefine" "|{\\{")
+                                                   ("hmdefine" "|{\\{"))
+                                                 'function)))
+                    TeX-dialect)
 
 (defvar LaTeX-bm-package-options nil
   "Package options for the bm package.")
diff --git a/style/book.el b/style/book.el
index cdc754a..4a23d25 100644
--- a/style/book.el
+++ b/style/book.el
@@ -17,7 +17,7 @@
  (lambda ()
    (LaTeX-largest-level-set "part")
    (LaTeX-add-counters "part" "chapter" "section" "subsection" "subsubsection"
-                      "paragraph" "subparagraph" "figure" "table")
+                       "paragraph" "subparagraph" "figure" "table")
    (LaTeX-add-pagestyles "headings" "myheadings"))
  TeX-dialect)
 
diff --git a/style/booktabs.el b/style/booktabs.el
index 7abecc1..7de74b6 100644
--- a/style/booktabs.el
+++ b/style/booktabs.el
@@ -34,15 +34,15 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (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-arg-opening-brace "\(")
-       (TeX-arg-closing-brace "\)"))
+        (TeX-arg-closing-brace "\)"))
     (TeX-parse-argument optional prompt)))
 
 (TeX-add-style-hook
@@ -51,9 +51,9 @@ PROMPT is the value of the prompt to be shown."
    ;; Do not append an empty group to toprule, midrule, and bottomrule macros,
    ;; otherwise one gets a wrong spacing in the table.
    (setq TeX-insert-braces-alist (append TeX-insert-braces-alist
-                                        '(("toprule" . nil)
-                                          ("midrule" . nil)
-                                          ("bottomrule" . nil))))
+                                         '(("toprule" . nil)
+                                           ("midrule" . nil)
+                                           ("bottomrule" . nil))))
    ;; New symbols
    (TeX-add-symbols
     '("toprule" [ "Thickness" ])
@@ -69,15 +69,15 @@ PROMPT is the value of the prompt to be shown."
 
    ;; Fontification
    (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
+              (eq TeX-install-font-lock 'font-latex-setup))
      (font-latex-add-keywords '(("toprule" "[")
-                               ("midrule" "[")
-                               ("bottomrule" "[")
-                               ("cmidrule" "[({")
-                               ("addlinespace" "[")
-                               ("morecmidrules" "")
-                               ("specialrule" "{{{"))
-                             'function)))
+                                ("midrule" "[")
+                                ("bottomrule" "[")
+                                ("cmidrule" "[({")
+                                ("addlinespace" "[")
+                                ("morecmidrules" "")
+                                ("specialrule" "{{{"))
+                              'function)))
  TeX-dialect)
 
 (defvar LaTeX-booktabs-package-options nil
diff --git a/style/breqn.el b/style/breqn.el
index b5d4138..0352055 100644
--- a/style/breqn.el
+++ b/style/breqn.el
@@ -52,8 +52,8 @@
 
 (defvar LaTeX-breqn-key-val-options
   '(("style" ("\\tiny" "\\scriptsize" "\\footnotesize" "\\small"
-             "\\normalsize" "\\large" "\\Large" "\\LARGE"
-             "\\huge" "\\Huge"))
+              "\\normalsize" "\\large" "\\Large" "\\LARGE"
+              "\\huge" "\\Huge"))
     ("number")
     ("indentstep")
     ("compact")
@@ -78,19 +78,19 @@ The keys \"label\" and \"labelprefix\" are omitted.")
 Keys offered for key=val query depend on ENV.  \"label\" and
 \"labelprefix\" are omitted."
   (let ((keyvals
-        (TeX-read-key-val t
-                          (cond ((or (string= env "dgroup")
-                                     (string= env "dgroup*"))
-                                 (append '(("noalign") ("brace"))
-                                         LaTeX-breqn-key-val-options))
-                                ((or (string= env "darray")
-                                     (string= env "darray*"))
-                                 (append '(("noalign") ("brace") ("cols" 
("{}")))
-                                         LaTeX-breqn-key-val-options))
-                                (t LaTeX-breqn-key-val-options)))))
+         (TeX-read-key-val t
+                           (cond ((or (string= env "dgroup")
+                                      (string= env "dgroup*"))
+                                  (append '(("noalign") ("brace"))
+                                          LaTeX-breqn-key-val-options))
+                                 ((or (string= env "darray")
+                                      (string= env "darray*"))
+                                  (append '(("noalign") ("brace") ("cols" 
("{}")))
+                                          LaTeX-breqn-key-val-options))
+                                 (t LaTeX-breqn-key-val-options)))))
     (LaTeX-insert-environment env (when (and keyvals
-                                            (not (string= keyvals "")))
-                                   (concat LaTeX-optop keyvals LaTeX-optcl)))
+                                             (not (string= keyvals "")))
+                                    (concat LaTeX-optop keyvals LaTeX-optcl)))
     (LaTeX-env-label-as-keyval nil nil keyvals env)))
 
 (add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
diff --git a/style/bulgarian.el b/style/bulgarian.el
index c7437db..d571a5f 100644
--- a/style/bulgarian.el
+++ b/style/bulgarian.el
@@ -36,8 +36,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-quotes
-                 "font-latex"
-                 (quotes))
+                  "font-latex"
+                  (quotes))
 
 (defvar LaTeX-bulgarian-mode-syntax-table
   (copy-syntax-table LaTeX-mode-syntax-table)
@@ -51,7 +51,7 @@
    (set-syntax-table LaTeX-bulgarian-mode-syntax-table)
    (unless (eq (car TeX-quote-language) 'override)
      (setq TeX-quote-language
-          `("bulgarian" "\"`" "\"'" ,TeX-quote-after-quote)))
+           `("bulgarian" "\"`" "\"'" ,TeX-quote-after-quote)))
    (setq LaTeX-babel-hyphen-language "bulgarian")
    ;; Fontification of quotation marks.
    (when (fboundp 'font-latex-add-quotes)
diff --git a/style/captcont.el b/style/captcont.el
index d68babd..5bf1ba1 100644
--- a/style/captcont.el
+++ b/style/captcont.el
@@ -33,8 +33,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (TeX-add-style-hook
  "captcont"
@@ -48,7 +48,7 @@
  TeX-dialect)
 
 (defvar LaTeX-captcont-package-options '("figbotcap" "figtopcap" "tabbotcap"
-                                        "tabtopcap")
+                                         "tabtopcap")
   "Package options for the captcont package.")
 
 ;;; captcont.el ends here
diff --git a/style/caption.el b/style/caption.el
index 19c225d..346b84d 100644
--- a/style/caption.el
+++ b/style/caption.el
@@ -45,8 +45,8 @@
 
 ;; Silence the compiler:
 (declare-function font-latex-add-keywords
-                 "font-latex"
-                 (keywords class))
+                  "font-latex"
+                  (keywords class))
 
 (declare-function LaTeX-babel-active-languages "babel" ())
 (declare-function LaTeX-polyglossia-active-languages "polyglossia" ())
@@ -57,30 +57,30 @@
   '(("aboveskip")
     ("belowskip")
     ("font"   ("scriptsize" "footnotesize" "small" "normalsize" "large"
-              "Large" "normalfont" "up" "it" "sl" "sc" "md" "bf" "rm"
-              "sf" "tt" "singlespacing" "onehalfspacing" "doublespacing"
-              "stretch" "normalcolor" "color" "normal"))
+               "Large" "normalfont" "up" "it" "sl" "sc" "md" "bf" "rm"
+               "sf" "tt" "singlespacing" "onehalfspacing" "doublespacing"
+               "stretch" "normalcolor" "color" "normal"))
     ("font+"  ("scriptsize" "footnotesize" "small" "normalsize" "large"
-              "Large" "normalfont" "up" "it" "sl" "sc" "md" "bf" "rm"
-              "sf" "tt" "singlespacing" "onehalfspacing" "doublespacing"
-              "stretch" "normalcolor" "color" "normal"))
+               "Large" "normalfont" "up" "it" "sl" "sc" "md" "bf" "rm"
+               "sf" "tt" "singlespacing" "onehalfspacing" "doublespacing"
+               "stretch" "normalcolor" "color" "normal"))
     ("format" ("plain" "hang"))
     ("hangindent")
     ("hypcap" ("false" "no" "off" "0" "true" "yes" "on" "1"))
     ("hypcapspace")
     ("indention")
     ("justification" ("justified" "centering" "centerlast" "centerfirst"
-                     "raggedright" "RaggedRight" "raggedleft"))
+                      "raggedright" "RaggedRight" "raggedleft"))
     ("labelfont"     ("scriptsize" "footnotesize" "small" "normalsize" "large"
-                     "Large" "normalfont" "up" "it" "sl" "sc" "md" "bf" "rm"
-                     "sf" "tt" "singlespacing" "onehalfspacing" "doublespacing"
-                     "stretch" "normalcolor" "color" "normal"))
+                      "Large" "normalfont" "up" "it" "sl" "sc" "md" "bf" "rm"
+                      "sf" "tt" "singlespacing" "onehalfspacing" 
"doublespacing"
+                      "stretch" "normalcolor" "color" "normal"))
     ("labelfont+"    ("scriptsize" "footnotesize" "small" "normalsize" "large"
-                     "Large" "normalfont" "up" "it" "sl" "sc" "md" "bf" "rm"
-                     "sf" "tt" "singlespacing" "onehalfspacing" "doublespacing"
-                     "stretch" "normalcolor" "color" "normal"))
+                      "Large" "normalfont" "up" "it" "sl" "sc" "md" "bf" "rm"
+                      "sf" "tt" "singlespacing" "onehalfspacing" 
"doublespacing"
+                      "stretch" "normalcolor" "color" "normal"))
     ("labelformat"   ("default" "empty" "simple" "brace" "parens"
-                     "autodot" "unnumbered"))
+                      "autodot" "unnumbered"))
     ("labelsep"      ("none" "colon" "period" "space" "quad" "newline" 
"endash"))
     ("list"          ("false" "no" "off" "0" "true" "yes" "on" "1"))
     ("listformat"    ("empty" "simple" "paren" "subsimple" "subparens"))
@@ -99,13 +99,13 @@
     ("strut"      ("false" "no" "off" "0" "true" "yes" "on" "1"))
     ("style"      ("base" "default"))
     ("textfont"   ("scriptsize" "footnotesize" "small" "normalsize" "large"
-                  "Large" "normalfont" "up" "it" "sl" "sc" "md" "bf" "rm"
-                  "sf" "tt" "singlespacing" "onehalfspacing" "doublespacing"
-                  "stretch" "normalcolor" "color" "normal"))
+                   "Large" "normalfont" "up" "it" "sl" "sc" "md" "bf" "rm"
+                   "sf" "tt" "singlespacing" "onehalfspacing" "doublespacing"
+                   "stretch" "normalcolor" "color" "normal"))
     ("textfont+"  ("scriptsize" "footnotesize" "small" "normalsize" "large"
-                  "Large" "normalfont" "up" "it" "sl" "sc" "md" "bf" "rm"
-                  "sf" "tt" "singlespacing" "onehalfspacing" "doublespacing"
-                  "stretch" "normalcolor" "color" "normal"))
+                   "Large" "normal