Hacker Newsnew | comments | show | ask | jobs | submit login
How we ported LaTeX to the iPad (texpadapp.com)
100 points by steeleduncan 980 days ago | 36 comments



The most clueless TeX related piece I have read since their previous one. For example, kpathsea is a library that TeX engines call, so no forking is done to “grab search paths from the Kpathsea system”. And the bright future for C implementation didn't happen when TeX WEB code was hand converted into much more readable C code 8 years ago (http://metatex.org/), not to mention the existence of an actively maintained, extended TeX engine written in C (http://www.luatex.org/), wait, this is GPL “encumbered” so it does not count. Did I mention that XeTeX does not “skip the DVI step” at all, but it actually does fork an external binary to convert its ‘extended’ DVI into PDF.

-----


I also loved the GPL ``encumbered'' bit. But they are trying to sell a (binary only) app for iOS, so I can see how it's inconvenient to them if other people don't give them all rights to their code.

TeX, while maybe not pretty, has stood the test of time remarkably well. I find it somewhat low of the article to bash the technology it uses (WEB, DVI) just because they are not the newest and hippest.

-----


I also loved the GPL ``encumbered'' bit. But they are trying to sell a (binary only) app for iOS, so I can see how it's inconvenient to them if other people don't give them all rights to their code.

As far as I know, Apple won't allow GPL software on iPad/iOS, they ban it on the App Store. So it isn't this company trying to get around the GPL, it's Apple.

-----


Apple doesn't care. GPL backers like the FSF are who enforce GPL'd software not being in the App Store. They feel that the GPL is incompatible with Apple's distribution mechanisms, since it's impossible to "distribute" a modified version of the app to iOS devices without going through the App Store. But if a group decided to upload their GPL app, Apple isn't going to check, and won't kick the app out of the store on GPL grounds.

The VLC example mentioned below in fact supports this: Apple was absolutely fine with it being in the store until Rémi Denis-Courmont filed a copyright violation with Apple asking them to take down the version that had been posted there. Apple didn't take initiative to remove it themselves.

-----


> GPL backers like the FSF are who enforce GPL'd software not being in the App Store. They feel that the GPL is incompatible with Apple's distribution mechanisms, since it's impossible to "distribute" a modified version of the app to iOS devices without going through the App Store. But if a group decided to upload their GPL app, Apple isn't going to check, and won't kick the app out of the store on GPL grounds.

What if someone sold an iOS app that could be downloaded from the iTunes App Store that "contained" the source code? (Actually, it would detect whichever app started it and would download the source on demand.) Combine this with a free app and service that lets people use on-air provisioning to get modified versions of apps?

-----


You don't need to include the source code to be in compliance with the GPL. You can easily have it downloadable from your website. You only need to provide it for about 3 years (IIRC). You can just have a note in your 'About' screen: "This is GPL software, go to http://www.example.com to get the source". That should suffice.

-----


It isn't the FSF that enforce the GPL, it's the copyright holder, i.e. the original programmer.

I think "this software is for personal use only" is the main (only?) GPL incompatible parts of the App Store terms. I don't know if it's a possible outcome, but I wonder if there's some way to force iOS to be an OS where you can run any programme (i.e. no App Store needed), if there is GPL software. This is clearly not something Apple want, so they may be trying to nip that problem in the bud by setting things up to stop GPL. I believe some sort of Microsoft app store explicitly bans GPL.

Apple do officially care, and they only officially allow things in that match their rules. If you told Apple that the software was GPL, they would probably care and pull it.

The reason VLC was there for long was because Apple clearly don't check things in the App Store very much (examples like this, and various scammy apps, and pirated software back this up). However once (one of) the copyright holders noticed it, they informed Apple that Apple was distributing copyright infringing software, and Apple promptly acted.

GPL software on the iOS App Store is about as legal as copying DVDs of Hollywood films and selling them yourself, or copying someone else's closed source software and uploading it to the App Store.

Remember, GPL software is often based on other GPL software that someone else wrote, and released to you under certain terms (the GPL). To distribute it via the App Store goes against the spirit and letter of those terms. It should be clear why some developers are annoyed about people who do that.

-----


> They feel that the GPL is incompatible with Apple's distribution mechanisms, since it's impossible to "distribute" a modified version of the app to iOS devices without going through the App Store

