"Fossies" - the Fresh Open Source Software Archive

Member "auctex-12.3/style/revtex4-2.el" (18 Oct 2020, 8400 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 ;;; revtex4-2.el --- AUCTeX style for `revtex4-2.cls' (v4.2c)
    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: 2019-12-29
    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 `revtex4-2.cls' (v4.2c) from 2019/01/18.
   30 ;; `revtex4-2.cls' 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-natbib-package-options)
   39 (defvar LaTeX-url-package-options)
   40 
   41 (defun LaTeX-env-revtex4-2-video (environment)
   42   "Create ENVIRONMENT with \\caption and \\label commands.
   43 This function is meant to be used for \"video\" environment
   44 provided by REVTeX class."
   45   (let* ((float (and LaTeX-float ; LaTeX-float can be nil, i.e. do not prompt
   46              (TeX-read-string
   47               (TeX-argument-prompt t nil "Float position")
   48               LaTeX-float)))
   49      (caption (TeX-read-string
   50            (TeX-argument-prompt nil nil "Caption")))
   51      (short-caption (when (>= (length caption) LaTeX-short-caption-prompt-length)
   52               (TeX-read-string
   53                (TeX-argument-prompt t nil "Short caption")))))
   54     (setq LaTeX-float float)
   55     (LaTeX-insert-environment environment
   56                   (unless (zerop (length float))
   57                 (concat LaTeX-optop float LaTeX-optcl)))
   58     ;; Save the place where we've started:
   59     (save-excursion
   60       ;; Add a new line and add the \setfloatlink macro:
   61       (LaTeX-newline)
   62       (indent-according-to-mode)
   63       (TeX-insert-macro "setfloatlink")
   64       ;; Insert caption and ask for a label, do nothing if user skips
   65       ;; caption:
   66       (when (and caption (not (string= caption "")))
   67     (LaTeX-newline)
   68     (indent-according-to-mode)
   69     (insert (LaTeX-compose-caption-macro caption short-caption))
   70     ;; If `auto-fill-mode' is active, fill the caption.
   71     (when auto-fill-function (LaTeX-fill-paragraph))
   72     (LaTeX-newline)
   73     (indent-according-to-mode)
   74     ;; Ask for a label and indent only if it is inserted:
   75     (when (LaTeX-label environment 'environment)
   76       (indent-according-to-mode))))))
   77 
   78 (TeX-add-style-hook
   79  "revtex4-2"
   80  (lambda ()
   81 
   82    ;; Add standard stuff taken from `article.el':
   83    (LaTeX-largest-level-set "section")
   84    (LaTeX-add-counters "part" "section" "subsection" "subsubsection"
   85                "paragraph" "subparagraph" "figure" "table")
   86    (LaTeX-add-environments "abstract")
   87 
   88    ;; Run style hooks for packages loaded by default:
   89    (TeX-run-style-hooks "url" "natbib")
   90 
   91    ;; Check for other class options and load AUCTeX style
   92    ;; respectively.  car of the cons is the REVTeX class option, cdr
   93    ;; the name of AUCTeX style:
   94    (let ((opt-style '(("amsfonts" . "amsfonts")
   95               ("amsmath" . "amsmath")
   96               ("linenumbers" . "lineno")))
   97      (opt-cls (cdar LaTeX-provided-class-options)))
   98      (dolist (opt opt-style)
   99        (when (member (car opt) opt-cls)
  100      (TeX-run-style-hooks (cdr opt)))))
  101 
  102    (TeX-add-symbols
  103     ;; IV.3. Specifying authors and affiliations
  104     '("affiliation" "Affliation")
  105     '("noaffiliation")
  106     ;; Because collaborations don't normally have affiiations, one
  107     ;; needs to follow the \collaboration with \noaffiliation:
  108     '("collaboration" "Collaboration"
  109       (TeX-arg-literal "\n")
  110       (TeX-arg-literal "\\noaffiliation"))
  111     '("email"    ["Text"] "E-Mail Address")
  112     '("homepage" ["Text"] "URL")
  113     '("altaffiliation" ["Text"] "Affliation")
  114     ;; Specifying first names and surnames
  115     '("surname" "Surname")
  116 
  117     ;; IV.6. Keywords
  118     '("keywords" t)
  119 
  120     ;; IV.7. Institutional report numbers
  121     '("preprint" 0)
  122 
  123     ;; V.3. One-column vs. two-column layouts
  124     '("onecolumngrid"  0)
  125     '("twocolumngrid"  0)
  126 
  127     ;; V.6. Appendices
  128     '("appendix*" 0)
  129 
  130     ;; VIII.1. Citing a reference
  131     '("onlinecite"
  132       (TeX-arg-conditional TeX-arg-cite-note-p ([LaTeX-arg-natbib-notes]) nil)
  133       TeX-arg-cite)
  134     '("textcite"
  135       (TeX-arg-conditional TeX-arg-cite-note-p ([LaTeX-arg-natbib-notes]) nil)
  136       TeX-arg-cite)
  137 
  138     ;; IX.2 video environment
  139     '("setfloatlink" "URL")
  140 
  141     ;; X.3. Dealing with Long Tables
  142     '("squeezetable" 0)
  143 
  144     ;; XI. Placement of Figures, Tables, and other floats
  145     '("printtables"   0)
  146     '("printtables*"  0)
  147     '("printfigures"  0)
  148     '("printfigures*" 0))
  149 
  150    ;; V.3. One-column vs. two-column layouts
  151    (LaTeX-add-environments
  152     '("widetext")
  153     '("acknowledgments")
  154 
  155     ;; IX.2. video environment
  156     '("video" LaTeX-env-revtex4-2-video)
  157 
  158     ;; X. Tables
  159     '("ruledtabular")
  160 
  161     ;; XII. Rotating Floats
  162     '("turnpage"))
  163 
  164    ;; Append entry for `video' to `LaTeX-label-alist':
  165    (add-to-list 'LaTeX-label-alist
  166         (cons "video" 'LaTeX-revtex4-2-video-label)
  167         t)
  168 
  169    ;; Tell RefTeX about `video' environment:
  170    (when (fboundp 'reftex-add-label-environments)
  171      (reftex-add-label-environments
  172       `(("video"
  173      ,LaTeX-revtex4-2-video-reftex-quick-id-key
  174      ,LaTeX-revtex4-2-video-label
  175      "~\\ref{%s}" caption))))
  176 
  177    ;; X.3. Dealing with Long Tables
  178    (when (member "longtable" (TeX-style-list))
  179      (LaTeX-add-environments
  180       '("longtable*" LaTeX-env-longtable)))
  181 
  182    ;; Verbatim-like macros with braces as delimiters:
  183    (add-to-list 'LaTeX-verbatim-macros-with-braces-local "email")
  184    (add-to-list 'LaTeX-verbatim-macros-with-braces-local "homepage")
  185    (add-to-list 'LaTeX-verbatim-macros-with-braces-local "setfloatlink")
  186 
  187    ;; Fontification
  188    (when (and (featurep 'font-latex)
  189           (eq TeX-install-font-lock 'font-latex-setup))
  190      (font-latex-add-keywords '(("fbox"          "*[{")
  191                 ("keywords"      "{")
  192                 ("preprint"      "")
  193                 ("onecolumngrid" "")
  194                 ("twocolumngrid" "")
  195                 ("squeezetable"  "")
  196                 ("printtables"   "*")
  197                 ("printfigures"  "*"))
  198                   'function)
  199      (font-latex-add-keywords '(("affiliation"    "{")
  200                 ("noaffiliation"  "")
  201                 ("collaboration"  "{")
  202                 ("altaffiliation" "[{"))
  203                   'textual)
  204      (font-latex-add-keywords '(("email"        "[")
  205                 ("homepage"     "[")
  206                 ("onlinecite"   "[[{")
  207                 ("textcite"     "[[{")
  208                 ("setfloatlink" ""))
  209                   'reference)
  210      (font-latex-add-keywords '(("appendix*" ""))
  211                   'warning)))
  212  LaTeX-dialect)
  213 
  214 (defvar LaTeX-revtex4-2-class-options
  215   (progn
  216     (TeX-load-style "natbib")
  217     (TeX-load-style "url")
  218     (append
  219      LaTeX-natbib-package-options
  220      LaTeX-url-package-options
  221      '("aps"   "aip"   "aapm" "sor"
  222        "prl"   "pra"   "prb"  "prc" "prd" "pre"
  223        "prab"  "prper" "prx"  "prapplied" "prfluids"
  224        "prmaterials"   "physrev"    "rmp"
  225        "apl"   "bmf"   "cha"  "jap" "jcp" "jmp" "rse"
  226        "pof"   "pop"   "rsi"  "apm" "adv" "sd"
  227        "mph"   "jor"
  228        "10pt"  "11pt"  "12pt"
  229        "groupedaddress"  "superscriptaddress"
  230        "draft"           "linenumbers" "longbibliography"
  231        "amsfonts"        "noamsfonts"
  232        "amssymb"         "noamssymb"
  233        "amsmath"         "noamsmath"
  234        "preprintnumbers" "nopreprintnumbers"
  235        "floatfix"
  236        "bibnotes"        "nobibnotes"
  237        "footinbib"       "nofootinbib"
  238        "eprint"          "noeprint"
  239        "altaffilletter"  "altaffillsymbol"
  240        "unsortedaddress"
  241        "runinaddress"
  242        "showkeys"        "noshowkeyws"
  243        "tightenlines"
  244        "floats"
  245        "endfloats"
  246        "endfloats*"
  247        "titlepage"       "notitlepage"
  248        "final"
  249        "letterpaper"     "a4paper" "a5paper"
  250        "oneside"         "twoside"
  251        "fleqn"
  252        "eqsecnum"
  253        "balancelastpage" "nobalancelastpage"
  254        "raggedbottom"    "flushbottom"
  255        "raggedfooter"    "noraggedfooter"
  256        "byrevtex"
  257        "citeautoscript" "galley" "nomerge")))
  258   "Options for the revtex4-2 document class.")
  259 
  260 ;;; revtex4-2.el ends here