nDVI

a DVI viewer plugin for Netscape (Unix)
by K.Peeters, k.peeters@damtp.cam.ac.uk

Public version (09-Apr-1998): libGhostview-1.50, libXtex-1.60, ndvi-1.60

Development version: identical to public version

nDVI is no longer being developed. The binaries below are unlikely to work with Netscape 4.x and higher, but you may be able to compile the sources yourself. Contact me by email if you want to know about future plans.


Table of contents

  1. Acknowledgement,
  2. Introduction and overview,
  3. Licensing and copyright information,
  4. Comparison to other products,
  5. Bugs and current limitations,
  6. Future plans and preliminary releases

  7. Getting and installing a binary,
  8. Compiling it yourself,
  9. Using nDVI with gzipped files,
  10. Netscape memory bug workaround,
  11. Printing

  12. Frequently asked questions,
  13. Information about HyperTeX,
  14. Mailing lists,
  15. Demonstration pages.


Acknowledgement

The development of this version of nDVI is financially supported by JHEP, the Journal of High Energy Physics, a new scientific journal written, run and distributed by electronic means. See the JHEP web pages for more information.


Introduction and overview

nDVI is a Netscape plugin (Unix only) for viewing DVI files, with support for hyperTeX. A snapshot is shown below.

Version 1.0 (and up) was written with support from JHEP. Compared to older versions, it has much improved font searching (no more environment variables to set), support for embedded postscript, a controlpanel from which you can also print the DVI file (see below) and several other improvements.
There are two modes of operation of nDVI. The first one is fullscreen, which is activated when you try to access a URL which is a DVI file. The second on is embedded mode. In this mode, an external DVI file is embedded in a HTML file using a statement of the form

  < embed type="application/x-dvi"
  file="http://some.host/mydvifile.dvi"
  width="500" height="300" shrink="3" >
  < /embed >

When displaying such a HTML file, the nDVI plugin will be activated, fetch `mydvifile.dvi' and display it in the 500x300 box reserved for the plugin.


Licensing and copyright information

nDVI is distributable under the GPL, a copy of which can be found at the GNU site. Many people have contributed to XHDVI, the code which was the base of nDVI. From the sourcecode:

1/1986modified for X.10Bob ScheiflerMIT LCS
1987handle specialsDirk GrunwaldUniv. of Illinois
7/1988modified for X.11Mark EichinMIT
12/1988added 'R' option, toolkit, magnifying glassPaul VojtaUC Berkeley
2/1989added tpic supportJeffrey LeeU of Toronto
4/1989modified for System VDonald RichardsonClarkson Univ
3/1990added VMS support (no longer in nDVI)Scott AllendorfU of Iowa
7/1990added reflection modeMichael PakHebrew U of Jerusalem
1/1992added greyscale codeTill BrychcyTechn. Univ. Muenchen
and Lee HetheringtonMIT
4/1994added DPS support, bounding boxRicardo Telichevesky and Luis Miguel SilveiraMIT RLE
5/1994added hypertex codeArthur SmithU. of Washington
9/1996modified to work as Netscape pluginKasper PeetersNIKHEF
Not all of the XHDVI code is present in nDVI, but most of it is planned to be re-inserted in a later version.


Motivation, background and comparison to other products

There are a couple of other programs that allow displaying of TeX material on the web (please drop me a note if there's something I forgot to mention). More information on math on the web can be found at MathNews. Furthermore, the original XHDVI is able to fetch documents from the web by using the libraries provided by W3C. XHDVI as a browser cannot hold a candle to Netscape of course.

Suggestions and ideas for improvement of nDVI can be sent to k.peeters@damtp.cam.ac.uk.


Bugs and current limitations

Known but not yet solved problems in version 1.60: If you find a reproducible bug, please do `setenv XTEX_DEBUG' or the 'sh' equivalent, and run it again. Extensive logging goes to a file `libxtex.log' in the directory from which you started Netscape.


Future plans and preliminary releases

I'm currently writing a workaround for a Netscape bug that results in crashes when selecting items from the 'options' menu while viewing a DVI file. When that is finished, I'll start working on the following features: If you want other features to be added to this list, please let me know.


Installing a binary

In order to use a precompiled binary, you need to have a kpathsea based TeX system installed. Most modern TeX installations should work without problems.

The Journal for High Energy Physics provides binaries for various platforms. See their nDVI page and download a binary from there.

