emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/auctex aa85918 24/43: Add new style/revtex4-2.el


From: Tassilo Horn
Subject: [elpa] externals/auctex aa85918 24/43: Add new style/revtex4-2.el
Date: Sat, 11 Apr 2020 15:05:22 -0400 (EDT)

branch: externals/auctex
commit aa85918447ddcd3053c3e3af09ff87537085c049
Author: Arash Esbati <address@hidden>
Commit: Arash Esbati <address@hidden>

    Add new style/revtex4-2.el
    
    * Makefile.in (STYLESRC): Add new style.
    
    * style/revtex4-2.el: New file.
    
    * tex-style.el (LaTeX-write18-enabled-p): Delete * and whitespace
    in docstring.
    Indent comment.
    Add customize entries for revtex4-2.el.
---
 Makefile.in        |   3 +-
 style/revtex4-2.el | 262 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tex-style.el       |  43 ++++++---
 3 files changed, 293 insertions(+), 15 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index c0ab529..1947718 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -170,7 +170,8 @@ STYLESRC = style/prosper.el \
           style/ocg-p.el     style/ocgx.el      style/thm-restate.el \
           style/pythontex.el style/dashundergaps.el style/beamerarticle.el \
           style/changelog.el style/ltugboat.el  style/beamerswitch.el \
-          style/multitoc.el  style/fbox.el      style/xkcdcolors.el
+          style/multitoc.el  style/fbox.el      style/xkcdcolors.el \
+          style/revtex4-2.el
 
 STYLEELC = $(STYLESRC:.el=.elc)
 
