summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/qcm/qcm.el
blob: 10def20e2a52d8705173d11088e0a24515db3ea4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
;;; qcm.el --- AUC-TeX style file for QCM

;; Copyright (C) 2004 Didier Verna.

;; Author:        Didier Verna <didier@lrde.epita.fr>
;; Maintainer:    Didier Verna <didier@lrde.epita.fr>
;; Created:       Tue Apr 18 14:49:29 2000
;; Last Revision: Tue Nov  9 17:46:37 2004
;; Keywords:      tex abbrev data

;; This file is part of QCM.

;; QCM may be distributed and/or modified under the
;; conditions of the LaTeX Project Public License, either version 1.1
;; of this license or (at your option) any later version.
;; The latest version of this license is in
;; http://www.latex-project.org/lppl.txt
;; and version 1.1 or later is part of all distributions of LaTeX
;; version 1999/06/01 or later.

;; QCM consists of all files listed in the file `README'.


;;; Commentary:

;; Contents management by FCM version 0.1-b2.

;; #### NOTE: maybe this file should be split in two: one for the style and
;; #### one for the class.

;;; Code:

(defun qcm-LaTeX-item-question ()
  (if current-prefix-arg
      (TeX-insert-macro "true")
    (TeX-insert-macro "false")))

(push '("question" . qcm-LaTeX-item-question) LaTeX-item-list)

(defun qcm-LaTeX-env-question (environment)
  "Create a \`question' environment in a QCM document."
  ;; Questions can be quite long, so instead of prompting for them, which
  ;; would be annoying, let's just put the point inside the braces.
  (LaTeX-insert-environment environment "{}")
  (beginning-of-line)
  (kill-line)
  (LaTeX-find-matching-begin)
  (end-of-line)
  (forward-char -1)
  )

(TeX-add-style-hook "qcm"
  (function
   (lambda ()
     ;; QCM style:
     (LaTeX-add-environments
      '("question" qcm-LaTeX-env-question)
      '("correction")
      )
     (TeX-add-symbols
      '("true" (TeX-arg-literal " "))
      '("false" (TeX-arg-literal " "))
      '("truesymbol" t)
      '("falsesymbol" t)
      '("correctionstyle" t)
      '("questionspace")
      '("thequestion")
      '("answerstitle" t)
      '("answerstitlefont" t)
      '("answernumberfont" t)
      '("makeform")
      '("makemask")
      '("headerfont" t)
      '("X" t)
      ;; QCM Class:
      '("title" t)
      '("titlefont" t)
      '("titlespace")
      '("maketitle")
      '("questiontitle" t)
      '("questiontitlefont" t)
      '("questiontitlespace")
      '("questionsepspace")
      )
     )))




;;; Local variables:
;;; eval: (put 'TeX-add-style-hook 'lisp-indent-function 1)
;;; End:

;;; qcm.el ends here