LaTeX on Cygwin again

I have Cygwin installed as admin (not installed with the “–no-admin” command line option). I needed LaTeX for a couple of things. After installing it through the setup program, I got some errors about files not found and suchlike.

I ran a terminal (mintty, the Cygwin default terminal is fine) as administrator (right click on the link and select Run as administrator), and ran:

$ mktexlsr

and now all is well.

Later, wanted to add xelatex; installed the packages but got errors like:

I can’t find the format file `xetex.fmt’!

Answer was to open an admin Cygwin term and rerun the above, then run:

$ fmtutil-sys --all

to regenerate all the formats (xelatex is another format).

.

 

 

 

 

LaTeX on FreeDOS

LaTeX is a great way of preparing nice-looking documents. At least as useful is its keeping track of cross-references, references and suchlike.

It has also been very stable (though evolving). That means that more than 30 years ago it was powerful and useful. And 25 years ago, if you were using MSDOS or OS/2, you could install emTeX, the implementation of LaTeX put together by Eberhard Mattes. He has long put it down and moved on, but if you’re interested in retrotech, it remains an interesting tool, or suite of tools.

Because you can get a reasonably recent Vim on FreeDOS (7.3) and some other great editors too, LaTeX is still quite viable. The biggest issue is that a lot of more modern functionality is missing — for example, anything using Lua, things like XeLaTeX, TrueType fonts, inserting PDFs and PNG files directly, and so on. You’re really limited to EPS graphics or (if you use the emTeX driver) monochrome PCX files.

BUT

Because LaTeX has been so stable, a LaTeX file that works in emTeX will work on a modern machine. That means LaTeX remains the best way of making a modern, good-looking document on DOS, one that can at some point be transferred to a modern machine for production if need be.

So here I outline a way of installing emTeX on FreeDOS

Basic install of emTeX on FreeDOS

The procedure mostly consists of unzipping archives and creating some environment variables.

I assume emTeX zips are in c:\cds\emtexzip (change to suit wherever you have put them). The zips can be found on CTAN, in systems/msdos/emtex.

FreeDOS installs unzip32.exe, I think. Any unzip that can keep the directory structure (eg pkzunip -d) is ok.

The instructions are really all already there — in the file install.eng (if English is your language — there is also an install.ger). So every so often, I have a look at it. I’ve already installed Vim using FreeDOS’s package tools. You don’t need Vim — the FreeDOS EDIT program is fine.

C:\> vim \cds\emtexzip\install.eng

So, step 1 is to unzip the archives after changing to the root directory.

C:\> c:
C:\> cd \
C:\> unzip32 \cds\emtexzip\first.zip

Add the new directory to the path in autoexec.bat and set some environment variables (note that you might well need to increase your environment space). It may be useful to add these paths and variables to your current DOS session as well, because we need to run emTeX later to generate some formats and so on, so these variables and paths need to be active for the installation to work:

path=%path%;c:\emtex\bin
set emtexdir=c:\emtex
set texconfig=%emtexdir%\data\dvips
set emtexopt=/ms:1600

tmp is already set by FreeDOS, but if not, make it:

md c:\tmp

Then add this to autoexc.bat:

set tmp=c:\tmp

Add emx/rsx; some of these files may already be on FreeDOS; I said ‘no’ to copying over any existing files. Do install this package, even if c:\emx already exists:

c:\>unzip c:\cds\emtexzip\emxrsx.zip

Add \emx\bin to your current path (to help with later install steps), and then add this to autoexec.bat :

path=%path%;c:\emx\bin

C:\>vim \emx\doc\emxrt.doc

There can be issues with emx and your DPMI driver; we’ll plough on an see if we have to come back to this.

C:\>unzip \cds\emtexzip\TEX4B.ZIP 
C:\>unzip \cds\emtexzip\fontcm.zip
C:\>unzip \cds\emtexzip\l2input.zip
C:\>unzip \cds\emtexzip\latex209.zip
C:\>unzip \cds\emtexzip\fontltx.zip

Now, we set up tex, latex, whatever we want to use — this is why we need our environment variables and paths to include the emTeX information:

C:\>vim emtex\doc\english\tex.doc 
C:\>cd \emtex\htexfmts\

We make some formats. I use latex2e as latex. This means I can run latex with latex2e (or latex), latex 2.09 with latex209, slitex with slitex and plain tex with either tex or htex386 (“C:…\>” bit omitted from commands not run in the root directory):

makefmt huge latex2e US -b \emtex\bin\latex2e
makefmt huge slitex US -b \emtex\bin\slitex
makefmt huge latex209 US -b \emtex\bin\latex209
makefmt huge plain US -b \emtex\bin\tex

(I then copied latex2e.bat to latex.bat.) Then we unzip some more archives.

C:\>cd \
C:\>unzip \cds\emtexzip\l2tools.zip
C:\>cd \emtex\dist\latex\packages\tools\
latex tools.ins
copy *.sty \emtex\texinput\latex2e\
copy *.tex \emtex\texinput\latex2e\
vim \emtex\dist\latex\packages\tools\readme.txt
cd \
C:\>unzip \cds\emtexzip\texware.zip
C:\>unzip \cds\emtexzip\MF4B.ZIP
C:\>unzip \cds\emtexzip\mfjob12d.zip
C:\>unzip \cds\emtexzip\fontcm.zip
C:\>unzip \cds\emtexzip\fontec.zip
C:\>unzip \cds\emtexzip\fontltx.zip
C:\>unzip \cds\emtexzip\fontemsy.zip
C:\>unzip \cds\emtexzip\fontams.zip
C:\>vim emtex\doc\english\metafont.doc
C:\>cd emtex\bmfbases\
makebas 386 plain
makebas 386 cm
C:\>cd \
C:\>vim emtex\doc\english\mfjob.doc
C:\>unzip \cds\emtexzip\mfware.zip
C:\>unzip \cds\emtexzip\DVID16H1.ZIP
C:\>unzip \cds\emtexzip\DVID16H2.ZIP
C:\>vim emtex\doc\english\metafont.doc
C:\>vim emtex\doc\english\mfjob.doc
C:\>vim emtex\doc\english\dvidrv.doc
C:\>mkdir texdocs\dvifiles
C:\>mkdir \texfonts
C:\>mkdir \texdocs\images

Put these 4 lines in autoexec.bat:

set dvidrvinput=c:\texdocs\dvifiles
set dvidrvfonts=c:\texfonts!!
set dvidrvgraph=c:\texdocs\images
set mfjobopt=/3

Then:

C:\>copy cds\emtexzip\*.fli \texfonts 
C:\>unzip \cds\emtexzip\makeindx.zip

Put a line in autoexec.bat:

set indexstyle=c:\emtex\idxstyle

And then install BibTeX:

C:\>unzip \cds\emtexzip\bibtex4b.zip 
C:\>vim emtex\doc\bibtex.doc

We want to find bib files that are not in the emTeX tree — they are userspace things, but we do want to search the official place if need be. I put my userspace stuff in c:\texdocs, so add to autoexec.bat:

set bibinput=c:\texdocs\bib;c:\emtex\bibtex\bib 
set bstinput=c:\emtex\bibtex\bst

Then:

C:\>mkdir \texdocs\bib
C:\>unzip \cds\emtexzip\texcad.zip

texcad did not work on my machine, but you can install if you like. Remove it using emTeX’s package management tools:

C:\>emremove \emtex\remove\texcad.rem 

c:\>cd \
C:\>unzip \cds\emtexzip\pictex.zip
C:\>unzip \cds\emtexzip\web.zip

Now emTeX works, but we still need some ancillaries — especially PSNFSS, which gives us PostScript fonts, and dvips which makes PostScript files for us. We can also add PS2PDF to make PDF files, which allows us to make modern output with old LaTeX (ps2pdf comes with GhostScript; old version of some of the xpdf tools are also available). Other tools to install later include ispell, word counters, drawing tools, gnuplot, all that kind of thing. Beyond the scope of this document.

FreeDOS package management can install some of these, including GhostScript; it should add the gs environment variables, but if not, more stuff for autoexec.bat:

set GS_LIB=c:\gs
set GS_FONTPATH=c:\gs\fonts

Download (it’s on CTAN) dvips583.zip and put in a temporary directory, unzip it then unzip some files that were within it from the root directory:

C:\>cd \
C:\>mkdir dvips.tmp
C:\>cd dvips.tmp

Move dvips583.zip from wherever to here and unzip it, then return to the root and unzip the zip that was inside the zip …

unzip dvips583.zip 
C:\>cd \
C:\>unzip dvips.tmp\dvipsexe.zip
C:\>deltree -Y dvips.tmp

(If you like); I am using 300 DPI (that is, LJ), so I go:

C:\>cd \emtex\data\dvips

Back up the config.ps because it is for the 600 DPI LaserJet IV. Then:

C:\>copy config.ps config.lj4
C:\>copy config.lj config.ps

Because it works for 300 DPI LJ/LJII. Then, if I want ps2pdf to work, I go:

C:\>cd \gs

C:\>copy gs386.exe  gs.exe.

(Or I could make an alias in autoexec.bat — FreeDOS/4DOS can do that. That is probably better, so if using 4DOS, instead add this to autoexec.bat):

alias gs="gs386.exe"

Ok, next we want to add PSNFSS — this gives us access to a bunch of PostScript fonts, like Bookman and all those kind of standard ones. There is a very good guide for doing this online — search for: “Installing the PostScript fonts in EmTeX using the PSNFSS package” and the guide will come up.

On CTAN or elsewhere (ideally, an older version), find  PSNFSS.zip and unzip it in a scratch space (I am using C:\cds\psnfss). Inside that zip is lw35nfss.zip, preferably an older version; unzip that too. Note that my system has some gnu utilities, so you may see ‘cp -r’ for ‘recursive copy’. Unzipping PSNFSS.zip should provide a handful of files, so in the scratch space:

cd \cds\psnfss
latex psfonts.ins
move *.sty \emtex\texinput\latex2e\
cd fonts\tfm\
cp -r adobe \emtex\tfm\
cd \cds\psnfss
copy psnfss.map \emtex\data\dvips\
cp -r fonts\vf\adobe \texfonts\vf
vim \emtex\data\dvips\config.ps

And on line 54 I add:

p +psnfss.map 

Then:

C:\>mkdir \emtex\texinput\fd 
C:\>cp tex\latex\psnfss\*.fd \emtex\texinput\fd\
C:\>cp 8r.enc \emtex\data\dvips\

And another environment variable:

set textfm=C:\EMTEX\tfm!!

Now, we can find the pixel fonts for these fonts in lw35pk.zip. This archive uses a different directory naming convention from the emTeX DVI viewer, so we have some manual copying to do; for example, after we unzip it:

c:\> copy dpi300\ptmr8r.pk \texfonts\pixel.lj\300dpi

(Of course, in practice to automate this any way you like).

Now we have a pretty good LaTeX installation. Some more packages and resources would be useful.

  1. Using computer modern, we can just use emTeX as given, and dvips32 and v.bat (the DVI viewer) will work out of the box.
  2. We can use the PSNFSS fonts by following the instructions, and latex and dvips32 will work, but we won’t have pixel fonts that are needed for onscreen preview. They can be generated using gsftopk, but that is beyond the scope of this document. It is often easiest done using a Linux or Windows box, to be honest. 

Now, we must add some more packages.

Just as an example!

To add packages to emTeX, use the archived TeX material at tug.org/historic. emTeX was last updated around 1999, so the ideal place to get packages to add to the installation is somewhere like ftp.math.utah.edu/pub/tex/historic/systems/texlive1998 where you can browse the repository or download the whole things as a tgz file (273 MB) (it’s not even that big a download by modern standards).

Almost everything fits with DOS’s 8.3 file name restrictions, and while important modern developments are not available, if you are happy to stick with TEX -> DVI -> PS -> PDF, there’s a lot that still works very nicely.

The historic archives contain fonts, macros and so on. Not all obey 8.3, so check before installing/adding. For example, we can add a graphics bundle of the right age.

For example, if we have the source files for array (array.ins and array.dtx) in the folder c:\array:

C:\>cd array\
latex ARRAY.ins
latex ARRAY.DTX
latex ARRAY.DTX
mkidx32 -s gind.ist array.idx
mkidx32 -s gglo.ist -o array.gls array.glo
latex ARRAY.DTX
latex ARRAY.DTX
v array

(We can view the documentation.) Then copy into the tree:

mkdir \emtex\texinput\latex2e\array
copy *.sty \emtex\texinput\latex2e\array

Let’s install a package from TeXLive3 downloaded  from ftp.math.utah.edu/pub/tex/historic/systems/texlive/. I created a documentation tree parallel with the texinput tree, but you don’t have to. This file did not produce index or glossary output, so some steps are different from above.

C:\>cd \texlive3\texmf\source\latex\geometry\ 
latex geometry.ins
latex geometry.dtx
latex geometry.dtx
mkdir \emtex\doc\latex2e\geometry
mkdir \emtex\texinput\latex2e\geometry\
mv geometry.d* \emtex\doc\latex2e\geometry\
mv GEOMETRY.CFG \emtex\texinput\latex2e\geometry\
mv GEOMETRY.STY \emtex\texinput\latex2e\geometry\

Then we can go to the \emtex\doc\latex2e\geometry directory and make the documentation, if we want (as above for array).

FreeDOS includes Vim, which is a great editor for LaTeX. It also includes TDE, which I like.

That’s it.

Veusz on Debian — scientific plotting, publication quality

I’m very taken with Veusz, so let’s install it on Debian.

Problem — it is in old stable and testing but not in stable. You can install via a Python-based installer from the Veusz website or by using a precompiled suite of binaries and libraries.

Take-home message: install the precompiled binary unless you have Qt 5.15 or higher as the default in your distribution. Debian, being conservative, does not as of time of writing, so must use the precompiled binary. If you are on i386, version 2.2.2 of Veusz is the last one available in this way.

 


The long version

$ wget https://github.com/veusz/veusz/releases/download/veusz-3.3.1/veusz-3.3.1.tar.gz
$ tar xvzf veusz-3.3.1.tar.gz veusz-3.3.1/
$ cd veusz-3.3.1/
$ python setup.py build

Barfs–

Problem — needs Qt > 5.5. And then a bunch of other dependencies that Debian does not seem to include. And then at some point it says:

ModuleNotFoundError: No module named 'PyQt5.QtSvg'

But:

$ sudo apt install python-pyqt5.qtsvg
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-pyqt5.qtsvg is already the newest version (5.11.3+dfsg-1+b3).
python-pyqt5.qtsvg set to manually installed

As superuser:

# pip install PyQt5
Requirement already satisfied: PyQt5 in /usr/local/lib/python3.7/dist-packages/PyQt5-5.15.4-py3.7-linux-x86_64.egg (5.15.4)
Requirement already satisfied: PyQt5-Qt5>=5.15 in /usr/local/lib/python3.7/dist-packages/PyQt5_Qt5-5.15.2-py3.7-linux-x86_64.egg (from PyQt5) (5.15.2)
Requirement already satisfied: PyQt5-sip<13,>=12.8 in /usr/local/lib/python3.7/dist-packages/PyQt5_sip-12.9.0-py3.7-linux-x86_64.egg (from PyQt5) (12.9.0)

But that does not help. A bit of googling suggests:

$ sudo apt install python-pyqt5 qtcreator pyqt5-dev-tools qttools5-dev-tools

And wtf it says this:

Need to get 201 MB of archives.
After this operation, 533 MB of additional disk space will be used.

And wants to install clang and a whole ‘nother ecosystem of shit! No, I don’t think so.

$ python setup.py build
Traceback (most recent call last):
File "setup.py", line 60, in <module>
import pyqtdistutils
File "/home/goossens/installs/veusz/veusz-3.3.1/pyqtdistutils.py", line 16, in <module>
import PyQt5.QtCore
ImportError: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.15' not found (required by /usr/local/lib/python3.7/dist-packages/PyQt5-5.15.4-py3.7-linux-x86_64.egg/PyQt5/QtCore.abi3.so)

$ ls -l /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
lrwxrwxrwx 1 root root 20 Sep 14 2020 /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 -> libQt5Core.so.5.11.3

So the problem is that the so library version is just not new enough.

apt shows that ‘All packages are up to date’; so we just have an application that is too far ahead of the distro. Backports? Well, no:

“That said, Debian Backports Policy does not allow backports of libraries that would break all dependent packages in stable (eg: new Qt 5.x releases)…”

So that’s it. Looks to me like it simply cannot be done. Debian testing has Qt 5.15.2, but I use stable. Though I think it might be time to toast my HDD and do a clean install.


Fortunately, the Veusz website also includes a prebuilt binary, so let’s try the binary.

$ wget https://github.com/veusz/veusz/releases/download/veusz-3.3.1/veusz-3.3.1-linux-x86_64.tar.xz
$ tar xvf veusz-3.3.1-linux-x86_64.tar.xz
$ cd veusz-3.3.1-linux-x86_64/
$ ./veusz.exe &
Fontconfig error: Cannot load default config file
VO table import: astropy module not available
SAMP: sampy module not available

But starts up, so we’ve got something to work with. (I could not get sampy to install.)

$ ln -s /home/username/installs/veusz/veusz-3.3.1-linux-x86_64/veusz.exe /home/username/bin/veusz
And that's done. But no!
$ veusz
[13897] Error loading Python lib '/home/username/bin/libpython3.7m.so.1.0': dlopen: /home/username/bin/libpython3.7m.so.1.0: cannot open shared object file: No such file or directory

So we cannot use a soft link to run it. Instead created a shell script called veusz:

startdir=${PWD}
cd /home/username/installs/veusz/veusz-3.3.1-linux-x86_64
./veusz.exe 2> /home/username/installs/veusz/veusz.log
cd "$startdir"

And then can call this from a hand-made .desktop file to put it into the menus.

Got there in the end! It’s a fine program and worth a little effort.

 

thob

Nifty but (not so) obscure #3: The clock package

https://ctan.org/pkg/clock

It will work on modern TeX, but I am installing it on emTeX on FreeDOS (or on DOSBox, although wget won’t work). After verifying that my paths follow those in the emtex.bat file:

cd \tmp
wget http://mirrors.ctan.org/macros/latex/contrib/clock.zip
unzip clock.zip
cd clock
copy emtex emtex.bat
emtex
cd doc
latex clockdoc
latex clockdoc
mkidx32 -s gind.ist clockdoc.idx
mkidx32 -s gglo.ist -o clockdoc.gls clockdoc.glo
latex clockdoc
latex clockdoc
v clockdoc
dvips clockdoc

All great.

Here is our LaTeX file:

\documentclass[12pt]{article}
\usepackage{clock}
\ClockFramefalse
\begin{document}
\verb|\clocktime| -- the time now\ldots \clocktime

\verb|\clock{12}{00}| -- noon\ldots \clock{12}{00}

Now we go again, but first issue \verb|\ClockFrametrue|

\ClockFrametrue

\verb|\clocktime| -- the time now\ldots \clocktime

\verb|\clock{12}{00}| -- noon\ldots \clock{12}{00}

\end{document}

And so output:

The clocks are implemented as fonts, which means many commands that can manipulate fonts can manipulate the clocks (colours, sizes and so on), but there are not font metrics for all sizes or styles, of course. You can select a bigger font using \bigclockfont and select the base font using \clockfont. Loading graphicx will allow \scalebox and so on. Endless fun.

Clocky

 

 

An explanation of the geometric mean

This was written up at a colleague’s behest. I’ve just used dvipng to make images of the LaTeX output, sorry, so not very accessible. WordPress freebie version does not do maths well… dvi2tty output, edited a little, is at the end. This is an example of ‘anything that can go on the blog does’.

Page 1

Page 2

Page 3

 

Whatevs

 

 


 

**This is rough. Sorry for the laziness.

1 Maths

1.1 Arithmetic mean

The familiar average or mean is really just one such quantity. It is more properly known as the arithmetic mean, ~x, and is calculated from

(x1 + x2 + … xi + …+ xn )/n

where xi is the ith of n measurements. The arithmetic mean is most useful when we are adding and subtracting things. For example, if I add 20 g of salt to a solution, then I add 30 g to it, and then another 10 g, how much did I add each time on average?

We can say x1 = 20 g, x2 = 30 g and x3 = 10 g, and n = 3. Our arithmetic mean (average amount added) is then

(x1 + x2 + x3)/3 = (20 g + 30 g + 10 g)/3 = 20 g

Now, it may be obvious, but we can find the total salt added by applying the average addition n times. That is:

20 g + 20 g + 20 g = 60 g:

We can see that we would get the same final total if instead of adding 20 g, 30 g and 10 g, we had added the `average extra’ (20 g) each time. Let’s imagine that before we added the extra salt, the solution already had 80 g of salt. We can then see that after we added all the salt, we had 80 + 60 = 140 g of salt in the solution.

