8 Boxes, Dimensions, and fills
Boxes, dimensions, and fills are rarely appropriate for web documents
because they imply an attempt to control the fine details of
layout. Browsers make their own choices about layout of a document in
HTML. For example they make the lines fit whatever size of window
happens to be present. This dynamic formatting makes mincemeat of most
detailed TEX layout. In fact, if you want your readers to see
exactly what you see, that is impossible with HTML, and you should use
some other representation of your document.
There are nevertheless many cases when a TEX document containing
boxes, dimensions, and fills needs to be translated. Limited
translation of these constructs is supported. They are translated,
where appropriate and possible, into HTML tables with widths and
vertical skips estimated to give a reasonable result on a browser. It
must be stressed that accurate translation is inherently impossible
because browsers deal in pixel sizes and default font sizes that vary
and are out of the control of the publisher.
The types of box usage that translate quite well are when things like
\hbox to \hsize{The left \hfil the Right}
\vbox{\hsize=2in Matter to be set in horizontal mode to a
limited hsize}
\makebox[0.6\hsize][r]{Stuff to the right of the makebox.}
\framebox{check}
are on a line by themselves.
You get:
| |
Matter to be set in horizontal mode to a limited hsize
|
|
|
Stuff to the right of the makebox. |
Usages that translate poorly tend to be boxes within a line of
text. That is because current HTML table implementations have to start
a new line unless they happen to be adjacent to a table already. Thus
an hbox in a line will give a line break that you might not have
wanted. This behaviour is really a bug in the browsers, but we are
currently stuck with it. The behaviour of HTML tables is buggy
[see 13.5] when their alignment is specified, which means that
strange results are likely if more than one box on a line is being
set. Boxes in equations are troublesome. The only type that is
reasonably supported is \mbox which is often used in LATEX for
introducing text inside equations.
Negative skips are not supported at all.
The only important dimension parameter that is currently interpreted
is \hsize. It is what controls the width of a vbox. It can be
reset using the plain TEX format e.g. \hsize = 3in or scaled
or advanced e.g. \hsize=0.6\hsize but only within a group. It
makes no sense for the HTML file to try to specify the width of the
line at the outermost level. That is the browser's business.
New dimensions can be defined, set, advanced, scaled and used to set
other dimensions including \hsize.
TTH trys valiantly to mimic the sort of text alignment that is
obtained using glue such as \hfil and \hss, provided it
is inside a box. However, the alignment algorithm of HTML tables makes
it impossible to obtain fills with exactly equal sizes. So don't be
surprised if some results looks disagreeable. Moreover, TTH will
completely ignore the glue outside an hbox, and it doesn't know
the difference between \hfil and \hfill, etc.