[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 4486056d50 16/77: Add new style/ltcaption.el
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 4486056d50 16/77: Add new style/ltcaption.el |
Date: |
Fri, 26 Aug 2022 16:06:32 -0400 (EDT) |
branch: externals/auctex
commit 4486056d50321194bc2c2c926a8eaf4c151ee8b0
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>
Add new style/ltcaption.el
* Makefile.in (STYLESRC): Add new style.
* style/caption.el ("caption"): Run the style hook for ltcaption
if longtable is loaded.
* style/ltcaption.el: New file.
---
Makefile.in | 2 +-
style/caption.el | 6 ++-
style/ltcaption.el | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 126 insertions(+), 2 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 235b9058a1..b8a45dd01a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -181,7 +181,7 @@ STYLESRC = style/prosper.el \
style/rotating.el style/sidecap.el style/l3doc.el \
style/ifthen.el style/etoolbox.el style/ifetex.el \
style/ifpdf.el style/iftex.el style/ifvtex.el \
- style/ifxetex.el style/multibib.el
+ style/ifxetex.el style/multibib.el style/ltcaption.el
STYLEELC = $(STYLESRC:.el=.elc)
diff --git a/style/caption.el b/style/caption.el
index 134157a443..1b06fbf633 100644
--- a/style/caption.el
+++ b/style/caption.el
@@ -1,6 +1,6 @@
;;; caption.el --- AUCTeX style for `caption.sty' (v3.4a) -*-
lexical-binding: t; -*-
-;; Copyright (C) 2015--2021 Free Software Foundation, Inc.
+;; Copyright (C) 2015--2022 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
@@ -365,6 +365,10 @@ STAR is non-nil, do not query for a short-caption and a
label."
;; Add caption to the parser.
(TeX-auto-add-regexp LaTeX-caption-DeclareCaption-regexp)
+ ;; Run style hook for ltcaption if longtable package is loaded:
+ (when (member "longtable" (TeX-style-list))
+ (TeX-run-style-hooks "ltcaption"))
+
;; Caption commands:
(TeX-add-symbols
'("caption*" t)
diff --git a/style/ltcaption.el b/style/ltcaption.el
new file mode 100644
index 0000000000..f100b929bd
--- /dev/null
+++ b/style/ltcaption.el
@@ -0,0 +1,120 @@
+;;; ltcaption.el --- AUCTeX style for `ltcaption.sty' version v1.4c -*-
lexical-binding: t; -*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash@gnu.org>
+;; Maintainer: auctex-devel@gnu.org
+;; Created: 2022-05-04
+;; 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 `ltcaption.sty' version v1.4c from
+;; 2021/01/08. `ltcaption.sty' is part of TeXLive.
+
+;; This style tracks ltcaption.sty which doesn't load longtable.sty
+;; and emits an error when longtable package is missing. The same
+;; happens here when longtable.el isn't loaded yet where
+;; `LaTeX-item-longtable' is undefined. The remedy is to load
+;; longtable before ltcaption. The caption package loads ltcaption
+;; automatically if longtable is loaded.
+
+;;; Code:
+
+(require 'tex)
+(require 'latex)
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+ "font-latex" (keywords class))
+(declare-function LaTeX-item-longtable
+ "longtable" (&optional suppress))
+
+(defun LaTeX-env-longtable* (environment)
+ "Insert a longtable* ENVIRONMENT with a starred caption."
+ (let ((pos (and LaTeX-default-position ; `LaTeX-default-position'
+ ; can be nil, i.e. no prompt
+ (completing-read (TeX-argument-prompt t nil "Position")
+ '("l" "r" "c")
+ nil nil LaTeX-default-position)))
+ (fmt (TeX-read-string
+ (if (string= LaTeX-default-format "")
+ "Format: "
+ (format "Format (default %s): " LaTeX-default-format))
+ nil nil
+ (if (string= LaTeX-default-format "")
+ nil
+ LaTeX-default-format)))
+ (caption (TeX-read-string
+ (TeX-argument-prompt nil nil "Starred caption"))))
+ (setq LaTeX-default-position pos
+ LaTeX-default-format fmt)
+ (LaTeX-insert-environment environment
+ (concat
+ (unless (zerop (length pos))
+ (concat LaTeX-optop pos LaTeX-optcl))
+ (concat TeX-grop fmt TeX-grcl)))
+ ;; top caption -- do nothing if user skips caption
+ (unless (zerop (length caption))
+ ;; insert '\caption*{text} \\':
+ (insert TeX-esc "caption*" TeX-grop caption TeX-grcl " \\\\")
+ ;; fill the caption
+ (when auto-fill-function (LaTeX-fill-paragraph))
+ ;; Insert a new line and indent
+ (LaTeX-newline)
+ (indent-according-to-mode))
+ ;; Insert suitable number of &'s, suppress line break
+ (LaTeX-item-longtable t)))
+
+(TeX-add-style-hook
+ "ltcaption"
+ (lambda ()
+
+ (TeX-add-symbols
+ "LTcapmarginsfalse"
+ "LTcaptype")
+
+ ;; These parameters are set with \setlength
+ (LaTeX-add-lengths
+ "LTcapskip" "LTcapleft" "LTcapright")
+
+ (LaTeX-add-environments
+ '("longtable*" LaTeX-env-longtable*))
+
+ ;; Use the enhanced table formatting. Append to
+ ;; `LaTeX-indent-environment-list' in order not to override custom
+ ;; settings.
+ (add-to-list (make-local-variable 'LaTeX-indent-environment-list)
+ '("longtable*" LaTeX-indent-tabular) t)
+
+ ;; Append 'longtable*' to `LaTeX-item-list' with `LaTeX-item-longtable':
+ (add-to-list 'LaTeX-item-list '("longtable*" . LaTeX-item-longtable) t)
+
+ ;; Fontification
+ (when (and (featurep 'font-latex)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ (font-latex-add-keywords '(("LTcapmarginsfalse" ""))
+ 'function)))
+ TeX-dialect)
+
+(defvar LaTeX-ltcaption-package-options nil
+ "Package options for the ltcaption package.")
+
+;;; ltcaption.el ends here
- [elpa] externals/auctex cc70633aa6 51/77: ; * preview.el.in (preview-reference-face): Fix warning., (continued)
- [elpa] externals/auctex cc70633aa6 51/77: ; * preview.el.in (preview-reference-face): Fix warning., Tassilo Horn, 2022/08/26
- [elpa] externals/auctex edb15b8f26 43/77: Follow up the previous commit, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 87b24d0963 45/77: Add support for the Sioyek document viewer, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 794ecb01ab 35/77: Fontify \maketitle macro, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 0029ca410f 77/77: Release GNU AUCTeX 13.1.4, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 06db9e302b 75/77: Add new style/tcolorboxlib-theorems.el, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 19a2607b42 73/77: Unbreak building with Emacs 29 after obsoleting autoload.el, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex ec3877ea7f 74/77: Pacify Emacs 29 compiler warnings, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 0f59225c0f 70/77: ; * doc/todo.texi (Mid-term Goals): Fix typo., Tassilo Horn, 2022/08/26
- [elpa] externals/auctex fe15af59d0 76/77: Merge remote-tracking branch 'origin/master' into externals/auctex, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 4486056d50 16/77: Add new style/ltcaption.el,
Tassilo Horn <=
- [elpa] externals/auctex 3a1a820bdf 18/77: ; Rearrange code after last commit., Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 9b5cf4b550 27/77: Fix insertion of second optional argument, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 4770d57dba 38/77: Support different number of arguments for \hyperref, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex e3657144f5 53/77: Partial fix of region preview with TeX-output-dir feature, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex edabf207b4 65/77: Insert a space between \caption and \\ in tables, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 812368af6a 62/77: Update documentation about C-M-a and C-M-e, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 728db25bf7 69/77: Update documentation, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex f2138e9a74 33/77: New option for saving auto parsed information (bug#55511), Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 5c5aa78de0 71/77: Fix doc string, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex c39fe6d1d6 13/77: Delete compatibility code, Tassilo Horn, 2022/08/26