Latte logo

Latte home

User manual

API manual



Latte News


Build notes



Latte examples

Plain text

In HTML, several common typographical symbols are "magic." If you want to include ", &, <, or > in your text, you must write them using special codes: &quot;, &amp;, &lt;, and &gt;. This tends to make your text hard to read, especially since the codes don't look anything like the characters they replace.

Latte's only magic characters are \, {, and }, which are far less common in ordinary text than HTML's magic characters are; and to include them in a document, you need only precede them with \.

Latte HTML
In "fish & chips," the "&" is between "fish" and "chips." In &quot;fish &amp; chips,&quot; the &quot;&amp;&quot; is between &quot;fish&quot; and &quot;chips.&quot;

Paragraph breaks

In HTML, every paragraph must begin with <p>, even though in most other contexts we only need to insert a blank line to denote a paragraph break. Thus it is easy to forget the <p> in some places where it's needed, causing paragraphs to run together confusingly.

Latte, on the other hand, allows you to separate paragraphs with a blank line as you're already accustomed to do.

Latte HTML
This is one paragraph.

This is another.

This is one paragraph.

<p>This is another.

E-mail addresses

The function \eaddr is defined and used on the Correspond page. It's for denoting clickable e-mail addresses. Here's a simple version of the function definition:

{\def {\eaddr \addr}
  {\tt <{\a \href={mailto:\addr} \addr}>}}

With this definition, here's how one can write `Send a message with the subject "subscribe" to <>':

Latte HTML
Send a message with the subject "subscribe" to {\eaddr} Send a message with the subject &quot;subscribe&quot; to <tt>&lt;<a href=""> </a>&gt;</tt>

Alternating colors

In the user survey form on the Download page, we use alternating background colors to visually distinguish the different questions. The basic HTML structure is this:

 <tr bgcolor="first color"> ... </tr>
 <tr bgcolor="second color"> ... </tr>
 <tr bgcolor="first color"> ... </tr>
 <tr bgcolor="second color"> ... </tr>

Rather than repeat those colors throughout the document, we define the colors in one place:

{\def \colors {first color
               second color}}

and then define a function, \next-color, that automatically alternates colors each time it's used. So the basic Latte structure is this:

 {\tr \bgcolor={\next-color} ...}
 {\tr \bgcolor={\next-color} ...}

and if we ever wish to change the color scheme, we only have to do it in one place. Also, inserting new questions in the middle of the survey won't mess up the alternation of colors; it'll just continue working.

Of course, this is Latte; even the simplified structure just described is more repetitive than necessary. So we defined another function, \survey-question, that automatically includes the setting of bgcolor (among other things). So the real structure is this:

 {\survey-question ...}
 {\survey-question ...}

This document was produced by Latte from the file examples.latte (with extra definitions from style.latte).

Copyright © 1998,1999 Zanshin, Inc.