Document 344

Exporting cross-references in HTML

Version: 4.x & 5.x - Scientific WorkPlace, Scientific Word

Because beautiful typesetting is more appropriate in print than on the web, the HTML filter in Versions 4.x and 5.x ignores most document elements that are generated automatically by LaTeX. These elements include cross-references, index entries, citations, bibliographies, and TeX fields.

Therefore, when you use the Export Document feature to create an .htm version of your .tex document, cross-references to numbered elements don't appear as you might expect. For example, a sentence with cross-references that appears in your SWP/SW document as

Section xrefdiscussion.wmf discusses Eqn. ( xrefbasic.wmf ) and....

where xrefdiscussion.wmf is a cross-reference to section 4 of the document and xrefbasic.wmf is a cross-reference to the first equation, will typeset as

Section 4 discusses Eqn. (1) and....

But it appears in the HTML file created by Version 5 with the referenced keys used to complete the cross-references, like this$:$

Section discussion discusses Eqn. (basic) and....

In the HTML file created by Version 4.x the sentence appears as

Section discusses Eqn. ( ) and....

with no automatically generated section or equation number and no links from which jumping is possible.

Publishing considerations

Knowing how you want to publish your document is important:

  • If you expect to publish primarily on the web, using the HTML export filter, create hypertext links instead of cross-references and otherwise avoid automatically generated document elements.

  • If you expect to publish primarily in print, using LaTeX to typeset your document, leave your document unchanged so that you can take advantage of all the typesetting capabilities that LaTeX has to offer.

  • If, however, you want the .htm version of your document to reflect at least the cross-references created by LaTeX, you can change the htmlout.dat file so that the filter recognizes them.
    Keep in mind, though, that even with the change, the HTML filter ignores section numbers, equation numbers, and other generated elements, so while you may be able to use a cross-reference in HTML to refer to, say, Section 4, the number 4 won't appear next to the section title in the .htm version of the document unless you place it there manually. Further, the change to the htmlout.dat file supports using cross-references to jump to most markers, but not to equation numbers.

Changing the htmlout.dat file

Here's how to change the htmlout.dat file:

  1. With an ASCII editor, open the htmlout.dat file in the main directory of your SWP or SW installation.

  2. In Version 4.x:

    1. Find this line in the file:

      \QTSN#1#2modeless""

    2. Place the insertion point at the end of the line and press Enter.

    3. On the new line, enter

      \QTSN{ref}#2 modeless textarg "<span class=""ref""><a href=""##2"">#2</a></span>"

  3. In Version 5.x:

    1. FInd this line in the file:

      \QTSN{ref}#2 modeless textarg "<span class=""ref"">#2</span>"

    2. Replace the line with this line:

      \QTSN{ref}#2 modeless textarg "<span class=""ref""><a href=""##2"">#2</a></span>"

  4. Save and close the file.

The cross-references that appear in your SWP/SW document as

Section xrefdiscussion.wmf discusses Eqn. ( xrefbasic.wmf ) and ....

now appear in the .htm version as

Section discussion discusses Eqn. (basic) and....

Last revised 04/24/06

The information in this frame was created with Scientific WorkPlace.