1.2 Geometric mean

Let’s make things slightly more complicated. What happens if we increase the amount by some proportion (rather than an additive amount), again, different for each increase? So again, let’s start with a solution containing 80 g of salt. Let’s increase the amount of salt in solution by 25%, then by 12% then by 25% again. This is like multiplying the amount of salt by 1.25 then multiplying that result by by 1.12 then that new result by 1.25. If we work out how much salt we have now in total, we find we have

80 g × 1.25 × 1.12 × 1.25 = 140 g

When we simply added amounts, we could mimic the total effect by increasing by the `average extra’ each time. What if we do the same here? The arithmetic average of these relative increases (call it ~xa) is

(1.25 + 1.12 + 1.25)/3 = 1.20666666…

That is, we have an average increase of about 20.67%. Previously, we could apply the average increase n times to get the total. What happens if we apply the average increase 3 times in this case? Well . . .

80 g × 1.206 × 1.206 × 1.206= 140.6 g

Not the same as 140 g. What does this mean? This means that applying the arithmetic average of n consecutive relative changes n times does not correctly give the total change. Whereas we know that applying the arithmetic average of n absolute (additive) changes n times does work. What if we instead look at the geometric mean? We’ll call it ~xg, and we find it from

xg = (x1 × x2 × … × xi × … xn)^(1/n)

That is, we multiply all the values together and take the nth root of the result (that is, raise the product to the power of 1/n). In our case, that means the geometric average of the relative increases is

xg= (1.25 × 1.12 × 1.25)^(1/3) = 1.20507…

Now,

80 g × 1.20507 × 1.20507 × 1.20507 = 140 g

The geometric average is the correct quantity to quote when we want to give the average relative change from one measurement to the next. For example, if population increased 2% one year, and 5% the next, then 6%, 3% and so on for n years, the average increase from one year to  the next would be the geometric mean of 1.02, 1.05, 1.06, 1.03 . . .

2 Diagrams

2.1 Arithmetic mean

Here’s a rectangle. How would we construct a square with the same perimeter? We get the perimeter by adding the lengths of the sides, and a square has 4 equal sides. So the side length of the square (call it la) is obtained by averaging the side lengths of the rectangle. The total perimeter is

9 cm + 9 cm + 4 cm + 4 cm = 26 cm

so, side length of the square is

26 cm / 4 = 6:5 cm

The perimeter is obtained by adding the side lengths, so the arithmetic mean is the right thing to use here.

2.2 Geometric mean

How would we construct a square with the same area? We get the area by multiplying the lengths of the sides. And the area of a square is the square of the side length (that’s why we call multiplying a number by itself `squaring’ it). The area of the rectangle is

