[comp.text.tex] GNU EMACS latex-mode, setting hooks, ...

fritzz@zoot.ldgo.columbia.edu (fritz zaucker) (03/25/91)

Hi,

I use GNU EMACS to edit LaTeX files and I use latex.el (from Nelson
Beebe).
I would like to set mode-hooks, so that if I switch to LaTeX-mode, the
following happens automatically:

latex.el is loaded
outline-regexp is set to something like "[\\][(sub\\)]*section".

I just couldn't get it to work. Has anybody done that? Do you have a
complete LaTeX outline-regexp?

Thanks for any help, I'll summarize.

Fritz
--
--
Fritz Zaucker
Lamont-Doherty Geological Observatory of Columbia University New York
Palisades, NY 10964 (914) 359-2900 x703 EMAIL: fritzz@lamont.ldgo.columbia.edu

pczdcd@uk.ac.nott.mips (Clyde Davies) (03/29/91)

In article <FRITZZ.91Mar24161916@zoot.ldgo.columbia.edu>,
fritzz@zoot.ldgo.columbia.edu (fritz zaucker) writes:
> Xref: nott-cs gnu.emacs.help:1397 comp.text.tex:5813
> Path:
nott-cs!ukc!mcsun!uunet!ukma!wuarchive!zaphod.mps.ohio-state.edu!sol.ctr
.columbia.edu!cunixf.cc.columbia.edu!lamont!zoot!fritzz
> From: fritzz@zoot.ldgo.columbia.edu (fritz zaucker)
> Newsgroups: gnu.emacs.help,comp.text.tex
> Subject: GNU EMACS latex-mode, setting hooks, ...
> Message-ID: <FRITZZ.91Mar24161916@zoot.ldgo.columbia.edu>
> Date: 24 Mar 91 21:19:16 GMT
> Sender: fritzz@lamont.ldgo.columbia.edu
> Organization: Lamont-Doherty Geological Observatory, Columbia University, New
> Lines: 21
> 
> 
> Hi,
> 
> I use GNU EMACS to edit LaTeX files and I use latex.el (from Nelson
> Beebe).
> I would like to set mode-hooks, so that if I switch to LaTeX-mode, the
> following happens automatically:
> 
> latex.el is loaded
> outline-regexp is set to something like "[\\][(sub\\)]*section".
> 
> I just couldn't get it to work. Has anybody done that? Do you have a
> complete LaTeX outline-regexp?
> 
> Thanks for any help, I'll summarize.
> 
> Fritz
> --
> --
> Fritz Zaucker
> Lamont-Doherty Geological Observatory of Columbia University New York
> Palisades, NY 10964 (914) 359-2900 x703 EMAIL:
fritzz@lamont.ldgo.columbia.edu


It's a little hairy to figure out the regexp yourself (it took me three
days...) 
so here goes. The thing to remember is that backslashes need to be
doubly escaped
when putting into a regexp, and also in Elisp.  hence all backslashes
need to be
*quadruply* escaped in the regexp when eventually intended for LaTeX.

The Elisp I use (and it works most of the time) is:

(setq outline-regexp
"^\\\\cha\\|^\\\\\\(sub\\)*se\\|^\\\\\\(sub\\)*paragraph)

try this and see.

'Scope