

Notes from a failed attempt to port LaTeX to iOS - JabavuAdams
http://vallettaventures.com/post/13124883568/the-price-of-a-messy-codebase-no-latex-for-the-ipad

======
gjm11
The author seems to mix up three quite separate things.

First, the fact that the core TeX engine is written in WEB -- a literate
programming system with Pascal as the underlying programming language. This is
responsible for maybe 1% of the author's problems, but the author writes as if
it's the main issue.

Second, the fact that the LaTeX ecosystem includes things like kpathsea built
out of C, bash scripts, and baling wire. This is certainly a real problem for
any porting effort.

Third, the fact that LaTeX itself equals the TeX engine plus lots (lots and
lots and lots) of other bits written _in TeX_. TeX is not only a typesetter,
it's a (horrible, horrible) programming language, and LaTeX is built out of
lots of packages implemented on top of that. _This_ is what makes LaTeX slow;
it has nothing whatever to do with Pascal or WEB or even bash scripts.

Rewriting the WEB stuff in modern C (or CWEB, if the people concerned wanted
to preserve the literate-programming approach) might help with portability. It
would do nothing to help with speed. In fact, rewriting the old Knuth code
would probably make the system slower -- there are things not to like about
Knuth's coding style, for sure, but no one would accuse him of not being
sufficiently concerned with efficiency or of not being able to write efficient
code. What it would take to make LaTeX much faster is not a from-scratch
_rewrite_ of the codebase the author complains about, but a from-scratch
_redesign_ to enable much more of the work to be done in native code instead
of in packages implemented in a nasty macro-expansion language, and to make
the extension language nicer and more efficient. (Most likely, by replacing it
with Python or Lua or something; see <http://www.luatex.org/> for an attempt
to do something rather like that.) Plus a _monstrously large_ project to re-
implement all the packages that make LaTeX what it is on that new substrate.

~~~
keenerd
You get 95% of the functionality in 1% the size with a 50x boost in speed by
using Lout instead of LaTeX.

<http://lout.wiki.sourceforge.net>

~~~
gjm11
Maybe Lout has improved a lot since I last tried it -- which, admittedly, was
a long long time ago -- but my recollection is that the quality of its
typesetting was always very greatly inferior to that of TeX's. It might have
95% of the functionality as measured by feature-counting (though ... there are
a _lot_ of LaTeX packages out there, doing all kinds of wacky things) but
that's not worth much if the output just doesn't look good.

------
kraemate
The author seems to blame Latex, when the fault squarely lies with Apple and
their "any iPad app be a single executable" policy. Oh, and Latex is not 4GB.
The standard,minimal distribution (which is what 99% users will ever need)
fits inside of 50MB (with all the fonts). For everything else there is CTAN.

So now it's Latex's fault that Apple does not understand the concept of
packages and libraries ?

~~~
lukeschlather
Apple understands it perfectly well. They just don't want any iOS apps that
contain package managers. Which makes sense from their perspective, but it's
very user-hostile.

~~~
rrreese
I think that Apple sees this as not being user hostile. If you want packages
installed then you have to use the appstore and in app downloads. This has the
advantage of being a consistent experience across all apps. Users do not need
to fear in app downloads, or get confused by them they get the same experience
every time. Obviously this hurt geeks like us who have no problem using a more
exotic system, but in general it favours the bulk of Apples user base.

Note that this applies to purchases as well, if you give the app money its
always through the same interface. Users see spending money in iOS as being
painless and danger free.

Do I wish I had more power over my iPad? Sure do, but Apple doesn't care about
us, they care about the 90% of users who are less sophisticated then us.

------
tincholio
Every now and then someone comes up with these 'brilliant' ideas, such as
reimplementing (La)TeX or Emacs from scratch. All it shows is that they don't
have a clue of the tons of man-years that have gone into the current
incarnations, and the fact that they actually work awesomely well for 99.99%
of the cases.

Also, he starts from a false premise when he points out that the ipad is the
'most beautiful platform'. It might be ok for watching videos and playing
angry birds, but without a physical keyboard it will always suck for composing
anything text-related, when compared to a real computer with keyboard and an
eye-level screen (also, if you're carrying a BT keyboard for your ipad, you
might do better with a macbook air).

------
bhickey
Why bother porting? Just cobble a parser onto a text editor and send the text
off to a server for compilation.

~~~
jkimmel
I'm not an iOS programmer, but I believe that in itself could present a few
difficult issues on both the client and server end. Despite the potential for
the problem to be solved, I think the real purpose in the article wasn't to
say that a LaTeX based typesetter could never be implemented on tablets, but
to demonstrate that implementing one wouldn't be so hard if the codebase was
cleaner. I think it outlines one of the really fundamental issues in OSS
today, in that everyone wants to build, but no one wants to clean up, leading
to extremely powerful pieces of software like LaTeX, that no one person can
reasonably read and port anymore.

------
brudgers
_"If we were going to bring LaTeX to the iPad we have would do so such that it
would be usable and appealing to the majority of the iOS userbase,"_

I think that this assumption is fundamentally flawed. A Latex app only needs
to be better than the alternatives in order to appeal to the entire potential
user base - a user base which is quite small in relative terms.

In other words, the fundamental feature for the minimum viable product is just
getting Latex running on the iPad (or even some meaningful subset). Snappy
performance and a gorgeous interface are not critical features of Latex - it
has always been about the document for those who have invested the time to
learn it.

Of course, slow performance and a clunky experience may not make it through
the review process, but a limited implementation would capture most of the
potential market.

------
homerowilson
I use LaTeX on my Asus transformer primer in a Debian Squeeze chroot. It runs
quite fast and works well.

------
cleverjake
See previous discussion - <https://news.ycombinator.com/item?id=3264341>

------
ja27
How is LaTeX now 4Gb? I haven't touched it in years, but I can't fathom how
it's grown so much.

~~~
gglanzani
It's not. 4GB includes almost 4GB of packages that you don't need to have
"bare" LaTeX.

~~~
ja27
I know, but what is in even the biggest set of optional packages to reach 4GB?
Fonts? Viewers and tools? Maybe it's just the old unix fart in me, but we've
had entire OSs with many GUI apps in much less than 1GB.

------
_pius
I smell a Kickstarter project ...

~~~
EliRivers
Wrong kind of tex :p

[http://www.kickstarter.com/projects/251414413/tex-murphy-
pro...](http://www.kickstarter.com/projects/251414413/tex-murphy-project-
fedora)

------
warmwaffles
No thanks, I'll stick to my markdown and pygment lib

~~~
ihodes
You should check out LaTeX if you haven't; I am a big fan of Markdown & syntax
highlighters, but LaTeX is solving a much different problem, and it solves it
very well.