That's a common misconception, but actually has nothing to do with the GPL/App Store incompatibility. You can distribute a modified version of the app in source form, and let the users compile it and install it on their own device. You just can't distribute a modified version through the App Store, but that's OK. GPL has no requirement that people who modify GPL code be able to distribute their modified programs through the same channel they obtained the unmodified program.

The GPL/App Store compatibility arises from the App Store terms of service. In order to download from the App Store, you have to agree to things, such as not reverse engineering what you download. GPL prohibits distributing GPL software with additional restrictions, and the App Store terms count as additional restrictions.

-----


it's impossible to "distribute" a modified version of the app to iOS devices without going through the App Store

Y'know I'm not sure this is something the GPL would care about. I mean if Apple sell GPL software (gcc), but if I modify gcc Apple are unlikely to sell my fork on apple.com, that doesn't mean Apple are breaking the GPL.

-----


This, see the VLC fiasco for details

-----


Apparently kpathsea, which is a C library, shells out to implement some functions. That's where their (unclear) comment on forking comes from.

This comment from the previous post indicates that it might not be such a big deal to fix this:

http://news.ycombinator.com/item?id=3264887

The whole thread on their earlier post is here:

http://news.ycombinator.com/item?id=3264341

Alas, it is not particularly enlightening.

-----


Agreed. The author displays a huge lack of understanding of how TeX works.

A big problem of current projects to port TeX is that most of them rely in the original translation from pascal to C, which is just a hack turned into a maintenance nightmare. I believe a better approach would be to write a better translator that would be easier to integrate with different environments such as iOS.

-----


So where is the source? Also I am fuzzy on whether or not this is a license violation:

[TeX] This program is copyright (C) 1982 by D. E. Knuth; all rights are reserved. Copying of this file is authorized only if (1) you are D. E. Knuth, or if (2) you make absolutely no changes to your copy. (The WEB system provides for alterations via an auxiliary file; the master file should stay intact.) See Appendix H of the WEB manual for hints on how to install this program. And see Appendix A of the TRIP manual for details about how to validate it. TeX is a trademark of the American Mathematical Society.

I know they are altering the translation not the WEB source but that is still the Tex program.

-----


AFAIK, the only requirement to comply with TeX license is to not name a the modified program TeX. This wouldn’t be the first proprietary version of TeX.

-----


I don't think there is a limitation on selling TeX derivatives. A lot of commercial products based on TeX have been created, such as Scientific WorkPlace. I would be concerned about cweb, the translation of TeX from pascal to C used on unix.

-----


Maybe one of them changed his name ^_^

-----


Very interesting, but does anyone here feel like this would be useful to them? For example, in my limited experience with LaTeX I've also needed to generate graphs (via Graphviz or R). Even if there existed apps for these, I'm under the impression that the iPad has no user-accessible filesystem, nor allows iPad apps to talk to each other. Please correct me if this is mistaken.

-----


