[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 7a1ebbf 08/27: Add support for algorithm style
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 7a1ebbf 08/27: Add support for algorithm style |
Date: |
Sat, 27 Jun 2020 03:17:42 -0400 (EDT) |
branch: externals/auctex
commit 7a1ebbf331be4961605a388a6a9157d9b4be32bc
Author: Uwe Brauer <oub@mat.ucm.es>
Commit: Tassilo Horn <tsdh@gnu.org>
Add support for algorithm style
* Makefile.in (STYLESRC): Add algorithm style
* style/algorithm.el: Add support for the algorithm style
---
Makefile.in | 2 +-
style/algorithm.el | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 81 insertions(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index 6e599c3..d84d04a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -172,7 +172,7 @@ STYLESRC = style/prosper.el \
style/changelog.el style/ltugboat.el style/beamerswitch.el \
style/multitoc.el style/fbox.el style/xkcdcolors.el \
style/ltxguide.el style/revtex4-2.el style/overpic.el \
- style/tex-live.el
+ style/tex-live.el style/algorithm.el
STYLEELC = $(STYLESRC:.el=.elc)
diff --git a/style/algorithm.el b/style/algorithm.el
new file mode 100644
index 0000000..8004002
--- /dev/null
+++ b/style/algorithm.el
@@ -0,0 +1,80 @@
+;;; algorithm.el --- AUCTeX style for the (LaTeX) algorithm package
+
+;; Copyright (C) 2020 Free Software Foundation, Inc.
+
+;; Author: Uwe Brauer <oub@mat.ucm.es>
+;; Created: 2020-01-26
+;; 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 the algorithm package.
+
+;;; Code:
+
+(defvar LaTeX-algorithm-package-options
+ '("section")
+ "Package options for the algorithm package.")
+
+
+(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: "))))
+ (LaTeX-insert-environment environment
+ (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 TeX-grop caption)
+ ;; ask for a label and insert it
+; (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
+ ;; close `\caption{'
+ (insert TeX-grcl "")
+ ;; fill the caption
+ (LaTeX-fill-paragraph)
+ ;; Insert a new line and indent
+ (LaTeX-newline)
+ (LaTeX-label environment 'environment)
+ (LaTeX-newline)
+ (indent-according-to-mode))))
+
+
+(TeX-add-style-hook
+ "algorithm"
+ (lambda ()
+ (LaTeX-add-environments
+ '("algorithm" LaTeX-env-algorithm ))
+ (TeX-add-symbols
+ '("listofalgorithms" 0))
+ LaTeX-dialect))
+
+
+;;; algorithm.el ends here
- [elpa] externals/auctex 5017391 10/27: Update region extension in font-latex.el, (continued)
- [elpa] externals/auctex 5017391 10/27: Update region extension in font-latex.el, Tassilo Horn, 2020/06/27
- [elpa] externals/auctex e62ce38 12/27: Merge branch 'obsolete-font-latex-update-font-lock', Tassilo Horn, 2020/06/27
- [elpa] externals/auctex a6b12a2 16/27: Update documents, Tassilo Horn, 2020/06/27
- [elpa] externals/auctex 3d4f378 17/27: Fix typos, Tassilo Horn, 2020/06/27
- [elpa] externals/auctex 22d2eb6 20/27: Use constant regexp to fontify math environments, Tassilo Horn, 2020/06/27
- [elpa] externals/auctex 1855efd 21/27: ; * style/mathtools.el: A bit change to align with previous commit., Tassilo Horn, 2020/06/27
- [elpa] externals/auctex 32ad0e2 04/27: Obsolete font-latex-update-font-lock (bug#37945), Tassilo Horn, 2020/06/27
- [elpa] externals/auctex f3df76a 09/27: Add support for algopseudocde style, Tassilo Horn, 2020/06/27
- [elpa] externals/auctex 54bb7c1 05/27: Omit hard font-lock reset also in font-latex-add-to-syntax-alist, Tassilo Horn, 2020/06/27
- [elpa] externals/auctex 9c105a2 06/27: Trigger refontification in font-latex-add-to-syntax-alist., Tassilo Horn, 2020/06/27
- [elpa] externals/auctex 7a1ebbf 08/27: Add support for algorithm style,
Tassilo Horn <=
- [elpa] externals/auctex 9170170 11/27: Delete overhead in extending font lock range of math expression, Tassilo Horn, 2020/06/27
- [elpa] externals/auctex 0ec28c6 13/27: Reconsider region extension, Tassilo Horn, 2020/06/27
- [elpa] externals/auctex ababc71 14/27: Recover compatibility for older emacsen, Tassilo Horn, 2020/06/27
- [elpa] externals/auctex 393fb21 15/27: * texmathp.el: Add comment about additional bug., Tassilo Horn, 2020/06/27
- [elpa] externals/auctex 0079026 19/27: ; * tests/latex/fontification-general.tex: Fix Indentation in environments., Tassilo Horn, 2020/06/27
- [elpa] externals/auctex 4c0d150 22/27: Don't call TeX-remove-style in TeX-arg-document., Tassilo Horn, 2020/06/27
- [elpa] externals/auctex 14a2b27 24/27: Improve conformance to code conventions, and documents, Tassilo Horn, 2020/06/27
- [elpa] externals/auctex 3c1f820 25/27: Add TODO item about remove-style feature, Tassilo Horn, 2020/06/27
- [elpa] externals/auctex d9e148b 26/27: Merge remote-tracking branch 'origin/master' into externals/auctex, Tassilo Horn, 2020/06/27
- [elpa] externals/auctex 3a809a9 18/27: Fix regression of font lock, Tassilo Horn, 2020/06/27