Read the comment on gzipped files if you want to use nDVI to browse the archives at xxx.lanl.gov. If you want to be notified of the release of new versions, please subscribe to one of the mailing lists.

Linux binaries generated by myself are also available:

Unpack the .gz files. The first three go into a directory in your PATH (you can also store them in a subdirectory .ndvi (mind the dot!) in your homedirectory). The last one (the actual plugin) goes in .netscape/plugins in your homedir, or in the system-wide plugin directory. Make all files executable and readable.


Compiling it yourself

Alternatively, get the Netscape plugin developer kit (at any Netscape ftp mirror in /pub/sdk/plugin/unix). There's a bug in there that you have to patch first: replace the file `common/npunix.c' with this version.

Then get the sources:

Unpack each of them. Go to the `libGhostview/src' directory, check that the paths in `Makefile.in' are correct and type `./configure' followed by `make'. Then go to the `libXtex/src' directory and do the same thing. Finally, go to the `ndvi/src' directory and do `./configure' and `make static' or `make motifstatic', depending on whether you want the Motif libs to be statically linked to the controlpanel.

If it doesn't compile out-of-the-box, please let me know.

Put the resulting binaries in the proper places, as described above.

If you want to be notified of the release of new versions, please subscribe to one of the mailing lists. If you're a plugin programmer yourself and need technical information, you might want to have a look at my page on plugin programming on Unix.


Making nDVI work with gzipped files

There is a bug in almost all versions of Netscape (the HPUX version seems to be the only version that does it right) that results in gzipped files not being transferred to plugins. This prevents one from using nDVI on gzipped dvi files, such as those produced by the physics preprint archives at http://xxx.lanl.gov. To remedy this, you can turn off Netscape's automatic detection of gzipped files. There is some code in nDVI that will detect gzipped files for you, and it will unzip it by itself. Of course, you will loose the automatic unzipping of other filetypes, but I do not know of a better workaround for this bug.

To disable Netscape's automatic unzipping, put the following in a file and do xrdb < [filename] to set the appropriate resources.

*encodingFilters:                                 \
        x-compress :  : .Z     : uncompress -c  \n\
        compress   :  : .Z     : uncompress -c  \n
On most modern machines running Xwindows, it's enough to put these lines in a file '.Xresources' in your homedirectory; the system will then automatically read these settings when you log in.


Netscape memory bug workaround

There is a serious bug in Netscape, which has been acknowledged by Netscape Inc. but will probably not be fixed in the near future, which results in random crashes of nDVI. See my page on plugin programming for details.

There is a workaround if you are on a Linux machine (or any other platform with a GNU dynamic loader): do the following to start Netscape:

sh or bash users:

export LD_PRELOAD=/usr/local/lib/netscape/plugins/ndvi.so
netscape
csh/tcsh users:
setenv LD_PRELOAD /usr/local/lib/netscape/plugins/ndvi.so
netscape
This way, nDVI will never be removed from memory as long as Netscape is running.

Bogdan Bucicovschi is entitled to a free beer for sending me this tip.

If you're not lucky enough to be working on a Linux machine, you can still minimize the risk of being bitten by this bug:


Printing

When clicking 'print...' in the controlpanel, a requester pops up asking for the printer name and the number of pages you want to fit on one physical sheet. After pressing 'print', nDVI will put the DVI file (and the embedded postscript files, if applicable) in a temporary directory, and call the script '~/.ndvi/ndvi_pr'.

You can modify this script to handle printing in the appropriate way on your system. The default script calls 'dvips' to convert the DVI file to postscript, and then calls 'psnup' to put multiple pages on one physical sheet (if requested). It then dumps the file to the printer using 'lpr'. Information on the parameters that are passed to the 'ndvi_pr' script can be found at the top of that script.


Frequently asked questions

After a dvi file has been transferred, I get an empty Netscape window.
You have probably turned off the Netscape disk cache. For some reason nDVI does not work without such a cache. Turn it on and try again.

When I choose 'about plugins' from the help menu, I get an empty screen.
That particular page depends on javascript. Turn it on in the 'network preferences' panel. After that, nDVI should be listed on the 'about plugins' page.

Netscape refuses to recognise the plugin and there are no messages output to the terminal from which it was started.
Probably your system uses a wrapper script around netscape to set certain options and environment variables (some sites do this to eg. disable the disk cache). Sometimes it helps to set the 'NPX_PLUGIN_PATH' environment variable to the directory in which you installed ndvi.so. In doubt, ask your system administrator.

