all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Add items to TeX-font-list
@ 2003-02-07 17:19 Kai Großjohann
  2003-02-07 19:34 ` Piet van Oostrum
  2003-02-07 21:36 ` Piet van Oostrum
  0 siblings, 2 replies; 6+ messages in thread
From: Kai Großjohann @ 2003-02-07 17:19 UTC (permalink / raw)


I have a document where it is convenient to add some items to
TeX-font-list.  Is there a way to do this for a document (which may
consist of more than one file)?

I've tried to add `eval' entries in a Local Variables block in the
master file which do (add-to-list 'TeX-font-list ...).

My document does \usepackage{nifty-macros} (where the
nifty-macros.sty for the most part consists of kludgy macros), so I
created a file style/nifty-macros.el which does

(TeX-add-style-hook
 "kg-thesis-macros"
 (lambda ()
   (add-to-list 'TeX-font-list (list ?d "\\DefTerm{" "}"))))

amongst other things.  Actually, the lambda contains more statements,
so I'm sure that it is executed.

But the only thing that works, in the end, is to add a Local
Variables block to each file.

But I would prefer something which works on a per-document basis.

Ideas?
-- 
A turnip curses Elvis

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Add items to TeX-font-list
  2003-02-07 17:19 Add items to TeX-font-list Kai Großjohann
@ 2003-02-07 19:34 ` Piet van Oostrum
  2003-02-07 20:14   ` Kai Großjohann
  2003-02-07 21:36 ` Piet van Oostrum
  1 sibling, 1 reply; 6+ messages in thread
From: Piet van Oostrum @ 2003-02-07 19:34 UTC (permalink / raw)


>>>>> kai.grossjohann@uni-duisburg.de (Kai Großjohann) (KG) wrote:

KG> I have a document where it is convenient to add some items to
KG> TeX-font-list.  Is there a way to do this for a document (which may
KG> consist of more than one file)?

KG> I've tried to add `eval' entries in a Local Variables block in the
KG> master file which do (add-to-list 'TeX-font-list ...).

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{" "}"))))
                    ^^^^ use LaTeX-font-list.
It works for me.
And I think you should also include
    (make-local-variable 'LaTeX-font-list)
in your hook (before the add-to-list call).
-- 
Piet van Oostrum <piet@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum@hccnet.nl

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Add items to TeX-font-list
  2003-02-07 19:34 ` Piet van Oostrum
@ 2003-02-07 20:14   ` Kai Großjohann
  2003-02-07 21:29     ` Piet van Oostrum
  0 siblings, 1 reply; 6+ messages in thread
From: Kai Großjohann @ 2003-02-07 20:14 UTC (permalink / raw)


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

>                     ^^^^ use LaTeX-font-list.
> It works for me.

Yes, indeed.  Argh.  Stupid me.

> And I think you should also include
>     (make-local-variable 'LaTeX-font-list)
> in your hook (before the add-to-list call).

That sounds useful.  Though, will it be executed in the right buffer?
Have you tried it with multi-file documents?
-- 
A turnip curses Elvis

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Add items to TeX-font-list
  2003-02-07 20:14   ` Kai Großjohann
@ 2003-02-07 21:29     ` Piet van Oostrum
  0 siblings, 0 replies; 6+ messages in thread
From: Piet van Oostrum @ 2003-02-07 21:29 UTC (permalink / raw)


>>>>> kai.grossjohann@uni-duisburg.de (Kai Großjohann) (KG) wrote:

KG> Piet van Oostrum <piet@cs.uu.nl> writes:
>> ^^^^ use LaTeX-font-list.
>> It works for me.

KG> Yes, indeed.  Argh.  Stupid me.

No, stupid me. It appears I was wrong. The variable LaTeX-font-list is
copied to TeX-font-list at an early stage (just when latex-mode is
entered). So changes that are made later don't work. And TeX-font-list is
a buffer-local variable already, so you were correct in changing that one.

Your original code DOES work for me.
Only I have (function(lambda ... rather than only (lambda ... but I don't
think it matters.

And it does work with multi-file documents. Be sure you start with a fresh
emacs or reload the .el file after you make these changes and issue C-u C-c
C-n in the proper buffers.
-- 
Piet van Oostrum <piet@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum@hccnet.nl

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Add items to TeX-font-list
  2003-02-07 17:19 Add items to TeX-font-list Kai Großjohann
  2003-02-07 19:34 ` Piet van Oostrum
@ 2003-02-07 21:36 ` Piet van Oostrum
  2003-02-09 15:45   ` Kai Großjohann
  1 sibling, 1 reply; 6+ messages in thread
From: Piet van Oostrum @ 2003-02-07 21:36 UTC (permalink / raw)


>>>>> 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.
-- 
Piet van Oostrum <piet@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum@hccnet.nl

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Add items to TeX-font-list
  2003-02-07 21:36 ` Piet van Oostrum
@ 2003-02-09 15:45   ` Kai Großjohann
  0 siblings, 0 replies; 6+ messages in thread
From: Kai Großjohann @ 2003-02-09 15:45 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-02-09 15:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-07 17:19 Add items to TeX-font-list Kai Großjohann
2003-02-07 19:34 ` Piet van Oostrum
2003-02-07 20:14   ` Kai Großjohann
2003-02-07 21:29     ` Piet van Oostrum
2003-02-07 21:36 ` Piet van Oostrum
2003-02-09 15:45   ` Kai Großjohann

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.