# HG changeset patch # User Uwe Brauer # Date 1478528547 0 # Mon Nov 07 14:22:27 2016 +0000 # Node ID 982bd4194d502ce6003a0ac23af37feb64a351fe # Parent e37527510e63bb0a4fcd64db2ab385a6f7fda5f2 Add style/subfiles.el add entry in Makefile.in diff --git a/Makefile.in b/Makefile.in --- a/Makefile.in +++ b/Makefile.in @@ -157,7 +157,7 @@ style/splitidx.el style/tikz.el style/xcolor.el \ style/pdflscape.el style/commath.el style/empheq.el \ style/framed.el style/paracol.el style/menukeys.el \ - style/bidi.el + style/bidi.el style/subfiles.el STYLEELC = $(STYLESRC:.el=.elc) diff --git a/style/subfiles.el b/style/subfiles.el new file mode 100644 --- /dev/null +++ b/style/subfiles.el @@ -0,0 +1,56 @@ +;;; subfiles.el --- AUCTeX style for the subfiles package. + +;; Copyright (C) 2016 Free Software Foundation, Inc. + +;; Author: Uwe Brauer +;; Created: 07 Nov 2016 +;; 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. + +;; Acknowledgements +;; Mosè Giordano +;; Arash Esbati + +;;; Commentary: + +;; This file adds support for the subfiles package. + +;;; Code: + +(defvar LaTeX-subfiles-package-options nil + "Package options for the subfiles package.") + +(TeX-add-style-hook + "subfiles" + (lambda () + ;; The following code will fontify `\subfile{}' like input or include. + (when (and (featurep 'font-latex) + (eq TeX-install-font-lock 'font-latex-setup)) + (font-latex-add-keywords '(("subfile" "{")) + 'reference)) + ;; The following code will run `TeX-run-style-hooks' on the subfile master file. + ;; Thanks to Mosè Giordano for presenting a better solution using `assoc'. + (TeX-run-style-hooks + (file-name-base (cadr (assoc "subfiles" LaTeX-provided-class-options)))) + (TeX-add-symbols + '("subfile" TeX-arg-file))) + LaTeX-dialect) + + +;;; subfiles.el ends here