Tutorial

Under construction, a long, long way from being useful. Right now this is mostly just notes to myself about topics I don't want to forget to cover.

Commands

Just as in TEX, a backslash followed by alphanumeric characters is a command:

\command

Also like TEX, an argument can be supplied to a command by surrounding it with curly braces and putting it immediately after the command (no whitespace).

\command{argument}

To supply multiple arguments, use square braces for all but the last argument.

\command[arg1][arg2][arg3]{argument}

What should round braces mean?

\command(arg1){argument}

Should we allow whitespace after commands for spacing purposes?

\command
    (arg1)
    (arg2)
    {argument}

Tokens

There are several places where WIX interprets two tokens differently if they are separated by whitespace. For example, a set of curly braces after a command is considered an argument to the command if there is no intervening whitespace:

\command{argument}

Adding whitespace prevents WIX from interpreting the curly-braced text as an argument:

\command {not-an-argument}

However, this will also cause whitespace to appear between the command and the argument in the output. Sometimes this is not desirable; for example, consider the euro symbol:

\euro 3.20

This is rendered as “€ 3.20” (note the space). If we want to typeset the “€” immediately adjacent to the “3” in order to get “€3.20” we cannot include whitespace there.

In this situation – and any other situation where you want to separate two tokens but not introduce space in the output – the solution is to use a pair of empty braces:

\euro{}3.20

You can think of the empty brace pair as being “a whitespace of width zero”.

Another alternative is to put curly braces around the command

{\euro}3.20

Links

In WIX, you can add a link to any atom by putting the characters -> and a url after it, like this:

Only the word link->http://www.megacz.com will be a link.

Note that you can leave whitespace after the arrow – but not before it. This makes the paragraphs in your source code fill more easily (for example, with emacs' fill-paragraph command).

WIX is pretty smart about figuring out where your url ends and the text begins again – it will try to build the longest valid url it can, but it will also try to avoid getting punctuation “stuck” on the end of an url. For example, if you type this:

I like apples->http://wikipedia.org/apples, oranges, and pears.

The url http://wikipedia.org/apples, (note the comma) is technically a valid url. However, most of the time when you type something like this, you probably didn't intend for the comma to be part of the url. So, WIX has special grammar rules that tell it to try to avoid including trailing punctuation in urls.

If you really mean for an url to have trailing punctuation (some do), just put curly braces around the url:

I like apples->{http://wikipedia.org/apples,} oranges, and pears.

You can also use curly braces to have a link span multiple words:

I like {apples, oranges, and pears}->{http://wikipedia.org/fruit}

Also, wherever an url is allowed to appear, you can include a bare email address (ie without the usual mailto: prefix):

Send me->adam@megacz.com some email!

WIX parses urls very strictly – its grammar includes a complete copy of the RFC1738 URL grammar. You'll sometimes find that urls you cut and paste from elsewhere are invalid – usually because they include characters that are technically illegal in urls, like @. Unfortunately at the moment you'll need to escape those characters by looking up their hexadecimal ASCII code and writing them in url-escaped form (for example, %40 for @). You also need to replace spaces with plus (+) characters.