Initial commit

This commit is contained in:
Mateus Pinto Rodrigues
2017-11-11 15:15:10 -02:00
commit 58c3bd6728
1202 changed files with 434097 additions and 0 deletions

View File

@@ -0,0 +1 @@
;; AUCTeX style/ and auto/ directories should not appear in load path.

View File

@@ -0,0 +1,98 @@
;;; Alegreya.el --- AUCTeX style for `Alegreya.sty' (v2015/10/22)
;; Copyright (C) 2015 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2015-09-12
;; 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 `Alegreya.sty' (v2015/10/22).
;; `Alegreya.sty' is part of TeXLive.
;;; Code:
(TeX-add-style-hook
"Alegreya"
(lambda ()
;; Run style hook for packages loaded by Alegreya
(TeX-run-style-hooks "textcomp")
;; Load `fontaxes' or `fontspec' dep. on `type1' option:
(if (or (LaTeX-provided-package-options-member "Alegreya" "type1")
(LaTeX-provided-package-options-member "Alegreya" "type1=true"))
(TeX-run-style-hooks "fontaxes")
(TeX-run-style-hooks "fontspec"))
(TeX-add-symbols
;; Should be used in preamble only
'("useosf")
;; Text commands
'("Alegreya" -1)
'("AlegreyaBlack" -1)
'("AlegreyaLF" -1)
'("AlegreyaOsF" -1)
'("AlegreyaTLF" -1)
'("AlegreyaTOsF" -1)
'("textsu" t) ; superior figures
'("sufigures" -1) ;
'("textin" t) ; inferior figures
'("infigures" -1))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("textsu" "{")
("textin" "{"))
'type-command)
(font-latex-add-keywords '(("Alegreya" "")
("AlegreyaBlack" "")
("AlegreyaLF" "")
("AlegreyaOsF" "")
("AlegreyaTLF" "")
("AlegreyaTOsF" "")
("sufigures" "")
("infigures" ""))
'type-declaration)))
LaTeX-dialect)
(defvar LaTeX-Alegreya-package-options-list
'(("lining" ("true" "false"))
("lf" ("true" "false"))
("oldstyle" ("true" "false"))
("osf" ("true" "false"))
("tabular" ("true" "false"))
("tf" ("true" "false"))
("proportional" ("true" "false"))
("pf" ("true" "false"))
("black" ("true" "false"))
("type1" ("true" "false"))
("scaled")
("scale"))
"Package options for the Alegreya package.")
(defun LaTeX-Alegreya-package-options ()
"Prompt for package options for the Alegreya package."
(TeX-read-key-val t LaTeX-Alegreya-package-options-list))
;;; Alegreya.el ends here

View File

@@ -0,0 +1,110 @@
;;; AlegreyaSans.el --- AUCTeX style for `AlegreyaSans.sty' (v2015/10/22)
;; Copyright (C) 2015 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2015-09-12
;; 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 `AlegreyaSans.sty' (v2015/10/22).
;; `AlegreyaSans.sty' is part of TeXLive.
;;; Code:
(TeX-add-style-hook
"AlegreyaSans"
(lambda ()
;; Run style hook for packages loaded by AlegreyaSans
(TeX-run-style-hooks "textcomp")
;; Load `fontaxes' or `fontspec' dep. on `type1' option:
(if (or (LaTeX-provided-package-options-member "AlegreyaSans" "type1")
(LaTeX-provided-package-options-member "AlegreyaSans" "type1=true"))
(TeX-run-style-hooks "fontaxes")
(TeX-run-style-hooks "fontspec"))
(TeX-add-symbols
;; Should be used in preamble only
'("useosf")
;; Text commands
'("AlegreyaSans" -1)
'("AlegreyaSansLF" -1)
'("AlegreyaSansOsF" -1)
'("AlegreyaSansTLF" -1)
'("AlegreyaSansTOsF" -1)
'("AlegreyaSansThin" -1)
'("AlegreyaSansLight" -1)
'("AlegreyaSansMedium" -1)
'("AlegreyaSansExtraBold" -1)
'("AlegreyaSansBlack" -1)
'("textsu" t) ; superior figures
'("sufigures" -1) ;
'("textin" t) ; inferior figures
'("infigures" -1))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("textsu" "{")
("textin" "{"))
'type-command)
(font-latex-add-keywords '(("AlegreyaSans" "")
("AlegreyaSansLF" "")
("AlegreyaSansOsF" "")
("AlegreyaSansTLF" "")
("AlegreyaSansTOsF" "")
("AlegreyaSansLight" "")
("AlegreyaSansMedium" "")
("AlegreyaSansExtraBold" "")
("AlegreyaSansBlack" "")
("sufigures" "")
("infigures" ""))
'type-declaration)))
LaTeX-dialect)
(defvar LaTeX-AlegreyaSans-package-options-list
'(("lining" ("true" "false"))
("lf" ("true" "false"))
("oldstyle" ("true" "false"))
("osf" ("true" "false"))
("tabular" ("true" "false"))
("tf" ("true" "false"))
("proportional" ("true" "false"))
("pf" ("true" "false"))
("black" ("true" "false"))
("extrabold" ("true" "false"))
("thin" ("true" "false"))
("light" ("true" "false"))
("medium" ("true" "false"))
("type1" ("true" "false"))
("sfdefault" ("true" "false"))
("scaled")
("scale"))
"Package options for the AlegreyaSans package.")
(defun LaTeX-AlegreyaSans-package-options ()
"Prompt for package options for the AlegreyaSans package."
(TeX-read-key-val t LaTeX-AlegreyaSans-package-options-list))
;;; AlegreyaSans.el ends here

View File

@@ -0,0 +1,90 @@
;;; AnonymousPro.el --- AUCTeX style for `AnonymousPro.sty' (v2.1)
;; Copyright (C) 2014 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2014-10-30
;; 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 `AnonymousPro.sty' (v2.1) from
;; 2014/03/22. `AnonymousPro.sty' is part of TeXLive.
;;; Code:
(TeX-add-style-hook
"AnonymousPro"
(lambda ()
;; Run style hook for textcomp
(TeX-run-style-hooks "textcomp")
;; New symbols
(TeX-add-symbols
"ANPapplelogo"
"ANPappleopen"
"ANPapproxequal"
"ANPback"
"ANPblackdiamond"
"ANPcheckmark"
"ANPcopy"
"ANPellipsis"
"ANPendtab"
"ANPerasetotheright"
"ANPgreaterequal"
"ANPHbar"
"ANPhbar"
"ANPinfinity"
"ANPinsert"
"ANPintegral"
"ANPlessequal"
"ANPlozenge"
"ANPnotequal"
"ANPoptionkey"
"ANPpartialdiff"
"ANPPi"
"ANPpi"
"ANPproduct"
"ANPshift"
"ANPshiftlock"
"ANPSigma"
"ANPsigma"
"ANPsigmaone"
"ANPsummation"
"ANPtab"
"ANPReturnSign"
"ANPShoulderedOpenBox"
"ANPUpArrowHead"
"ANPInsertSign"
"ANPUpArrowHeadBars"
"ANPHelm"
"ANPOpenBox"
"ANPDelta"
"ANPverticaltab"
"ANPNumeroSign"))
LaTeX-dialect)
(defvar LaTeX-AnonymousPro-package-options
'("ttdefault" "scale")
"Package options for the AnonymousPro package.")
;;; AnonymousPro.el ends here

View File

@@ -0,0 +1,94 @@
;;; CJK.el --- AUCTeX style for the CJK package.
;; Copyright (C) 2009, 2014 Free Software Foundation, Inc.
;; Author: Ralf Angeli <angeli@caeruleus.net>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2009-01-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 the CJK package, version 4.8.0
;; (22-May-2008).
;;; Code:
(defvar LaTeX-CJK-package-options
'("lowercase" "global" "local" "active" "encapsulated")
"Package options for the CJK package.")
(defvar LaTeX-CJK-enc-list
'("Bg5" "Bg5+" "HK" "GB" "GBt" "GBK" "JIS" "JIS2" "SJIS" "KS" "UTF8" "CNS1"
"CNS2" "CNS3" "CNS4" "CNS5" "CNS6" "CNS7" "CEFX" "CEFY")
"List of encodings supported by the CJK package.")
(defun LaTeX-env-CJK (env)
"Prompt for the arguments of ENV and insert it.
The function can be used for CJK and CJK* environments."
(LaTeX-insert-environment
env
(concat
(let ((font-enc (TeX-read-string "(Optional) Font encoding: ")))
(unless (zerop (length font-enc)) (format "[%s]" font-enc)))
(format "{%s}" (completing-read "Encoding: "
(mapcar 'list LaTeX-CJK-enc-list)))
(format "{%s}" (TeX-read-string "Font family: ")))))
(TeX-add-style-hook
"CJK"
(lambda ()
;; New symbols
(TeX-add-symbols
'("CJKencfamily" ["Font encoding"] "Encoding" "Font family")
'("CJKchar" ["Encoding"] "First byte" "Second byte")
'("CJKcaption" 1)
'("CJKfamily" 1)
'("CJKfontenc" "Encoding" "Font encoding")
'("CJKenc" 1)
'("Unicode" "First byte" "Second byte")
'("CJKsymbols" 2)
'("CJKsymbol" 1)
"CJKbold"
"CJKnormal"
"CJKboldshift"
"CJKCJKchar"
"CJKhangulchar"
"CJKlatinchar"
"CJKhwkatakana"
"CJKnohwkatakana"
"CJKglue"
"CJKtolerance"
"CJKtilde"
"nbs"
"standardtilde"
"CJKspace"
"CJKnospace"
"CJKindent"
'("CJKaddEncHook" 2)
"CJKkern"
"CJKverbatim")
;; New environments
(LaTeX-add-environments
'("CJK" LaTeX-env-CJK)
'("CJK*" LaTeX-env-CJK)))
LaTeX-dialect)
;;; CJK.el ends here

View File

@@ -0,0 +1,39 @@
;;; CJKutf8.el --- AUCTeX style for the CJKutf8 package.
;; Copyright (C) 2009 Free Software Foundation, Inc.
;; Author: Ralf Angeli <angeli@caeruleus.net>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2009-01-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 the CJKutf8 package.
;;; Code:
(TeX-add-style-hook
"CJKutf8"
(lambda ()
(TeX-run-style-hooks "CJK"))
LaTeX-dialect)
;;; CJKutf8.el ends here

View File

@@ -0,0 +1,70 @@
;;; FiraMono.el --- AUCTeX style for `FiraMono.sty' (v2016/02/13)
;; Copyright (C) 2016 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2016-11-11
;; 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 `FiraMono.sty' (v2016/02/13).
;; `FiraMono.sty' is part of TeXLive.
;;; Code:
(TeX-add-style-hook
"FiraMono"
(lambda ()
;; `textcomp' is always loaded:
(TeX-run-style-hooks "textcomp")
;; If package option `type1' is given, load `fontaxes':
(when (LaTeX-provided-package-options-member "FiraMono" "type1")
(TeX-run-style-hooks "fontaxes"))
;; Macros:
(TeX-add-symbols
'("sufigures" -1)
'("firamonooldstyle" -1)
'("firamonolining" -1)
'("firamonomedium" -1))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("sufigures" "")
("firamonooldstyle" "")
("firamonolining" "")
("firamonomedium" ""))
'type-declaration)))
LaTeX-dialect)
(defvar LaTeX-FiraMono-package-options '("scaled" "scale"
"type1"
"lining" "lf"
"oldstyle" "osf"
"nomap"
"medium" "mb")
"Package options for the FiraMono package.")
;;; FiraMono.el ends here

View File

@@ -0,0 +1,102 @@
;;; FiraSans.el --- AUCTeX style for `FiraSans.sty' (v2016/11/20)
;; Copyright (C) 2016 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2016-11-11
;; 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 `FiraSans.sty' (v2016/11/20).
;; `FiraSans.sty' is part of TeXLive.
;;; Code:
(TeX-add-style-hook
"FiraSans"
(lambda ()
;; `textcomp' is always loaded:
(TeX-run-style-hooks "textcomp")
;; If package option `type1' is given, load `fontaxes':
(when (LaTeX-provided-package-options-member "FiraSans" "type1")
(TeX-run-style-hooks "fontaxes"))
;; Macros:
(TeX-add-symbols
'("sufigures" -1)
'("firaoldstyle" -1)
'("firalining" -1)
'("firatabular" -1)
'("firaproportional" -1)
'("firathin" -1)
'("firalight" -1)
'("firaextralight" -1)
'("firaultralight" -1)
'("firamedium" -1)
'("firabook" -1)
'("firasemibold" -1)
'("firaextrabold" -1)
'("firaheavy" -1))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("sufigures" "")
("firaoldstyle" "")
("firalining" "")
("firatabular" "")
("firaproportional" "")
("firathin" "")
("firalight" "")
("firaextralight" "")
("firaultralight" "")
("firamedium" "")
("firabook" "")
("firasemibold" "")
("firaextrabold" "")
("firaheavy" ""))
'type-declaration)))
LaTeX-dialect)
(defvar LaTeX-FiraSans-package-options
'("scaled" "scale"
"type1"
"lining" "lf"
"oldstyle" "osf"
"tabular" "t"
"proportional" "p"
"book"
"medium" "mb"
"semibold" "sb"
"light" "l"
"extralight"
"ultralight"
"thin"
"extrabold"
"heavy"
"default"
"sfdefault")
"Package options for the FiraSans package.")
;;; FiraSans.el ends here

View File

@@ -0,0 +1,69 @@
;;; MinionPro.el -- AUCTeX style for MinionPro.sty
;; Copyright (C) 2005, 2014 Free Software Foundation, Inc.
;; Author: Mark Trettin <Mark.Trettin@gmx.de>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2005-11-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 `MinionPro.sty' (v2.3) from 2012/08/03.
;; The latest version of MinionPro is available as part of FontPro
;; bundle from <https://www.github.com/sebschub>.
;;; Code:
(TeX-add-style-hook
"MinionPro"
(lambda ()
;; New symbols
(TeX-add-symbols
'("smallfrac" "Numerator" "Denominator")
'("slantfrac" "Numerator" "Denominator"))
;; Run style hook for amsmath which is loaded via MnSymbol
(TeX-run-style-hooks "amsmath" "fontaxes" "textcomp")
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("smallfrac" "{{")
("slantfrac" "{{"))
'textual)))
LaTeX-dialect)
(defvar LaTeX-MinionPro-package-options
'("smallfamily" "medfamily" "fullfamily" "noopticals" "opticals"
"slides" "textosf" "mathosf" "osf" "textlf" "mathlf" "lf"
"mathtabular" "mnsy" "cmsy" "swash" "abx" "amsbb" "fourierbb"
"lucidabb" "mixedgreek" "italicgreek" "frenchmath" "minionint"
"footnotefigures"
;; Additional options in v2.1
"onlytext" "onlymath" "loosequotes" "openg" "normalsize" "nonormalsize"
;; Additional option in v2.2
"scale")
"Package options for the MinionPro package.")
;;; MinionPro.el ends here

View File

@@ -0,0 +1,94 @@
;;; MyriadPro.el --- AUCTeX style for `MyriadPro.sty' (v0.5)
;; Copyright (C) 2014 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2014-10-21
;; 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 `MyriadPro.sty' (v0.5) from 2013/04/20.
;; The latest version of MyriadPro is available as part of FontPro
;; bundle from <https://www.github.com/sebschub>. `MyriadPro.sty' is
;; not part of TeXLive.
;;; Code:
(TeX-add-style-hook
"MyriadPro"
(lambda ()
;; Run style hook for various packages loaded by MyriadPro
(TeX-run-style-hooks "textcomp" "amsmath" "fontaxes" "mdsymbol")
;; New symbols
(TeX-add-symbols
'("smallfrac" "Numerator" "Denominator")
'("slantfrac" "Numerator" "Denominator")
'("boldsymbol" "Symbol"))
;; More control over spacing in `\slantfrac':
(LaTeX-add-lengths "MdSlantfracSpacingBeforeSlash"
"MdSlantfracSpacingAfterSlash")
;; `\mathversion' is available with sansmath option
(when (LaTeX-provided-package-options-member "MyriadPro" "sansmath")
(TeX-add-symbols
'("mathversion"
(TeX-arg-eval completing-read "Math version: "
'(("sans") ("sansbold")
("sanstabular") ("sansboldtabular"))))))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("smallfrac" "{{")
("slantfrac" "{{"))
'textual)
(font-latex-add-keywords '(("mathversion" "{"))
'variable)))
LaTeX-dialect)
(defvar LaTeX-MyriadPro-package-options
'(;; Font selection
"smallfamily" "medfamily" "onlytext" "onlymath" "math" "sansmath"
;; Figure selection
"textosf" "mathosf" "osf" "textlf" "mathlf" "lf" "mathtabular"
;; Calligraphic fonts
"cmsy" "swash" "abx"
;; Blackboard bold letters
"amsbb" "fourierbb" "lucidabb"
;; Greek letters
"mixedgreek" "italicgreek" "frenchmath"
;; Miscellaneous options
"scale" "loosequotes" "footnotefigures"
;; Additional mathversions
"sansmath")
"Package options for the MyriadPro package.")
;;; MyriadPro.el ends here

View File

@@ -0,0 +1,76 @@
;;; XCharter.el --- AUCTeX style for `XCharter.sty' (v1.05)
;; Copyright (C) 2014 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2014-10-30
;; 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 `XCharter.sty' (v1.05) from 2014/07/03.
;; `XCharter.sty' is part of TeXLive.
;;; Code:
(TeX-add-style-hook
"XCharter"
(lambda ()
;; Run style hook for various packages loaded by XCharter
(TeX-run-style-hooks "textcomp" "fontaxes")
;; New symbols
(TeX-add-symbols
;; Only preamble commands
'("useosf" 0)
'("useosfI" 0)
;; Text commands
'("textsu" t) ; superior figures
'("sustyle" -1) ;
'("textlf" t) ; lining figures
'("lfstyle" -1) ;
'("textosf" t) ; oldstyle figures
'("textosfI" t) ; oldstyle figures alternate
'("osfstyle" -1)) ; whatever oldstyle option is in force
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("textsu" "{")
("textlf" "{")
("textosf" "{")
("textosfI" "{"))
'type-command)
(font-latex-add-keywords '(("sustyle" "")
("lfstyle" "")
("osfstyle" ""))
'type-declaration)))
LaTeX-dialect)
(defvar LaTeX-XCharter-package-options
'("lining" "lf" "oldstyle" "osf" "oldstyleI" "osfI"
"scaled" "sups")
"Package options for the XCharter package.")
;;; XCharter.el ends here

View File

@@ -0,0 +1,294 @@
;;; acro.el --- AUCTeX style for `acro.sty' version 1.2a.
;; Copyright (C) 2013-2015 Free Software Foundation, Inc.
;; Maintainer: auctex-devel@gnu.org
;; Author: Mosè Giordano <giordano.mose@libero.it>
;; 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 `acro.sty' version 1.2a.
;;; Code:
(require 'tex) ;Indispensable when compiling the call to `TeX-auto-add-type'.
(defvar LaTeX-acro-package-options-list
'(;; General Options
("version" ("0" "1"))
("single" ("true" "false"))
("hyperref" ("true" "false"))
("record-pages" ("true" "false"))
("only-used" ("true" "false"))
("mark-as-used" ("first" "any"))
("macros" ("true" "false"))
("xspace" ("true" "false"))
("strict" ("true" "false"))
("sort" ("true" "false"))
("cite" ("all" "first" "none"))
("cite-cmd")
("cite-space")
("index-cmd")
("accsupp" ("true" "false"))
("uc-cmd")
;; Options Regarding Acronyms
("short-format")
("long-format")
("first-long-format")
("list-short-format")
("list-long-format")
("extra-format")
("first-style" ("default" "plain" "empty" "square" "short" "reversed"
"plain-reversed" "footnote" "sidenote"))
("extra-style" ("default" "plain" "comma" "paren" "bracket"))
("plural-ending")
;; Options Regarding the List
("page-ref" ("none" "plain" "comma" "paren"))
("page-name")
("pages-name")
("page-ranges" ("true" "false"))
("next-page")
("next-pages")
("list-type" ("table" "itemize" "description"))
("list-style" ("list" "tabular" "longtable" "extra-tabular" "extra-longtable"
"extra-tabular-rev" "extra-longtable-rev"))
("list-header" ("chapter" "chapter*" "section" "section*" "subsection"
"subsection*" "addchap" "addsec"))
("list-name")
("list-table-width")
("list-caps" ("true" "false")))
"Package options for the acro package.")
(TeX-auto-add-type "acro-acronym" "LaTeX")
;; Self Parsing -- see (info "(auctex)Hacking the Parser").
(defvar LaTeX-acro-regexp
(concat "\\\\DeclareAcronym" "{\\([^\n\r%\\{}]+\\)}")
"Matches `acro' acronym definitions.")
(defvar LaTeX-auto-acro-acronym nil
"Temporary for parsing `acro' acronym definitions.")
(defun LaTeX-acro-prepare ()
"Clear `LaTex-auto-acro-acronym' before use."
(setq LaTeX-auto-acro-acronym nil))
(defun LaTeX-acro-cleanup ()
"Move acronyms from `LaTeX-auto-acro-acronym' to
`LaTeX-acro-list' and to `TeX-auto-symbol' if option `macros' is
set to `true'."
(mapc (lambda (acronym)
(add-to-list 'LaTeX-acro-acronym-list (list acronym)))
LaTeX-auto-acro-acronym)
(when (or (LaTeX-provided-package-options-member "acro" "macros")
(LaTeX-provided-package-options-member "acro" "macros=true"))
(add-to-list 'TeX-auto-symbol LaTeX-auto-acro-acronym)))
(add-hook 'TeX-auto-prepare-hook #'LaTeX-acro-prepare t)
(add-hook 'TeX-auto-cleanup-hook #'LaTeX-acro-cleanup t)
(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
(defvar LaTeX-acro-acronym-history nil
"History of acronyms in acro.")
(defun LaTeX-arg-acro-acronym (optional &optional prompt definition)
"Prompt for an acronym completing with known acronyms.
If OPTIONAL is non-nil, insert the resulting value as an optional
argument, otherwise as a mandatory one. Use PROMPT as the prompt
string. If DEFINITION is non-nil, add the chosen acronym to the
list of defined acronyms."
(let ((acronym (completing-read (TeX-argument-prompt optional prompt "Acronym")
(LaTeX-acro-acronym-list) nil nil nil
'LaTeX-acro-acronym-history)))
(if (and definition (not (string-equal "" acronym)))
(LaTeX-add-acro-acronyms acronym))
(TeX-argument-insert acronym optional optional)))
(defun LaTeX-arg-define-acro-acronym (optional &optional prompt)
"Prompt for an acronym completing with known acronyms.
If OPTIONAL is non-nil, insert the resulting value as an optional
argument, otherwise as a mandatory one. Use PROMPT as the prompt
string."
(LaTeX-arg-acro-acronym optional prompt t))
(defvar LaTeX-acro-declareacronym-keys
'(("short") ("long") ("short-plural") ("long-plural") ("long-plural-form")
("short-indefinite") ("long-indefinite") ("long-pre") ("long-post") ("alt")
("alt-indefinite") ("extra") ("sort") ("class") ("cite") ("short-format")
("long-format") ("first-long-format") ("pdfstring") ("accsupp")
("index-sort") ("index") ("index-cmd"))
"List of keys accepted by `\DeclareAcronym' macro of `acro' package
in its second mandatory argument.")
(defvar LaTeX-acro-printacronyms-keys
'(("include-classes") ("exclude-classes") ("name") ("header"))
"List of keys accepted by `\printacronyms' macro of `acro' package
in its optional argument.")
(defun LaTeX-arg-acro-key-val (optional prompt key-val-alist)
"Prompt for keys and values in KEY-VAL-ALIST.
<SPC> key binding in minibuffer is removed temporarily. Insert
the given value as a TeX macro argument. If OPTIONAL is non-nil,
insert it as an optional argument. Use PROMPT as the prompt
string. KEY-VAL-ALIST is an alist. The car of each element
should be a string representing a key and the optional cdr should
be a list with strings to be used as values for the key."
;; Remove <SPC> key binding from map used in `multi-prompt-key-value' (called
;; by `TeX-arg-key-val') with `require-match' set to `nil'.
(let ((crm-local-completion-map
(remove (assoc 32 crm-local-completion-map) crm-local-completion-map)))
(TeX-arg-key-val optional key-val-alist prompt)))
(TeX-add-style-hook
"acro"
(lambda ()
(TeX-auto-add-regexp `(,LaTeX-acro-regexp 1 LaTeX-auto-acro-acronym))
(TeX-add-symbols
;; Creating New Acronyms
'("DeclareAcronym" LaTeX-arg-define-acro-acronym
(LaTeX-arg-acro-key-val "Definition of acronym (k=v)"
LaTeX-acro-declareacronym-keys))
;; Using the Acronyms
'("ac" LaTeX-arg-acro-acronym)
'("ac*" LaTeX-arg-acro-acronym)
'("Ac" LaTeX-arg-acro-acronym)
'("Ac*" LaTeX-arg-acro-acronym)
'("acs" LaTeX-arg-acro-acronym)
'("acs*" LaTeX-arg-acro-acronym)
'("acl" LaTeX-arg-acro-acronym)
'("acl*" LaTeX-arg-acro-acronym)
'("Acl" LaTeX-arg-acro-acronym)
'("Acl*" LaTeX-arg-acro-acronym)
'("aca" LaTeX-arg-acro-acronym)
'("aca*" LaTeX-arg-acro-acronym)
'("acf" LaTeX-arg-acro-acronym)
'("acf*" LaTeX-arg-acro-acronym)
'("Acf" LaTeX-arg-acro-acronym)
'("Acf*" LaTeX-arg-acro-acronym)
'("acp" LaTeX-arg-acro-acronym)
'("acp*" LaTeX-arg-acro-acronym)
'("Acp" LaTeX-arg-acro-acronym)
'("Acp*" LaTeX-arg-acro-acronym)
'("acsp" LaTeX-arg-acro-acronym)
'("acsp*" LaTeX-arg-acro-acronym)
'("aclp" LaTeX-arg-acro-acronym)
'("aclp*" LaTeX-arg-acro-acronym)
'("Aclp" LaTeX-arg-acro-acronym)
'("Aclp*" LaTeX-arg-acro-acronym)
'("acap" LaTeX-arg-acro-acronym)
'("acap*" LaTeX-arg-acro-acronym)
'("acfp" LaTeX-arg-acro-acronym)
'("acfp*" LaTeX-arg-acro-acronym)
'("Acfp" LaTeX-arg-acro-acronym)
'("Acfp*" LaTeX-arg-acro-acronym)
;; Indefinite Forms
'("iac" LaTeX-arg-acro-acronym)
'("iac*" LaTeX-arg-acro-acronym)
'("Iac" LaTeX-arg-acro-acronym)
'("Iac*" LaTeX-arg-acro-acronym)
'("iacs" LaTeX-arg-acro-acronym)
'("iacs*" LaTeX-arg-acro-acronym)
'("Iacs" LaTeX-arg-acro-acronym)
'("Iacs*" LaTeX-arg-acro-acronym)
'("iaca" LaTeX-arg-acro-acronym)
'("iaca*" LaTeX-arg-acro-acronym)
'("Iaca" LaTeX-arg-acro-acronym)
'("Iaca*" LaTeX-arg-acro-acronym)
'("iacl" LaTeX-arg-acro-acronym)
'("iacl*" LaTeX-arg-acro-acronym)
'("Iacl" LaTeX-arg-acro-acronym)
'("Iacl*" LaTeX-arg-acro-acronym)
'("iacf" LaTeX-arg-acro-acronym)
'("iacf*" LaTeX-arg-acro-acronym)
'("Iacf" LaTeX-arg-acro-acronym)
'("Iacf*" LaTeX-arg-acro-acronym)
'("iacflike" LaTeX-arg-acro-acronym)
'("iacflike*" LaTeX-arg-acro-acronym)
'("Iacflike" LaTeX-arg-acro-acronym)
'("Iacflike*" LaTeX-arg-acro-acronym)
;; Simulating the First Appearance
'("acflike" LaTeX-arg-acro-acronym)
'("acflike*" LaTeX-arg-acro-acronym)
'("acfplike" LaTeX-arg-acro-acronym)
'("acfplike*" LaTeX-arg-acro-acronym)
;; Reset or Mark as Used
'("acreset" "List of acronyms")
'("acresetall" 0)
'("acuse" "List of acronyms")
'("acuseall" 0)
;; PDF bookmarks
'("acpdfstring" LaTeX-arg-acro-acronym)
'("acpdfstringplural" LaTeX-arg-acro-acronym)
;; Printing the List
'("printacronyms" [LaTeX-arg-acro-key-val nil LaTeX-acro-printacronyms-keys])
;; Customization
'("acsetup" (TeX-arg-key-val LaTeX-acro-package-options-list)))
(TeX-run-style-hooks
"l3sort"
"xspace"
"xtemplate"
"l3keys2e"
"xparse"
"expl3")
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("DeclareAcronym" "{{")
("ac" "*{")
("Ac" "*{")
("acs" "*{")
("acl" "*{")
("Acl" "*{")
("aca" "*{")
("acf" "*{")
("Acf" "*{")
("acp" "*{")
("Acp" "*{")
("acsp" "*{")
("aclp" "*{")
("Aclp" "*{")
("acap" "*{")
("acfp" "*{")
("Acfp" "*{")
("acflike" "*{")
("acfplike" "*{")
("iac" "*{")
("Iac" "*{")
("iacs" "*{")
("Iacs" "*{")
("iaca" "*{")
("Iaca" "*{")
("iacl" "*{")
("Iacl" "*{")
("iacf" "*{")
("Iacf" "*{")
("iacflike" "*{")
("Iacflike" "*{")
("acuse" "{"))
'function)))
LaTeX-dialect)
(defun LaTeX-acro-package-options ()
"Prompt for package options for the acro package."
(TeX-read-key-val t LaTeX-acro-package-options-list))
;;; acro.el ends here

View File

@@ -0,0 +1,179 @@
;;; acronym.el --- AUCTeX style for `acronym.sty' version 1.38.
;; Copyright (C) 2013-2015 Free Software Foundation, Inc.
;; Maintainer: auctex-devel@gnu.org
;; Author: Mosè Giordano <giordano.mose@libero.it>
;; 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 `acronym.sty' version 1.38.
;;; Code:
(require 'tex) ;Indispensable when compiling the call to `TeX-auto-add-type'.
(TeX-auto-add-type "acronym" "LaTeX")
;; Self Parsing -- see (info "(auctex)Hacking the Parser").
(defvar LaTeX-acronym-regexp
(concat "\\\\\\(?:acro\\|newacro\\|acrodef\\)" "{\\([^\n\r%\\{}]+\\)}")
"Matches acronyms by `acronym' package.")
(defvar LaTeX-auto-acronym nil
"Temporary for parsing acronym by `acronym' package.")
(defun LaTeX-acronym-prepare ()
"Clear `LaTex-auto-acronym' before use."
(setq LaTeX-auto-acronym nil))
(defun LaTeX-acronym-cleanup ()
"Move acronyms from `LaTeX-auto-acronym' to `LaTeX-acronym-list'."
(mapc (lambda (acronym)
(add-to-list 'LaTeX-acronym-list (list acronym)))
LaTeX-auto-acronym))
(add-hook 'TeX-auto-prepare-hook #'LaTeX-acronym-prepare t)
(add-hook 'TeX-auto-cleanup-hook #'LaTeX-acronym-cleanup t)
(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
(defvar LaTeX-acronym-acronym-history nil
"History of acronyms in acronym.")
;; The former `acronym' stands for package name, the latter stands for the
;; argument of the macro calling this function.
(defun LaTeX-arg-acronym-acronym (optional &optional prompt definition)
"Prompt for an acronym completing with known acronyms.
If OPTIONAL is non-nil, insert the resulting value as an optional
argument, otherwise as a mandatory one. Use PROMPT as the prompt
string. If DEFINITION is non-nil, add the chosen acronym to the
list of defined acronyms."
(let ((acronym (completing-read (TeX-argument-prompt optional prompt "Acronym")
(LaTeX-acronym-list) nil nil nil
'LaTeX-acronym-acronym-history)))
(if (and definition (not (string-equal "" acronym)))
(LaTeX-add-acronyms acronym))
(TeX-argument-insert acronym optional optional)))
(defun LaTeX-arg-define-acronym-acronym (optional &optional prompt)
"Prompt for an acronym completing with known acronyms.
If OPTIONAL is non-nil, insert the resulting value as an optional
argument, otherwise as a mandatory one. Use PROMPT as the prompt
string."
(LaTeX-arg-acronym-acronym optional prompt t))
(TeX-add-style-hook
"acronym"
(lambda ()
(TeX-auto-add-regexp `(,LaTeX-acronym-regexp 1 LaTeX-auto-acronym))
(LaTeX-add-environments
'("acronym" LaTeX-env-args
[TeX-arg-string "Longest acronym"]))
(TeX-add-symbols
;; Acronyms in the Text
'("ac" LaTeX-arg-acronym-acronym)
'("acresetall" 0)
'("acf" LaTeX-arg-acronym-acronym)
'("acs" LaTeX-arg-acronym-acronym)
'("acl" LaTeX-arg-acronym-acronym)
'("acp" LaTeX-arg-acronym-acronym)
'("acfp" LaTeX-arg-acronym-acronym)
'("acsp" LaTeX-arg-acronym-acronym)
'("aclp" LaTeX-arg-acronym-acronym)
'("acfi" LaTeX-arg-acronym-acronym)
'("acused" LaTeX-arg-acronym-acronym)
'("acsu" LaTeX-arg-acronym-acronym)
'("aclu" LaTeX-arg-acronym-acronym)
'("iac" LaTeX-arg-acronym-acronym)
'("Iac" LaTeX-arg-acronym-acronym)
'("ac*" LaTeX-arg-acronym-acronym)
'("acf*" LaTeX-arg-acronym-acronym)
'("acs*" LaTeX-arg-acronym-acronym)
'("acl*" LaTeX-arg-acronym-acronym)
'("acp*" LaTeX-arg-acronym-acronym)
'("acfp*" LaTeX-arg-acronym-acronym)
'("acsp*" LaTeX-arg-acronym-acronym)
'("aclp*" LaTeX-arg-acronym-acronym)
'("acfi*" LaTeX-arg-acronym-acronym)
'("acsu*" LaTeX-arg-acronym-acronym)
'("aclu*" LaTeX-arg-acronym-acronym)
'("iac*" LaTeX-arg-acronym-acronym)
'("Iac*" LaTeX-arg-acronym-acronym)
;; Customization
'("acsfont" 1)
'("acffont" 1)
'("acfsfont" 1)
;; Defining Acronyms
'("acro" LaTeX-arg-define-acronym-acronym [ "Short name" ] "Full name")
'("acroextra" "Additional info")
'("newacro" LaTeX-arg-define-acronym-acronym [ "Short name" ] "Full name")
'("acrodef" LaTeX-arg-define-acronym-acronym [ "Short name" ] "Full name")
;; Non standard indefinite articles
'("acroindefinite" LaTeX-arg-acronym-acronym
"Short indefinite article" "Long indefinite article")
'("acrodefindefinite" LaTeX-arg-acronym-acronym
"Short indefinite article" "Long indefinite article")
'("newacroindefinite" LaTeX-arg-acronym-acronym
"Short indefinite article" "Long indefinite article")
;; Non standard and foreign plural forms
'("acroplural" LaTeX-arg-acronym-acronym [ "Short plural" ] "Long plural")
'("acrodefplural" LaTeX-arg-acronym-acronym [ "Short plural" ] "Long plural")
'("newacroplural" LaTeX-arg-acronym-acronym [ "Short plural" ] "Long plural"))
(TeX-run-style-hooks
"relsize"
"xstring"
"suffix")
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("ac" "*{")
("acf" "*{")
("acs" "*{")
("acl" "*{")
("acp" "*{")
("acfp" "*{")
("acsp" "*{")
("aclp" "*{")
("acfi" "*{")
("acused" "{")
("acsu" "*{")
("aclu" "*{")
("iac" "*{")
("Iac" "*{")
("acro" "{[{")
("acroextra" "{")
("newacro" "{[{")
("acrodef" "{[{")
("acroindefinite" "{{{")
("acrodefindefinite" "{{{")
("newacroindefinite" "{{{")
("acroplural" "{[{")
("acrodefplural" "{[{")
("newacroplural" "{[{"))
'function)))
LaTeX-dialect)
(defvar LaTeX-acronym-package-options
'("footnote" "nohyperlinks" "printonlyused" "withpage" "smaller" "dua" "nolist")
"Package options for the acronym package.")
;; acronym.el ends here

View File

@@ -0,0 +1,43 @@
;;; afterpage.el --- AUCTeX style for `afterpage.sty'
;; Copyright (C) 2013 Free Software Foundation, Inc.
;; Author: Mads Jensen <mje@inducks.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2013-01-01
;; 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 `afterpage.sty'
;;; Code:
(TeX-add-style-hook
"afterpage"
(lambda ()
(TeX-add-symbols
'("afterpage" t)))
LaTeX-dialect)
(defvar LaTeX-afterpage-package-options nil
"Package options for afterpage.")
;; afterpage.el ends here

View File

@@ -0,0 +1,50 @@
;;; alltt.el --- AUCTeX style for `alltt.sty'
;; Copyright (C) 2004, 2005, 2014, 2016 Free Software Foundation, Inc.
;; Author: Ralf Angeli <angeli@iwi.uni-sb.de>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2004-04-30
;; 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 `alltt.sty'.
;;; Code:
(TeX-add-style-hook
"alltt"
(lambda ()
(LaTeX-add-environments "alltt")
(add-to-list (make-local-variable 'LaTeX-indent-environment-list)
'("alltt" current-indentation) t)
(add-to-list 'LaTeX-verbatim-environments-local "alltt")
;; Fontification
(when (and (fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
;; Tell font-lock about the update.
(font-latex-update-font-lock t)))
LaTeX-dialect)
(defvar LaTeX-alltt-package-options nil
"Package options for the alltt package.")
;;; alltt.el ends here

View File

@@ -0,0 +1,100 @@
;;; alphanum.el --- AUCTeX style for `alphanum.sty'
;; Copyright (C) 2004 Free Software Foundation, Inc.
;; Author: Frank K<>ster <frank@kuesterei.ch>
;; Maintainer: auctex-devel@gnu.org
;; 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 is file alphanum.el, which makes AUCTeX usable with jura.cls
;; and its style file alphanum.sty.
;;
;; Contributed by Frank K<>ster <frank@kuesterei.ch>. The code for
;; reftex has been written by Carsten Dominik, the maintainer of
;; reftex, but all the errors are mine.
;;; Code:
(defun TeX-arg-none (arg)
(insert " "))
(defun reftex-get-section-level-alphanum ()
(save-excursion ; preserve position
(save-match-data ; preserve matching data (important!)
;; Go back to the beginning of the sectioning command
(goto-char (match-beginning 0))
;; Define an initial level number, depending on the current macro.
(let* ((macro (reftex-match-string 3)) ; "toc" or "sub"
(lev (cond ((string= macro "toc") 1) ; min level for "toc"
((string= macro "sub") 2) ; min level for "sub"
(t 0)))
;; Make a regular expression which will match sectioning commands
;; and the levelup macro.
(re (concat "\\(^[^%]*\\\\levelup\\>\\)"
"\\|"
"\\(" reftex-section-regexp "\\)")))
;; Now parse backwards for all sectioning and levelup macros,
;; and keep track of the relative level changes.
(while (re-search-backward re nil t)
(cond
((match-beginning 1)
;; levelup matched, reduce level counter
(setq lev (1- lev)))
((string= (reftex-match-string 4) "toc")
;; a toc entry, nothing changes
)
((string= (reftex-match-string 4) "sub")
;; a sub entry, increase level counter
(setq lev (1+ lev)))))
;; return the level
lev))))
(TeX-add-style-hook
"alphanum"
(lambda ()
(LaTeX-largest-level-set "chapter")
(TeX-add-symbols '("levelup" TeX-arg-none))
(make-local-variable 'LaTeX-section-list)
(LaTeX-section-list-add-locally
'(("part" 0)
;; the levels don't make sense with alphanum, I randomly chose 0...
("toc" 0)
("sub" 0)) t)
(setq LaTeX-section-label
'(("part" . "part:")
("toc" . "sec:")
("sub" . "sec:")))
;;
;; ****************** reftex part ******************
;; this won't work in multifile documents, but at least there is
;; something.
(if (fboundp 'reftex-add-section-levels)
(reftex-add-section-levels
'(("toc" . reftex-get-section-level-alphanum)
("sub" . reftex-get-section-level-alphanum)))))
LaTeX-dialect)
;; Local Variables:
;; coding: iso-8859-1
;; End:

View File

@@ -0,0 +1,12 @@
;;; amsart.el --- Style hook for the AMS-LaTeX article document class.
;;; Code:
(TeX-add-style-hook "amsart"
(function
(lambda ()
(TeX-run-style-hooks "amsmath" "amsthm")
(LaTeX-add-environments "abstract")))
LaTeX-dialect)
;;; amsart.el ends here.

View File

@@ -0,0 +1,12 @@
;;; amsbook.el --- Style hook for the AMS-LaTeX book document class.
;;; Code:
(TeX-add-style-hook "amsbook"
(function
(lambda ()
(TeX-run-style-hooks "amsmath" "amsthm")
(LaTeX-add-environments "abstract")))
LaTeX-dialect)
;;; amsbook.el ends here.

View File

@@ -0,0 +1,19 @@
;;; amsbsy.el --- Style hook for the AMS-LaTeX amsbsy package.
;;;
;;; AUTHOR: Carsten Dominik <dominik@strw.leidenuniv.nl>
;;; Code:
(TeX-add-style-hook "amsbsy"
(function
(lambda ()
(TeX-add-symbols
'("boldsymbol" "Symbol")
'("pmb" "Symbol")
)))
LaTeX-dialect)
(defvar LaTeX-amsbsy-package-options nil
"Package options for the amsbsy package.")
;;; amsbsy.el ends here.

View File

@@ -0,0 +1,53 @@
;;; amsfonts.el --- AUCTeX style for `amsfonts.sty' version 3.01
;; Copyright (C) 2016 Free Software Foundation, Inc.
;; Maintainer: auctex-devel@gnu.org
;; Author: Mosè Giordano <mose@gnu.org>
;; 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 `amsfonts.sty' version 3.01.
;;; Code:
(TeX-add-style-hook
"amsfonts"
(lambda ()
(TeX-add-symbols
'("bold" 1))
;; New math font by `amsfonts'.
(setq TeX-font-list
(append
TeX-font-list
'((?\C-k "" "" "\\mathfrak{" "}"))))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("bold" "{"))
'bold-command)))
LaTeX-dialect)
;; The `psamsfonts' option is obsolete in AMSFonts v3
(defvar LaTeX-amsfonts-package-options nil
"Package options for the amsfonts package.")
;;; amsfonts.el ends here.

View File

@@ -0,0 +1,229 @@
;;; amsmath.el --- Style hook for the AMS-LaTeX amsmath package.
;; Copyright (C) 2002, 2005-2007, 2012-2014 Free Software Foundation, Inc.
;; FIXME: What about the copyright for <= 2001?
;; Author: Carsten Dominik <dominik@strw.leidenuniv.nl>
;; Maintainer: auctex-devel@gnu.org
;; 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 will also load the amstext, amsbsy and amsopn style files.
;;; Code:
(TeX-add-style-hook "amsmath"
(function
(lambda ()
(LaTeX-add-environments
'("align" LaTeX-env-label)
'("gather" LaTeX-env-label)
'("flalign" LaTeX-env-label)
'("multline" LaTeX-env-label)
'("alignat" LaTeX-amsmath-env-alignat)
'("alignat*" LaTeX-amsmath-env-alignat)
'("xalignat" LaTeX-amsmath-env-alignat)
'("xalignat*" LaTeX-amsmath-env-alignat)
'("xxalignat" LaTeX-amsmath-env-alignat)
'("aligned" ["Vertical position (t or b)"])
'("gathered" ["Vertical position (t or b)"])
'("alignedat" LaTeX-amsmath-env-alignedat)
"align*" "gather*" "flalign*" "multline*" "equation*"
"split"
"cases"
"matrix" "smallmatrix" "pmatrix" "bmatrix" "Bmatrix" "vmatrix" "Vmatrix"
"subequations"
'("subarray" "Alignment"))
(TeX-add-symbols
'("eqref" TeX-arg-ref)
'("numberwithin" TeX-arg-counter "Section level")
'("raisetag" "Dimension")
'("shoveright" t) '("shoveleft" t)
'("intertext" t)
'("hdotsfor" ["Stretch"] "Number of columns to cover")
'("xleftarrow" ["Below"] "Above")
'("xrightarrow" ["Below"] "Above")
'("overset" "Accent symbol" "Symbol")
'("underset" "Accent symbol" "Symbol")
'("dfrac" 2)
'("tfrac" 2)
'("binom" 2)
'("dbinom" 2)
'("tbinom" 2)
'("genfrac" "Left delimiter" "Right delimiter" "Thickness"
"Mathstyle" 2)
'("cfrac" ["position (l or r)"] t)
'("smash" ["where (t or b)"] t)
'("sideset" "Left" "Right")
'("tag" "(Tag)")
'("tag*" "Tag")
'("displaybreak" ["Weight (0..4)"])
'("allowdisplaybreaks" ["Weight (1..4)"])
'("substack" t)
'("leftroot" "Push root index left by")
'("uproot" "Push root index upward by")
'("boxed" t)
'("mspace" t)
'("mod" t)
'("pmod" t)
'("pod" t)
'("overleftrightarrow" t)
'("underleftarrow" t)
'("underrightarrow" t)
'("underleftrightarrow" t)
'("dddot" t)
'("ddddot" t)
"bmod" "notag"
"dots" "dotsb" "dotsc" "dotsi" "dotsm" "dotso" "nobreakdash"
'("lvert" TeX-arg-insert-right-brace-maybe)
'("lVert" TeX-arg-insert-right-brace-maybe)
"rvert" "rVert"
"iint" "iiint" "iiiint" "idotsint"
)
(setq LaTeX-item-list
(append '(("split" . LaTeX-item-equation)
("multline" . LaTeX-item-equation)
("multline*" . LaTeX-item-equation)
("gather" . LaTeX-item-equation)
("gather*" . LaTeX-item-equation)
("gathered" . LaTeX-item-equation)
("align" . LaTeX-item-equation)
("align*" . LaTeX-item-equation)
("aligned" . LaTeX-item-equation)
("alignat" . LaTeX-item-equation-alignat)
("alignat*" . LaTeX-item-equation-alignat)
("xalignat" . LaTeX-item-equation-alignat)
("xalignat*" . LaTeX-item-equation-alignat)
("xxalignat" . LaTeX-item-equation-alignat)
("alignedat" . LaTeX-item-equation-alignat)
("flalign" . LaTeX-item-equation)
("flalign*" . LaTeX-item-equation)
("matrix" . LaTeX-item-equation)
("pmatrix" . LaTeX-item-equation)
("bmatrix" . LaTeX-item-equation)
("Bmatrix" . LaTeX-item-equation)
("vmatrix" . LaTeX-item-equation)
("Vmatrix" . LaTeX-item-equation)
("subarray" . LaTeX-item-equation)
("cases" . LaTeX-item-equation))
LaTeX-item-list))
;; When `LaTeX-amsmath-label' is nil, use value of LaTeX-equation-label:
(unless LaTeX-amsmath-label
(setq LaTeX-amsmath-label LaTeX-equation-label))
(setq LaTeX-label-alist
;; Append amsmath environments to `LaTeX-label-alist', in order not to
;; override possible custome values.
(append LaTeX-label-alist
'(("align" . LaTeX-amsmath-label)
("alignat" . LaTeX-amsmath-label)
("xalignat" . LaTeX-amsmath-label)
("multline" . LaTeX-amsmath-label)
("flalign" . LaTeX-amsmath-label)
("gather" . LaTeX-amsmath-label))))
(set (make-local-variable 'TeX-braces-association)
(append '(("\\lvert" . "\\rvert")
("\\lVert" . "\\rVert"))
TeX-braces-association))
(set (make-local-variable 'TeX-left-right-braces)
(append '(("\\lvert") ("\\rvert") ("\\lVert") ("\\rVert"))
TeX-left-right-braces))
;; amsmath includes amstext, amsbsy, & amsopn.
;; So we run their hooks, too.
(TeX-run-style-hooks "amstext" "amsbsy" "amsopn")
;; If RefTeX is loaded, make it recognize the amsmath environments.
(when (fboundp 'reftex-add-to-label-alist)
(reftex-add-to-label-alist '(AMSTeX)))))
LaTeX-dialect)
(defun LaTeX-amsmath-env-alignat (env)
"Insert ENV with column number specifications.
Insert suitable number of ampersands also if possible."
(let ((ncols (TeX-read-string "Number of columns: ")))
(LaTeX-insert-environment env (concat TeX-grop ncols TeX-grcl))
(LaTeX-item-equation-alignat t)))
(defun LaTeX-amsmath-env-alignedat (env)
"Insert ENV with position and column number specifications.
Insert suitable number of ampersands also if possible."
(let ((where (TeX-read-string "(Optional) Vertical position (t or b): "))
(ncols (TeX-read-string "Number of columns: ")))
(unless (string= where "")
(setq where (concat LaTeX-optop where LaTeX-optcl)))
(LaTeX-insert-environment env (concat where TeX-grop ncols TeX-grcl))
(LaTeX-item-equation-alignat t)))
(defun LaTeX-item-equation (&optional suppress)
"Insert contents to terminate a line in multi-line equations environment.
Put line break macro on the last line. If the current environment
wants \\label, insert it also.
If SUPPRESS is non-nil, do not insert line break macro."
(unless suppress
(end-of-line 0)
(just-one-space)
(TeX-insert-macro "\\")
(forward-line 1)
(indent-according-to-mode))
(let ((env (LaTeX-current-environment)))
(when (and (assoc env LaTeX-label-alist)
(LaTeX-label env 'environment))
(LaTeX-newline)
(indent-according-to-mode))))
(defun LaTeX-item-equation-alignat (&optional suppress)
"Insert contents to terminate a line in multi-line equations environment.
Put line break macro on the last line. Next, if the current
environment wants \\label, insert it also. And insert suitable number
of ampersands if possible.
If SUPPRESS is non-nil, do not insert line break macro."
(LaTeX-item-equation suppress)
(LaTeX-insert-ampersands
(concat "\\(?:"
(regexp-quote LaTeX-optop) "[tb]" (regexp-quote LaTeX-optcl)
"\\)?")
'LaTeX-amsmath-alignat-number-of-ampersands))
(defun LaTeX-amsmath-alignat-number-of-ampersands (start end)
"Return the number of ampersands to insert.
The number is 2N-1 where N is the number taken from the text between
START and END."
(let ((num (string-to-number (buffer-substring-no-properties start end))))
(if (integerp num) (+ num num -1))))
(defvar LaTeX-amsmath-package-options '("intlimits" "nointlimits"
"sumlimits" "nosumlimits"
"namelimits" "nonamelimits"
"leqno" "reqno" "centertags"
"tbtags" "cmex10" "fleqn" "?"
"alignedleftspaceyes"
"alignedleftspaceno"
"alignedleftspaceyesifneg")
"Package options for the amsmath package.")
;;; amsmath.el ends here.

View File

@@ -0,0 +1,53 @@
;;; amsopn.el --- AUCTeX style for the `amsnopn.sty' AMS-LaTeX package
;; Copyright (C) 1997, 2002, 2005, 2013 Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@strw.leidenuniv.nl>
;; Mads Jensen <mje@inducks.org>
;; Maintainer: auctex-devel@gnu.org
;; 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 `amsnopn.sty'
;;; Code:
(TeX-add-style-hook "amsopn"
(function
(lambda ()
(TeX-add-symbols
'("DeclareMathOperator" (TeX-arg-define-macro "Math Operator: \\")
"Expansion text for the math operator")
'("DeclareMathOperator*" (TeX-arg-define-macro "Math Operator: \\")
"Expansion text for the math operator")
'("operatorname" t)
'("operatorname*" t))
(add-to-list 'LaTeX-auto-regexp-list
'("\\\\DeclareMathOperator\\*?{?\\\\\\([A-Za-z0-9]+\\)}?"
1 TeX-auto-symbol))))
LaTeX-dialect
)
(defvar LaTeX-amsopn-package-options '("namelimits" "nonamelimits")
"Package options for the amsopn package.")
;;; amsopn.el ends here.

View File

@@ -0,0 +1,250 @@
;;; amssymb.el --- AUCTeX style for `amssymb.sty'
;; Copyright (C) 2012 Free Software Foundation, Inc.
;; Author: Mads Jensen <mje@inducks.org>
;; Maintainer: auctex-devel@gnu.org
;; 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 `amssymb.sty'.
;; The commands were just taken out of the \DeclareMathSymbol from
;; amssymb.sty in the order specified there, i.e., \mathord, \mathbin,
;; \mathrel
;;; Code:
(TeX-add-style-hook
"amssymb"
(lambda ()
(TeX-run-style-hooks "amsfonts")
(TeX-add-symbols
"boxdot"
"boxplus"
"boxtimes"
"square"
"blacksquare"
"centerdot"
"lozenge"
"blacklozenge"
"circlearrowright"
"circlearrowleft"
"leftrightharpoons"
"boxminus"
"Vdash"
"Vvdash"
"vDash"
"twoheadrightarrow"
"twoheadleftarrow"
"leftleftarrows"
"rightrightarrows"
"upuparrows"
"downdownarrows"
"upharpoonright"
"downharpoonright"
"upharpoonleft"
"downharpoonleft"
"rightarrowtail"
"leftarrowtail"
"leftrightarrows"
"rightleftarrows"
"Lsh"
"Rsh"
"rightsquigarrow"
"leftrightsquigarrow"
"looparrowleft"
"looparrowright"
"circeq"
"succsim"
"gtrsim"
"gtrapprox"
"multimap"
"therefore"
"because"
"doteqdot"
"triangleq"
"precsim"
"lesssim"
"lessapprox"
"eqslantless"
"eqslantgtr"
"curlyeqprec"
"curlyeqsucc"
"preccurlyeq"
"leqq"
"leqslant"
"lessgtr"
"backprime"
"risingdotseq"
"fallingdotseq"
"succcurlyeq"
"geqq"
"geqslant"
"gtrless"
"vartriangleright"
"vartriangleleft"
"trianglerighteq"
"trianglelefteq"
"bigstar"
"between"
"blacktriangledown"
"blacktriangleright"
"blacktriangleleft"
"vartriangle"
"blacktriangle"
"triangledown"
"eqcirc"
"lesseqgtr"
"gtreqless"
"lesseqqgtr"
"gtreqqless"
"Rrightarrow"
"Lleftarrow"
"veebar"
"barwedge"
"doublebarwedge"
"measuredangle"
"sphericalangle"
"varpropto"
"smallsmile"
"smallfrown"
"Subset"
"Supset"
"Cup"
"Cap"
"curlywedge"
"curlyvee"
"leftthreetimes"
"rightthreetimes"
"subseteqq"
"supseteqq"
"bumpeq"
"Bumpeq"
"lll"
"ggg"
"circledS"
"pitchfork"
"dotplus"
"backsim"
"backsimeq"
"complement"
"intercal"
"circledcirc"
"circledast"
"circleddash"
"lvertneqq"
"gvertneqq"
"nleq"
"ngeq"
"nless"
"ngtr"
"nprec"
"nsucc"
"lneqq"
"gneqq"
"nleqslant"
"ngeqslant"
"lneq"
"gneq"
"npreceq"
"nsucceq"
"precnsim"
"succnsim"
"lnsim"
"gnsim"
"nleqq"
"ngeqq"
"precneqq"
"succneqq"
"precnapprox"
"succnapprox"
"lnapprox"
"gnapprox"
"nsim"
"ncong"
"diagup"
"diagdown"
"varsubsetneq"
"varsupsetneq"
"nsubseteqq"
"nsupseteqq"
"subsetneqq"
"supsetneqq"
"varsubsetneqq"
"varsupsetneqq"
"subsetneq"
"supsetneq"
"nsubseteq"
"nsupseteq"
"nparallel"
"nmid"
"nshortmid"
"nshortparallel"
"nvdash"
"nVdash"
"nvDash"
"nVDash"
"ntrianglerighteq"
"ntrianglelefteq"
"ntriangleleft"
"ntriangleright"
"nleftarrow"
"nrightarrow"
"nLeftarrow"
"nRightarrow"
"nLeftrightarrow"
"nleftrightarrow"
"divideontimes"
"varnothing"
"nexists"
"Finv"
"Game"
"eth"
"eqsim"
"beth"
"gimel"
"daleth"
"lessdot"
"gtrdot"
"ltimes"
"rtimes"
"shortmid"
"shortparallel"
"smallsetminus"
"thicksim"
"thickapprox"
"approxeq"
"succapprox"
"precapprox"
"curvearrowleft"
"curvearrowright"
"digamma"
"varkappa"
"Bbbk"
"hslash"
"backepsilon"))
LaTeX-dialect)
(defvar LaTeX-amssymb-package-options '("psamsfonts")
"Package options for the amssymb package.")
;;; amssymb.el ends here.

View File

@@ -0,0 +1,61 @@
;;; amstex.el --- AMS-LaTeX support.
;; Copyright (C) 2004, 2005 Free Software Foundation, Inc.
;; Maintainer: auctex-devel@gnu.org
;; 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 is only needed when using AMS-LaTeX 1.1 and LaTeX 2.09.
;; In later versions of LaTeX and AMS-LaTeX this file is never used,
;; because there is no longer a class or package name amstex.
;;
;; As far as AUCTeX is concerned, the old amstex style is fairly
;; similar to the new amsmath package. So we will just run that hook
;; here.
;;
;; amsmath.el should not be loaded, if an AMS-TeX (in contrast to
;; AMS-LaTeX) file is opened. The commands defined in amsmath.el
;; mostly have no meaning in this case and errors about unknown
;; variables or functions may occur due to latex.el possibly not being
;; loaded.
;;; Code:
(TeX-add-style-hook
"amstex"
(function
(lambda ()
(unless (memq major-mode '(plain-tex-mode ams-tex-mode))
(TeX-run-style-hooks "amsmath"))))
LaTeX-dialect)
(defvar LaTeX-amstex-package-options '("noamsfonts" "psamsfonts"
"intlimits" "nointlimits"
"sumlimits" "nosumlimits"
"namelimits" "nonamelimits"
"leqno" "reqno" "centertags"
"tbtags" "fleqn" "righttag"
"ctagsplt" "intlim" "nosumlim"
"nonamelm")
"Package options for the amstex package.")
;;; amstex.el ends here.

View File

@@ -0,0 +1,17 @@
;;; amstext.el --- Style hook for the AMS-LaTeX amstext package.
;;;
;;; AUTHOR: Carsten Dominik <dominik@strw.leidenuniv.nl>
;;; Code:
(TeX-add-style-hook "amstext"
(function
(lambda ()
(TeX-add-symbols
'("text" t))))
LaTeX-dialect)
(defvar LaTeX-amstext-package-options nil
"Package options for the amstext package.")
;;; amstext.el ends here.

View File

@@ -0,0 +1,200 @@
;;; amsthm.el --- Style hook for the AMS-LaTeX amsthm package.
;; Copyright (C) 1997, 2013--2015 Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@strw.leidenuniv.nl>
;; Maintainer: auctex-devel@gnu.org
;; 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:
;; The style provides the function `LaTeX-amsthm-env-label' which
;; enables new defined environments with "\newtheoreom" to interact
;; with AUCTeX and RefTeX mechanisms for inserting labels. Check
;; docstring of `LaTeX-amsthm-env-label' for instructions.
;;; Code:
(defvar LaTeX-amsthm-package-options nil
"Package options for the amsthm package.")
(defvar LaTeX-amsthm-theoremstyle-list
'(("plain") ("definition") ("remark"))
"List of theorem styles provided by `amsthm.el' and new ones
defined with \"\\newtheoremstyle\".")
(defvar LaTeX-amsthm-fontdecl
'(;; family
"rmfamily" "sffamily" "ttfamily"
;; series
"mdseries" "bfseries"
;; shape
"upshape" "itshape" "slshape" "scshape"
;; size
"tiny" "scriptsize" "footnotesize"
"small" "normalsize" "large"
"Large" "LARGE" "huge" "Huge"
;; reset macro
"normalfont")
"List of font declaration commands for \"\\newtheoremstyle\".")
(defun LaTeX-arg-amsthm-fontdecl (optional &optional prompt)
"Prompt for font declaration commands in \"\\newtheoremstyle\".
If OPTIONAL is non-nil, insert the resulting value as an optional
argument. Use PROMPT as the prompt string."
;; `INITIAL-INPUT' (5th argument to `TeX-completing-read-multiple')
;; is hard-coded to `TeX-esc'.
(let* ((crm-separator (regexp-quote TeX-esc))
(fontdecl (mapconcat 'identity
(TeX-completing-read-multiple
(TeX-argument-prompt optional prompt "Font")
LaTeX-amsthm-fontdecl nil nil TeX-esc)
TeX-esc)))
(TeX-argument-insert fontdecl optional)))
(defun LaTeX-amsthm-env-label (environment)
"Insert ENVIRONMENT, query for an optional argument and prompt
for label. AUCTeX users should add ENVIRONMENT to
`LaTeX-label-alist' via customize or in init-file with:
(add-to-list \\='LaTeX-label-alist \\='(\"lemma\" . \"lem:\"))
RefTeX users should customize or add ENVIRONMENT to
`LaTeX-label-alist' and `reftex-label-alist', e.g.
(add-to-list \\='LaTeX-label-alist \\='(\"lemma\" . \"lem:\"))
(add-to-list \\='reftex-label-alist
\\='(\"lemma\" ?m \"lem:\" \"~\\ref{%s}\"
nil (\"Lemma\" \"lemma\") nil))"
(let ((opthead (TeX-read-string
(TeX-argument-prompt t nil "Heading"))))
(LaTeX-insert-environment environment
(when (and opthead
(not (string= opthead "")))
(format "[%s]" opthead))))
(when (LaTeX-label environment 'environment)
(LaTeX-newline)
(indent-according-to-mode)))
;; Needed for auto-parsing
(require 'tex)
;; Setup parsing for \newtheorem
(TeX-auto-add-type "amsthm-newtheorem" "LaTeX")
;; Setup parsing for \newtheoremstyle
(TeX-auto-add-type "amsthm-newtheoremstyle" "LaTeX")
(defun LaTeX-amsthm-auto-prepare ()
"Clear `LaTeX-auto-amsthm-newtheorem' and
`LaTeX-auto-amsthm-newtheoremstyle' before parsing."
(setq LaTeX-auto-amsthm-newtheorem nil)
(setq LaTeX-auto-amsthm-newtheoremstyle nil))
(defun LaTeX-amsthm-auto-cleanup ()
"Move parsed results from `LaTeX-auto-amsthm-newtheorem' and
make them available as new environments. Update
`LaTeX-amsthm-theoremstyle-list' with styles defined with
\"\\newtheoremstyle\"."
(dolist (newthm (mapcar 'car (LaTeX-amsthm-newtheorem-list)))
(LaTeX-add-environments (list newthm 'LaTeX-amsthm-env-label)))
(dolist (newthmstyle (LaTeX-amsthm-newtheoremstyle-list))
(add-to-list (make-local-variable 'LaTeX-amsthm-theoremstyle-list)
newthmstyle)))
(add-hook 'TeX-auto-prepare-hook #'LaTeX-amsthm-auto-prepare t)
(add-hook 'TeX-auto-cleanup-hook #'LaTeX-amsthm-auto-cleanup t)
(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
(TeX-add-style-hook
"amsthm"
(lambda ()
(LaTeX-add-environments
'("proof" LaTeX-amsthm-env-label))
(TeX-add-symbols
;; Overrule the defintion in `latex.el':
'("newtheorem"
(TeX-arg-eval
(lambda ()
(let ((nthm (TeX-read-string
(TeX-argument-prompt nil nil "Environment"))))
(LaTeX-add-amsthm-newtheorems nthm)
(LaTeX-add-environments (list nthm 'LaTeX-theorem-env-label))
(format "%s" nthm))))
[ TeX-arg-environment "Numbered like" ]
t [ (TeX-arg-eval progn (if (eq (save-excursion
(backward-char 2)
(preceding-char)) ?\])
()
(TeX-arg-counter t "Within counter"))
"") ])
'("newtheorem*"
(TeX-arg-eval
(lambda ()
(let ((nthm (TeX-read-string
(TeX-argument-prompt nil nil "Environment")))
(heading (TeX-read-string
(TeX-argument-prompt nil nil "Heading"))))
(LaTeX-add-amsthm-newtheorems nthm)
(LaTeX-add-environments (list nthm 'LaTeX-amsthm-env-label))
(insert (concat TeX-grop nthm TeX-grcl))
(format "%s" heading)))))
'("theoremstyle"
(TeX-arg-eval completing-read "Style: "
LaTeX-amsthm-theoremstyle-list))
"qedhere"
"swapnumbers"
'("newtheoremstyle"
(TeX-arg-eval
(lambda ()
(let ((nthmstyle (TeX-read-string
(TeX-argument-prompt nil nil "Style name"))))
(LaTeX-add-amsthm-newtheoremstyles nthmstyle)
(add-to-list (make-local-variable 'LaTeX-amsthm-theoremstyle-list)
(list nthmstyle))
(format "%s" nthmstyle))))
(TeX-arg-length "Space above")
(TeX-arg-length "Space below")
(LaTeX-arg-amsthm-fontdecl "Body font")
"Indent amount"
(LaTeX-arg-amsthm-fontdecl "Theorem head font")
"Punctuation after head"
(TeX-arg-length "Space after head")
"Theorem head spec"))
(TeX-auto-add-regexp
`(,(concat "\\\\newtheorem\\*?{\\(" TeX-token-char "+\\)}")
1 LaTeX-auto-amsthm-newtheorem))
(TeX-auto-add-regexp
`(,(concat "\\\\newtheoremstyle{\\(" TeX-token-char "+\\)}")
1 LaTeX-auto-amsthm-newtheoremstyle))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("newtheorem" "*{[{[")
("theoremstyle" "{")
("newtheoremstyle" "{{{{{{{{{"))
'function)))
LaTeX-dialect)
;;; amsthm.el ends here

View File

@@ -0,0 +1,105 @@
;;; array.el --- AUCTeX style for `array.sty'
;; Copyright (C) 2013, 2015 Free Software Foundation, Inc.
;; Author: Mads Jensen <mje@inducks.org>
;; Maintainer: auctex-devel@gnu.org
;; 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 `array.sty'
;;; Code:
(require 'tex)
(TeX-auto-add-type "array-newcolumntype" "LaTeX")
(defvar LaTeX-array-newcolumntype-regexp
'("\\\\newcolumntype{\\([^}]+\\)}"
1 LaTeX-auto-array-newcolumntype)
"Matches the argument of `\\newcolumntype' from `array'
package.")
(defun LaTeX-array-auto-prepare ()
"Clear `LaTeX-auto-array-newcolumntype' before parsing."
(setq LaTeX-auto-array-newcolumntype nil))
(defun LaTeX-array-auto-cleanup ()
"Move parsed column specification from
`LaTeX-auto-array-newcolumntype' to `LaTeX-array-column-letters'."
(when (LaTeX-array-newcolumntype-list)
(LaTeX-array-update-column-letters)))
(defun LaTeX-array-update-column-letters ()
"Update and uniquify the value of `LaTeX-array-column-letters'
and make it buffer local. "
(set (make-local-variable 'LaTeX-array-column-letters)
(mapconcat 'identity
(TeX-delete-duplicate-strings
(split-string
(concat LaTeX-array-column-letters
(mapconcat 'car (LaTeX-array-newcolumntype-list) ""))
"" t))
"")))
(add-hook 'TeX-auto-prepare-hook #'LaTeX-array-auto-prepare t)
(add-hook 'TeX-auto-cleanup-hook #'LaTeX-array-auto-cleanup t)
(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
(TeX-add-style-hook
"array"
(lambda ()
(TeX-auto-add-regexp LaTeX-array-newcolumntype-regexp)
(TeX-add-symbols
'("newcolumntype"
(TeX-arg-eval
(lambda ()
(let ((col (TeX-read-string "Column type: ")))
(LaTeX-add-array-newcolumntypes col)
(LaTeX-array-update-column-letters)
(format "%s" col))))
[ "Number of arguments" ] t)
'("showcols" 0)
'("firsthline" 0)
'("lasthline" 0))
;; `array.sty' adds a couple of new lengths. They're added here, rather than
;; in the `TeX-add-symbols' block.
(LaTeX-add-lengths "extratabsurround" "extrarowheight")
;; `array.sty' adds some new column specification letters.
(set (make-local-variable 'LaTeX-array-column-letters)
(concat LaTeX-array-column-letters "m" "b"))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("newcolumntype" "{[{"))
'function)))
LaTeX-dialect)
(defvar LaTeX-array-package-options nil
"Package options for array.")
;; array.el ends here

View File

@@ -0,0 +1,21 @@
;;; article.el - Special code for article style.
;;; Code:
(defvar LaTeX-article-class-options
'("a4paper" "a5paper" "b5paper" "letterpaper" "legalpaper" "executivepaper"
"landscape" "10pt" "11pt" "12pt" "oneside" "twoside" "draft" "final"
"titlepage" "notitlepage" "onecolumn" "twocolumn" "leqno" "fleqn" "openbib")
"Package options for the article class.")
(TeX-add-style-hook
"article"
(lambda ()
(LaTeX-largest-level-set "section")
(LaTeX-add-counters "part" "section" "subsection" "subsubsection" "paragraph"
"subparagraph" "figure" "table")
(LaTeX-add-pagestyles "headings" "myheadings")
(LaTeX-add-environments "abstract"))
LaTeX-dialect)
;;; article.el ends here

View File

@@ -0,0 +1,119 @@
;;; attachfile.el --- AUCTeX style for `attachfile.sty' (v1.6)
;; Copyright (C) 2015 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2015-04-11
;; 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 `attachfile.sty' (v1.6) from 2015/04/04.
;; `attachfile.sty' is part of TeXLive.
;;; Code:
(defvar LaTeX-attachfile-key-val-options
'(("appearance" ("true" "false"))
("author")
("color")
("created")
("date")
("description")
("icon" ("Graph" "Paperclip" "PushPin" "Tag"))
;; This can only be a small excerpt:
("mimetype"
("application/javascript"
"application/pdf"
"application/postscript"
"application/vnd.ms-excel"
"application/vnd.ms-powerpoint"
"application/zip"
"audio/mpeg"
"audio/ogg"
"image/jpeg"
"image/png"
"image/tiff"
"text/csv"
"text/plain"
"video/H264"
"video/mp4"))
("modified")
("print" ("true" "false"))
("size")
("subject")
("timezone")
("zoom" ("true" "false")))
"Key=value options for attachfile macros.")
(TeX-add-style-hook
"attachfile"
(lambda ()
;; Run style hook for packages loaded by attachfile; both packages
;; are required for running LaTeX, but not necessary within AUCTeX
(TeX-run-style-hooks "hyperref" "color")
(TeX-add-symbols
;; \attachfile[<options>]{<filename>}
'("attachfile"
[TeX-arg-key-val LaTeX-attachfile-key-val-options]
(TeX-arg-eval
(lambda ()
(let ((atfi (file-relative-name
(read-file-name "File to attach: "))))
(format "%s" atfi)))))
;; \noattachfile[<options>]
'("noattachfile"
[TeX-arg-key-val LaTeX-attachfile-key-val-options] )
;; \textattachfile[<options>]{<filename>}{<text>}
'("textattachfile"
[TeX-arg-key-val LaTeX-attachfile-key-val-options]
(TeX-arg-eval
(lambda ()
(let ((atfi (file-relative-name
(read-file-name "File to attach: "))))
(format "%s" atfi))))
t)
;; \notextattachfile[<options>]{<text>}
'("notextattachfile"
[TeX-arg-key-val LaTeX-attachfile-key-val-options] t)
;; \attachfilesetup{<options>}
'("attachfilesetup"
(TeX-arg-key-val LaTeX-attachfile-key-val-options)))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("attachfilesetup" "{")
("attachfile" "[{")
("noattachfile" "[")
("textattachfile" "[{{")
("notextattachfile" "[{"))
'function)))
LaTeX-dialect)
(defvar LaTeX-attachfile-package-options nil
"Prompt for package options for the attachfile package.")
;;; attachfile.el ends here

View File

@@ -0,0 +1,40 @@
;;; australian.el --- AUCTeX style for the `australian' babel option.
;; Copyright (C) 2017 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2017-07-02
;; 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:
;; Set up AUCTeX for editing Australian text in connection with the
;; `australian' babel option.
;;; Code:
(TeX-add-style-hook
"australian"
(lambda ()
(TeX-run-style-hooks "english"))
LaTeX-dialect)
;;; australian.el ends here

View File

@@ -0,0 +1,40 @@
;;; austrian.el --- AUCTeX style for the `austrian' babel option.
;; Copyright (C) 2009 Free Software Foundation, Inc.
;; Author: Ralf Angeli <angeli@caeruleus.net>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2009-12-28
;; 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:
;; Set up AUCTeX for editing Austrian text in connection with the
;; `austrian' babel option.
;;; Code:
(TeX-add-style-hook
"austrian"
(lambda ()
(TeX-run-style-hooks "german"))
LaTeX-dialect)
;;; austrian.el ends here

View File

@@ -0,0 +1,196 @@
;;; babel.el --- AUCTeX style for `babel.sty' version 3.9h.
;; Copyright (C) 2005, 2007, 2013-2014 Free Software Foundation, Inc.
;; Author: Ralf Angeli <angeli@iwi.uni-sb.de>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2005-05-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 `babel.sty' version 3.9h.
;;; Code:
(eval-when-compile (require 'cl))
(defvar LaTeX-babel-language-list
'("afrikaans"
"bahasa" "indonesian" "indon" "bahasai" "bahasam" "malay" "meyalu"
"basque"
"breton"
"bulgarian"
"catalan"
"croatian"
"czech"
"danish"
"dutch"
"english" "USenglish" "american" "UKenglish" "british" "canadian"
"australian" "newzealand"
"esperanto"
"estonian"
"finnish"
"french" "francais" "canadien" "acadian"
"galician"
"austrian" "german" "germanb" "ngerman" "naustrian"
"greek" "polutonikogreek"
"hebrew"
"icelandic"
"interlingua"
"irish"
"italian"
"latin"
"lowersorbian"
"samin"
"norsk" "nynorsk"
"polish"
"portuges" "portuguese" "brazilian" "brazil"
"romanian"
"russian"
"scottish"
"spanish"
"slovak"
"slovene"
"swedish"
"serbian"
"turkish"
"ukrainian"
"uppersorbian"
"welsh"
;; Extra languages mentioned in the `babel' manual.
"albanian" "hindi" "thai" "thaicjk" "latvian" "turkmen" "hungarian" "magyar"
"mongolian" "romansh" "lithuanian" "spanglish" "vietnamese" "japanese"
"pinyin" "arabinc" "farsi" "ibygreek" "bgreek" "serbianic" "frenchle"
"ethiop" "friulan" "frenchb")
"List of languages supported by the babel LaTeX package.")
(defun LaTeX-babel-active-languages ()
"Return a list of languages used in the document."
(let (main-language active-languages)
;; Loop over options provided to class and `babel' package at load time.
(dolist (elt (append
;; In most cases there is only one element in the alist, if
;; there is more than one element, the first one should
;; contain the class options of the current buffer. So we can
;; take the car of `LaTeX-provided-class-options'.
(cdr (car LaTeX-provided-class-options))
(cdr (assoc "babel" LaTeX-provided-package-options))))
(setq elt (TeX-split-string "=" elt))
(if (equal (car elt) "main")
;; Starting from version 3.9 of `babel' package, languages can be set
;; with the following syntax:
;; \usepackage[latin.medieval,main=danish,spanish.notilde]{babel}
;; with `danish' being the default language. When the default
;; language is set with the `main' option, we record it and append to
;; the list at the end.
(setq main-language (car (cdr elt)))
;; Get rid of the modifiers (`medieval' and `notilde' in the above
;; example).
(setq elt (car (TeX-split-string "\\." (car elt))))
(if (member elt LaTeX-babel-language-list)
;; Append element to `active-languages' to respect loading order.
;; `babel' package uses as default language the last loaded one,
;; except if it is set with the `main' option.
(pushnew elt active-languages :test #'equal))))
(if main-language
(pushnew main-language active-languages :test #'equal))
(nreverse active-languages)))
(defun TeX-arg-babel-lang (_optional &optional _prompt)
"Prompt for a language with completion and insert it as an argument."
(TeX-argument-insert
(completing-read "Language: " (LaTeX-babel-active-languages)) nil))
(defun LaTeX-env-babel-lang (env)
"Prompt for a language and insert it as an argument of ENV."
(LaTeX-insert-environment
env (format "{%s}" (completing-read "Language: "
(LaTeX-babel-active-languages)))))
(defun LaTeX-babel-load-languages ()
"Load style files of babel active languages."
;; Run style hooks for every active language in loading order, so
;; `TeX-quote-language' will be correctly set.
(mapc 'TeX-run-style-hooks (LaTeX-babel-active-languages)))
(TeX-add-style-hook
"babel"
(lambda ()
(LaTeX-babel-load-languages)
(add-hook 'LaTeX-after-usepackage-hook 'LaTeX-babel-load-languages nil t)
;; New symbols
(TeX-add-symbols
'("selectlanguage" TeX-arg-babel-lang)
'("foreignlanguage" TeX-arg-babel-lang t)
"languagename"
'("iflanguage" TeX-arg-babel-lang t nil)
'("useshorthands" t)
'("defineshorthand" t nil)
'("aliasshorthand" t nil)
'("languageshorthands" TeX-arg-babel-lang)
'("shorthandon" t)
'("shorthandoff" t)
'("languageattribute" TeX-arg-babel-lang t))
;; New environments
(LaTeX-add-environments
'("otherlanguage" LaTeX-env-babel-lang)
'("otherlanguage*" LaTeX-env-babel-lang)
'("hyphenrules" LaTeX-env-babel-lang))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("selectlanguage" "{")
("foreignlanguage" "{{")
("iflanguage" "{{{")
("languagename" "")
("useshorthands" "{")
("languageshorthands" "{")
("shorthandon" "{")
("shorthandoff" "{"))
'function)
(font-latex-add-keywords '(("defineshorthand" "{{")
("aliasshorthand" "{{")
("languageattribute" "{{"))
'variable)))
LaTeX-dialect)
(defun LaTeX-babel-package-options ()
"Prompt for package options for the babel package."
(TeX-read-key-val
t
(append
'(("KeepShorthandsActive")
("activeacute")
("activegrave")
("shorthands")
("safe" ("none" "ref" "bib"))
("math" ("active" "normal"))
("config")
("main" LaTeX-babel-language-list)
("headfoot" LaTeX-babel-language-list)
("noconfigs")
("showlanguages")
("strings" ("generic" "unicode" "encoded"))
("hyphenmap" ("off" "main" "select" "other" "other*"))
("base"))
(mapcar 'list LaTeX-babel-language-list))))
;;; babel.el ends here

View File

@@ -0,0 +1,84 @@
;;; baskervaldx.el --- AUCTeX style for `baskervaldx.sty' (v1.07)
;; Copyright (C) 2014, 2015 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2014-11-18
;; 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 `baskervaldx.sty' (v1.07) from 2015/04/06.
;; `baskervaldx.sty' is part of TeXLive.
;;; Code:
(TeX-add-style-hook
"baskervaldx"
(lambda ()
;; Run style hook for various packages loaded by baskervaldx
(TeX-run-style-hooks "textcomp" "fontaxes")
;; New symbols
(TeX-add-symbols
;; Only preamble commands
'("useosf" 0)
;; Text commands
'("lfstyle" -1) ; lf declaration
'("tlfstyle" -1) ; tlf declaration
'("osfstyle" -1) ; osf declaration
'("tosfstyle" -1) ; tosf declaration
'("sufigures" -1) ; superior figures declaration
'("textlf" t) ; proportional lining figures
'("texttlf" t) ; tabular lining figures
'("textosf" t) ; proportional oldstyle figures
'("texttosf" t) ; tabular oldstyle figures
'("textsu" t) ; superior figures
'("swshape" -1)) ; italic shape with ligatures activated
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("textlf" "{")
("texttlf" "{")
("textosf" "{")
("texttosf" "{")
("textsu" "{"))
'type-command)
(font-latex-add-keywords '(("lfstyle" "")
("tlfstyle" "")
("osfstyle" "")
("tosfstyle" "")
("sufigures" ""))
'type-declaration)
(font-latex-add-keywords '(("swshape" ""))
'bold-declaration)))
LaTeX-dialect)
(defvar LaTeX-baskervaldx-package-options
'("lining" "lf" "oldstyle" "osf" "tabular" "proportional" "p"
"scale" "scaled" "sups" "swash")
"Package options for the baskervaldx package.")
;;; baskervaldx.el ends here

View File

@@ -0,0 +1,363 @@
;;; beamer.el --- AUCTeX style for the latex-beamer class
;; Copyright (C) 2003, 2004, 2005, 2008, 2013-2016 Free Software Foundation
;; Author: Thomas Baumann <thomas.baumann@ch.tum.de>
;; Created: 2003-12-20
;; 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 latex-beamer class.
;;; Code:
(defun LaTeX-beamer-after-insert-env (env start _end)
"Do beamer-specific stuff after the insertion of an environment."
;; Add `fragile' as an optional argument to the frame environment if
;; a verbatim environment is inserted.
(when (and (TeX-member env (LaTeX-verbatim-environments) 'string-equal)
(save-excursion
(goto-char start)
(string-equal (LaTeX-current-environment) "frame")))
(save-excursion
(when (re-search-backward "\\\\begin[ \t]*{frame}" nil t)
(let ((end-of-begin (match-end 0)))
(goto-char end-of-begin)
(while (forward-comment 1))
(if (eq (char-after) (string-to-char LaTeX-optop))
(progn
(forward-char)
(insert "fragile")
(unless (looking-at (concat "[ \t]*" LaTeX-optcl))
(insert ",")))
(goto-char end-of-begin)
(insert "[fragile]")))))))
(defvar LaTeX-beamer-frametitle-history nil
"History of frame titles in beamer.")
(TeX-add-style-hook
"beamer"
(lambda ()
(add-hook 'LaTeX-after-insert-env-hooks 'LaTeX-beamer-after-insert-env nil t)
(TeX-run-style-hooks "amsmath" "amssymb" "amsthm" "color" "geometry"
"hyperref" "inputenc" "translator" "xcolor")
(unless LaTeX-beamer-section-labels-flag
(make-local-variable 'LaTeX-section-hook)
(setq LaTeX-section-hook
'(LaTeX-section-heading
LaTeX-section-title
LaTeX-section-section)))
(setq LaTeX-item-list
(append '(("itemize" . LaTeX-item-beamer)
("enumerate" . LaTeX-item-beamer))
LaTeX-item-list))
(setq LaTeX-default-document-environment "frame")
(LaTeX-paragraph-commands-add-locally "frametitle")
(TeX-add-symbols
'("alert" 1)
'("alt" TeX-arg-beamer-overlay-spec 2)
'("beamerbutton" 1)
'("beamergotobutton" 1)
'("beamerreturnbutton" 1)
'("beamerskipbutton" 1)
'("frame" TeX-arg-beamer-frametitle)
'("frametitle"
(TeX-arg-eval TeX-read-string "Title: " nil 'LaTeX-beamer-frametitle-history))
'("hyperlink" TeX-arg-beamer-overlay-spec 2)
'("hyperlinkslideprev" TeX-arg-beamer-overlay-spec 1)
'("hyperlinkslidenext" TeX-arg-beamer-overlay-spec 1)
'("hyperlinkframestart" TeX-arg-beamer-overlay-spec 1)
'("hyperlinkframeend" TeX-arg-beamer-overlay-spec 1)
'("hyperlinkframestartnext" TeX-arg-beamer-overlay-spec 1)
'("hyperlinkframeendprev" TeX-arg-beamer-overlay-spec 1)
'("hyperlinkpresentationstart" TeX-arg-beamer-overlay-spec 1)
'("hyperlinkpresentationend" TeX-arg-beamer-overlay-spec 1)
'("hyperlinkappendixstart" TeX-arg-beamer-overlay-spec 1)
'("hyperlinkappendixend" TeX-arg-beamer-overlay-spec 1)
'("hyperlinkdocumentstart" TeX-arg-beamer-overlay-spec 1)
'("hyperlinkdocumentend" TeX-arg-beamer-overlay-spec 1)
'("hypertarget" TeX-arg-beamer-overlay-spec 2)
'("institute" 1)
'("invisible" TeX-arg-beamer-overlay-spec 1)
'("label" TeX-arg-beamer-overlay-spec 1)
'("logo" 1)
'("note" TeX-arg-beamer-note 1)
'("only" TeX-arg-beamer-overlay-spec 1)
'("onslide" TeX-arg-beamer-overlay-spec)
'("partpage")
'("pause" ["Slide number"])
'("structure" TeX-arg-beamer-overlay-spec 1)
'("temporal" TeX-arg-beamer-overlay-spec 3)
'("titlepage")
'("titlegraphic" 1)
'("uncover" TeX-arg-beamer-overlay-spec 1)
'("usetheme" LaTeX-arg-beamer-theme)
'("useinnertheme" LaTeX-arg-beamer-inner-theme)
'("useoutertheme" LaTeX-arg-beamer-outer-theme)
'("usecolortheme" LaTeX-arg-beamer-color-theme)
'("usefonttheme" LaTeX-arg-beamer-font-theme)
'("usetheme" LaTeX-arg-beamer-theme)
'("visible" TeX-arg-beamer-overlay-spec 1))
(LaTeX-add-environments
'("actionenv")
'("alertblock" 1)
'("beamerboxesrounded" 1)
'("block" (lambda (env &rest ignore)
(LaTeX-insert-environment
env (format "{%s}" (TeX-read-string "Title: ")))))
'("column" "Width")
"columns"
"columnsonlytextwidth"
'("exampleblock" 1)
'("frame" (lambda (env &rest ignore)
(let ((title (TeX-read-string "(Optional) Title: " nil
'LaTeX-beamer-frametitle-history)))
(LaTeX-insert-environment env)
(unless (zerop (length title))
(save-excursion
(LaTeX-find-matching-begin)
(end-of-line)
(LaTeX-newline)
(insert (format "\\frametitle{%s}" title))
;; This works because \frametitle is a
;; paragraph command.
(backward-char)
(LaTeX-fill-paragraph))))))
'("onlyenv" (lambda (env &rest ignore)
(LaTeX-insert-environment
env
(let ((overlay (TeX-read-string "(Optional) Overlay: ")))
(unless (zerop (length overlay))
(format "<%s>" overlay))))))
'("overlayarea" "Area width" "Area height")
'("overprint" (lambda (env &rest ignore)
(LaTeX-insert-environment
env
(let ((width (TeX-read-string "(Optional) Area width: ")))
(unless (zerop (length width))
(format "[%s]" width))))))
"semiverbatim")
(LaTeX-largest-level-set "section")
(LaTeX-add-counters "lecture" "part" "section" "subsection" "subsubsection"
"subsectionslide" "framenumber" "figure" "table"
"beamerpauses")
(LaTeX-add-pagestyles "navigation")
(add-to-list (make-local-variable 'LaTeX-indent-environment-list)
'("semiverbatim" current-indentation) t)
(add-to-list 'LaTeX-verbatim-environments-local "semiverbatim")
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("title" "[{")
("subtitle" "[{")
("author" "[{")
("date" "[{")
("frametitle" "<[{")) 'slide-title)
(font-latex-update-font-lock t)))
LaTeX-dialect)
(defun TeX-arg-beamer-overlay-spec (_optional &optional _prompt)
"Prompt for overlay specification."
(let ((overlay (TeX-read-string "(Optional) Overlay: ")))
(unless (zerop (length overlay))
(insert "<" overlay ">"))
(indent-according-to-mode)))
(defun TeX-arg-beamer-frametitle (_optional &optional _prompt)
"Prompt for the frametitle."
(let ((title (TeX-read-string "Title: " nil 'LaTeX-beamer-frametitle-history)))
(if (not (zerop (length title)))
(insert TeX-grop TeX-esc "frametitle" TeX-grop
title TeX-grcl TeX-grcl)
(insert TeX-grop TeX-grcl))))
(defun LaTeX-item-beamer ()
"Insert a new item with an optional overlay argument. You
can turn off the prompt for the overlay argument by setting
`LaTeX-beamer-item-overlay-flag' to nil. Calling the function
with a prefix argument prompts for the overlay specification
unconditionally."
(if (listp current-prefix-arg)
(setq current-prefix-arg (car current-prefix-arg))
current-prefix-arg)
(TeX-insert-macro "item")
(delete-horizontal-space)
(if (or current-prefix-arg LaTeX-beamer-item-overlay-flag)
(TeX-arg-beamer-overlay-spec 0))
(insert " ")
(indent-according-to-mode))
(defun TeX-arg-beamer-note (_optional &optional _prompt)
"Prompt for overlay specification and optional argument."
(let ((overlay (TeX-read-string "(Optional) Overlay: "))
(options (TeX-read-string "(Optional) Options: ")))
(unless (zerop (length overlay))
(insert "<" overlay ">"))
(unless (zerop (length options))
(insert "[" options "]"))
(indent-according-to-mode)))
(defun LaTeX-beamer-search-themes (&optional regexp extensions length)
"Search for beamer themes matching REGEXP with EXTENSIONS.
The function removes the first LENGTH characters and the
extension of the file and returns a list of strings. LENGTH may
also be a string. Then the length of the string is used."
(let* ((match (or regexp "^beamertheme[A-Z]"))
(exts (or extensions '("tex" "sty")))
(chars (cond ((integerp length)
length)
((stringp length)
(string-width length))
;; Try some DWIM magic...
((and (not length)
(string-match "beamer[A-Za-z0-9]*theme" match))
(- (match-end 0) (match-beginning 0)))
(t (error "Invalid length: `%s'" length)))))
;; (message "match=`%s' chars=`%s'" match chars)
(TeX-delete-duplicate-strings
(delete nil
(mapcar
(lambda (file)
(let ((case-fold-search nil))
(and (numberp (string-match match file))
(substring file chars))))
(TeX-search-files nil exts t t))))))
(defun LaTeX-arg-beamer-theme (&rest _ignore)
"Prompt for beamer theme with completion."
(TeX-argument-insert
(completing-read
(TeX-argument-prompt nil nil "Theme")
(mapcar 'list
(cond ((eq LaTeX-beamer-themes 'local)
(set (make-local-variable 'LaTeX-beamer-themes)
(LaTeX-beamer-search-themes)))
((functionp LaTeX-beamer-themes)
(funcall LaTeX-beamer-themes))
((listp LaTeX-beamer-themes)
LaTeX-beamer-themes)
(t (error
"`LaTeX-beamer-themes' should be a list: `%s'"
LaTeX-beamer-themes))))
nil nil nil)
t))
(defun LaTeX-arg-beamer-inner-theme (&rest _ignore)
"Prompt for beamer inner theme with completion."
(TeX-argument-insert
(completing-read
(TeX-argument-prompt nil nil "Theme")
(mapcar 'list
(cond ((eq LaTeX-beamer-inner-themes 'local)
(set (make-local-variable 'LaTeX-beamer-inner-themes)
(LaTeX-beamer-search-themes "^beamerinnertheme")))
((functionp LaTeX-beamer-inner-themes)
(funcall LaTeX-beamer-inner-themes))
((listp LaTeX-beamer-inner-themes)
LaTeX-beamer-inner-themes)
(t (error
"`LaTeX-beamer-inner-themes' should be a list: `%s'"
LaTeX-beamer-inner-themes))))
nil nil nil)
t))
(defun LaTeX-arg-beamer-outer-theme (&rest _ignore)
"Prompt for beamer outer theme with completion."
(TeX-argument-insert
(completing-read
(TeX-argument-prompt nil nil "Theme")
(mapcar 'list
(cond ((eq LaTeX-beamer-outer-themes 'local)
(set (make-local-variable 'LaTeX-beamer-outer-themes)
(LaTeX-beamer-search-themes "^beameroutertheme")))
((functionp LaTeX-beamer-outer-themes)
(funcall LaTeX-beamer-outer-themes))
((listp LaTeX-beamer-outer-themes)
LaTeX-beamer-outer-themes)
(t (error
"`LaTeX-beamer-outer-themes' should be a list: `%s'"
LaTeX-beamer-outer-themes))))
nil nil nil)
t))
(defun LaTeX-arg-beamer-color-theme (&rest _ignore)
"Prompt for beamer color theme with completion."
(TeX-argument-insert
(completing-read
(TeX-argument-prompt nil nil "Theme")
(mapcar 'list
(cond ((eq LaTeX-beamer-color-themes 'local)
(set (make-local-variable 'LaTeX-beamer-color-themes)
(LaTeX-beamer-search-themes "^beamercolortheme")))
((functionp LaTeX-beamer-color-themes)
(funcall LaTeX-beamer-color-themes))
((listp LaTeX-beamer-color-themes)
LaTeX-beamer-color-themes)
(t (error
"`LaTeX-beamer-color-themes' should be a list: `%s'"
LaTeX-beamer-color-themes))))
nil nil nil)
t))
(defun LaTeX-arg-beamer-font-theme (&rest _ignore)
"Prompt for beamer font theme with completion."
(TeX-argument-insert
(completing-read
(TeX-argument-prompt nil nil "Theme")
(mapcar 'list
(cond ((eq LaTeX-beamer-font-themes 'local)
(set (make-local-variable 'LaTeX-beamer-font-themes)
(LaTeX-beamer-search-themes "^beamerfonttheme")))
((functionp LaTeX-beamer-font-themes)
(funcall LaTeX-beamer-font-themes))
((listp LaTeX-beamer-font-themes)
LaTeX-beamer-font-themes)
(t (error
"`LaTeX-beamer-font-themes' should be a list: `%s'"
LaTeX-beamer-font-themes))))
nil nil nil)
t))
(defun LaTeX-beamer-class-options ()
"Read the beamer class options from the user."
(TeX-read-key-val t '(("usepdftitle" ("false")) ("envcountsect")
("notheorems") ("noamsthm") ("compress") ("t") ("c")
("leqno") ("fleqn") ("handout") ("trans") ("pdftex")
("nativepdf") ("pdfmark") ("dvips") ("dviwindo")
("dvipsone") ("vtex") ("ps2pdf") ("ignorenonframetext")
("noamssymb") ("bigger") ("smaller") ("8pt") ("9pt")
("10pt") ("11pt") ("12pt") ("14pt") ("17pt") ("20pt")
("draft") ("CJK") ("cjk") ("pgf")
("hyperref" LaTeX-hyperref-package-options-list)
("color") ("xcolor") ("ucs") ("utf8x") ("utf8")
("aspectratio" ("1610" "169" "149" "54" "43" "32")))))
;;; beamer.el ends here

View File

@@ -0,0 +1,634 @@
;;; biblatex.el --- AUCTeX style for `biblatex.sty' version 2.8a.
;; Copyright (C) 2012-2014, 2016 Free Software Foundation, Inc.
;; Author: Ralf Angeli <angeli@caeruleus.net>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2012-11-14
;; 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 `biblatex.sty' version 2.8a.
;;; Code:
(defvar LaTeX-biblatex-entrytype
'(;; Regular Types
"article" "book" "mvbook" "inbook" "bookinbook" "suppbook" "booklet"
"collection" "mvcollection" "incollection" "suppcollection" "manual" "misc"
"online" "patent" "periodical" "suppperiodical" "proceedings"
"mvproceedings" "inproceedings" "reference" "mvreference" "inreference"
"report" "set" "thesis" "unpublished" "xdata" "customa" "customb" "customc"
"customd" "custome" "customf"
;; Type Aliases
"conference" "electronic" "masterthesis" "phdthesis" "techreport" "www"
;; Unsupported Types
"artwork" "audio" "bibnote" "commentary" "image" "jurisdiction"
"legislation" "legal" "letter" "movie" "music" "performance" "review"
"software" "standard" "video")
"List of biblatex entry types.")
(defvar LaTeX-biblatex-executebibliographyoptions-options
'(;; General
("sorting" ("nty" "nyt" "nyvt" "anyt" "anyvt" "ynt" "ydnt" "none" "debug"))
("sortcase" ("true" "false"))
("sortupper" ("true" "false"))
("sortlocale")
("sortlos" ("bib" "los"))
("related" ("true" "false"))
("sortcites" ("true" "false"))
("maxnames")
("minnames")
("maxbibnames")
("minbibnames")
("maxcitenames")
("mincitenames")
("maxitems")
("minitems")
("autocite" ("plain" "inline" "footnote" "superscript"))
("autopunct" ("true" "false"))
("language" (append LaTeX-biblatex-language-list
'("autobib" "autocite" "auto")))
("clearlang" ("true" "false"))
("autolang" ("none" "hyphen" "other" "other*" "langname"))
("block" ("none" "space" "par" "nbpar" "ragged"))
("notetype" ("foot+end" "footonly" "endonly"))
("hyperref" ("true" "false" "auto"))
("backref" ("true" "false"))
("backrefstyle" ("none" "three" "two" "two+" "three+" "all+"))
("backrefsetstyle" ("setonly" "memonly" "setormem" "setandmem" "memandset"
"setplusmem"))
("indexing" ("true" "false" "cite" "bib"))
("loadfiles" ("true" "false"))
("refsection" ("none" "part" "chapter" "section" "subsection"))
("refsegment" ("none" "part" "chapter" "section" "subsection"))
("citereset" ("none" "part" "chapter" "section" "subsection"))
("abbreviate" ("true" "false"))
("date" ("short" "long" "terse" "comp" "iso8601"))
("datelabel" ("year" "short" "long" "terse" "comp" "iso8601"))
("origdate" ("short" "long" "terse" "comp" "iso8601"))
("eventdate" ("short" "long" "terse" "comp" "iso8601"))
("urldate" ("short" "long" "terse" "comp" "iso8601"))
("alldates" ("short" "long" "terse" "comp" "iso8601"))
("datezeros" ("true" "false"))
("dateabbrev" ("true" "false"))
("defernumbers" ("true" "false"))
("punctfont" ("true" "false"))
("arxiv" ("abs" "ps" "pdf" "format"))
("texencoding" ("auto"))
("bibencoding" ("auto"))
("safeinputenc" ("true" "false"))
("bibwarn" ("true" "false"))
("mincrossrefs")
;; Style-specific
("isbn" ("true" "false"))
("url" ("true" "false"))
("doi" ("true" "false"))
("eprint" ("true" "false"))
;; Internal
("pagetracker" ("true" "false" "page" "spread"))
("citecounter" ("true" "false" "context"))
("citetracker" ("true" "false" "context" "strict" "constrict"))
("ibidtracker" ("true" "false" "context" "strict" "constrict"))
("opcittracker" ("true" "false" "context" "strict" "constrict"))
("loccittracker" ("true" "false" "context" "strict" "constrict"))
("idemtracker" ("true" "false" "context" "strict" "constrict"))
("parentracker" ("true" "false"))
("maxparens")
("firstinits" ("true" "false"))
("sortfirstinits" ("true" "false"))
("terseinits" ("true" "false"))
("labelalpha" ("true" "false"))
("maxalphanames")
("minalphanames")
("labelnumber" ("true" "false"))
("labeltitle" ("true" "false"))
("labeltitleyear" ("true" "false"))
("labeldate" ("true" "false"))
("singletitle" ("true" "false"))
("uniquename" ("true" "false" "init" "full" "allinit" "allfull" "mininit"
"minfull"))
("uniquelist" ("true" "false" "minyear")))
"Key=value options for ExecuteBibliographyOptions macro of the biblatex package.")
;; See table 2 of Biblatex reference manual.
(defvar LaTeX-biblatex-language-list
'("catalan" "croatian" "czech" "danish" "dutch" "american" "british"
"canadian" "australian" "newzealand" "finnish" "french" "german" "austrian"
"ngernam" "naustrian" "greek" "italian" "norwegian" "polish" "brazilian"
"portuguese" "russian" "spanish" "swedish")
"List of languages supported by biblatex packages.")
(defvar LaTeX-biblatex-addbibresource-options
'(("label")
("location" ("local" "remote"))
("type" ("file"))
("datatype" ("bibtex" "ris" "zoterordfxml" "endnotexml")))
"Key=value options for addbibresource macro of the biblatex package.")
(defun LaTeX-arg-addbibresource (optional &optional prompt)
"Prompt for a BibLaTeX database file.
If OPTIONAL is non-nil, insert the resulting value as an optional
argument, otherwise as a mandatory one. Use PROMPT as the prompt
string."
(let (files inputs database)
(if LaTeX-using-Biber
(setq files 'TeX-Biber-global-files
inputs 'biberinputs)
(setq files 'BibTeX-global-files
inputs 'bibinputs))
(setq files 'TeX-Biber-global-files
inputs 'biberinputs)
(message "Searching for BibLaTeX files...")
(or (symbol-value files)
(set files (mapcar 'list (TeX-search-files-by-type
'biberinputs 'global t nil))))
(setq database (completing-read
(TeX-argument-prompt optional prompt "BibLaTeX files")
(append (mapcar 'list (TeX-search-files-by-type
inputs 'local t nil))
(symbol-value files))))
(LaTeX-add-bibliographies database)
;; Run style file associated to the bibliography database file in order to
;; immediately fill `LaTeX-bibitem-list'. We need to strip the extension
;; because AUCTeX style files don't use it.
(TeX-run-style-hooks (file-name-sans-extension database))
(TeX-argument-insert database optional)))
;; Support for multicite commands, see § 3.7.3 of Biblatex reference manual.
(defun LaTeX-arg-biblatex-cites (optional &optional prompt)
"Prompt for citations with completion until input is empty.
Prompt also for optional prenotes and postnotes. If OPTIONAL is
non-nil, insert the citation key as an optional argument,
otherwise as a mandatory one. Use PROMPT as the prompt string
for citation keys."
;; Prompt for global prenote and postnote.
(and TeX-arg-cite-note-p (not current-prefix-arg)
(let ((TeX-arg-opening-brace "(")
(TeX-arg-closing-brace ")")
(prenote (TeX-read-string
(TeX-argument-prompt t nil "Global prenote"))))
(TeX-argument-insert prenote t)
;; If the prenote is empty the postnote is optional, otherwise it's
;; mandatory.
(TeX-argument-insert
(TeX-read-string (TeX-argument-prompt t nil "Global postnote"))
(equal prenote ""))))
(let ((items t) (noinsert nil))
(while items
;; Prompt for prenote and postnote of the current keys.
(and TeX-arg-cite-note-p (not current-prefix-arg)
(let ((TeX-arg-opening-brace "[")
(TeX-arg-closing-brace "]")
(prenote (TeX-read-string
(TeX-argument-prompt t nil "Prenote"))))
(TeX-argument-insert prenote t)
;; If the prenote is empty the postnote is optional, otherwise it's
;; mandatory.
(TeX-argument-insert
(TeX-read-string (TeX-argument-prompt t nil "Postnote"))
(equal prenote ""))))
(setq items (if (and (fboundp 'reftex-citation)
(fboundp 'reftex-plug-flag)
(reftex-plug-flag 3))
;; Use RefTeX when enabled.
(reftex-citation t)
;; Multiple citation keys in each argument are allowed.
(TeX-completing-read-multiple
(TeX-argument-prompt optional prompt "Key(s)")
(LaTeX-bibitem-list))))
(apply 'LaTeX-add-bibitems items)
;; If input is empty, insert an empty group only the first time, when
;; `noinsert' flag is nil.
(unless (and (not items) noinsert)
(TeX-argument-insert (mapconcat 'identity items ",") optional))
(setq noinsert t))))
(defun LaTeX-arg-biblatex-natbib-notes (optional)
"Prompt for two note arguments of a natbib compat citation command."
(when TeX-arg-cite-note-p
(let ((pre (TeX-read-string
(TeX-argument-prompt optional nil "Prenote")))
(post (TeX-read-string
(TeX-argument-prompt optional nil "Postnote"))))
(TeX-argument-insert pre optional)
(TeX-argument-insert post optional)
;; pre is given, post is empty: Make sure that we insert an
;; extra pair of `[]', otherwise pre becomes post
(when (and pre (not (string= pre ""))
(string= post ""))
(insert LaTeX-optop LaTeX-optcl)))))
(TeX-add-style-hook
"biblatex"
(lambda ()
;; Biblatex uses as default backend biber, run it unless biblatex `backend'
;; option value is one of `bibtex', `bibtex8', `bibtexu'. Autodetection of
;; the backend can be overridden by setting `LaTeX-biblatex-use-Biber' as a
;; local variable.
(setq LaTeX-using-Biber
(if (local-variable-p 'LaTeX-biblatex-use-Biber (current-buffer))
LaTeX-biblatex-use-Biber
(not (or (LaTeX-provided-package-options-member
"biblatex" "backend=bibtex")
(LaTeX-provided-package-options-member
"biblatex" "backend=bibtex8")
(LaTeX-provided-package-options-member
"biblatex" "backend=bibtexu")))))
(TeX-run-style-hooks
"etoolbox"
"keyval"
"kvoptions"
"logreq"
"ifthen"
"url")
(TeX-add-symbols
;;; Global Customization
;; Setting Package Options
'("ExecuteBibliographyOptions"
[TeX-arg-eval mapconcat 'identity
(TeX-completing-read-multiple
"Entry type: " LaTeX-biblatex-entrytype) ","]
(TeX-arg-key-val LaTeX-biblatex-executebibliographyoptions-options))
;;; Bibliography Commands
;; Resources
'("addbibresource" [TeX-arg-key-val LaTeX-biblatex-addbibresource-options]
LaTeX-arg-addbibresource)
'("addglobalbib" [TeX-arg-key-val LaTeX-biblatex-addbibresource-options]
LaTeX-arg-addbibresource)
'("addsectionbib" [TeX-arg-key-val LaTeX-biblatex-addbibresource-options]
LaTeX-arg-addbibresource)
;; The Bibliography
'("printbibliography"
[TeX-arg-key-val (("env") ("heading") ("title") ("prenote") ("postnote")
("section") ("segment") ("sorting") ("type") ("nottype")
("subtype") ("notsubtype") ("keyword") ("notkeyword")
("categoy") ("notcategory") ("filter") ("check")
("prefixnumbers") ("resetnumbers" ("true" "false"))
("omitnumbers" ("true" "false")))])
'("bibbysection"
[TeX-arg-key-val (("env") ("heading") ("prenote") ("postnote"))])
'("bibbysegment"
[TeX-arg-key-val (("env") ("heading") ("prenote") ("postnote"))])
'("bibbycategory"
[TeX-arg-key-val (("env") ("prenote") ("postnote") ("section"))])
'("printbibheading"
[TeX-arg-key-val (("heading") ("title"))])
;; The List of Shorthands
'("printshorthands"
[TeX-arg-key-val (("env") ("heading") ("title") ("prenote") ("postnote")
("section") ("segment") ("sorting") ("type") ("nottype")
("subtype") ("notsubtype") ("keyword") ("notkeyword")
("categoy") ("notcategory") ("filter") ("check"))])
;; Bibliography Sections
'("newrefsection" ["Resources"])
"endrefsection"
;; Bibliography Segments
"newrefsegment"
"endrefsegment"
;; Bibliography Categories
'("DeclareBibliographyCategory" "Category")
'("addtocategory" "Category" TeX-arg-cite)
;; Bibliography Headings and Environments
'("defbibenvironment" "Name" 3)
'("defbibheading" "Name" ["Title"] t)
;; Bibliography Notes
'("defbibnote" "Name" "Text")
;; Bibliography Filters and Checks
'("defbibfilter" "Name" t)
'("defbibcheck" "Name" t)
;; Dynamic Entry Sets
'("defbibentryset" "Set"
(TeX-arg-eval mapconcat 'identity (TeX-completing-read-multiple
"Keys: " (LaTeX-bibitem-list)) ","))
;;; Citation Commands
'("cite" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("Cite" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("parencite" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("Parencite" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("footcite" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("footcitetext" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
;; Style-specific Commands
'("textcite" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("Textcite" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("smartcite" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("Smartcite" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("cite*" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("parencite*" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("supercite" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
;; Qualified Citation Lists
'("cites" LaTeX-arg-biblatex-cites)
'("Cites" LaTeX-arg-biblatex-cites)
'("parencites" LaTeX-arg-biblatex-cites)
'("Parencites" LaTeX-arg-biblatex-cites)
'("footcites" LaTeX-arg-biblatex-cites)
'("footcitetexts" LaTeX-arg-biblatex-cites)
'("smartcites" LaTeX-arg-biblatex-cites)
'("Smartcites" LaTeX-arg-biblatex-cites)
'("textcites" LaTeX-arg-biblatex-cites)
'("Textcites" LaTeX-arg-biblatex-cites)
'("supercites" LaTeX-arg-biblatex-cites)
;; Style-independent Commands
'("autocite" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("Autocite" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("autocite*" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("Autocite*" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("autocites" LaTeX-arg-biblatex-cites)
'("Autocites" LaTeX-arg-biblatex-cites)
;; Text Commands
'("citeauthor" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("Citeauthor" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("citeauthor*" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("Citeauthor*" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("citetitle" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("citetitle*" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("citeyear" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("citeyear*" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("citedate" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("citedate*" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("citeurl" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("parentext" "Text")
'("brackettext" "Text")
;; Special Commands
'("fullcite" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("footfullcite" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("volcite"
(TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
(TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
'("Volcite"
(TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
(TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
'("Pvolcite"
(TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
(TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
'("Pvolcite"
(TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
(TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
'("fvolcite"
(TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
(TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
'("ftolcite"
(TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
(TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
'("svolcite"
(TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
(TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
'("Svolcite"
(TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
(TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
'("tvolcite"
(TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
(TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
'("Tvolcite"
(TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
(TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
'("avolcite"
(TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
(TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
'("Avolcite"
(TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"]) ()) "Volume"
(TeX-arg-conditional TeX-arg-cite-note-p (["Page"]) ()) TeX-arg-cite)
'("notecite" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("Notecite" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("pnotecite" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("Pnotecite" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
'("fnotecite" (TeX-arg-conditional TeX-arg-cite-note-p
(["Prenote"] ["Postnote"]) ()) TeX-arg-cite)
;; Low-level Commands
'("citename"
(TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"] ["Postnote"]) ())
TeX-arg-cite (TeX-arg-conditional TeX-arg-cite-note-p (["Format"]) ())
"Name list")
'("citelist"
(TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"] ["Postnote"]) ())
TeX-arg-cite (TeX-arg-conditional TeX-arg-cite-note-p (["Format"]) ())
"Literal list")
'("citefield"
(TeX-arg-conditional TeX-arg-cite-note-p (["Prenote"] ["Postnote"]) ())
TeX-arg-cite (TeX-arg-conditional TeX-arg-cite-note-p (["Format"]) ())
"Field")
;; Miscellaneous Commands
"citereset"
"citereset*"
"mancite"
"pno"
"ppno"
"nopp"
"psq"
"psqq"
'("RN" "Integer")
'("Rn" "Integer")
;; Localization Commands
'("DefineBibliographyStrings"
(TeX-arg-eval completing-read "Language: " LaTeX-biblatex-language-list) t)
'("DefineBibliographyExtras"
(TeX-arg-eval completing-read "Language: " LaTeX-biblatex-language-list) t)
'("UndefineBibliographyExtras"
(TeX-arg-eval completing-read "Language: " LaTeX-biblatex-language-list) t)
'("DefineHyphenationExceptions"
(TeX-arg-eval completing-read "Language: " LaTeX-biblatex-language-list) t)
"NewBibliographyString")
;; § 3.8.9 natbib Compatibility Commands
(when (or (LaTeX-provided-package-options-member "biblatex" "natbib")
(LaTeX-provided-package-options-member "biblatex" "natbib=true"))
(let ((cmds '(("citet" . 1) ("citet*" . 1)
("Citet" . 1) ("Citet*" . 1)
("citep" . 2) ("citep*" . 2)
("Citep" . 2) ("Citep*" . 2)
("citealt" . 1) ("citealt*" . 1)
("Citealt" . 1) ("Citealt*" . 1)
("citealp" . 2) ("citealp*" . 2)
("Citealp" . 2) ("Citealp*" . 2))))
;; Taken from natbib.el:
(apply
#'TeX-add-symbols
(mapcar
(lambda (cmd)
(cond
((= (cdr cmd) 1)
;; Just one optional argument, the post note
(list
(car cmd)
'(TeX-arg-conditional TeX-arg-cite-note-p (["Postnote"]) nil)
'TeX-arg-cite))
((= (cdr cmd) 2)
;; Pre and post notes
(list
(car cmd)
'(TeX-arg-conditional TeX-arg-cite-note-p
([LaTeX-arg-biblatex-natbib-notes])
nil)
'TeX-arg-cite))))
cmds))
;; Fontification for compat macros does not go into `font-latex.el':
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("citet" "*[[{")
("Citet" "*[[{")
("citep" "*[[{")
("Citep" "*[[{")
("citealt" "*[[{")
("Citealt" "*[[{")
("citealp" "*[[{")
("Citealp" "*[[{"))
'biblatex))))
(LaTeX-add-environments
;;; Bibliography commands
;; Bibliography Sections
'("refsection" ["Resources"])
;; Bibliography Segments
"refsegment")
;; Declaring expert macros and environments. Criterion: all macros and
;; environments to fine tune the bibliography, probably they will be used
;; only by expert users.
(TeX-declare-expert-macros
"biblatex"
"ExecuteBibliographyOptions" "printshorthands" "newrefsection"
"endrefsection" "newrefsegment" "endrefsegment"
"DeclareBibliographyCategory" "addtocategory" "defbibenvironment"
"defbibheading" "defbibnote" "defbibfilter" "defbibcheck" "defbibentryset"
"citereset" "citereset*" "mancite" "pno" "ppno" "nopp" "psq" "psqq" "RN"
"Rn" "DefineBibliographyStrings" "DefineBibliographyExtras"
"UndefineBibliographyExtras" "DefineHyphenationExceptions"
"NewBibliographyString")
(LaTeX-declare-expert-environments
"biblatex"
"refsection" "refsegment")
;; Tell RefTeX: If package option `natbib' is given, activate that
;; format, otherwise stick with `biblatex':
(when (and LaTeX-reftex-cite-format-auto-activate
(fboundp 'reftex-set-cite-format))
(if (or (LaTeX-provided-package-options-member "biblatex" "natbib")
(LaTeX-provided-package-options-member "biblatex" "natbib=true"))
(reftex-set-cite-format 'natbib)
;; The entry `biblatex' is defined in
;; `reftex-cite-format-builtin' in reftex-vars.el which will be
;; part of Emacs >= 25.3. So check here if we find an entry,
;; otherwise do it manually for older Emacsen.
(if (assoc 'biblatex reftex-cite-format-builtin)
(reftex-set-cite-format 'biblatex)
(reftex-set-cite-format
'((?\C-m . "\\cite[][]{%l}")
(?C . "\\cite*[][]{%l}")
(?t . "\\textcite[][]{%l}")
(?T . "\\textcite*[][]{%l}")
(?p . "\\parencite[][]{%l}")
(?P . "\\parencite*[][]{%l}")
(?f . "\\footcite[][]{%l}")
(?s . "\\smartcite[][]{%l}")
(?u . "\\autocite[][]{%l}")
(?U . "\\autocite*[][]{%l}")
(?a . "\\citeauthor{%l}")
(?A . "\\citeauthor*{%l}")
(?i . "\\citetitle{%l}")
(?I . "\\citetitle*{%l}")
(?y . "\\citeyear{%l}")
(?Y . "\\citeyear*{%l}")
(?n . "\\nocite{%l}")))))))
LaTeX-dialect)
(defvar LaTeX-biblatex-package-options-list
(append
;;; Preamble Options
LaTeX-biblatex-executebibliographyoptions-options
'(;;; Load-time Options
("backend" ("biber" "bibtex" "bibtexu" "bibtex8"))
("style" BibLaTeX-global-style-files)
("bibstyle" BibLaTeX-global-style-files)
("citestyle" BibLaTeX-global-style-files)
("natbib" ("true" "false"))
("mcite" ("true" "false"))
;;; Entry Options
;; Preamble/Type/Entry Options
("useauthor" ("true" "false"))
("useeditor" ("true" "false"))
("usetranslator" ("true" "false"))
("useprefix" ("true" "false"))
("indexing" ("true" "false" "cite" "bib"))
;; Type/Entry Options are not available globally.
;; Legacy Options (deprecated)
("openbib")))
"Package options for the biblatex package.")
(defun LaTeX-biblatex-package-options nil
"Prompt for package options for the biblatex package."
(unless BibLaTeX-global-style-files
(if (if (eq TeX-arg-input-file-search 'ask)
(not (y-or-n-p "Find BibLaTeX style yourself? "))
TeX-arg-input-file-search)
;; ...then, search for BibLaTeX styles.
(progn
(message "Searching for BibLaTeX styles...")
(setq BibLaTeX-global-style-files
(TeX-search-files-by-type 'bbxinputs 'global t t)))
;; ...else, use for completion only standard BibLaTeX styles (see §3.3 of
;; Biblatex reference manual).
(setq BibLaTeX-global-style-files
'("numeric" "numeric-comp" "numeric-verb" "alphabetic"
"alphabetic-verb" "authoryear" "authoryear-comp" "authoryear-ibid"
"authoryear-icomp" "authortitle" "authortitle-comp"
"authortitle-ibid" "authortitle-icomp" "authortitle-terse"
"authortitle-tcomp" "authortitle-ticomp" "verbose" "verbose-ibid"
"verbose-note" "verbose-inote" "verbose-trad1" "verbose-trad2"
"verbose-trad3" "reading" "draft" "debug"))))
(TeX-read-key-val t LaTeX-biblatex-package-options-list))
;;; biblatex.el ends here

View File

@@ -0,0 +1,183 @@
;;; bicaption.el --- AUCTeX style for `bicaption.sty' (v1.1-158)
;; Copyright (C) 2016, 2017 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2016-11-11
;; 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 `bicaption.sty' (v1.1-158) from
;; 2016/03/27. `bicaption.sty' is part of TeXLive.
;; If things do not work or when in doubt, press `C-c C-n'. Comments
;; for improvement are welcome.
;;; Code:
(defvar LaTeX-bicaption-key-val-options
'(("bi-lang" ("first" "second" "both"))
("bi-singlelinecheck" ("false" "no" "off" "0" "true" "yes" "on" "1"))
("bi-slc" ("false" "no" "off" "0" "true" "yes" "on" "1"))
("bi-swap" ("false" "no" "off" "0" "true" "yes" "on" "1"))
("listtype+"))
"Key=value options for bicaption macros.")
(defun LaTeX-arg-bicaption-bicaption (optional &optional prompt star cap-box label-inside)
"Query for the arguments of \"\\bicaption\" incl. a label and insert them.
PROMPT replaces the standard one. If STAR is non-nil, then do
not query for a \\label and short captions, insert only captions.
If CAP-BOX is non-nil, also query and include optional arguments
for the box command. If LABEL-INSIDE is non-nil, insert \\label
inside the first mandatory argument, otherwise after all
arguments."
(let* (;; \bisubcaption needs an environment, "minipage" will be
;; popular. If so, check next higher environment to find out
;; where we are
(currenv (if (string= (LaTeX-current-environment) "minipage")
(LaTeX-current-environment 2)
(LaTeX-current-environment)))
(captionI (TeX-read-string
(TeX-argument-prompt
optional (when prompt
(concat "1. " prompt "bicaption"))
"1. bicaption")))
(short-captionI
(when (and (not star)
(>= (length captionI) LaTeX-short-caption-prompt-length))
(TeX-read-string
(TeX-argument-prompt t (when prompt
(concat "Short 1. " prompt "bicaption"))
"Short 1. bicaption"))))
(captionII (TeX-read-string
(TeX-argument-prompt
optional (when prompt
(concat "2. " prompt "bicaption"))
"2. bicaption")))
(short-captionII
(when (and (not star)
(>= (length captionII) LaTeX-short-caption-prompt-length))
(TeX-read-string
(TeX-argument-prompt t (when prompt
(concat "Short 2. " prompt "bicaption"))
"Short 2. bicaption")))))
(indent-according-to-mode)
;; Insert short & regular 1. caption
(when (and short-captionI (not (string= short-captionI "")))
(insert LaTeX-optop short-captionI LaTeX-optcl))
(insert TeX-grop captionI)
;; For \bi(sub)?captionbox, the label must be inserted here
(when (and label-inside (not star))
(LaTeX-label currenv 'environment))
(insert TeX-grcl)
(LaTeX-fill-paragraph)
(LaTeX-newline)
(indent-according-to-mode)
;; Insert short & regular 2. caption
(when (and short-captionII (not (string= short-captionII "")))
(insert LaTeX-optop short-captionII LaTeX-optcl))
(insert TeX-grop captionII TeX-grcl)
;; Insert width & pos in case of captionbox macros:
(when cap-box
(let* ((TeX-arg-opening-brace "[")
(TeX-arg-closing-brace "]")
(width (completing-read (TeX-argument-prompt t nil "Width")
(mapcar (lambda (elt) (concat TeX-esc (car elt)))
(LaTeX-length-list))))
(inpos (if (and width (not (string-equal width "")))
(completing-read (TeX-argument-prompt t nil "Inner position")
'("c" "l" "r" "s"))
"")))
(TeX-argument-insert width t)
(TeX-argument-insert inpos t)))
(LaTeX-fill-paragraph)
;; Insert label -- a new line is inserted only if label is there:
(when (and (not label-inside) (not star)
(save-excursion (LaTeX-label currenv 'environment)))
(LaTeX-newline)
(indent-according-to-mode)
(end-of-line))))
(defun LaTeX-arg-bicaption-captionsetup (optional)
"Query for 2 arguments for \"\\captionsetup\" with bicaption.sty loaded.
When OPTIONAL is non-nil, include both as optional arguments in
square brackets."
(let* ((flttype (completing-read (TeX-argument-prompt optional nil "Float type")
LaTeX-caption-supported-float-types))
(biflt (if (and (not (or (string= flttype "bi")
(string= flttype "bi-first")
(string= flttype "bi-second")))
flttype (not (string= flttype "")))
(completing-read (TeX-argument-prompt optional nil "Bicaption type")
'("bi" "bi-first" "bi-second"))
"")))
(TeX-argument-insert flttype optional)
(TeX-argument-insert biflt optional)))
(TeX-add-style-hook
"bicaption"
(lambda ()
;; Load caption.el:
(TeX-run-style-hooks "caption")
;; Macros
(TeX-add-symbols
'("bicaption" (LaTeX-arg-bicaption-bicaption))
'("bicaption*" (LaTeX-arg-bicaption-bicaption nil t))
'("bicaptionbox" (LaTeX-arg-bicaption-bicaption nil nil t t) t)
'("bicaptionbox*" (LaTeX-arg-bicaption-bicaption nil t t) t)
'("bisubcaption" (LaTeX-arg-bicaption-bicaption "sub-"))
'("bisubcaption*" (LaTeX-arg-bicaption-bicaption "sub-" t))
'("bisubcaptionbox" (LaTeX-arg-bicaption-bicaption "sub-" nil t t) t)
'("bisubcaptionbox*" (LaTeX-arg-bicaption-bicaption "sub-" t t t) t))
;; \bi(sub)?caption(box)? macros should get their own lines
(LaTeX-paragraph-commands-add-locally '("bicaption" "bicaptionbox"
"bisubcaption" "bisubcaptionbox"))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("bicaption" "*[{[{")
("bicaptionbox" "*[{[{[[")
("bisubcaption" "*[{[{")
("bisubcaptionbox" "*[{[{[["))
'textual)))
LaTeX-dialect)
(defun LaTeX-bicaption-package-options ()
"Prompt for package options for the bicaption package."
(TeX-read-key-val t
(append
`(,(list "language"
(cond ((and (member "babel" (TeX-style-list))
(LaTeX-babel-active-languages))
(butlast (LaTeX-babel-active-languages)))
((and (member "polyglossia" (TeX-style-list))
(LaTeX-polyglossia-active-languages))
(butlast (LaTeX-babel-active-languages)))
(t nil))))
LaTeX-bicaption-key-val-options
LaTeX-caption-key-val-options)))
;;; bicaption.el ends here

View File

@@ -0,0 +1,59 @@
;;; bidi.el --- AUCTeX style for the (XeLaTeX) bidi package
;; Copyright (C) 2016 Free Software Foundation, Inc.
;; Author: Uwe Brauer <oub@mat.ucm.es>
;; Created: 2016-03-06
;; 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 bidi package.
;;; Code:
(defvar LaTeX-bidi-package-options '("RTLdocument" "rldocument")
"Package options for the bidi package.")
(TeX-add-style-hook
"bidi"
(lambda ()
(TeX-check-engine-add-engines 'xetex)
(LaTeX-add-environments
"LTR"
"RTL")
;; Fontification
(TeX-add-symbols
'("setRL" 0)
'("unsetRL" 0)
'("setRTL" 0)
'("unsetRTL" 0)
'("setLR" 0)
'("unsetLR" 0)
'("setLTR" 0)
'("unsetLTR" 0)
'("LR" 1)
'("LRE" 1)
'("RLE" 1)
'("RL" 1)))
LaTeX-dialect)
;;; bidi.el ends here

View File

@@ -0,0 +1,40 @@
;;; bidibeamer.el --- AUCTeX style for the bidibeamer class
;; Copyright (C) 2015 Free Software Foundation
;; Author: Tassilo Horn <tsdh@gnu.org>
;; Created: 2015-03-08
;; 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 bidibeamer class which offers the same
;; functionality and interface as latex-beamer, so we simply call the style
;; hook of the latter.
;;; Code:
(TeX-add-style-hook
"bidibeamer"
(lambda ()
(TeX-run-style-hooks "beamer"))
LaTeX-dialect)
;;; bidibeamer.el ends here

View File

@@ -0,0 +1,53 @@
;;; bigdelim.el --- AUCTeX style for `bigdelim.sty'
;; Copyright (C) 2011 Free Software Foundation, Inc.
;; Author: Mads Jensen <mje@inducks.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2011-01-24
;; 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 `bigdelim.sty'.
;;; Code:
(TeX-add-style-hook
"bigdelim"
(lambda ()
(TeX-add-symbols
'("ldelim" TeX-arg-bigdelim-brace "Number of rows for multirow"
"Width in multirow" [ "Text in multirow" ])
'("rdelim" TeX-arg-bigdelim-brace "Number of rows for multirow"
"Width in multirow" [ "Text in multirow" ])))
LaTeX-dialect)
(defun TeX-arg-bigdelim-brace (optional &optional prompt)
"Prompt for a single brace, and do not insert the matching
right parentheses."
(let ((brace (read-from-minibuffer
(TeX-argument-prompt optional prompt "Brace") nil)))
(insert (format "%s" brace))))
(defvar LaTeX-bigdelim-package-options nil
"Package options for the bigdelim package.")
;;; bigdelim.el ends here

View File

@@ -0,0 +1,51 @@
;;; bigstrut.el --- AUCTeX style for `bigstrut.sty'
;; Copyright (C) 2012, 2014 Free Software Foundation, Inc.
;; Author: Mads Jensen <mje@inducks.org>
;; Maintainer: auctex-devel@gnu.org
;; 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 `bigstrut.sty'.
;;; Code:
(TeX-add-style-hook
"bigstrut"
(lambda ()
(TeX-add-symbols
"bigstrutsetup"
'("bigstrut" [ TeX-arg-bigstrut ])))
LaTeX-dialect)
(defun TeX-arg-bigstrut (optional &optional _prompt)
"Prompt for the optional argument in \\bigstrut."
(TeX-argument-insert
(completing-read (TeX-argument-prompt
optional "Strut to top (t) or bottom (b)" nil t)
(mapcar 'list '("t" "b")) nil t)
optional))
(defvar LaTeX-bigstrut-package-options nil
"Package options for the bigstrut package.")
;;; bigstrut.el ends here

View File

@@ -0,0 +1,55 @@
;;; bm.el --- AUCTeX style for `bm.sty'.
;; Copyright (C) 2012 Free Software Foundation, Inc.
;; Maintainer: auctex-devel@gnu.org
;; Author: Mosè Giordano <giordano.mose@libero.it>
;; 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 `bm.sty'.
;;; Code:
(TeX-add-style-hook "bm"
(lambda ()
(TeX-add-symbols
'("bm" 1)
'("hm" 1)
'("DeclareBoldMathCommand" [ "Math version" ] TeX-arg-define-macro "Math expression")
'("bmdefine" TeX-arg-define-macro "Math expression")
'("hmdefine" TeX-arg-define-macro "Math expression"))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("bm" "{")
("hm" "{"))
'bold-command)
(font-latex-add-keywords '(("DeclareBoldMathCommand" "[|{\\{")
("bmdefine" "|{\\{")
("hmdefine" "|{\\{"))
'function)))
LaTeX-dialect)
(defvar LaTeX-bm-package-options nil
"Package options for the bm package.")
;; bm.el ends here

View File

@@ -0,0 +1,21 @@
;;; book.el - Special code for book style.
;;; Code:
(defvar LaTeX-book-class-options
'("a4paper" "a5paper" "b5paper" "letterpaper" "legalpaper" "executivepaper"
"landscape" "10pt" "11pt" "12pt" "oneside" "twoside" "draft" "final"
"titlepage" "notitlepage" "openright" "openany" "onecolumn" "twocolumn"
"leqno" "fleqn" "openbib")
"Package options for the book class.")
(TeX-add-style-hook
"book"
(lambda ()
(LaTeX-largest-level-set "part")
(LaTeX-add-counters "part" "chapter" "section" "subsection" "subsubsection"
"paragraph" "subparagraph" "figure" "table")
(LaTeX-add-pagestyles "headings" "myheadings"))
LaTeX-dialect)
;;; book.el ends here

View File

@@ -0,0 +1,79 @@
;;; booktabs.el -- AUCTeX style for booktabs.sty
;; Copyright (C) 2003, 2004, 2013 Free Software Foundation, Inc.
;; Author: Ralf Angeli <angeli@iwi.uni-sb.de>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2003-10-21
;; 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 `booktabs.sty'.
;;; Code:
(defun LaTeX-booktabs-arg-paren (optional prompt)
"Prompt for a value and use parentheses when it is inserted.
If OPTIONAL is non-nil the parameter is labeled as optional.
PROMPT is the value of the prompt to be shown."
(let ((TeX-arg-opening-brace "\(")
(TeX-arg-closing-brace "\)"))
(TeX-parse-argument optional prompt)))
(TeX-add-style-hook
"booktabs"
(lambda ()
;; Do not append an empty group to toprule, midrule, and bottomrule macros,
;; otherwise one gets a wrong spacing in the table.
(setq TeX-insert-braces-alist (append TeX-insert-braces-alist
'(("toprule" . nil)
("midrule" . nil)
("bottomrule" . nil))))
;; New symbols
(TeX-add-symbols
'("toprule" [ "Thickness" ])
'("midrule" [ "Thickness" ])
'("bottomrule" [ "Thickness" ])
;; The `ignore' resets `last-optional-rejected' to nil so that the trim
;; argument is prompted also when the thickness is skipped.
'("cmidrule" [ "Thickness" ] (ignore) [ LaTeX-booktabs-arg-paren "Trim" ]
"Column(s)")
'("addlinespace" [ "Height" ])
'("morecmidrules")
'("specialrule" "Thickness" "Space above" "Space below"))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("toprule" "[")
("midrule" "[")
("bottomrule" "[")
("cmidrule" "[({")
("addlinespace" "[")
("morecmidrules" "")
("specialrule" "{{{"))
'function)))
LaTeX-dialect)
(defvar LaTeX-booktabs-package-options nil
"Package options for the booktabs package.")
;;; booktabs.el ends here

View File

@@ -0,0 +1,185 @@
;;; breqn.el --- AUCTeX style for `breqn.sty' (v0.98e)
;; Copyright (C) 2017 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2017-01-06
;; 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 `breqn.sty' (v0.98e) from 2017/01/27.
;; `breqn.sty' is part of TeXLive.
;; In breqn documentation, there is the following statement:
;;
;; 9 Various environment options
;;
;; Use of the normal \label command instead of the label option
;; works, I think, most of the time (untested).
;;
;; To be on the safe side, a label should be written in the optional
;; argument of an environment as value to the `label' key, e.g.:
;;
;; \begin{dmath}[label={eq:42}]
;; ...
;; \end{dmath}
;;
;; This style achieves this requirement by using the function
;; `LaTeX-env-label-as-keyval'.
;;; Code:
(defvar LaTeX-breqn-key-val-options
'(("style" ("\\tiny" "\\scriptsize" "\\footnotesize" "\\small"
"\\normalsize" "\\large" "\\Large" "\\LARGE"
"\\huge" "\\Huge"))
("number")
("indentstep")
("compact")
("spread")
("frame")
("framesep")
("background")
("color")
("breakdepth"))
"Key=value options for breqn environments.
The keys \"label\" and \"labelprefix\" are omitted.")
(defvar LaTeX-breqn-key-val-options-local nil
"Buffer-local key=value options for breqn environments.")
(make-variable-buffer-local 'LaTeX-breqn-key-val-options-local)
(defvar LaTeX-breqn-key-val-label-regexp
`(,(concat
"\\\\begin{"
(regexp-opt '("dmath" "dseries" "dgroup" "darray"))
"}"
"\\(?:\\[[^][]*"
"\\(?:{[^}{]*"
"\\(?:{[^}{]*"
"\\(?:{[^}{]*}[^}{]*\\)*"
"}[^}{]*\\)*"
"}[^][]*\\)*"
"label[ \t]*=[ \t]*{\\([^}]+\\)}"
"\\(?:[^]]*\\)*"
"\\]\\)")
1 LaTeX-auto-label)
"Matches the label inside an optional argument after \\begin{<breqn-env's>}.")
(defun LaTeX-breqn-env (env)
"Insert ENV from breqn package incl. optional key=val argument.
Keys offered for key=val query depend on ENV. \"label\" and
\"labelprefix\" are omitted."
(let ((keyvals
(TeX-read-key-val t
(cond ((or (string= env "dgroup")
(string= env "dgroup*"))
(append '(("noalign") ("brace"))
LaTeX-breqn-key-val-options-local))
((or (string= env "darray")
(string= env "darray*"))
(append '(("noalign") ("brace") ("cols" ("{}")))
LaTeX-breqn-key-val-options-local))
(t LaTeX-breqn-key-val-options-local)))))
(LaTeX-insert-environment env (when (and keyvals
(not (string= keyvals "")))
(concat LaTeX-optop keyvals LaTeX-optcl)))
(LaTeX-env-label-as-keyval nil nil keyvals env)))
(defun LaTeX-breqn-update-color-keys ()
"Update color relevant keys from `LaTeX-breqn-key-val-options-local'."
(when (or (member "xcolor" (TeX-style-list))
(member "color" (TeX-style-list)))
(let* ((colorcmd (if (member "xcolor" (TeX-style-list))
#'LaTeX-xcolor-definecolor-list
#'LaTeX-color-definecolor-list))
(keys '("color" "background"))
(tmp (copy-alist LaTeX-breqn-key-val-options-local)))
(dolist (x keys)
(setq tmp (assq-delete-all (car (assoc x tmp)) tmp))
(push (list x (mapcar #'car (funcall colorcmd))) tmp))
(setq LaTeX-breqn-key-val-options-local
(copy-alist tmp)))))
(add-hook 'TeX-auto-cleanup-hook #'LaTeX-breqn-update-color-keys t)
(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
(TeX-add-style-hook
"breqn"
(lambda ()
;; Local version of key-val options
(setq LaTeX-breqn-key-val-options-local
(copy-alist LaTeX-breqn-key-val-options))
;; Add breqn to parser:
(TeX-auto-add-regexp LaTeX-breqn-key-val-label-regexp)
;; Tell AUCTeX that we want to prefix the labels with `LaTeX-equation-label':
(let ((envs '("dmath" "dseries" "dgroup" "darray")))
(dolist (env envs)
(add-to-list 'LaTeX-label-alist `(,env . LaTeX-equation-label) t)))
;; For RefTeX, we must distinguish between equation and eqnarray-like:
;; breqn env == equivalent -- starred
;; dmath == equation -- dmath* == unnumbered
;; dseries == equation -- dseries* == unnumbered
;; dgroup == align -- dgroup* == unnumbered
;; darray == eqnarray -- darray* == unnumbered
(when (fboundp 'reftex-add-label-environments)
(dolist (env '("dmath" "dseries" "dgroup"))
(reftex-add-label-environments `((,env ?e nil nil t))))
(reftex-add-label-environments '(("darray" ?e nil nil eqnarray-like))))
(LaTeX-add-environments
'("dmath" LaTeX-breqn-env)
'("dmath*" LaTeX-breqn-env)
'("dseries" LaTeX-breqn-env)
'("dseries*" LaTeX-breqn-env)
'("dgroup" LaTeX-breqn-env)
'("dgroup*" LaTeX-breqn-env)
'("darray" LaTeX-breqn-env)
'("darray*" LaTeX-breqn-env)
'("dsuspend"))
(TeX-add-symbols
'("condition" [ "Punctuation mark (default ,)" ] t)
'("condition*" [ "Punctuation mark (default ,)" ] t)
'("hiderel" t))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup)
(boundp 'font-latex-math-environments))
(make-local-variable 'font-latex-math-environments)
(let ((envs '(;; Do not insert the starred versions here;
;; function `font-latex-match-math-envII' takes
;; care of it
"dmath" "dseries" "dgroup" "darray")))
(dolist (env envs)
(add-to-list 'font-latex-math-environments env t)))))
LaTeX-dialect)
(defvar LaTeX-breqn-package-options nil
"Package options for the breqn package.")
;;; breqn.el ends here

View File

@@ -0,0 +1,55 @@
;;; bulgarian.el --- AUCTeX style for the `bulgarian' babel option.
;; Copyright (C) 2008 Free Software Foundation, Inc.
;; Author: Ralf Angeli <angeli@caeruleus.net>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2008-06-28
;; 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:
;; Set up AUCTeX for editing Bulgarian text in connection with the
;; `bulgarian' babel option.
;;; Code:
(defvar LaTeX-bulgarian-mode-syntax-table
(copy-syntax-table LaTeX-mode-syntax-table)
"Syntax table used in LaTeX mode when using `bulgarian.sty'.")
(modify-syntax-entry ?\" "w" LaTeX-bulgarian-mode-syntax-table)
(TeX-add-style-hook
"bulgarian"
(lambda ()
(set-syntax-table LaTeX-bulgarian-mode-syntax-table)
(unless (eq (car TeX-quote-language) 'override)
(setq TeX-quote-language
`("bulgarian" "\"`" "\"'" ,TeX-quote-after-quote)))
(setq LaTeX-babel-hyphen-language "bulgarian")
;; Fontification of quotation marks.
(when (fboundp 'font-latex-add-quotes)
(font-latex-add-quotes '("\"`" "\"'"))
(font-latex-add-quotes '("\"<" "\">" french)))
(run-hooks 'TeX-language-bg-hook))
LaTeX-dialect)
;;; bulgarian.el ends here

View File

@@ -0,0 +1,40 @@
;;; canadian.el --- AUCTeX style for the `canadian' babel option.
;; Copyright (C) 2017 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2017-07-02
;; 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:
;; Set up AUCTeX for editing Canadian text in connection with the
;; `canadian' babel option.
;;; Code:
(TeX-add-style-hook
"canadian"
(lambda ()
(TeX-run-style-hooks "english"))
LaTeX-dialect)
;;; canadian.el ends here

View File

@@ -0,0 +1,47 @@
;; captcont.el --- AUCTeX style file for captcont.sty
;; Copyright (C) 2003, 2005 Free Software Foundation, Inc.
;; Author: Reiner Steib <Reiner.Steib@gmx.de>
;; Maintainer: auctex-devel@gnu.org
;; 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:
;; AUCTeX style file for captcont.sty
;;; Code:
(TeX-add-style-hook
"captcont"
(lambda ()
(TeX-add-symbols
'("captcont" [ "list entry" ] "Caption")
'("captcont*" [ "list entry" ] "Caption"))
;; Fontification
(when (featurep 'font-latex)
(font-latex-add-keywords '(("captcont" "*[{")) 'textual)))
LaTeX-dialect)
(defvar LaTeX-captcont-package-options '("figbotcap" "figtopcap" "tabbotcap"
"tabtopcap")
"Package options for the captcont package.")
;;; captcont.el ends here

View File

@@ -0,0 +1,463 @@
;;; caption.el --- AUCTeX style for `caption.sty' (v3.3-111)
;; Copyright (C) 2015--2017 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2015-02-21
;; 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 `caption.sty' (v3.3-111) from 2015/09/17.
;; `caption.sty' is part of TeXLive.
;; If things do not work or when in doubt, press `C-c C-n'. Comments
;; for improvement are welcome.
;;; Code:
;; Needed for compiling `pushnew':
(eval-when-compile (require 'cl))
;; Needed for auto-parsing.
(require 'tex)
(defvar LaTeX-caption-key-val-options
'(("aboveskip")
("belowskip")
("font" ("scriptsize" "footnotesize" "small" "normalsize" "large"
"Large" "normalfont" "up" "it" "sl" "sc" "md" "bf" "rm"
"sf" "tt" "singlespacing" "onehalfspacing" "doublespacing"
"stretch" "normalcolor" "color" "normal"))
("font+" ("scriptsize" "footnotesize" "small" "normalsize" "large"
"Large" "normalfont" "up" "it" "sl" "sc" "md" "bf" "rm"
"sf" "tt" "singlespacing" "onehalfspacing" "doublespacing"
"stretch" "normalcolor" "color" "normal"))
("format" ("plain" "hang"))
("hangindent")
("hypcap" ("false" "no" "off" "0" "true" "yes" "on" "1"))
("hypcapspace")
("indention")
("justification" ("justified" "centering" "centerlast" "centerfirst"
"raggedright" "RaggedRight" "raggedleft"))
("labelfont" ("scriptsize" "footnotesize" "small" "normalsize" "large"
"Large" "normalfont" "up" "it" "sl" "sc" "md" "bf" "rm"
"sf" "tt" "singlespacing" "onehalfspacing" "doublespacing"
"stretch" "normalcolor" "color" "normal"))
("labelfont+" ("scriptsize" "footnotesize" "small" "normalsize" "large"
"Large" "normalfont" "up" "it" "sl" "sc" "md" "bf" "rm"
"sf" "tt" "singlespacing" "onehalfspacing" "doublespacing"
"stretch" "normalcolor" "color" "normal"))
("labelformat" ("default" "empty" "simple" "brace" "parens"))
("labelsep" ("none" "colon" "period" "space" "quad" "newline" "endash"))
("list" ("false" "no" "off" "0" "true" "yes" "on" "1"))
("listformat" ("empty" "simple" "paren" "subsimple" "subparens"))
("margin")
("margin*")
("maxmargin")
("minmargin")
("name")
("oneside")
("parindent")
("parskip")
("position" ("top" "above" "bottom" "below" "auto"))
("singlelinecheck" ("false" "no" "off" "0" "true" "yes" "on" "1"))
("slc" ("false" "no" "off" "0" "true" "yes" "on" "1"))
("skip")
("strut" ("false" "no" "off" "0" "true" "yes" "on" "1"))
("style" ("base" "default"))
("textfont" ("scriptsize" "footnotesize" "small" "normalsize" "large"
"Large" "normalfont" "up" "it" "sl" "sc" "md" "bf" "rm"
"sf" "tt" "singlespacing" "onehalfspacing" "doublespacing"
"stretch" "normalcolor" "color" "normal"))
("textfont+" ("scriptsize" "footnotesize" "small" "normalsize" "large"
"Large" "normalfont" "up" "it" "sl" "sc" "md" "bf" "rm"
"sf" "tt" "singlespacing" "onehalfspacing" "doublespacing"
"stretch" "normalcolor" "color" "normal"))
("textformat" ("empty" "simple" "period"))
("twoside")
("type" ("figure" "table" "ContinuedFloat"))
("type*" ("figure" "table" "ContinuedFloat"))
("width"))
"Key=value options for caption macros.")
(defvar LaTeX-caption-key-val-options-local nil
"Buffer-local key=value options for caption macros.")
(make-variable-buffer-local 'LaTeX-caption-key-val-options-local)
(defvar LaTeX-caption-supported-float-types
'("figure" "table" "ContinuedFloat" ; Standard caption.sty
"sub" "subtable" "subfigure" ; subcaption.sty
"bi" "bi-first" "bi-second" ; bicaption.sty
"ruled" "boxed" ; float.sty
"floatingfigure" "floatingtable" ; floatflt.sty
"lstlisting" ; listings.sty
"longtable" ; longtable.sty
"figwindow" "tabwindow" ; picinpar.sty
"parpic" ; picins.sty
"SCfigure" "SCtable" ; sidecap.sty
"supertabular" "xtabular" ; supertabular.sty & xtab.sty
"threeparttable" "measuredfigure" ; threeparttable.sty
"wrapfigure" "wraptable") ; wrapfigure
"List of float types provided by other LaTeX packages and
supported by `caption.sty'.")
;; Setup for various \DeclareCaption's:
(TeX-auto-add-type "caption-DeclareCaption" "LaTeX")
;; The 2. argument to `DeclareCaption[A-Za-z]' contains (La)TeX code.
;; We deliberately ignore that argument in our regex since it is not
;; needed for this style and would pollute the auto generated
;; `docname.el' file.
(defvar LaTeX-caption-DeclareCaption-regexp
`(,(concat "\\\\DeclareCaption\\(Font\\|Format\\|Justification"
"\\|LabelFormat\\|LabelSeparator\\|ListFormat"
"\\|Option\\|Style\\|TextFormat\\)"
"\\*?"
"[ \t\n\r%]*"
"{\\([^}]+\\)}")
(0 1 2) LaTeX-auto-caption-DeclareCaption)
"Matches the arguments of different `\\DeclareCaption*' from
`caption.sty'.")
(defun LaTeX-caption-auto-prepare ()
"Clear `LaTeX-auto-caption-DeclareCaption' before parsing."
(setq LaTeX-auto-caption-DeclareCaption nil))
(add-hook 'TeX-auto-prepare-hook #'LaTeX-caption-auto-prepare t)
(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
(defun LaTeX-caption-update-key-val-options ()
"Update the buffer-local key-val options before offering them
in `caption'-completions."
(dolist (keyvals (LaTeX-caption-DeclareCaption-list))
(let* ((key (cond ((string-equal (nth 1 keyvals) "LabelSeparator")
(downcase (substring (nth 1 keyvals) 0 8)))
(t (downcase (nth 1 keyvals)))))
(val (nth 2 keyvals))
(val-match (cdr (assoc key LaTeX-caption-key-val-options-local)))
(temp (copy-alist LaTeX-caption-key-val-options-local))
;; If `subcaption.el' is loaded, delete and update also the
;; entry for `subrefformat' when processing the `labelformat'.
(opts (progn
(when (and (string-equal key "labelformat")
(boundp 'LaTeX-subcaption-key-val-options))
(setq temp
(assq-delete-all
(car (assoc (caar LaTeX-subcaption-key-val-options) temp))
temp)))
(assq-delete-all (car (assoc key temp)) temp))))
;; For `\DeclareCaptionOption', only add the value
;; (remember: key=^^^^^^, val="defined key")
(if (string-equal key "option")
(pushnew (list val) opts :test #'equal)
;; For anything but `\DeclareCaptionOption', do the standard
;; procedure. Again, take care of `subrefformat' for `subcaption.el'.
(if val-match
(progn
(when (and (string-equal key "labelformat")
(boundp 'LaTeX-subcaption-key-val-options))
(pushnew (list "subrefformat"
(delete-dups (apply #'append (list val) val-match)))
opts :test #'equal))
(pushnew (list key (delete-dups (apply #'append (list val) val-match)))
opts :test #'equal))
(pushnew (list key (list val)) opts :test #'equal)))
(setq LaTeX-caption-key-val-options-local (copy-alist opts))))
;; Support for environments defined with newfloat.sty: These
;; environments are added to "type" and "type*" key:
(when (and (member "newfloat" (TeX-style-list))
(fboundp 'LaTeX-newfloat-DeclareFloatingEnvironment-list)
(LaTeX-newfloat-DeclareFloatingEnvironment-list))
(dolist (key '("type" "type*"))
(let* ((val (mapcar #'car (LaTeX-newfloat-DeclareFloatingEnvironment-list)))
(val-match (cdr (assoc key LaTeX-caption-key-val-options-local)))
(temp (copy-alist LaTeX-caption-key-val-options-local))
(opts (assq-delete-all (car (assoc key temp)) temp)))
(pushnew (list key (delete-dups (apply #'append val val-match)))
opts :test #'equal)
(setq LaTeX-caption-key-val-options-local (copy-alist opts))))))
(defun LaTeX-arg-caption-command (optional &optional prompt)
"Insert caption-commands from `caption.sty'. If OPTIONAL,
indicate `(Optional)' while reading key=val and insert it in
square brackets. PROMPT replaces the standard one."
(LaTeX-caption-update-key-val-options)
(let ((opts (TeX-read-key-val optional
LaTeX-caption-key-val-options-local
prompt)))
(TeX-argument-insert opts optional)))
;; In `LaTeX-caption-DeclareCaption-regexp', we match (0 1 2). When
;; adding a new `Name', we need something unique for `0'-match until
;; the next `C-c C-n'. We mimic that regex-match bei concat'ing the
;; elements. It will vanish upon next `C-c C-n'.
(defun LaTeX-arg-caption-DeclareCaption (optional format)
"Insert various `\\DeclareCaptionFORMAT' commands. If
OPTIONAL, insert argument in square brackets. FORMAT is the
suffix of the command."
(let ((name (TeX-read-string "Name: ")))
(LaTeX-add-caption-DeclareCaptions
(list (concat "\\DeclareCaption" format "{" name "}")
format name))
(TeX-argument-insert name optional)))
;; Support for an undocumented feature of caption.sty:
;; `\captionbox' sets the width of the caption equal to the width of
;; the contents (a feature provided e.g. by `threeparttable.sty').
;; The starred version typesets the caption without label and without
;; entry to the list of figures or tables.
;; The first mandatory argument {<heading>} contains the caption text
;; and the label. We used to use `TeX-insert-macro' to do the job
;; (Thanks to M. Giordano for his valuable comments on this!), but now
;; moved to `LaTeX-label'.
;; Syntax:
;; \captionbox[<list entry>]{<heading>}[<width>][<inner-pos>]{<contents>}
;; \captionbox*{<heading>}[<width>][<inner-pos>]{<contents>}
(defun LaTeX-arg-caption-captionbox (optional &optional star)
"Query for the arguments of \"\\captionbox\" incl. a label and insert them.
If STAR is non-nil, then do not query for a \\label and a short
caption, insert only a caption."
(let* ((currenv (LaTeX-current-environment))
(caption (TeX-read-string
(TeX-argument-prompt optional nil "Caption")))
(short-caption
(when (and (not star)
(>= (length caption) LaTeX-short-caption-prompt-length))
(TeX-read-string
(TeX-argument-prompt t nil "Short caption")))))
(indent-according-to-mode)
(when (and short-caption (not (string= short-caption "")))
(insert LaTeX-optop short-caption LaTeX-optcl))
(insert TeX-grop caption)
(unless star (LaTeX-label currenv 'environment))
(insert TeX-grcl))
(let* ((TeX-arg-opening-brace "[")
(TeX-arg-closing-brace "]")
(width (completing-read (TeX-argument-prompt t nil "Width")
(mapcar (lambda (elt) (concat TeX-esc (car elt)))
(LaTeX-length-list))))
(inpos (if (and width (not (string-equal width "")))
(completing-read (TeX-argument-prompt t nil "Inner position")
'("c" "l" "r" "s"))
"")))
(TeX-argument-insert width t)
(TeX-argument-insert inpos t))
;; Fill the paragraph before inserting {}. We can use
;; `LaTeX-fill-paragraph' without messing up the code since
;; \caption starts a new paragraph with AUCTeX
;; (cf. `paragraph-start').
(LaTeX-fill-paragraph))
(defun LaTeX-arg-caption-captionof (optional &optional star)
"Query for the arguments of \"\\captionof\" macro and insert them.
If OPTIONAL is non-nil, insert the arguments in brackets. If
STAR is non-nil, do not query for a short-caption and a label."
(let* ((envtype (completing-read (TeX-argument-prompt optional nil "Float type")
LaTeX-caption-supported-float-types))
(figtypes '("figure" "subfigure" "floatingfigure"
"figwindow" "SCfigure" "measuredfigure" "wrapfigure"))
(tabtypes '("table" "subtable" "floatingtable" "tabwindow" "SCtable"
"supertabular" "xtabular" "threeparttable" "wraptable"))
(caption (TeX-read-string
(TeX-argument-prompt optional nil "Caption")))
(short-caption
(when (and (not star)
(>= (length caption) LaTeX-short-caption-prompt-length))
(TeX-read-string
(TeX-argument-prompt t nil "Short caption")))))
(indent-according-to-mode)
(TeX-argument-insert envtype optional)
(when (and short-caption (not (string= short-caption "")))
(insert LaTeX-optop short-caption LaTeX-optcl))
(TeX-argument-insert caption optional)
(LaTeX-fill-paragraph)
(when (and (not star)
;; Check if `envtype' is a figure or a table, also
;; consult `LaTeX-label-alist' for additions from user
;; or newfloat.el, then run `LaTeX-label' w/
;; 'environment arg, otherwise w/o.
(save-excursion
(if (or (member envtype figtypes)
(member envtype tabtypes)
(assoc envtype LaTeX-label-alist))
(LaTeX-label (cond ((member envtype figtypes)
"figure")
((member envtype tabtypes)
"table")
(t envtype))
'environment)
(LaTeX-label envtype))))
(LaTeX-newline)
(indent-according-to-mode)
(end-of-line))))
(TeX-add-style-hook
"caption"
(lambda ()
;; Add caption to the parser.
(TeX-auto-add-regexp LaTeX-caption-DeclareCaption-regexp)
;; Activate the buffer-local version of key-vals.
(setq LaTeX-caption-key-val-options-local
(copy-alist LaTeX-caption-key-val-options))
;; Append key=vals from bicaption.sty if loaded: "language" key
;; depends on the active languages, it is appended extra where main
;; language is removed from the list:
(when (and (member "bicaption" (TeX-style-list))
;; Make sure that one of these packages is loaded:
(or (fboundp 'LaTeX-babel-active-languages)
(fboundp 'LaTeX-polyglossia-active-languages)))
(setq LaTeX-caption-key-val-options-local
(append
`(,(list "language"
(or (butlast (LaTeX-babel-active-languages))
(butlast (LaTeX-polyglossia-active-languages)))))
LaTeX-bicaption-key-val-options
LaTeX-caption-key-val-options-local)))
;; Caption commands:
(TeX-add-symbols
'("caption*" t)
'("captionlistentry"
[TeX-arg-eval completing-read (TeX-argument-prompt t nil "Float type")
LaTeX-caption-supported-float-types]
t)
'("captionof" LaTeX-arg-caption-captionof)
'("captionof*" (LaTeX-arg-caption-captionof t))
'("captionsetup"
(TeX-arg-conditional (member "bicaption" (TeX-style-list))
([LaTeX-arg-bicaption-captionsetup])
([TeX-arg-eval completing-read
(TeX-argument-prompt t nil "Float type")
LaTeX-caption-supported-float-types]))
(LaTeX-arg-caption-command))
'("captionsetup*"
(TeX-arg-conditional (member "bicaption" (TeX-style-list))
([LaTeX-arg-bicaption-captionsetup])
([TeX-arg-eval completing-read
(TeX-argument-prompt t nil "Float type")
LaTeX-caption-supported-float-types]))
(LaTeX-arg-caption-command))
'("clearcaptionsetup"
[LaTeX-arg-caption-command "Single key"]
(TeX-arg-eval completing-read (TeX-argument-prompt nil nil "Float type")
LaTeX-caption-supported-float-types))
'("clearcaptionsetup*"
[LaTeX-arg-caption-command "Single key"]
(TeX-arg-eval completing-read (TeX-argument-prompt nil nil "Float type")
LaTeX-caption-supported-float-types))
'("captionbox" (LaTeX-arg-caption-captionbox) t)
'("captionbox*" (LaTeX-arg-caption-captionbox t) t)
'("ContinuedFloat" 0)
'("ContinuedFloat*" 0)
'("continuedfloat" 0)
'("continuedfloat*" 0)
'("DeclareCaptionFont"
(LaTeX-arg-caption-DeclareCaption "Font") t)
'("DeclareCaptionFormat"
(LaTeX-arg-caption-DeclareCaption "Format") t)
'("DeclareCaptionFormat*"
(LaTeX-arg-caption-DeclareCaption "Format") t)
'("DeclareCaptionJustification"
(LaTeX-arg-caption-DeclareCaption "Justification") t)
'("DeclareCaptionLabelFormat"
(LaTeX-arg-caption-DeclareCaption "LabelFormat") t)
'("DeclareCaptionLabelSeparator"
(LaTeX-arg-caption-DeclareCaption "LabelSeparator") t)
'("DeclareCaptionLabelSeparator*"
(LaTeX-arg-caption-DeclareCaption "LabelSeparator") t)
'("DeclareCaptionListFormat"
(LaTeX-arg-caption-DeclareCaption "ListFormat") t)
'("DeclareCaptionOption"
(LaTeX-arg-caption-DeclareCaption "Option") t)
'("DeclareCaptionStyle"
(LaTeX-arg-caption-DeclareCaption "Style")
[LaTeX-arg-caption-command "Additional options"]
(LaTeX-arg-caption-command "Options"))
'("DeclareCaptionTextFormat"
(LaTeX-arg-caption-DeclareCaption "TextFormat") t)
'("bothIfFirst" 2)
'("bothIfSecond" 2))
;; \caption(box|of) macros should get their own lines
(LaTeX-paragraph-commands-add-locally '("captionbox" "captionof"))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("caption" "*[{")
("captionlistentry" "[{")
("captionof" "*{[{")
("captionbox" "*[{[["))
'textual)
(font-latex-add-keywords '(("captionsetup" "*[[{")
("clearcaptionsetup" "*[{")
("DeclareCaptionFont" "{{")
("DeclareCaptionFormat" "*{{")
("DeclareCaptionJustification" "{{")
("DeclareCaptionLabelFormat" "{{")
("DeclareCaptionLabelSeparator" "*{{")
("DeclareCaptionListFormat" "{{")
("DeclareCaptionOption" "{{")
("DeclareCaptionStyle" "{[{")
("DeclareCaptionTextFormat" "{{"))
'function)) )
LaTeX-dialect)
(defun LaTeX-caption-package-options ()
"Prompt for package options for the caption package."
(TeX-read-key-val t
(append '(("compatibility" ("true" "false")))
'(("figureposition" ("top" "above" "bottom" "below")))
'(("tableposition" ("top" "above" "bottom" "below")))
LaTeX-caption-key-val-options)))
;;; caption.el ends here

View File

@@ -0,0 +1,108 @@
;;; cleveref.el --- Style hook for the `cleveref.sty' package.
;; Copyright (C) 2014--2016 Free Software Foundation, Inc.
;; Author: Matthew Leach <matthew@mattleach.net>
;; Maintainer: auctex-devel@gnu.org
;; Created: 13/10/2014
;; 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.
;;; Code
(defun TeX-arg-cleveref-multiple-labels (optional &optional prompt)
"Prompt for a series of labels completing with known labels.
If OPTIONAL is non-nil, insert the resulting value as an optional
argument, otherwise as a mandatory one. Use PROMPT as the prompt
string."
(if (and (fboundp 'reftex-arg-label)
(fboundp 'reftex-plug-flag)
(reftex-plug-flag 2))
;; Use RefTeX when enabled
(TeX-arg-ref optional)
;; Use AUCTeX interface
(let* ((labels (TeX-completing-read-multiple
(TeX-argument-prompt optional prompt "Keys")
(LaTeX-label-list)))
(labels-string (mapconcat #'identity labels ",")))
(TeX-argument-insert labels-string optional))))
(TeX-add-style-hook
"cleveref"
(lambda ()
(TeX-add-symbols
'("cref" TeX-arg-cleveref-multiple-labels)
'("Cref" TeX-arg-cleveref-multiple-labels)
'("crefrange" (TeX-arg-ref "Key (first)") (TeX-arg-ref "Key (last)"))
'("Crefrange" (TeX-arg-ref "key (first)") (TeX-arg-ref "Key (last)"))
'("cpageref" TeX-arg-cleveref-multiple-labels)
'("Cpageref" TeX-arg-cleveref-multiple-labels)
'("cpagerefrange" (TeX-arg-ref "Key (first)") (TeX-arg-ref "Key (last)"))
'("Cpagerefrange" (TeX-arg-ref "Key (first)") (TeX-arg-ref "Key (last)"))
'("cref*" TeX-arg-cleveref-multiple-labels)
'("Cref*" TeX-arg-cleveref-multiple-labels)
'("crefrange*" (TeX-arg-ref "Key (first)") (TeX-arg-ref "Key (last)"))
'("Crefrange*" (TeX-arg-ref "Key (first)") (TeX-arg-ref "Key (last)"))
'("namecref" TeX-arg-ref)
'("nameCref" TeX-arg-ref)
'("lcnamecref" TeX-arg-ref)
'("namecrefs" TeX-arg-ref)
'("nameCrefs" TeX-arg-ref)
'("lcnamecrefs" TeX-arg-ref)
'("labelcref" TeX-arg-cleveref-multiple-labels)
'("labelcpageref" TeX-arg-cleveref-multiple-labels))
;; These macros aren't used particularly often during the course of
;; normal referencing.
(TeX-declare-expert-macros
"cleveref"
"namecref" "nameCref" "lcnamecref" "namecrefs" "nameCrefs"
"lcnamecrefs" "labelcref" "labelcpageref")
;; Fontification
(when (and (fboundp 'font-latex-add-keywords)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("cref" "*{")
("Cref" "*{")
("crefrange" "*{{")
("Crefrange" "*{{")
("cpageref" "{")
("Cpageref" "{")
("cpagerefrange" "{{")
("Cpagerefrange" "{{")
("namecref" "{")
("nameCref" "{")
("lcnamecref" "{")
("namecrefs" "{")
("nameCrefs" "{")
("lcnamecrefs" "{")
("labelcref" "{")
("labelcpageref" "{"))
'reference))
;; Activate RefTeX reference style.
(and LaTeX-reftex-ref-style-auto-activate
(fboundp 'reftex-ref-style-activate)
(reftex-ref-style-activate "Cleveref")))
LaTeX-dialect)
(defvar LaTeX-cleveref-package-options
'("capitalise" "nameinlink" "noabbrev" "poorman")
"Package options for the cleveref package.")
;;; cleveref.el ends here.

View File

@@ -0,0 +1,291 @@
;;; color.el --- AUCTeX style for `color.sty' (v1.1a)
;; Copyright (C) 2015--2017 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2015-01-16
;; 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 `color.sty' (v1.1a) from 2014/10/28.
;; `color.sty' is part of TeXLive.
;; Many thanks to Tassilo Horn for his percetive comments on
;; implementation of this style and testing.
;;; Code:
(defvar LaTeX-color-colour-models
'("cmyk" "gray" "named" "rgb")
"List of color models provided by `color.sty'.")
(defvar LaTeX-color-dvipsnames-colors
'("Apricot" "Aquamarine" "Bittersweet" "Black"
"Blue" "BlueGreen" "BlueViolet" "BrickRed"
"Brown" "BurntOrange" "CadetBlue" "CarnationPink"
"Cerulean" "CornflowerBlue" "Cyan" "Dandelion"
"DarkOrchid" "Emerald" "ForestGreen" "Fuchsia"
"Goldenrod" "Gray" "Green" "GreenYellow"
"JungleGreen" "Lavender" "LimeGreen" "Magenta"
"Mahogany" "Maroon" "Melon" "MidnightBlue"
"Mulberry" "NavyBlue" "OliveGreen" "Orange"
"OrangeRed" "Orchid" "Peach" "Periwinkle"
"PineGreen" "Plum" "ProcessBlue" "Purple"
"RawSienna" "Red" "RedOrange" "RedViolet"
"Rhodamine" "RoyalBlue" "RoyalPurple" "RubineRed"
"Salmon" "SeaGreen" "Sepia" "SkyBlue"
"SpringGreen" "Tan" "TealBlue" "Thistle"
"Turquoise" "Violet" "VioletRed" "White"
"WildStrawberry" "Yellow" "YellowGreen" "YellowOrange")
"List of colors defined by package option `dvipsnames' from `color.sty'.")
;; Needed for auto-parsing.
(require 'tex)
;; Plug \definecolor into the parser
(TeX-auto-add-type "color-definecolor" "LaTeX")
(defvar LaTeX-color-definecolor-regexp
'("\\\\definecolor{\\([^}]+\\)}" 1 LaTeX-auto-color-definecolor)
"Matches the argument of \\definecolor from color package.")
(defun LaTeX-color-auto-prepare ()
"Clear `LaTeX-auto-color-definecolor' before parsing."
(setq LaTeX-auto-color-definecolor nil))
(add-hook 'TeX-auto-prepare-hook #'LaTeX-color-auto-prepare t)
(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
(defun TeX-arg-color-definecolor (optional &optional prompt)
"Insert arguments of `\\definecolor' from `color.sty'."
;; \definecolor{<name>}{<model>}{<color spec>}
;; Ask for <name>, add to our list and insert it
(let ((colorname (TeX-read-string "Color name: ")))
(LaTeX-add-color-definecolors colorname)
(TeX-argument-insert colorname optional))
;; Ask and insert <model>
(let ((model (completing-read
(TeX-argument-prompt optional prompt "Color model")
(if (not (or (LaTeX-provided-package-options-member "color" "dvips")
(LaTeX-provided-package-options-member "color" "dvipsnames")))
(remove "named" LaTeX-color-colour-models)
LaTeX-color-colour-models))))
(TeX-argument-insert model optional)
;; Depending on <model>, ask for <color spec> and insert it
(cond (;; <cmyk> model
(string-equal model "cmyk")
(let ((cyan (TeX-read-string "Value Cyan (between 0,1): "))
(magenta (TeX-read-string "Value Magenta (between 0,1): "))
(yellow (TeX-read-string "Value Yellow (between 0,1): "))
(black (TeX-read-string "Value Black (between 0,1): ")))
(TeX-argument-insert
(concat cyan "," magenta "," yellow "," black) optional)))
;; <rgb> model
((string-equal model "rgb")
(let ((red (TeX-read-string "Value Red (between 0,1): "))
(green (TeX-read-string "Value Green (between 0,1): "))
(blue (TeX-read-string "Value Blue (between 0,1): ")))
(TeX-argument-insert
(concat red "," green "," blue) optional)))
;; <gray> model
((string-equal model "gray")
(let ((grayness (TeX-read-string "Value Gray (between 0,1): ")))
(TeX-argument-insert grayness optional)))
;; <named> model takes the dvipsnames
((string-equal model "named")
(let ((color (completing-read "Named Color: "
LaTeX-color-dvipsnames-colors)))
(TeX-argument-insert color optional))))))
(defun TeX-arg-color (optional &optional prompt)
"Insert arguments of various color commands from `color.sty'."
;; \color{<name>} or \color[<model>]{<color spec>}
;; First, ask for <model>. `named' is removed here from completion
;; if package option is not given
(let ((model (completing-read
(TeX-argument-prompt t prompt "Color model")
(if (not (or (LaTeX-provided-package-options-member "color" "dvips")
(LaTeX-provided-package-options-member "color" "dvipsnames")))
(remove "named" LaTeX-color-colour-models)
LaTeX-color-colour-models))))
(if (string-equal model "")
;; if empty, ask for <name> with completion
(let ((color (completing-read
(TeX-argument-prompt optional prompt "Color name")
(LaTeX-color-definecolor-list))))
(TeX-argument-insert color optional))
;; if not empty, insert [<model>] and proceed
(insert (concat LaTeX-optop model LaTeX-optcl))
(cond (;; <cmyk> model
(string-equal model "cmyk")
(let ((cyan (TeX-read-string "Value Cyan (between 0,1): "))
(magenta (TeX-read-string "Value Magenta (between 0,1): "))
(yellow (TeX-read-string "Value Yellow (between 0,1): "))
(black (TeX-read-string "Value Black (between 0,1): ")))
(TeX-argument-insert
(concat cyan "," magenta "," yellow "," black) optional)))
;; <rgb> model
((string-equal model "rgb")
(let ((red (TeX-read-string "Value Red (between 0,1): "))
(green (TeX-read-string "Value Green (between 0,1): "))
(blue (TeX-read-string "Value Blue (between 0,1): ")))
(TeX-argument-insert
(concat red "," green "," blue) optional)))
;; <gray> model
((string-equal model "gray")
(let ((grayness (TeX-read-string "Value Gray (between 0,1): ")))
(TeX-argument-insert grayness optional)))
;; <named> model; allowed are dvipsnames.
((string-equal model "named")
(let ((color (completing-read "Named Color: "
LaTeX-color-dvipsnames-colors)))
(TeX-argument-insert color optional)))))))
(defun TeX-arg-color-fcolorbox (optional &optional prompt)
"Insert arguments of `\\fcolorbox' from `color.sty'. "
;; \fcolorbox{<frame color name>}{<box color name>}{<text>} or
;; \fcolorbox[<model>]{<frame color spec>}{<box color spec>}{<text>}
;; First, ask for <model>; remove `named' again
(let ((model (completing-read
(TeX-argument-prompt t prompt "Color model")
(if (not (or (LaTeX-provided-package-options-member "color" "dvips")
(LaTeX-provided-package-options-member "color" "dvipsnames")))
(remove "named" LaTeX-color-colour-models)
LaTeX-color-colour-models))))
(if (string-equal model "")
;; if empty, ask for <frame color spce> with completion
(let ((frame-color (completing-read
(TeX-argument-prompt optional prompt "Frame color name")
(LaTeX-color-definecolor-list)))
(box-color (completing-read
(TeX-argument-prompt optional prompt "Box color name")
(LaTeX-color-definecolor-list))))
(TeX-argument-insert frame-color optional)
(TeX-argument-insert box-color optional))
;; if not empty, insert [<model>] and cater for 2 mandatory args.
(insert (concat LaTeX-optop model LaTeX-optcl))
(cond (;; <cmyk> model
(string-equal model "cmyk")
(let ((cyan (TeX-read-string "Frame value Cyan (between 0,1): "))
(magenta (TeX-read-string "Frame value Magenta (between 0,1): "))
(yellow (TeX-read-string "Frame value Yellow (between 0,1): "))
(black (TeX-read-string "Frame value Black (between 0,1): ")))
(TeX-argument-insert
(concat cyan "," magenta "," yellow "," black) optional))
(let ((cyan (TeX-read-string "Box value Cyan (between 0,1): "))
(magenta (TeX-read-string "Box value Magenta (between 0,1): "))
(yellow (TeX-read-string "Box value Yellow (between 0,1): "))
(black (TeX-read-string "Box value Black (between 0,1): ")))
(TeX-argument-insert
(concat cyan "," magenta "," yellow "," black) optional)))
;; <rgb> model
((string-equal model "rgb")
(let ((red (TeX-read-string "Frame value Red (between 0,1): "))
(green (TeX-read-string "Frame value Green (between 0,1): "))
(blue (TeX-read-string "Frame value Blue (between 0,1): ")))
(TeX-argument-insert
(concat red "," green "," blue) optional))
(let ((red (TeX-read-string "Box value Red (between 0,1): "))
(green (TeX-read-string "Box value Green (between 0,1): "))
(blue (TeX-read-string "box value Blue (between 0,1): ")))
(TeX-argument-insert
(concat red "," green "," blue) optional)))
;; <gray> model
((string-equal model "gray")
(let ((grayness (TeX-read-string "Frame value Gray (between 0,1): ")))
(TeX-argument-insert grayness optional))
(let ((grayness (TeX-read-string "Box value Gray (between 0,1): ")))
(TeX-argument-insert grayness optional)))
;; <named> model; allowed are dvipsnames.
((string-equal model "named")
(let ((color (completing-read "Frame named Color: "
LaTeX-color-dvipsnames-colors)))
(TeX-argument-insert color optional))
(let ((color (completing-read "Box named Color: "
LaTeX-color-dvipsnames-colors)))
(TeX-argument-insert color optional)))))))
(TeX-add-style-hook
"color"
(lambda ()
;; Add color to the parser.
(TeX-auto-add-regexp LaTeX-color-definecolor-regexp)
;; Add list of colors which are always available.
(LaTeX-add-color-definecolors
"black" "blue" "cyan" "green" "magenta" "red" "white" "yellow")
;; Add dvips colors in conjunction with `usenames'.
(when (and (LaTeX-provided-package-options-member "color" "usenames")
(or (LaTeX-provided-package-options-member "color" "dvips")
(LaTeX-provided-package-options-member "color" "dvipsnames")))
(apply #'LaTeX-add-color-definecolors LaTeX-color-dvipsnames-colors))
(unless (member "xcolor" (TeX-style-list))
(TeX-add-symbols
;; \definecolor{<name>}{<model>}{<color spec>}
'("definecolor" TeX-arg-color-definecolor)
;; \color{<name>} or \color[<model>]{<color spec>}
'("color" TeX-arg-color)
;; \textcolor{<name>}{<text>} or
;; \textcolor[<model>]{<color spec>}{<text>}
'("textcolor" TeX-arg-color "Text")
;; \pagecolor{<name>} or
;; \pagecolor[<model>]{<color spec>}
'("pagecolor" TeX-arg-color)
;; \nopagecolor
'("nopagecolor" 0)
;; \colorbox{<name>}{<text>} or
;; \colorbox[<model>]{<color spec>}{<text>}
'("colorbox" TeX-arg-color "Text")
;; \fcolorbox{<frame color name>}{<box color name>}{<text>} or
;; \fcolorbox[<model>]{<frame color spec>}{<box color spec>}{<text>}
'("fcolorbox" TeX-arg-color-fcolorbox "Text"))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("color" "[{")
("pagecolor" "[{"))
'type-declaration)
(font-latex-add-keywords '(("textcolor" "[{{")
("colorbox" "[{{" )
("fcolorbox" "[{{{"))
'type-command)
(font-latex-add-keywords '(("definecolor" "{{{"))
'function))))
LaTeX-dialect)
(defvar LaTeX-color-package-options
'("debugshow" "dvipdf" "dvipdfm" "dvipdfmx" "dvips" "dvipsnames"
"dvipsone" "dviwin" "dviwindo" "emtex" "monochrome" "nodvipsnames"
"oztex" "pctex32" "pctexhp" "pctexps" "pctexwin" "pdftex" "tcidvi"
"textures" "truetex" "usenames" "vtex" "xdvi" "xetex")
"Package options for the color package.")
;;; color.el ends here

View File

@@ -0,0 +1,92 @@
;;; colortbl.el --- AUCTeX style for `colortbl.sty' (v1.0a)
;; Copyright (C) 2015, 2016 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2015-03-22
;; 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 `colortbl.sty' (v1.0a) from 2012/02/13.
;; `colortbl.sty' is part of TeXLive.
;;; Code:
(TeX-add-style-hook
"colortbl"
(lambda ()
;; array.el is always loaded:
(TeX-run-style-hooks "array")
;; Load color.el only if xcolor.el is not already loaded. This is
;; mainly for the option `table' from xcolor.sty which loads
;; colortbl.sty, but we don't want to load color.el.
(unless (member "xcolor" (TeX-style-list))
(TeX-run-style-hooks "color"))
(TeX-add-symbols
;; `TeX-arg-color' is provided by color.el,
;; `TeX-arg-xcolor' is provided by xcolor.el.
'("columncolor" (TeX-arg-conditional (member "xcolor" (TeX-style-list))
(TeX-arg-xcolor)
(TeX-arg-color))
[ TeX-arg-length "Left overhang" ] [ TeX-arg-length "Right overhang" ] )
'("rowcolor" (TeX-arg-conditional (member "xcolor" (TeX-style-list))
(TeX-arg-xcolor)
(TeX-arg-color))
[ TeX-arg-length "Left overhang" ] [ TeX-arg-length "Right overhang" ] )
'("cellcolor" (TeX-arg-conditional (member "xcolor" (TeX-style-list))
(TeX-arg-xcolor)
(TeX-arg-color))
[ TeX-arg-length "Left overhang" ] [ TeX-arg-length "Right overhang" ] )
'("arrayrulecolor" (TeX-arg-conditional (member "xcolor" (TeX-style-list))
(TeX-arg-xcolor)
(TeX-arg-color)))
'("doublerulesepcolor" (TeX-arg-conditional (member "xcolor" (TeX-style-list))
(TeX-arg-xcolor)
(TeX-arg-color))))
(LaTeX-add-lengths "minrowclearance")
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("columncolor" "[{[[")
("rowcolor" "[{[[")
("cellcolor" "[{[[")
("arrayrulecolor" "[{")
("doublerulesepcolor" "[{"))
'function)))
LaTeX-dialect)
;; colortbl.sty has one option `debugshow'. I ignore that since it
;; would only take more time during insertation in a buffer and I
;; presume that not many users use it anyway.
(defvar LaTeX-colortbl-package-options nil
"Package option for the colortbl package.")
;;; colortbl.el ends here

View File

@@ -0,0 +1,102 @@
;;; commath.el --- AUCTeX style for `commath.sty' (v0.3)
;; Copyright (C) 2016 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2016-07-31
;; 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 `commath.sty' (v0.3) from 2006/07/18.
;; `commath.sty' is part of TeXLive.
;;; Code:
(TeX-add-style-hook
"commath"
(lambda ()
;; Only load amsmath.el, ifthen.el is not necessary
(TeX-run-style-hooks "amsmath")
(TeX-add-symbols
'("dif" 0)
'("Dif" 0)
'("od" [ "Order of differentiation" ] "Function" "Variable")
'("tod" [ "Order of differentiation" ] "Function" "Variable")
'("dod" [ "Order of differentiation" ] "Function" "Variable")
'("pd" [ "Order of differentiation" ] "Function" "Variable")
'("tpd" [ "Order of differentiation" ] "Function" "Variable")
'("dpd" [ "Order of differentiation" ] "Function" "Variable")
'("md" 6)
'("tmd" 6)
'("dmd" 6)
'("del" [ "Size argument (0..4)" ] "Argument")
'("cbr" [ "Size argument (0..4)" ] "Argument")
'("set" [ "Size argument (0..4)" ] "Argument")
'("sbr" [ "Size argument (0..4)" ] "Argument")
'("intoo" [ "Size argument (0..4)" ] "Argument")
'("intcc" [ "Size argument (0..4)" ] "Argument")
'("intoc" [ "Size argument (0..4)" ] "Argument")
'("intco" [ "Size argument (0..4)" ] "Argument")
'("eval" [ "Size argument (0..4)" ] t)
'("sVert" [ "Size argument (0..4)" ])
'("envert" [ "Size argument (0..4)" ] "Argument")
'("abs" [ "Size argument (0..4)" ] "Argument")
'("enVert" [ "Size argument (0..4)" ] "Argument")
'("norm" [ "Size argument (0..4)" ] "Argument")
'("fullfunction" 5)
;; Referencing macros
'("thmref" TeX-arg-ref)
'("exref" TeX-arg-ref)
'("defnref" TeX-arg-ref)
'("secref" TeX-arg-ref)
'("lemref" TeX-arg-ref)
'("propref" TeX-arg-ref)
'("remref" TeX-arg-ref)
'("figref" TeX-arg-ref)
'("colref" TeX-arg-ref)
'("appref" TeX-arg-ref)
'("assref" TeX-arg-ref))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("thmref" "{")
("exref" "{")
("defnref" "{")
("secref" "{")
("lemref" "{")
("propref" "{")
("remref" "{")
("figref" "{")
("colref" "{")
("appref" "{")
("assref" "{"))
'reference)))
LaTeX-dialect)
(defvar LaTeX-commath-package-options nil
"Package options for the commath package.")
;;; commath.el ends here

View File

@@ -0,0 +1,69 @@
;;; comment.el --- AUCTeX style for `comment.sty'
;; Copyright (C) 2007 Free Software Foundation, Inc.
;; Author: Ralf Angeli <angeli@caeruleus.net>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2007-03-18
;; 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., 59 Temple Place - Suite 330, Boston, MA
;; 02111-1307, USA.
;;; Commentary:
;; This file adds support for `comment.sty'.
;;; Code:
(TeX-add-style-hook
"comment"
(lambda ()
;; New symbols
(TeX-add-symbols
'("includecomment" "Name")
'("excludecomment" "Name")
'("specialcomment" "Name" "Before commands" "After commands")
'("processcomment" "Name" "Each-line commands"
"Before commands" "After commands"))
;; New environments
(mapc 'LaTeX-add-environments LaTeX-comment-env-list)
;; Fontification
(when (and (fboundp 'font-latex-add-keywords)
(fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
;; For syntactic fontification.
(add-to-list 'font-latex-syntactic-keywords-extra
;; \begin is supposed to start at the beginning of a line.
`(,(format "^\\\\begin *{%s}.*\\(\n\\)"
(regexp-opt LaTeX-comment-env-list))
(1 "!" t)))
(add-to-list 'font-latex-syntactic-keywords-extra
;; \end is supposed to start at the beginning of a line.
`(,(format "^\\(\\\\\\)end *{%s}"
(regexp-opt LaTeX-comment-env-list))
(1 "!" t)))
(font-latex-add-keywords '(("includecomment" "{")
("excludecomment" "{")
("specialcomment" "{{{")
("processcomment" "{{{{"))
'variable)
;; Tell font-lock about the update.
(font-latex-update-font-lock t)))
LaTeX-dialect)
;;; comment.el ends here

View File

@@ -0,0 +1,246 @@
;;; csquotes.el --- AUCTeX style for `csquotes.sty'
;; Copyright (C) 2004, 2005, 2006, 2014 Free Software Foundation, Inc.
;; Author: Ralf Angeli <angeli@caeruleus.net>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2004-11-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 `csquotes.sty', version 3.7.
;;; Code:
;; FIXME: It would be nice to be able to dump this function in favor
;; of a generalized handling of additional arguments for environments
;; specified via `LaTeX-add-environments'. `TeX-parse-arguments' and
;; friends would be the functions to be used for that, but those
;; functions currently insert text directly into the buffer. There
;; would either have to be a way of preventing this and letting them
;; return a string, or the insertion could happen in a temporary buffer
;; and the buffer content be returned.
(defun LaTeX-csquotes-insert-environment (env &rest args)
"Insert environment ENV considering optional arguments ARGS.
This is basically a variant of `LaTeX-environment-menu'
specialized for csquotes.el. ARGS can be made up of strings and
vectors containing single strings. Plain strings will be used as
prompts for mandatory arguments and strings in vectors as prompts
for optional arguments of the environment to be inserted.
That means, in contrast to `LaTeX-environment-menu' it supports
the insertion of optional arguments."
(let (env-extra prompt optional user-input)
(dolist (elt args)
(if (vectorp elt)
(setq prompt (aref elt 0)
optional t)
(setq prompt elt
optional nil))
(setq user-input (TeX-read-string (TeX-argument-prompt optional prompt nil)))
(unless (and optional (zerop (length user-input)))
(setq env-extra (concat env-extra
(if optional LaTeX-optop TeX-grop)
user-input
(if optional LaTeX-optcl TeX-grcl)))))
(LaTeX-insert-environment env env-extra)))
(TeX-add-style-hook
"csquotes"
(lambda ()
(let ((quote-style-variant-list '(("quotes") ("guillemets") ("american")
("british") ("oldstyle") ("imprimerie")
("swiss")))
(quote-style-name-list '(("danish") ("dutch") ("english") ("finnish")
("french") ("german") ("italian")
("norwegian") ("swedish"))))
;; New symbols
(TeX-add-symbols
'("enquote" 1)
'("enquote*" 1)
'("foreignquote" 2)
'("foreignquote*" 2)
'("hyphenquote" 2)
'("hyphenquote*" 2)
'("textquote" ["Citation"] ["Punctuation"] t)
'("textquote*" ["Citation"] ["Punctuation"] t)
'("foreigntextquote" "Language" ["Citation"] ["Punctuation"] t)
'("foreigntextquote*" "Language" ["Citation"] ["Punctuation"] t)
'("hyphentextquote" "Language" ["Citation"] ["Punctuation"] t)
'("hyphentextquote*" "Language" ["Citation"] ["Punctuation"] t)
'("blockquote" ["Citation"] ["Punctuation"] t)
'("foreignblockquote" "Language" ["Citation"] ["Punctuation"] t)
'("hyphenblockquote" "Language" ["Citation"] ["Punctuation"] t)
`("setquotestyle"
[ (TeX-arg-eval completing-read "Quote style variant: "
',quote-style-variant-list) ]
(TeX-arg-eval completing-read "Quote style name or alias: "
',quote-style-name-list))
"setquotestyle*"
'("MakeInnerQuote" "Character")
'("MakeOuterQuote" "Character")
'("MakeAutoQuote" "Opening quotation mark" "Closing quotation mark")
'("MakeAutoQuote*" "Opening quotation mark" "Closing quotation mark")
'("MakeForeignQuote" "Babel's language name"
"Opening quotation mark" "Closing quotation mark")
'("MakeForeignQuote*" "Babel's language name"
"Opening quotation mark" "Closing quotation mark")
'("MakeHyphenQuote" "Babel's language name"
"Opening quotation mark" "Closing quotation mark")
'("MakeHyphenQuote" "Babel's language name"
"Opening quotation mark" "Closing quotation mark")
'("MakeBlockQuote" "Opening quotation mark" "Delimiter for citation"
"Closing quotation mark")
'("MakeForeignBlockQuote" "Language" "Opening quotation mark"
"Delimiter for citation" "Closing quotation mark")
'("MakeHyphenBlockQuote" "Language" "Opening quotation mark"
"Delimiter for citation" "Closing quotation mark")
"EnableQuotes"
"DisableQuotes"
"VerbatimQuotes"
"DeleteQuotes"
'("textcquote" ["Pre-note"] ["Post-note"] "Key" ["Punctuation"] t)
'("textcquote*" ["Pre-note"] ["Post-note"] "Key" ["Punctuation"] t)
'("foreigntextcquote" "Language" ["Pre-note"] ["Post-note"] "Key"
["Punctuation"] t)
'("foreigntextcquote*" "Language" ["Pre-note"] ["Post-note"] "Key"
["Punctuation"] t)
'("hyphentextcquote" "Language" ["Pre-note"] ["Post-note"] "Key"
["Punctuation"] t)
'("hyphentextcquote*" "Language" ["Pre-note"] ["Post-note"] "Key"
["Punctuation"] t)
'("blockcquote" ["Pre-note"] ["Post-note"] "Key" ["Punctuation"] t)
'("foreignblockcquote" "Language" ["Pre-note"] ["Post-note"] "Key"
["Punctuation"] t)
'("hyphenblockcquote" "Language" ["Pre-note"] ["Post-note"] "Key"
["Punctuation"] t)
`("DeclareQuoteStyle"
[ (TeX-arg-eval completing-read "Quote style variant: "
',quote-style-variant-list) ]
(TeX-arg-eval completing-read "Quote style name: "
',quote-style-name-list)
["Outer quote initialization"] ["Inner quote initialization"]
"Opening outer quotation mark" ["Middle outer quotation mark"]
"Closing outer quotation mark" ["Kerning between adjoining marks"]
"Opening inner quotation mark" ["Middle inner quotation mark"]
"Closing inner quotation mark")
`("DeclareQuoteAlias"
[ (TeX-arg-eval completing-read "Quote style variant: "
',quote-style-variant-list) ]
(TeX-arg-eval completing-read "Quote style name: "
',quote-style-name-list)
"Alias name")
'("DeclareQuoteOption" 1)
'("ExecuteQuoteOptions" 1)
'("DeclarePlainStyle" "Opening outer quotation mark"
"Closing outer quotation mark" "Opening inner quotation mark"
"Closing inner quotation mark")
'("SetBlockThreshold" "Number of lines")
'("SetBlockEnvironment" "Environment")
'("SetCiteCommand" "Command")
"mkcitation"
"mkccitation"
"mkpreblockpunct"
"mkmidblockpunct"
"mkfinblockpunct"
"mkpretextpunct"
"mkmidtextpunct"
"mkfintextpunct"
"mkpredisppunct"
"mkmiddisppunct"
"mkfindisppunct"
'("ifblockquote" 2)
'("ifquotepunct" 2)
'("ifquoteterm" 2)
'("ifquoteperiod" 2)
'("ifquotecomma" 2)
'("ifquotesemicolon" 2)
'("ifquotecolon" 2)
'("ifquoteexclam" 2)
'("ifquotequestion" 2)
'("ifstringblank" 2)
'("BlockquoteDisable" 1))
;; New environments
(LaTeX-add-environments
"quoteblock"
"quotetext"
'("displayquote" LaTeX-csquotes-insert-environment ["Citation"]
["Punctuation"])
'("foreigndisplayquote" LaTeX-csquotes-insert-environment "Language"
["Citation"] ["Punctuation"])
'("hyphendisplayquote" LaTeX-csquotes-insert-environment "Language"
["Citation"] ["Punctuation"])
'("displaycquote" LaTeX-csquotes-insert-environment
["Pre-note"] ["Post-note"] "Key" ["Punctuation"])
'("foreigndisplaycquote" LaTeX-csquotes-insert-environment
"Language" ["Pre-note"] ["Post-note"] "Key" ["Punctuation"])
'("hyphendisplaycquote" LaTeX-csquotes-insert-environment
"Language" ["Pre-note"] ["Post-note"] "Key" ["Punctuation"]))
;; Quotation marks
(when (and (> (length LaTeX-csquotes-open-quote) 0)
(> (length LaTeX-csquotes-close-quote) 0))
(setq TeX-quote-language
`(override ,LaTeX-csquotes-open-quote ,LaTeX-csquotes-close-quote
,LaTeX-csquotes-quote-after-quote)))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("DisableQuotes" "")
("RestoreQuotes" ""))
'function)
(font-latex-add-keywords '(("enquote" "*{")
("foreignquote" "*{{")
("hyphenquote" "*{{")
("textcquote" "*[[{[{")
("foreigntextcquote" "*{[[{[{")
("hyphentextcquote" "*{[[{[{")
("textquote" "*[[{")
("foreigntextquote" "*{[[{")
("hyphentextquote" "*{[[{")
("blockquote" "[[{")
("foreignblockquote" "{[[{")
("hyphenblockquote" "{[[{")
("blockcquote" "[[{[{")
("foreignblockcquote" "{[[{[{")
("hyphenblockcquote" "{[[{[{"))
'textual)
(font-latex-add-keywords '(("setquotestyle" "[{")
("MakeOuterQuote" "{")
("MakeInnerQuote" "{")
("MakeAutoQuote" "*{{")
("MakeForeignQuote" "*{{{")
("MakeHyphenQuote" "*{{{")
("MakeBlockQuote" "{{{")
("MakeForeignBlockQuote" "{{{{")
("MakeHyphenBlockQuote" "{{{{")
("DeclareQuoteStyle" "[{[[{[{[{[{")
("DeclareQuoteAlias" "[{{")
("DeclareQuoteOption" "{")
("DeclarePlainStyle" "{{{{")
("SetBlockThreshold" "{")
("SetBlockEnvironment" "{")
("SetCiteCommand" "{"))
'variable))))
LaTeX-dialect)
;;; csquotes.el ends here

View File

@@ -0,0 +1,94 @@
;;; currvita.el --- AUCTeX style for `currvita.sty' (v0.9i)
;; Copyright (C) 2015, 2016 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2015-01-05
;; 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 `currvita.sty' (v0.9i) from 1999/09/13.
;; `currvita.sty' is part of TeXLive.
;;; Code:
;; This is a modified version of `LaTeX-env-item'.
(defun LaTeX-currvita-env-with-label (env)
"Insert ENV, a mandatory label and the first item."
(LaTeX-insert-environment
env
(let ((heading (TeX-read-string "Heading of list: ")))
(format "{%s}" heading)))
(if (TeX-active-mark)
(progn
(LaTeX-find-matching-begin)
(end-of-line 1))
(end-of-line 0))
(delete-char 1)
(when (looking-at (concat "^[ \t]+$\\|"
"^[ \t]*" TeX-comment-start-regexp "+[ \t]*$"))
(delete-region (point) (line-end-position)))
(delete-horizontal-space)
;; Deactivate the mark here in order to prevent `TeX-parse-macro'
;; from swapping point and mark and the \item ending up right after
;; \begin{...}.
(TeX-deactivate-mark)
(LaTeX-insert-item)
;; The inserted \item may have outdented the first line to the
;; right. Fill it, if appropriate.
(when (and (not (looking-at "$"))
(not (assoc env LaTeX-indent-environment-list))
(> (- (line-end-position) (line-beginning-position))
(current-fill-column)))
(LaTeX-fill-paragraph nil)))
(TeX-add-style-hook
"currvita"
(lambda ()
;; env's defined by currvita.sty
(LaTeX-add-environments
'("cv" "Heading of CV")
'("cvlist" LaTeX-currvita-env-with-label))
;; Add "cvlist" to the list of environments which have an optional
;; argument for each item
(add-to-list 'LaTeX-item-list '("cvlist" . LaTeX-item-argument))
;; General commands: "\date" is already provided by AUCTeX
(TeX-add-symbols
'("cvplace" t)
'("cvheadingfont" 0)
'("cvlistheadingfont" 0)
'("cvlabelfont" 0)
'("cvbibname" 0))
;; Add new lengths defined by currvita.sty
(LaTeX-add-lengths "cvlabelwidth" "cvlabelskip" "cvlabelsep"))
LaTeX-dialect)
(defvar LaTeX-currvita-package-options
'("LabelsAligned" "TextAligned" "openbib" "ManyBibs" "NoDate")
"Package options for the currvita package.")
;;; currvita.el ends here

View File

@@ -0,0 +1,9 @@
;;; czech.el --- Setup AUCTeX for editing Czech text.
(TeX-add-style-hook
"czech"
(lambda ()
(unless (eq (car TeX-quote-language) 'override)
(setq TeX-quote-language `("czech" "\\uv{" "}" ,TeX-quote-after-quote)))
(run-hooks 'TeX-language-cz-hook))
LaTeX-dialect)

View File

@@ -0,0 +1,18 @@
;;; danish.el --- Setup AUCTeX for editing Danish text.
;;; Code:
(TeX-add-style-hook
"danish"
(lambda ()
(unless (eq (car TeX-quote-language) 'override)
(setq TeX-quote-language `("danish" "\"`" "\"'" ,TeX-quote-after-quote)))
(setq LaTeX-babel-hyphen-language "danish")
;; Fontification of quotation marks.
(when (fboundp 'font-latex-add-quotes)
(font-latex-add-quotes '("\"`" "\"'"))
(font-latex-add-quotes '("\">" "\"<" german)))
(run-hooks 'TeX-language-dk-hook))
LaTeX-dialect)
;;; danish.el ends here

View File

@@ -0,0 +1,49 @@
;;; dcolumn.el --- AUCTeX style for `dcolumn.sty' (v1.06)
;; Copyright (C) 2016 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2016-12-18
;; 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 `dcolumn.sty' (v1.06) from 2014/10/28.
;; `dcolumn.sty' is part of TeXLive.
;;; Code:
(TeX-add-style-hook
"dcolumn"
(lambda ()
;; `dcolumn.sty' adds one new column specification letter:
(set (make-local-variable 'LaTeX-array-column-letters)
(concat LaTeX-array-column-letters "D"))
;; Also run style hook for `array':
(TeX-run-style-hooks "array"))
LaTeX-dialect)
(defvar LaTeX-dcolumn-package-options nil
"Package options for the dcolumn package.")
;;; dcolumn.el ends here

View File

@@ -0,0 +1,277 @@
;;; dinbrief.el --- Special code for LaTeX-Style dinbrief.
;; Copyright (C) 1994, 2013, 2014 Free Software Foundation, Inc.
;; Author: Werner Fink <werner@suse.de>
;; Maintainer: auctex-devel@gnu.org
;; 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.
;;; dinbrief.el - Special code for LaTeX class dinbrief.
;;; Commentary:
;; LaTeX Class: dinbrief.cls
;;; Code:
(require 'tex)
(TeX-add-style-hook "dinbrief"
(function
(lambda ()
(add-hook 'LaTeX-document-style-hook
'LaTeX-dinbrief-style)
(LaTeX-add-environments
'("letter" LaTeX-dinbrief-env-recipient)
"dinquote")
(TeX-add-symbols
'("address" "Absender: ")
'("postremark" "Postvermerk: ")
'("date" "Datum: ")
'("subject" "Betreff: ")
'("handling" "Behandlungsvermerk: ")
'("cc" "Verteiler: ")
'("place" "Heutiger Ort: ")
"makelabels"
"nowindowrules"
"windowrules"
"nowindowtics"
"windowtics"
"disabledraftstandard"
"enabledraftstandard"
"centeraddress"
"normaladdress"
'("encl" "Anlagen: ")
'("backaddress" "Retouradresse: ")
'("signature" "Unterschrift: ")
'("opening" "Anrede: ")
'("closing" "Schluss: "))))
LaTeX-dialect)
(defmacro LaTeX-dinbrief-insert (&rest args)
"Insert text ignoring active markers."
`(progn (if (TeX-mark-active) (TeX-deactivate-mark))
(insert ,@args)))
(defun LaTeX-dinbrief-style ()
"Insert some useful packages for writing german letters."
(save-excursion
(goto-char (point-min)) ; insert before \begin{document}
(if (re-search-forward ".begin.document." (point-max) t)
(beginning-of-line 1))
(open-line 2)
(indent-relative-maybe)
(LaTeX-dinbrief-insert TeX-esc "usepackage"
LaTeX-optop "latin1,utf8" LaTeX-optcl
TeX-grop "inputenc" TeX-grcl)
(newline-and-indent)
(LaTeX-dinbrief-insert TeX-esc "usepackage"
LaTeX-optop "T1" LaTeX-optcl
TeX-grop "fontenc" TeX-grcl)
(newline-and-indent)
(LaTeX-dinbrief-insert TeX-esc "usepackage"
TeX-grop "ngerman" TeX-grcl)
(TeX-run-style-hooks "inputenc")
(TeX-run-style-hooks "fontenc")
(TeX-run-style-hooks "ngerman")))
(defun LaTeX-dinbrief-env-recipient (environment)
"Insert ENVIRONMENT and prompt for recipient and address."
(let (
(sender (LaTeX-dinbrief-sender))
(recipient (TeX-read-string "Empfänger: "))
(address (LaTeX-dinbrief-recipient))
(date (TeX-read-string "Datum: " (LaTeX-dinbrief-today)))
(postremark (TeX-read-string "Postvermerk: "))
(fenster (TeX-read-string "Fenster \(ja/nein\): "))
(vermerk (TeX-read-string "Behandlungsvermerk: "))
(verteil (TeX-read-string "Verteiler: "))
(betreff (TeX-read-string "Betreff: "))
(opening (TeX-read-string "Anrede: "))
(closing (TeX-read-string "Schluss: "))
(signature (TeX-read-string "Unterschrift: "))
(anlage (TeX-read-string "Anlagen: ")))
(if (string= fenster "ja")
(progn
(LaTeX-dinbrief-insert TeX-esc "enabledraftstandard")
(newline-and-indent)
(LaTeX-dinbrief-insert TeX-esc "centeraddress")
(newline-and-indent)
(LaTeX-dinbrief-insert TeX-esc "nowindowrules")
(newline-and-indent)
(LaTeX-dinbrief-insert TeX-esc "windowtics")
(newline-and-indent)
(let ((retouradr (TeX-read-string "Retouradresse: " sender)))
(newline-and-indent)
(if (not (zerop (length retouradr)))
(progn
(if (TeX-mark-active) (TeX-deactivate-mark))
(LaTeX-dinbrief-insert TeX-esc "backaddress" TeX-grop retouradr TeX-grcl)
(newline-and-indent)))))
(LaTeX-dinbrief-insert TeX-esc "enabledraftstandard")
(newline-and-indent)
(LaTeX-dinbrief-insert TeX-esc "centeraddress")
(newline-and-indent)
(LaTeX-dinbrief-insert TeX-esc "nowindowrules")
(newline-and-indent)
(LaTeX-dinbrief-insert TeX-esc "windowtics"))
(newline-and-indent)
(if (not (zerop (length signature)))
(progn
(LaTeX-dinbrief-insert TeX-esc "signature" TeX-grop signature TeX-grcl)
(newline-and-indent)))
(if (not (zerop (length date)))
(progn
(LaTeX-dinbrief-insert TeX-esc "date" TeX-grop date TeX-grcl)
(newline-and-indent)))
(newline-and-indent)
(let ((indentation (current-column)))
(LaTeX-insert-environment
environment
(concat TeX-grop recipient
(if (not (zerop (length address)))
(concat
(if (not (zerop (length recipient)))
(concat " " TeX-esc TeX-esc " "))
address))
TeX-grcl))
(save-excursion ; Fix indentation of address
(if (search-backward TeX-grcl nil 'move)
(let ((addr-end (point-marker)))
(if (search-backward TeX-grop nil 'move)
(let ((addr-column (current-column)))
(while (search-forward
(concat TeX-esc TeX-esc)
(marker-position addr-end) 'move)
(progn
(newline)
(indent-to addr-column))))))))
(LaTeX-dinbrief-insert "\n")
(indent-to indentation))
(if (not (zerop (length postremark)))
(progn
(LaTeX-dinbrief-insert TeX-esc "postremark" TeX-grop postremark TeX-grcl)
(newline-and-indent)))
(if (not (zerop (length betreff)))
(progn
(LaTeX-dinbrief-insert TeX-esc "subject" TeX-grop)
(LaTeX-dinbrief-insert betreff TeX-grcl)
(newline-and-indent)))
(if (not (zerop (length vermerk)))
(progn
(LaTeX-dinbrief-insert TeX-esc "handling" TeX-grop vermerk TeX-grcl)
(newline-and-indent)))
(if (not (zerop (length verteil)))
(progn
(LaTeX-dinbrief-insert TeX-esc "cc" TeX-grop verteil TeX-grcl)
(newline-and-indent)))
(if (not (zerop (length anlage)))
(progn
(LaTeX-dinbrief-insert TeX-esc "encl" TeX-grop anlage TeX-grcl)
(newline-and-indent)))
(LaTeX-dinbrief-insert TeX-esc "opening"
TeX-grop
(if (zerop (length opening))
(concat TeX-esc " ")
opening)
TeX-grcl "\n")
(indent-relative-maybe)
(save-excursion
(LaTeX-dinbrief-insert "\n" TeX-esc "closing"
TeX-grop
(if (zerop (length closing))
(concat TeX-esc " ")
closing)
TeX-grcl "\n")
(indent-relative-maybe))))
(defun LaTeX-dinbrief-sender ()
"Read and write the senders address."
(interactive)
(let ((name (TeX-read-string "Absender: " (user-full-name)))
(str (TeX-read-string "Meine Strasse: "))
(ort (TeX-read-string "Mein Wohnort: ")))
(if (not (zerop (length name)))
(progn
(goto-char (point-min)) ; insert before \end{document}
(if (re-search-forward ".end.document." (point-max) t)
(beginning-of-line 1))
(previous-line 1) ;FIXME: Use forward-line!
(LaTeX-dinbrief-insert TeX-esc "address" TeX-grop name)
(if (not (zerop (length str)))
(progn
(LaTeX-dinbrief-insert " " TeX-esc TeX-esc)
(newline-and-indent)
(LaTeX-dinbrief-insert str)))
(if (not (zerop (length ort)))
(progn
(LaTeX-dinbrief-insert " " TeX-esc "par")
(newline-and-indent)
(LaTeX-dinbrief-insert ort)))
(LaTeX-dinbrief-insert TeX-grcl)
(newline-and-indent)
(concat name ", " str ", " ort)))))
(defun LaTeX-dinbrief-recipient ()
"Read and return the recipient address."
(interactive)
(let ((str (TeX-read-string "Wohnhaft in Strasse: "))
(ort (TeX-read-string "Aus der Ortschaft: ")))
(if (not (zerop (length str)))
(if (not (zerop (length ort)))
(concat str " " TeX-esc TeX-esc " " ort)
str)
(if (not (zerop (length ort)))
ort))))
(defun LaTeX-dinbrief-today ()
"Return a string representing todays date according to flavor."
(interactive)
(let ((ctime-string (current-time-string))
(month-alist '(("Jan" . "Januar")
("Feb" . "Februar")
("Mar" . "M\\\"arz")
("Apr" . "April")
("May" . "Mai")
("Jun" . "Juni")
("Jul" . "Juli")
("Aug" . "August")
("Sep" . "September")
("Oct" . "Oktober")
("Nov" . "November")
("Dec" . "Dezember"))))
(string-match
"^\\S-+\\s-+\\(\\S-+\\)\\s-+\\(\\S-+\\)\\s-+\\S-+\\s-+\\(\\S-+\\)"
ctime-string)
(let ((year (substring ctime-string (match-beginning 3) (match-end 3)))
(month (substring ctime-string (match-beginning 1) (match-end 1)))
(day (substring ctime-string (match-beginning 2) (match-end 2)))
(place (TeX-read-string "Heutiger Ort: ")))
(if (assoc month month-alist)
(progn
(setq month (cdr (assoc month month-alist)))
(if (> 2 (length day))
(setq day (concat "0" day)))))
(format "%s, den %s. %s %s" place day month year))))
;;; dinbrief.el ends here

View File

@@ -0,0 +1,62 @@
;;; dk-bib.el --- AUCTeX style for `dk-bib.sty'
;; Copyright (C) 2005, 2014 Free Software Foundation, Inc.
;; Author: Arne J<>rgensen <arne@arnested.dk>
;; 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 Street, Fifth Floor, Boston,
;; MA 02110-1301, USA.
;;; Commentary:
;; Prompt for package option for dk-bib.sty.
;;; Code:
(defun LaTeX-dk-bib-package-options nil
"Prompt for package options for the dk-bib package."
(let ((options
(mapconcat 'identity
(TeX-completing-read-multiple
"Options: "
'(("isbn") ("issn") ("url") ("annote")
("printing") ("apalike") ("fixcitedash=false")
("ordinals2word") ("ordinaldepth=")))
","))
(depth -1))
(when (string-match "\\(ordinaldepth=\\)\\([^0-9]\\|$\\)" options)
(while (or (< depth 0)
(> depth 20))
(setq depth (if (fboundp 'read-number)
(read-number "Ordinal depth: ")
(string-to-number (TeX-read-string "Ordinal depth: "))))
(when (or (< depth 0)
(> depth 20))
(message "Ordinal depth must be between 0 and 20")
(sit-for 1)))
(setq options (concat
(substring options 0 (match-end 1))
(number-to-string depth)
(substring options (match-end 1)))))
options))
;; Local Variables:
;; coding: iso-8859-1
;; End:
;;; dk-bib.el ends here

View File

@@ -0,0 +1,10 @@
;;; dk.el - Setup AUCTeX for editing Danish text.
;;; Code:
(TeX-add-style-hook "dk"
(function (lambda ()
(run-hooks 'TeX-language-dk-hook)))
LaTeX-dialect)
;;; dk.el ends here

View File

@@ -0,0 +1,193 @@
;;; doc.el --- AUCTeX style for `doc.sty'
;; Copyright (C) 2004, 2008, 2016 Free Software Foundation, Inc.
;; Author: Frank K<>ster <frank@kuesterei.ch>
;; Maintainer: auctex-devel@gnu.org
;; 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 `doc.sty'.
;;; Code:
(defun LaTeX-env-no-comment (environment)
"Insert ENVIRONMENT and make sure there is no commented empty line inside."
(LaTeX-insert-environment environment
(when (string-equal environment "macro")
(let ((macroname (TeX-read-string
(TeX-argument-prompt nil nil "Macro")
TeX-esc)))
(format "{%s}" macroname))))
(unless (TeX-active-mark)
(when (save-excursion
(beginning-of-line)
(looking-at (concat "[ \t]+$\\|[ \t]*"
TeX-comment-start-regexp "+[ \t]*$")))
(delete-region (line-beginning-position) (line-end-position))
(indent-according-to-mode))))
(defun LaTeX-doc-after-insert-macrocode (env start end)
"Make sure the macrocode environment is properly formatted after insertion."
(when (TeX-member env '("macro" "macrocode" "macrocode*") 'string-equal)
(save-excursion
(goto-char end)
(skip-chars-backward " \t")
(when (bolp)
(insert "%")
(indent-according-to-mode))
(goto-char start)
(skip-chars-backward " \t")
(when (bolp)
(insert "%")
(indent-according-to-mode)))))
(TeX-add-style-hook
"doc"
(lambda ()
(add-to-list (make-local-variable 'LaTeX-indent-environment-list)
'("macrocode" current-indentation) t)
(add-to-list 'LaTeX-indent-environment-list
'("macrocode*" current-indentation) t)
(add-to-list 'LaTeX-indent-environment-list
'("macro" current-indentation) t)
(add-hook 'LaTeX-after-insert-env-hooks 'LaTeX-doc-after-insert-macrocode
nil t)
(LaTeX-add-environments
"theglossary"
'("macrocode" LaTeX-env-no-comment)
'("macrocode*" LaTeX-env-no-comment)
'("macro" LaTeX-env-no-comment))
(TeX-add-symbols
"EnableCrossrefs"
"DisableCrossrefs"
'("DoNotIndex" t)
"DontCheckModules"
"CheckModules"
"Module"
'("DescribeMacro" (TeX-arg-eval
(lambda ()
(let ((name (TeX-read-string
(TeX-argument-prompt optional nil "Macro")
TeX-esc)))
(format "%s" name)))))
'("DescribeEnv" "Environment")
"verbatim"
"verb"
'("parg" "Argument")
'("oarg" "Argument")
'("marg" "Argument")
'("meta" "Text")
'("cs" "Name")
'("cmd" (TeX-arg-eval
(lambda ()
(let ((name (TeX-read-string
(TeX-argument-prompt optional nil "Name")
TeX-esc)))
(format "%s" name)))))
"makelabel"
'("MacroFont" t)
'("AltMacroFont" t)
"PrintMacroName"
"PrintDescribeMacro"
"PrintDescribeEnv"
"PrintEnvName"
"MakePrivateLetters"
"actualchar"
"quotechar"
"levelchar"
"encapchar"
"verbatimchar"
"SpecialIndex"
"SpecialMainIndex"
"SpecialMainEnvIndex"
"SpecialUsageIndex"
"SpecialEnvIndex"
"SortIndex"
"LeftBraceIndex"
"RightBraceIndex"
"PercentIndex"
"OldMakeindex"
"PercentIndex"
"IndexPrologue"
"IndexParms"
"subitem"
"subsubitem"
"indexspace"
"efill"
"pfill"
"PrintIndex"
'("changes" "version" TeX-arg-date t)
"generalname"
"RecordChanges"
"GlossaryPrologue"
"GlossaryParms"
"PrintChanges"
"AlsoImplementation"
'("StopEventually" t)
"OnlyDescription"
"Finale"
"IndexInput"
"maketitle"
"MakeShortVerb"
"DeleteShortVerb"
"MakeShortverb"
"DeleteShortverb"
"CheckSum"
"CharacterTable"
"CharTableChanges"
"CodelineNumbered"
"CodelineIndex"
"PageIndex"
"theCodelineNo"
"DocstyleParms"
"MakePercentIgnore"
"MakePercentComment"
'("DocInput"
(TeX-arg-eval
(lambda ()
(let ((file (file-relative-name
(read-file-name
"File to input: " nil nil nil nil
(lambda (x)
(string-match "\\.fdd$\\|\\.dtx$" x)))
(TeX-master-directory))))
(format "%s" file)))))
'("DocInclude"
(TeX-arg-eval
(lambda ()
(let ((file (file-relative-name
(read-file-name
"File to include: " nil nil nil nil
(lambda (x)
(string-match "\\.fdd$\\|\\.dtx$" x)))
(TeX-master-directory))))
(format "%s" file)))))
"GetFileInfo"
"filename"
"fileinfo")
(TeX-run-style-hooks "shortvrb")
(LaTeX-add-lengths "MacrocodeTopsep" "MacroTopsep" "MacroIndent"))
LaTeX-dialect)
;; Local Variables:
;; coding: iso-8859-1
;; End:

View File

@@ -0,0 +1,10 @@
;;; dutch.el - Setup AUCTeX for editing Dutch text.
;;; Code:
(TeX-add-style-hook "dutch"
(function (lambda ()
(run-hooks 'TeX-language-nl-hook)))
LaTeX-dialect)
;;; dutch.el ends here

View File

@@ -0,0 +1,85 @@
;;; emp.el --- AUCTeX support for emp.sty
;; Copyright (C) 2004, 2005, 2014 Free Software Foundation, Inc.
;; Author: Yvon Henel aka TeXnicien de surface <Yvon.Henel@wanadoo.fr>
;; Maintainer: auctex-devel@gnu.org
;; Keywords: tex
;; This file 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.
;; This file 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 GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;; version 1.0 2004-03-04
;;; Code:
(TeX-add-style-hook "emp"
(function
(lambda ()
(TeX-add-symbols "empuse" "empTeX" "empaddtoTeX"
"emprelude" "empaddtoprelude" "unitlength"
)
(LaTeX-add-environments
'("empfile" LaTeX-env-empfile)
'("emp" LaTeX-env-emp-gen)
'("empdef" LaTeX-env-emp-gen)
'("empgraph" LaTeX-env-emp-gen)
'("empcmds")
)))
LaTeX-dialect)
(defun LaTeX-env-emp-gen (environment-name)
"Ask for file, width and length. Insert environment-name environment
Used for emp, empdef, and empgraph environments."
(let ((emp-fig-name (TeX-read-string "figure name: " ""))
(emp-fig-width (TeX-read-string "figure width: " "1" ))
(emp-fig-height (TeX-read-string "figure height: " "1" ))
;;; emp.sty demands a width and a height for each of the
;;; emp, empdef, and empgraph environments
;;; we give them 1 by default
;;; not necessarily the best thing to do?
)
(if (not (zerop (length emp-fig-name)))
(progn
(setq LaTeX-emp-fig-name (concat LaTeX-optop emp-fig-name LaTeX-optcl))
(LaTeX-insert-environment environment-name LaTeX-emp-fig-name))
(LaTeX-insert-environment environment-name))
(forward-line -1)
(end-of-line)
(insert "(" emp-fig-width "," emp-fig-height ")")
(forward-line 1)
(indent-according-to-mode)
))
(defun LaTeX-env-empfile (_optional)
"Ask for file. Insert empfile environment"
(let ((empfile (TeX-read-string "empfile: " "")))
(if (not (zerop (length empfile)))
(progn
(setq LaTeX-emp-file-name (concat LaTeX-optop empfile LaTeX-optcl))
(setq mpost-emp-file-name (concat empfile ".mp"))
(LaTeX-insert-environment "empfile" LaTeX-emp-file-name))
(progn
(setq mpost-emp-file-name "\\jobname")
(LaTeX-insert-environment "empfile")))
(if LaTeX-write18-enabled-p
(progn
(forward-line 1)
(end-of-line)
(newline-and-indent)
(insert "\\immediate\\write18{mpost -tex=latex " mpost-emp-file-name TeX-grcl)
(forward-line -2)))))
;;; emp.el ends here

View File

@@ -0,0 +1,500 @@
;;; empheq.el --- AUCTeX style for `empheq.sty' (v2.14)
;; Copyright (C) 2016, 2017 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2016-08-07
;; 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 `empheq.sty' (v2.14) from 2014/08/04.
;; `empheq.sty' is part of TeXLive.
;;; Code:
;; Needed for compiling `pushnew':
(eval-when-compile (require 'cl))
;; Needed for auto-parsing.
(require 'tex)
(defvar LaTeX-empheq-key-val-options
`(("box")
("innerbox")
("left" ,(mapcar
(lambda (x)
(concat TeX-esc x))
'("empheqlbrace"
"empheqlbrack"
"empheqlangle"
"empheqlparen"
"empheqlvert"
"empheqlVert"
"empheqlfloor"
"empheqlceil"
"empheqbiglbrace"
"empheqbiglbrack"
"empheqbiglangle"
"empheqbiglparen"
"empheqbiglvert"
"empheqbiglVert"
"empheqbiglfloor"
"empheqbiglceil")))
("right" ,(mapcar
(lambda (x)
(concat TeX-esc x))
'("empheqrbrace"
"empheqrbrack"
"empheqrangle"
"empheqrparen"
"empheqrvert"
"empheqrVert"
"empheqrfloor"
"empheqrceil"
"empheqbigrbrace"
"empheqbigrbrack"
"empheqbigrangle"
"empheqbigrparen"
"empheqbigrvert"
"empheqbigrVert"
"empheqbigrfloor"
"empheqbigrceil")))
("outerbox")
("marginbox"))
"Key=value options for environments from empheq.sty.")
(defvar LaTeX-empheq-key-val-options-local nil
"Buffer-local key=value options for environments from empheq.sty.")
(make-local-variable 'LaTeX-empheq-key-val-options-local)
(defvar LaTeX-empheq-supported-amsmath-envs
'("equation" "equation*"
"align" "align*"
"gather" "gather*"
"flalign" "flalign*"
"alignat" "alignat*"
"multline" "multline*")
"List of amsmath environments supported by empheq package.")
(defvar LaTeX-empheq-package-options
'("overload" "overload2" "ntheorem" "newmultline" "oldmultline")
"Package options for the empheq package.")
;; Setup for \Declare(Left|Right)Delimiter:
(TeX-auto-add-type "empheq-declaredelimiter" "LaTeX")
(defvar LaTeX-empheq-declaredelimiter-regexp
`(,(concat "\\\\Declare\\(Left\\|Right\\)Delimiter"
"[ \t\n\r%]*"
"\\(?:\\[[^]]*\\]\\)?"
"[ \t\n\r%]*"
"{"
(regexp-quote TeX-esc)
"\\([^}]+\\)}")
(2 1) LaTeX-auto-empheq-declaredelimiter)
"Matches the argument of \\Declare(Left|Right)Delimiter from empheq package.")
(defun LaTeX-empheq-auto-prepare ()
"Clear `LaTeX-auto-empheq-declaredelimiter' before parsing."
(setq LaTeX-auto-empheq-declaredelimiter nil))
(defun LaTeX-empheq-auto-cleanup ()
"Process parsed delimiters."
(dolist (delim (mapcar #'car (LaTeX-empheq-declaredelimiter-list)))
(TeX-add-symbols (concat "empheq" delim)
(concat "empheqbig" delim)))
(LaTeX-empheq-update-key-val-options))
(add-hook 'TeX-auto-prepare-hook #'LaTeX-empheq-auto-prepare t)
(add-hook 'TeX-auto-cleanup-hook #'LaTeX-empheq-auto-cleanup t)
(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
(defun LaTeX-empheq-update-key-val-options ()
"Update `LaTeX-empheq-key-val-options-local' if the function
`LaTeX-empheq-declaredelimiter-list' returns non-nil."
(when (LaTeX-empheq-declaredelimiter-list)
(let ((lvals (cadr (assoc "left" LaTeX-empheq-key-val-options)))
(rvals (cadr (assoc "right" LaTeX-empheq-key-val-options)))
(tmp (copy-alist LaTeX-empheq-key-val-options))
lval rval)
(dolist (delims (LaTeX-empheq-declaredelimiter-list))
(let ((delim (car delims))
(where (cadr delims)))
(if (string= where "Left")
(progn
(pushnew (concat TeX-esc "empheq" delim) lval :test #'equal)
(pushnew (concat TeX-esc "empheqbig" delim) lval :test #'equal))
(progn
(pushnew (concat TeX-esc "empheq" delim) rval :test #'equal)
(pushnew (concat TeX-esc "empheqbig" delim) rval :test #'equal)))))
(when lval
(setq tmp (assq-delete-all (car (assoc "left" tmp)) tmp))
(setq lvals (append lval lvals))
(push (list "left" lvals) tmp))
(when rval
(setq tmp (assq-delete-all (car (assoc "right" tmp)) tmp))
(setq rvals (append rval rvals))
(push (list "right" rvals) tmp))
(setq LaTeX-empheq-key-val-options-local
(copy-alist tmp)))))
(defun LaTeX-empheq-env (env)
"Query for a supported amsmath environment and insert it accordingly."
(let* ((keyvals (TeX-read-key-val t LaTeX-empheq-key-val-options-local))
(amsenv (completing-read
(TeX-argument-prompt nil nil "amsmath environment")
LaTeX-empheq-supported-amsmath-envs))
(ncols (when (or (string= amsenv "alignat")
(string= amsenv "alignat*"))
(TeX-read-string
(TeX-argument-prompt nil nil "Number of columns"))))
num)
(LaTeX-insert-environment
env
(concat
(when (and keyvals (not (string= keyvals "")))
(concat LaTeX-optop keyvals LaTeX-optcl))
TeX-grop
(if (and ncols (not (string= ncols "")))
(concat amsenv "=" ncols)
(symbol-value 'amsenv))
TeX-grcl))
(when (and (assoc amsenv LaTeX-label-alist)
(LaTeX-label amsenv 'environment))
(LaTeX-newline)
(indent-according-to-mode))
(when (and ncols (not (string= ncols "")))
(setq num (string-to-number ncols))
(save-excursion
(insert (make-string (+ num num -1) ?&))))))
(defun LaTeX-empheq-env-overload (env &optional _ignore)
"Insert amsmath ENV's when option overload is given to empheq package.
This function combines the capabilities of `LaTeX-env-label' and
`LaTeX-amsmath-env-alignat'. It overwrites the definitions of
`amsmath.el'."
(if (or (string= env "alignat")
(string= env "alignat*"))
(let ((ncols (TeX-read-string
(TeX-argument-prompt nil nil "Number of columns")))
(keyvals (TeX-read-key-val t
LaTeX-empheq-key-val-options-local
"empheq options (k=v)")))
(LaTeX-insert-environment env (concat TeX-grop ncols TeX-grcl
(when (and keyvals (not (string= keyvals "")))
(concat LaTeX-optop keyvals LaTeX-optcl))))
(LaTeX-item-equation-alignat t))
(let ((keyvals
(TeX-read-key-val t LaTeX-empheq-key-val-options-local "empheq options (k=v)")))
(LaTeX-insert-environment env (when (and keyvals (not (string= keyvals "")))
(concat LaTeX-optop keyvals LaTeX-optcl)))
(when (and (assoc env LaTeX-label-alist)
(LaTeX-label env 'environment))
(LaTeX-newline)
(indent-according-to-mode)))))
(defun LaTeX-empheq-item-equation ()
"Insert contents to terminate a line in multi-line equations environment.
Put line break macro on the last line. Next, if the current
environment wants \\label, insert it also. And insert suitable
number of ampersands if possible."
(let ((env (LaTeX-current-environment))
amsenv ncols match)
(save-excursion
(LaTeX-find-matching-begin)
(re-search-forward (concat (regexp-quote TeX-esc)
"begin" TeX-grop env TeX-grcl))
(when (looking-at "[ \t\n\r%]*\\[")
(forward-sexp))
(re-search-forward "[ \t\n\r%]*{\\([^}]+\\)}")
(setq match (TeX-replace-regexp-in-string "[ \t\n\r%]" ""
(match-string-no-properties 1)))
(if (string-match "=" match)
(progn
(setq amsenv (car (split-string match "=")))
(setq ncols (string-to-number (cadr (split-string match "=")))))
(setq amsenv match)))
;; Do not ask for "\\" if in "equation" or "equation*" since these
;; are single line equations only
(if (or (string= amsenv "equation")
(string= amsenv "equation*"))
;; Nullify the effect of `M-RET'
(progn
(message "This environment does not support multi-line equations")
(end-of-line 0)
(kill-line 1))
(progn
(end-of-line 0)
(just-one-space)
(TeX-insert-macro "\\")
(forward-line 1)
(indent-according-to-mode)))
;; Add a new label only if not in "equation"
(when (and (not (string= amsenv "equation"))
(assoc amsenv LaTeX-label-alist)
(LaTeX-label amsenv 'environment))
(LaTeX-newline)
(indent-according-to-mode))
(when ncols
(save-excursion
(insert (make-string (+ ncols ncols -1) ?&))))))
(TeX-add-style-hook
"empheq"
(lambda ()
;; Add empheq to parser
(TeX-auto-add-regexp LaTeX-empheq-declaredelimiter-regexp)
;; Load amsmath.el and mathtools.el
(TeX-run-style-hooks "amsmath" "mathtools")
;; Add elements from `LaTeX-mathtools-package-options' only once
;; and not every time the style hook runs
(dolist (elt LaTeX-mathtools-package-options)
(add-to-list 'LaTeX-empheq-package-options elt))
;; Local version of key-val options
(setq LaTeX-empheq-key-val-options-local
(copy-alist LaTeX-empheq-key-val-options))
;; Initial update of key-vals
(LaTeX-empheq-update-key-val-options)
(LaTeX-add-environments
'("empheq" LaTeX-empheq-env))
;; Add "empheq" to `LaTeX-item-list' and run
;; `LaTeX-empheq-item-equation' when `M-RET' is invoked
(add-to-list 'LaTeX-item-list '("empheq" . LaTeX-empheq-item-equation) t)
;; Reftex support: Use `reftex-add-label-environments'
(when (fboundp 'reftex-add-label-environments)
(reftex-add-label-environments '(("empheq" ?e nil nil t))))
(TeX-add-symbols
'("empheqset" (TeX-arg-key-val LaTeX-empheq-key-val-options-local))
;; 1.4 Special delimiters
;; Normal
'("empheqlbrace" TeX-arg-insert-right-brace-maybe)
'("empheqrbrace")
'("empheqlbrack" TeX-arg-insert-right-brace-maybe)
'("empheqrbrack")
'("empheqlangle" TeX-arg-insert-right-brace-maybe)
'("empheqrangle")
'("empheqlparen" TeX-arg-insert-right-brace-maybe)
'("empheqrparen")
'("empheqlvert" TeX-arg-insert-right-brace-maybe)
'("empheqrvert")
'("empheqlVert" TeX-arg-insert-right-brace-maybe)
'("empheqrVert")
'("empheqlfloor" TeX-arg-insert-right-brace-maybe)
'("empheqrfloor")
'("empheqlceil" TeX-arg-insert-right-brace-maybe)
'("empheqrceil")
;; Bigger
'("empheqbiglbrace" TeX-arg-insert-right-brace-maybe)
'("empheqbigrbrace")
'("empheqbiglbrack" TeX-arg-insert-right-brace-maybe)
'("empheqbigrbrack")
'("empheqbiglangle" TeX-arg-insert-right-brace-maybe)
'("empheqbigrangle")
'("empheqbiglparen" TeX-arg-insert-right-brace-maybe)
'("empheqbigrparen")
'("empheqbiglvert" TeX-arg-insert-right-brace-maybe)
'("empheqbigrvert")
'("empheqbiglVert" TeX-arg-insert-right-brace-maybe)
'("empheqbigrVert")
'("empheqbiglfloor" TeX-arg-insert-right-brace-maybe)
'("empheqbigrfloor")
'("empheqbiglceil" TeX-arg-insert-right-brace-maybe)
'("empheqbigrceil"))
;; Append delimiters to `TeX-braces-association'
(make-local-variable 'TeX-braces-association)
(let ((delimiters '(("\\empheqlbrace" . "\\empheqrbrace")
("\\empheqlbrack" . "\\empheqrbrack")
("\\empheqlangle" . "\\empheqrangle")
("\\empheqlparen" . "\\empheqrparen")
("\\empheqlvert" . "\\empheqrvert")
("\\empheqlVert" . "\\empheqrVert")
("\\empheqlfloor" . "\\empheqrfloor")
("\\empheqlceil" . "\\empheqrceil")
("\\empheqbiglbrace" . "\\empheqbigrbrace")
("\\empheqbiglbrack" . "\\empheqbigrbrack")
("\\empheqbiglangle" . "\\empheqbigrangle")
("\\empheqbiglparen" . "\\empheqbigrparen")
("\\empheqbiglvert" . "\\empheqbigrvert")
("\\empheqbiglVert" . "\\empheqbigrVert")
("\\empheqbiglfloor" . "\\empheqbigrfloor")
("\\empheqbiglceil" . "\\empheqbigrceil"))))
(dolist (elt delimiters)
(add-to-list 'TeX-braces-association elt t)))
;; 2.2.1 Using multline
(when (LaTeX-provided-package-options-member "empheq" "oldmultline")
(LaTeX-add-environments
'("MTmultlined" LaTeX-mathtools-env-multlined)))
;; 2.2.2 The overload option
;; I simplify it and ignore the additional feature overload2:
(when (or (LaTeX-provided-package-options-member "empheq" "overload")
(LaTeX-provided-package-options-member "empheq" "overload2"))
(LaTeX-add-environments
'("align" LaTeX-empheq-env-overload)
'("alignat" LaTeX-empheq-env-overload)
'("equation" LaTeX-empheq-env-overload)
'("flalign" LaTeX-empheq-env-overload)
'("gather" LaTeX-empheq-env-overload)
'("multline" LaTeX-empheq-env-overload)
'("align*" LaTeX-env-args [TeX-arg-key-val LaTeX-empheq-key-val-options-local])
'("alignat*" LaTeX-empheq-env-overload)
'("equation*" LaTeX-env-args [TeX-arg-key-val LaTeX-empheq-key-val-options-local])
'("flalign*" LaTeX-env-args [TeX-arg-key-val LaTeX-empheq-key-val-options-local])
'("gather*" LaTeX-env-args [TeX-arg-key-val LaTeX-empheq-key-val-options-local])
'("multline*" LaTeX-env-args [TeX-arg-key-val LaTeX-empheq-key-val-options-local])
;; Original definitions are stored prefixed with "AmS"
'("AmSalign" LaTeX-env-label)
'("AmSalignat" LaTeX-amsmath-env-alignat)
'("AmSequation" LaTeX-env-label)
'("AmSflalign" LaTeX-env-label)
'("AmSgather" LaTeX-env-label)
'("AmSmultline" LaTeX-env-label)
'("AmSalign*")
'("AmSalignat*" LaTeX-amsmath-env-alignat)
'("AmSequation*")
'("AmSflalign*")
'("AmSgather*")
'("AmSmultline*"))
;; Append original definitions to `LaTeX-label-alist'
(let ((envs '("AmSalign"
"AmSalignat"
"AmSequation"
"AmSflalign"
"AmSgather"
"AmSmultline")))
(dolist (env envs)
(add-to-list 'LaTeX-label-alist `(,env . LaTeX-amsmath-label) t)))
;; RefTeX support: Add original definitions with `reftex-add-label-environments'
(when (fboundp 'reftex-add-label-environments)
(let ((envs '(("AmSalign" ?e nil nil eqnarray-like)
("AmSequation" ?e nil nil t)
("AmSgather" ?e nil nil eqnarray-like)
("AmSmultline" ?e nil nil t)
("AmSflalign" ?e nil nil eqnarray-like)
("AmSalignat" ?e nil nil alignat-like))))
(dolist (env envs)
(reftex-add-label-environments `(,env)))))
;; Append original definitions to `LaTeX-item-list'; functions
;; are provided by amsmath.el
(let ((envs '(("AmSalign" . LaTeX-item-equation)
("AmSalign*" . LaTeX-item-equation)
("AmSflalign" . LaTeX-item-equation)
("AmSalignat" . LaTeX-item-equation-alignat)
("AmSalignat*" . LaTeX-item-equation-alignat)
("AmSflalign*" . LaTeX-item-equation)
("AmSgather" . LaTeX-item-equation)
("AmSgather*" . LaTeX-item-equation)
("AmSmultline" . LaTeX-item-equation)
("AmSmultline*" . LaTeX-item-equation))))
(dolist (env envs)
(add-to-list 'LaTeX-item-list env t)))
;; Ispell skip lists:
(TeX-ispell-skip-setcdr
`(,(cons (concat "\\(AmS\\(?:align\\(?:\\*\\|at\\*?\\)?\\|"
"equation\\*?\\|flalign\\*?\\|gather\\*?\\|multline\\*?\\)\\)")
(concat "\\\\end{"
"\\(AmS\\(?:align\\(?:\\*\\|at\\*?\\)?\\|"
"equation\\*?\\|flalign\\*?\\|gather\\*?\\|multline\\*?\\)\\)}")))))
;; 3.2 Support for ntheorem
(LaTeX-add-lengths "mintagvsep")
;; 4.1 Creating your own delimiters
(TeX-add-symbols
'("DeclareLeftDelimiter"
[ "Space adjustment" ]
(TeX-arg-eval
(lambda ()
(let ((delim (TeX-read-string (concat "Delimiter: " TeX-esc))))
(TeX-add-symbols (concat "empheq" delim)
(concat "empheqbig" delim))
(LaTeX-add-empheq-declaredelimiters `(,delim "Left"))
(LaTeX-empheq-update-key-val-options)
(concat TeX-esc delim)))))
'("DeclareRightDelimiter"
[ "Space adjustment" ]
(TeX-arg-eval
(lambda ()
(let ((delim (TeX-read-string (concat "Delimiter: " TeX-esc))))
(TeX-add-symbols (concat "empheq" delim)
(concat "empheqbig" delim))
(LaTeX-add-empheq-declaredelimiters `(,delim "Right"))
(LaTeX-empheq-update-key-val-options)
(concat TeX-esc delim))))))
;; 4.2 Fine-tuning of delimiters
(LaTeX-add-lengths "EmphEqdelimitershortfall")
(LaTeX-add-counters "EmphEqdelimiterfactor")
(TeX-add-symbols
;; 4.3 Scaling material yourself
'("EmphEqdisplayheight" 0)
'("EmphEqdisplaydepth" 0)
;; 6.1 New empheq-like environments
'("EmphEqMainEnv" 0)
'("endEmphEqMainEnv" 0))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("empheqset" "{")
("DeclareLeftDelimiter" "[{")
("DeclareRightDelimiter" "[{"))
'function)
;; Append our addition so that we don't interfere with user customizations
(make-local-variable 'font-latex-math-environments)
(add-to-list 'font-latex-math-environments "empheq" t)
(when (or (LaTeX-provided-package-options-member "empheq" "overload")
(LaTeX-provided-package-options-member "empheq" "overload2"))
(let ((envs '(;; Do not insert the starred versions here;
;; function `font-latex-match-math-envII' takes
;; care of it
"AmSalign"
"AmSalignat"
"AmSequation"
"AmSflalign"
"AmSgather"
"AmSmultline")))
(dolist (env envs)
(add-to-list 'font-latex-math-environments env t))))))
LaTeX-dialect)
;;; empheq.el ends here

View File

@@ -0,0 +1,13 @@
;;; english.el --- Setup AUCTeX for editing English text.
;;; Code:
(TeX-add-style-hook
"english"
(lambda ()
(unless (eq (car TeX-quote-language) 'override)
(setq TeX-quote-language nil))
(run-hooks 'TeX-language-en-hook))
LaTeX-dialect)
;;; english.el ends here

View File

@@ -0,0 +1,455 @@
;;; enumitem.el --- AUCTeX style for `enumitem.sty' (v3.5.2)
;; Copyright (C) 2015, 2016 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2014-10-20
;; 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 `enumitem.sty' (v3.5.2) from 2011/09/28.
;; `enumitem.sty' is part of TeXLive.
;; Tassilo Horn's `minted.el' was a major source of inspiration for
;; this style, many thanks to him (also for patiently answering my
;; many other questions, incl. the stupid ones.)
;; If things do not work or when in doubt, press `C-c C-n'. Comments
;; for improvement are welcome.
;;; Code:
;; Needed for compiling `pushnew':
(eval-when-compile (require 'cl))
;; Needed for auto-parsing.
(require 'tex)
(defvar LaTeX-enumitem-key-val-options
'(;; Vertical Spacing
("topsep")
("partopsep")
("parsep")
("itemsep")
;; Horizontal Spacing
("leftmargin" ("*" "!"))
("itemindent" ("*" "!"))
("labelsep" ("*" "!"))
("labelwidth" ("*" "!"))
("labelindent" ("*" "!"))
("labelsep*")
("labelindent*")
("widest")
("widest*")
("rightmargin")
;; Labels and cross reference format
("label")
("label*")
("ref")
("font")
("format")
("align" ("left" "right" "parleft"))
;; Numbering, stopping, resuming
("start")
("resume")
("resume*")
;; Series
("series")
;; Penalties
("beginpenalty")
("midpenalty")
("endpenalty")
("before")
("before*")
("after")
("after*")
;; Description styles
("style" ("standard" "multiline" "nextline" "sameline" "unboxed"))
;; Compact lists
("noitemsep")
("nosep")
;; Wide lists
("wide")
;; Inline lists
("itemjoin")
("itemjoin*")
("afterlabel")
("mode" ("boxed" "unboxed")))
"Key=value options for enumitem macros and environments.")
(defvar LaTeX-enumitem-key-val-options-local nil
"Buffer-local key=value options for enumitem macros and environments.")
(make-variable-buffer-local 'LaTeX-enumitem-key-val-options-local)
(defvar LaTeX-enumitem-newlist-list-local nil
"Local list of all environments definded with `\\newlist' plus
the ones initially available through `enumitem' package.")
(make-variable-buffer-local 'LaTeX-enumitem-newlist-list-local)
;; Setup for \newlist:
(TeX-auto-add-type "enumitem-newlist" "LaTeX")
(defvar LaTeX-enumitem-newlist-regexp
'("\\\\newlist{\\([^}]+\\)}{\\([^}]+\\)}"
(1 2) LaTeX-auto-enumitem-newlist)
"Matches the arguments of `\\newlist' from `enumitem'
package.")
;; Setup for \SetLabelAlign:
(TeX-auto-add-type "enumitem-SetLabelAlign" "LaTeX")
(defvar LaTeX-enumitem-SetLabelAlign-regexp
'("\\\\SetLabelAlign{\\([^}]+\\)}"
1 LaTeX-auto-enumitem-SetLabelAlign)
"Matches the argument of `\\SetLabelAlign' from `enumitem'
package.")
;; Setup for \SetEnumitemKey:
(TeX-auto-add-type "enumitem-SetEnumitemKey" "LaTeX")
(defvar LaTeX-enumitem-SetEnumitemKey-regexp
'("\\\\SetEnumitemKey{\\([^}]+\\)}"
1 LaTeX-auto-enumitem-SetEnumitemKey)
"Matches the arguments of `\\SetEnumitemKey' from `enumitem'
package.")
;; Setup for \SetEnumitemValue:
(TeX-auto-add-type "enumitem-SetEnumitemValue" "LaTeX")
;; Upon Tassilo's recommendation, we include also `0' so that we can
;; use the function `LaTeX-enumitem-SetEnumitemValue-list' while we
;; make sure that `TeX-auto-list-information' doesn't remove multiple
;; defined values to a specific key. For this reason, we also ignore
;; the 3. argument to the `\SetEnumitemValue' macro (i.e., a third
;; {\\([^}]+\\)} in regex) so that we don't pollute the generated
;; `docname.el' with unnecessary (La)TeX code.
(defvar LaTeX-enumitem-SetEnumitemValue-regexp
'("\\\\SetEnumitemValue{\\([^}]+\\)}{\\([^}]+\\)}"
(0 1 2) LaTeX-auto-enumitem-SetEnumitemValue)
"Matches the arguments of `\\SetEnumitemValue' from `enumitem'
package.")
;; Plug them into the machinery.
(defun LaTeX-enumitem-auto-prepare ()
"Clear various `LaTeX-enumitem-*' before parsing."
(setq LaTeX-auto-enumitem-newlist nil
LaTeX-auto-enumitem-SetLabelAlign nil
LaTeX-auto-enumitem-SetEnumitemKey nil
LaTeX-auto-enumitem-SetEnumitemValue nil))
(defun LaTeX-enumitem-auto-cleanup ()
"Move parsing results into right places for further usage."
;; \newlist{<name>}{<type>}{<max-depth>}
;; env=<name>, type=<type>, ignored=<max-depth>
(dolist (env-type (LaTeX-enumitem-newlist-list))
(let* ((env (car env-type))
(type (cadr env-type)))
(LaTeX-add-environments (list env 'LaTeX-enumitem-env-with-opts))
;; Tell AUCTeX about parsed description like environments.
(when (or (string-equal type "description")
(string-equal type "description*"))
(add-to-list 'LaTeX-item-list `(,env . LaTeX-item-argument)))
;; Add new env's to `ispell-tex-skip-alist': skip the optional argument
(TeX-ispell-skip-setcdr `((,env ispell-tex-arg-end 0)))))
;; Now add the parsed env's to the local list.
(when (LaTeX-enumitem-newlist-list)
(setq LaTeX-enumitem-newlist-list-local
(append (mapcar 'list (mapcar 'car (LaTeX-enumitem-newlist-list)))
LaTeX-enumitem-newlist-list-local))))
(add-hook 'TeX-auto-prepare-hook #'LaTeX-enumitem-auto-prepare t)
(add-hook 'TeX-auto-cleanup-hook #'LaTeX-enumitem-auto-cleanup t)
(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
(defun LaTeX-enumitem-env-with-opts (env)
"Update available key-val options, then insert ENV and optional
key-val and the first item."
(LaTeX-enumitem-update-key-val-options)
(LaTeX-insert-environment
env
(let ((opts (TeX-read-key-val t LaTeX-enumitem-key-val-options-local)))
(when (and opts (not (string-equal opts "")))
(format "[%s]" opts))))
(if (TeX-active-mark)
(progn
(LaTeX-find-matching-begin)
(end-of-line 1))
(end-of-line 0))
(delete-char 1)
(when (looking-at (concat "^[ \t]+$\\|"
"^[ \t]*" TeX-comment-start-regexp "+[ \t]*$"))
(delete-region (point) (line-end-position)))
(delete-horizontal-space)
;; Deactivate the mark here in order to prevent `TeX-parse-macro'
;; from swapping point and mark and the \item ending up right after
;; \begin{...}.
(TeX-deactivate-mark)
(LaTeX-insert-item)
;; The inserted \item may have outdented the first line to the
;; right. Fill it, if appropriate.
(when (and (not (looking-at "$"))
(not (assoc env LaTeX-indent-environment-list))
(> (- (line-end-position) (line-beginning-position))
(current-fill-column)))
(LaTeX-fill-paragraph nil)))
(defun LaTeX-arg-SetLabelAlign (optional)
"Ask for new type (value) for the \"align\" key and add it to
`LaTeX-enumitem-key-val-options-local'."
(LaTeX-enumitem-update-key-val-options)
(let ((val (TeX-read-string "Alignment: ")))
(TeX-argument-insert val optional)
(LaTeX-add-enumitem-SetLabelAligns val)))
(defun LaTeX-arg-SetEnumitemKey (optional)
"Ask for a new key to be defined and add it to
`LaTeX-enumitem-key-val-options-local'."
(LaTeX-enumitem-update-key-val-options)
(let ((key (TeX-read-string "New Key: "))
(replace (TeX-read-key-val optional
LaTeX-enumitem-key-val-options-local "Replacement")))
(TeX-argument-insert key optional)
(TeX-argument-insert replace optional)
(LaTeX-add-enumitem-SetEnumitemKeys key)))
;; In `LaTeX-enumitem-SetEnumitemValue-regexp', we match (0 1 2).
;; When adding a new `key=val', we need something unique for `0'-match
;; until the next `C-c C-n'. We mimic that regex-match bei concat'ing
;; the elements and pass the result to
;; `LaTeX-add-enumitem-SetEnumitemValues'. It will vanish upon next
;; invocation of `C-c C-n'.
(defun LaTeX-arg-SetEnumitemValue (optional)
"Ask for a new value added to an existing key incl. the final
replacement of the value."
(LaTeX-enumitem-update-key-val-options)
(let ((key (completing-read "Key: " LaTeX-enumitem-key-val-options-local))
(val (TeX-read-string "String value: ")))
(TeX-argument-insert key optional)
(TeX-argument-insert val optional)
(LaTeX-add-enumitem-SetEnumitemValues
(list (concat "\\SetEnumitemValue{" key "}{" val "}")
key val))))
(defun LaTeX-enumitem-update-key-val-options ()
"Update the buffer-local key-val options before offering them
in `enumitem'-completions."
(dolist (key (LaTeX-enumitem-SetEnumitemKey-list))
(add-to-list 'LaTeX-enumitem-key-val-options-local key))
(dolist (keyvals (LaTeX-enumitem-SetEnumitemValue-list))
(let* ((key (nth 1 keyvals))
(val (nth 2 keyvals))
;; (key-match (car (assoc key LaTeX-enumitem-key-val-options-local)))
(val-match (cdr (assoc key LaTeX-enumitem-key-val-options-local)))
(temp (copy-alist LaTeX-enumitem-key-val-options-local))
(opts (assq-delete-all (car (assoc key temp)) temp)))
(if val-match
(pushnew (list key (delete-dups (apply 'append (list val) val-match)))
opts :test #'equal)
(pushnew (list key (list val)) opts :test #'equal))
(setq LaTeX-enumitem-key-val-options-local (copy-alist opts))))
(dolist (newalign (LaTeX-enumitem-SetLabelAlign-list))
(let* ((key "align")
(val (car newalign))
(val-match (cdr (assoc key LaTeX-enumitem-key-val-options-local)))
(temp (copy-alist LaTeX-enumitem-key-val-options-local))
(opts (assq-delete-all (car (assoc key temp)) temp)))
(pushnew (list key (delete-dups (apply 'append (list val) val-match)))
opts :test #'equal)
(setq LaTeX-enumitem-key-val-options-local (copy-alist opts)))))
(TeX-add-style-hook
"enumitem"
(lambda ()
;; Add enumitem to the parser.
(TeX-auto-add-regexp LaTeX-enumitem-newlist-regexp)
(TeX-auto-add-regexp LaTeX-enumitem-SetEnumitemKey-regexp)
(TeX-auto-add-regexp LaTeX-enumitem-SetEnumitemValue-regexp)
(TeX-auto-add-regexp LaTeX-enumitem-SetLabelAlign-regexp)
;; Activate the buffer-local version of key-vals.
(setq LaTeX-enumitem-key-val-options-local
(copy-alist LaTeX-enumitem-key-val-options))
;; Set the standard env's to the local list.
(setq LaTeX-enumitem-newlist-list-local
'(("itemize") ("enumerate") ("description")))
;; Add the starred versions to the local list.
(when (LaTeX-provided-package-options-member "enumitem" "inline")
(setq LaTeX-enumitem-newlist-list-local
(append '(("itemize*") ("enumerate*") ("description*"))
LaTeX-enumitem-newlist-list-local)))
;; Standard env's take key-val as optional argument.
(LaTeX-add-environments
'("itemize" LaTeX-enumitem-env-with-opts)
'("enumerate" LaTeX-enumitem-env-with-opts)
'("description" LaTeX-enumitem-env-with-opts))
;; Make inline env's available with package option "inline"
(when (LaTeX-provided-package-options-member "enumitem" "inline")
(LaTeX-add-environments
'("itemize*" LaTeX-enumitem-env-with-opts)
'("enumerate*" LaTeX-enumitem-env-with-opts)
'("description*" LaTeX-enumitem-env-with-opts))
(add-to-list 'LaTeX-item-list '("description*" . LaTeX-item-argument)))
;; Cloning lists
(TeX-add-symbols
;; The easy way would be:
;; '("newlist"
;; "Name" (TeX-arg-eval
;; completing-read "Type: "
;; '(("itemize") ("enumerate") ("description")
;; ("itemize*") ("enumerate*") ("description*")))
;; "Max-depth")
;; But we go the extra mile to improve the user experience and add
;; the arguments directly to appropriate lists.
;; \newlist{<name>}{<type>}{<max-depth>}
'("newlist"
(TeX-arg-eval
(lambda ()
(let ((name (TeX-read-string "Name: "))
(type (completing-read
"Type: "
'(("itemize") ("enumerate") ("description")
("itemize*") ("enumerate*") ("description*"))))
(depth (TeX-read-string "Max-depth: ")))
(setq LaTeX-enumitem-newlist-list-local
(append `(,(list name)) LaTeX-enumitem-newlist-list-local))
(when (or (string-equal type "description")
(string-equal type "description*"))
(add-to-list 'LaTeX-item-list `(,name . LaTeX-item-argument)))
(LaTeX-add-environments `(,name LaTeX-enumitem-env-with-opts))
(LaTeX-add-enumitem-newlists (list name type))
(TeX-ispell-skip-setcdr `((,name ispell-tex-arg-end 0)))
(TeX-argument-insert name optional)
(TeX-argument-insert type optional)
(format "%s" depth)))))
;; \renewlist{<name>}{<type>}{<max-depth>}
'("renewlist"
(TeX-arg-eval completing-read "Name: "
LaTeX-enumitem-newlist-list-local)
(TeX-arg-eval completing-read "Type: "
'(("itemize") ("enumerate") ("description")
("itemize*") ("enumerate*") ("description*")))
"Max-depth")
;; \setlist[<names,levels>]{<key-vals>}
'("setlist"
[TeX-arg-eval mapconcat 'identity
(TeX-completing-read-multiple
"Environment(s), level(s): "
`(,@LaTeX-enumitem-newlist-list-local
("1") ("2") ("3") ("4"))) ","]
(TeX-arg-eval
(lambda ()
(LaTeX-enumitem-update-key-val-options)
(let ((opts (TeX-read-key-val nil LaTeX-enumitem-key-val-options-local)))
(format "%s" opts)))))
;; \setlist*[<names,levels>]{<key-vals>}
'("setlist*"
[TeX-arg-eval mapconcat 'identity
(TeX-completing-read-multiple
"Environment, level: "
`(,@LaTeX-enumitem-newlist-list-local
("1") ("2") ("3") ("4"))) ","]
(TeX-arg-eval
(lambda ()
(LaTeX-enumitem-update-key-val-options)
(let ((opts (TeX-read-key-val nil LaTeX-enumitem-key-val-options-local)))
(format "%s" opts))))) )
;; General commands:
(TeX-add-symbols
;; Ask for an Integer and insert it.
'("setlistdepth" "Integer")
;; Just add the braces and let the user do the rest.
'("AddEnumerateCounter" 3)
'("AddEnumerateCounter*" 3)
;; "\restartlist" only works for lists defined with "resume" key.
;; We will not extract that information and leave that to users.
;; For completion, extract enumerated environments from
;; `LaTeX-enumitem-newlist-list' and add "enumerate" to them.
'("restartlist"
(TeX-arg-eval
(lambda ()
(let ((enums '("enumerate")))
(when (LaTeX-provided-package-options-member "enumitem" "inline")
(pushnew "enumerate*" enums :test #'equal))
(dolist (env-type (LaTeX-enumitem-newlist-list))
(let ((env (car env-type))
(type (cadr env-type)))
(when (or (string-equal type "enumerate")
(string-equal type "enumerate*"))
(pushnew env enums :test #'equal))))
(completing-read "List name: " enums)))))
;; "Align" is added as new value to "align" key in key-val list.
'("SetLabelAlign" LaTeX-arg-SetLabelAlign t)
;; "Key" will be parsed and added to key-val list.
'("SetEnumitemKey" LaTeX-arg-SetEnumitemKey)
;; "Key" and "Value" are added to our key-val list
'("SetEnumitemValue" LaTeX-arg-SetEnumitemValue "Replacement"))
;; Setting enumerate short label
(when (LaTeX-provided-package-options-member "enumitem" "shortlabels")
(TeX-add-symbols
'("SetEnumerateShortLabel"
(TeX-arg-eval completing-read "Key: "
'(("A") ("a") ("I") ("i") ("1")))
"Replacement")))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("newlist" "{{{")
("renewlist" "{{{")
("setlist" "*[{")
("AddEnumerateCounter" "*{{{")
("SetLabelAlign" "{{")
("SetEnumitemKey" "{{" )
("SetEnumitemValue" "{{{"))
'function)
(font-latex-add-keywords '(("restartlist" "{" )
("setlistdepth" "{" )
("SetEnumerateShortLabel" "{{"))
'variable)))
LaTeX-dialect)
(defvar LaTeX-enumitem-package-options
'("inline" "ignoredisplayed" "shortlabels" "loadonly")
"Package options for the enumitem package.")
;;; enumitem.el ends here

View File

@@ -0,0 +1,135 @@
;;; environ.el --- AUCTeX style for `environ.sty' version v0.3
;; Copyright (C) 2015, 2016 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2015-07-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 `environ.sty' version v0.3 from
;; 2014/05/04. `environ.sty' is part of TeXLive.
;; Name of new env's defined with `\NewEnviron' are automatically
;; added to list of known env's, e.g.:
;;
;; \NewEnviron{test}{<macro code>}
;;
;; `test' will be in completion list upon `C-c C-e'.
;; More sophisticated definions must go through AUCTeX's parser, e.g.:
;;
;; \NewEnviron{test}[2][]{<macro code>}
;;
;; After a definition like this, you have to invoke `C-c C-n' to get
;; the correct completion.
;;; Code:
(defvar LaTeX-auto-environ-NewEnviron nil
"Temporary for parsing the arguments of `\\NewEnviron'
from `environ' package.")
(defvar LaTeX-environ-NewEnviron-regexp
`(,(concat "\\\\\\(?:Ren\\|N\\)ewEnviron"
"[ \t\n\r]*{\\([A-Za-z0-9]+\\)}%?"
"[ \t\n\r]*\\[?\\([0-9]?\\)\\]?%?"
"[ \t\n\r]*\\(\\[\\)?")
(1 2 3) LaTeX-auto-environ-NewEnviron)
"Matches the argument of `\\NewEnviron' and `\\RenewEnviron'
from `environ.sty'.")
(defun LaTeX-environ-auto-prepare ()
"Clear temporary variable from `environ.sty' before parsing."
(setq LaTeX-auto-environ-NewEnviron nil))
(defun LaTeX-environ-auto-cleanup ()
"Process the parsed results of `\\NewEnviron'."
(dolist (env-args LaTeX-auto-environ-NewEnviron)
(let ((env (car env-args))
(args (cadr env-args))
(opt (nth 2 env-args)))
(cond (;; opt. 1st argument and mandatory argument(s)
(and args (not (string-equal args ""))
opt (not (string-equal opt "")))
(add-to-list 'LaTeX-auto-environment
(list env 'LaTeX-env-args (vector "argument")
(1- (string-to-number args)))))
(;; mandatory argument(s) only
(and args (not (string-equal args ""))
(string-equal opt ""))
(add-to-list 'LaTeX-auto-environment
(list env (string-to-number args))))
(t ; No args
(add-to-list 'LaTeX-auto-environment (list env)))))))
(add-hook 'TeX-auto-prepare-hook #'LaTeX-environ-auto-prepare t)
(add-hook 'TeX-auto-cleanup-hook #'LaTeX-environ-auto-cleanup t)
(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
(defun TeX-arg-environ-final-code (_optional)
"Query for the presence of optional `final code' as argument to
`\\NewEnviron' and insert the appropriate brackets."
(let ((fincode (y-or-n-p "With optional final code? ")))
(when fincode
(insert "[]"))))
(TeX-add-style-hook
"environ"
(lambda ()
;; Add it to the parser
(TeX-auto-add-regexp LaTeX-environ-NewEnviron-regexp)
(TeX-add-symbols
;; \NewEnviron{<name>}[<No.args>][<Opt.arg.>]{<Macro code>}[<Final code>]
'("NewEnviron"
(TeX-arg-define-environment "Environment")
[ "Number of arguments" ] [ "argument" ] t TeX-arg-environ-final-code)
'("RenewEnviron"
(TeX-arg-environment "Environment")
[ "Number of arguments" ] [ "argument" ] t TeX-arg-environ-final-code)
;; Insert a pair of braces and we're done
'("environfinalcode" t)
;; Pre-defined
'("BODY")
;; Define another macro instead of \BODY
'("environbodyname" TeX-arg-define-macro))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("NewEnviron" "{[[{[")
("RenewEnviron" "{[[{[")
("environbodyname" "|{\\"))
'function)))
LaTeX-dialect)
(defvar LaTeX-environ-package-options nil
"Package options for the environ package.")
;;; environ.el ends here

View File

@@ -0,0 +1,74 @@
;;; epigraph.el --- AUCTeX style for `epigraph.sty'
;; Copyright (C) 2012 Free Software Foundation, Inc.
;; Author: Mads Jensen <mje@inducks.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2012-02-11
;; 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 `epigraph.sty'.
;;; Code:
(TeX-add-style-hook
"epigraph"
(lambda ()
(TeX-add-symbols
'("epigraph" t t)
'("qitem" t t)
'("epigraphhead" [ "Distance (a number)" ] t)
'("dropchapter" TeX-arg-size)
"epigraphwidth"
"textflush"
"epigraphflush"
"sourceflush"
"epigraphsize"
"epigraphrule"
"beforeepigraphskip"
"afterepigraphskip"
"undodrop"
"cleartoevenpage")
(LaTeX-add-environments
'("epigraphs" LaTeX-env-item))
(add-to-list 'LaTeX-item-list '("epigraphs" . LaTeX-epigraph-qitem))
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("epigraph" "{{")
("qitem" "{{")
("dropchapter" "{")
("epigraphhead" "{")) 'function)
(font-latex-add-keywords '("cleartoevenpage") 'warning)))
LaTeX-dialect)
(defvar LaTeX-epigraph-package-options nil
"Package options for the epigraph package.")
;; adapted from latex.el:`LaTeX-item-bib'
(defun LaTeX-epigraph-qitem ()
"Insert a new qitem for use in the epigraphs environment."
(TeX-insert-macro "qitem"))
;;; epigraph.el ends here

View File

@@ -0,0 +1,38 @@
;;; epsf.el - Support for the epsf style option.
;; Copyright (C) 2013-2014 Free Software Foundation, Inc.
;; Contributed by Marc Gemis <makke@wins.uia.ac.be>
;;; Code:
(TeX-add-style-hook
"epsf"
(lambda ()
(TeX-add-symbols
'("epsfsize" TeX-arg-epsfsize)
'("epsffile" TeX-arg-file)
'("epsfbox" TeX-arg-file)
"epsflly" "epsfury" "testit" "epsfgetlitbb"
"epsfnormal" "epsfgetbb" "other" "epsfsetgraph"
"PsFragSpecialArgs" "epsfaux" "testit" "epsfgrab"
"epsfllx" "epsflly" "epsfury" "epsfverbosetrue"))
LaTeX-dialect)
(defun TeX-arg-epsfsize (_optional &optional _prompt _definition)
"Create a line that print epsf figures at a certain percentage"
(interactive)
(let ((scale (TeX-read-string "Scale in percent (default 75): ")))
(setq scale (if (zerop (length scale)) "75" scale))
(save-excursion
; append #1#{scale#1}
(insert "#1#2" TeX-grop "0." scale "#1" TeX-grcl)
; insert \def before \epsfsize
(beginning-of-line 1)
(newline)
(insert TeX-esc "def")
(forward-line -1)
(insert "% From now on print figures at " scale "% of original size"))
(end-of-line)))
;;; epsf.el ends here

View File

@@ -0,0 +1,91 @@
;;; erewhon.el --- AUCTeX style for `erewhon.sty' (v1.04)
;; Copyright (C) 2014, 2015 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2014-11-18
;; 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 `erewhon.sty' (v1.04) from 2015/04/07.
;; `erewhon.sty' is part of TeXLive.
;;; Code:
(TeX-add-style-hook
"erewhon"
(lambda ()
;; Run style hook for various packages loaded by erewhon
(TeX-run-style-hooks "textcomp" "fontaxes")
;; New symbols
(TeX-add-symbols
;; Only preamble commands
'("useosf" 0)
'("useproportional" 0)
;; Text commands
'("lfstyle" -1) ; lf declaration
'("tlfstyle" -1) ; tlf declaration
'("osfstyle" -1) ; osf declaration
'("tosfstyle" -1) ; tosf declaration
'("sufigures" -1) ; superior figures declaration
'("textlf" t) ; proportional lining figures
'("texttlf" t) ; tabular lining figures
'("textosf" t) ; proportional oldstyle figures
'("texttosf" t) ; tabular oldstyle figures
'("textsu" t) ; superior figures
'("textin" t) ; inferior figures
'("textnu" t) ; numerator figures
'("textde" t) ; denominator figures
'("textfrac" "Numerator" "Denominator"))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("textlf" "{")
("texttlf" "{")
("textosf" "{")
("texttosf" "{")
("textsu" "{")
("textin" "{")
("textnu" "{")
("textde" "{"))
'type-command)
(font-latex-add-keywords '(("lfstyle" "")
("tlfstyle" "")
("osfstyle" "")
("tosfstyle" "")
("sufigures" ""))
'type-declaration)
(font-latex-add-keywords '(("textfrac" "{{"))
'textual)))
LaTeX-dialect)
(defvar LaTeX-erewhon-package-options
'("lining" "lf" "oldstyle" "osf" "tabular" "p" "proportional"
"scale" "scaled" "scosf" "space" "sups")
"Package options for the erewhon package.")
;;; erewhon.el ends here

View File

@@ -0,0 +1,90 @@
;;; eso-pic.el --- AUCTeX style for `eso-pic.sty' (v2.0d)
;; Copyright (C) 2014 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2014-10-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 `eso-pic.sty' (v2.0d) from 2013/10/06.
;; `eso-pic.sty' is part of TeXLive.
;;; Code:
(TeX-add-style-hook
"eso-pic"
(lambda ()
;; Run style hook for eso-pic
(TeX-run-style-hooks "atbegshi")
;; New symbols
(TeX-add-symbols
;; Basic commands
'("AddToShipoutPictureBG" t)
'("AddToShipoutPictureBG*" t)
'("AddToShipoutPictureFG" t)
'("AddToShipoutPictureFG*" t)
'("ClearShipoutPictureBG" 0)
'("ClearShipoutPictureFG" 0)
;; Helper macros
'("AtPageUpperLeft" t)
'("AtPageLowerLeft" t)
'("AtPageCenter" t)
'("AtTextUpperLeft" t)
'("AtTextLowerLeft" t)
'("AtTextCenter" t)
'("AtStockUpperLeft" t)
'("AtStockLowerLeft" t)
'("AtStockCenter" t)
;; Aux. commands
'("LenToUnit" t)
'("gridSetup"
[ "Grid unit name" ] "Grid unit" "Label factor"
"Grid delta" "Grid Delta" "Gap"))
;; Declare expert macro
(TeX-declare-expert-macros
"eso-pic"
"gridSetup" "LenToUnit"))
LaTeX-dialect)
(defvar LaTeX-eso-pic-package-options-list
'(("pscoord" ("true" "false"))
("texcoord" ("true" "false"))
("grid" ("true" "false"))
("gridunit" ("mm" "in" "bp" "pt"))
("gridcolor")
("subgridcolor")
("subgridstyle" ("solid" "dotted"))
("dvips" ("true" "false")))
"Package options for the eso-pic package.")
(defun LaTeX-eso-pic-package-options nil
"Prompt for package options for the eso-pic package."
(TeX-read-key-val t LaTeX-eso-pic-package-options-list))
;;; eso-pic.el ends here

View File

@@ -0,0 +1,45 @@
;;; everysel.el --- AUCTeX style for `everysel.sty'
;; Copyright (C) 2012, 2015 Free Software Foundation, Inc.
;; Author: Mads Jensen <mje@inducks.org>
;; Created: 2012-12-25
;; 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 `everysel.sty'.
;;; Code:
(TeX-add-style-hook
"everysel"
(lambda ()
(TeX-add-symbols
;; adds a hook (the argument code) to be called after \\selectfont
'("EverySelectfont" 1)
;; adds a hook to be called after the next \\selectfont
'("AtNextSelectfont" 1)))
LaTeX-dialect)
(defvar LaTeX-everysel-package-options nil
"Package options for the everysel package.")
;;; everysel.el ends here

View File

@@ -0,0 +1,378 @@
;;; exam.el --- AUCTeX style for the (LaTeX) exam class
;; Copyright (C) 2016, 2017 Free Software Foundation, Inc.
;; Author: Uwe Brauer <oub@mat.ucm.es>
;; Created: 2016-03-06
;; 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 exam class.
;; Acknowledgements
;; Arash Esbati <arash@gnu.org> for a almost complete rewrite.
;;; Code:
(defvar LaTeX-exam-class-options
'("answers" "noanswers" "cancelspace" "nocancelspace" "addpoints")
"Class options for the exam class.")
(defun LaTeX-exam-insert-item ()
"Insert a new item in an environment from exam class.
Item inserted depends on the environment."
(TeX-insert-macro
(cond ((string= environment "questions")
"question")
((string= environment "parts")
"part")
((string= environment "subparts")
"subpart")
((string= environment "subsubparts")
"subsubpart")
;; Fallback
(t "item"))))
(defun LaTeX-exam-insert-label (_optional &optional name type)
"Indent the line and query/insert a label incl. the \"\\label\" macro.
Arguments NAME and TYPE are the same as for the function
`LaTeX-label'. OPTIONAL is ignored."
(indent-according-to-mode)
(let ((currenv (LaTeX-current-environment)))
(LaTeX-label (or name currenv) (or type 'environment))))
(TeX-add-style-hook
"exam"
(lambda ()
(TeX-run-style-hooks "article")
;; Add options from `LaTeX-article-class-options' only once:
(dolist (opt LaTeX-article-class-options)
(add-to-list 'LaTeX-exam-class-options opt))
;; Make our label prefix available ...
(let ((envs '("questions")))
(dolist (env envs)
;; to AUCTeX
(add-to-list 'LaTeX-label-alist
(cons env 'LaTeX-exam-label))
;; to RefTeX with `reftex-add-label-environments'
(when (fboundp 'reftex-add-label-environments)
(reftex-add-label-environments
`((,env ,LaTeX-exam-reftex-quick-id-key ,LaTeX-exam-label
"~\\ref{%s}" nil
(regexp "[Qq]uestions?" "[Nn]umbers?")))))))
(when (or (member "xcolor" (TeX-style-list))
(member "color" (TeX-style-list)))
(TeX-add-symbols '("shadedsolutions" 0)))
(LaTeX-add-environments
'("solution" [ "Height" ])
'("select")
'("solutionorbox" [ "Height" ])
'("solutionorlines" [ "Height" ])
'("solutionordottedlines" [ "Height" ])
'("solutionorgrid" [ "Height" ])
'("questions" LaTeX-env-item)
'("parts" LaTeX-env-item)
'("subparts" LaTeX-env-item)
'("subsubparts" LaTeX-env-item))
;; Tell AUCTeX about special environments:
(let ((envs '("questions" "parts" "subparts" "subsubparts")))
(dolist (env envs)
(add-to-list 'LaTeX-item-list
(cons env 'LaTeX-exam-insert-item))))
;; Append us only once:
(unless (and (string-match "question" LaTeX-item-regexp)
(string-match "subsub" LaTeX-item-regexp))
(set (make-local-variable 'LaTeX-item-regexp)
(concat
LaTeX-item-regexp
"\\|"
"\\(titled\\)?question\\b"
"\\|"
"\\(sub\\|subsub\\)?part\\b"))
(LaTeX-set-paragraph-start))
(TeX-add-symbols
'("part" [ "Points" ] (TeX-arg-literal " "))
'("subpart" [ "Points" ] (TeX-arg-literal " "))
'("gradetable"
[ TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Orientation")
'("v" "h") ]
[ TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Table index")
'("questions" "pages") ] )
'("bonusgradetable"
[ TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Orientation")
'("v" "h") ]
[ TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Table index")
'("questions" "pages") ] )
'("bonuspointtable"
[ TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Orientation")
'("v" "h") ]
[ TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Table index")
'("questions" "pages") ] )
'("partialgradetable"
[ TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Orientation")
'("v" "h") ]
[ TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Table index")
'("questions" "pages") ] )
'("partialbonusgradetable"
[ TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Orientation")
'("v" "h") ]
[ TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Table index")
'("questions" "pages") ] )
'("partialbonuspointtable"
[ TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Orientation")
'("v" "h") ]
[ TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Table index")
'("questions" "pages") ] )
'("pointtable"
[ TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Orientation")
'("v" "h") ]
[ TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Table index")
'("questions" "pages") ] )
'("partialpointtable"
[ TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Orientation")
'("v" "h") ]
[ TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Table index")
'("questions" "pages") ] )
'("subsubpart" [ "Points" ] (TeX-arg-literal " "))
'("question" ["Points"] (TeX-arg-literal " "))
'("bonusquestion" ["Points"] (TeX-arg-literal " "))
'("extrafootheight" [ TeX-arg-length "Extra height 1. page footer" ]
(TeX-arg-length "Extra height footers"))
'("titledquestion" "Title" ["Points"] LaTeX-exam-insert-label (TeX-arg-literal " "))
'("ContinuedQuestion" 0)
'("CorrectChoice" 0)
'("CorrectChoiceEmphasis" 1)
'("IncompleteQuestion" 0)
'("SolutionEmphasis" 1)
'("addpoints" 0)
'("addquestionobject" 0)
'("answerclearance" 1)
'("answerline" ["Points"] (TeX-arg-literal " "))
'("begingradingrange" 1)
'("bhpgword" 1)
'("bhpword" 1)
'("bhqword" 1)
'("bhsword" 1)
'("bhtword" 1)
'("bonuspart" 0)
'("bonuspointformat" 0)
'("bonuspointname" 1)
'("bonuspointpoints" 2)
'("bonuspointsinrange" 0)
'("bonuspointsofquestion" 1)
'("bonuspointsonpage" 0)
'("bonusqformat" 1)
'("bonussubpart" 0)
'("bonussubsubpart" 0)
'("bonustitledquestion" "Title" ["Points"] LaTeX-exam-insert-label (TeX-arg-literal " "))
'("bonustotalformat" 0)
'("boxedpoints" 0)
'("bracketedpoints" 0)
'("bvpgword" 1)
'("bvpword" 1)
'("bvqword" 1)
'("bvsword" 1)
'("bvtword" 1)
'("cancelspace" 0)
'("cellwidth" 1)
'("cfoot" 1)
'("chbpword" 1)
'("chead" 1)
'("checkboxchar" 1)
'("checkboxeshook" 0)
'("checkedchar" 1)
'("choice" 0)
'("choicelabel" 0)
'("choiceshook" 0)
'("chpgword" 1)
'("chpword" 1)
'("chqword" 1)
'("chsword" 1)
'("chsword" 1)
'("correctchoice" 0)
'("correctchoiceemphasis" 1)
'("covercfoot" 3)
'("coverchead" 3)
'("coverextrafootheight" 3)
'("coverextraheadheight" 3)
'("coverfirstpagefooter" 3)
'("coverfirstpageheader" 3)
'("coverfooter" 3)
'("coverheader" 3)
'("coverlfoot" 3)
'("coverlhead" 3)
'("coverrfoot" 3)
'("coverrhead" 3)
'("coverrunningfooter" 3)
'("coverrunningheader" 3)
'("cvbpword" 1)
'("cvpgword" 1)
'("cvpword" 1)
'("cvqword" 1)
'("cvsword" 1)
'("cvtword" 1)
'("dottedlinefillheight" 1)
'("droppoints" 0)
'("droptotalbonuspoints" 0)
'("droptotalpoints" 0)
'("endgradingrange" 1)
'("extraheadheight" 1)
'("extrawidth" 1)
'("fillwithdottedlines" 1)
'("fillwithlines" 1)
'("firstpagefooter" 1)
'("firstpagefootrule" 0)
'("firstpageheader" 3)
'("firstpageheadrule" 0)
'("footer" 3)
'("footrule" 0)
'("framedsolutions" 0)
'("fullwidth" 1)
'("gradetablestretch" 0)
'("greeknum" 0)
'("half" 0)
'("hpgword" 1)
'("hpword" 1)
'("hqword" 1)
'("hsword" 1)
'("htword" 1)
'("ifcontinuation" 0)
'("ifincomplete" 0)
'("iflastpage" 0)
'("ifprintanswers" 0)
'("lfoot" 1)
'("lhead" 1)
'("linefillheight" 1)
'("linefillthickness" 1)
'("makeemptybox" 1)
'("marginbonuspointname" 1)
'("marginpointname" 1)
'("marginpointsep" 1)
'("marksnotpoints" 0)
'("noaddpoints" 0)
'("nobonusqformat" 1)
'("noboxedpoints" 0)
'("nobracketedpoints" 0)
'("nocancelspace" 0)
'("nomorequestions" 0)
'("nopointsinmargin" 0)
'("nopointsinrightmargin" 0)
'("noprintanswers" 0)
'("noqformat" 1)
'("numbonuspoints" 0)
'("numcoverpages" 0)
'("numpages" 0)
'("numparts" 0)
'("numpoints" 0)
'("numquestions" 0)
'("numsubparts" 0)
'("numsubsubparts" 0)
'("oddeven" 2)
'("partlabel" 0)
'("partopsep" 0)
'("partshook" 0)
'("pointname" 1)
'("pointpoints" 2)
'("pointsdroppedatright" 0)
'("pointsinmargin" 0)
'("pointsinrightmargin" 0)
'("pointsofquestion" 1)
'("pointsonpage" 1)
'("printanswers" 0)
'("printselectedfalse" 0)
'("printselectedtrue" 0)
'("qformat" 1)
'("questionlabel" 0)
'("questionshook" 0)
'("rfoot" 1)
'("rhead" 1)
'("rightpointsmargin" 0)
'("roman" 0)
'("romannumeral" 0)
'("runningfooter" 3)
'("runningfootrule" 0)
'("runningheader" 3)
'("runningheadrule" 0)
'("settabletotalbonuspoints" 1)
'("settabletotalpoints" 1)
'("shadedsolutions" 0)
'("solutiontitle" 0)
'("subpartlabel" 0)
'("subpartshook" 0)
'("subsubpartlabel" 0)
'("subsubpartshook" 0)
'("thechoice" 0)
'("themarginpoints" 0)
'("thepartno" 0)
'("thequestion" 0)
'("thequestiontitle" 0)
'("thesubpart" 0)
'("thesubsubpart" 0)
'("totalbonuspoints" 0)
'("totalformat" 0)
'("totalnumpages" 0)
'("totalpoints" 0)
'("unframedsolutions" 0)
'("uplevel" 1)
'("usehorizontalhalf" 0)
'("useslantedhalf" 0)
'("vpgword" 1)
'("vpword" 1)
'("vqword" 1)
'("vsword" 1)
'("vtword" 1)
'("thepoints" 0)
;; ... more stuff here
)
(LaTeX-add-lengths "answerlinelength" "answerskip")
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("question" "[")
("titledquestion" "{[")
("subpart" "[")
("subsubpart" "["))
'textual)))
LaTeX-dialect)
;;; exam.el ends here

View File

@@ -0,0 +1,63 @@
;;; exercise.el --- AUCTeX style for `exercise.sty'
;; Copyright (C) 2014 Free Software Foundation, Inc.
;; Author: Nicolas Richard <theonewiththeevillook@yahoo.fr>
;; Created: 2014-03-17
;; 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 `exercise.sty'.
;;; Code:
(TeX-add-style-hook
"exercise"
(lambda ()
(LaTeX-add-environments
'("Exercise")
'("Exercise*")
'("Answer")
'("ExerciseList")
)
(TeX-add-symbols
'("Exercise")
'("Exercise*")
'("Answer")
'("ExePart")
'("ExePart*")
'("Question")
'("subQuestion")
'("ExeText")
'("ExerciseSelect")
'("ExerciseStopSelect")
'("refAnswer")
'("marker")
'("DifficultyMarker")
'("listofexercises")
'("ListOfExerciseInToc")
'("ExerciseLevelInToc")))
LaTeX-dialect)
(defvar LaTeX-exercise-package-options '("noexercise" "noanswer" "exerciseonly" "answeronly" "nothing" "answerdelayed" "exercisedelayed" "lastexercise")
"Package options for the exercise package.")
;;; exercise.el ends here

View File

@@ -0,0 +1,58 @@
;;; expl3.el --- AUCTeX style for `expl3.sty'
;; Copyright (C) 2015, 2017 Free Software Foundation, Inc.
;; Author: Tassilo Horn <tsdh@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2015-02-22
;; 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 `expl3.sty'.
;;; Code:
(defvar LaTeX-expl3-syntax-table
(let ((st (copy-syntax-table LaTeX-mode-syntax-table)))
;; Make _ and : symbol chars
(modify-syntax-entry ?\_ "_" st)
(modify-syntax-entry ?\: "_" st)
st))
(TeX-add-style-hook
"expl3"
(lambda ()
(set-syntax-table LaTeX-expl3-syntax-table)
(when (and (fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
;; Tell font-lock about the update.
(font-latex-update-font-lock t)))
LaTeX-dialect)
(defun LaTeX-expl3-package-options ()
"Read the expl3 package options from the user."
(TeX-read-key-val t '(("check-declarations" ("true" "false"))
("log-functions" ("true" "false"))
("driver" ("auto" "latex2e"
"dvips" "dvipdfmx"
"pdfmode" "xdvipdfmx")))))
;;; expl3.el ends here

View File

@@ -0,0 +1,114 @@
;;; fancyhdr.el --- AUCTeX style for `fancyhdr.sty'
;; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
;; Author: Mads Jensen <mje@inducks.org>
;; Maintainer: auctex-devel@gnu.org
;; 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 `fancyhdr.sty', version 3.2
;;; Code:
(TeX-add-style-hook
"fancyhdr"
(lambda ()
(TeX-add-symbols
'("lhead" t)
'("lfoot" t)
'("chead" t)
'("cfoot" t)
'("rhead" t)
'("rfoot" t)
'("nouppercase" t)
'("MakeUppercase" t)
'("fancyhead" [ TeX-arg-fancyhdr-position ] t)
'("fancyfoot" [ TeX-arg-fancyhdr-position ] t)
'("fancyheadoffset"
[ (TeX-arg-fancyhdr-position
"Position" ("LO" "LE" "L" "RE" "RO" "R" "0")) ] t)
'("fancyfootoffset"
[ (TeX-arg-fancyhdr-position
"Position" ("LO" "LE" "L" "RE" "RO" "R" "O")) ] t)
'("fancyhfoffset"
[ (TeX-arg-fancyhdr-position "Position" ("E" "O" "L" "R")) ] t)
'("fancypagestyle" TeX-arg-pagestyle t)
"headrulewidth" "footrulewidth" "plainfootrulewidth"
"plainheadrulewidth" "leftmark" "rightmark"
;; the manual does not mention any subsubsectionmark (!)
"chaptermark" "sectionmark" "subsectionmark" "paragraphmark"
"subparagraphmark" "footrule" "headrule")
;; `fancyhdr.sty' supplies these two pagestyles
(LaTeX-add-pagestyles "fancy" "fancyplain")
;; Fontification
(when (and (fboundp 'font-latex-add-keywords)
(fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("fancyhead" "[{")
("fancyfoot" "[{")
("lhead" "{")
("lfoot" "{")
("chead" "{")
("cfoot" "{")
("rhead" "{")
("rfoot" "{")
("fancyheadoffset" "[{")
("fancyfootoffset" "[{")
("fancypagestyle" "{{")) 'function)
(font-latex-add-keywords '(("headrulewidth" "")
("footrulewidth" "")
("plainheadrulewidth" "")
("plainfootrulewidth" "")) 'variable)
;; Tell font-lock about the update.
(font-latex-update-font-lock)))
LaTeX-dialect)
;; Because there can be many positions, `TeX-completing-read-multiple' is used
;; instead of just `completing-read', and a `collection' argument is provided as
;; the list of positions differs between the macros
(defun TeX-arg-fancyhdr-position (optional &optional prompt collection)
"Prompt for a fancyhdr position with completion.
If OPTIONAL is non-nil, insert the resulting value as an optional
argument, otherwise as a mandatory one. If non-nil, PROMPT is
used as the prompt. If non-nil, COLLECTION is used as the
completion list for the position."
(let* ((positions (if (not collection)
;; Standard positions with no restrictions. Lower-case
;; versions, and reverse versions (e.g., OC) are left
;; out for simplicity.
'("LO" "LE" "L" "CO" "CE" "C" "RE" "RO" "R")
collection))
(arguments
(mapconcat 'identity
(TeX-completing-read-multiple
(TeX-argument-prompt optional prompt "Position")
(mapcar 'list positions)) ",")))
(TeX-argument-insert arguments optional)))
(defvar LaTeX-fancyhdr-package-options nil
"Package options for fancyhdr.")
;;; fancyhdr.el ends here

View File

@@ -0,0 +1,47 @@
;;; fancynum.el --- AUCTeX style for `fancynum.sty'
;; Copyright (C) 2013 Free Software Foundation, Inc.
;; Author: Mads Jensen <mje@inducks.org>
;; Maintainer: auctex-devel@gnu.org
;; 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 `fancynum.sty'
;;; Code:
(TeX-add-style-hook
"fancynum"
(lambda ()
(TeX-add-symbols
'("fnum" t)
'("setfnumdsym" t)
'("setfnummsym" t)
'("setfnumgsym" t)))
LaTeX-dialect)
(defvar LaTeX-fancynum-package-options
'("english" "french" "tight" "loose" "commas" "thinspaces" "plain")
"Package options for fancynum.")
;; fancynum.el ends here

View File

@@ -0,0 +1,128 @@
;;; fancyref.el --- AUCTeX style file with support for fancyref.sty
;; Copyright (C) 1999, 2014, 2015 Free Software Foundation, Inc.
;; Author: Carsten Dominik <dominik@strw.leidenuniv.nl>
;; Maintainer: auctex-devel@gnu.org
;; 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.
;;; Code:
(TeX-add-style-hook "fancyref"
(lambda ()
(TeX-add-symbols
;; The macros with label arguments
'("fref" [ TeX-arg-fancyref-format ] TeX-arg-ref)
'("Fref" [ TeX-arg-fancyref-format ] TeX-arg-ref)
;; The macros which define new prefixes and formats
'("fancyrefchangeprefix" TeX-arg-macro "Prefix")
'("Frefformat" TeX-arg-fancyref-format TeX-arg-macro "Output")
'("frefformat" TeX-arg-fancyref-format TeX-arg-macro "Output")
;; The delimiter
"fancyrefargdelim"
;; All those names and abbreviations.
;; Part
"fancyrefpartlabelprefix"
"Frefpartname" "frefpartname"
;; Chapter
"fancyrefchalabelprefix"
"Frefchaname" "frefchaname"
;; Section
"fancyrefseclabelprefix"
"Frefsecname" "frefsecname"
;; Equation
"fancyrefeqlabelprefix"
"Frefeqname" "frefeqname"
;; Figure
"fancyreffiglabelprefix"
"Freffigname" "freffigname" "Freffigshortname"
;; Footnote
"fancyreffnlabelprefix"
"Freffnname" "freffnname"
;; Item
"fancyrefitemlabelprefix"
"Frefitemname" "frefitemname"
;; Table
"fancyreftablabelprefix"
"Freftabname" "freftabname" "Freftabshortname"
;; Page
"Frefpgname" "frefpgname" "Frefpgshortname"
;; On
"Frefonname" "frefonname"
;; See
"Frefseename" "frefseename"
;; The spacing macros
"fancyrefloosespacing" "fancyreftightspacing" "fancyrefdefaultspacing"
;; And the hook
"fancyrefhook")
;; Insatall completion for labels and formats
(setq TeX-complete-list
(append
'(("\\\\[fF]ref\\(\\[[^]]*\\]\\)?{\\([^{}\n\r\\%,]*\\)"
2 LaTeX-label-list "}")
("\\\\[fF]ref\\[\\([^{}\n\r\\%,]*\\)"
1 LaTeX-fancyref-formats "]")
("\\\\[fF]refformat{\\([^{}\n\r\\%,]*\\)"
1 LaTeX-fancyref-formats "}"))
TeX-complete-list))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("fref" "[{") ("Fref" "[{")) 'reference))
;; Activate RefTeX reference style.
(and LaTeX-reftex-ref-style-auto-activate
(fboundp 'reftex-ref-style-activate)
(reftex-ref-style-activate "Fancyref")))
LaTeX-dialect)
;; The following list keeps a list of available format names
;; Note that this list is only updated when a format is used, not
;; during buffer parsing. We could install a regexp to look for
;; formats, but this would not work in multifile documents since the
;; formats are not written out to the auto files.
;; For now, we just leave it at that.
(defvar LaTeX-fancyref-formats '(("plain") ("vario") ("margin") ("main"))
"List of formats for fancyref.")
(defun LaTeX-fancyref-formats () LaTeX-fancyref-formats)
(defun TeX-arg-fancyref-format (optional &optional prompt _definition)
"Prompt for a fancyref format name.
If the user gives an unknown name, add it to the list."
(let ((format (completing-read (TeX-argument-prompt optional prompt "Format")
LaTeX-fancyref-formats)))
(if (not (string-equal "" format))
(add-to-list 'LaTeX-fancyref-formats (list format)))
(TeX-argument-insert format optional)))
(defvar LaTeX-fancyref-package-options '("english" "german" "loose"
"margin" "paren" "plain" "tight"
"vario")
"Package options for the fancyref package.")
;;; fancyref.el ends here

View File

@@ -0,0 +1,538 @@
;;; fancyvrb.el --- AUCTeX style for `fancyvrb.sty' version 2.8.
;; Copyright (C) 2013, 2014, 2016, 2017 Free Software Foundation, Inc.
;; Maintainer: auctex-devel@gnu.org
;; Author: Mosè Giordano <mose@gnu.org>
;; 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 `fancyvrb.sty' version 2.8.
;; This style has some capabilities to parse user defined macros,
;; environments and saved blocks with `SaveVerbatim' environments and
;; offer them for completion. After defining a new macro or
;; environment, hit `C-c C-n' to parse the document. In case of
;; `SaveVerbatim', a second `C-c C-n' might be necessary.
;; The command `\CustomVerbatimEnvironment' is not mentioned in the
;; documenation; hence this command is removed from this style. Use
;; `\DefineVerbatimEnvironment' for new environments and customize the
;; standard ones with `\RecustomVerbatimEnvironment'.
;; The entries in `LaTeX-fancyvrb-key-val-options' cover also some
;; keys which are not mentioned in the manual of the package.
;;; Code:
;; Needed for auto-parsing.
(require 'tex)
(defvar LaTeX-fancyvrb-key-val-options
'(("commentchar" ("none"))
("gobble")
("formatcom")
;; Undocumented key
("formatcom*")
("fontfamily" ("tt" "courier" "helvetica"))
("fontsize" ("auto" "\\tiny" "\\scriptsize"
"\\footnotesize" "\\small" "\\normalsize"
"\\large" "\\Large" "\\LARGE" "\\huge" "\\Huge"))
("fontshape" ("auto" "n" "it" "sl" "sc" "scit"))
("fontseries" ("auto" "m" "b" "bx" "sb" "c" "l" "lc"))
("frame" ("none" "leftline" "topline" "bottomline" "lines" "single"))
("framerule")
("framesep")
("rulecolor" ("none"))
("fillcolor" ("none"))
("label" ("none"))
("labelposition" ("none" "topline" "bottomline" "all"))
("numbers" ("none" "left" "right"))
("numbersep")
("firstnumber" ("auto" "last" "integer"))
("stepnumber")
("numberblanklines" ("true" "false"))
("firstline")
("lastline")
("showspaces" ("true" "false"))
("showtabs" ("true" "false"))
("obeytabs" ("true" "false"))
("tabsize")
("baselinestretch" ("auto" "dimension"))
("commandchars" ("none"))
("xleftmargin")
("xrightmargin")
("resetmargins" ("true" "false"))
("hfuzz")
("samepage" ("true" "false"))
("codes")
;; Undocumented key
("codes*")
("defineactive")
;; Undocumented key
("defineactive*")
;; Actually, the following options are used only by the `BVerbatim'
;; environment.
("boxwidth" ("auto" "dimension"))
("baseline" ("b" "c" "t"))
;; The next key applies only to `\SaveVerb' macro.
("aftersave"))
"Key=value options for fancyvrb macros and environments.")
(defvar LaTeX-fancyvrb-key-val-options-local nil
"Buffer-local key=value options for fancyvrb macros and environments.
This variable is intended for packages like \"fvextra\" which
provide new key=values for fancyvrb environments. New key=values
should be appended to this variable.")
(make-variable-buffer-local 'LaTeX-fancyvrb-key-val-options-local)
(defvar LaTeX-fancyvrb-base-macros
'("VerbatimInput" "BVerbatimInput" "LVerbatimInput"
"SaveVerb" "UseVerb" "Verb")
"List of base macros available with fancyvrb package.
Starred versions are not included in this list.")
(defvar LaTeX-fancyvrb-base-environments
'("Verbatim" "BVerbatim" "LVerbatim" "SaveVerbatim" "VerbatimOut")
"List of base environments available with fancyvrb package.
Starred versions are not included in this list.")
(defvar LaTeX-fancyvrb-key-val-skip-regexp
(concat
"\\(?:\\[[^][]*"
"\\(?:{[^}{]*"
"\\(?:{[^}{]*"
"\\(?:{[^}{]*}[^}{]*\\)*"
"}[^}{]*\\)*"
"}[^][]*\\)*"
"\\]\\)?")
"Helper regexp to skip over an optional argument.")
;; Setup for defining new Verbatim commands:
(TeX-auto-add-type "fancyvrb-macro" "LaTeX")
(defvar LaTeX-fancyvrb-macro-regexp
`(,(concat "\\\\\\(Rec\\|C\\)ustomVerbatimCommand"
"[ \t\n\r]*{?[ \t\n\r]*\\\\\\([A-Za-z]+\\)[ \t\n\r]*}?"
"[ \t\n\r]*{[ \t\n\r]*\\([A-Za-z]+\\)[ \t\n\r]*}")
(2 3 1) LaTeX-auto-fancyvrb-macro)
"Matches macros by fancyvrb package.")
;; Setup for defining new Verbatim environments:
(TeX-auto-add-type "fancyvrb-environment" "LaTeX")
(defvar LaTeX-fancyvrb-environment-regexp
`(,(concat "\\\\DefineVerbatimEnvironment"
"[ \t\n\r]*{[ \t\n\r]*\\([A-Za-z0-9]+\\)[ \t\n\r]*}"
"[ \t\n\r]*{[ \t\n\r]*\\([A-Za-z]+\\)[ \t\n\r]*}")
(1 2) LaTeX-auto-fancyvrb-environment)
"Matches new environments defined by fancyvrb package.")
;; Setup for names in SaveVerb macros:
(TeX-auto-add-type "fancyvrb-saveverb" "LaTeX")
(defvar LaTeX-fancyvrb-saveverb-regexp
`(,(concat "\\\\SaveVerb"
LaTeX-fancyvrb-key-val-skip-regexp
"{\\([^}]+\\)}")
1 LaTeX-auto-fancyvrb-saveverb)
"Match the name under which verbatim text is saved by SaveVerb macro.")
;; Setup for names in SaveVerbatim environments:
(TeX-auto-add-type "fancyvrb-saveverbatim" "LaTeX")
(defvar LaTeX-fancyvrb-saveverbatim-regexp
`(,(concat "\\\\begin{SaveVerbatim}"
LaTeX-fancyvrb-key-val-skip-regexp
"{\\([^}]+\\)}")
1 LaTeX-auto-fancyvrb-saveverbatim)
"Match the name under which verbatim text is saved by SaveVerbatim environment.")
(defun LaTeX-fancyvrb-auto-prepare ()
"Clear various LaTeX-auto-fancyvrb-* variables before parsing."
(setq LaTeX-auto-fancyvrb-macro nil
LaTeX-auto-fancyvrb-environment nil
LaTeX-auto-fancyvrb-saveverb nil
LaTeX-auto-fancyvrb-saveverbatim nil))
(defun LaTeX-fancyvrb-auto-cleanup ()
"Process parsed elements for fancyvrb package."
(LaTeX-fancyvrb-arg-define-macro nil t)
(LaTeX-fancyvrb-arg-define-environment nil t))
(add-hook 'TeX-auto-prepare-hook #'LaTeX-fancyvrb-auto-prepare t)
(add-hook 'TeX-auto-cleanup-hook #'LaTeX-fancyvrb-auto-cleanup t)
(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
(defun LaTeX-fancyvrb-arg-define-macro (optional &optional cleanup recustom)
"Query and insert a new verbatim macro with fancyvrb package.
If OPTIONAL is non-nil, insert the arguments in brackets. If
CLEANUP is non-nil, do not insert any arguments in the buffer and
update only various AUCTeX variables for verbatim macros. If
RECUSTOM is non-nil, delete macros from the variable
`TeX-symbol-list' before adding the new ones."
(let ((new-mac (unless cleanup
(if recustom
(completing-read
(TeX-argument-prompt optional nil "Verbatim macro: \\" t)
(mapcar #'car (apply #'append LaTeX-fancyvrb-macro-list)))
(TeX-read-string
(TeX-argument-prompt optional nil "New verbatim macro: \\" t)))))
(base-mac (unless cleanup
(completing-read (TeX-argument-prompt optional nil "Based on macro")
LaTeX-fancyvrb-base-macros)))
(rec-flag (if recustom "Rec" "C")))
;; We are (re-)defining a macro: Insert user queried input and use
;; `LaTeX-add-fancyvrb-macros' on the input
(unless cleanup
(TeX-argument-insert new-mac optional TeX-esc)
(TeX-argument-insert base-mac optional)
(TeX-argument-insert
(TeX-read-key-val optional LaTeX-fancyvrb-key-val-options-local) optional)
(LaTeX-add-fancyvrb-macros `(,new-mac ,base-mac ,rec-flag))))
;;
;; Now run the procdure: Do not use the function
;; `LaTeX-fancyvrb-macro-list' here which will remove dupes from the
;; variable `LaTeX-fancyvrb-macro-list' depending on car; we need
;; the variable as is, hence (apply #'append ...);
(dolist (elt (apply #'append LaTeX-fancyvrb-macro-list))
(let ((mac-name (nth 0 elt))
(base-mac (nth 1 elt))
(flag (nth 2 elt)))
;; If we're Rec-ustomizing, delete the entry first from
;; `TeX-symbol-list':
(when (string= flag "Rec")
(setq TeX-symbol-list
(assq-delete-all (car (assoc mac-name (TeX-symbol-list))) TeX-symbol-list)))
;; Now add the new item: Start with new macros for loading
;; files:
(cond ((member base-mac '("VerbatimInput" "BVerbatimInput" "LVerbatimInput"))
(TeX-add-symbols
`(,mac-name
[ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local ]
LaTeX-fancyvrb-arg-file-relative))
(when (and (fboundp 'font-latex-add-keywords)
(fboundp 'font-latex-update-font-lock))
(font-latex-add-keywords `((,mac-name "[{"))
'reference)))
;; New macros for saving verbatim text:
((string= base-mac "SaveVerb")
(TeX-add-symbols
`(,mac-name
[ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local ]
(TeX-arg-eval
(lambda ()
(let ((name (TeX-read-string
(TeX-argument-prompt optional nil "Save name"))))
(LaTeX-add-fancyvrb-saveverbs name)
(format "%s" name))))
TeX-arg-verb))
(when (and (fboundp 'font-latex-add-keywords)
(fboundp 'font-latex-update-font-lock))
(font-latex-add-keywords `((,mac-name "[{"))
'textual)))
;; New macros for using previously saved text:
((string= base-mac "UseVerb")
(TeX-add-symbols
`(,mac-name
(TeX-arg-eval
completing-read
(TeX-argument-prompt optional nil "Saved name")
(LaTeX-fancyvrb-saveverb-list))))
(when (and (fboundp 'font-latex-add-keywords)
(fboundp 'font-latex-update-font-lock))
(font-latex-add-keywords `((,mac-name "{"))
'textual)))
;; Anything else is considered as verbatim typesetting macro:
(t
(TeX-add-symbols
`(mac-name
[ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local ]
TeX-arg-verb))
(add-to-list 'LaTeX-verbatim-macros-with-delims-local mac-name t)
(when (and (fboundp 'font-latex-add-keywords)
(fboundp 'font-latex-update-font-lock))
(font-latex-add-keywords `((,mac-name "["))
'textual))))))
;; Update font-lock:
(when (and (fboundp 'font-latex-add-keywords)
(fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-update-font-lock t)))
(defun LaTeX-fancyvrb-arg-define-environment (optional &optional cleanup)
"Query and insert a new verbatim environment with fancyvrb package.
If OPTIONAL is non-nil, insert the arguments in brackets. If
CLEANUP is non-nil, do not insert any arguments in the buffer and
update only various AUCTeX variables for verbatim environments."
(let ((new-env (unless cleanup
(TeX-read-string
(TeX-argument-prompt optional nil "New verbatim environment"))))
(base-env (unless cleanup
(completing-read (TeX-argument-prompt optional nil "Based on environment")
LaTeX-fancyvrb-base-environments))))
;; We are defining a new env: First insert the arguments and the
;; run `LaTeX-add-fancyvrb-environments' on '(new-env base-env).
;; If base-env is SaveVerbatim, run
;; `LaTeX-add-fancyvrb-saveverbatims' on new-env as well.
(unless cleanup
(TeX-argument-insert (car new-env) optional)
(TeX-argument-insert base-env optional)
(TeX-argument-insert
(TeX-read-key-val optional LaTeX-fancyvrb-key-val-options-local) optional)
(LaTeX-add-fancyvrb-environments `(,new-env ,base-env))
(when (string= base-env "SaveVerbatim")
(LaTeX-add-fancyvrb-saveverbatims new-env)))
;;
;; Now run the procdure:
(dolist (elt (LaTeX-fancyvrb-environment-list))
(let ((env (car elt))
(type (cadr elt)))
(cond ((string= type "VerbatimOut")
(LaTeX-add-environments
`(,env (lambda (env)
(let ((options (TeX-read-key-val t LaTeX-fancyvrb-key-val-options-local))
(file (TeX-read-string "Output file: ")))
(LaTeX-insert-environment
env
(concat
(unless (zerop (length options))
(concat LaTeX-optop options LaTeX-optcl))
(concat TeX-grop file TeX-grcl))))))))
((string= type "SaveVerbatim")
(TeX-auto-add-regexp `(,(concat "\\\\begin{"
env
"}"
LaTeX-fancyvrb-key-val-skip-regexp
"{\\([^}]+\\)}")
1 LaTeX-auto-fancyvrb-saveverbatim)))
(t
;; Regular verbatim environments have a starred
;; version; so add them here; the non-starred additions
;; to `LaTeX-verbatim-environments-local' and
;; `LaTeX-indent-environment-list' are done outside
;; (cond ...):
(LaTeX-add-environments
`(,env LaTeX-env-args
[ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local ]))
(LaTeX-add-environments
`(,(concat env "*") LaTeX-env-args
[ TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local ]))
(add-to-list 'LaTeX-verbatim-environments-local (concat env "*"))
(add-to-list 'LaTeX-indent-environment-list
`(,(concat env "*") current-indentation) t)))
;; These apply for all environments defined:
(add-to-list 'LaTeX-verbatim-environments-local env)
(add-to-list 'LaTeX-indent-environment-list `(,env current-indentation) t)))
;; Update font-lock:
(when (and (fboundp 'font-latex-add-keywords)
(fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-update-font-lock t))))
(defun LaTeX-fancyvrb-arg-file-relative (optional)
"Query and insert a file name relative to current master file.
If OPTIONAL is non-nil, insert the file name in brackets."
(TeX-argument-insert
(file-relative-name
(read-file-name (TeX-argument-prompt optional nil "File"))
(TeX-master-directory))
optional))
(TeX-add-style-hook
"fancyvrb"
(lambda ()
(TeX-auto-add-regexp LaTeX-fancyvrb-macro-regexp)
(TeX-auto-add-regexp LaTeX-fancyvrb-environment-regexp)
(TeX-auto-add-regexp LaTeX-fancyvrb-saveverb-regexp)
(TeX-auto-add-regexp LaTeX-fancyvrb-saveverbatim-regexp)
(TeX-run-style-hooks
"keyval")
;; Activate the buffer-local version of key-vals.
(setq LaTeX-fancyvrb-key-val-options-local
(copy-alist LaTeX-fancyvrb-key-val-options))
(TeX-add-symbols
;; Verbatim material in footnotes
"VerbatimFootnotes"
;; Improved verbatim commands
'("Verb" [TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local] TeX-arg-verb)
'("DefineShortVerb" (TeX-arg-eval
TeX-read-string
(TeX-argument-prompt optional nil "Character")
TeX-esc))
'("UndefineShortVerb" (TeX-arg-eval
TeX-read-string
(TeX-argument-prompt optional nil "Character")
TeX-esc))
;; Verbatim environments
'("fvset" (TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local))
;; Changing individual line formatting
"FancyVerbFormatLine"
;; Line numbering
"theFancyVerbLine"
;; Selection of lines to print
"FancyVerbStartString"
"FancyVerbStopString"
;; Personalized environments
'("DefineVerbatimEnvironment"
LaTeX-fancyvrb-arg-define-environment)
'("RecustomVerbatimEnvironment"
(TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Verbatim environment")
LaTeX-fancyvrb-base-environments)
(TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Based on environment")
LaTeX-fancyvrb-base-environments)
(TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local))
'("CustomVerbatimCommand"
LaTeX-fancyvrb-arg-define-macro)
'("RecustomVerbatimCommand"
(LaTeX-fancyvrb-arg-define-macro nil t))
;; Saving and restoring verbatim text and environments
'("SaveVerb"
[TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local]
(TeX-arg-eval
(lambda ()
(let ((name (TeX-read-string
(TeX-argument-prompt optional nil "Save name"))))
(LaTeX-add-fancyvrb-saveverbs name)
(format "%s" name))))
TeX-arg-verb)
'("UseVerb" (TeX-arg-eval
completing-read
(TeX-argument-prompt optional nil "Saved name")
(LaTeX-fancyvrb-saveverb-list)))
'("UseVerbatim" (TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Saved name")
(LaTeX-fancyvrb-saveverbatim-list)))
'("LUseVerbatim" (TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Saved name")
(LaTeX-fancyvrb-saveverbatim-list)))
'("BUseVerbatim" (TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Saved name")
(LaTeX-fancyvrb-saveverbatim-list)))
;; Writing and reading verbatim files
'("VerbatimInput" [TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local]
LaTeX-fancyvrb-arg-file-relative)
'("BVerbatimInput" [TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local]
LaTeX-fancyvrb-arg-file-relative)
'("LVerbatimInput" [TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local]
LaTeX-fancyvrb-arg-file-relative))
(LaTeX-add-environments
'("Verbatim" LaTeX-env-args
[TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local])
'("Verbatim*" LaTeX-env-args
[TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local])
'("BVerbatim" LaTeX-env-args
[TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local])
'("BVerbatim*" LaTeX-env-args
[TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local])
'("LVerbatim" LaTeX-env-args
[TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local])
'("LVerbatim*" LaTeX-env-args
[TeX-arg-key-val LaTeX-fancyvrb-key-val-options-local])
'("SaveVerbatim"
(lambda (env)
(let ((options (TeX-read-key-val t LaTeX-fancyvrb-key-val-options-local))
(name (TeX-read-string "Save name: ")))
(LaTeX-insert-environment
env
(concat
(unless (zerop (length options))
(concat LaTeX-optop options LaTeX-optcl))
(concat TeX-grop name TeX-grcl)))
(LaTeX-add-fancyvrb-saveverbatims name))))
'("VerbatimOut"
(lambda (env)
(let ((options (TeX-read-key-val t LaTeX-fancyvrb-key-val-options-local))
(file (TeX-read-string "Output file: ")))
(LaTeX-insert-environment
env
(concat (unless (zerop (length options))
(concat LaTeX-optop options LaTeX-optcl))
(concat TeX-grop file TeX-grcl)))))))
(LaTeX-add-counters
"FancyVerbLine")
;; Filling
(add-to-list 'LaTeX-verbatim-environments-local "Verbatim")
(add-to-list 'LaTeX-verbatim-environments-local "Verbatim*")
(add-to-list 'LaTeX-verbatim-environments-local "BVerbatim")
(add-to-list 'LaTeX-verbatim-environments-local "BVerbatim*")
(add-to-list 'LaTeX-verbatim-environments-local "LVerbatim")
(add-to-list 'LaTeX-verbatim-environments-local "LVerbatim*")
(add-to-list 'LaTeX-verbatim-environments-local "SaveVerbatim")
(add-to-list 'LaTeX-verbatim-environments-local "VerbatimOut")
(make-local-variable 'LaTeX-indent-environment-list)
(add-to-list 'LaTeX-indent-environment-list '("Verbatim" current-indentation) t)
(add-to-list 'LaTeX-indent-environment-list '("Verbatim*" current-indentation) t)
(add-to-list 'LaTeX-indent-environment-list '("BVerbatim" current-indentation) t)
(add-to-list 'LaTeX-indent-environment-list '("BVerbatim*" current-indentation) t)
(add-to-list 'LaTeX-indent-environment-list '("LVerbatim" current-indentation) t)
(add-to-list 'LaTeX-indent-environment-list '("LVerbatim*" current-indentation) t)
(add-to-list 'LaTeX-indent-environment-list '("SaveVerbatim" current-indentation) t)
(add-to-list 'LaTeX-indent-environment-list '("VerbatimOut" current-indentation) t)
(add-to-list 'LaTeX-verbatim-macros-with-delims-local "Verb")
;; Fontification
(when (and (fboundp 'font-latex-add-keywords)
(fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("CustomVerbatimCommand" "{{{")
("RecustomVerbatimCommand" "{{{")
("DefineVerbatimEnvironment" "{{{")
("RecustomVerbatimEnvironment" "{{{")
("DefineShortVerb" "{")
("UndefineShortVerb" "{")
("fvset" "{"))
'function)
(font-latex-add-keywords '(("VerbatimInput" "[{")
("BVerbatimInput" "[{")
("LVerbatimInput" "[{"))
'reference)
(font-latex-add-keywords '(("Verb" "[") ; The second argument should
; actually be verbatim.
("SaveVerb" "[{")
("UseVerb" "{")
("UseVerbatim" "{")
("LUseVerbatim" "{")
("BUseVerbatim" "{"))
'textual)
;; Tell font-lock about the update.
(font-latex-update-font-lock t)))
LaTeX-dialect)
(defvar LaTeX-fancyvrb-package-options nil
"Package options for the fancyvrb package.")
;;; fancyvrb.el ends here

View File

@@ -0,0 +1,81 @@
;;; fbb.el --- AUCTeX style for `fbb.sty' (v1.07)
;; Copyright (C) 2014, 2015 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2014-11-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 `fbb.sty' (v1.07) from 2015/04/06.
;; `fbb.sty' is part of TeXLive.
;;; Code:
(TeX-add-style-hook
"fbb"
(lambda ()
;; Run style hook for various packages loaded by fbb
(TeX-run-style-hooks "textcomp" "fontaxes")
;; New symbols
(TeX-add-symbols
;; Only preamble command
'("useosf" 0)
;; Text commands
'("lfstyle" -1) ; lf declaration
'("tlfstyle" -1) ; tlf declaration
'("osfstyle" -1) ; osf declaration
'("tosfstyle" -1) ; tosf declaration
'("sufigures" -1) ; superior figures declaration
'("textlf" t) ; proportional lining figures
'("texttlf" t) ; tabular lining figures
'("textosf" t) ; proportional oldstyle figures
'("texttosf" t) ; tabular oldstyle figures
'("textsu" t)) ; superior figures
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("textlf" "{")
("texttlf" "{")
("textosf" "{")
("texttosf" "{")
("textsu" "{"))
'type-command)
(font-latex-add-keywords '(("lfstyle" "")
("tlfstyle" "")
("osfstyle" "")
("tosfstyle" "")
("sufigures" ""))
'type-declaration)))
LaTeX-dialect)
(defvar LaTeX-fbb-package-options
'("lining" "osf" "oldstyle" "tabular" "p" "proportional"
"scale" "scaled" "scosf" "sups")
"Package options for the fbb package.")
;;; fbb.el ends here

View File

@@ -0,0 +1,61 @@
;;; filecontents.el --- AUCTeX style for `filecontents.sty'
;; Copyright (C) 2013--2016 Free Software Foundation, Inc.
;; Author: Mads Jensen <mje@inducks.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2013-01-01
;; 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 `filecontents.sty'. The package removes the two
;; constraints that `filecontents' from LaTeX2e has, namely that the environment
;; must be before the documentclass (or \begin{document} according to some
;; sources), and that existing files are not overwritten.
;;; Code:
(TeX-add-style-hook
"filecontents"
(lambda ()
(LaTeX-add-environments
'("filecontents" LaTeX-env-filecontents)
'("filecontents*" LaTeX-env-filecontents))
(make-local-variable 'LaTeX-indent-environment-list)
(add-to-list 'LaTeX-indent-environment-list
'("filecontents" current-indentation) t)
(add-to-list 'LaTeX-indent-environment-list
'("filecontents*" current-indentation) t))
LaTeX-dialect)
(defun LaTeX-env-filecontents (environment)
"Insert ENVIRONMENT with filename for contents."
(LaTeX-insert-environment environment
(concat TeX-grop
(TeX-read-string "File: ")
TeX-grcl))
(delete-horizontal-space))
(defvar LaTeX-filecontents-package-options nil
"Package options for filecontents.")
;; filecontents.el ends here

View File

@@ -0,0 +1,61 @@
;;; flashcards.el --- AUCTeX style for the flashcards class.
;; Copyright (C) 2007 Free Software Foundation, Inc.
;; Author: Ralf Angeli <angeli@caeruleus.net>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2007-04-23
;; 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 flashcards class.
;;; Code:
(TeX-add-style-hook
"flashcards"
(lambda ()
(TeX-add-symbols
'("cardfrontstyle" ["Format"] "Style")
'("cardfrontfoot" "Footer text")
'("cardbackstyle" ["Format"] "Style")
'("cardfrontheadstyle" ["Format"] "Style")
'("cardfrontfootstyle" ["Format"] "Style")
"cardmargin"
"cardpaper"
"cardpapermode"
"cardrows"
"cardcolumns"
"cardheight"
"cardwidth")
(LaTeX-add-environments '("flashcard" ["Header"] "Front side"))
;; Fontification
(when (and (fboundp 'font-latex-add-keywords)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("cardfrontstyle" "[{")
("cardfrontfoot" "{")
("cardbackstyle" "[{")
("cardfrontheadstyle" "[{")
("cardfrontfootstyle" "[{"))
'variable)))
LaTeX-dialect)
;;; flashcards.el ends here

View File

@@ -0,0 +1,726 @@
;;; floatrow.el --- AUCTeX style for `floatrow.sty' (v0.3b)
;; Copyright (C) 2017 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2016-11-11
;; 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 `floatrow.sty' (v0.3b) from 2009/08/02.
;; `floatrow.sty' is part of TeXLive.
;;
;; `floatrow.sty' is a powerful package and the documentation long.
;; It is expected that this style is not feature complete. One
;; deliberate decision is that this style does not offer any package
;; options: Please use the command `\floatsetup' to set the options
;; you want.
;;
;; This style also alters the way AUCTeX inserts the environments
;; "table" and "figure" (cf. function `LaTeX-floatrow-env-init'). If
;; you want the original behavior, try `C-c C-e rawfigure' or `C-c C-e
;; rawtable' which include the environments incl. the macro \RawFloats
;; at the beginning of the environment (cf. function
;; `LaTeX-floatrow-env-figure-raw').
;;
;; Another deliberate decision is the implementation of commands like
;; `\ffigbox' and `\ttabbox': When invoked with `C-c C-m ffigbox RET',
;; the final result will look like this with cursor being at *:
;;
;; \ffigbox{*}{%
;; \caption{query for a caption}%
;; \label{prefix:is-chosen-acc-to-current-environment}%
;; }
;;
;; This gives users the freedom to insert any command where point is.
;; The mandatory arguments are not part of the fontification as
;; commands like `\includegraphics' or `tabular' environments have their
;; own fontification.
;;; Code:
;; Needed for compiling `pushnew':
(eval-when-compile (require 'cl))
;; Needed for auto-parsing.
(require 'tex)
(defvar LaTeX-floatrow-key-val-options
'(;; 3.1.1 Float Style
("style" ("plain" "plaintop" "Plaintop"
"ruled" "Ruled"
"boxed" "Boxed" "BOXED"
"shadowbox" "Shadowbox" "SHADOWBOX"
"doublebox" "Doublebox" "DOUBLEBOX"
"wshadowbox" "Wshadowbox" "WSHADOWBOX"))
;; 3.1.2 Font Settings
("font" ("scriptsize" "footnotesize" "small" "normalsize" "large"
"Large" "normalfont" "up" "it" "sl" "sc" "md" "bf"
"rm" "sf" "tt"))
("footfont" ("scriptsize" "footnotesize" "small" "normalsize" "large"
"Large" "normalfont" "up" "it" "sl" "sc" "md" "bf"
"rm" "sf" "tt"))
;; 3.1.3 Position of Caption
("capposition" ("top" "TOP" "bottom" "beside"))
;; 3.1.4 Position of Beside Caption
("capbesideposition" ("left" "right" "inside" "outside"
"top" "bottom" "center"))
;; 3.1.5 Defining The Width of Beside Caption
("capbesidewidth" ("none" "sidefil"))
;; 3.1.6 Defining Width of Object
("floatwidth" ("\\hsize" "\\textwidth" "\\columnwidth" "\\linewidth"))
;; 3.1.7 Other Settings for Beside Captions
("capbesideframe" ("yes" "no"))
;; 3.1.8 Defining Float Foot Position (Legends and Footnotes)
("footposition" ("default" "caption" "bottom"))
;; 3.1.9 Vertical Alignment of Float Elements
("heightadjust" ("all" "caption" "object" "none" "nocaption" "noobject"))
("valign" ("t" "c" "b" "s"))
;; 3.1.10 Facing Layout
("facing" ("yes" "no"))
;; 3.1.11 Object Settings
("objectset" ("justified" "centering" "raggedright" "RaggedRight" "raggedleft"))
;; 3.1.12 Defining Float Margins
("margins" ("centering" "raggedright" "raggedleft"
"hangright" "hanginside" "hangoutside"))
;; 3.1.13 Defining Float Separators
("floatrowsep" ("columnsep" "quad" "qquad" "hfil" "hfill" "none"))
("capbesidesep" ("columnsep" "quad" "qquad" "hfil" "hfill" "none"))
;; 3.1.14 Defining Float Rules/Skips
("precode" ("none" "thickrule" "rule" "lowrule" "captionskip"))
("rowprecode" ("none" "thickrule" "rule" "lowrule" "captionskip"))
("midcode" ("none" "thickrule" "rule" "lowrule" "captionskip"))
("postcode" ("none" "thickrule" "rule" "lowrule" "captionskip"))
("rowpostcode" ("none" "thickrule" "rule" "lowrule" "captionskip"))
;; 3.1.15 Defining Float Frames
("framestyle" ("fbox" "colorbox" "FRcolorbox" "corners"
"doublebox" "shadowbox" "wshadowbox"))
("frameset")
("framearound" ("none" "object" "all" "row" "none"))
("framefit" ("yes" "no"))
("rowfill" ("yes" "no"))
;; 3.1.16 Settings for Colored Frames
("colorframeset")
("colorframecorners")
;; 3.1.17 Defining Float Skips
("captionskip")
("footskip")
;; 3.1.18 Defining Float Footnote Rule's Style
("footnoterule" ("normal" "limited" "fullsize" "none"))
;; 3.1.19 Managing Floats with [H] Placement Option
("doublefloataswide" ("yes" "no"))
("floatHaslist" ("yes" "no"))
;; 7.2.1 Additions in The floatrow Package to longtable package
("LTcapwidth" ("table" "contents")))
"Key=value options for floatrow macros and environments.")
(defvar LaTeX-floatrow-key-val-options-local nil
"Buffer-local key=value options for floatrow macros and environments.")
(make-variable-buffer-local 'LaTeX-floatrow-key-val-options-local)
(defvar LaTeX-floatrow-supported-float-types
'("figure" "table" ; Standard LaTeX
"widefigure" "widetable" "widefloat" ; Standard figure* & table*
"wrapfigure" "wraptable" "wrapfloat" ; wrapfig.sty
"rotfigure" "rottable" "rotfloat" ; rotating.sty
"widerotfigure" "widerottable" "widerotfloat" ; for 2-col & wide
"figurerow" "tablerow" "floatrow" ; inside floatrow env's
"capbesidefigure" "capbesidetable" ; floats with beside captions
"capbesidefloat"
"longtable" ; longtable.sty
"subfigure" "subtable" "sub") ; subcaption.sty
"List of float types supported by floatrow.sty.")
;; Setup for \newfloatcommand
(TeX-auto-add-type "floatrow-newfloatcommand" "LaTeX")
(defvar LaTeX-floatrow-newfloatcommand-regexp
'("\\\\newfloatcommand{\\([^}]+\\)}" 1 LaTeX-auto-floatrow-newfloatcommand)
"Matches the arguments of \"\\newfloatcommand\" from floatrow.sty.")
;; Setup for various \Declare* macros:
(TeX-auto-add-type "floatrow-DeclareNewOption" "LaTeX")
(defvar LaTeX-floatrow-DeclareNewOption-regexp
`(,(concat
"\\\\Declare"
"\\("
(mapconcat #'identity
'("FloatStyle" ; 3.6.1 Float Style Option (style=)
"FloatFont" ; 3.6.2 Float Font Option (font=)
"FloatVCode" ; 3.6.3 Option for Float Rules/Skips (precode= etc.)
"ColorBox" ; 3.6.4 Settings for Colored Frame (colorframeset=)
"CBoxCorners" ; colorframecorners=
"ObjectSet" ; 3.6.5 Object Justification Option (objectset=)
"MarginSet" ; 3.6.6 Option for Float Box Alignment/Settings (margins=)
"FloatSeparators" ; 3.6.7 Float Separators Options (floatrowsep=, capbesidesep=)
"FloatFootnoterule") ; 3.6.8 Option for Footnote Rule's Style (footnoterule=)
"\\|")
"\\)"
"{\\([^}]+\\)}")
(0 1 2) LaTeX-auto-floatrow-DeclareNewOption)
"Matches the arguments of \"\\Declare*\" from floatrow.sty.")
;; Setup for \newseparated(label|ref):
(TeX-auto-add-type "floatrow-newseparatedlabel-ref" "LaTeX")
(defvar LaTeX-floatrow-newseparatedlabel-ref-regexp
`(,(concat
"\\\\newseparated"
"\\(label\\|ref\\)"
"{?"
"\\\\"
"\\([a-zA-Z]+\\)"
"}?")
(2 1) LaTeX-auto-floatrow-newseparatedlabel-ref)
"Matches the arguments \"\\newseparated(label|ref)\" command from floatrow.sty.")
;; Setup for \DeclareNewFloatType:
(TeX-auto-add-type "floatrow-DeclareNewFloatType" "LaTeX")
(defvar LaTeX-floatrow-DeclareNewFloatType-regexp
'("\\\\DeclareNewFloatType{\\([^}]+\\)}"
1 LaTeX-auto-floatrow-DeclareNewFloatType)
"Matches the argument of \"\\DeclareNewFloatType\" command from floatrow.sty.")
;; Plug them into the machinery.
(defun LaTeX-floatrow-auto-prepare ()
"Clear various \"LaTeX-floatrow\" variables before parsing."
(setq LaTeX-auto-floatrow-newfloatcommand nil
LaTeX-auto-floatrow-DeclareNewOption nil
LaTeX-auto-floatrow-newseparatedlabel-ref nil
LaTeX-auto-floatrow-DeclareNewFloatType nil))
(defun LaTeX-floatrow-auto-cleanup ()
"Process parsed results from floatrow package."
;; Replace initially the way fig & tab env's are inserted:
(LaTeX-floatrow-env-init)
;;
;; Process new key=val options:
(when (LaTeX-floatrow-DeclareNewOption-list)
(LaTeX-floatrow-update-key-val-options))
;;
;; Process new float commands like \ffigbox:
(when (LaTeX-floatrow-newfloatcommand-list)
(dolist (cmd (mapcar #'car (LaTeX-floatrow-newfloatcommand-list)))
(TeX-add-symbols `(,cmd LaTeX-floatrow-arg-floatbox))
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords `((,cmd "[[["))
'textual))))
;;
;; Process new label/ref commands:
(when (LaTeX-floatrow-newseparatedlabel-ref-list)
(let (floatrow-run-reftex-compile-vars)
(dolist (elt (LaTeX-floatrow-newseparatedlabel-ref-list))
(let ((cmd (car elt))
(type (cadr elt)))
(if (string= type "ref")
;; More fun w/ referencing macros:
(TeX-add-symbols `(,cmd TeX-arg-ref))
;; Less fun w/ label defining macros. Add cmd to
;; TeX-symbol-list:
(TeX-add-symbols `(,cmd TeX-arg-define-label))
;; For AUCTeX, parse the argument of the new macro and add
;; it to `LaTeX-auto-label':
(TeX-auto-add-regexp
`(,(concat "\\\\" cmd "{\\([^\n\r%\\{}]+\\)}") 1 LaTeX-auto-label))
;; For RefTeX, append cmd to `reftex-label-regexps and set
;; floatrow-run-reftex-compile-vars to t:
(when (and (boundp 'reftex-label-regexps)
(fboundp 'reftex-compile-variables)
(not (string-match
cmd
(mapconcat #'identity reftex-label-regexps "|"))))
(add-to-list (make-local-variable 'reftex-label-regexps)
(concat "\\\\" cmd "{\\(?1:[^}]*\\)}") t)
(setq floatrow-run-reftex-compile-vars t)))
;; Fontify macros as reference:
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords `((,cmd "{"))
'reference))))
;; Run `reftex-compile-variables' if needed only once:
(when floatrow-run-reftex-compile-vars
(reftex-compile-variables))))
;;
;; Process new floattypes:
(when (LaTeX-floatrow-DeclareNewFloatType-list)
(LaTeX-floatrow-arg-declare-new-floattype nil t))
;;
;; Add elements from `LaTeX-floatrow-supported-float-types' to
;; `LaTeX-caption-supported-float-types':
(when (boundp 'LaTeX-caption-supported-float-types)
(make-local-variable 'LaTeX-caption-supported-float-types)
(dolist (float LaTeX-floatrow-supported-float-types)
(add-to-list 'LaTeX-caption-supported-float-types float t))) )
(add-hook 'TeX-auto-prepare-hook #'LaTeX-floatrow-auto-prepare t)
(add-hook 'TeX-auto-cleanup-hook #'LaTeX-floatrow-auto-cleanup t)
(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
(defun LaTeX-floatrow-update-key-val-options ()
"Update buffer-local key-val options before offering for completion."
(let ((vcode-keys '("precode" "rowprecode" "midcode" "postcode" "rowpostcode"))
(sep-keys '("floatrowsep" "capbesidesep")))
(dolist (keyvals (LaTeX-floatrow-DeclareNewOption-list))
(let* ((key (cond ((string= (nth 1 keyvals) "FloatStyle")
"style")
((string= (nth 1 keyvals) "FloatFont")
"font")
((string= (nth 1 keyvals) "FloatVCode")
"precode")
((string= (nth 1 keyvals) "ColorBox")
"colorframeset")
((string= (nth 1 keyvals) "CBoxCorners")
"colorframecorners")
((string= (nth 1 keyvals) "ObjectSet")
"objectset")
((string= (nth 1 keyvals) "MarginSet")
"margins")
((string= (nth 1 keyvals) "FloatSeparators")
"floatrowsep")
((string= (nth 1 keyvals) "FloatFootnoterule")
"footnoterule")
(t nil)))
(val (nth 2 keyvals))
(val-match (cadr (assoc key LaTeX-floatrow-key-val-options-local)))
(temp (copy-alist LaTeX-floatrow-key-val-options-local))
(opts (cond ((string= key "precode")
(dolist (x vcode-keys)
(setq temp (assq-delete-all (car (assoc x temp)) temp)))
temp)
((string= key "floatrowsep")
(setq temp (dolist (x sep-keys)
(assq-delete-all (car (assoc x temp)) temp)))
temp)
(t
(assq-delete-all (car (assoc key temp)) temp)))))
(cond ((string= key "precode")
(dolist (x vcode-keys)
(pushnew (list x (delete-dups (append (list val) val-match)))
opts :test #'equal)))
((string= key "floatrowsep")
(dolist (x sep-keys)
(pushnew (list x (delete-dups (append (list val) val-match)))
opts :test #'equal)))
(t
(pushnew (list key (delete-dups (append (list val) val-match)))
opts :test #'equal)))
(setq LaTeX-floatrow-key-val-options-local (copy-alist opts))))))
(defun LaTeX-floatrow-arg-floatbox (optional)
"Query and insert arguments of float box commands from floatrow.sty.
If OPTIONAL is non-nil, indicate optional argument during query."
;; Query for the optional arguments; ask for "vertpos" only if
;; "height" is given. let-bind `TeX-arg-*-brace' for
;; `TeX-argument-insert':
(let* ((TeX-arg-opening-brace "[")
(TeX-arg-closing-brace "]")
(width (completing-read
(TeX-argument-prompt t nil "Width")
(mapcar (lambda (x) (concat TeX-esc (car x)))
(LaTeX-length-list))))
(height (completing-read
(TeX-argument-prompt t nil "Height")
(mapcar (lambda (x) (concat TeX-esc (car x)))
(LaTeX-length-list))))
(vertpos (if (string= height "")
""
(completing-read
(TeX-argument-prompt t nil "Vertical alignment")
'("t" "c" "b" "s")))))
(TeX-argument-insert width t)
;; Insert an extra pair of brackets if only `height' is given,
;; otherwise it will become `width'
(when (and (string= width "")
height (not (string= height "")))
(insert "[]"))
(TeX-argument-insert height t)
(TeX-argument-insert vertpos t))
;; Now query for the (short-)caption. Also check for the
;; float-type; if we're inside (sub)?floatrow*?, then check for the
;; next outer environment:
(let* ((currenv (if (string-match "floatrow\\*?\\_>" (LaTeX-current-environment))
(LaTeX-current-environment 2)
(LaTeX-current-environment)))
(caption (TeX-read-string
(TeX-argument-prompt optional nil "Caption")))
(short-caption
(when (>= (length caption) LaTeX-short-caption-prompt-length)
(TeX-read-string
(TeX-argument-prompt t nil "Short caption")))))
(indent-according-to-mode)
;; The final result will look like this with * being point:
;; \ffigbox{*}{%
;; \caption{text}%
;; \label{fig:foo}%
;; }
(insert TeX-grop)
(save-excursion
;; We are inside the 1. mandatory arg: Save the pos & insert `}{':
(insert TeX-grcl TeX-grop)
(if (and caption (not (string= caption "")))
(progn
;; If caption, move to EOL, delete any spaces and hide the line end
(end-of-line)
(delete-horizontal-space)
(insert "%")
;; Add a newline and the caption
(newline-and-indent)
(insert (LaTeX-compose-caption-macro caption short-caption))
;; If we have a caption, then we probably also want a
;; label. Hide EOL end and proceed to enter a label
(insert "%")
(newline-and-indent)
(when (LaTeX-label currenv 'environment)
;; Move point to end of line and hide EOL
(end-of-line)
(delete-horizontal-space)
(insert "%")
(newline-and-indent))
;; Now close the group
(insert TeX-grcl)
(indent-according-to-mode)
(end-of-line))
;; Otherwise, only insert a }
(insert TeX-grcl)))))
(defun LaTeX-floatrow-env-init ()
"Replace AUCTeX entries in the variable `LaTeX-environment-list'.
After loading the style hook floatrow.el, delete the entries for
figure*? and table*? from variable `LaTeX-environment-list' and
replace them with the ones offered by the style. Original
entries are available under \"rawfigure*?\" and \"rawtable*?\"."
(LaTeX-environment-list)
(dolist (env '("figure" "figure*" "table" "table*"))
(setq LaTeX-environment-list
(assq-delete-all (car (assoc env LaTeX-environment-list))
LaTeX-environment-list))
(LaTeX-add-environments `(,env LaTeX-floatrow-env-figure)
`(,(concat "raw" env) LaTeX-floatrow-env-figure-raw))))
(defun LaTeX-floatrow-env-figure (environment)
"Create floating ENVIRONMENT suitable for floatrow macros."
(let ((float (and LaTeX-float
(TeX-read-string
(TeX-argument-prompt t nil "Float position")
LaTeX-float))))
(LaTeX-insert-environment environment
(unless (zerop (length float))
(concat LaTeX-optop float LaTeX-optcl)))))
(defun LaTeX-floatrow-env-figure-raw (env)
"Create raw floating ENV with floatrow.sty.
Also insert the macro \"\\RawFloats\" when finished with user
queries."
(let ((environment (TeX-replace-regexp-in-string "raw" "" env)))
(LaTeX-env-figure environment)
(save-excursion
;; `LaTeX-find-matching-begin' will not work for us as we don't
;; know how user answers queries from AUCTeX, hence we search
;; back for `environment':
(re-search-backward (concat "\\\\begin{" environment "}") nil t)
(end-of-line)
(LaTeX-newline)
(indent-according-to-mode)
(insert TeX-esc "RawFloats"))))
(defun LaTeX-floatrow-arg-declare-new-options (optional prompt key)
"Query and insert user-defined values to keys provided by floatrow.sty.
If OPTIONAL is non-nil, ask for an optional argument and insert
it in square brackets. PROMPT replaces the standard one. KEY is
a string and corresponds to first parsed element in
`LaTeX-floatrow-DeclareNewOption-regexp'."
(let ((val (TeX-read-string
(TeX-argument-prompt optional prompt "New value option"))))
(LaTeX-add-floatrow-DeclareNewOptions
(list (concat TeX-esc "Declare" key TeX-grop val TeX-grcl)
key val))
(LaTeX-floatrow-update-key-val-options)
(TeX-argument-insert val optional)
(TeX-argument-insert
(TeX-read-key-val optional LaTeX-floatrow-key-val-options-local) optional)))
(defun LaTeX-floatrow-arg-newseparatedlabel/ref (optional type)
"Query and insert user defined label and reference macros from floatrow.sty.
If OPTIONAL is non-nil, insert the argument in brackets. TYPE is
the string \"label\" or \"ref\"."
(let ((cmd (TeX-read-string
(if (string= type "label")
(TeX-argument-prompt optional nil "Label command: \\" t)
(TeX-argument-prompt optional nil "Reference command: \\" t)))))
(LaTeX-add-floatrow-newseparatedlabel-refs (list cmd type))
(if (string= type "label")
(TeX-add-symbols `(,cmd TeX-arg-define-label))
(TeX-add-symbols `(,cmd TeX-arg-ref)))
(TeX-argument-insert cmd optional TeX-esc)))
(defun LaTeX-floatrow-arg-declare-new-floattype (optional &optional cleanup)
"Query and insert the first argument of \"DeclareNewFloatType\" macro from floatrow.sty.
If OPTIONAL is non-nil, insert the argument in brackets. If
CLEANUP in non-nil, skip the query and insert process as we are
inside the function `LaTeX-floatrow-auto-cleanup' and process
only the parsed items."
(let ((type (if cleanup
(mapcar #'car (LaTeX-floatrow-DeclareNewFloatType-list))
(list (TeX-read-string
(TeX-argument-prompt optional nil "Environment type"))))))
;; If not inside `LaTeX-floatrow-auto-cleanup', add user input to
;; list of new floats and insert it
(unless cleanup
(LaTeX-add-floatrow-DeclareNewFloatTypes (car type))
(TeX-argument-insert (car type) optional))
;; Make the next variables buffer local
(make-local-variable 'LaTeX-floatrow-supported-float-types)
(when (boundp 'LaTeX-caption-supported-float-types)
(make-local-variable 'LaTeX-caption-supported-float-types))
;; Process new float type(s): a) add type to list of known
;; environments incl. "raw" version b) add different flavors of
;; type to `LaTeX-floatrow-supported-float-types' c) check if
;; `LaTeX-caption-supported-float-types' is bound and add
;; different flavors of type to it as well
(dolist (elt type)
(LaTeX-add-environments `(,elt LaTeX-floatrow-env-figure)
`(,(concat "raw" elt) LaTeX-floatrow-env-figure-raw))
(add-to-list 'LaTeX-floatrow-supported-float-types elt t)
(add-to-list 'LaTeX-floatrow-supported-float-types (concat "wide" elt) t)
(add-to-list 'LaTeX-floatrow-supported-float-types (concat elt "row") t)
(add-to-list 'LaTeX-floatrow-supported-float-types (concat "capbeside" elt) t)
(when (boundp 'LaTeX-caption-supported-float-types)
(add-to-list 'LaTeX-caption-supported-float-types elt t)
(add-to-list 'LaTeX-caption-supported-float-types (concat "wide" elt) t)
(add-to-list 'LaTeX-caption-supported-float-types (concat elt "row") t)
(add-to-list 'LaTeX-caption-supported-float-types (concat "capbeside" elt) t)))))
(TeX-add-style-hook
"floatrow"
(lambda ()
;; Add floatrow to the parser
(TeX-auto-add-regexp LaTeX-floatrow-DeclareNewOption-regexp)
(TeX-auto-add-regexp LaTeX-floatrow-newfloatcommand-regexp)
(TeX-auto-add-regexp LaTeX-floatrow-newseparatedlabel-ref-regexp)
(TeX-auto-add-regexp LaTeX-floatrow-DeclareNewFloatType-regexp)
;; Activate the buffer-local version of key-vals
(setq LaTeX-floatrow-key-val-options-local
(copy-alist LaTeX-floatrow-key-val-options))
;; Add pre-defined float commands:
(LaTeX-add-floatrow-newfloatcommands
"ffigbox" "fcapside" "ttabbox")
;; Macros
(TeX-add-symbols
;; 2.1 The \floatbox Macro
;; \floatbox[<preamble>]{<captype>}[<width>][<height>][<vert pos>]{<caption>}{<object>}
'("floatbox"
[ TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Preamble")
'("\\capbeside" "\\nocapbeside" "\\captop") ]
(TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Float type")
LaTeX-floatrow-supported-float-types)
LaTeX-floatrow-arg-floatbox)
;; 2.2 Creation of Personal Commands for Float Boxes
'("newfloatcommand"
(TeX-arg-eval
(lambda ()
(let ((cmd (TeX-read-string
(TeX-argument-prompt optional nil "Command"))))
(LaTeX-add-floatrow-newfloatcommands cmd)
(TeX-add-symbols
`(,cmd LaTeX-floatrow-arg-floatbox))
(format "%s" cmd))))
(TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Float type")
'("figure" "table"))
[ 2 ])
'("renewfloatcommand"
(TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Command")
(LaTeX-floatrow-newfloatcommand-list))
(TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Float type")
'("figure" "table"))
[ 2 ])
;; 2.2.2 Predefined Float Box Commands
'("ffigbox"
LaTeX-floatrow-arg-floatbox)
'("ttabbox"
LaTeX-floatrow-arg-floatbox)
'("fcapside"
LaTeX-floatrow-arg-floatbox)
;; 2.3.1 Mixed Row
'("CenterFloatBoxes" 0)
'("TopFloatBoxes" 0)
'("BottomFloatBoxes" 0)
'("PlainFloatBoxes" 0)
'("buildFBBOX" 2)
;; 3 Float Layout Settings
'("floatsetup"
[ TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Float type")
LaTeX-floatrow-supported-float-types ]
(TeX-arg-key-val LaTeX-floatrow-key-val-options-local))
;; 3.2 Settings for Current Float Environment
'("thisfloatsetup"
(TeX-arg-key-val LaTeX-floatrow-key-val-options-local))
;; 3.3 Clearing of Settings for Current Float Type
'("clearfloatsetup"
(TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Float type")
LaTeX-floatrow-supported-float-types))
;; 3.4 Temporary Clearing of All Float Settings
'("killfloatstyle" 0)
;; 3.6.1 Float Style Option (style=)
'("DeclareFloatStyle"
(LaTeX-floatrow-arg-declare-new-options "New style option"
"FloatStyle"))
;; 3.6.2 Float Font Option (font=)
'("DeclareFloatFont"
(LaTeX-floatrow-arg-declare-new-options "New font option"
"FloatFont"))
;; 3.6.3 Option for Float Rules/Skips (precode= etc.)
'("DeclareFloatVCode"
(LaTeX-floatrow-arg-declare-new-options "New rules/skip option"
"FloatVCode"))
;; 3.6.4 Settings for Colored Frame (colorframeset=)
'("DeclareColorBox"
(LaTeX-floatrow-arg-declare-new-options "New colored frame option"
"ColorBox"))
;; (colorframecorners=)
'("DeclareCBoxCorners"
(LaTeX-floatrow-arg-declare-new-options "New colored corner option"
"CBoxCorners"))
;; 3.6.5 Object Justification Option (objectset=)
'("DeclareObjectSet"
(LaTeX-floatrow-arg-declare-new-options "New object justification"
"ObjectSet"))
;; 3.6.6 Option for Float Box Alignment/Settings (margins=)
'("DeclareMarginSet"
(LaTeX-floatrow-arg-declare-new-options "New alignment option"
"MarginSet"))
'("setfloatmargins" 2)
'("setfloatmargins*" 2)
'("floatfacing" 2)
'("floatfacing*" 2)
'("floatboxmargins" 2)
'("floatrowmargins" 2)
'("floatcapbesidemargins" 2)
;; 3.6.7 Float Separators Options (floatrowsep=, capbesidesep=)
'("DeclareFloatSeparators"
(LaTeX-floatrow-arg-declare-new-options "New separator option"
"FloatSeparators"))
;; 3.6.8 Option for Footnote Rule's Style (footnoterule=)
'("DeclareFloatFootnoterule"
(LaTeX-floatrow-arg-declare-new-options "New footnote rule option"
"FloatFootnoterule"))
;; 4 Creation of New Float Types
'("DeclareNewFloatType"
(LaTeX-floatrow-arg-declare-new-floattype)
(TeX-arg-key-val (("placement" ("tbp" "t" "b" "p"))
("name")
("fileext")
("within" ("chapter" "section" "subsection"))
("relatedcapstyle" ("yes" "no")))))
;; 6.2 Support of The Label-Sublabel References
'("newseparatedlabel"
(LaTeX-floatrow-arg-newseparatedlabel/ref "label") 2)
'("newseparatedref"
(LaTeX-floatrow-arg-newseparatedlabel/ref "ref") t)
'("makelabelseparator" t) ) ;; terminate TeX-add-symbols
;; Environments
(LaTeX-add-environments
;; 2.3 Building Float Row
'("floatrow" [ "Number of beside floats" ])
;; 6.1 Managing of Float Parts With the subfloatrow Environment
'("subfloatrow" [ "Number of beside floats" ])
'("subfloatrow*" [ "Number of beside floats" ]))
;; 2.1.1 Float Box Width Equals to The Width of Object Contents
(LaTeX-add-lengths "FBwidth" "FBheight" "Xhsize")
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("floatbox" "[{[[[")
("ffigbox" "[[[")
("ttabbox" "[[[")
("fcapside" "[[["))
'textual)
(font-latex-add-keywords '(("newfloatcommand" "{{[[")
("renewfloatcommand" "{{[[")
("buildFBBOX" "{{")
("floatsetup" "[{")
("thisfloatsetup" "{")
("clearfloatsetup" "{")
("killfloatstyle" "")
("DeclareFloatStyle" "{{")
("DeclareFloatFont" "{{")
("DeclareFloatVCode" "{{")
("DeclareColorBox" "{{")
("DeclareCBoxCorners" "{{")
("DeclareObjectSet" "{{")
("DeclareMarginSet" "{{")
("DeclareFloatSeparators" "{{")
("DeclareFloatFootnoterule" "{{")
("newseparatedlabel" "{{{")
("newseparatedref" "{{")
("makelabelseparator" "{")
("DeclareNewFloatType" "{{")
("RawFloats" ""))
'function)))
LaTeX-dialect)
(defvar LaTeX-floatrow-package-options nil
"Prompt for package options for the floatrow package.")
;;; floatrow.el ends here

View File

@@ -0,0 +1,66 @@
;;; foils.el - Special code for FoilTeX.
;; Copyright (C) 1994-2014 Free Software Foundation, Inc.
;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
;; Maintainer: auctex-devel@gnu.org
;; 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. If not, see <http://www.gnu.org/licenses/>.
;;; Code:
(require 'timezone)
(TeX-add-style-hook "foils"
(function
(lambda ()
(add-hook 'LaTeX-document-style-hook 'LaTeX-style-foils)
(setq LaTeX-default-style "foils")
(setq LaTeX-default-options '("landscape"))
(TeX-add-symbols
'("foilhead" [ "Rubric-body separation" ] "Foil rubric"))))
LaTeX-dialect)
(defun LaTeX-style-foils nil
"Prompt for and insert foiltex options."
(let* ((date (timezone-parse-date (current-time-string)))
(year (string-to-number (aref date 0)))
(month (string-to-number (aref date 1)))
(day (string-to-number (aref date 2)))
(title (TeX-read-string "Title: ")))
(save-excursion
(goto-char (point-max))
(re-search-backward ".begin.document.")
(insert TeX-esc "title"
TeX-grop title TeX-grcl "\n")
(insert TeX-esc "author"
TeX-grop (user-full-name) TeX-grcl "\n")
(insert TeX-esc "date" TeX-grop
(format "%d-%02d-%02d" year month day)
TeX-grcl "\n")
(insert "" TeX-esc "MyLogo" TeX-grop TeX-grcl "\n")
(insert "%" TeX-esc "Restriction" TeX-grop TeX-grcl "\n")
(insert "%" TeX-esc "rightfooter" TeX-grop TeX-grcl "\n")
(insert "%" TeX-esc "leftheader" TeX-grop TeX-grcl "\n")
(insert "%" TeX-esc "rightheader" TeX-grop TeX-grcl "\n\n")
(re-search-forward ".begin.document.")
(end-of-line)
(newline-and-indent)
(insert "" TeX-esc "maketitle\n\n"))
(forward-line -1)))
;;; foils.el ends here

View File

@@ -0,0 +1,114 @@
;;; fontaxes.el --- AUCTeX style for `fontaxes.sty' version v1.0d
;; Copyright (C) 2014 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2014-10-12
;; 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 `fontaxes.sty' version v1.0d from
;; 2014/03/23. `fontaxes.sty' is part of TeXLive.
;; Thanks to Mos<6F> Giordano for his perceptive comments on
;; implementation of "figureversion".
;;; Code:
(TeX-add-style-hook
"fontaxes"
(lambda ()
(TeX-add-symbols
;; Various font shapes
'("swshape" -1) ; swash shape
'("sscshape" -1) ; spaced small caps
'("fontprimaryshape" t)
'("fontsecondaryshape" t)
'("swdefault" t)
'("sscdefault" t)
'("ulcdefault" t)
;; Figure versions
'("figureversion"
(TeX-arg-eval mapconcat 'identity
(TeX-completing-read-multiple
"Style, alignment: "
'(("text") ("osf")
("lining") ("lf")
("tabular") ("tab")
("proportional") ("prop"))) ","))
'("txfigures" -1) ; style: text figures (osf)
'("lnfigures" -1) ; style: lining figures
'("tbfigures" -1) ; alignment: tabular figures
'("prfigures" -1) ; alignment: proportional figures
'("fontfigurestyle"
(TeX-arg-eval completing-read "Style: "
'(("text") ("lining"))))
'("fontfigurealignment"
(TeX-arg-eval completing-read "Alignment: "
'(("tabular") ("proportional"))))
'("fontbasefamily" t)
;; Math versions
'("boldmath" -1) ; math weight
'("unboldmath" -1) ;
'("tabularmath" -1) ; math figure alignment
'("proportionalmath" -1) ;
'("mathweight"
(TeX-arg-eval completing-read "Math weight: "
'(("bold") ("normal"))))
'("mathfigurealignment"
(TeX-arg-eval completing-read "Math figure alignment: "
'(("tabular") ("proportional"))))
;; Additional commands
'("textsw" t)
'("textssc" t)
'("textulc" t)
'("textfigures" t)
'("liningfigures" t)
'("tabularfigures" t)
'("proportionalfigures" t))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("textfigures" "{")
("liningfigures" "{")
("tabularfigures" "{")
("proportionalfigures" "{"))
'type-command)
(font-latex-add-keywords '(("textsw" "{")
("textssc" "{")
("textulc" "{"))
'bold-command)
(font-latex-add-keywords '(("swshape" "")
("sscshape" ""))
'bold-declaration)
(font-latex-add-keywords '(("figureversion" "{"))
'variable)))
LaTeX-dialect)
(defvar LaTeX-fontaxes-package-options nil
"Package options for the fontaxes package.")
;;; fontaxes.el ends here

View File

@@ -0,0 +1,52 @@
;;; fontenc.el --- AUCTeX style for `fontenc.sty' (v1.99g)
;; Copyright (C) 2015 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2015-09-12
;; 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 `fontenc.sty' (v1.99g) from 2005/09/27.
;; `fontenc.sty' is a standard LaTeX package and part of TeXLive.
;;; Code:
(defvar LaTeX-fontenc-package-options-list
'(;; 128+ glyph encodings (text)
"OT1" "OT2" "OT3" "OT4" "OT6"
;; 256 glyph encodings (text)
"T1" "T2A" "T2B" "T2C" "T3" "T4" "T5"
;; 256 glyph encodings (text extended)
"X2"
;; Other encodings
"LY1" "LV1" "LGR")
"Package options for the fontenc package.")
(defun LaTeX-fontenc-package-options ()
"Prompt for package options for the fontenc package."
(mapconcat 'identity
(TeX-completing-read-multiple
"Encoding(s): "
LaTeX-fontenc-package-options-list) ","))
;;; fontenc.el ends here

View File

@@ -0,0 +1,400 @@
;;; fontspec.el --- AUCTeX style for `fontspec.sty' version 2.6a.
;; Copyright (C) 2013, 2017 Free Software Foundation, Inc.
;; Maintainer: auctex-devel@gnu.org
;; Author: Mosè Giordano <mose@gnu.org>
;; 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 `fontspec.sty' version 2.6a. Starting
;; with `fontspec.sty' v2.4, the order of mandatory font names and
;; optional font features in related macros has changed, i.e. optional
;; argument comes after the mandatory one. This change is now (April
;; 2017) implemented in this file. Fontification support retains
;; backward compatibilty.
;;; Code:
(defvar LaTeX-fontspec-font-features
'(;; 5 Font selection
("Extension" (".otf" ".ttf" ".ttc" ".dfont"))
("Path")
;; 6.1 More control over font shape selection
("BoldFont")
("ItalicFont")
("BoldItalicFont")
("SlantedFont")
("BoldSlantedFont")
("SmallCapsFont")
;; 6.2 Specifically choosing the NFSS family
("NFSSFamily")
("FontFace")
;; 11 Different features for different font shapes
("UprightFeatures")
("BoldFeatures")
("ItalicFeatures")
("BoldItalicFeatures")
("SlantedFeatures")
("BoldSlantedFeatures")
("SmallCapsFeatures")
;; 13 Different features for different font sizes
("SizeFeatures")
;; 14 Font independent options
("Color")
("Scale" ("MatchLowercase" "MatchUppercase"))
("WordSpace")
("PunctuationSpace")
("HyphenChar")
("OpticalSize")
("AutoFakeBold")
("AutoFakeSlant")
("FakeSlant")
("FakeStretch")
("FakeBold")
("LetterSpace")
;; 16 OpenType options
("Ligatures" ("Required" "RequiredOff"
"Common" "CommonOff"
"Contextual" "ContextualOff"
"Rare" "RareOff"
"Discretionary" "DiscretionaryOff"
"Historic" "HistoricOff"
"TeX"
"ResetAll"))
("Letters" ("Uppercase" "UppercaseOff"
"SmallCaps" "SmallCapsOff"
"PetiteCaps" "PetiteCapsOff"
"UppercaseSmallCaps" "UppercaseSmallCapsOff"
"UppercasePetiteCaps" "UppercasePetiteCapsOff"
"Unicase" "UnicaseOff"
"ResetAll"))
("Numbers" ("Uppercase" "UppercaseOff"
"Lowercase" "LowercaseOff"
"Lining" "LiningOff"
"OldStyle" "OldStyleOff"
"Proportional" "ProportionalOff"
"Monospaced" "MonospacedOff"
"SlashedZero" "SlashedZeroOff"
"Arabic" "ArabicOff"
"ResetAll"))
("Contextuals" ("Swash" "SwashOff"
"Alternate" "AlternateOff"
"WordInitial" "WordInitialOff"
"WordFinal" "WordFinalOff"
"LineFinal" "LineFinalOff"
"Inner" "InnerOff"
"ResetAll"))
("VerticalPosition" ("Superior" "SuperiorOff"
"Inferior" "InferiorOff"
"Numerator" "NumeratorOff"
"Denominator" "DenominatorOff"
"ScientificInferior" "ScientificInferiorOff"
"Ordinal" "OrdinalOff"
"ResetAll"))
("Fraction" ("On" "Off" "Reset" "Alternate" "AlternateOff" "ResetAll"))
("StylisticSet")
("CharacterVariant")
("Alternate" ("Random"))
("Style" ("Alternate" "AlternateOff"
"Italic" "ItalicOff"
"Ruby" "RubyOff"
"Swash" "SwashOff"
"Cursive" "CursiveOff"
"Historic" "HistoricOff"
"TitlingCaps" "TitlingCapsOff"
"HorizontalKana" "HorizontalKanaOff"
"VerticalKana" "VerticalKanaOff"
"ResetAll"))
("Diacritics" ("MarkToBase" "MarkToBaseOff"
"MarkToMark" "MarkToMarkOff"
"AboveBase" "AboveBaseOff"
"BelowBase" "BelowBaseOff"
"ResetAll"))
("Kerning" ("Uppercase" "UppercaseOff" "On" "Off" "Reset" "ResetAll"))
("CharacterWidth" ("Proportional" "ProportionalOff"
"Full" "FullOff"
"Half" "HalfOff"
"Third" "ThirdOff"
"Quarter" "QuarterOff"
"AlternateProportional" "AlternateProportionalOff"
"AlternateHalf" "AlternateHalfOff"
"ResetAll"))
("Annotation")
("CJKShape" ("Traditional"
"Simplified"
"JIS1978"
"JIS1983"
"JIS1990"
"Expert"
"NLC"))
("Vertical" ("RotatedGlyphs" "RotatedGlyphsOff"
"AlternatesForRotation" "AlternatesForRotationOff"
"Alternates" "AlternatesOff"
"KanaAlternates" "KanaAlternatesOff"
"Kerning" "KerningOff"
"AlternateMetrics" "AlternateMetricsOff"
"HalfMetrics" "HalfMetricsOff"
"ProportionalMetrics" "ProportionalMetricsOff"
"ResetAll"))
;; 25 Going behind fontspec's back: Offer only an excerpt of all
;; possible tags:
("RawFeature" ("frac" "lnum" "onum" "pnum" "smcp" "tnum" "zero")))
"Font features options for macros of the fontspec package.")
(defvar LaTeX-fontspec-font-features-local nil
"Buffer-local font features options for macros of the fontspec package.")
(make-variable-buffer-local 'LaTeX-fontspec-font-features-local)
(defvar LaTeX-fontspec-font-list nil
"List of the fonts accessible to fontspec.")
(defun LaTeX-fontspec-arg-font (optional &optional prompt)
"Prompt for a font name with completion.
If OPTIONAL is non-nil, insert the resulting value as an optional
argument, otherwise as a mandatory one. Use PROMPT as the prompt
string.
Customize `LaTeX-fontspec-arg-font-search' in order to decide how
to retrieve the list of fonts."
(unless LaTeX-fontspec-font-list
(when (if (eq LaTeX-fontspec-arg-font-search 'ask)
(not (y-or-n-p "Find font yourself? "))
LaTeX-fontspec-arg-font-search)
(message "Searching for fonts...")
(with-temp-buffer
(shell-command "luaotfload-tool --list=basename" t)
;; Search for the font base names and full names, and add them to
;; `LaTeX-fontspec-font-list'. The list is in the form
;; <base name><TAB><full name><TAB><version>
(while
(re-search-forward "^\\([^\n\r\t]*\\)\t\\([^\n\r\t]*\\)\t.*$" nil t)
(add-to-list 'LaTeX-fontspec-font-list (match-string-no-properties 1))
(add-to-list 'LaTeX-fontspec-font-list
(match-string-no-properties 2))))))
(TeX-argument-insert
(completing-read
(TeX-argument-prompt optional prompt "Font name")
(or LaTeX-fontspec-font-list LaTeX-fontspec-font-list-default))
optional))
(defun LaTeX-fontspec-update-font-features ()
"Update Color key=values in `LaTeX-fontspec-font-features-local'."
;; Check if any color defininig package is loaded and update the
;; key=values for coloring. Prefer xcolor.sty if both packages are
;; loaded.
(when (or (member "xcolor" (TeX-style-list))
(member "color" (TeX-style-list)))
(let* ((colorcmd (if (member "xcolor" (TeX-style-list))
#'LaTeX-xcolor-definecolor-list
#'LaTeX-color-definecolor-list))
(tmp (copy-alist LaTeX-fontspec-font-features-local)))
(setq tmp (assq-delete-all (car (assoc "Color" tmp)) tmp))
(push (list "Color" (mapcar #'car (funcall colorcmd))) tmp)
(setq LaTeX-fontspec-font-features-local
(copy-alist tmp)))))
;; Setup for \newfontfamily and \newfontface:
(TeX-auto-add-type "fontspec-newfontcmd" "LaTeX")
(defvar LaTeX-fontspec-newfontcmd-regexp
'("\\\\newfontfa\\(?:ce\\|mily\\)[ \t\n\r%]*\\\\\\([a-zA-Z]+\\)"
1 LaTeX-auto-fontspec-newfontcmd)
"Matches new macros defined with \\newfontface and \\newfontfamily.")
(defun LaTeX-fontspec-auto-prepare ()
"Clear `LaTeX-auto-fontspec-newfontcmd' before parsing."
(setq LaTeX-auto-fontspec-newfontcmd nil))
(defun LaTeX-fontspec-auto-cleanup ()
"Process parsed elements for fontspec package."
(dolist (mac (mapcar #'car (LaTeX-fontspec-newfontcmd-list)))
;; Add macro to list of known macros
(TeX-add-symbols mac)
;; Cater for fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords `((,mac ""))
'type-declaration)))
;; Update values of Color key:
(LaTeX-fontspec-update-font-features))
(add-hook 'TeX-auto-prepare-hook #'LaTeX-fontspec-auto-prepare t)
(add-hook 'TeX-auto-cleanup-hook #'LaTeX-fontspec-auto-cleanup t)
(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
(TeX-add-style-hook
"fontspec"
(lambda ()
(TeX-check-engine-add-engines 'luatex 'xetex)
(TeX-run-style-hooks "expl3" "xparse")
;; Add fontspec to the parser.
(TeX-auto-add-regexp LaTeX-fontspec-newfontcmd-regexp)
;; Activate the buffer local version of font features:
(setq LaTeX-fontspec-font-features-local
(copy-alist LaTeX-fontspec-font-features))
(TeX-add-symbols
;; 4.3 Commands for old-style and lining numbers: \oldstylenums is
;; already provided by LaTeX, so just add \liningnums here
'("liningnums" "Numbers")
;; 4.5 Emphasis and nested emphasis
;; \emshape seems to be an internal macro
"emshape"
'("emfontdeclare" t)
"emreset"
;; 4.6 Strong emphasis
'("strong" t)
'("strongfontdeclare" t)
"strongreset"
;; 5 Font selection
'("fontspec"
LaTeX-fontspec-arg-font
[TeX-arg-key-val LaTeX-fontspec-font-features-local "Font features"])
;; Default font families
'("setmainfont"
(LaTeX-fontspec-arg-font "Main font name")
[TeX-arg-key-val LaTeX-fontspec-font-features-local "Font features"])
'("setsansfont"
(LaTeX-fontspec-arg-font "Sans font name")
[TeX-arg-key-val LaTeX-fontspec-font-features-local "Font features"])
'("setmonofont"
(LaTeX-fontspec-arg-font "Mono font name")
[TeX-arg-key-val LaTeX-fontspec-font-features-local "Font features"])
;; 5.3 Querying whether a font exists
'("IfFontExistsTF" LaTeX-fontspec-arg-font 2)
;; 6 commands to select font families
'("newfontfamily" TeX-arg-define-macro
LaTeX-fontspec-arg-font
[TeX-arg-key-val LaTeX-fontspec-font-features-local "Font features"])
'("newfontface" TeX-arg-define-macro
LaTeX-fontspec-arg-font
[TeX-arg-key-val LaTeX-fontspec-font-features-local "Font features"])
;; 6.4 Math(s) fonts
'("setmathrm" "Font name" [ "Font features" ])
'("setmathsf" "Font name" [ "Font features" ])
'("setmathtt" "Font name" [ "Font features" ])
'("setboldmathrm" "Font name" [ "Font features" ])
;; 8 Default settings
'("defaultfontfeatures" [ LaTeX-fontspec-arg-font ]
(TeX-arg-key-val LaTeX-fontspec-font-features-local "Font features"))
'("defaultfontfeatures+" [ LaTeX-fontspec-arg-font ]
(TeX-arg-key-val LaTeX-fontspec-font-features-local "Font features"))
;; 10 Working with the currently selected features
'("IfFontFeatureActiveTF"
[TeX-arg-key-val LaTeX-fontspec-font-features-local "Font feature"] 2)
;; Changing the currently selected features
'("addfontfeatures"
(TeX-arg-key-val LaTeX-fontspec-font-features-local "Font features"))
;; 23 Defining new features
'("newAATfeature"
(TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Existing feature")
LaTeX-fontspec-font-features-local)
"New option" 2)
'("newopentypefeature"
(TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Existing feature")
LaTeX-fontspec-font-features-local)
"New option" t)
'("newfontfeature" "New feature" t)
;; 24 Defining new scripts and languages
'("newfontscript" "Script name" "OpenType tag")
'("newfontlanguage" "Language name" "OpenType tag")
;; 26 Renaming existing features & options
'("aliasfontfeature"
(TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Existing feature")
LaTeX-fontspec-font-features-local)
"New name")
'("aliasfontfeatureoption"
(TeX-arg-eval
(lambda ()
(let* ((key (completing-read
(TeX-argument-prompt optional nil "Feature")
LaTeX-fontspec-font-features-local))
(val (completing-read
(TeX-argument-prompt optional nil "Existing name")
(cadr (assoc key LaTeX-fontspec-font-features-local)))))
(TeX-argument-insert key optional)
(format "%s" val))))
"New name") )
(LaTeX-add-environments
;; 4.6 Strong emphasis
'("strong"))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("fontspec" "[{[")
("setmainfont" "[{[")
("setsansfont" "[{[")
("setmonofont" "[{[")
("newfontfamily" "\\[{[")
("newfontface" "\\[{[")
("setmathrm" "[{[")
("setmathsf" "[{[")
("setmathtt" "[{[")
("setboldmathrm" "[{[")
("defaultfontfeatures" "+[{")
("addfontfeature" "{")
("addfontfeatures" "{")
("newfontscript" "{{")
("newfontlanguage" "{{")
("emfontdeclare" "{")
("strongfontdeclare" "{")
("newAATfeature" "{{{{")
("newopentypefeature" "{{{")
("newfontfeature" "{{")
("aliasfontfeature" "{{")
("aliasfontfeatureoption" "{{{"))
'function)
(font-latex-add-keywords '(("liningnums" "{"))
'type-command)
(font-latex-add-keywords '(("strong" "{"))
'bold-command)))
LaTeX-dialect)
(defvar LaTeX-fontspec-package-options
'("tuenc" "euenc" "math" "no-math" "config" "no-config" "quiet" "silent")
"Package options for the fontspec package.")
;;; fontspec.el ends here

View File

@@ -0,0 +1,73 @@
;;; footmisc.el --- AUCTeX style for `footmisc.sty'
;; Copyright (C) 2011 Free Software Foundation, Inc.
;; Author: Mads Jensen <mje@inducks.org>
;; Created: 2011-04-08
;; 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 `footmisc.sty'.
;;; Code:
(TeX-add-style-hook
"footmisc"
(lambda ()
(TeX-add-symbols
'("DefineFNsymbols" "Name" [ "Style (text or math) " ] 1)
'("DefineFNsymbols*" "Name" [ "Style (text or math)" ] 1)
;; These two commands define both text and math variants of the
;; footnote symbols
'("DefineFNsymbolsTM" "Name" 1)
'("DefineFNsymbolsTM*" "Name" 1)
'("setfnsymbol" "Name")
'("mpfootnoterule" TeX-arg-size)
"pagefootnoterule"
"splitfootnoterule"
;; The following command references a label inside in a footnote
'("footref" TeX-arg-ref)
"hangfootparskip"
"hangfootparindent"
"footnotehint"
'("footnotemargin" TeX-arg-size)
"mpfootnoterule"
"multiplefootnotemarker"
"multfootsep")
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("DefineFNsymbols" "{[{")
("DefineFNsymbols*" "{[{")
("DefineFNsymbolsTM" "{{")
("DefineFNsymbolsTM*" "{{")
("setfnsymbol" "{")) 'function)
(font-latex-add-keywords '(("footnoteref")) 'reference)))
LaTeX-dialect)
(defvar LaTeX-footmisc-package-options '("perpage" "side" "ragged"
"para" "symbol" "symbol*"
"marginal" "flushmargin" "hang"
"norule" "splitrule" "stable"
"multiple")
"Package options for the footmisc package.")
;;; footmisc.el ends here

View File

@@ -0,0 +1,52 @@
;;; framed.el --- AUCTeX style for `framed.sty' (v0.96)
;; Copyright (C) 2016 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2016-06-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 `framed.sty' (v0.96) from 2011/10/22.
;; `framed.sty' is part of TeXLive.
;;; Code:
(TeX-add-style-hook
"framed"
(lambda ()
;; env's defined by framed.sty
(LaTeX-add-environments
'("framed")
'("oframed")
'("shaded")
'("shaded*")
'("snugshade")
'("snugshade*")
'("leftbar")
'("titled-frame" "Title")))
LaTeX-dialect)
(defvar LaTeX-framed-package-options nil
"Package options for the framed package.")
;;; framed.el ends here

View File

@@ -0,0 +1,42 @@
;;; francais.el --- AUCTeX style for the `francais' babel option.
;; Copyright (C) 2005 Free Software Foundation, Inc.
;; Author: Ralf Angeli <angeli@iwi.uni-sb.de>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2005-10-28
;; 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:
;; Set up AUCTeX for editing French text. In particular for commands
;; provided by the `francais' option of the `babel' LaTeX package. As
;; this is equivalent to the `frenchb' option, this file only loads
;; `frenchb.el'.
;;; Code:
(TeX-add-style-hook
"francais"
(lambda ()
(TeX-run-style-hooks "frenchb"))
LaTeX-dialect)
;;; francais.el ends here

View File

@@ -0,0 +1,49 @@
;;; french.el --- AUCTeX style for the `french' babel option.
;; Copyright (C) 2010 Free Software Foundation, Inc.
;; Author: Ralf Angeli <angeli@caeruleus.net>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2010-03-20
;; 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:
;; Set up AUCTeX for editing French text in connection with the
;; `french' babel option. The file basically loads the style file for
;; the `frenchb' babel option.
;;
;; Support for the FrenchPro package by Bernard Gaulle is _not_
;; included. If the presence of FrenchPro is detected, the `frenchb'
;; support is not loaded.
;;; Code:
(TeX-add-style-hook
"french"
(lambda ()
(when (and (member "babel" TeX-active-styles)
(not (member "frenchpro" TeX-active-styles))
(not (member "frenchle" TeX-active-styles))
(not (member "mlp" TeX-active-styles)))
(TeX-run-style-hooks "frenchb")))
LaTeX-dialect)
;;; french.el ends here

View File

@@ -0,0 +1,79 @@
;;; frenchb.el --- AUCTeX style for the `frenchb' babel option.
;; Copyright (C) 2005 Free Software Foundation, Inc.
;; Author: Ralf Angeli <angeli@iwi.uni-sb.de>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2005-10-28
;; 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:
;; Set up AUCTeX for editing French text. In particular for commands
;; provided by the `frenchb' option of the `babel' LaTeX package. The
;; `frenchb' option is equivalent to the `francais' option and since
;; babel version 3.7j with the `french' option. `french', however, is
;; ambiguous because another package by that name made by Bernard
;; Gaulle could be loaded. In order to avoid this, either `frenchb'
;; (or `francais') or `frenchle' (or `frenchPRO') should be used. See
;; the documentation of `frenchb' at
;; <URL:http://daniel.flipo.free.fr/frenchb/frenchb-doc.pdf>.
;;; Code:
(TeX-add-style-hook
"frenchb"
(lambda ()
(TeX-add-symbols
"og"
"fg"
"up"
"ier"
"iere"
"iers"
"ieres"
"ieme"
"iemes"
'("bsc" t)
"primo"
"secundo"
"tertio"
"quarto"
"No"
"no"
"degre"
"degres"
"DecimalMathComma"
"StandardMathComma"
'("nombre" "Nombre")
"ThinSpaceInFrenchNumbers"
"FrenchLayout"
"StandardLayout")
(unless (eq (car TeX-quote-language) 'override)
(setq TeX-quote-language
`("french" "\\og "
(lambda ()
(concat "\\fg"
(unless (member "xspace" TeX-active-styles) "{}")))
,TeX-quote-after-quote)))
(run-hooks 'TeX-language-fr-hook))
LaTeX-dialect)
;;; frenchb.el ends here

View File

@@ -0,0 +1,139 @@
;;; fvextra.el --- AUCTeX style for `fvextra.sty' (v1.2.1)
;; Copyright (C) 2017 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2017-03-05
;; 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 `fvextra.sty' (v1.2.1) from 2016/09/02.
;; `fvextra.sty' is part of TeXLive.
;;; Code:
;; Needed for compiling `pushnew':
(eval-when-compile (require 'cl))
(defvar LaTeX-fvextra-key-val-options
'(;; 3 General options
("curlyquotes" ("true" "false"))
("highlightcolor")
("highlightlines")
("linenos" ("true" "false"))
("mathescape" ("true" "false"))
("numberfirstline" ("true" "false"))
;; ("numbers" ("none" "left" "right" "both"))
("space" ("\\textvisiblespace"))
("spacecolor" ("none"))
("stepnumberfromfirst" ("true" "false"))
("stepnumberoffsetvalues" ("true" "false"))
("tab" ("\\FancyVerbTab"))
("tabcolor" ("none"))
;; 5.1 Line breaking options
("breakafter" ("none"))
("breakaftergroup" ("true" "false"))
("breakaftersymbolpre")
("breakaftersymbolpost")
("breakanywhere" ("true" "false"))
("breakanywheresymbolpre")
("breakanywheresymbolpost")
("breakautoindent" ("true" "false"))
("breakbefore")
("breakbeforegroup" ("true" "false"))
("breakbeforesymbolpre")
("breakbeforesymbolpost")
("breakindent")
("breaklines" ("true" "false"))
("breaksymbol")
("breaksymbolleft")
("breaksymbolright")
("breaksymbolindent")
("breaksymbolindentleft")
("breaksymbolindentright")
("breaksymbolsep")
("breaksymbolsepleft")
("breaksymbolsepright"))
"Key=value options for fvextra macros and environments.")
(defun LaTeX-fvextra-update-key-val ()
"Update `LaTeX-fancyvrb-key-val-options-local' with key=vals from \"fvextra.sty\"."
;; Delete the key "numbers" from `LaTeX-fancyvrb-key-val-options-local':
(setq LaTeX-fancyvrb-key-val-options-local
(assq-delete-all (car (assoc "numbers" LaTeX-fancyvrb-key-val-options-local))
LaTeX-fancyvrb-key-val-options-local))
;; Add the key with "both" value:
(add-to-list 'LaTeX-fancyvrb-key-val-options-local
'("numbers" ("none" "left" "right" "both")))
;; Add color values to resp. keys:
(when (or (member "xcolor" (TeX-style-list))
(member "color" (TeX-style-list)))
(let* ((colorcmd (if (member "xcolor" (TeX-style-list))
#'LaTeX-xcolor-definecolor-list
#'LaTeX-color-definecolor-list))
(keys '("highlightcolor"
"rulecolor"
"fillcolor"
"tabcolor"
"spacecolor"))
(tmp (copy-alist LaTeX-fancyvrb-key-val-options-local)))
(dolist (x keys)
(setq tmp (assq-delete-all (car (assoc x tmp)) tmp))
(if (string= x "highlightcolor")
(pushnew (list x (mapcar #'car (funcall colorcmd))) tmp :test #'equal)
(pushnew (list x (append '("none") (mapcar #'car (funcall colorcmd)))) tmp :test #'equal)))
(setq LaTeX-fancyvrb-key-val-options-local
(copy-alist tmp)))))
(add-hook 'TeX-auto-cleanup-hook #'LaTeX-fvextra-update-key-val t)
(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
(TeX-add-style-hook
"fvextra"
(lambda ()
;; Run the style hook for "fancyvrb"
(TeX-run-style-hooks "fancyvrb")
;; Append `LaTeX-fvextra-key-val' to `LaTeX-fancyvrb-key-val-options-local':
(setq LaTeX-fancyvrb-key-val-options-local
(append LaTeX-fvextra-key-val-options
LaTeX-fancyvrb-key-val-options-local))
(TeX-add-symbols
;; 4.1 Line and text formatting
"FancyVerbFormatText"
;; 5.3.2 Breaks within macro arguments
"FancyVerbBreakStart"
"FancyVerbBreakStop"
;; 5.3.3 Customizing break behavior
"FancyVerbBreakAnywhereBreak"
"FancyVerbBreakBeforeBreak"
"FancyVerbBreakAfterBreak"))
LaTeX-dialect)
(defvar LaTeX-fvextra-package-options nil
"Package options for the fvextra package.")
;;; fvextra.el ends here

View File

@@ -0,0 +1,151 @@
;;; geometry.el --- AUCTeX style for `geometry.sty' (v5.6)
;; Copyright (C) 2015 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2015-02-21
;; 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 `geometry.sty' (v5.6) from 2010/09/12.
;; `geometry.sty' is part of TeXLive.
;;; Code:
(defvar LaTeX-geometry-always-key-val-options
'(("layout") ("layoutwidth") ("layoutheight") ("layoutsize")
("layouthoffset") ("layoutvoffset") ("layoutoffset") ("hscale")
("vscale") ("scale") ("width") ("totalwidth") ("height") ("totalheight")
("total") ("textwidth") ("textheight") ("text") ("body") ("lines")
("includehead") ("includefoot") ("includeheadfoot") ("includemp")
("includeall") ("ignorehead") ("ignorefoot") ("ignoreheadfoot")
("ignoremp") ("ignoreall") ("heightrounded") ("hdivide") ("vdivide")
("divide") ("left") ("lmargin") ("inner") ("right") ("rmargin")
("outer") ("top") ("tmargin") ("bottom") ("bmargin") ("hmargin")
("vmargin") ("margin") ("hmarginratio") ("vmarginratio") ("marginratio")
("ratio") ("hcentering") ("vcentering") ("centering") ("twoside")
("asymmetric") ("bindingoffset") ("hdivide") ("vdivide") ("divide")
("headheight") ("head") ("headsep") ("footskip") ("foot") ("nohead")
("nofoot") ("noheadfoot") ("footnotesep") ("marginparwidth") ("marginpar")
("marginparsep") ("nomarginpar") ("columnsep") ("hoffset") ("voffset")
("offset") ("twocolumn") ("onecolumn") ("twoside") ("textwidth")
("textheight") ("reversemp") ("reversemarginpar"))
"Key=value options always available for geometry macros.")
(defvar LaTeX-geometry-preamble-key-val-options
'(("paper" ("a0paper" "a1paper" "a2paper" "a3paper" "a4paper"
"a5paper" "a6paper" "b0paper" "b1paper" "b2paper"
"b3paper" "b4paper" "b5paper" "b6paper" "c0paper"
"c1paper" "c2paper" "c3paper" "c4paper" "c5paper"
"c6paper" "b0j" "b1j" "b2j" "b3j" "b4j" "b5j" "b6j"
"ansiapaper" "ansibpaper" "ansicpaper" "ansidpaper"
"ansiepaper" "ansiapaper" "ansibpaper" "ansicpaper"
"ansidpaper" "ansiepaper"))
("papername" ("a0paper" "a1paper" "a2paper" "a3paper" "a4paper"
"a5paper" "a6paper" "b0paper" "b1paper" "b2paper"
"b3paper" "b4paper" "b5paper" "b6paper" "c0paper"
"c1paper" "c2paper" "c3paper" "c4paper" "c5paper"
"c6paper" "b0j" "b1j" "b2j" "b3j" "b4j" "b5j" "b6j"
"ansiapaper" "ansibpaper" "ansicpaper" "ansidpaper"
"ansiepaper" "ansiapaper" "ansibpaper" "ansicpaper"
"ansidpaper" "ansiepaper"))
("a0paper") ("a1paper") ("a2paper") ("a3paper") ("a4paper") ("a5paper")
("a6paper") ("b0paper") ("b1paper") ("b2paper") ("b3paper") ("b4paper")
("b5paper") ("b6paper") ("c0paper") ("c1paper") ("c2paper") ("c3paper")
("c4paper") ("c5paper") ("c6paper") ("b0j") ("b1j") ("b2j") ("b3j")
("b4j") ("b5j") ("b6j") ("ansiapaper") ("ansibpaper") ("ansicpaper")
("ansidpaper") ("ansiepaper") ("ansiapaper") ("ansibpaper") ("ansicpaper")
("ansidpaper") ("ansiepaper") ("screen") ("paperwidth") ("paperheight")
("papersize") ("landscape") ("portrait")
("driver" ("dvips" "dvipdfm" "pdftex" "vtex" "xetex" "auto" "none"))
("dvips") ("dvipdfm") ("pdftex") ("xetex") ("vtex") ("verbose")
("reset") ("mag") ("truedimen") ("pass") ("showframe") ("showcrop"))
"Key=value options allowed only in the preamble for geometry macros.")
;; Needed for auto-parsing.
(require 'tex)
;; Setup for \savegeometry:
(TeX-auto-add-type "geometry-savegeometry" "LaTeX" "geometry-savegeometries")
(defvar LaTeX-geometry-savegeometry-regexp
'("\\\\savegeometry{\\([^}]+\\)}"
1 LaTeX-auto-geometry-savegeometry)
"Matches the argument of `\\savegeometry' from `geometry'
package.")
(defun LaTeX-geometry-auto-prepare ()
"Clear `LaTeX-auto-geometry-savegeometry' before parsing."
(setq LaTeX-auto-geometry-savegeometry nil))
(add-hook 'TeX-auto-prepare-hook #'LaTeX-geometry-auto-prepare t)
(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
(TeX-add-style-hook
"geometry"
(lambda ()
;; Add geometry to the parser.
(TeX-auto-add-regexp LaTeX-geometry-savegeometry-regexp)
;; geometry commands:
(TeX-add-symbols
'("geometry"
(TeX-arg-eval TeX-read-key-val nil
(append LaTeX-geometry-preamble-key-val-options
LaTeX-geometry-always-key-val-options)))
'("newgeometry"
(TeX-arg-key-val LaTeX-geometry-always-key-val-options))
'("restoregeometry" 0)
'("savegeometry"
(TeX-arg-eval
(lambda ()
(let ((name (TeX-read-string "Name: ")))
(LaTeX-add-geometry-savegeometries name)
(format "%s" name)))))
'("loadgeometry"
(TeX-arg-eval
(lambda ()
(completing-read "Name: "
(LaTeX-geometry-savegeometry-list))))))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("geometry" "{")
("newgeometry" "{")
("savegeometry" "{")
("loadgeometry" "{"))
'function)))
LaTeX-dialect)
(defun LaTeX-geometry-package-options ()
"Prompt for package options for the geometry package."
(TeX-read-key-val t
(append LaTeX-geometry-preamble-key-val-options
LaTeX-geometry-always-key-val-options)))
;;; geometry.el ends here

View File

@@ -0,0 +1,50 @@
;;; german.el --- Setup AUCTeX for editing German text.
;;; Commentary:
;;
;; Cater for some specialities of `(n)german.sty', e.g. special quote
;; and hyphen strings or that `"' makes the following letter an
;; umlaut.
;;; Code:
(defvar LaTeX-german-mode-syntax-table
(copy-syntax-table LaTeX-mode-syntax-table)
"Syntax table used in LaTeX mode when using `german.sty'.")
(modify-syntax-entry ?\" "w" LaTeX-german-mode-syntax-table)
(TeX-add-style-hook
"german"
(lambda ()
(set-syntax-table LaTeX-german-mode-syntax-table)
;; XXX: Handle former customizations of the now defunct
;; German-specific variables. References to the respective
;; variables are to be deleted in future versions. (now = 2005-04-01)
(unless (eq (car TeX-quote-language) 'override)
(let ((open-quote (if (and (boundp 'LaTeX-german-open-quote)
LaTeX-german-open-quote)
LaTeX-german-open-quote
"\"`"))
(close-quote (if (and (boundp 'LaTeX-german-close-quote)
LaTeX-german-close-quote)
LaTeX-german-close-quote
"\"'"))
(q-after-q (if (and (boundp 'LaTeX-german-quote-after-quote)
LaTeX-german-quote-after-quote)
LaTeX-german-quote-after-quote
t)))
(setq TeX-quote-language
`("german" ,open-quote ,close-quote ,q-after-q))))
(setq LaTeX-babel-hyphen-language "german")
;; Fontification of quotation marks.
(when (and (eq TeX-install-font-lock 'font-latex-setup)
(featurep 'font-latex))
(font-latex-add-quotes '("\"`" "\"'"))
(font-latex-add-quotes '("\">" "\"<" german))
;; Prevent "| from leading to color bleed.
(font-latex-add-to-syntax-alist (list (cons ?\" "\\"))))
(run-hooks 'TeX-language-de-hook))
LaTeX-dialect)
;;; german.el ends here

View File

@@ -0,0 +1,68 @@
;;; gloss-italian.el --- Italian support for polyglossia package.
;; Copyright (C) 2015 Free Software Foundation, Inc.
;; Maintainer: auctex-devel@gnu.org
;; Author: Mosè Giordano <mose@gnu.org>
;; 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 is based on italian.el style file, adapted to polyglossia package.
;;; Code:
(defvar TeX-language-it-hook nil
"Hook run for Italian texts.")
(TeX-add-style-hook
"gloss-italian"
(lambda ()
(TeX-add-symbols
'("textitalian" [TeX-arg-key-val LaTeX-polyglossia-italian-options-list] t))
(LaTeX-add-environments
'("italian"
LaTeX-env-args [TeX-arg-key-val LaTeX-polyglossia-italian-options-list]))
(when (or (LaTeX-polyglossia-lang-option-member "italian" "babelshorthands=true")
(LaTeX-polyglossia-lang-option-member "italian" "babelshorthands"))
(unless (eq (car TeX-quote-language) 'override)
(let ((open-quote (if (and (boundp 'LaTeX-italian-open-quote)
LaTeX-italian-open-quote)
LaTeX-italian-open-quote
"\"<"))
(close-quote (if (and (boundp 'LaTeX-italian-close-quote)
LaTeX-italian-close-quote)
LaTeX-italian-close-quote
"\">")))
(setq TeX-quote-language
`("italian" ,open-quote ,close-quote ,TeX-quote-after-quote))))
;; Fontification of quotation marks.
(when (fboundp 'font-latex-add-quotes)
(font-latex-add-quotes '("\"<" "\">" french))))
(run-hooks 'TeX-language-it-hook))
LaTeX-dialect)
(defvar LaTeX-polyglossia-italian-options-list
'(("babelshorthands" ("true" "false")))
"Italian language options for the polyglossia package.")
;;; gloss-italian.el ends here

View File

@@ -0,0 +1,12 @@
;;; graphics.el --- Handle graphical commands in LaTeX 2e.
;;; Code:
(TeX-add-style-hook "graphics"
(function
(lambda ()
(TeX-run-style-hooks "graphicx")
(setq LaTeX-graphics-package-options LaTeX-graphicx-package-options)))
LaTeX-dialect)
;;; graphics.el ends here.

View File

@@ -0,0 +1,290 @@
;;; graphicx.el --- AUCTeX style file for graphicx.sty
;; Copyright (C) 2000, 2004, 2005, 2014--2017 by Free Software Foundation, Inc.
;; Author: Ryuichi Arafune <arafune@debian.org>
;; Created: 1999/3/20
;; Keywords: tex
;; This file 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.
;; This file 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 GNU Emacs; 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 package supports the includegraphcics macro in graphicx style.
;; Acknowledgements
;; Dr. Thomas Baumann <thomas.baumann@ch.tum.de>
;; David Kastrup <David.Kastrup@t-online.de>
;; Masayuki Akata <ataka@milk.freemail.ne.jp>
;;; Code:
(defvar LaTeX-graphicx-key-val-options
'(("bb")
("bbllx")
("bblly")
("bburx")
("bbury")
("natheight")
("natwidth")
("viewport")
("trim")
("hiresbb" ("true" "false"))
("angle")
("origin")
("width" ("\\textwidth" "\\columnwidth" "\\linewidth"))
("height" ("\\textheight"))
("totalheight" ("\\textheight"))
("keepaspectratio" ("true" "false"))
("scale")
("clip" ("true" "false"))
("draft" ("true" "false"))
("quiet")
("interpolate" ("true" "false")))
"Key=value options for graphicx macros.")
(defvar LaTeX-includegraphics-dvips-extensions
'("eps" "mps" "EPS")
"List of extensions for image files supported by \"dvips\".")
(defvar LaTeX-includegraphics-pdftex-extensions
'("png" "pdf" "jpe?g" "jbig2" "jb2" "mps"
"PNG" "PDF" "JPE?G" "JBIG2" "JB2")
"List of extensions for image files supported by \"pdftex\" and \"luatex\".")
(defvar LaTeX-includegraphics-xetex-extensions
'("pdf" "eps" "mps" "ps" "png" "jpe?g" "jp2" "jpf"
"PDF" "EPS" "MPS" "PS" "PNG" "JPE?G" "JP2" "JPF"
"bmp" "pict" "psd" "mac" "tga" "gif" "tif" "tiff"
"BMP" "PICT" "PSD" "MAC" "TGA" "GIF" "TIF" "TIFF")
"List of extensions for image files supported by \"xetex\".")
(defun LaTeX-arg-graphicx-includegraphics-key-val (optional)
"Insert key-val for optional argument of \\includegraphics macro.
If OPTIONAL is non-nil, insert argument in square brackets.
Temporarily remove \"space\" from `crm-local-completion-map' and
`minibuffer-local-completion-map' in order to be able to insert
spaces conveniently.
If `TeX-engine' is set to symbol 'default (while
`TeX-PDF-from-DVI' is set to nil) or 'luatex and `TeX-PDF-mode'
is non-nil, add the keys \"page\" and \"pagebox\" to list of
key-val's."
(let ((crm-local-completion-map
(remove (assoc 32 crm-local-completion-map)
crm-local-completion-map))
(minibuffer-local-completion-map
(remove (assoc 32 minibuffer-local-completion-map)
minibuffer-local-completion-map)))
(TeX-argument-insert
(TeX-read-key-val optional
(if (and (or (and (eq TeX-engine 'default)
(not (TeX-PDF-from-DVI)))
(eq TeX-engine 'luatex))
TeX-PDF-mode)
(append '(("page")
("pagebox" ("mediabox"
"cropbox"
"bleedbox"
"trimbox"
"artbox")))
LaTeX-graphicx-key-val-options)
LaTeX-graphicx-key-val-options))
optional)))
(defun LaTeX-includegraphics-extensions (&optional list)
"Return appropriate extensions for input files to \\includegraphics."
(let* ((temp (copy-sequence LaTeX-includegraphics-extensions))
(LaTeX-includegraphics-extensions
(cond (;; 'default TeX-engine:
(if (and (eq TeX-engine 'default)
;; we want to produce a pdf
(if TeX-PDF-mode
;; Return t if default compiler produces PDF,
;; nil for "Dvips" or "Dvipdfmx"
(not (TeX-PDF-from-DVI))
;; t if pdftex is used in dvi-mode
TeX-DVI-via-PDFTeX))
;; We're using pdflatex in pdf-mode
(delete-dups
(append LaTeX-includegraphics-pdftex-extensions
LaTeX-includegraphics-extensions))
;; We're generating a .dvi to process with dvips or dvipdfmx
(progn
(dolist (x '("jpe?g" "pdf" "png"))
(setq temp (remove x temp)))
(delete-dups
(append LaTeX-includegraphics-dvips-extensions
temp)))))
;; Running luatex in pdf or dvi-mode:
((eq TeX-engine 'luatex)
(if TeX-PDF-mode
(delete-dups
(append LaTeX-includegraphics-pdftex-extensions
LaTeX-includegraphics-extensions))
(progn
(dolist (x '("jpe?g" "pdf" "png"))
(setq temp (remove x temp)))
(delete-dups
(append LaTeX-includegraphics-dvips-extensions
temp)))))
;; Running xetex in any mode:
((eq TeX-engine 'xetex)
(delete-dups (append LaTeX-includegraphics-xetex-extensions
LaTeX-includegraphics-extensions)))
;; For anything else
(t
LaTeX-includegraphics-extensions))))
(concat "\\."
(mapconcat 'identity
(or list LaTeX-includegraphics-extensions)
"$\\|\\.")
"$")))
(defun LaTeX-includegraphics-read-file-TeX ()
"Read image file for \\includegraphics.
Offers all graphic files found in the TeX search path. See
`LaTeX-includegraphics-read-file' for more."
(completing-read
"Image file: "
(TeX-delete-dups-by-car
(mapcar 'list
(TeX-search-files nil LaTeX-includegraphics-extensions t t)))
nil nil nil))
(defun LaTeX-includegraphics-read-file-relative ()
"Read image file for \\includegraphics.
Lists all graphic files in the master directory and its
subdirectories and inserts the relative file name. This option
doesn't works with Emacs 21.3 or XEmacs. See
`LaTeX-includegraphics-read-file' for more."
(file-relative-name
(read-file-name
"Image file: " nil nil nil nil
;; FIXME: Emacs 21.3 and XEmacs 21.4.15 dont have PREDICATE as the sixth
;; argument (Emacs 21.3: five args; XEmacs 21.4.15: sixth is HISTORY).
(lambda (fname)
(or (file-directory-p fname)
(string-match (LaTeX-includegraphics-extensions) fname))))
(TeX-master-directory)))
(defun LaTeX-arg-includegraphics (_prefix)
"Ask for mandantory argument for the \\includegraphics command."
(let* ((image-file (funcall LaTeX-includegraphics-read-file)))
(TeX-insert-braces 0)
(insert
(if LaTeX-includegraphics-strip-extension-flag
;; We don't have `replace-regexp-in-string' in all (X)Emacs versions:
(with-temp-buffer
(insert image-file)
(goto-char (point-max))
(when (search-backward-regexp (LaTeX-includegraphics-extensions)
nil t 1)
(replace-match ""))
(buffer-string))
image-file))))
(TeX-add-style-hook
"graphicx"
(lambda ()
(TeX-add-symbols
'("reflectbox" "Argument")
'("resizebox"
(TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Width")
(append '("\\width" "!")
(mapcar
(lambda (x) (concat TeX-esc (car x)))
(LaTeX-length-list))))
(TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Height")
(append '("\\height" "\\totalheight" "\\depth" "!")
(mapcar
(lambda (x) (concat TeX-esc (car x)))
(LaTeX-length-list))))
"Argument")
'("resizebox*"
(TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Width")
(append '("\\width" "!")
(mapcar
(lambda (x) (concat TeX-esc (car x)))
(LaTeX-length-list))))
(TeX-arg-eval completing-read
(TeX-argument-prompt optional nil "Height")
(append '("\\height" "\\totalheight" "\\depth" "!")
(mapcar
(lambda (x) (concat TeX-esc (car x)))
(LaTeX-length-list))))
"Argument")
'("rotatebox" (TeX-arg-conditional (member "graphics" (TeX-style-list))
()
([ TeX-arg-key-val (("x") ("y") ("origin") ("units")) ]))
"Angle" "Argument")
'("scalebox" "Horizontal scale" [ "Vertical scale" ] "Argument")
'("includegraphics" (TeX-arg-conditional (member "graphics" (TeX-style-list))
(["llx,lly"] ["urx,ury"])
([ LaTeX-arg-graphicx-includegraphics-key-val ]))
LaTeX-arg-includegraphics)
'("includegraphics*" (TeX-arg-conditional (member "graphics" (TeX-style-list))
(["llx,lly"] ["urx,ury"])
([ LaTeX-arg-graphicx-includegraphics-key-val ]))
LaTeX-arg-includegraphics)
'("graphicspath" t)
'("DeclareGraphicsExtensions" t)
'("DeclareGraphicsRule" 4))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("reflectbox" "{")
("resizebox" "*{{{")
("rotatebox" "[{{")
("scalebox" "{[{"))
'textual)
(font-latex-add-keywords '(("includegraphics" "*[[{"))
'reference)
(font-latex-add-keywords '(("graphicspath" "{")
("DeclareGraphicsExtensions" "{")
("DeclareGraphicsRule" "{{{{"))
'function)))
LaTeX-dialect)
(defvar LaTeX-graphicx-package-options
'("draft" "final" "debugshow"
"hiderotate" "hidescale" "hiresbb"
"setpagesize" "nosetpagesize" "demo"
"dvips" "xdvi"
"dvipdf" "dvipdfm" "dvipdfmx"
"xetex" "pdftex" "luatex"
"dvisvgm" "dvipsone" "dviwindo"
"emtex" "dviwin" "oztex"
"textures" "pctexps" "pctexwin"
"pctexhp" "pctex32" "truetex"
"tcidvi" "vtex")
"Package options for the graphicx package.")
;;; graphicx.el ends here

View File

@@ -0,0 +1,130 @@
;;; harvard.el --- Support for Harvard Citation style package for AUCTeX.
;; Copyright (C) 1994, 1997, 2005, 2012, 2014 Free Software Foundation, Inc.
;; Author: Berwin Turlach <statba@nus.edu.sg>
;; Maintainer: auctex-devel@gnu.org
;; 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.
;;; Code:
(TeX-add-style-hook
"harvard"
#'(lambda ()
(LaTeX-add-environments
'("thebibliography" LaTeX-env-harvardbib ignore))
(TeX-add-symbols
"harvardand"
'("citeasnoun"
(TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil)
TeX-arg-cite)
'("possessivecite"
(TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil)
TeX-arg-cite)
'("citeaffixed"
(TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil)
TeX-arg-cite "Affix")
'("citeyear"
(TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil)
TeX-arg-cite)
'("citename"
(TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) nil)
TeX-arg-cite)
'("citationstyle"
(TeX-arg-eval completing-read "Citation style: " '(("agsm") ("dcu"))))
'("citationmode"
(TeX-arg-eval completing-read "Citation mode: "
'(("full") ("abbr") ("default"))))
'("harvardparenthesis"
(TeX-arg-eval completing-read "Harvardparenthesis: "
'(("round") ("curly") ("angle") ("square"))))
'("bibliographystyle"
(TeX-arg-eval
completing-read "Bibliography style: "
'(("agsm") ("apsr") ("dcu") ("jmr") ("jphysicsB") ("kluwer") ("nederlands") ("econometrica")))
ignore)
'("harvarditem" [ "Short citation" ]
"Complete citation" "Year" TeX-arg-define-cite))
(setq TeX-complete-list
(append '(("\\\\citeasnoun\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)"
1 LaTeX-bibitem-list "}")
("\\\\citeasnoun{\\([^{}\n\r\\%,]*\\)" 1
LaTeX-bibitem-list "}")
("\\\\possessivecite\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)"
1 LaTeX-bibitem-list "}")
("\\\\possessivecite{\\([^{}\n\r\\%,]*\\)" 1
LaTeX-bibitem-list "}")
("\\\\citename\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)"
1 LaTeX-bibitem-list "}")
("\\\\citename{\\([^{}\n\r\\%,]*\\)" 1
LaTeX-bibitem-list "}")
("\\\\citeaffixed\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)"
1 LaTeX-bibitem-list "}")
("\\\\citeaffixed{\\([^{}\n\r\\%,]*\\)" 1
LaTeX-bibitem-list "}")
("\\\\citeaffixed{\\([^{}\n\r\\%]*,\\)\\([^{}\n\r\\%,]*\\)"
2 LaTeX-bibitem-list)
("\\\\citeyear\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)"
1 LaTeX-bibitem-list "}")
("\\\\citeyear{\\([^{}\n\r\\%,]*\\)" 1
LaTeX-bibitem-list "}")
("\\\\citeyear{\\([^{}\n\r\\%]*,\\)\\([^{}\n\r\\%,]*\\)"
2 LaTeX-bibitem-list))
TeX-complete-list))
(setq LaTeX-auto-regexp-list
(append '(("\\\\harvarditem{\\([a-zA-Z][^%#'()={}]*\\)}{\\([0-9][^, %\"#'()={}]*\\)}{\\([a-zA-Z][^, %\"#'()={}]*\\)}" 3 LaTeX-auto-bibitem)
("\\\\harvarditem\\[[^][\n\r]+\\]{\\([a-zA-Z][^%#'()={}]*\\)}{\\([0-9][^, %\"#'()={}]*\\)}{\\([a-zA-Z][^, %\"#'()={}]*\\)}" 3 LaTeX-auto-bibitem)
)
LaTeX-auto-regexp-list))
(setq LaTeX-item-list
(cons '("thebibliography" . LaTeX-item-harvardbib)
LaTeX-item-list))
;; Tell RefTeX
(when (and LaTeX-reftex-cite-format-auto-activate
(fboundp 'reftex-set-cite-format))
(reftex-set-cite-format 'harvard)))
LaTeX-dialect)
(defun LaTeX-env-harvardbib (environment &optional _ignore)
"Insert ENVIRONMENT with label for harvarditem."
(LaTeX-insert-environment environment
(concat TeX-grop "xx" TeX-grcl))
(end-of-line 0)
(delete-char 1)
(delete-horizontal-space)
(LaTeX-insert-item))
;; Analog to LaTeX-item-bib from latex.el
(defun LaTeX-item-harvardbib ()
"Insert a new harvarditem."
(TeX-insert-macro "harvarditem"))
(defvar LaTeX-harvard-package-options '("full" "abbr" "default"
"agsmcite" "dcucite" "round"
"curly" "angle" "square" "none")
"Package options for the harvard package.")
;; harvard.el ends here

Some files were not shown because too many files have changed in this diff Show More