Article View: comp.text.tex
Article #12123Re: Q: Can Emacs make LaTeX files more readable?
From: Jaap Henk Hoepman
Date: Thu, 26 Jan 1995 09:41
Date: Thu, 26 Jan 1995 09:41
64 lines
3511 bytes
3511 bytes
alex@ccl.kuleuven.ac.be (Alex Schoenmakers) writes:
>Is this color-highlight a special package? If not, what is the command to
>get it (and try it out...)?
As I'm not sure whether the default installation of Emacs gives any useful
font-locking for TeX or LaTeX files, I'll tell how I installed it for Emacs
19.27. You will have to put the following lines into your .emacs file:
----- .emacs
; force loading of the font-lock package
(font-lock-mode 0)
; specify the colours and underlining of the different standard type-faces
; (In used colours because I really like the 9x15 fixed font which doesn't have
; sensible bold or italics)
(set-face-foreground 'bold "firebrick3")
(set-face-foreground 'italic "turquoise4")
(set-face-foreground 'bold-italic "blue")
(set-face-underline-p 'underline nil)
(set-face-foreground 'underline "blueviolet")
; bind the standard type-faces to the font-lock faces, some already have a
; sensible default
(setq font-lock-type-face 'bold)
; the following list specifies that strings matching one of the regular
; expressions should be rendered using the font-lock-...-face that follows it
(setq tex-font-lock-keywords
'(
("\\(\\\\\\(begin\\|end\\){[a-zA-Z0-9\\*]+}\\)" 1 font-lock-function-name-face nil)
("\\(\\\\\\(.\\|[a-zA-Z@]+\\)\\)" 1 font-lock-keyword-face nil)
("\\\\def[\\\\@]\\([a-zA-Z@]+\\)" 1 font-lock-function-name-face t)
("\\([^\\\\]\\|^\\)\\$\\([^$]*\\)\\$" 2 font-lock-string-face t)
("\\\\\\[\\(\\([^]]\\|^\\)*\\)\\\\\\]" 1 font-lock-string-face t)
)
)
; tell Emacs to use tex-font-lock-keywords for font-locking of TeX/LaTeX files
; you can add more settings you wish to take effect for TeX/LaTeX files only
(defun do-tex () (interactive)
(setq font-lock-keywords tex-font-lock-keywords)
)
; tell Emacs to do something special whenever you load a TeX or LaTeX file
(add-hook 'tex-mode-hook 'do-tex)
(add-hook 'latex-mode-hook 'do-tex)
----- end .emacs
If you've added these lines, quit emacs and start again. Then load a TeX
or LaTeX file and put the buffer in Font-Lock-Mode with the command
font-lock-mode. If you don't want to change your .emacs file immediately, just
turn on font-lock-mode and see whether the Emacs default installation suits
your needs.
Deep breath.... that's it. I hope this helps.
Jaap-Henk
--
Jaap-Henk Hoepman, jhh@cwi.nl, +31 20 5924078 | "Yes, we've eaten up the silver
CWI, P.O. Box 94079, 1090 GB Amsterdam | when even food was against us!"
URL: http://www.cwi.nl/cwi/people/Jaap-Henk.Hoepman.html | - Nick Cave
Technical Details
Message-ID:
<jhh.791113288@news.cwi.nl>Path:
arc1-ca.pugleaf.net!nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!gw1.att.com!fnnews.fnal.gov!uwm.edu!vixen.cso.uiuc.edu!howland.reston.ans.net!Germany.EU.net!EU.net!sun4nl!cwi.nl!news.cwi.nl!jhhReferences:
<3fp413$ld@decaxp.harvard.edu> <3g5gfu$g36@surz03.HRZ.Uni-Marburg.DE> <ALEX.95Jan25171217@verb.ccl.kuleuven.ac.be>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f9e16,39bee7ee240bd764 X-Google-Attributes: gidf9e16,public X-Google-Thread: 103b8b,39bee7ee240bd764 X-Google-Attributes: gid103b8b,public X-Google-ArrivalTime: 1995-01-26 01:41:28 PST Newsgroups: comp.text.tex,gnu.emacs.help Path: arc1-ca.pugleaf.net!nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!gw1.att.com!fnnews.fnal.gov!uwm.edu!vixen.cso.uiuc.edu!howland.reston.ans.net!Germany.EU.net!EU.net!sun4nl!cwi.nl!news.cwi.nl!jhh From: jhh@cwi.nl (Jaap Henk Hoepman) Subject: Re: Q: Can Emacs make LaTeX files more readable? Message-ID: <jhh.791113288@news.cwi.nl> Sender: news@cwi.nl (The Daily Dross) Nntp-Posting-Host: luis.cwi.nl Organization: CWI, Amsterdam References: <3fp413$ld@decaxp.harvard.edu> <3g5gfu$g36@surz03.HRZ.Uni-Marburg.DE> <ALEX.95Jan25171217@verb.ccl.kuleuven.ac.be> Date: Thu, 26 Jan 1995 09:41:28 GMT Lines: 65