9 cm × 4 cm = 36 cm^2

We get the side length of a square with the same area (call it lg) by taking the square root of the area.

lg = 36 cm and the root is 6 cm

This is just the geometric mean. We can see that lg < la. In fact, the geometric mean is always smaller than the arithmetic mean (unless all the data values are the same, in which case the 2 means are equal). The area is obtained by multiplying the side lengths, so the geometric mean is the right thing to use here.

emTeX and the NX-1000

The Star NX-1000 works really well with emTeX. The emTeX prtfx.bat batch file prints a DVI file to the printer (if it is on the parallel printer port) at a very good resolution, given the limits of the printer.

If we look up c:\emtex\doc\english\dvidrv.doc, we find this:

The following dvidot parameter files for printing on dot matrix
printers are supplied:

Parameter | Printers          | Resolution | Environ. | +font-files
file      | (incomplete list) | h x v DPI  | variable | default (*)
----------------------------------------------------------
fx80  | EPSON FX and RX series | 240x216 | DVIFX | fx
fx80l | EPSON FX and RX series |  120x72 | DVIFX | fx
fx100 | EPSON FX and RX series | 240x216 | DVIFX | fx

(etc)

we can use fx80 for the higher resolution or fx80l for lower (draft). We can use the pcxfx.bat to make a PCX file of what would have gone to the printer.

