\&.if \\n(.f==2 .ihtml f1
\&.if \\n(.f==3 .ihtml f1
\&.if \\n(.f==4 .ihtml f1
\&.if \\n(.f==5 .ihtml f1
\&.if \\n(.f==6 .ihtml f1
\&..
.EE
.LP
Input files can redefine
.B .font
like any other request or macro.
.SS Paragraphs
.I Htmlroff
implements line height, text adjustment, and margins by
wrapping all output text in
.B
tags.
This behavior can be disabled by setting the
.B .paragraph
number register to zero.
Setting the
.B .margin
register to zero
eliminates only the margin annotations.
.SS Subscripts and superscripts
.PP
.I Htmlroff
interprets the
.BR \eu ,
.BR \ed ,
and
.BR \ev
requests to move vertically during output.
It emits output vertically offset up the page inside
.B
tags and output vertically offset down the page
inside
.B
tags.
This heuristic handles simple equations formatted by
.MR eqn (1) .
.SS Conditional input
.PP
To make it easier to write input files that can be formatted by both
.I troff
and
.IR htmlroff ,
.I htmlroff
adds a new condition
.B h
which evaluates true in
.B .if
and
.B .ie
requests.
The
.B t
condition continues to evaluate true, to accomodate
input files trying to distinguish between
.I troff
and
.IR nroff .
To write a conditional matching
.I troff
alone, use
.RB ` ".if !h .if t" '.
.PP
.I Htmlroff 's
handling of conditional input does not match
.IR troff 's
exactly.
For example,
.IP
.EX
\&.if 0 \e{\e
\&.de xx
\&..
\&.\e}
.EE
.LP
redefines the
.B xx
macro in
.I troff
but not in
.IR htmlroff .
Do not write files depending on this behavior, as this bug may be fixed
in the future.
.I Htmlroff
also mishandles
.B \e}
in some cases. To work around them, use
.B .\e}
on a line by itself, as in the last example.
.SS Diversions
.PP
Diversions in
.I htmlroff
use the alignment in effect at the time of the
diversion
when output.
In particular,
.IP
.EX
\&.di xx
Line here.
\&.di
\&.nf
\&.ce
\&.xx
.EE
.LP
produces a centered line in
.I troff
but not in
.IR htmlroff .
The solution is to center inside the diversion, as in
.IP
.EX
\&.di xx
\&.if h .ce 999
Line here
\&.di
.EE
.SS Input pipes
.PP
.I Htmlroff
adds a new request
.B .inputpipe
.I stop
.I cmd
that redirects
.I htmlroff 's
input into a pipe to the
given
.I cmd .
The redirection stops on encountering the line
.IR stop ,
optionally followed by white space and extra text.
This is a dangerous and clusmy request, as
.I htmlroff
stops interpreting its input during the redirection, so
.I stop
must be found in the input itself, not in a macro that
the input might appear to call.
Although clusmy,
.B .inputpipe
allows input files to invoke
.I troff
to handle complicated input.
For example,
.B tmac.html
redefines the
.B PS
macro that marks the beginning of a
.MR pic (1)
picture:
.IP
.EX
\&.nr png -1 1
\&.de PS
\&.ds pngbase "\e\e*[basename]
\&.if '\e\e*[pngbase]'' .ds pngbase \e\en(.B
\&.ds pngfile \e\e*[pngbase]\e\en+[png].png
\&.html -
\&.inputpipe .PE troff2png >\e\e*[pngfile]
\&..
.EE
.LP
This macro invokes the shell script
.I troff2png
to run troff and convert the Postscript
output to a PNG image file.
Before starting the program, the macro creates
a new file name for the image and prints
HTML referring to it.
The new
.B .B
register holds the final path element
(the base name) of the current input file.