

How TeX made it to the iOS App Store - running on DOS, inside an emulator - steeleduncan
http://vallettaventures.com/2012/08/27/tex-notebook/

======
chj
Developer here.

Take this as a proof of concept. New update (a native one) will change
everything.

Btw:

1\. The 486 emulation engine I have been working on is intended for DOS game
emulation. It happens to be fast enough to run TeX, although it is at least
ten times slower than the native version.

2\. Next time, don't pretend to be a customer in the email. Be clear that you
are a developer (working on TeX apps), I'll be more open to your questions.

~~~
ghost91
It would be interesting to hear your standpoint on the IP infringements (DOS,
GPL License...)

~~~
chj
First of all, No GPL violation here. The BIOS rom is licensed under LGPL, as
long as you do not build it in the executable, you are not violating anything.
Users can replace this component freely.

The disk image is formatted with "/S" option. I am not sure if that counts as
shipping DOS.

~~~
pygy_
You're distributing files copyrighted by Microsoft, namely _msdos.sys_ ,
_io.sys_ and possibly _command.com_ (IIRC you could override it by setting the
_SHELL_ environment variable in _config.sys_ ).

They may be small, but they since pack the core functionality of MS-DOS, I
don't know if a fair use defense would fly...

You should also distribute the source of the BIOS with the app (because Apple
is the distributor, not you).

Otherwise, very cool project. Is your x86 emulator available somewhere? What
will differentiate it from DOSBox?

~~~
chj
Yes, these files are the essential part of a boot disk. Did MS forbid people
transfer boot disks when they were still selling DOS?

The emulator only runs on ARM cpu(at present works only for jailbroken
iPad/iPhone). You can download it (free) at www.aemula.net/download.html

This is much less than DOSBox in terms of features, but when it runs, it runs
fast.

~~~
flatline3
> _Yes, these files are the essential part of a boot disk. Did MS forbid
> people transfer boot disks when they were still selling DOS?_

Do you have a license that states you can ship those "essential" files? If
not, then all you have is a copyright statement, which effectively forbids
redistribution.

------
pygy_
To answer several comments who suggest to use Free software:

You can't run GPLed software on iOS. The App store has its own license with
term incompatible with the "no other restrictions" of the GPL, and Apple, who
is the distributor, is not willing to provide the source anyway.

This means No FreeDos, no Linux, no DOSBox, no QEMU(which is has no
interpreter, only a dynamic compiler, which also rules it out), no BOCHS...

I don't think that there are non-native, non-GPL, non-proprietary solution to
run TeX on iOS.

To run TeX on iOS, you'd have to port the WEB/Pascal compiler (the language in
which TeX is written) to ARM+iOS...

~~~
ksherlock
web2c converts the TeX web/pascal source code to C code which is what actually
gets compiled for teTex, TeXLive, etc.

[http://www.tug.org/svn/texlive/trunk/Build/source/texk/web2c...](http://www.tug.org/svn/texlive/trunk/Build/source/texk/web2c/)

------
jdleesmiller
That is an impressive feat of emulation, but it's worth noting that there are
some good online alternatives, if you really want to write LaTeX on your iPad
(from somewhere with an Internet connection).

Here's one that I wrote: <http://www.writelatex.com> (At least I think it
works on iPad... I haven't tested it recently.)

And there's also <http://www.scribtex.com> and <http://www.sharelatex.com>

~~~
podperson
By the same token doing the conversion in the cloud and wrapping a nice UI
around it would be totally viable.

------
FrojoS
I don't get it. The OP pretends to like the app and is glad someone achieved
to build one for iOS. But then, why suggest the author, chj did something
potentially illegal or at least against the rules of the app store? In Germany
we say: "Don't wake up sleeping dogs."

------
radarsat1
I understand this as a good hack, but I don't really get why anyone would want
to run TeX on an iPad/iPhone. I mean, phones and tablets seem to be good at
everything _except_ for extensive typing. I would never want to work on a
paper on my tablet, I can barely type out a long email on it without getting
frustrated.

~~~
duaneb
I do most of my typing on my iPad via a bluetooth keyboard.

~~~
radarsat1
Cool, but why not just use a laptop then?

~~~
duaneb
Because I can't detach the keyboard from the laptop, and my laptop doesn't
have 3g.

------
NonEUCitizen
they should replace MSDOS with FreeDOS ?

~~~
steeleduncan
or even use linux . . .

~~~
justincormack
Or run it natively on iOS... it sounds incompetent to me.

~~~
seclorum
Hah hah. Run TeX natively on iOS. Good one. :)

~~~
chris_wot
There is something I've missed here... What is so funny about running TeX
natively on iOS?

~~~
vetinari
TeX is an interpreter. It can interpret the user supplied scripts.

Interpreters than can run code supplied by user or downloaded from internet
are verboten on iOS.

~~~
jahewson
This has not been true since late 2010, the rule is now that applications
cannot interpret scripts downloaded from sources external to the app.
Embedding an interpreter in an app is fine.

~~~
prodigal_erik
If this is at all useful, it can render a downloaded .tex document, which
equates to running a script from an external source (because TeX macros are
Turing-complete even if not convenient).

~~~
duaneb
Well, it's sandboxed interpretation. You can't really do much with TeX aside
from maybe reading files from the filesystem.

------
shiven
Does Microsoft even care anymore about MS-DOS to go after such IP
infringement?

~~~
ams6110
Whether they care or not I don't know; I would say if you asked them they
would care; I don't see any evidence that they've put the OS into the public
domain or anything. I believe they do still distribute MS-DOS via MSDN, and
it's still used for some legacy and embedded applications. I still see a lot
of retail POS systems that appear to be running in DOS or at least in a full-
screen character mode.

Wonder why DOS was chosen instead of Linux?

~~~
tomrod
GPL issues, maybe?

------
tomrod
Would it be possible to make a MathML writer that typesets?

~~~
thebooktocome
MathML is not a substitute for TeX.

~~~
tomrod
It isn't yet, but for the basics it may well be usable.

~~~
thebooktocome
I'd be greatly surprised if MathML ever overtook LaTeX as a math authoring
tool. XML is not friendly to humans, and I don't see career mathematicians
being comfortable with a bazaar of half-constructed WYSIWYG editors. After
all, most choose to write LaTeX by hand now!

~~~
tomrod
> most choose to write LaTeX by hand now!

Really? I haven't come across that. Cool, if so.

------
chj
App has been updated:

<http://litchie.com/blog/?p=406>

Cleared of copyright issues.

------
StavrosK
Why didn't he just use Bochs to boot the image?

------
sproketboy
Sounds like Apple will remove this if they find out about it.