We could construct a command to use DVIDRV.EXE to print, but Mattes did it for us — we just type:

C:\our-dir> prtfx boxex

(If boxex is our DVI file) and it prints at the higher resolution, including calling Metafont to make the needed fonts and then convert them to bitmaps.

A scan of a print from emTeXAdequate at best!

The docs say:

The following batch files for used for running the printer drivers:

prtlql prtp6l prthpdj prthpljh prtmx prtsty
prtlqm prtp6m prthpdjh prtfx prtbj10e prtitoh
prtlqh prtp6h prthplj prtfxl prtbj300 prtfaxwk

So there we have it! For what it is worth, this is what prtfx.bat looks like:

@echo off
dvidrv dvidot fx80 @fx /po=prn /h=12in %1 %2 %3 %4 %5 %6 %7 %8 %9

So, it invokes DVIDRV and DVIDOT with the fx80 parameter file, sends the output to prn and assumes the paper is 12in high (a standard fanfold paper height). Then it reads in the command line parameters.

The fx-related config files are in c:\emtex\data:

c:\> dir emtex\data\fx*.*
fx.cnf 385 8-09-20 9:46
fx80.dot 383 8-09-20 9:46
fx80l.dot 409 8-09-20 9:46
fx100.dot 387 8-09-20 9:46
fx100l.dot 413 8-09-20 9:46

So, what does fx80.dot look like? Well, it’s binary, but we can look at the cnf file:

