Function: cal-tex-preamble

cal-tex-preamble is a byte-compiled function defined in cal-tex.el.gz.

Signature

(cal-tex-preamble &optional ARGS)

Documentation

Insert the LaTeX calendar preamble into cal-tex-buffer.

Preamble includes initial definitions for various LaTeX commands. Optional string ARGS are included as options for the article document class with inclusion of default values "12pt" for size, and "a4paper" for paper unless size or paper are already specified in ARGS. When ARGS is omitted, by default the option
"12pt,a4paper" is passed. When ARGS has any other value, then
no option is passed to the class.

Insert the "\\usepackage{geometry}" directive when ARGS contains the "landscape" string.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/cal-tex.el.gz
(defun cal-tex-preamble (&optional args)
  "Insert the LaTeX calendar preamble into `cal-tex-buffer'.
Preamble includes initial definitions for various LaTeX commands.
Optional string ARGS are included as options for the article
document class with inclusion of default values \"12pt\" for
size, and \"a4paper\" for paper unless size or paper are already
specified in ARGS.  When ARGS is omitted, by default the option
\"12pt,a4paper\" is passed.  When ARGS has any other value, then
no option is passed to the class.

Insert the \"\\usepackage{geometry}\" directive when ARGS
contains the \"landscape\" string."
  (set-buffer (generate-new-buffer cal-tex-buffer))
  (save-match-data
    (insert (format "\\documentclass%s{article}\n"
                    (cond
                     ((stringp args)
                      ;; set default size
                      (unless (string-match "\\(^\\|,\\) *[0-9]+pt *\\(,\\|$\\)" args)
                        (setq args (concat args ",12pt")))
                      ;; set default paper
                      (unless (string-match "\\(^\\|,\\) *\\([ab][4-5]\\|le\\(tter\\|gal\\)\\|executive\\)paper *\\(,\\|$\\)" args)
                        (setq args (concat args ",a4paper")))
                      (when (string= (substring args 0 1) ",")
                        (setq args (substring args 1)))
                      (if (string= args "") "" (format "[%s]" args)))
                     ((null args) "[12pt]")
                     (t ""))))
    (if (and (stringp args) (string-match "\\<landscape\\>" args))
      (insert "\\usepackage{geometry}\n")))
  (if (stringp cal-tex-preamble-extra)
      (insert cal-tex-preamble-extra "\n"))
  ;; FIXME boxwidth and boxheight unused?
  (insert "\\hbadness 20000
\\hfuzz=1000pt
\\vbadness 20000
\\lineskip 0pt
\\marginparwidth 0pt
\\oddsidemargin  -2cm
\\evensidemargin -2cm
\\marginparsep   0pt
\\topmargin      0pt
\\textwidth      7.5in
\\textheight     9.5in
\\newlength{\\cellwidth}
\\newlength{\\cellheight}
\\newlength{\\boxwidth}
\\newlength{\\boxheight}
\\newlength{\\cellsize}
\\newcommand{\\myday}[1]{}
\\newcommand{\\caldate}[6]{}
\\newcommand{\\nocaldate}[6]{}
\\newcommand{\\calsmall}[6]{}
%
"))