Sams Teach Yourself Emacs in 24 Hours |  | ContentsIndex
Hour 17: Editing LaTeX/HTML Files |  | Previous HourNext Hour
Sections in this Hour: |  |

## Hour 17
Editing LaTeX/HTML Files

Although a text editor such as Emacs is most often used for writing and editing plain text, many people also use it to write specialized forms of text which are not intended to be read in their raw state. This sort of file, known as marked-up or tagged text, is intended to be interpreted by a separate program and then displayed in a form which is suitable for high-quality printing or viewing. The two most commonly used formats are HTML and LaTeX.

HTML files are the format in which Web pages on the WWW are written (as well as documentation for some software). LaTeX is a set of macros which makes Donald Knuth's TeX markup language easier to work with; after processing with the freely available TeX tools, the marked-up file is eventually transformed into a PostScript file which can be printed or viewed. When Emacs is used with these markup languages it becomes a sort of middle-ground between editors and word processors, with the advantage that control of the appearance of the output file is limited only by the amount of time you are willing to spend learning the many options available. In general TeX and LaTeX are preferable for long documents and academic papers, especially scientific, mathematical, and book-length works. HTML is increasingly being used for general documents not necessarily intended for the World Wide Web, but in comparison to TeX and LaTeX its formatting capabilities are limited.

## HTML and Emacs

A common misconception is that HTML is a difficult and obscure programming language, used in its raw form only by skilled programmers. HTML, in fact, is merely a text markup language. The text in an HTML file is just like any other text; the only difference is that markup tags surround various words, paragraphs, and sections of the text. Tags are set off from the text in the document by angle brackets (< >). The tags are the instructions used by a Web browser to display text in specific ways. As an example, the tag which indicates a boldface word or phrase would look like this:

    <b>This sentence would be shown in a Web browser in a bold font.</b>

Although many commercial HTML editors are available, most of them hide the actual structure and tags of the document and often create HTML files which are difficult to read with other tools. Tags can be cumbersome to type, but using them directly gives the writer maximum control of the HTML file's eventual appearance in a browser. Another approach to inserting tags is to make them easier to type rather than hiding them. Hotkeys and mouse-selected menu items can be used to insert tags, which are the methods used by Emacs.

With Emacs, you can cut or copy text from other files to include in your HTML file or browse directories on your computer's hard disk. You can even upload the completed HTML file to a directory on your Internet service provider's (ISP) machine.

GNU Emacs and XEmacs both come with specialized modes for writing HTML. Because the two Emacs variants have markedly different HTML modes, a separate section has been devoted to each.

With a little practice, writing HTML with Emacs can be quick and easy, and as a bonus you will become familiar with HTML rather than relying upon a program to know it for you.

Sams Teach Yourself Emacs in 24 Hours |  | ContentsIndex
Hour 17: Editing LaTeX/HTML Files |  | Previous HourNext Hour
Sections in this Hour: |  |

© Copyright Macmillan USA. All rights reserved.