Structured Emacs |
|
Structured editing is a means of rationalising and ordering
your writing so that the structure of your document is taken care of
by the editor, leaving you freer to concentrate on the
content. Structured editors use markup to identify
the structure of your document (headings, paragraphs, lists etc),
similarly to the way used by some wordprocessors, but in a rational
and reusable form. The international standard for text markup is the
Standard Generalized
Markup Language (SGML), which is implemented for Emacs in
psgml-mode.
There are many different applications of SGML: some of the most popular are:
You should read a little more about SGML and how it works before starting to use structured editing, in order to get the maximum benefit from it. You should also read the documentation for the specific SGML application you plan to use.
There is a separate Reference Card for HTML available online.
The psgml-mode checks the syntax of SGML according
to the relevant Document Type Description (DTD), so it always knows
where you are in the document. This means you need to have a copy of
the relevant DTD for the application you are using. Your systems
manager should be able to provide a precompiled (.ced)
file for you.
Emacs is GNU software. The GNU project (it stands for `GNU's Not Unix') aims to provide a complete operating environment in a portable form, distributable free of charge.
There's an online tutorial you can use (once you have Emacs running) by typing ^h t (the ^ prefix means you hold down the Ctrl key while pressing the letter that follows).
psgml-modeProvided that psgml-mode has been installed
correctly on your machine, and if your filename ends in
.sgml or .html then Emacs should spot this
and load psgml-mode automatically. If this does not
happen, you can force any buffer to become SGML-sensitive by typing
ESC x sgml-mode RET
In order to recognise the component parts of your document,
psgml-mode needs access to the DTD. You must provide this
by making the first line of your document a DOCTYPE
statement in the form:
<!DOCTYPE type PUBLIC public-id>
or
<!DOCTYPE type SYSTEM directory/filename.DTD>
where
TEI.2', `HTML', etc;"-//IETF//DTD HTML//EN"; or/tlh/tei/p3/dtd/tei2.dtdExamples:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <!doctype html system "~/web/html.dtd"> <!DOCTYPE tei.2 SYSTEM "c:/tei/dtds/tei2.dtd">Note that on a PC system the directory separators must always be UNIX-style forward slashes, not DOS-style backslashes.
Emacs psgml-mode will read and parse the Document
Type Declaration the moment you type something which requires parsing
or validation. You can make it read the DTD first by typing
^c^p
Local (UCC) users on the WWW host can type
Once a DTD has been parsed and read correctly, you can make a
fast-loading version by typing ESC x
sgml-save-dtd RET and giving it a name ending with
.ced
This can be reloaded for subsequent sessions with this file or others by typing ESC x sgml-load-dtd RET and giving the name. This avoids having to wait for a lengthy parse if you use a long or complex DTD like the TEI.
The difference between structured editing and visual editing is that with structured editing you tell the system what kind of information you are about to type (or have just typed, or want to change), rather than how it is to appear when printed. This lets you uniquely and unambiguously define the component parts of your document entirely separately from their visual instantiation, so that your text becomes reusable, rather than tied to a specific manufacturer's proprietary view of how it `ought' to be. See Eliot Kimber's comments on public vs proprietary markup.
Doing this means you say `I want to start a new paragraph here' rather than `Break the line and indent 5 spaces'. The former describes the logic of what you want; the latter only tells you how it will look on one particular occasion. If you have ever written material for a publisher, you will have come across the problem of how to describe what you want in generic terms, when you don't yet know the actual design or style of typography to be used. SGML lets you do this without interfeing with your text in any way.
It does this by enclosing your text in tags, which are named items in angled brackets. The names are defined in the DTD you use, so this paragraph is actually stored as:
<p>It does this by enclosing your text in <dfn>tags</dfn>, which are named items in angled brackets. The names are defined in the DTD you use, so this paragraph is actually stored as:</p>
The elements of your text are thus sandwiched between a start-tag and an end-tag (the end-tag has a slash before the name to identify it as such). Note in the example above how a descriptive element (DFN: a definition of a new term) is identified within a P (paragraph) element. The degree to which elements can be nested inside one another is defined by the DTD: obviously you can't normally have a section heading (for example) beginning inside a paragraph.
All Emacs editing keys operate exactly as normal, with the following major additions. You can use completion on all element names: pressing TAB when being asked for the element name will display a list of all elements valid at this point.
To keep your files portable, you cannot use PC-specific or Mac-specific accent or other special characters. Instead, you use the international standard set of character names from the ISO Latin-1 and other lists, as defined in the DTD you are using.
For example, the ones valid for HTML are listed below. To write a name like René Füßli, you type:
René Füßli
Editing systems which understand SGML and HTML usually let you insert these naes from menus.
À À capital A, grave accent ï ï small i, diæresis/umlaut à à small a, grave accent Ð Ð capital Eth, Icelandic Á Á capital A, acute accent ð ð small eth, Icelandic á á small a, acute accent Ñ Ñ capital N, tilde   capital A, circumflex ñ ñ small n, tilde â â small a, circumflex Ò Ò capital O, grave accent à à capital A, tilde ò ò small o, grave accent ã ã small a, tilde Ó Ó capital O, acute accent Ä Ä capital A, diæresis/umlaut ó ó small o, acute accent ä ä small a, diæresis/umlaut Ô Ô capital O, circumflex Å Å capital A, ring ô ô small o, circumflex å å small a, ring Õ Õ capital O, tilde Æ Æ capital AE ligature õ õ small o, tilde æ æ small ae ligature Ö Ö capital O, diæresis/umlaut Ç Ç capital C, cedilla ö ö small o, diæresis/umlaut ç ç small c, cedilla Ø Ø capital O, slash È È capital E, grave accent ø ø small o, slash è è small e, grave accent Ù Ù capital U, grave accent É É capital E, acute accent ù ù small u, grave accent é é small e, acute accent Ú Ú capital U, acute accent Ê Ê capital E, circumflex ú ú small u, acute accent ê ê small e, circumflex Û Û capital U, circumflex Ë Ë capital E, diæresis/umlaut û û small u, circumflex ë ë small e, diæresis/umlaut Ü Ü capital U, diæresis/umlaut Ì Ì capital I, grave accent ü ü small u, diæresis/umlaut ì ì small i, grave accent Ý Ý capital Y, acute accent Í Í capital I, acute accent ý ý small y, acute accent í í small i, acute accent Þ Þ capital Thorn, Icelandic Î Î capital I, circumflex þ þ small thorn, Icelandic î î small i, circumflex ß ß small sharp s, German sz Ï Ï capital I, diæresis/umlaut ÿ ÿ small y, diæresis/umlaut
  non-breaking space ± ± ± plus-or-minus sign ¡ ¡ ¡ inverted exclamation mark ² ² ² superscript two ¢ ¢ ¢ cent sign ³ ³ ³ superscript three £ £ £ pound sign ´ ´ ´ acute accent ¤ ¤ ¤ general currency sign µ µ ´ micro sign ¥ ¥ ¥ yen sign ¶ ¶ ¶ pilcrow (paragraph sign) ¦ ¦ ¦ broken (vertical) bar · · · middle dot § § § section sign ¸ ¸ ¹ cedilla ¨ ¨ ¨ umlaut/dieresis ¹ ¹ ¹ superscript one © © © copyright sign º º º ordinal indicator, male ª ª ª ordinal indicator, fem » » » angle quotation mark, right « « « angle quotation mark, left ¼ ¼ ¼ fraction one-quarter ¬ ¬ ¬ not sign ½ ½ ½ fraction one-half ­ ­ soft hyphen ¾ ¾ ¾ fraction three-quarters ® ® ® registered sign ¿ ¿ ¿ inverted question mark ¯ ¯ ¯ macron × × × multiply sign ° ° ° degree sign ÷ ÷ ÷ division sign