diff --git a/style/revtex4-2.el b/style/revtex4-2.el
new file mode 100644
index 0000000..7ae5f2b
--- /dev/null
+++ b/style/revtex4-2.el
@@ -0,0 +1,262 @@
+;;; revtex4-2.el --- AUCTeX style for `revtex4-2.cls' (v4.2c)
+
+;; Copyright (C) 2020 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <address@hidden>
+;; Maintainer: address@hidden
+;; Created: 2019-12-29
+;; Keywords: tex
+
+;; This file is part of AUCTeX.
+
+;; AUCTeX is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; AUCTeX is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with AUCTeX; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+
+;; This file adds support for `revtex4-2.cls' (v4.2c) from 2019/01/18.
+;; `revtex4-2.cls' is part of TeXLive.
+
+;;; Code:
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(defun LaTeX-env-revtex4-2-video (environment)
+  "Create ENVIRONMENT with \\caption and \\label commands.
+This function is meant to be used for \"video\" environment
+provided by REVTeX class."
+  (let* ((float (and LaTeX-float ; LaTeX-float can be nil, i.e. do not prompt
+                    (TeX-read-string
+                     (TeX-argument-prompt t nil "Float position")
+                     LaTeX-float)))
+        (caption (TeX-read-string
+                  (TeX-argument-prompt nil nil "Caption")))
+        (short-caption (when (>= (length caption) 
LaTeX-short-caption-prompt-length)
+                         (TeX-read-string
+                          (TeX-argument-prompt t nil "Short caption")))))
+    (setq LaTeX-float float)
+    (LaTeX-insert-environment environment
+                             (unless (zerop (length float))
+                               (concat LaTeX-optop float LaTeX-optcl)))
+    ;; Save the place where we've started:
+    (save-excursion
+      ;; Add a new line and add the \setfloatlink macro:
+      (LaTeX-newline)
+      (indent-according-to-mode)
+      (TeX-insert-macro "setfloatlink")
+      ;; Insert caption and ask for a label, do nothing if user skips
+      ;; caption:
+      (when (and caption (not (string= caption "")))
+       (LaTeX-newline)
+       (indent-according-to-mode)
+       (insert (LaTeX-compose-caption-macro caption short-caption))
+       ;; If `auto-fill-mode' is active, fill the caption.
+       (when auto-fill-function (LaTeX-fill-paragraph))
+       (LaTeX-newline)
+       (indent-according-to-mode)
+       ;; Ask for a label and indent only if it is inserted:
+       (when (LaTeX-label environment 'environment)
+         (indent-according-to-mode))))))
+
+(TeX-add-style-hook
+ "revtex4-2"
+ (lambda ()
+
+   ;; Add standard stuff taken from `article.el':
+   (LaTeX-largest-level-set "section")
+   (LaTeX-add-counters "part" "section" "subsection" "subsubsection"
+                      "paragraph" "subparagraph" "figure" "table")
+   (LaTeX-add-environments "abstract")
+
+   ;; Run style hooks for packages loaded by default:
+   (TeX-run-style-hooks "url" "natbib")
+
+   ;; Check for other class options and load AUCTeX style
+   ;; respectively.  car of the cons is the REVTeX class option, cdr
+   ;; the name of AUCTeX style:
+   (let ((opt-style '(("amsfonts" . "amsfonts")
+                     ("amsmath" . "amsmath")
+                     ("linenumbers" . "lineno")))
+        (opt-cls (cdar LaTeX-provided-class-options)))
+     (dolist (opt opt-style)
+       (when (member (car opt) opt-cls)
+        (TeX-run-style-hooks (cdr opt)))))
+
+   (TeX-add-symbols
+    ;; IV.3. Specifying authors and affiliations
+    '("affiliation" "Affliation")
+    '("noaffiliation")
+    ;; Because collaborations don't normally have affiiations, one
+    ;; needs to follow the \collaboration with \noaffiliation:
+    '("collaboration" "Collaboration"
+      (TeX-arg-literal "\n")
+      (TeX-arg-literal "\\noaffiliation"))
+    '("email"    ["Text"] "E-Mail Address")
+    '("homepage" ["Text"] "URL")
+    '("altaffiliation" ["Text"] "Affliation")
+    ;; Specifying first names and surnames
+    '("surname" "Surname")
+
+    ;; IV.6. Keywords
+    '("keywords" t)
+
+    ;; IV.7. Institutional report numbers
+    '("preprint" 0)
+
+    ;; V.3. One-column vs. two-column layouts
+    '("onecolumngrid"  0)
+    '("twocolumngrid"  0)
+
+    ;; V.6. Appendices
+    '("appendix*" 0)
+
+    ;; VIII.1. Citing a reference
+    '("onlinecite"
+      (TeX-arg-conditional TeX-arg-cite-note-p ([LaTeX-arg-natbib-notes]) nil)
+      TeX-arg-cite)
+    '("textcite"
+      (TeX-arg-conditional TeX-arg-cite-note-p ([LaTeX-arg-natbib-notes]) nil)
+      TeX-arg-cite)
+
+    ;; IX.2 video environment
+    '("setfloatlink" "URL")
+
+    ;; X.3. Dealing with Long Tables
+    '("squeezetable" 0)
+
+    ;; XI. Placement of Figures, Tables, and other floats
+    '("printtables"   0)
+    '("printtables*"  0)
+    '("printfigures"  0)
+    '("printfigures*" 0))
+
+   ;; V.3. One-column vs. two-column layouts
+   (LaTeX-add-environments
+    '("widetext")
+    '("acknowledgments")
+
+    ;; IX.2. video environment
+    '("video" LaTeX-env-revtex4-2-video)
+
+    ;; X. Tables
+    '("ruledtabular")
+
+    ;; XII. Rotating Floats
+    '("turnpage"))
+
+   ;; Append entry for `video' to `LaTeX-label-alist':
+   (add-to-list 'LaTeX-label-alist
+               (cons "video" 'LaTeX-revtex4-2-video-label)
+               t)
+
+   ;; Tell RefTeX about `video' environment:
+   (when (fboundp 'reftex-add-label-environments)
+     (reftex-add-label-environments
+      `(("video"
+        ,LaTeX-revtex4-2-video-reftex-quick-id-key
+        ,LaTeX-revtex4-2-video-label
+        "~\\ref{%s}" caption))))
+
+   ;; X.3. Dealing with Long Tables
+   (when (member "longtable" (TeX-style-list))
+     (LaTeX-add-environments
+      '("longtable*" LaTeX-env-longtable)))
+
+   ;; Verbatim-like macros with braces as delimiters:
+   (add-to-list 'LaTeX-verbatim-macros-with-braces-local "email")
+   (add-to-list 'LaTeX-verbatim-macros-with-braces-local "homepage")
+   (add-to-list 'LaTeX-verbatim-macros-with-braces-local "setfloatlink")
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+             (eq TeX-install-font-lock 'font-latex-setup)
+             (fboundp 'font-latex-update-font-lock))
+     (font-latex-add-keywords '(("fbox"          "*[{")
+                               ("keywords"      "{")
+                               ("preprint"      "")
+                               ("onecolumngrid" "")
+                               ("twocolumngrid" "")
+                               ("squeezetable"  "")
+                               ("printtables"   "*")
+                               ("printfigures"  "*"))
+                             'function)
+     (font-latex-add-keywords '(("affiliation"    "{")
+                               ("noaffiliation"  "")
+                               ("collaboration"  "{")
+                               ("altaffiliation" "[{"))
+                             'textual)
+     (font-latex-add-keywords '(("email"        "[")
+                               ("homepage"     "[")
+                               ("onlinecite"   "[[{")
+                               ("textcite"     "[[{")
+                               ("setfloatlink" ""))
+                             'reference)
+     (font-latex-add-keywords '(("appendix*" ""))
+                             'warning)
+
+     ;; Tell font-lock about the update.
+     (font-latex-update-font-lock t)))
+ LaTeX-dialect)
+
+(defvar LaTeX-revtex4-2-class-options
+  (progn
+    (TeX-load-style "natbib")
+    (TeX-load-style "url")
+    (append
+     LaTeX-natbib-package-options
+     LaTeX-url-package-options
+     '("aps"   "aip"   "aapm" "sor"
+       "prl"   "pra"   "prb"  "prc" "prd" "pre"
+       "prab"  "prper" "prx"  "prapplied" "prfluids"
+       "prmaterials"   "physrev"    "rmp"
+       "apl"   "bmf"   "cha"  "jap" "jcp" "jmp" "rse"
+       "pof"   "pop"   "rsi"  "apm" "adv" "sd"
+       "mph"   "jor"
+       "10pt"  "11pt"  "12pt"
+       "groupedaddress"  "superscriptaddress"
+       "draft"           "linenumbers" "longbibliography"
+       "amsfonts"        "noamsfonts"
+       "amssymb"         "noamssymb"
+       "amsmath"         "noamsmath"
+       "preprintnumbers" "nopreprintnumbers"
+       "floatfix"
+       "bibnotes"        "nobibnotes"
+       "footinbib"       "nofootinbib"
+       "eprint"          "noeprint"
+       "altaffilletter"  "altaffillsymbol"
+       "unsortedaddress"
+       "runinaddress"
+       "showkeys"        "noshowkeyws"
+       "tightenlines"
+       "floats"
+       "endfloats"
+       "endfloats*"
+       "titlepage"       "notitlepage"
+       "final"
+       "letterpaper"     "a4paper" "a5paper"
+       "oneside"         "twoside"
+       "fleqn"
+       "eqsecnum"
+       "balancelastpage" "nobalancelastpage"
+       "raggedbottom"    "flushbottom"
+       "raggedfooter"    "noraggedfooter"
+       "byrevtex"
+       "citeautoscript" "galley" "nomerge")))
+  "Options for the revtex4-2 document class.")
+
+;;; revtex4-2.el ends here
diff --git a/tex-style.el b/tex-style.el
index 79bf32c..89dcbbe 100644
--- a/tex-style.el
+++ b/tex-style.el
@@ -1,7 +1,6 @@
 ;;; tex-style.el --- Customizable variables for AUCTeX style files
 
-;; Copyright (C) 2005, 2007, 2009, 2012-2017
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2007, 2009, 2012-2020 Free Software Foundation, Inc.
 
 ;; Author: Reiner Steib <address@hidden>
 ;; Keywords: tex, wp, convenience
@@ -271,8 +270,8 @@ and `LaTeX-csquotes-close-quote' are non-empty strings."
 ;; style/emp.el
 
 (defcustom LaTeX-write18-enabled-p t
-  "*If non-nil, insert automatically the \\write18 calling metapost.
-When disabled, you have to use mpost on the mp files automatically 
+  "If non-nil, insert automatically the \\write18 calling metapost.
+When disabled, you have to use mpost on the mp files automatically
 produced by emp.sty and then re-LaTeX the document."
   :type 'boolean
   :group 'LaTeX-style)
@@ -356,16 +355,16 @@ files.
 Inserting the subdirectory in the filename (as
 `LaTeX-includegraphics-read-file-relative') is discouraged by
 `epslatex.ps'."
-;; ,----[ epslatex.ps; Section 12; (page 26) ]
-;; | Instead of embedding the subdirectory in the filename, there are two
-;; | other options
-;; |   1. The best method is to modify the TeX search path [...]
-;; |   2. Another method is to specify sub/ in a \graphicspath command
-;; |      [...].  However this is much less efficient than modifying the
-;; |      TeX search path
-;; `----
-;; See "Inefficiency" and "Unportability" in the same section for more
-;; information.
+  ;; ,----[ epslatex.ps; Section 12; (page 26) ]
+  ;; | Instead of embedding the subdirectory in the filename, there are two
+  ;; | other options
+  ;; |   1. The best method is to modify the TeX search path [...]
+  ;; |   2. Another method is to specify sub/ in a \graphicspath command
+  ;; |      [...].  However this is much less efficient than modifying the
+  ;; |      TeX search path
+  ;; `----
+  ;; See "Inefficiency" and "Unportability" in the same section for more
+  ;; information.
   :group 'LaTeX-style
   :type '(choice (const :tag "TeX" LaTeX-includegraphics-read-file-TeX)
                 (const :tag "relative"
@@ -376,6 +375,22 @@ Inserting the subdirectory in the filename (as
                                         (TeX-master-directory))))
                 (function :tag "other")))
 
+;; style/revtex4-2.el
+
+(defcustom LaTeX-revtex4-2-video-label "vid:"
+  "Default prefix to labels in video environments of REVTeX4-2 class."
+  :group 'LaTeX-label
+  :type 'string)
+
+(defcustom LaTeX-revtex4-2-video-reftex-quick-id-key ?v
+  "Unique letter identifying \"video\" environment in RefTeX.
+
+A character argument for quick identification when RefTeX inserts
+new references with `reftex-reference'.  It must be unique.  It
+is initialized to ?v."
+  :group 'LaTeX-style
+  :type 'character)
+
 ;; style/splitidx.el
 
 (defcustom LaTeX-splitidx-sindex-reftex-quick-id-key ?s



reply via email to

[Prev in Thread] Current Thread [Next in Thread]