## 9  TEX command definitions and other extensions

### 9.1  Delimited-parameter macros and Conditionals

Delimited parameter definitions are fully supported. However, macros in some style files are written in such a way that the recognition of the delimited parameter depends on other TEX behaviour (e.g. dimensions) that are not supported or handled differently by TTH. In such cases it is all too possible for the delimited parameter not to be matched, resulting in a runaway argument situation. Thus, delimited parameter macros are especially dangerous when using TTH, or indeed any process other than TEX itself. (And they are never exactly "safe TEX"). The recognition of these definitions can be disabled using the -d switch, in which case the definitions are simply discarded.
Conditionals such as \if, \ifnum and so on are supported, as listed above (1.1.2). In TTH they have one syntax limitation. Further if' commands are not permitted in, or as part of a command expanded in, the tokens, characters, or numbers being tested. Thus, an example of truly perverse usage such as
\ifnum 1=\if ab 1\else 2\fi  True \else False \fi
will likely break. Nested if' constructs are permitted in the conditional text, however, so
\ifnum 1=1 True\if ab -true\else -false\fi \else False \fi
is fine. Because TTH does not internally resemble TEX, whereas the result of conditionals such as \if and \ifx may depend on internal representations, there cannot be 100% compatibility of such tests at the lowest level. Still, tests on externally defined commands ought generally to give correct results. When authoring documents in TEX one is generally well advised to avoid conditionals.
Although TTH supports a remarkably complete subset of LATEX, it does not support all of the complicated primitive details of TEX, partly because that would be unnecessary. For example, practically any TEX that redefines category codes (other than @ which TTH treats universally as a letter) will break because TTH knows nothing about the concept of category codes. (If you don't know much either, about this unfortunate aspect of TEX, join the vast majority of TEX users!) A related example is that TTH expects only letters or @ in user-defined command names, not punctuation characters etc.

### 9.2  Macro- and Style-file inclusion

Macro definitions are fully supported by TTH. However, special macro packages designed for a specific layout of journal or conference, for example, often use unsupported constructs such as catcode changes. It may then be inadvisable to use the macro package. TTH does not recognize the \usepackage command by default because the LATEX macros that are input by this command almost always contain catcode changes or other usages incompatible with TTH. That is another reason why TTH does not normally have directory paths defined the same as TEX. If a macro package is on the TEXINPUTS path it will be found by TEX but not by TTH. Thus, the macro definitions are included when "TEX"ing the file, but not when "TTH"ing it. It should be clear from this discussion, however, that TTH generally does not support any of the enormous number of extensions to LATEX unless they are mentioned in this manual, because most extension packages are incompatible with TTH.
TTH will find an input file if
1. the full path is specified relative to the directory from which TTH is run, e.g.
\input /home/myhome/mytexdir/mymacro.tex
2. the -p switch specifies a path on which the file is found, or
3. the TTHINPUTS environment variable is defined to be a path on which the file is found.
Paths are searched in this order until an appropriate file is found or all directory options are exhausted
This policy provides a mechanism for making available the alternative package for TTH, without alteration of the original TEX files, by placing the (simplified) version of the macro package on the path TTH searches. An example using the -p switch might be
tth >file.html <file.tex -p/usr/local/tthinputs:~/mytthinputs


Since it is impossible to anticipate all style file incompatibilities, it must be the responsibility of the user (or the journal) to decide how to translate the concepts implemented in the original complicated macro package into simpler, TTH-compatible, TEX macros.
When TTH is used within a CGI script accepting arbitrary TEX for translation, its ability to input any file on the system is a serious security hole. It can be used to view all sorts of files on the system by \inputing them. Therefore a special switch -pNULL is provided that disables all \input or \include files.

### 9.3  Layout to include arguments of unknown commands

Unrecognized or undefined commands of the form \dothis{one}{two}{three}, are treated by discarding all the following adjacent brace groups. A space between the close and open braces will terminate the discarded arguments and cause the following brace group(s) to be scanned as if just the text. This makes it possible to use formatting to make TEX code come out right in both TEX and HTML. For example if TTH encounters a command written "\boxthis{width} {boxed material}" which might be designed in TEX to provide a width to a defined command, written with a space after the first argument, it will ignore the width and scan the boxed material into the text.

### 9.4  Restrictions on redefinition of internal commands

In TTH (unlike TEX) most internal commands can not normally be redefined; any redefinition will simply be ignored (except inside edef and a few other places). This prevents TTH from safely allowing use of major packages that redefine standard TEX commands. For example amsTEX redefines footnote to have just one argument, which will cause problems. This particular example is potentially a problem with LATEX too, which also redefines footnote. TTH handles this by keeping track of whether the file is LATEX or TEX; therefore you should not mix the two dialects in a single file even though there is no need to tell TTH explicitly which type the file is. (Besides, a mixed file will play havoc with TEX itself.)

#### 9.4.1  Footnotes

Footnotes are placed together at the end of the document, or, in the case of TTHgold splitting files, in a separate file called footnote.html. The title of this end section is determined by the macro \tthfootnotes. By default this is "Footnotes", but can be redefined by the user at will, e.g. by \def\tthfootnotes{Tailnotes}.