help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Add items to TeX-font-list


From: Kai Großjohann
Subject: Re: Add items to TeX-font-list
Date: Sun, 09 Feb 2003 16:45:43 +0100
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.3.50

Piet van Oostrum <piet@cs.uu.nl> writes:

>>>>>> kai.grossjohann@uni-duisburg.de (Kai Großjohann) (KG) wrote:
>
> KG> My document does \usepackage{nifty-macros} (where the
> KG> nifty-macros.sty for the most part consists of kludgy macros), so I
> KG> created a file style/nifty-macros.el which does
>
> KG> (TeX-add-style-hook
> KG>  "kg-thesis-macros"
> KG>  (lambda ()
> KG>    (add-to-list 'TeX-font-list (list ?d "\\DefTerm{" "}"))))
>
> I think it is safer to use "nifty-macros" rather than "kg-thesis-macros".
> I am not sure if it really is necessary, but I think it wouldn't harm to
> try it.

Ayee.  I was using "nifty-macros" in my posting in a feeble attempt
to be funny.  And then I revealed my cluelessness by not changing the
stuff I copied and pasted from the actual source files :-{

Anyhow, I think that the name does matter.  Here is the complete file
style/kg-thesis-macros.el as it exists now, and it works quite well.
This is rather amazing, considering that I don't know what I'm doing
at all.  O the wonders of AUC-TeX.

Kudos to Carsten for RefTeX and the useful hints, to Per for AUC TeX,
and to David for the dash :-)  ^W^W I mean the maintenance of AUC-TeX.

;; From Carsten Dominik <dominik@astro.uva.nl>.
;; Define a custom function to insert the environment.  You need a
;; custom function since you want the extra argument (the title)
(defun kai-LaTeX-env-title-and-label (environment)
  "Insert ENVIRONMENT, prompt for title and insert label."
  (let ((title (read-string "Title: ")))
    (LaTeX-insert-environment environment (concat "[" title "]"))
    (and (LaTeX-label environment)
         (newline-and-indent))))

(TeX-add-style-hook
 "kg-thesis-macros"
 (lambda ()
   (add-to-list 'LaTeX-font-list (list ?d "\\DefTerm{" "}" "\\text{" "}"))
   (add-to-list 'LaTeX-font-list (list ?c "\\Code{" "}"))
   (add-to-list 'LaTeX-font-list (list ?o "\\operatorname{" "}"))
   (add-to-list 'LaTeX-font-list (list ?s "\\synt{" "}"))
   ;; Tell RefTeX to derive labels for the definition environment from
   ;; context.
   (make-local-variable 'reftex-insert-label-flags)
   (setq reftex-insert-label-flags
         (list
          (concat (nth 0 reftex-insert-label-flags) "d")
          (nth 1 reftex-insert-label-flags)))
   ;; Tell LaTeX about the definition environment and how to insert it.
   (LaTeX-add-environments '("definition" kai-LaTeX-env-title-and-label))
   (LaTeX-add-environments '("todo" LaTeX-env-item))
   (reftex-add-label-environments
    '(("definition" ?d "def:" "~\\ref{%s}" 
       "\\\\begin{definition}\\[" ("definition") nil)))
   (reftex-add-label-environments
    '(("observation" ?o "obs:" "~\\ref{%s}"
       "\\\\begin{observation}\\[" ("observation") nil)))))
-- 
A turnip curses Elvis


reply via email to

[Prev in Thread] Current Thread [Next in Thread]