

                            ZapENH 1.31 (28 Dec 1995)
                    Copyright  Elliott Hughes, 1994 - 1995



--------------------------------------------------------------- Introduction
                            (Yeah, I've got ZapENH, so what's it do for me?)

ZapENH provides a LaTeX syntax-colouring mode and several new commands for
use with Dominic Symes' Zap text editor.  Most of the facilities will only
be of interest to those people who use LaTeX, but if you skip down to the
commands section, you might find something to entice you...



----------------------------------------------------------------- LaTeX mode
                                  (Why shouldn't I keep on using text mode?)

LaTeX mode is first and foremost a syntax-colouring mode.  This means that
characters with special meaning are coloured in a way that helps distinguish
them from ordinary text.

As you know if you're a TeX user, TeX treats $, &, %, #, _, {, }, ~, ^ and \
as special characters.  The % is used to begin a comment (and is coloured as
part of the comment).  The \ begins a control sequence (coloured as part of
the control sequence).  This leaves $, &, #, _, ~, {, } and ^ which are
LaTeX mode's special characters.  These special characters are all given
the same colour.

So there are four things that LaTeX mode can distinguish: normal text,
commands, comments and special characters.  These can each be given a
separate colour, but (as the default colours demonstrate) this isn't a
necessity.

LaTeX mode also performs simple bracket matching.  At the moment, it isn't
as good as Bryan Scattergood's CMode, so if $ matching is important to you
and colouring isn't -- here we part.  LaTeX mode matches the bracket pairs
{,}; [,]; (,); $,$; and $$,$$: when you type a closing bracket (from that
list) the caret jumps back to the relevant opening bracket.  The time for
which the caret remains at this opening bracket can be set from LaTeX mode's
submenu (off the Mode menu).  This delay is saved with Zap's other options
in the !Config file if you choose Save options from the Options menu.
If it hits the start of the file without finding a matching bracket, it'll
beep to let you know.

LaTeX mode is quite sensible when it comes to moving around a word at a
time in your document. Compound words (that's to say commands) are treated
as a collection of components, rather than as a single word. Try text mode
for comparision: it's easier seen than described.

Finally, LaTeX mode offers compile & save (and all the related functions).
There are two modes of operation. The simple mode checks the filetype of
the file you're editing. If it's a TeX or LaTeX file (using armTeX
filetypes), then the file will appear to have been double-clicked. If it's
any other type, LaTeX will be run with the filename as an argument.
The alternative mode is used if the first few characters of the file are
%main= then the characters following the = are used as the name of the file
to be double-clicked. This allows you to either LaTeX a root file
that \inputs the file you're editing, or to run any program you want.



------------------------------------------------------------------- Commands
                          (I'm not impressed so far... Is that all it does?)

ZapENH also provides the following commands.  These can be executed by
pressing Ctrl-Esc (with the default keymap); by adding them to your keymap;
or by putting them on a menu.  See the main Zap documentation for information
on doing those things.


LATEX_ENVIRONMENT <string>

This command allows you to insert an environment into your document with the
minimum of typing. If it's executed without a string argument, it opens the
minibuffer so that you can enter an environment name. Once it has a string,
it inserts the text:

\begin{<string>}
[]
\end{<string>}

where [] represents the final position of the caret.


LATEX_NEXTSECTION
LATEX_PREVSECTION

These commands move the caret to the the start of the next or previous
section respectively.  They are useful for quickly skipping through a large
LaTeX document.


LATEX_QUOTE

This command tries to insert the correct LaTeX-style quotes at the cursor.
As you know, the " character isn't much used by TeXperts.  This command can
be bound to the " key in an alternative keymap and will do its best to type
what you meant to type.  If the character before the cursor is whitespace or
an opening brace, `` will be inserted.  If the character is a backslash, "
is inserted instead.  Otherwise, '' is inserted.  Try it, and you'll be
surprised how well it works.


IMPRESSIONSPELL_SELECTION
WORDWORKS_SELECTION

These two commands send the current selection to either Impression Spell (in
which case a beep is heard if the word isn't known) or WordWorks (in which
case the word will be looked up). If Impression Spell or WordWorks aren't
loaded when their commands are called, an error is reported.


EVAL <string>

This command evaluates its string with OS_Evaluate, and inserts the result
at the cursor position.  It's useful if you can't remember 512*32 but need
it in a comment: EVAL 512*32 inserts the answer, 16384, into your file.
If you bind EVAL to a key, that key shortcut will open the minibuffer with
the prompt Evaluate:.


ISPELL

This command calls ISpell to check the current file. Note that it does NOT
save the file first. If you want that behaviour, use QUICKSAVE:ISPELL to
save the file before calling ISPELL.


WC

WC counts the number of words in a file. If called as a command, it opens a
window containing the number of words, centred on the pointer. If attached
to a menu, it provides the same window as usual, but as a submenu. The
method used for counting words is (as far as I can tell) the same as that
used by Impression Publisher: it's not terribly accurate, but it's pretty
nippy.  (The name, rather than being an obscure reference to a toilet, is
that of the UNIX utility that counts words.)



-------------------------------------------- Known bugs and missing features
              (You're telling me I haven't used it and it's already broken?)

Don't be surprised if colouring doesn't work properly on wrapped lines.  I
don't notice this limitation because I press Return whenever the cursor gets
near 80 columns, or use linewrap mode.  That said, I promise to fix this
eventually.

LaTeX mode doesn't stop you changing the tab mode (which can spoil the
display: only tab mode 'none' is catered for).  A similar problem to the
wrapping: I don't use tabs in LaTeX source, so I didn't notice.  Indeed,
unless you go looking for this fault, you'll probably not notice either.
LaTeX mode will hide this from you by overriding the effect of pressing
tab. Tab in LaTeX mode always enters four spaces.

The upside-down ! and ? (!` and ?`) are not coloured as command symbols.  Is
this correct or not?  They're punctuation really, so I think they should be
coloured like all the other punctuation symbols.  I shalln't fix this until
someone who writes Spanish with LaTeX asks me to!

The following commands were unfinished at the time of writing, and haven't
been tested properly.  So you can't have them yet!

 IMPRESSIONSPELL_WORD / WORDWORKS_WORD
 These two commands send the word at the cursor to either Impression Spell
 (in which case a beep is heard if the word isn't known) or WordWorks (in
 which case the word will be looked up). If Impression Spell or WordWorks
 aren't loaded when their commands are called, an error is reported.

 CRLF
 Convert line feeds (0x0a) to carriage returns (0x0d) and back again.

I also keep meaning to provide a list of functions facility that produces
a throwback window containing a mock table of contents (ie all the
sectioning commands).



------------------------------------------------------------------ Copyright
                        (Pria tossendo, poi sedendo, \\ Clara voce legger.)

The conditions of copying this program and its associated documentation are
the same as those of the main Zap application, except you do not need my
permission to copy it if you have Dominic's.



----------------------------------------------------------- Acknowledgements
                     (I'd like to thank my agent, my director, my family...)

I'd like to thank Dominic Symes for writing Zap and for helping me to write
this module, even though I repeatedly ignored or misread the documentation.

I'd also like to thank Martin Ebourne (author of ZapMJE).  He helped me
transfer from the BASIC assembler and allowed me to examine the source to
ZapMJE -- those parts of ZapENH that weren't copied straight from ZapMJE
were often rewritten after seeing ZapMJE.  (The bracket matching that works
properly is essentially the bracket matching from ZapMJE's C mode.)  The
assembler mode was invaluable to me while writing ZapENH and other programs:
ZapMJE's assembler and C modes were the main reasons I moved to using Zap in
the first place.  ZapMJE also solved the difficult problem of what I should
call my module ;-)

If you don't find many bugs, then you too will want to thank Uli Schwanecke
for testing many versions of ZapENH and for suggesting several of the
features I've come to find very useful. Paddy Spencer also suggested
several improvements to ZapENH after it was released. Ah well: look at it
this way -- if this was a Microsoft product, you'd be paying for the fun of
finding faults. I make mistakes for free.

Thanks must also go to Donald Knuth for writing TeX in the first place, and
to Leslie Lamport whose LaTeX macros have done much to popularise TeX.

Last, and unquestionably least, the writing of this program was made
possible by the funding of the Mum & Dad Hughes Research Council.



-------------------------------------------------------------- Contacting me
                                    (It doesn't work, stupid! Do something!)

If you want to report a bug or suggest an enhancement, I can be contacted by
electronic mail as:

  enh-a@minster.york.ac.uk

This will be valid until at least June 1997, although I'm in Basel,
Switzerland until at least July 1996.
