>From 2b09e568315dcf343845e62df92ccdcc3abb8887 Mon Sep 17 00:00:00 2001 From: Arash Esbati Date: Fri, 5 Jun 2015 22:45:05 +0200 Subject: [PATCH 2/2] New style pdfpages.el. * Makefile.in (STYLESRC): Add new style. * style/pdfpages.el: New file. --- ChangeLog | 4 ++ Makefile.in | 2 +- style/pdfpages.el | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 style/pdfpages.el diff --git a/ChangeLog b/ChangeLog index 539a008..4d1f5b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2015-06-05 Arash Esbati + * Makefile.in (STYLESRC): Add new style. + + * style/pdfpages.el: New file. + * style/listings.el (LaTeX-listings-auto-cleanup): Add support for the optional argument of env's defined with `\lstnewenvironment'. (LaTeX-listing-lstnewenvironment-regexp): Ditto. diff --git a/Makefile.in b/Makefile.in index 750036e..069a847 100644 --- a/Makefile.in +++ b/Makefile.in @@ -148,7 +148,7 @@ STYLESRC = style/prosper.el \ style/bidibeamer.el style/enumitem.el style/caption.el \ style/geometry.el style/ltablex.el style/ltxtable.el \ style/mn2e.el style/colortbl.el style/attachfile.el \ - style/newpxtext.el style/newpxmath.el + style/newpxtext.el style/newpxmath.el style/pdfpages.el STYLEELC = $(STYLESRC:.el=.elc) diff --git a/style/pdfpages.el b/style/pdfpages.el new file mode 100644 index 0000000..8957cf7 --- /dev/null +++ b/style/pdfpages.el @@ -0,0 +1,131 @@ +;;; pdfpages.el --- AUCTeX style for `pdfpages.sty' (v0.4v) + +;; Copyright (C) 2015 Free Software Foundation, Inc. + +;; Author: Arash Esbati +;; Maintainer: address@hidden +;; Created: 2015-05-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 `pdfpages.sty' (v0.4v) from 2013/08/25. +;; `pdfpages.sty' is part of TeXLive. + +;; Thanks to Andreas Matthias for testing this style and writing +;; `pdfpages.sty' in the first place. + +;;; Code: +(defvar LaTeX-pdfpages-key-val-options + '(;; Main options: + ("pages" ("-")) + ("nup") + ("landscape" ("true" "false")) + ;; Layout options: + ("delta") + ("offset") + ("frame" ("true" "false")) + ("column" ("true" "false")) + ("columnstrict" ("true" "false")) + ("openright" ("true" "false")) + ("pagecommand") + ("turn" ("true" "false")) + ("noautoscale" ("true" "false")) + ("fitpaper" ("true" "false")) + ("reflect" ("true" "false")) + ("signature") + ("signature*") + ("booklet" ("true" "false")) + ("picturecommand") + ("picturecommand*") + ("pagetemplate") + ("templatesize") + ("rotateoversize" ("true" "false")) + ("doublepages" ("true" "false")) + ("doublepagestwist" ("true" "false")) + ("doublepagestwistodd" ("true" "false")) + ("doublepagestwist*" ("true" "false")) + ("doublepagestwistodd*" ("true" "false")) + ("duplicatepages") + ;; Miscellaneous options: + ("lastpage") + ;; Hypertext options: + ("link" ("true" "false")) + ("linkname") + ("thread" ("true" "false")) + ("threadname") + ("linktodoc" ("true" "false")) + ;; Additional hypertext options: + ("linkfit" ("Fit" "FitH " "FitV " "FitB" "FitBH " "FitBV " "Region")) + ("linktodocfit" ("/Fit" "/FitH " "/FitV " "/FitB" "/FitBH " "/FitBV " "/Region")) + ("newwindow" ("true" "false")) + ("linkfilename") + ;; Experimental options: (Syntax may change in future versions!) + ("addtotoc") + ("addtolist") + ("survey" ("true" "false")) + ("survey-nolink" ("true" "false")) + ("xr-prefix")) + "Key=value options for pdfpages macros.") + +(TeX-add-style-hook + "pdfpages" + (lambda () + ;; Run style hook for packages loaded by pdfpages; all packages + ;; are required for running LaTeX, but not necessary within AUCTeX + (TeX-run-style-hooks "graphicx" "eso-pic" "everyshi" "ifthen" "calc") + + (TeX-add-symbols + ;; \includepdf[]{} + '("includepdf" + [TeX-arg-key-val LaTeX-pdfpages-key-val-options] + (TeX-arg-eval + (lambda () + (let ((pdffile (file-relative-name + (read-file-name "File to include: ")))) + (format "%s" pdffile))))) + + ;; \includepdfmerge[]{} + ;; The mandatory argument is complex, we just insert a pair of + ;; braces and leave the rest to the user + '("includepdfmerge" + [TeX-arg-key-val LaTeX-pdfpages-key-val-options] t) + + ;; \includepdfset{} + '("includepdfset" + (TeX-arg-key-val LaTeX-pdfpages-key-val-options)) + + '("threadinfodict" 0)) + + ;; Fontification + (when (and (featurep 'font-latex) + (eq TeX-install-font-lock 'font-latex-setup)) + (font-latex-add-keywords '(("includepdfset" "{")) + 'function) + (font-latex-add-keywords '(("includepdf" "[{") + ("includepdfmerge" "[{")) + 'reference))) + LaTeX-dialect) + +(defvar LaTeX-pdfpages-package-options + '("final" "draft" "enable-survey") + "Prompt for package options for the pdfpages package.") + +;;; pdfpages.el ends here -- 2.4.2