Creating HTML Docs with EMACS at IU (Version 0.12)

Howdy! If you've made it here, you're probably interested in making an HTML document. An introduction to the HTML format is available if you really don't like EMACS. If you like (or at least don't detest) EMACS, this document just might help you use it to create HTML documents.

Here at IU, the definition of the HTML mode is located in:

/usr/local/gnu/emacs/lisp-local/html-mode.elc. If you're not at IU or you just want to see the latest html-mode elisp source, here is link to the elisp source code for HTML mode. Anyway, if /usr/local/gnu/emacs/lisp-local is in your load-path, then there should be no worries about finding the code for HTML mode. To find out if the load-path contains that directory, look at your .emacs file. If somewhere in that file, something like (setq load-path (append '(... "/usr/local/gnu/emacs/lisp-local" ...))) exists, there are no worries. Otherwise, add /usr/local/gnu/emacs/lisp-local to your load-path. Once, that is done, it's possible to set up emacs to automatically be in HTML mode if a file ends with a ".html" (the usual extension for HTML files). This can be done with: (setq auto-mode-alist (append '((...) ("\\.html$ . html-mode) (...)) auto-mode-alist)) somewhere else in your .emacs file.

If you have problems with the auto-mode-alist, you might want to do do an autoload of the HTML mode directly. You can do that with the following command (thanks to Joost Witteveen):

(autoload 'html-mode "html-mode" "Mode for HTML editing." t) This will work once the html-mode.el file is in your load-path. If you're still here, you've finished the hard part. Now for the easy part: making HTML documents. Right now, all we have is a list of HTML commands that HTML mode adds for you -- really soon now, this should be fleshed out with some handy-dandy descriptions and even an anchor or two.

Convention:

Following usual emacs convention, C-c x would be "Press control-c and then press x." In HTML mode, that would insert plaintext. Anyway, here's the list:
&		html-ampersand
>		html-greater-than
<		html-less-than
C-c		Prefix Command
TAB		tab-to-tab-stop

C-c C-r		Prefix Command
C-c &		html-real-ampersand
C-c >		html-real-greater-than
C-c <		html-real-less-than
C-c x		html-add-plaintext
C-c w		html-add-definition-entry
C-c n		html-strong-text
C-c e		html-emphasized-text
C-c t		html-add-title
C-c s		html-add-list
C-c p		html-add-paragraph-separator
C-c m		html-add-menu
C-c l		html-add-normal-link
C-c i		html-add-list-or-menu-item
C-c h		html-add-header
C-c g		html-add-graphic
C-c d		html-add-definition-list
C-c c		html-code-text
C-c b		html-add-blockquote
C-c a		html-add-address

C-c C-r r	html-add-reference-to-region
C-c C-r l	html-add-normal-link-to-region

List of HTML Mode Commands

C-c a
Open an Address element. An example of an address element is:
tloos@whale.cs.indiana.edu .
C-c b
Add a block quote.
This is an example of a block quote. It's not that pretty but it sure is blocky and I'm trying to stretch it out to see how blocky it gets...
C-c d
Open a definition list. The first entry is created for you. Add additional entries with C-c e. This list is an example of a definition list.
C-c e
Add a new entry inside of a definition list. See C-c d to open a definition list.
C-c h
Add a header. Emacs prompts for size (1 is biggest, 2 is next biggest). 3 is about standard size and 6 is the smallest available size. The following are size 1, 2, 3, 4, 5, 6, and 7 headers:

Big Header (Size 1)

A Little Smaller Header (Size 2)

A Smaller Header (Size 3)

A Small Header (Size 4)

A Tiny Header (Size 5)
A Really Tiny Header (Size 6)
This isn't supported (Size 7)
C-c i
Add a menu or list item, assuming you're already in a menu or list (i.e. at the end of the previous item) -- See C-c m to open a menu and C-c s to open a list.
C-c l
Add a link -- emacs prompts you for the URL (Universal Resource Locator) and then puts the cursor in the appropriate place to start typing the link name The word URL is a link to a description of the addressing format used by WWW.
C-c m
Open a menu. The first entry is created and the cursor is placed in the appropriate place to start entering in the item. Add additional entries with C-c i. The following is an example of a menu:
  • Menu Item 1: cheeseburgers.
  • Menu Item 2: road kill souffle.
  • Menu Item 3: aardvark pie.
  • C-c p
    Begin a new paragraph. Pretty straight forward...
    C-c s
    Open a list. The first entry is created for you. Add additional entries with C-c i. A list is a bullet list. Below follows an example of a list:
    C-c t
    Add a document title. Of course, emacs prompts for the document title.
    C-c x
    Add plaintext. The following is an example of plaintext: Isn't this text plain? Yeah, it's not that fancy text we've grown accustomed to...
    C-c C-r l
    C-c C-r l adds a link with the description in the current region. This is useful for really long link descriptions.
    C-c C-r r
    C-c C-r r adds a link with the URL given in the current region. This is useful for really long URLs.
    Misc.
    Since <, >, and & are special to HTML, C-c < is used to insert a <, C-c > is used to insert a >, and C-c & is used to insert a &. Just typing those keys (<,>, and &) inserts the codes that are required to have those characters displayed.

    Please feel free to send comments, suggested modifications or dirty jokes about this file to Tom Loos. And to go back to the CS Departmental Home Page, click here.