Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

A few weeks ago I read this article about some difficultites bring TeX to the iPad.

It made me wonder: why not rewrite TeX.web in C++11? The codebase itself is now quite stable, and (unfortunately) it won't be too many more years before it's completely frozen.

I just downloaded the source; it's about 25,000 lines of WEB code. Let's say the code/comment ratio is 1/5, which results in around 5,000 lines of actual source code. At one line/minute hand rewrite, that's a little over two weeks. Even if these calculations are off a bit, it still seems like a "summer vacation" project.

Yes, I know there is a lot more than just TeX.web. But it seems like a native C++ implementation (rather than a web2c compiliation) could be an interesting step in a different direction.

share|improve this question
10  
I'll spend you a sixpack of bear if you finished it, I'm a generous person, in one year! –  Herbert Dec 13 '11 at 16:16
3  
I'm not really sure this is a question, as such (I find it hard to believe that there will be an answer other than 'well, no one has done it'). The other thing to point out is that LuaTeX has been converted to C, although there are I think GPL pieces to this code which would be an issue for the iPad. –  Joseph Wright Dec 13 '11 at 16:22
2  
This cannot be a direct translation, so line for line rewriting simply makes no sense. You could translate it line by line, but then you'd lose any benefit of using an object oriented language like C++. You'd have to rethink the structure of TeX.web to make it suited to C++ and that's got to be a huge task. –  qubyte Dec 13 '11 at 16:38
6  
My feeling is that the article you refer to has little idea how the TeX world today works. –  Yan Zhou Dec 13 '11 at 17:02
2  
Interesting idea, and I'll throw in a bottle of aquavit to go with Herbert's beer (but only if you eat lutefisk while coding). However, I don't actually see a question here (and I agree with Joseph and Yan's comments in particular) so I'm voting to close as "Not a real question". –  Andrew Stacey Dec 13 '11 at 17:18
show 10 more comments

closed as not a real question by Andrew Stacey, diabonas, Alan Munn, topskip, morbusg Dec 13 '11 at 20:21

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers

Check Taco's CXTeX; "A hand-converted C version of TeX". I think one can throw some C++ syntactic sugar on top of it, but IMO that is as far as you can go without rethinking the whole TeX structure.

share|improve this answer
    
This is real close to what I was thinking; notice Knuth's comments in the source code! I'd go with C++ instead of C; and I'd keep it 100% TeX w/o adding PDF stuff in the same code base. –  Dan Dec 13 '11 at 18:17
3  
Now I've actually read the article, I fail to see how its conclusion solves any of the mentioned problems; you can have only one executable (TeX), a tiny distribution (LaTeX core, no fonts) and I bet it would take a competent person few hours to build it and the result would be few megabits, without re-writing one line of TeX code. –  Khaled Hosny Dec 13 '11 at 18:26
add comment

Have a look at the source code for LuaTeX: It contains no Pascal code anymore. All of it has been converted by hand to C.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.