At some point in my life I found that I cannot efficiently read
papers in the formats which do not support effectively altering
page contens with my own comments, which I use to explain to
the next reader (usually myself) the difference between what the
author intended to write and what the author actually wrote.
So I had to patch djview4 to be able to insert comments, inclu-
ding formulae between the lines of a document. Comment render-
ing is implemented using the MicroTeX library by NanoMichael
https://github.com/NanoMichael/MicroTeX/
TL;DR:

Do not forget to first checkout the MicroTeX submodule:
$ git submodule update --init
Then build this fork of djview4 as ordinary djview4.
A better way of building it is planned, but I am not good at
Autotools, it might take some time. (It might be worth just
moving everything to cmake anyway, since cmake now works
everywhere where Qt works.)
I tested the code with C++20 and Qt6.3.2. Other versions may
or may not work. You also need tinyxml2, and other deps
required by djview4.
Edits are saved as .org mode files with +begin_src latex
blocks, which are, unfortunately, not valid LaTeX, because
standard LaTeX does not support (or did not support last
time I checked) \text{} macros. Mass replacing \text{} with
something else should make it compilable.
Text handling in MicroTeX is imperfect, YMMV, but I have
found the following hack to be the most robust:
$\begin{equation}
$\text{
$Line 1. \
$Line 2.}
$\
$E=mc^2
$\end{equation}
That is, line breaking has to be completely manual. It is
quite annoying, but I do not know how to fix it.
Ordinary \text{} blocks also work, but in my opinion look
not beautiful.
Edits stretch the page vertically. If you compile in many
edits, your page might very well overflow A4, or, in fact
become incompatible with any paper format. I do not really
plan to do any page recomputation, because edited files
are not production quality anyway.
This package contains the djview4 viewer and browser plugin.
This new viewer relies on the DjVulibre library and the Qt toolkit.
Highlights:
Prerequisites:
WARNING: USING DJVIEW AS A PLUGIN IN 2020 IS VERY DIFFICULT BECAUSE
POPULAR BROWSERS EITHER DO NOT SUPPORT NETSCAPE PLUGINS (CHROME), OR
REMOVED SUPPORT FOR NETSCAPE PLUGINS OTHER THAN FLASH (FIREFOX).
We regret this decision because djview/nsdejavu is a perfect
example of very well behaved plugin that would have been
easy to support.
Under Unix/X11, djview4 can be used as a browser plugin
by means of the small shared library named nsdejavu.so.
The djview3 distributed with djvulibre uses the same approach.
In fact both djview3 and djview4 communicate
with nsdejavu.so with the same protocol.
You can either install the file nsdejavu.so that comes
with djview3 or the one that comes with djview4.
The file nsdejavu.so uses the viewer specified
with the environment variable NPX_DJVIEW or searches
an executable viewer named djview, djview4 or djview3.
You need DjVuLibre (>= 3.5.18)
See http://djvu.sourceforge.net for the
source code and for pointers to binary packages.
Under debian type "apt-get install libdjvulibre-dev"
You need Qt4 (>= 4.4.0) or QT5 (tested with 5.2)
See http://trolltech.com for the source code.
Select the version of Qt adapted to your platform.
Under debian type "apt-get install libqt4-dev qt4-dev-tools
Under Unix the configure script uses pkg-config
to locate the DjVuLibre library and its ancillary files.
See http://pkgconfig.freedesktop.org.
If you do not have pkg-config, you will have
to specify which compilation options using
the variabled DDJVUAPI_CFLAGS and DDJVUAPI_LIBS.
First run the script 'configure' (or 'autogen.sh' as
explained above) to generate the makefiles.
Note that there will be no configure file if you obtain the djvulibre
source using git clone. Instead there is a script 'autogen.sh' that
uses automake to generate and call the actual configure script.
Since all autogen.sh arguments will be passed to configure,
you can simply treat autogen.sh as a replacement for configure.
Command 'configure --help' list options and environment
variables that affect the generation of makefile.
The most useful ones are:
--prefix=<directory>
Indicate the base directory for installing djview.
The default prefix is /usr/local.
Binary packages are usually compiled with prefix /usr.</directory>
--mandir=<directory>
Indicates where the man pages go.
The default is ${prefix}/man but many systems
prefer to install man pages in ${prefix}/share/man.</directory>
PKG_CONFIG_PATH=<colon-separated-directories>
Indicates the path for search pkg-config description files.
The default path is /usr/lib/pkgconfig:/usr/share/pkgconfig.
If you have installed DjVuLibre with a prefix different
from /usr, you probably want to add ${prefix}/lib/pkgconfig
to this path.</colon-separated-directories>
DDJVUAPI_CFLAGS=<compiler-flags>
Compiler flags for using the DjVuLibre api.
This is useful when you do not have pkg-config
or when pkg-config does not locate DjVuLibre.</compiler-flags>
DDJVUAPI_LIBS=<linker-flags>
Linker flags for using the DjVuLibre api.
This is useful when you do not have pkg-config
or when pkg-config does not locate DjVuLibre.</linker-flags>
QMAKE=<filaname>
Indicate the location of the Qt4 qmake executable.
This is useful when configure cannot locate Qt4.</filaname>
Running configure creates all the required makefiles
and executes command qmake in directory src.
You can then compile djview4 with command
% make
Once the compilation is successful, install the binaries with
% make install
In general you can compile the standalone viewer djview4 on non unix platforms.
However the browser plugin capability is currently not working on non X11 systems.
We recommend the following procedure to compile on the Mac.
1) Install the Qt 5.x SDK.
2) Install Homebrew with the following packages
$ brew install autoconf automake libtool pkg-config
$ brew install jpeg libtiff git
4) Install the djvulibre Homebrew package
$ brew install djvulibre
Advanced: If you want to compile a fresh version of djvulibre,
you can use the instructions found in the djvulibre tarball.
An interesting alternative is to install the current djvulibre
development version using the Homebrew command,
$ brew install --HEAD djvulibre
but you might find that the brew recipe is out of date.
5) Get the djview source from the git repository
$ git clone git://git.code.sf.net/p/djvu/djview-git djvulibre-djview
$ cd djvulibre-djview
Configure with command
$ ./autogen.sh --enable-mac QMAKE=<path-to-qt-qmake-executable>
Then compile with command
$ make</path-to-qt-qmake-executable>
6) Prepare the djview.app bundle and the dmg file
$ cd mac
$ ./make_djview_bundle.sh
$ ./make_djview_dmg.sh
In general you can compile the standalone
viewer djview4 on non unix platforms.
However the browser plugin capability
is currently not working on non X11 systems.
You will need to compile DjVuLibre.
You will need the appropriate version of Qt.
There are also two ways to compile djview under Windows.
Using Visual C++
First you need to install Qt5 binaries compatible
with your compiler. Sometimes this means
compiling Qt yourself.
Tweak the project file to properly link with
the djvulibre library and the tiff library.
One good way to do so is to open the file "djvulibre.sln"
that comes with the cvs version of djvulibre. Then add the
project "djview.vcproj" and insert the property sheets
"dirs", "warnings", "libtiff" and "tools" found in the
djvulibre-3.5/win32/djvulibre directory. You also need
to add the references to libdjvulibre and libtiff.
This works well despite requiring a lot of clicks.
Using the MINGW compiler (not recommended)
Install the binary version of Qt4.