Given my longtime wish to see LaTeX on iOS (and past experiments with porting it myself), I was thrilled to see that TeX appears to have finally made it natively to iOS in the form of TeX Notebook. Naturally once the novelty of being able to typeset on my iPad had worn off I started a spot of digital archaeology to find out how this was done - in summary, it appears (though I could be wrong) that the App’s typesetter itself is an x86 emulator, which loads a frozen image of MSDOS6+Tex, and the typesetting is done there.
Why do I think this? Poking around in the contents of the app bundle(v1.0) there is a config directory containing 4 files of interest
init.l is ~20 lines of Lisp, calling memory initialisation, cpu initialisation and hardware initialisations, presumably a init file for an emulator of sorts. During its init it loads the
raw2 files. These are binary files and more or less unreadable, but
raw2 has a header in it clearly identifying it as a bios file connected with the bochs.sourceforge.net project.
This VGA/VBE Bios is released under the GNU LGPL
Please visit :
This header suggests it is a BIOS file from the bochs (x86 emulator) project, leading me to believe that this app contains an emulator.
The final file
texmf is also the biggest, my guess is it is the disk or memory image loaded into the emulator. The first two chars of this file are
PK, a smoking gun that this is in fact a .zip archive.
Having decompressed to a 10MB
texmf.cache file I had a look around. Once again it is hardly human readable, but the first line contains the strings “Invalid partition table”, “Error loading operating system” and “Missing operating system” so clearly this is an OS image, but which?
Around line seven I came across
SYSMSDOS - this OS is clearly of the DOS variety and line 25 has
TEX~1 EXE, so it is reasonable to assume the developer has come up with the ingenious solution of dealing with TeX’s unruly and iOS incompatible nature by wrapping it up in an x86 emulator.
Down on line 19682 you come across a chunk of Tex that I imagine must be part of the TeX distribution, and most curiously on line 8256 there is the entire text of a “Study in Scarlet”.
The only flaw in this plan comes around line 273
MS DOS Version 6 (C)Copyright 1981-1994 Microsoft Corp Licensed Material - Property of Microsoft All rights reserved.(and also on 307, 598, …) This may be an ingenious plan, but if I have guessed right (quite possibly I haven’t) it is also an illegal one.