[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 225bade 14/57: Add new style/titletoc.el
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 225bade 14/57: Add new style/titletoc.el |
Date: |
Wed, 11 Jan 2017 18:01:38 +0000 (UTC) |
branch: externals/auctex
commit 225badee0ec3f169a1a87227fce14cb5b326d054
Author: Arash Esbati <address@hidden>
Commit: Arash Esbati <address@hidden>
Add new style/titletoc.el
* style/titletoc.el: New file.
* Makefile.in (STYLESRC): Add new style.
---
Makefile.in | 2 +-
style/titletoc.el | 206 +++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 207 insertions(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index 5a4aea4..1efcdd1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -160,7 +160,7 @@ STYLESRC = style/prosper.el \
style/bidi.el style/FiraMono.el style/FiraSans.el \
style/bicaption.el style/amsfonts.el style/subfiles.el \
style/dcolumn.el style/mdframed.el style/tcolorboxlib-raster.el \
- style/titleps.el style/titlesec.el
+ style/titleps.el style/titlesec.el style/titletoc.el
STYLEELC = $(STYLESRC:.el=.elc)
diff --git a/style/titletoc.el b/style/titletoc.el
new file mode 100644
index 0000000..5cad560
--- /dev/null
+++ b/style/titletoc.el
@@ -0,0 +1,206 @@
+;;; titletoc.el --- AUCTeX style for `titletoc.sty' (v1.6)
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash.esbati'at'gmail.com>
+;; Maintainer: address@hidden
+;; Created: 2015-09-19
+;; 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 `titletoc.sty' (v1.6) from
+;; 2011/12/15. `titletoc.sty' is part of TeXLive.
+
+;;; Code:
+
+(defvar LaTeX-titletoc-section-command-list
+ '("part"
+ "chapter"
+ "section"
+ "subsection"
+ "subsubsection"
+ "paragraph"
+ "subparagraph"
+ "figure"
+ "table")
+ "List of sectioning commands available in \"titletoc.sty\".
+Other environments producing a \"Table of ENVIRONMENT\" (figure,
+table) are also available in this variable.")
+
+(defun LaTeX-titletoc-section-command-list ()
+ "Remove \"chapter\" from variable
+`LaTeX-titletoc-section-command-list' and return the remainder.
+Removal is based on the return value of function
+`LaTeX-largest-level'."
+ (if (< (LaTeX-largest-level) 2)
+ (symbol-value 'LaTeX-titletoc-section-command-list)
+ (remove "chapter" LaTeX-titletoc-section-command-list)))
+
+;; Needed for auto-parsing.
+(require 'tex)
+
+;; Setup for \contentsuse:
+(TeX-auto-add-type "titletoc-contentsuse" "LaTeX")
+
+(defvar LaTeX-titletoc-contentsuse-regexp
+ '("\\\\contentsuse{\\([^}]+\\)}"
+ 1 LaTeX-auto-titletoc-contentsuse)
+ "Matches the argument of \\contentsuse from titletoc package.")
+
+(defun LaTeX-titletoc-auto-prepare ()
+ "Clear `LaTeX-auto-titletoc-contentsuse' before parsing."
+ (setq LaTeX-auto-titletoc-contentsuse nil))
+
+(defun LaTeX-titletoc-auto-cleanup ()
+ "Move parsed arguments of \"\\contentsuse\" to the variable
+`LaTeX-titletoc-section-command-list'."
+ (when (LaTeX-titletoc-contentsuse-list)
+ (make-local-variable 'LaTeX-titletoc-section-command-list)
+ (dolist (content (mapcar #'car (LaTeX-titletoc-contentsuse-list)))
+ (add-to-list 'LaTeX-titletoc-section-command-list content))))
+
+(add-hook 'TeX-auto-prepare-hook #'LaTeX-titletoc-auto-prepare t)
+(add-hook 'TeX-auto-cleanup-hook #'LaTeX-titletoc-auto-cleanup t)
+(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
+
+(TeX-add-style-hook
+ "titletoc"
+ (lambda ()
+
+ ;; Add titletoc to the parser
+ (TeX-auto-add-regexp LaTeX-titletoc-contentsuse-regexp)
+
+ (TeX-add-symbols
+ ;; Basic macros
+ ;; \dottedcontents{<section>}[<left>]{<above-code>}
+ ;; {<label width>}{<leader width>}
+ '("dottedcontents"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Sectioning command")
+ (LaTeX-titletoc-section-command-list))
+ [ TeX-arg-eval
+ (lambda ()
+ (let ((length (TeX-read-string
+ (TeX-argument-prompt nil nil "Left margin"))))
+ (format "%s" length))) ]
+ 3)
+
+ ;; \titlecontents{<section>}[<left>]{<above-code>}
+ ;; {<numbered-entry-format>}{<numberless-entry-format>}
+ ;; {<filler-page-format>}[<below-code>]
+ '("titlecontents"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Sectioning command")
+ (LaTeX-titletoc-section-command-list))
+ [ TeX-arg-eval
+ (lambda ()
+ (let ((length (TeX-read-string
+ (TeX-argument-prompt nil nil "Left margin"))))
+ (format "%s" length))) ]
+ (TeX-arg-conditional (y-or-n-p "With optional below code argument? ")
+ (4 [nil])
+ (4)))
+
+ ;; \titlecontents*{<section>}[<left>]{<above-code>}
+ ;; {<numbered-entry-format>}{<numberless-entry-format>}
+ ;; {<filler-page-format>}[<separator>]
+ '("titlecontents*"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Sectioning command")
+ (LaTeX-titletoc-section-command-list))
+ [ TeX-arg-eval
+ (lambda ()
+ (let ((length (TeX-read-string
+ (TeX-argument-prompt nil nil "Left margin"))))
+ (format "%s" length))) ]
+ (TeX-arg-conditional (y-or-n-p "With optional separator argument? ")
+ (4 [nil])
+ (4)))
+
+ ;; \contentsmargin[<correction>]{<right>}
+ '("contentsmargin" [ "Correction" ] "Right margin")
+
+ '("thecontentslabel" 0)
+
+ '("thecontentspage" 0)
+
+ '("contentslabel" [ "Format" ] (TeX-arg-length "Space"))
+
+ '("contentspage" [ "Format" ])
+
+ '("contentspush" t)
+
+ ;; Check if newfloat.el is loaded and any new environment is
+ ;; defined with it. titletoc.sty can also be used to customize
+ ;; new environments defined with newfloat.sty. As a prerequisite,
+ ;; the environments must be introduced to titletoc.sty with
+ ;; \contentuse{ENV} and then can be used as argument to \titlecontents.
+ '("contentsuse"
+ (TeX-arg-eval
+ (lambda ()
+ (let ((name (if (and (member "newfloat" (TeX-active-styles))
+ (LaTeX-newfloat-DeclareFloatingEnvironment-list))
+ (completing-read
+ (TeX-argument-prompt optional nil "Name of contents")
+ (mapcar #'car
+
(LaTeX-newfloat-DeclareFloatingEnvironment-list)))
+ (TeX-read-string
+ (TeX-argument-prompt optional nil "Name of
contents")))))
+ (make-local-variable 'LaTeX-titletoc-section-command-list)
+ (add-to-list 'LaTeX-titletoc-section-command-list name)
+ (format "%s" name))))
+ "File extension")
+
+ ;; 6.3. Partial TOC's
+ '("startcontents" [ "Name" ])
+
+ '("stopcontents" [ "Name" ])
+
+ '("resumecontents" [ "Name" ])
+
+ '("printcontents" [ "Name" ] "Prefix" "Start level" t)
+
+ ;; 6.4. Partial lists
+ '("startlist" [ "Name" ] "List")
+
+ '("stoplist" [ "Name" ] "List")
+
+ '("resumelist" [ "Name" ] "List")
+
+ '("printlist" [ "Name" ] "Prefix" t) )
+
+ ;; Fontification: We only add macros which are used at top level;
+ ;; most of macros definded above are intended to be used in
+ ;; arguments of \dottedcontents or \titlecontents
+ (when (and (featurep 'font-latex)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ (font-latex-add-keywords '(("dottedcontents" "{[{{{")
+ ("titlecontents" "*{[{{{[[[")
+ ("contentsmargin" "[{")
+ ("contentsuse" "{{"))
+ 'function)) )
+ LaTeX-dialect)
+
+(defvar LaTeX-titletoc-package-options
+ '("leftlabels" "rightlabels" "dotinlabels")
+ "Package options for the titletoc package.")
+
+;;; titletoc.el ends here
- [elpa] externals/auctex bef4873 22/57: Set `reftex-set-cite-format' to biblatex or natbib, (continued)
- [elpa] externals/auctex bef4873 22/57: Set `reftex-set-cite-format' to biblatex or natbib, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex c3a21f2 04/57: Print only first line of the message in error overview, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 48d397c 17/57: Add starred version of \citeauthor and \Citeauthor, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 89ea0e4 19/57: Fix name of macros \lcnamecref and \lcnamecrefs, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex bb390fe 18/57: Add fontification for varioref's referencing macros, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 8186490 06/57: Fix documentation of TeX-arg-file, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 01da194 23/57: ; * style/titletoc.el ("titletoc"): Use `TeX-arg-length'., Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 1addc62 30/57: Use RefTeX for multiple citations in biblatex, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 890163e 26/57: Bring back multi-level script font-locking, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 5ddbd04 12/57: Add new style/titleps.el, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 225bade 14/57: Add new style/titletoc.el,
Tassilo Horn <=
- [elpa] externals/auctex 343ca9c 36/57: Fix script unfontification bug, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 501b0de 47/57: Use RefTeX for multiple references in cleveref, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex bfc7e90 16/57: Fix fontification for natbib compat macros, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 1de2359 13/57: Add new style/titlesec.el, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex ccec850 24/57: Remove multi-level/invisible feature of font-latex-fontify-script, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 4c42f7a 25/57: Revert "Remove multi-level/invisible feature of font-latex-fontify-script", Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 4747c24 29/57: Simple docfix, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 69fc320 27/57: Add a newline only if \label is inserted, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 377a97a 32/57: Completion for math macros, Tassilo Horn, 2017/01/11
- [elpa] externals/auctex 0e54895 34/57: Improve completion docs, Tassilo Horn, 2017/01/11