Control of HTML output.




From version 4.08 onwards, the 'Pro' version of TechWriter has the ability to automatically convert equations and drawfile diagrams into GIFs when the document is saved as an HTML file. (EasiWriter Pro can now also save illustrations as GIFs, but obviously can't handle equations.) This means it is now fairly easy to create technical documents in HTML format. An example of this is shown in the white box, below

(N.B. Apologies if your browser doesn't handle tables as you won't see the white background!)


It is conventional to define a quantity called the modulation index,

equation

we can then write the FM wave in the form

equation

By consulting a good maths textbook we discover that this expression can (after some boring algebra!) be rewritten as

equation

equation

equation

equation

where is the Bessel Function (first kind, integer order, n).



The above example was saved as an HTML 'selection' from an existing TechWriter document. The process of converting the equations into GIFs uses Peter Hartley's excellent !InterGif application. Provided that this has been 'seen' or Filer_Booted it will be used. If it hasn't been seen, the equations, etc, are all saved as sprites.

The output html can be tweaked in various ways...




Messages



Inside the !TechWrite.Messages file you can find the lines:



(Note that lines x49 to x52 have a space at the end.)

By altering x49 to x52 you can adjust the way InterGif processes equations and drawfile illustrations. These strings, followed by an appropriate filename, are sent to InterGif by TWPro. If you want to understand these strings, have a look at the helpfile that comes with !InterGif.

Each line controls the following items:



JPEGs (and PNGs from version 4.10 onwards) are copied out and linked without processing as it is assumed that any extra processing might lead to an unwanted degradation of the image quality.

Illustration DrawFiles are saved with a scaling factor determined by the scale factor used to display them in the TW document. Any border on an illustration will cause a border to be placed around the exported image.




Choices



You can control the output using settings held in the TW Choices file. This will probably be inside the machine boot structure at

Including a choices setting 'nz1/z2' or 'nz1' will control the scaling ('zoom factor') used for creating gifs from display and inline equations. The z1 and z2 are percentage scale values. The first value sets the display equation zoom and the second sets the inline zoom. The second value can be omitted if the same factor is required for both types of equation. So, for example, the output shown in the above white box was saved with 'n120' in the choices file string. As a result all the equations are 20% bigger than the default size which would be obtained from saving the equations as DrawFiles.

Another setting you can make is 'g<i0g00dcba>'; where the <i0g00dcba> is a bitfield that controls different aspects of the way in which GIFs are created. The meaning of each bit is summarised as follow:

The bitfield value ignores leading zeros (which are assumed by default) so both 'g0100' and 'g100' are legitimate ways to specify that the equation GIFs should have a white background rather than a transparent background.

In my case, my choices file contains the string:



So I have arranged for the 'white' corner pixels to be suppressed and for all the equations to by at 120% scale.




Other pages on html control.



From version 4.10 onwards TW/EW Pro offer more flexible control of background colours. This is of particular interest for creating more varied webpages. A excellent feature is that all exported drawfiles and equations are automatically anti-aliased to the chosen webpage background colour when they are translated into gifs.

There is also a page which explains in detail how TW imports/exports graphics, equations, and characters. This provides additional information which you can use to adjust the output to suit your requirements. For example, to control ‘smart quotes’ on webpages exported from TW.




Although the created output is - technically - excellent, you may wish to tweak it a little more after being saved. For example, 4.08 and 4.10 use the BASEFONT SIZE tag to set the size of the body text of the html. Alas, some browsers (e.g. Fresco V1.69) ignore this. So you may want to change this to the plainer FONT SIZE tag which seems more browser-reliable.



Back to the main TechWriter Tips page for more info...
twt3p.gif - 1894 bytes


Pages created using TW Pro and HTMLEdit
Content and pages maintained by: Jim Lesurf (jcgl@st-and.demon.co.uk)