Can I install nDVI system-wide?
Yes. Store 'ndvi.so' in the system-wide plugin directory (eg. '/usr/local/lib/netscape/plugins/'), and store 'ndvi_controlpanel', 'ndvi_pr' and 'ndvi_ps' in a directory that is in PATH (eg. '/usr/local/bin/').

I have downloaded a Linux binary, but Netscape complains with "ERROR: File not found, Can't load plug-in ndvi.so. Ignored.".
You probably don't have 'libXaw3d' installed. If your version of the 'ldd' command is new enough you can try 'ldd ndvi.so' to check this, otherwise you'll have to scan your system to see if the library is indeed not present. The 'libXaw3d' library can be obtained from various places (eg. Sunsite) and comes with many distributions (there is a RedHat '.rpm' file). I have stored a copy of just the libraries locally, libXaw3d-linux.tar.gz, which you should untar in '/usr/X11R6/lib', after which you should run (as root) the command 'ldconfig'.

It is possible that you are using a very old version of libc. Please upgrade to at least 5.3.12 or (if you want the 5.4 series) 5.4.33. If you used an old version of libc to circumvent bugs (mostly with Java) in Netscape: a better way to solve these problems this exists; look at Netscape and Java in the Java-Linux HOWTO.

When changing one of the options in the 'options' menu (eg. toggling off the menubar), Netscape crashes.
This is a bug in Netscape (calling code in the plugin when it has already removed it from memory). If you're on a Linux system (or any other system with a GNU dynamic loader), you can circumvent the problem. See `Netscape memory bug workaround' for details, also if you are on a different platform.

When pressing Netscape's 'back' button while viewing a dvi file, it crashes.
See the previous question.

I get a lot of xterm windows running MakeTeXPK, they all complain, and then I end up with a blank window.
Try the latest version. Many font searching problems have been fixed. If you still encounter problems I'd like to know about them.

Compiling libGhostview fails on Solaris, using gcc 2.6.3.
That's a bug in gcc. Get a more recent version.

When compiling nDVI myself, the linker complains about an unresolved symbol `NPN_GetURLNotify'.
You did not replace the `npunix.c' file in the plugin SDK with the version available here. Read the instructions again.

The compiler complains about missing X11 includefiles.
The `configure' script was unable to figure out the location of the X11 includefiles and libraries. Run it again, but now like
./configure --x-includes=DIR --x-libraries=DIR
with 'DIR' replaced by the appropriate paths.

When I access a `.dvi.gz' file, I get a message `gzip: stdin: not in gzip format'.
This is most likely a Netscape bug. Accessing gzipped files on HPUX works, but on Linux and Solaris Netscape doesn't handle the uncompression properly. Netscape Tech support has not answered this bug report yet. See the section on how to make nDVI work with gzipped files for information about a workaround.

When I open a DVI file Netscape crashes.
Upgrade to the most recent version. Versions < 1.0 do not have fullscreen support.

The fonts look jaggy.
You probably ran out of color entries. Start Netscape with `netscape -ncols 150' or some other number safely below the maximum number that your display supports.

If you're running netscape with the '-install' option, or if you have an entry 'Netscape*installColormap: yes' in your Xresources, it is possible that Netscape has already allocated all colors for itself so nDVI won't be able to get the required shades of grey. Try to run without '-install'.

The plugin is not recognised, even though it is in the proper path.
On some systems, the .mailcap and .mime-types files are screwed up. Try to start netscape without these files.

Using Linux with glibc and Netscape 4.x, all I get is crashes.
I'm working on this one, but it is a tricky one. Try to downgrade to Netscape 3.x for the moment. And drop me an email, to encourage me.

Will there be a Windows 95 version?
Probably not, or at least not very soon. A lot of the code is specific to X11, and although I have tried to separate the display code from the core routines somewhat, the fact that nDVI is based on xdvi means that many things would have to be rewritten for a Windows version. You're welcome to help porting.

You might be better off using Techexplorer. See the motivation section.


Using HyperTeX

HyperTeX is the defacto standard for inclusion of hyperlinks in TeX documents. More information can be found on the HyperTeX pages.


Mailinglists

Two mailinglists are available.


Demonstration pages


Send comments, suggestions and bugreports to k.peeters@damtp.cam.ac.uk.