AUCTeX Sync -- New Style Files
[packages] / xemacs-packages / auctex / style / preview.el
1 ;;; preview.el --- AUCTeX style for `preview.sty' (v2010/02/14)
2
3 ;; Copyright (C) 2017 Free Software Foundation, Inc.
4
5 ;; Author: Arash Esbati <arash@gnu.org>
6 ;; Maintainer: auctex-devel@gnu.org
7 ;; Created: 2017-02-05
8 ;; Keywords: tex
9
10 ;; This file is part of AUCTeX.
11
12 ;; AUCTeX is free software; you can redistribute it and/or modify it
13 ;; under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 3, or (at your option)
15 ;; any later version.
16
17 ;; AUCTeX is distributed in the hope that it will be useful, but
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20 ;; General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with AUCTeX; see the file COPYING.  If not, write to the Free
24 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
25 ;; 02110-1301, USA.
26
27 ;;; Commentary:
28
29 ;; This file adds support for `preview.sty' v2010/02/14.
30 ;; `preview.sty' is part of TeXLive.
31
32 ;;; Code:
33
34 (defun LaTeX-preview-arg-ifpreview (_optional)
35   "Insert \\else and \\fi part of \\ifPreview command from preview.sty.
36 OPTIONAL is ignored."
37   (indent-according-to-mode)
38   (LaTeX-newline)
39   (indent-according-to-mode)
40   (save-excursion
41     (LaTeX-newline)
42     (indent-according-to-mode)
43     (insert TeX-esc "else")
44     (LaTeX-newline)
45     (LaTeX-newline)
46     (indent-according-to-mode)
47     (insert TeX-esc "fi")))
48
49 (TeX-add-style-hook
50  "preview"
51  (lambda ()
52
53    (LaTeX-add-environments
54     '("preview")
55     '("nopreview"))
56
57    (TeX-add-symbols
58     '("PreviewMacro" (TeX-arg-conditional (y-or-n-p "With optional arguments? ")
59                                           ( [ t ] [ nil ] )
60                                         ())
61       TeX-arg-macro)
62
63     '("PreviewMacro*" (TeX-arg-conditional (y-or-n-p "With optional arguments? ")
64                                            ( [ t ] [ nil ] )
65                                          ())
66       TeX-arg-macro)
67
68     '("PreviewEnvironment" (TeX-arg-conditional (y-or-n-p "With optional arguments? ")
69                                                 ( [ t ] [ nil ] )
70                                               ())
71       TeX-arg-environment)
72
73     '("PreviewEnvironment*" (TeX-arg-conditional (y-or-n-p "With optional arguments? ")
74                                                  ( [ t ] [ nil ] )
75                                                ())
76       TeX-arg-environment)
77
78     '("PreviewSnarfEnvironment" TeX-arg-environment)
79
80     '("PreviewOpen")
81     '("PreviewClose")
82
83     '("ifPreview" LaTeX-preview-arg-ifpreview))
84
85    ;; Fontification
86    (when (and (featurep 'font-latex)
87               (eq TeX-install-font-lock 'font-latex-setup))
88      (font-latex-add-keywords '(("PreviewMacro"            "*[[{")
89                                 ("PreviewEnvironment"      "*[[{")
90                                 ("PreviewSnarfEnvironment" "{"))
91                               'function)))
92  LaTeX-dialect)
93
94 (defvar LaTeX-preview-package-options
95   '("active"      "noconfig"   "psfixbb"
96     "dvips"       "pdftex"     "xetex"
97     "displaymath" "floats"     "textmath"
98     "graphics"    "sections"   "delayed"
99     "auctex"      "showlabels" "tightpage"
100     "lyx"         "counters"   "footnotes"
101     "tracingall"  "showbox")
102   "Package options for the preview package.")
103
104 ;;; preview.el ends here