# + MicroEMACS LaTeX Interface.

MEWLaTeX Version 1.0,  January 10,1993.
Michael F. Reid <mfreid@hkuxa.hku.hk>
From April 1993: <mfr@phys.canterbury.ac.nz>

This is an attempt at a MicroEMACS interface for preparing LaTeX documents under MicroSoft Windows (mewin). It consists of a LATEX.CMD file and a number of auxiliary files. 

Please tell me about any inaccuracies in the macros or the documents. The details of the implementation can be easily adjusted if you have some good suggestions. 

0. TeX-helpful modifications to mewin. 

There are  five major headings under the TeX menu item.:

1. LaTeX Input.  		to assist in preparation of LaTeX files
2. BibTeX Input.		to assist in preparation of BibTeX files
3. Execute. 		to run LaTeX processes
4. Debug. 		to locate errors automatically
5. Help. 		help on LaTeX, this interface, and installation

# + 0. TeX-helpful modifications.

Some additions and modifications have been made. Some are personal preferences, some are to mewin work reasonably nicely with TeX files, and some are to make mewin behave a little more similarly to gnu emacs. 

Wrap mode and "C Indentation" are automatically used on .tex and .bib files. 

The "mark" (see mewin help) can be set using the gnu keystroke Control-@, which of course, requires you to press both Control and Shift keys at the same time! 

The point is left in place after a file insert. This is more like gnu emacs.

The Insert key toggles over-write mode. 

Control-Delete deletes blanks up to the next non-blank or end-of-line.

Read about the mouse interface in the mewin help. You can cut and paste with just mouse strokes. 

The characters "\" and "%" are considered to start a paragraph, so that you don't get your equations reformatted (Esc-Q or "Edit>Paragraph>Fill"). 

A backup-save option on the file menu (M-S keystroke) creates a backup file. If your original file was x.y the backup is x.~y. This is clumsy, as it has to run a DOS batch file to do it (del x.~y, rename x.y x.~y).

An "Edit>Date" item is added, which puts the current time and date into your file at the current point. 

An "Edit>Region>To Clipboard" item is added, which copies the "region" to the Windows clipboard. 

A "Spell>Buffer" menu item is added, to run a spell-checker on your file. If you want to read in the corrections, you have to wait for the DOS program to finish, then press enter. If you type "n" then enter, the modifications will not be read. 

Note the goto-matching-fence (Esc-Control-F or under the "Search>Goto" menu), which matches brackets (but not $ signs).  

# + 1. LaTeX Input.

In some cases the menu items give you an explicit input, such as a pair of brackets, but in other cases the options are displayed on the screen, and you have to move the cursor to the option you want (by mouse or position keys), and then press enter. Or you can type the option. Pressing enter without moving the cursor, or pressing Control-G, aborts the process. The layout of the math symbols is similar to the Character Set Help. 

Some of the bracketing commands are more likely to be accessed by keystroke. The key bindings appear on the menus automatically. Since you may want to change these, I will not spell them out here. 

Templates. Here you use mouse or arrow keys to point the cursor at the item you want (document, letter, REVTeX template, etc) and the appropriate file is included in your file. . Adding extra items would be easy. 

Headings. Similar to templates. Creates \section{}, etc. 

Environments. Allows you to pick an environment. The \begin{env} \end{env} pair is created, and you are positioned in between. If the environment is known to have more arguments, space is created for those,  e.g. \begin{tabular}{lcr} \end{tabular}.

Math Environments. Brackets around math mode. 

Brackets. Creates a pair of brackets, e.g. {}, with the point positioned between. 

Text.
	Accents
	Special Symbols
	Foreign Symbols

Math.
	Super/Subscripts
	Variable Brackets
	Accents
	Greek
	Binary Operators
	Relation Symbols
	Arrow Symbols
	Miscellaneous
	Log Like
	Delimiters
	Variable Symbols (\sum, \int, etc)
	Over and Underline

Miscellaneous. Pick an item and it will be copied into your file. 

# + 2. BibTeX Input.

Templates. Pulls in a file with the necessary entries for each type of citation. i.e.
	@BOOK{,
  	 author="", 
 	 ...
	} 
 Note that I include an "annote" field. The bibliographystyle annotation.bst (available at TeX archives) will print out this field, so that is a handy place to put comments. 

Clean BibItem. Takes out all the blank items, i.e. lines with a pair of double quotes  (""). This is quite crude, and relies on the template format. 

Clean BibFile. Cleans the whole file. 

Sort BibFile. Sorts the entries by citation key, which is crude. Better sorting.programs are available. The sorting is rather slow for a large file, but it seems to work. Note that there seems to be no way of interrupting this, but you can close down the mewin process! 

# + 3. Execute.

The items under this menu (which you may want to rearrange to suit you local setup) allow you to run TeX, LaTeX, previewer, printer driver, PostScript previewer, BibTeX, and MakeIndex. In my setup all, apart from dvimswin, run in DOS boxes. The principle is the same for each executable. You are prompted with a default file name, which stays in force until you clear it using the last sub-menu item (Clear Filename). This allows you to edit several "\include" files and continue to process the "master" file. However, please note that when you invoke these programs, they run in the directory of the file in the current edit window!  

# + 4. Debug.

Read Logfile. Reads in the relevant logfile to allow you to examine the errors.

Find Next Error. Searches for the next LaTeX error, and tries to put you in the erroneous file at the right place. Of course, this makes no sense unless it is a LaTeX log file! This is rather slow. Note that you should kill off any automatically generated files (like .aux, .bbl) after this process. Also, if you didn't save all the files first, you may not be looking at the correct place. 

# + 5. Help.

LaTeX  Commands. 
Search LaTeX Commands. 
These run a help file that was ported from VMS to Windows, so some aspects are a little clumsy. For many topics the same information appears in two places, once under the general headings such as Environments, and again under an alphabetical listing. Each topic is numbered to help you keep track. However, it is a real WinHelp file. Note that you can search for any \command with or without the \.

Character Set. Runs the dvi-viewer on a file containing standard math
characters. 

TeX Information. The idea of this is to allow easy loading of TeX FAQ documents or other useful information. This will require modification for your local setup. 

MicroEMACS Interface. Gives you this help file. 

MicroEMACS Installation. Displays the mewlatex.txt installation guide.