Initial Commit
[packages] / xemacs-packages / auctex / style / jurabib.el
1 ;;; jurabib.el --- AUCTeX style for the `jurabib' package
2
3 ;; Copyright (C) 2004, 2007 Free Software Foundation, Inc.
4
5 ;; Author: Ralf Angeli <angeli@iwi.uni-sb.de>
6 ;; Maintainer: auctex-devel@gnu.org
7 ;; Created: 2004-10-05
8 ;; Keywords: tex
9
10 ;; This file is part of AUCTeX.
11
12 ;; AUCTeX is free software; you can redistribute it and/or modify it
13 ;; under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 3, or (at your option)
15 ;; any later version.
16
17 ;; AUCTeX is distributed in the hope that it will be useful, but
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20 ;; General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with AUCTeX; see the file COPYING.  If not, write to the Free
24 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
25 ;; 02110-1301, USA.
26
27 ;;; Commentary:
28
29 ;; This file adds support for the `jurabib' package.
30
31 ;; Currently only the citation-related commands are supported.  Feel
32 ;; free to complete the support and send the result to the AUCTeX
33 ;; mailing list.  But be aware that the code can only be included if
34 ;; you assign the copyright to the FSF.
35
36 ;;; Code:
37
38 (TeX-add-style-hook
39  "jurabib"
40  (lambda ()
41    ;; Taken from natbib.el and adapted.
42    (let ((citecmds
43           '(("cite" . 2) ("cite*" . 2)
44             ("citetitle" . 2) ("fullcite" . 2)
45             ("citet" . 1) ("citealt" . 1)
46             ("citep" . 2) ("citealp" . 2)
47             ("citeauthor" . 2) ("citeyear" . 2)
48             ("footcite" . 2) ("footcite*" . 2)
49             ("footcitetitle" . 2) ("footfullcite" . 2)
50             ("footcitet" . 1) ("footcitealt" . 1)
51             ("footcitep" . 2) ("footcitealp" . 2)
52             ("footciteauthor" . 2) ("footciteyear" . 2))))
53      ;; Add these symbols
54      (apply 
55       'TeX-add-symbols
56       (mapcar
57        (lambda (cmd)
58          (cond 
59           ((= (cdr cmd) 0)
60            ;; No optional arguments
61            (list (car cmd) 'TeX-arg-cite))
62           ((= (cdr cmd) 1)
63            ;; Just one optional argument, the post note
64            (list
65             (car cmd)
66             '(TeX-arg-conditional TeX-arg-cite-note-p (["Post-note"]) nil)
67             'TeX-arg-cite))
68           ((= (cdr cmd) 2)
69            ;; Pre and post notes
70            (list
71             (car cmd)
72             '(TeX-arg-conditional TeX-arg-cite-note-p (natbib-note-args) nil)
73             'TeX-arg-cite))))
74        citecmds))
75      ;; Special cases
76      (TeX-add-symbols
77       ;; FIXME: Completing read for field.
78       '("citefield" ; \citefield[]{}{}
79         (TeX-arg-conditional TeX-arg-cite-note-p (["Post-note"]) nil)
80         "Field" TeX-arg-cite)
81       '("footcitefield" ; \footcitefield[]{}{}
82         (TeX-arg-conditional TeX-arg-cite-note-p (["Post-note"]) nil)
83         "Field" TeX-arg-cite))
84
85      ;; Make an entry in TeX-complete-list
86      (add-to-list
87       'TeX-complete-list
88       (list
89        (concat "\\\\\\(" 
90                (mapconcat (lambda (x) (regexp-quote (car x)))
91                           (append citecmds
92                                   '(("citefield") ("footcitefield"))) "\\|")
93                "\\)\\(\\[[^]\n\r\\%]*\\]\\)*{\\([^{}\n\r\\%,]*,\\)*"
94                "\\([^{}\n\r\\%,]*\\)")
95        4 'LaTeX-bibitem-list "}"))
96
97      ;; Add further symbols
98      (TeX-add-symbols
99       '("citefullfirstfortype" 1)
100       '("citenotitlefortype" 1)
101       '("citeswithoutentry" 1)
102       '("citetitlefortype" 1)
103       '("citeworkwithtitle" 1)
104       '("nextcitefull" 1)
105       '("nextcitenotitle" 1)
106       '("nextcitereset" 1)
107       '("nextciteshort" 1)
108       '("jurabibsetup" 1))
109
110      ;; Fontification
111      (when (and (featurep 'font-latex)
112                 (eq TeX-install-font-lock 'font-latex-setup))
113        (font-latex-add-keywords '(("cite" "*[[{")
114                                   ("citetitle" "[[{")
115                                   ("fullcite" "[[{")
116                                   ("citet" "[{")
117                                   ("citealt" "[{")
118                                   ("citep" "[[{")
119                                   ("citealp" "[[{")
120                                   ("citeauthor" "[[{")
121                                   ("citeyear" "[[{")
122                                   ("footcite" "[[{")
123                                   ("footcite*" "[[{")
124                                   ("footcitetitle" "[[{")
125                                   ("footfullcite" "[[{")
126                                   ("footcitet" "[{")
127                                   ("footcitealt" "[{")
128                                   ("footcitep" "[[{")
129                                   ("footcitealp" "[[{")
130                                   ("footciteauthor" "[[{")
131                                   ("footciteyear" "[[{")
132                                   ("citefield" "[{{")
133                                   ("footcitefield" "[{{"))
134                                 'reference)
135        (font-latex-add-keywords '(("citeswithoutentry" "{")
136                                   ("nextcitefull" "{")
137                                   ("nextcitenotitle" "{")
138                                   ("nextcitereset" "{")
139                                   ("nextciteshort" "{"))
140                                 'function)
141        (font-latex-add-keywords '(("citenotitlefortype" "{")
142                                   ("citetitlefortype" "{")
143                                   ("jurabibsetup" "{"))
144                                 'variable))
145
146      ;; Tell RefTeX (Thanks, Carsten)
147      (when (and (fboundp 'reftex-set-cite-format)
148                 ;; Is it `reftex-cite-format' customized?
149                 (not (get 'reftex-cite-format 'saved-value)))
150        ;; Check if RefTeX supports jurabib.
151        (if (assoc 'jurabib reftex-cite-format-builtin)
152            ;; Yes, use the provided default.
153            (reftex-set-cite-format 'jurabib)
154          ;; No, set it by hand.
155          (reftex-set-cite-format
156           '((?\C-m . "\\cite{%l}")
157             (?c    . "\\cite[?][]{%l}")
158             (?t    . "\\citet{%l}")
159             (?p    . "\\citep{%l}")
160             (?e    . "\\citep[e.g.][?]{%l}")
161             (?s    . "\\citep[see][?]{%l}")
162             (?u    . "\\fullcite{%l}")
163             (?i    . "\\citetitle{%l}")
164             (?a    . "\\citeauthor{%l}")
165             (?e    . "\\citefield{?}{%l}")
166             (?y    . "\\citeyear{%l}")
167             (?f    . "\\footcite{%l}")
168             (?F    . "\\footcite[?][]{%l}")
169             (?l    . "\\footfullcite{%l}"))))))
170
171    ;; FIXME: The following list is the edited output of
172    ;; `TeX-auto-generate' which probably includes internal macros of
173    ;; jurabib.  Unfortunately the macros which should be accessible to
174    ;; the user are not fully documented at the time of this writing.
175    ;; But instead of including only the limited part which is
176    ;; documented we rather give the user a bit too much.  The list
177    ;; should be reduced when there is proper documentation, though.
178    (TeX-add-symbols
179     '("Wrapquotes" 1)
180     '("apyformat" 1)
181     '("artnumberformat" 1)
182     '("artvolnumformat" 2)
183     '("artvolumeformat" 1)
184     '("artyearformat" 1)
185     '("bibAnnote" 1)
186     '("bibAnnoteFile" 1)
187     '("bibAnnotePath" 1)
188     '("bibEIMfont" 1)
189     '("bibIMfont" 1)
190     '("bibYear" 1)
191     '("bibedformat" 1)
192     '("bibedinformat" 1)
193     '("bibenf" 5)
194     '("biblenf" 5)
195     '("bibnf" 5)
196     '("bibnumberformat" 1)
197     '("bibrenf" 5)
198     '("bibrlenf" 5)
199     '("bibrnf" 5)
200     '("biburlfont" 1)
201     '("edfont" 1)
202     '("formatarticlepages" ["argument"] 2)
203     '("fsted" 1)
204     '("fullnameoxfordcrossref" 1)
205     '("incolledformat" 5)
206     '("jbArchPages" 1)
207     '("jbPages" 1)
208     '("jbannoteformat" 1)
209     '("jbapifont" 1)
210     '("jbarchnameformat" 1)
211     '("jbarchsig" 2)
212     '("jbartPages" 1)
213     '("jbartcrossrefchecked" ["argument"] 1)
214     '("jbauthorindexfont" 1)
215     '("jbbibargs" 5)
216     '("jbbibyearformat" 1)
217     '("jbcitationoyearformat" 1)
218     '("jbcitationyearformat" 1)
219     '("jbcrossrefchecked" ["argument"] 1)
220     '("jbedafti" 1)
221     '("jbedbyincollcrossreflong" 1)
222     '("jbedbyincollcrossrefshort" 1)
223     '("jbedbyincollcrossrefshortnoapy" 1)
224     '("jbedbyincollcrossrefshortwithapy" 1)
225     '("jbedition" 1)
226     '("jbeditorindexfont" 1)
227     '("jbendnote" 1)
228     '("jbflanguage" 1)
229     '("jbincollcrossref" 2)
230     '("jbisbn" 1)
231     '("jbissn" 1)
232     '("jbnote" 2)
233     '("jborganizationindexfont" 1)
234     '("jbpagesformat" 1)
235     '("jbprformat" 1)
236     '("jbrealcitation" 2)
237     '("jbshortarchformat" 1)
238     '("jbshortsubarchformat" 1)
239     '("jbsy" 1)
240     '("jbtiafed" 1)
241     '("lookatfortype" 1)
242     '("nobibliography" 1)
243     '("nocitebuthowcited" 1)
244     '("numberandseries" 2)
245     '("pageadd" 1)
246     '("pernumberformat" 1)
247     '("pervolnumformat" 2)
248     '("pervolumeformat" 1)
249     '("peryearformat" 1)
250     '("revnumberformat" 1)
251     '("revvolnumformat" 2)
252     '("revvolumeformat" 1)
253     '("revyearformat" 1)
254     '("snded" 1)
255     '("textitswitch" 1)
256     '("translator" 3)
257     '("volumeformat" 1)
258     "Bibbfsasep"
259     "Bibbfsesep"
260     "Bibbstasep"
261     "Bibbstesep"
262     "Bibbtasep"
263     "Bibbtesep"
264     "Bibchaptername"
265     "Bibetal"
266     "Edbyname"
267     "IbidemMidName"
268     "IbidemName"
269     "NAT"
270     "OpCit"
271     "Reprint"
272     "SSS"
273     "Transfrom"
274     "Volumename"
275     "addtoalllanguages"
276     "afterfoundersep"
277     "aftervolsep"
278     "ajtsep"
279     "alsothesisname"
280     "aprname"
281     "augname"
282     "bibBTsep"
283     "bibJTsep"
284     "bibPageName"
285     "bibPagesName"
286     "bibaesep"
287     "bibaldelim"
288     "bibaltformatalign"
289     "bibandname"
290     "bibanfont"
291     "bibansep"
292     "bibapifont"
293     "bibapyldelim"
294     "bibapyrdelim"
295     "bibarchpagename"
296     "bibarchpagesname"
297     "bibardelim"
298     "bibartperiodhowcited"
299     "bibatsep"
300     "bibauthormultiple"
301     "bibbdsep"
302     "bibbfsasep"
303     "bibbfsesep"
304     "bibbstasep"
305     "bibbstesep"
306     "bibbtasep"
307     "bibbtesep"
308     "bibbtfont"
309     "bibbtsep"
310     "bibbudcsep"
311     "bibces"
312     "bibchapterlongname"
313     "bibchaptername"
314     "bibcite"
315     "bibcolumnsep"
316     "bibcommenthowcited"
317     "bibcontinuedname"
318     "bibcrossrefcite"
319     "bibcrossrefciteagain"
320     "bibeandname"
321     "bibedformat"
322     "bibefnfont"
323     "bibeimfont"
324     "bibelnfont"
325     "bibenf"
326     "bibfnfmt"
327     "bibfnfont"
328     "bibhowcited"
329     "bibibidfont"
330     "bibidemPfname"
331     "bibidemPmname"
332     "bibidemPnname"
333     "bibidemSfname"
334     "bibidemSmname"
335     "bibidemSnname"
336     "bibidempfname"
337     "bibidempmname"
338     "bibidempnname"
339     "bibidemsfname"
340     "bibidemsmname"
341     "bibidemsnname"
342     "bibimfont"
343     "bibincollcrossrefcite"
344     "bibincollcrossrefciteagain"
345     "bibjtfont"
346     "bibjtsep"
347     "bibleftcolumn"
348     "bibleftcolumnadjust"
349     "bibleftcolumnstretch"
350     "biblenf"
351     "biblnfmt"
352     "biblnfont"
353     "bibnf"
354     "bibnotcited"
355     "bibpagename"
356     "bibpagesname"
357     "bibpagesnamesep"
358     "bibpldelim"
359     "bibprdelim"
360     "bibrevtfont"
361     "bibrightcolumn"
362     "bibrightcolumnadjust"
363     "bibrightcolumnstretch"
364     "bibsall"
365     "bibsdanish"
366     "bibsdutch"
367     "bibsenglish"
368     "bibsfinnish"
369     "bibsfrench"
370     "bibsgerman"
371     "bibsitalian"
372     "bibsnfont"
373     "bibsnorsk"
374     "bibsportuguese"
375     "bibsspanish"
376     "bibtabularitemsep"
377     "bibtfont"
378     "bibtotalpagesname"
379     "biburlprefix"
380     "biburlsuffix"
381     "bibvolumecomment"
382     "bibvtfont"
383     "bothaesep"
384     "bpubaddr"
385     "byname"
386     "citetitleonly"
387     "citeyearpar"
388     "commaename"
389     "commaname"
390     "dateldelim"
391     "daterdelim"
392     "decname"
393     "diffpageibidemmidname"
394     "diffpageibidemname"
395     "edbyname"
396     "edbysep"
397     "editionname"
398     "editorname"
399     "editorsname"
400     "enoteformat"
401     "etalname"
402     "etalnamenodot"
403     "febname"
404     "fifthedname"
405     "firstedname"
406     "footcitetitleonly"
407     "formatpages"
408     "foundername"
409     "fourthedname"
410     "fromdutch"
411     "fromenglish"
412     "fromfinnish"
413     "fromfrench"
414     "fromgerman"
415     "fromitalian"
416     "fromnorsk"
417     "fromportuguese"
418     "fromspanish"
419     "herename"
420     "howcitedprefix"
421     "howcitedsuffix"
422     "ibidem"
423     "ibidemmidname"
424     "ibidemname"
425     "idemPfedbyname"
426     "idemPfname"
427     "idemPmedbyname"
428     "idemPmname"
429     "idemPnedbyname"
430     "idemPnname"
431     "idemSfedbyname"
432     "idemSfname"
433     "idemSmedbyname"
434     "idemSmname"
435     "idemSnedbyname"
436     "idemSnname"
437     "idemmidname"
438     "idemname"
439     "idempfedbyname"
440     "idempfname"
441     "idempmedbyname"
442     "idempmname"
443     "idempnedbyname"
444     "idempnname"
445     "idemsfedbyname"
446     "idemsfname"
447     "idemsmedbyname"
448     "idemsmname"
449     "idemsnedbyname"
450     "idemsnname"
451     "incollinname"
452     "inname"
453     "inseriesname"
454     "janname"
455     "jbCheckedFirst"
456     "jbFirst"
457     "jbFirstAbbrv"
458     "jbJunior"
459     "jbLast"
460     "jbNotRevedNoVonJr"
461     "jbNotRevedNoVonNoJr"
462     "jbNotRevedOnlyLast"
463     "jbNotRevedVonJr"
464     "jbNotRevedVonNoJr"
465     "jbPAGES"
466     "jbPageName"
467     "jbPages"
468     "jbPagesName"
469     "jbRevedFirstNoVonJr"
470     "jbRevedFirstNoVonNoJr"
471     "jbRevedFirstOnlyLast"
472     "jbRevedFirstVonJr"
473     "jbRevedFirstVonNoJr"
474     "jbRevedNotFirstNoVonJr"
475     "jbRevedNotFirstNoVonNoJr"
476     "jbRevedNotFirstOnlyLast"
477     "jbRevedNotFirstVonJr"
478     "jbRevedNotFirstVonNoJr"
479     "jbVon"
480     "jbactualauthorfnfont"
481     "jbactualauthorfont"
482     "jbaddtomakehowcited"
483     "jbaensep"
484     "jbafterstartpagesep"
485     "jbannotatorfont"
486     "jbapifont"
487     "jbarchnamesep"
488     "jbarchpagename"
489     "jbarchpagesname"
490     "jbartPages"
491     "jbatsep"
492     "jbauthorfnfont"
493     "jbauthorfont"
494     "jbauthorfontifannotator"
495     "jbauthorinfo"
496     "jbbeforestartpagesep"
497     "jbbfsasep"
498     "jbbfsesep"
499     "jbbookedaftertitle"
500     "jbbstasep"
501     "jbbstesep"
502     "jbbtasep"
503     "jbbtesep"
504     "jbbtfont"
505     "jbbtitlefont"
506     "jbcitationyearformat"
507     "jbcrossrefchecked"
508     "jbdisablecitationcrossref"
509     "jbdoitem"
510     "jbdonotindexauthors"
511     "jbdonotindexeditors"
512     "jbdonotindexorganizations"
513     "jbdotafterbibentry"
514     "jbdotafterendnote"
515     "jbdy"
516     "jbedbyincollcrossrefcite"
517     "jbedbyincollcrossrefciteagain"
518     "jbedition"
519     "jbedseplikecite"
520     "jbeimfont"
521     "jbfirstcitepageranges"
522     "jbfootnoteformat"
523     "jbfootnotenumalign"
524     "jbfulltitlefont"
525     "jbhowcitedcomparepart"
526     "jbhowcitednormalpart"
527     "jbhowsepannotatorfirst"
528     "jbhowsepannotatorlast"
529     "jbhowsepbeforetitle"
530     "jbhowsepbeforetitleae"
531     "jbhowsepbeforetitleibidemname"
532     "jbignorevarioref"
533     "jbimfont"
534     "jbindexbib"
535     "jbindexonlyfirstauthors"
536     "jbindexonlyfirsteditors"
537     "jbindexonlyfirstorganizations"
538     "jbindextype"
539     "jblookforgender"
540     "jbmakeinbib"
541     "jbmakeinbiblist"
542     "jbmakeindexactual"
543     "jbnotsamearch"
544     "jbonlyforbib"
545     "jbonlyforcitations"
546     "jbonlyforfirstcitefullbegin"
547     "jbonlyforfirstcitefullend"
548     "jborgauthorfont"
549     "jboyearincitation"
550     "jbpagename"
551     "jbpagenamenodot"
552     "jbpages"
553     "jbpagesep"
554     "jbpagesname"
555     "jbpagesnamesep"
556     "jbsamearch"
557     "jbsamesubarch"
558     "jbsamesubarchindent"
559     "jbshorttitlefont"
560     "jbshowbibextralabel"
561     "jbssedbd"
562     "jbsubarchsep"
563     "jbsuperscripteditionafterauthor"
564     "jbtitlefont"
565     "jbts"
566     "jburldef"
567     "jbuseidemhrule"
568     "jbyear"
569     "jbyearaftertitle"
570     "julname"
571     "junname"
572     "jurthesisname"
573     "marname"
574     "mastersthesisname"
575     "mayname"
576     "nofirstnameforcitation"
577     "noibidem"
578     "noidem"
579     "nopage"
580     "novname"
581     "numbername"
582     "octname"
583     "ofseriesname"
584     "opcit"
585     "organizationname"
586     "origPAGES"
587     "origartPages"
588     "origbibces"
589     "origcrossref"
590     "origpages"
591     "osep"
592     "phdthesisname"
593     "reprint"
594     "reprintname"
595     "reviewbyname"
596     "reviewname"
597     "reviewofname"
598     "samepageibidemmidname"
599     "samepageibidemname"
600     "secondedname"
601     "sepname"
602     "sndecmd"
603     "snded"
604     "sndeditorname"
605     "sndeditorsname"
606     "technicalreportname"
607     "testnosig"
608     "textandname"
609     "texteandname"
610     "theHlvla"
611     "theHlvlb"
612     "theHlvlc"
613     "theHlvld"
614     "theHlvle"
615     "theHlvlf"
616     "theHlvlg"
617     "theHlvlh"
618     "theHlvli"
619     "theHlvlj"
620     "theHlvlk"
621     "theHlvll"
622     "thedname"
623     "thirdedname"
624     "trans"
625     "transby"
626     "transfrom"
627     "updatename"
628     "updatesep"
629     "urldatecomment"
630     "volname"
631     "volumename"
632     "volumeofname"))
633  LaTeX-dialect)
634
635 ;;; jurabib.el ends here