Previous Next


Unpack the archive in any directory. Set environment variables correctly. They are:

should point to TEItools directory. For example, if you've unpacked archive in /usr/local/lib, then SGML_HOME should be set to /usr/local/lib/TEItools.

should contain your locale name. Make sure there is corresponding locale file in $SGML_HOME/lib. If there is not, create one by making a link to an existing one or by writing your own by example in case TEItools does not support your language yet.

don't set this unless you are debugging TEItools.

if set, nsgmls is not used, internal XML parser is used instead.

nsgmls, costsh and $SGML_HOME/bin should be in your PATH. Go to src directory, and issue make install to compile xpm2rtf.

If you operate WWW server, you can serve TEI Lite documents without explicit conversion to HTML. I've included sample CGI shell script, tei2html.cgi, which should be configured to run when user requests TEI files. For the Apache web server, add the following to srm.conf:

AddType application/x-tei .tei
Action  application/x-tei /cgi-bin/tei2html.cgi

and put tei2html.cgi in the appropriate cgi-bin directory.

Psgml tuning

Add the following to your ~/.emacs:

(load-library "psgml")

(setq sgml-catalog-files 
  (append sgml-catalog-files 
          (list (concat (getenv "SGML_HOME") "/dtd/catalog")))
	("TEI Tools" 
         "<!doctype tei.2 public '-//TEI//DTD TEI Tools 0.1//EN'>" 

If you use 8-bit characters, and don't want them to be represented as ISO 8859-1 entities, like if you're writing in Russian charset, then your ~/.emacs should contain this, too:

(add-hook 'sgml-mode-hook 
          '(lambda ()
             (setq write-file-hooks (delete 'fix-iso2sgml write-file-hooks)
                   find-file-hooks (delete 'fix-iso2sgml find-file-hooks)

If you don't like to wait while psgml parses DTD, do the following:

(add-hook 'sgml-mode-hook
          '(lambda ()
	     (let ((ced-file-name 
		    (concat (file-name-sans-extension (buffer-file-name)) 
	       (if (file-readable-p ced-file-name)
		   (sgml-load-dtd ced-file-name)
		 (sgml-save-dtd ced-file-name)

If you like to see TEI markup colorized in psgml, do the following:

(make-face 'tei-head-1-face)
(set-face-foreground 'tei-head-1-face "dark green")
(set-face-font 'tei-head-1-face  
(make-face 'tei-head-2-face)
(set-face-foreground 'tei-head-2-face "dark blue")
(set-face-font 'tei-head-2-face  
(make-face 'tei-head-3-face)
(set-face-foreground 'tei-head-3-face "dark green")
(set-face-font 'tei-head-3-face  
(make-face 'tei-head-4-face)
(set-face-foreground 'tei-head-4-face "dark blue")
(set-face-font 'tei-head-4-face  
(make-face 'tei-head-5-face)
(set-face-foreground 'tei-head-5-face "brown")
(set-face-font 'tei-head-5-face  
(make-face 'tei-emph-face)
(set-face-font 'tei-emph-face  
(make-face 'tei-title-face)
(set-face-font 'tei-title-face  
(make-face 'tei-eg-face)
(set-face-font 'tei-eg-face  
(make-face 'tei-label-face)
(set-face-foreground 'tei-label-face "dark cyan")
(set-face-font 'tei-label-face  
(make-face 'tei-item-face)
(set-face-foreground 'tei-item-face "dark cyan")
(set-face-font 'tei-item-face  
(make-face 'tei-note-face)
(set-face-font 'tei-note-face  
(make-face 'tei-quote-face)
(set-face-font 'tei-quote-face 

(add-hook 'tei-mode-hook
 '(lambda ()
     ("<div1[^>]*><head/[^/]*/"	. tei-head-1-face)
     ("<div1[^>]*><head[^>]*>[^<]*</>"	. tei-head-1-face)
     ("<div1[^>]*><head[^>]*>[^<]*</head>"	. tei-head-1-face)
     ("<div2[^>]*><head/[^/]*/"	. tei-head-2-face)
     ("<div2[^>]*><head[^>]*>[^<]*</>"	. tei-head-2-face)
     ("<div2[^>]*><head[^>]*>[^<]*</head>"	. tei-head-2-face)
     ("<div3[^>]*><head/[^/]*/"	. tei-head-3-face)
     ("<div3[^>]*><head[^>]*>[^<]*</>"	. tei-head-3-face)
     ("<div3[^>]*><head[^>]*>[^<]*</head>"	. tei-head-3-face)
     ("<div4[^>]*><head/[^/]*/"	. tei-head-4-face)
     ("<div4[^>]*><head[^>]*>[^<]*</>"	. tei-head-4-face)
     ("<div4[^>]*><head[^>]*>[^<]*</head>"	. tei-head-4-face)
     ("<div5[^>]*><head/[^/]*/"	. tei-head-5-face)
     ("<div5[^>]*><head[^>]*>[^<]*</>"	. tei-head-5-face)
     ("<div5[^>]*><head[^>]*>[^<]*</head>"	. tei-head-5-face)
     ("<emph/[^/]*/" . tei-emph-face)
     ("<emph[^>]*>[^<]*</emph>" . tei-emph-face)
     ("<emph[^>]*>[^<]*</>" . tei-emph-face)
     ("<hi/[^/]*/" . tei-emph-face)
     ("<hi[^>]*>[^<]*</title>" . tei-emph-face)
     ("<hi[^>]*>[^<]*</>" . tei-emph-face)
     ("<title/[^/]*/" . tei-title-face)
     ("<title[^>]*>[^<]*</title>" . tei-title-face)
     ("<title[^>]*>[^<]*</>" . tei-title-face)
     ("<eg[^>]*>[^<]*</>" . tei-eg-face)
     ("<eg[^>]*>[^<]*</eg>" . tei-eg-face)
     ("<code/[^/]*/" . tei-eg-face)
     ("<code[^>]*>[^<]*</>" . tei-eg-face)
     ("<code[^>]*>[^<]*</code>" . tei-eg-face)
     ("<kw/[^/]*/" . tei-eg-face)
     ("<kw[^>]*>[^<]*</>" . tei-eg-face)
     ("<kw[^>]*>[^<]*</kw>" . tei-eg-face)
     ("<label/[^/]*/" . tei-label-face)
     ("<label[^>]*>[^<]*</>" . tei-label-face)
     ("<label[^>]*>[^<]*</label>" . tei-label-face)
     ("<note/[^/]*/" . tei-note-face)
     ("<note[^>]*>[^<]*</>" . tei-note-face)
     ("<note[^>]*>[^<]*</note>" . tei-note-face)
     ("<item/" . tei-item-face)
     ("<item[^>]*>" . tei-item-face)
     ("<q/[^/]*/" . tei-quote-face)
     ("<q>[^<]*</>" . tei-quote-face)
     ("<q>[^<]*</q>" . tei-quote-face)
     ("<socalled/[^/]*/" . tei-quote-face)
     ("<socalled>[^<]*</>" . tei-quote-face)
     ("<socalled[^>]*>[^<]*</socalled>" . tei-quote-face)
     ("<term/[^/]*/" . tei-eg-face)
     ("<term[^>]*>[^<]*</>" . tei-eg-face)
     ("<term[^>]*>[^<]*</term>" . tei-eg-face)
(defun tei-mode ()
  (run-hooks 'tei-mode-hook)
  (font-lock-mode 1))

(defun docbook-mode ()

(setq auto-mode-alist
        '("\\.tei$" . tei-mode))

Of course, choose fonts and colors according to your taste.

Previous Next

Last modified: 19 18:09:48 MSK 2004
Produced by TEItools