% fx.cnf (240x216 DPI using FX fonts)
+dvi-file={,$DVIDRVINPUT:}@i
+font-libraries=$DVIDRVFONTS:fx_{base,more}
+font-files=$DVIDRVFONTS:pixel.fx\@Rrdpi\@f{.pk,.pxl}
+graphics-files={,$DVIDRVGRAPH:}{@Rrdpi\,}@PBf{@Ef,.msp,.pcx,.bmp}
+resolution-x=240 +resolution-y=216
+font-resolution-x=240 +font-resolution-y=216
+font-scaling=1
+metafont-mode=epsonfx,epsonfxl
+max-drift=2

So it mentions the resolution, the Metafont mode(s), gives some environment variables and other information. the .dot files are made by DVIDOT.EXE and it has its own comprehensive documentation — but we don’t need that for this printer.

Because PICTVIEW can convert images to monochrome PCX files and PCX files are a ‘native’ format for emTeX, we can use emTeX to print bitmaps. However, I suggest that BM2FONT may also be used.

Whew

gsftopk no longer falls over

A year later, on Debian 11, all is well.

$ gs --version
9.53.3

And make sure to run:

$ sudo apt install texlive-extra-utils

$ gsftopk --version
gsftopk(k) 1.19.2
kpathsea version 6.3.2
Copyright (C) 1993-1998 Paul Vojta.
There is NO warranty. You may redistribute this software
under the terms of the GNU General Public License
and the standard X consortium copyright notice.
For more information about these matters, see the files
named COPYING and gsftopk.c.
Author of gsftopk: Paul Vojta.

 

———————————————————————————-

As of August 2020 on current Debian, (10.5), it does not work:

$ gsftopk ptmr8r 300
gsftopk(k) version 1.19.2gs: Error: /undefined in shellarguments
gs: Operand stack:
gs:
gs: Execution stack:
GPL Ghostscript gs: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1992 1 3 %oparray_pop 1991 1 3 %oparray_pop 1979 1 3 %oparray_pop 1833 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval--
gs: Dictionary stack:
gs: --dict:732/1123(ro)(G)-- --dict:0/20(G)-- --dict:95/200(L)--
9.27gs: Current allocation mode is local
: gs: Current file position is 4993
Unrecoverable error, exit code 1

gs terminated abnormally with status 1

Is it an issue with gs?

$ gs --version
9.27

This is current in Debian, but maybe it’s got an issue?

I’ve recompiled gsftopk, and it throws the same error.

There are records of this bug on the Debian bug tracker, but I cannot find a solution.

I can try a newer gs binary from https://www.ghostscript.com/download/gsdnld.html — seems to be 9.52 at the moment.

$ ./gs-952-linux-x86_64 --version
9.52

OK:

