EasyPG 1.07 Released
[packages] / xemacs-packages / auctex / style / foils.el
1 ;;; foils.el - Special code for FoilTeX.
2
3 ;; Copyright (C) 1994-2014 Free Software Foundation, Inc.
4
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
6 ;; Maintainer: auctex-devel@gnu.org
7 ;; Keywords: tex
8
9 ;; This file is part of AUCTeX.
10
11 ;; AUCTeX is free software; you can redistribute it and/or modify it
12 ;; under the terms of the GNU General Public License as published by the
13 ;; Free Software Foundation; either version 3, or (at your option) any
14 ;; later version.
15
16 ;; AUCTeX is distributed in the hope that it will be useful, but WITHOUT
17 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 ;; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19 ;; for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with AUCTeX.  If not, see <http://www.gnu.org/licenses/>.
23
24 ;;; Code:
25
26 (require 'timezone)
27
28 (TeX-add-style-hook "foils"
29  (function
30   (lambda ()
31     (add-hook 'LaTeX-document-style-hook 'LaTeX-style-foils)
32     (setq LaTeX-default-style "foils")
33     (setq LaTeX-default-options '("landscape"))
34     (TeX-add-symbols
35      '("foilhead" [ "Rubric-body separation" ] "Foil rubric"))))
36  LaTeX-dialect)
37
38 (defun LaTeX-style-foils nil
39   "Prompt for and insert foiltex options."
40   (let* ((date (timezone-parse-date (current-time-string)))
41          (year   (string-to-number (aref date 0)))
42          (month  (string-to-number (aref date 1)))
43          (day    (string-to-number (aref date 2)))
44          (title (TeX-read-string "Title: ")))
45     (save-excursion
46       (goto-char (point-max))
47       (re-search-backward ".begin.document.")
48       (insert TeX-esc "title"
49               TeX-grop title TeX-grcl "\n")
50       (insert TeX-esc "author"
51               TeX-grop (user-full-name) TeX-grcl "\n")
52       (insert TeX-esc "date" TeX-grop
53               (format "%d-%02d-%02d" year month day)
54               TeX-grcl "\n")
55       (insert "" TeX-esc "MyLogo" TeX-grop TeX-grcl "\n")
56       (insert "%" TeX-esc "Restriction" TeX-grop TeX-grcl "\n")
57       (insert "%" TeX-esc "rightfooter" TeX-grop TeX-grcl "\n")
58       (insert "%" TeX-esc "leftheader" TeX-grop TeX-grcl "\n")
59       (insert "%" TeX-esc "rightheader" TeX-grop TeX-grcl "\n\n")
60       (re-search-forward ".begin.document.")
61       (end-of-line)
62       (newline-and-indent)
63       (insert "" TeX-esc "maketitle\n\n"))
64     (forward-line -1)))
65
66 ;;; foils.el ends here