"Fossies" - the Fresh Open Source Software Archive

Member "auctex-12.3/style/overpic.el" (18 Oct 2020, 3564 Bytes) of package /linux/misc/auctex-12.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Lisp source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 ;;; overpic.el --- AUCTeX style for `overpic.sty' (v1.3)
    2 
    3 ;; Copyright (C) 2020 Free Software Foundation, Inc.
    4 
    5 ;; Author: Arash Esbati <arash@gnu.org>
    6 ;; Maintainer: auctex-devel@gnu.org
    7 ;; Created: 2020-02-23
    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 `overpic.sty' (v1.3) from 2020/02/22.
   30 ;; `overpic.sty' is part of TeXLive.
   31 
   32 ;;; Code:
   33 
   34 ;; Silence the compiler
   35 (declare-function font-latex-add-keywords
   36           "font-latex"
   37           (keywords class))
   38 (defvar LaTeX-graphicx-key-val-options)
   39 (defvar LaTeX-graphicx-package-options)
   40 
   41 (defvar LaTeX-overpic-key-val-options
   42   '(("abs"     ("true" "false"))
   43     ("percent" ("true" "false"))
   44     ("permil"  ("true" "false"))
   45     ("rel")
   46     ("grid"    ("true" "false"))
   47     ("tics")
   48     ("unit"))
   49   "Key=value options for overpic macro and environments.")
   50 
   51 (defun LaTeX-arg-overpic-key-val (optional)
   52   "Insert key-val for optional argument of overpic environments.
   53 If OPTIONAL is non-nil, insert argument in square brackets.
   54 
   55 This function is an variation of
   56 `LaTeX-arg-graphicx-includegraphics-key-val' where the key-val's
   57 in `LaTeX-overpic-key-val-options' are offered in addition to the
   58 ones provided by `LaTeX-graphicx-key-val-options'."
   59   (let ((crm-local-completion-map
   60      (remove (assoc 32 crm-local-completion-map)
   61          crm-local-completion-map))
   62     (minibuffer-local-completion-map
   63      (remove (assoc 32 minibuffer-local-completion-map)
   64          minibuffer-local-completion-map)))
   65     (TeX-argument-insert
   66      (TeX-read-key-val optional
   67                (if (and (or (and (eq TeX-engine 'default)
   68                      (not (TeX-PDF-from-DVI)))
   69                     (eq TeX-engine 'luatex))
   70                 TeX-PDF-mode)
   71                (append '(("page")
   72                      ("pagebox" ("mediabox"
   73                          "cropbox"
   74                          "bleedbox"
   75                          "trimbox"
   76                          "artbox")))
   77                    LaTeX-overpic-key-val-options
   78                    LaTeX-graphicx-key-val-options)
   79              (append
   80               LaTeX-overpic-key-val-options
   81               LaTeX-graphicx-key-val-options)))
   82      optional)))
   83 
   84 
   85 (TeX-add-style-hook
   86  "overpic"
   87  (lambda ()
   88 
   89    ;; overpic.sty loads graphicx.sty
   90    (TeX-run-style-hooks "graphicx")
   91 
   92    (TeX-add-symbols
   93     '("setOverpic" (TeX-arg-key-val LaTeX-overpic-key-val-options)))
   94 
   95    (LaTeX-add-environments
   96     '("overpic" LaTeX-env-args
   97       [ LaTeX-arg-overpic-key-val ]
   98       LaTeX-arg-includegraphics)
   99 
  100     '("Overpic" LaTeX-env-args
  101       [ LaTeX-arg-overpic-key-val ]
  102       (TeX-arg-literal "{" "}")))
  103 
  104    ;; Fontification
  105    (when (and (featurep 'font-latex)
  106           (eq TeX-install-font-lock 'font-latex-setup))
  107      (font-latex-add-keywords '(("setOverpic" "{"))
  108                   'function)))
  109  LaTeX-dialect)
  110 
  111 (defvar LaTeX-overpic-package-options
  112   (progn
  113     (TeX-load-style "graphicx")
  114     (append
  115      LaTeX-graphicx-package-options
  116      '("abs"
  117        "percent"
  118        "permil")))
  119   "Package options for the overpic package.")
  120 
  121 ;;; overpic.el ends here