# Tralics: All commands, non-letters

This page contains the description characters of catcode 0, catcode 1, catcode 2, catcode 3, catcode 4, catcode 5, catcode 6, catcode 7, catcode 8, catcode 9, catcode 10, catcode 11, catcode 12, catcode 13, catcode 14, catcode 15, catcode 16.

It contains also the description of ~, \~, \$, \%, &, \&, \!, \,, \>, \;, \{, \}, $$,$$, \_, \#, \|, \\, |, [ $, ]$, (, ), <, >, ', \', \", \=, \., \^, \, \ , - \-, *, \@, \/. It contains the description of the following commands: \@mathbb, \@mathbf, \@mathcal, \@mathit, \@mathrm, \@mathsf, \@mathtt. The following definitions will be used here: \def\testeq#1#2{\def\tmp{#2}\ifx#1\tmp\else \toks0={#1wantd: ->#2.} \typeout{\the\toks0}\show #1\uerror\fi} \def\xtesteq#1#2{\xdef\tmp{#2}\ifx#1\tmp\else \toks0={#1wantd: ->} \typeout{\the\toks0 #2.}\show #1\uerror\fi}  This can be used as \def\foo{something} \testeq\foo{Something else}  and will produce no XML, but an error and two lines of message, like \foo wantd: ->Something else. \foo=macro: ->something. Error signaled at line 352: Undefined command \uerror.  Note the following points. Both \typeout and \show print the value on the tty as well as the transcript file. The token list of \typeout is fully expanded, and for this reason, we put in a token list the quantity #1wantd: ->#2. and inhibit expansion via \the. # The symbols, by catcode Unless stated otherwise, a category code (in short a catcode) is an integer between 0 and 15. It is a property of input characters, used by the scanner to convert the input stream into a sequence of tokens. The character with ASCII code 37 is the character %, and is normally of category 14, thus behaves like a start-of-comment. You can insert such a character in the XML output via the sequence \char37 (However \char60 produces &lt;, see the \char command). In most of the cases, a character of catcode c is read as a command with command code c. Tralics uses the same parsing rules as TeX, with the exception of characters of category 16 (see below), and the fact that the character range is not limited to 8bit characters (but a command name can contain only iso-8859-1 characters). ## Catcode 0 The only character with catcode 0 is the backslash. This character is used to construct command names. The number 0 is not a command code. The command name is created as follows: if the next character is not of category 11, the name consists of the single character, and Tralics goes into state S if the character is a space, state M otherwise; if the character is of category 11, the name consists of all characters category 11 starting with the current one, and Tralics goes into state S. The first unused character will be read again later, and a category code assigned to it. Normally, spaces after command names are ignored because the current state S and the category code of the space character is 10. But the command can change the category code of the character that follows. The following example shows how to change the \catcode of the letter x, so that x can be used like a backslash. In the second definition, there is no space between the digit zero and the letter x. This letter is scanned, found to be a non digit, and pushed back in the main token list; at this moment, the catcode is still unchanged, xfoo is considered as a string of four letters, and not a command.  {\def\foo{\gdef\bar{OK}} \catcodex=0 xfoo} \testeq\bar{OK} {\def\foo{\gdef\bar{notOK}} \catcodex=0xfoo} \testeq\bar{OK}  The next example shows that the token after a control sequence like \foo can be of catcode letter (because when the character is read again, its catcode is analysed again). {\def\bar#1{\egroup\show#1} \def\foo{\bgroup\catcode32=11\catcode\%=11 \bar}\foo \foo%\foo=\foo$\foo#}


In the Tralics output below, the letter' means a character of category 11, the character' a character of category 12. than the TeX output:

the letter  .
the letter %.
the character =.
</p>


Preview:

# Mono-letter commands

## ~

(tralics version 1 description: The ~ character is a normal character, but translates into a non-breaking space. Of course, the result is a tilde in verbatim mode, and a mathematical space in math mode.) Example:

Test tilde:~\verb=~=$a~b$.
\href{\url{a~b\~c}}{some url}


The XML translation is

Test tilde:&nbsp;<hi rend='tt'>~</hi><formula type='inline'>
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow><mi>a</mi><mspace width='1em'/><mi>b</mi></mrow>[/itex]</formula>.
<xref url='some url'>a~b~c</xref>


Note how ~ and \~ are handled by the \url command.

In the current version of Tralics, the tilde character is active and defined as \def~{\nobreakspace}. The only purpose of the change is to make the following example work (it is file xii by David Carlisle).

\let~\catcode~76~A13~F1~j00~P2jdefA71F~7113jdefPALLF

## (, $$The ( command can be used as a math delimiter. See description of the \vert command. The expansion of \( is . It means: start inline math' but Tralics does no check. ## ),$$

The ( command can be used as a math delimiter. See description of the \vert command.