$ gsftopk --interpreter=/home/username/temp/gs-952-linux-x86_64 ptmr8r 300
gsftopk(k) version Zü
.`Zü: No such file or directory
gs terminated abnormally with status 1

Seems like a bug in gsftopk too … does not actually use the correct interpreter given on the command line.

$ gsftopk --interpreter=/usr/bin/gs ptmr8r 300
gsftopk(k) version \þ
JS:\þ: No such file or directory
gs terminated abnormally with status 1

Which is the default interpreter but gives a different error to when it is not called explicitly.

Even if I copy the newer binary over the old one in /usr/bin, I get the same error as originally. So, it seems like there’s nothing to be done. Perhaps move away from Debian?

Works fine on Cygwin with gsftopk(k) version 1.19.2/952 and gs 9.52.

Works fine in Slackware 14.2 as of August 2020, with gsftopk(k) version 1.19.2/926 and gs 9.26.

Seems to be a Debian bug, or gs 9.27.

Things that make you go: Hmmm. Ok.

 

 

 

Printing from DOSBox-X

First, I installed DOSBox-X.

https://github.com/joncampbell123/dosbox-x/releases

Tried dosbox-x-mingw-win64-20200101085603.zip; unzipped and just ran it . Certainly works well enough. What about printing, though?

On the Windows command line, I did this:

H:\>net use lpt1: "\\BT-Servername-SVR\KONICA Printername SP" /persistent:yes

(note, undo a net use command with (say):

net use lpt1: /delete

Now, I can print from inside DOSBox-X. I can just go:

C:\> copy file.txt lpt1:

to print a text file, and:

C:\> copy file.ps lpt1:

to print PostScript. Of course, that needs a postscript printer attached to LPT1. (Same goes for PDF, PCL and whatever else the printer supports.)

So the basic structure here is that DOSBox-X will send the stuff to LPT1. The net use command then connects LPT1 on the host computer to a real printer (in this case. on a server). This ought not be needed if you have a real printer on LPT1 on the host. Easy way to check that would be to open a CMD.EXE window on the host and copy a small text file to LPT1: and see if it prints.

Printing from emTeX

This is best done by using dvips to make a PostScript file and then copying  it to the (PostScript) printer.

When running dvihplj in emTeX, it generates a PCL file. This can also be sent to the printer, but because this driver cannot use PostScript fonts, it is essential that the right pixel fonts (under TEXFONTS) be present. The best way to be sure is to use computer modern.

DOSBox-X

Now, DOSBox-X seems really good. The mouse integration is like VirtualBox — it grabs the mouse when you hover over the DOSBox and lets it go again at the edge. really usable. I just need to increase the environment space because emTeX sets a lot of variables. Also, running external commands from within TDE/Vim causes DOSBox-X it to fall over … what’s going on?

Maybe next time, maybe not

TeXLive but not so big

Default TeXLive is well above a GB of stuff, and a very full install is above 4 GB. That’s a lot! It also means a lot of packages to update, a lot of data allowance to use. Now, I don’t want to go too far the other way, and I don’t want to spend ages sorting this out, so:

Can I install a medium-sized system that will be highly usable but not so enormous? Can I do it without rolling my sleeves up? (The answer is of course ‘yes’.)

It’s more a question of wanting to contain the size of the updates — there’s no lack of disk space on modern machines.

For context, MS Office Pro 2010 (Word, Excel, PPT, all the other tools I don’t use etc) comes out at about 800 MB. LibreOffice specifies ‘up to 1.5 GB’, which is also rather a lot.

Step 1 — got the netinstaller

https://www.tug.org/texlive/acquire-netinstall.html

and for windows

http://mirror.ctan.org/systems/texlive/tlnet/install-tl-windows.exe

Step 2 — ran it (not as admin) and clicked Advanced

Under Selections, clicked the Scheme: Change button. Chose basic scheme (plain and latex)

(Can use Customize to be more fine-grained — add in a few things you know you want, esp. localisations, but I did not.)

Said it wants about 400 MB.

Go!

See end of post for a list of packages it installed.

Then it said:

See C:/texlive/2020/index.html for links to documentation.
The TeX Live web site (https://tug.org/texlive/) contains any updates and corrections.
TeX Live is a joint project of the TeX user groups around the world; please consider
supporting it by joining the group best for you. The list of groups is available on
the web at https://tug.org/usergroups.html.

Step 3 — a test

Opened a CMD.EXE window and checked that the path now included the tex binaries:

C:\>path
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\texlive\2020\bin\win32

OK, so … copy the sample document into some working directory and try it out:

C:\>cd \Users\username\Documents
C:\Users\username\Documents>copy \texlive\2020\texmf-dist\tex\latex\base\sample2e.tex
C:\Users\username\Documents>latex sample2e
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020/W32TeX) (preloaded format=latex)
restricted \write18 enabled.
entering extended mode
(./sample2e.tex
LaTeX2e patch level 5
L3 programming layer
(c:/texlive/2020/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(c:/texlive/2020/texmf-dist/tex/latex/base/size10.clo))
(c:/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-dvips.def)
No file sample2e.aux.
(c:/texlive/2020/texmf-dist/tex/latex/base/omscmr.fd) [1] [2] [3]
(./sample2e.aux) )
Output written on sample2e.dvi (3 pages, 7568 bytes).
Transcript written on sample2e.log.

View the DVI file:

C:\Users\username\Documents>dviout sample2e

Make a PostScript file:

C:\Users\username\Documents>dvips sample2e
This is dvips(k) 2020.1 Copyright 2020 Radical Eye Software (www.radicaleye.com)
' TeX output 2020.09.01:0934' -> sample2e.ps
<c:/Users/username/.texlive2020/texmf-var/fonts/pk/ljfour/jknappen/ec/tcrm1000.600
pk>.[1][2][3]

View the PostScript file:

C:\Users\username\Documents>psviewer sample2e.ps

(Opens it in Acrobat Reader, which is already installed on this machine; I don’t know what happens if it’s not installed.)

Or make a PDF the modern way:

C:\Users\username\Documents>pdflatex sample2e
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020/W32TeX) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./sample2e.tex
LaTeX2e patch level 5
L3 programming layer
(c:/texlive/2020/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(c:/texlive/2020/texmf-dist/tex/latex/base/size10.clo))
(c:/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def)
(./sample2e.aux) (c:/texlive/2020/texmf-dist/tex/latex/base/omscmr.fd) [1{c:/te
xlive/2020/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] [2] [3]
(./sample2e.aux) ) <c:/Users/username/.texlive2020/texmf-var/fonts/pk/ljfour/jkna
ppen/ec/tcrm1000.600pk><c:/texlive/2020/texmf-dist/fonts/type1/public/amsfonts/
cm/cmbx12.pfb><c:/texlive/2020/texmf-dist/fonts/type1/public/amsfonts/cm/cmex10
.pfb><c:/
texlive/2020/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi7.pfb><c:/texlive/20
20/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb><c:/texlive/2020/texmf-d
ist/fonts/type1/public/amsfonts/cm/cmr12.pfb><c:/texlive/2020/texmf-dist/fonts/
type1/public/amsfonts/cm/cmr17.pfb><c:/texlive/2020/texmf-dist/fonts/type1/publ
ic/amsfonts/cm/cmr6.pfb><c:/texlive/2020/texmf-dist/fonts/type1/public/amsfonts
/cm/cmr7.pfb><c:/texlive/2020/texmf-dist/fonts/type1/public/amsfonts/cm/cmr8.pf
b><c:/tex
live/2020/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy7.pfb><c:/texlive/2020/
texmf-dist/fonts/type1/public/amsfonts/cm/cmti10.pfb>
Output written on sample2e.pdf (3 pages, 137016 bytes).
Transcript written on sample2e.log.

View the PDF

C:\Users\username\Documents>psviewer sample2e.pdf

OK.

Step 4 — modifying and updating the installation

C:\Users\username\Documents>tlmgr --help | more

(screens and screen of output — key things are…)

C:\Users\username\Documents>tlmgr --gui
Please use tlshell as a GUI for tlmgr
C:\Users\username\Documents>tlshell

(Which works)

The command line tlmgr or the GUI can be used to search for and install missing packages, to update the installation and so on.

Step 5 — how big on disk?

As regards the size on disk of the texlive tree Windows properties says

Size: 389 MiB
Size on disk: 413 MiB

So, it is big, but not incredibly enormous, although of course it will only get bigger as functionality is added.

jkghbgegftc


The packages:

Installing to: C:/texlive/2020
Installing [001/131, time/total: ??:??/??:??]: texlive.infra [421k]
Installing [002/131, time/total: 00:03/17:17]: texlive.infra.win32 [2667k]
Installing [003/131, time/total: 00:05/03:55]: tlperl.win32 [6816k]
Installing [004/131, time/total: 00:22/05:23]: ae [84k]
Installing [005/131, time/total: 00:24/05:49]: amscls [1437k]
Installing [006/131, time/total: 00:27/05:44]: amsfonts [4725k]
Installing [007/131, time/total: 00:39/05:51]: amsmath [2401k]
Installing [008/131, time/total: 00:43/05:37]: atbegshi [409k]
Installing [009/131, time/total: 00:45/05:45]: atveryend [380k]
Installing [010/131, time/total: 00:47/05:53]: auxhook [286k]
Installing [011/131, time/total: 00:49/06:03]: babel [1580k]And these tools will allow pacakges to be added as needed.
Installing [012/131, time/total: 00:58/06:38]: babel-english [137k]
Installing [013/131, time/total: 01:00/06:49]: babelbib [1168k]
Installing [014/131, time/total: 01:03/06:47]: bibtex [404k]
Installing [015/131, time/total: 01:04/06:46]: bibtex.win32 [41k]
Installing [016/131, time/total: 01:04/06:45]: bigintcalc [467k]
Installing [017/131, time/total: 01:06/06:50]: bitset [622k]
Installing [018/131, time/total: 01:08/06:51]: bookmark [481k]
Installing [019/131, time/total: 01:11/07:01]: carlisle [85k]
Installing [020/131, time/total: 01:13/07:11]: cm [235k]
Installing [021/131, time/total: 01:15/07:19]: collection-basic [1k]
Installing [022/131, time/total: 01:16/07:25]: collection-latex [1k]
Installing [023/131, time/total: 01:16/07:25]: collection-wintools [1k]
Installing [024/131, time/total: 01:17/07:31]: colorprofiles [113k]
Installing [025/131, time/total: 01:18/07:35]: colortbl [593k]
Installing [026/131, time/total: 01:19/07:30]: dehyph [46k]
Installing [027/131, time/total: 01:21/07:40]: dviout.win32 [2183k]
Installing [028/131, time/total: 01:25/07:25]: dvipdfmx [3080k]
Installing [029/131, time/total: 01:27/06:50]: dvipdfmx.win32 [315k]
Installing [030/131, time/total: 01:28/06:51]: dvips [566k]
Installing [031/131, time/total: 01:30/06:52]: dvips.win32 [92k]
Installing [032/131, time/total: 01:31/06:56]: ec [280k]
Installing [033/131, time/total: 01:39/07:28]: enctex [272k]
Installing [034/131, time/total: 01:41/07:34]: epstopdf-pkg [362k]
Installing [035/131, time/total: 01:43/07:38]: etex [197k]And these tools will allow pacakges to be added as needed.
Installing [036/131, time/total: 01:44/07:39]: etex-pkg [7k]
Installing [037/131, time/total: 01:45/07:44]: etexcmds [302k]
Installing [038/131, time/total: 01:47/07:48]: fancyhdr [741k]
Installing [039/131, time/total: 01:49/07:46]: fix2col [217k]
Installing [040/131, time/total: 01:50/07:48]: geometry [900k]
Installing [041/131, time/total: 01:53/07:48]: gettitlestring [320k]
Installing [042/131, time/total: 01:54/07:48]: glyphlist [25k]
Installing [043/131, time/total: 01:54/07:48]: graphics [2007k]
Installing [044/131, time/total: 01:58/07:38]: graphics-cfg [2k]
Installing [045/131, time/total: 01:58/07:38]: graphics-def [13k]
Installing [046/131, time/total: 01:59/07:42]: grfext [310k]
Installing [047/131, time/total: 02:01/07:46]: grffile [357k]
Installing [048/131, time/total: 02:03/07:49]: hopatch [305k]
Installing [049/131, time/total: 02:04/07:49]: hycolor [380k]
Installing [050/131, time/total: 02:05/07:48]: hyperref [3766k]
Installing [051/131, time/total: 02:09/07:21]: hyph-utf8 [312k]
Installing [052/131, time/total: 02:12/07:28]: hyphen-base [22k]
Installing [053/131, time/total: 02:13/07:31]: hyphenex [187k]
Installing [054/131, time/total: 02:14/07:32]: ifplatform [156k]
Installing [055/131, time/total: 02:16/07:37]: iftex [217k]
Installing [056/131, time/total: 02:17/07:38]: infwarerr [287k]
Installing [057/131, time/total: 02:19/07:42]: intcalc [431k]
Installing [058/131, time/total: 02:20/07:41]: knuth-lib [30k]
Installing [059/131, time/total: 02:21/07:44]: knuth-local [23k]
Installing [060/131, time/total: 02:22/07:47]: kpathsea [1074k]
Installing [061/131, time/total: 02:24/07:42]: kpathsea.win32 [476k]
Installing [062/131, time/total: 02:25/07:41]: kvdefinekeys [297k]
Installing [063/131, time/total: 02:26/07:41]: kvoptions [496k]
Installing [064/131, time/total: 02:28/07:42]: kvsetkeys [378k]
Installing [065/131, time/total: 02:30/07:45]: l3backend [39k]
Installing [066/131, time/total: 02:31/07:47]: l3kernel [10455k]
Installing [067/131, time/total: 02:38/06:40]: l3packages [1825k]
Installing [068/131, time/total: 02:40/06:32]: latex [17858k]
Installing [069/131, time/total: 02:52/05:24]: latex-bin [69k]
Installing [070/131, time/total: 02:52/05:24]: latex-bin.win32 [1k]
Installing [071/131, time/total: 02:53/05:26]: latex-fonts [19k]
Installing [072/131, time/total: 02:54/05:28]: latexconfig [4k]
Installing [073/131, time/total: 02:55/05:29]: letltxmacro [292k]
Installing [074/131, time/total: 02:56/05:30]: lm [17956k]
Installing [075/131, time/total: 03:17/05:00]: ltxcmds [397k]
Installing [076/131, time/total: 03:19/05:02]: ltxmisc [16k]
Installing [077/131, time/total: 03:20/05:03]: lua-alt-getopt [6k]
Installing [078/131, time/total: 03:22/05:06]: luahbtex [30k]
Installing [079/131, time/total: 03:23/05:08]: luahbtex.win32 [1517k]
Installing [080/131, time/total: 03:24/05:04]: lualibs [213k]
Installing [081/131, time/total: 03:26/05:07]: luaotfload [1136k]
Installing [082/131, time/total: 03:32/05:12]: luaotfload.win32 [1k]
Installing [083/131, time/total: 03:33/05:13]: luatex [1867k]
Installing [084/131, time/total: 03:35/05:10]: luatex.win32 [1777k]
Installing [085/131, time/total: 03:37/05:08]: makeindex [460k]
Installing [086/131, time/total: 03:38/05:08]: makeindex.win32 [18k]
Installing [087/131, time/total: 03:39/05:09]: metafont [80k]
Installing [088/131, time/total: 03:39/05:09]: metafont.win32 [142k]
Installing [089/131, time/total: 03:40/05:10]: mflogo [242k]
Installing [090/131, time/total: 03:45/05:16]: mfnfss [458k]
Installing [091/131, time/total: 03:48/05:19]: mfware [102k]
Installing [092/131, time/total: 03:52/05:24]: mfware.win32 [58k]
Installing [093/131, time/total: 03:52/05:24]: modes [294k]
Installing [094/131, time/total: 03:54/05:26]: mptopdf [51k]
Installing [095/131, time/total: 03:55/05:27]: mptopdf.win32 [1k]
Installing [096/131, time/total: 03:55/05:27]: natbib [493k]
Installing [097/131, time/total: 03:57/05:29]: oberdiek [9106k]
Installing [098/131, time/total: 04:04/05:11]: pagesel [334k]
Installing [099/131, time/total: 04:05/05:12]: pdfescape [347k]
Installing [100/131, time/total: 04:07/05:13]: pdftex [1610k]
Installing [101/131, time/total: 04:10/05:13]: pdftex.win32 [693k]
Installing [102/131, time/total: 04:10/05:11]: pdftexcmds [391k]
Installing [103/131, time/total: 04:12/05:12]: plain [70k]
Installing [104/131, time/total: 04:13/05:13]: pslatex [7k]
Installing [105/131, time/total: 04:13/05:13]: psnfss [275k]
Installing [106/131, time/total: 04:16/05:16]: pspicture [50k]
Installing [107/131, time/total: 04:17/05:17]: refcount [329k]
Installing [108/131, time/total: 04:19/05:19]: rerunfilecheck [317k]
Installing [109/131, time/total: 04:20/05:19]: stringenc [702k]
Installing [110/131, time/total: 04:22/05:20]: symbol [36k]
Installing [111/131, time/total: 04:22/05:20]: tex [77k]
Installing [112/131, time/total: 04:23/05:21]: tex-ini-files [5k]
Installing [113/131, time/total: 04:24/05:22]: tex.win32 [130k]
Installing [114/131, time/total: 04:25/05:23]: texlive-common [502k]
Installing [115/131, time/total: 04:26/05:23]: texlive-docindex [165k]
Installing [116/131, time/total: 04:27/05:24]: texlive-en [1848k]
Installing [117/131, time/total: 04:29/05:21]: texlive-msg-translations [138k]
Installing [118/131, time/total: 04:30/05:22]: texlive-scripts [343k]
Installing [119/131, time/total: 04:32/05:23]: texlive-scripts.win32 [36k]
Installing [120/131, time/total: 04:33/05:24]: tlgs.win32 [6677k]
Installing [121/131, time/total: 04:41/05:17]: tlpsv.win32 [1411k]
Installing [122/131, time/total: 04:42/05:14]: tlshell [27k]
Installing [123/131, time/total: 04:43/05:15]: tlshell.win32 [2599k]
Installing [124/131, time/total: 04:56/05:23]: tools [5355k]
Installing [125/131, time/total: 05:01/05:16]: unicode-data [289k]
Installing [126/131, time/total: 05:02/05:17]: uniquecounter [292k]
Installing [127/131, time/total: 05:04/05:18]: updmap-map [304k]
Installing [128/131, time/total: 05:05/05:18]: url [266k]
Installing [129/131, time/total: 05:07/05:20]: wintools.win32 [5825k]
Installing [130/131, time/total: 05:14/05:14]: xdvi [175k]
Installing [131/131, time/total: 05:15/05:15]: zapfding [46k]

Nifty (but these days obscure) #2: using the emTeX graphics driver and DVI previewer (or ‘avoiding the digital dark age’)

So back in the DOS days (1990s), emTeX was a brilliant way to make LaTeX quality documents on DOS. It was a complete solution. In those days of dot matrix printers and VGA screens, PostScript was not really a central part of the DOS ecosystem. It has a fair bit of overhead for systems of that vintage, for one thing, and can render pretty damned slowly. Graphics were more often now-forgotten formats like IBM’s CGM (computer graphics metafile, I think) and PCX. So emTeX’s DVI viewer could not render embedded PostScript graphics. That was not to say they could not be used — dvips existed and could incorporate many kinds of graphics into the final file, if PostScript was your final target.

What emTeX could do was incorporate PCX bitmaps, and render them in its accompanying DVI viewer, dviscr, and then put them in the final printed version. There were not many ways of previewing LaTeX on DOS that did not involve having a cup of tea while an ancient (well, it wasn’t ancient at the time) version of Ghostscript rendered your page (or converted it to some kind of bitmap which you then viewed), or just giving up and printing it — which was fine if you had a PostScript printer, but they were very high-end in those days and often you did not.

The emTeX driver is still in TeXlive, and as a system emTeX is still there on CTAN. We can install it in DOSBox easily enough.

Here is my LaTeX file. You have to specify the image size manually:

\documentclass[emtex,a4paper,12pt]{article}
\usepackage[emtex]{graphicx}
\begin{document}
Here is a little bit of text before the picture; $\varepsilon =
\Delta \left( A B \cos\theta \right) \ldots \mathrm{etc}$

\includegraphics[width=4.2in,height=4.2in]{2.pcx}

Here is some text after the image. \emph{Just to see.}
\end{document}

Now, using emTeX on DOSBox I can process the file. The PCX was made using xFig, and the DVI viewer does not render it, though the old version of dvips (v. 5.83 from 1998) does put it into the PostScript output ok. But what about the DVI viewer that came with emTeX? (DVISCR)

I find that a PCX file that the viewer can deal with has the following properties:

  • PC Paintbrush version 3.0
  • RLE encoded
  • Monochrome

I cannot find a modern open source program to make the requisite monochrome bitmap — they all give too much colour depth. Even using ImageMagick’s convert does not work; the byte that sets the colour depth is wrong! I ask for depth=1 and get 8.

The trick is the magically compact and powerful PICTVIEW DOS image viewer in DOSBox. (And PICTVIEW is modern, it is just very stable!)

It can open most file formats. Some you can then directly reduce the colour depth to 1 bit and save as PCX. Others, you first have to convert to 256 colours, then to 2. But it works. I then call the monochrome PCX file from the LaTeX file, and here is the result.

Looks good, if monochrome
DVI file previewed using the emTeX previewer in DOSBox

Now, using the dvips and ps2pdf (from Ghostscript distribution GS386.exe, version 5.10 ) that came with the old emTeX, I get a perfectly good, though old format, PDF file — here’s a screen grab, viewed in atril:

Looks good in atril

PCX files from the very old  DOS bitmap painting program VGAPaint also work (of course, other old DOS paint programs might work too.)

FWIW, I can copy this DOSBox file tree to Haiku and get LaTeX on Haiku! (DOSBox is in the Haiku Depot.) I believe there are TeXlive binaries out there for Haiku, and you can do TeXlive properly, but this does work! Funny. I can use the native Haiku file editors and image creation tools and suchlike, then use emTeX to create the PDFs, though of course they are old-format PDFs (can run pdf2pdf or similar to update them) and I can only use LaTeX packages that confirm to the DOS 8.3 file name convention.

Looking at the same files on TeXlive on Linux, it compiles fine but xdvi does not render the PCX image.

The graphic comes out too small when I run the modern dvips. But if I recall that I scaled the PCX file while expecting 300 DPI in emTeX, I can do this:

$ dvips -D 300 EMBOX

(where EMBOX.tex is the LaTeX file and EMBOX.dvi is the DVI file) and it looks fine!

What does this tell me?

It says that LaTeX not only offers amazing cross-platform compatibility (DOS, Linux, Windows, Mac, you name it, and almost all versions of these), but also across the decades! Everything from emTeX is from the 1990s. DOS itself, the old versions of dvips, Ghostscript, emTeX. Yet I can create a file in emTeX, including graphics that I can view in the DOS-era previewer, and process the exact same files on a current machine running current LaTeX, and get the same results. Here is a close-up of the PostScript file produced by running modern LaTeX on the ‘old’ file. What digital dark age?

Looks good!Anyway, the emtex driver is really only of use in DOS anyway — you’d never use it on a modern system. If you really want to go minimal with graphics drivers, you’d use bm2font!

Worth nothing.