I can offer one data point: I run a browser-based LaTeX editor (http://www.writelatex.com) and currently 2% of visits come from iPads. 6% come from a mobile device of any kind. I'm not sure how many of those actually try to do any serious writing, though.

-----


While the filesystem is not directly accessible by either users or apps for security reasons, it is possible for apps to communicate and/or exchange files. Your app can register the ability to open certain filetypes with the OS (e.g., so users can open mail attachments or Dropbox files in your app) and it can communicate directly with another app through custom URL schemes (e.g., to accomplish single-sign-on using the Facebook app).

-----


I installed TeX writer in my iPad (the other iPad TeX version referenced around here in the comments), just for fun (when I needed to do some TeX on the go, I just ssh'd and looked at the PDF in Dropbox.) Finishing my PhD, I don't generate any more images, they are all already done. And TeX Writer is surprisingly effective as a compiler (feels faster than my desktop!) Love it as a proof of concept... but only use it sparingly. I don't think I'd use TeXPad any much, although the editor looks fancier

-----


You had me until "we have begun work on refactoring TeX's translated C sources into C++"

-----


Why? I know it's popular to not like C++ now but it really is far more maintanable for a large project than C - best example is how GCC are moving to C++ for the compiler source.

-----


I'd like to see a TeX -> MathML program come about. With web publishing, the standard A4 page approach isn't optimal anymore; further, MathML just seems so cool (even if it's still really in it's beta or alpha stages). I know TeX has so many things you can do with it, but this article brings up a great point: with people moving a large majority of their work to diminutive tablets, a 4GB TeXLive distribution probably won't work.

-----


The simple answer to that seems to be to not move to working on tablets. For LaTeX editing, I can't see any advantage that a tablet would offer over a notebook, and there are a lot of disadvantages.

-----


An article that appeared at the same time on HN's front page points out some of the benefits:

http://yieldthought.com/post/31857050698/ipad-linode-1-year-...

-----


He does not compare the tablet with a notebook for the use case of interest here, writing TeX documents (or something similar), and the disadvantes for notebooks that he gives would seem to prevent you from working with a tablet too (e.g., using a remote server for compilation will also help with the battery life of a netbook, and you may even be able to swap the battery).

The major problem in writing TeX on a tablet seems to be the keyboard: It takes away screen space (which is already hard to come by, since ideally you would have the source and the compiled output displayed side-by-side), is much less convenient to use than a physical keyboard, and (usually) makes it more difficult to get to special characters which are really important for TeX: \, {, }, [, ], and so on.

I can see how it could be usable for copy-editing, but for longer writing a notebook beats a tablet any day.

-----


There is no shortage of TeX ↔ MathML conversion tools and solutions, one spectacularly prominent example is MathJaX (http://www.mathjax.org/) which can take TeX input and output MathML (for browsers supporting it) or do its own rendering into regular HTML.

-----


Mathjax is pretty cool but it's also pretty slow if you have many formulas. While it's loading the page keeps rescrolling up and down because the document grows and shrinks. I started noticing the load after already ~30 formulas, quite big formulas though.

Also the distribution is a bit bulky, it consists of over 30000 files. You can remove many of them but then you also loose a big part of the compatibility. While speaking of compatibility, some formulas look kinda weird, but those are very few

-----


Previously: http://vallettaventures.com/2012/08/27/tex-notebook/

-----


Developer of TeX Notebook here, now TeX Writer(first native LaTeX compiler on iPad).

That post is no longer true. I wrote the full story here:

http://litchie.com/blog/?p=419

-----


It's great they did it, knowing how frustrated they were in the last blog post. That I don't really understand what's going on only makes the achievement larger in my eyes. Would be awesome if this led to a faster tex version that can be used by Desktop applications too, like Texmaker etc.

-----


I was almost going to buy that app, but it looks like their modified tex engine isn't open source.

I'm not quite sure why this irks me so much. I'm not likely to mess with tex source, but it'd be nice to share what was shared with you.

-----


I wanted to try the demo, but I'm not sure what to do with it. I loaded up my resume, but since typesetting is disabled, what exactly am I "demoing" other than an input field?

-----


I really hope that this Bataan death march of porting LaTeX to the iPad is the final word on whether or not literate programming is a worthwhile endeavor.

-----


It doesn't have to do with literate programming per se.

It has to do with a very widespread and powerful legacy system (with extreme requirements for backwards-compatability and portability) that happened to be written decades ago in, basically, Pascal.

Furthermore, the people doing this port don't seem to have total command of the tex infrastructure. This has held them back.

For instance, they didn't know what kpathsea was until well after they started their port ("As best we could tell kpathsea is a library to find fonts and scripts in the sprawling TeX distribution...", from http://texpadapp.com/2011/12/10/price-of-amessy-latex-not-fo...).

kpathsea is a basic library that anyone who has tweaked TeX configurations would know about. It has a certain syntax for subdirectory searching that you have to learn, as well as a utility command (kpsewhich) that you run quite a lot to debug "file-not-found" problems.

-----


Knuth's Web literate programming system is based on transforming the literate sources two different ways: "weave" transforms the source into the published book form, and "tangle" strips all comments, and massively rearranges the source into compilable Pascal (Rearranging was probably a somewhat Pascal specific feature, and newer literate programming systems don't necessarily rearrange anymore, I think).

Since their C code is based on the tangled code, their transformation discards the ENTIRE comments of the original source (and simply not stripping the comments would not help, because in the rearranged order they wouldn't make much sense anymore). Essentially, they are rendering TeX illiterate.

I can't conceive how this could possibly lead to a more maintainable product. TeX has a perfectly workable way of making arbitrary local changes through "Changefiles". The Pascal/C code was never meant to be edited directly.

-----




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: