1 ;;; fancyhdr.el --- AUCTeX style for `fancyhdr.sty'
3 ;; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
5 ;; Author: Mads Jensen <mje@inducks.org>
6 ;; Maintainer: auctex-devel@gnu.org
9 ;; This file is part of AUCTeX.
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
13 ;; the Free Software Foundation; either version 3, or (at your option)
16 ;; AUCTeX is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with AUCTeX; see the file COPYING. If not, write to the Free
23 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
28 ;; This file adds support for `fancyhdr.sty', version 3.2
44 '("fancyhead" [ TeX-arg-fancyhdr-position ] t)
45 '("fancyfoot" [ TeX-arg-fancyhdr-position ] t)
47 [ (TeX-arg-fancyhdr-position
48 "Position" ("LO" "LE" "L" "RE" "RO" "R" "0")) ] t)
50 [ (TeX-arg-fancyhdr-position
51 "Position" ("LO" "LE" "L" "RE" "RO" "R" "O")) ] t)
53 [ (TeX-arg-fancyhdr-position "Position" ("E" "O" "L" "R")) ] t)
54 '("fancypagestyle" TeX-arg-pagestyle t)
56 "headrulewidth" "footrulewidth" "plainfootrulewidth"
57 "plainheadrulewidth" "leftmark" "rightmark"
58 ;; the manual does not mention any subsubsectionmark (!)
59 "chaptermark" "sectionmark" "subsectionmark" "paragraphmark"
60 "subparagraphmark" "footrule" "headrule")
62 ;; `fancyhdr.sty' supplies these two pagestyles
63 (LaTeX-add-pagestyles "fancy" "fancyplain")
66 (when (and (featurep 'font-latex)
67 (eq TeX-install-font-lock 'font-latex-setup))
68 (font-latex-add-keywords '(("fancyhead" "[{")
76 ("fancyheadoffset" "[{")
77 ("fancyfootoffset" "[{")
78 ("fancypagestyle" "{{")) 'function)
79 (font-latex-add-keywords '(("headrulewidth" "")
81 ("plainheadrulewidth" "")
82 ("plainfootrulewidth" "")) 'variable)
83 ;; Tell font-lock about the update.
84 (setq font-lock-set-defaults nil)
85 (font-lock-set-defaults)))
88 ;; Because there can be many positions, `TeX-completing-read-multiple' is used
89 ;; instead of just `completing-read', and a `collection' argument is provided as
90 ;; the list of positions differs between the macros
91 (defun TeX-arg-fancyhdr-position (optional &optional prompt collection)
92 "Prompt for a fancyhdr position with completion.
93 If OPTIONAL is non-nil, insert the resulting value as an optional
94 argument, otherwise as a mandatory one. If non-nil, PROMPT is
95 used as the prompt. If non-nil, COLLECTION is used as the
96 completion list for the position."
97 (let* ((positions (if (not collection)
98 ;; Standard positions with no restrictions. Lower-case
99 ;; versions, and reverse versions (e.g., OC) are left
100 ;; out for simplicity.
101 '("LO" "LE" "L" "CO" "CE" "C" "RE" "RO" "R")
105 (TeX-completing-read-multiple
106 (TeX-argument-prompt optional prompt "Position")
107 (mapcar 'list positions)) ",")))
108 (TeX-argument-insert arguments optional)))
110 (defvar LaTeX-fancyhdr-package-options nil
111 "Package options for fancyhdr.")
113 ;;; fancyhdr.el ends here