I have always been curious why LaTeX is so fast and why attempts to improve it have failed. In order to make that question more precise, I could ask which algorithms are used and how. I heard there is lots of legacy code still that has not changed in decades.

Where is the appropriate place to ask such a thing?

Is it appropriate to ask questions about the design of LaTeX?

  • 5
    As has come up before, LaTeX is not an engine it's a TeX format. As such, you need to be clear if you are asking about the algorithms in the macro layer (such as float placement) or those in the binary (such as the hyphenation one). Moreover, you should specify exactly which parts of the code you have in mind.
    – Joseph Wright Mod
    Commented Jan 25, 2016 at 14:03
  • @JosephWright I guess have to start from zero then. What are the steps in turning my TeX code into a polished document? Commented Jan 25, 2016 at 14:41
  • is this a duplicate of tex.stackexchange.com/questions/77918/… Commented Jan 25, 2016 at 15:28
  • 2
    You might look at tex.stackexchange.com/questions/63994/… for TeX vs. LaTeX. On 'How does the whole of TeX work' really you need a book, for example TeX: The Program.
    – Joseph Wright Mod
    Commented Jan 25, 2016 at 15:28
  • @DavidCarlisle -- don't think this is a dupe of that question, or any of the questions linked to it. the key difference that i see is that the other questions don't address "why attempts to improve it [tex] have failed". i think that at least some of the reason can be ascribed to how dek concentrated on making the inner loop especially efficient. that's been described in various places, but i can't put my finger on those without rather much digging. gains in efficiency have mainly since then been ascribable to the effects of moore's law and corollaries. Commented Jan 27, 2016 at 19:59

3 Answers 3


What you are asking is actually a prime example of literate programming not being as literate as often CS people claim it to be so. There is definitely not a shortage of geeks who can implement X in Y but TeX has so far eluded everyone. The same problem holds for Fortran linear algebra libraries. They are amazingly fast but they have been optimized almost to the point where the memory management is done manually.

I think it is surely on topic but not so easy to get an answer even from our wizards because to my very biased eyes it's a spaghetti code (for good reasons that are not relevant to the matter here).

  • 2
    I agree it's on-topic but does need to be focussed: the danger is asking how all of TeX works!
    – Joseph Wright Mod
    Commented Jan 28, 2016 at 8:40
  • For example, perhaps: TeX the program (texdoc tex), section 69: "Roman numerals are produced by the print roman int routine. Readers who like puzzles might enjoy trying to figure out how this tricky code works; therefore no explanation will be given." Commented Jan 28, 2016 at 22:32
  • @JosephWright True, it is very easy to ask a question though specific sounding turns out to be asking all of TeX
    – percusse
    Commented Jan 29, 2016 at 12:22

As someone who has made it through at least a few pages of the WEB source code for TeX (before getting way over my head!), I would love to see some questions on this site about how the TeX program itself--as opposed to the TeX language--works at a very low level. Questions about Knuth's algorithms in the source code of TeX would be on topic, I believe, even if only a few users here could answer them.

If you can turn these questions into more conceptual ones (e.g., about the philosophy behind Knuth's strategy of memory allocation) then you might get better answers on Programmers.SE.


The operation of the LaTeX engine is certainly an interesting topic about which many questions could be asked. To determine whether they should be asked here, I think you'd need to consider another question first: "Are the people who are good at using LaTeX (i.e. this site's user base) also people who would generally know a lot about its implementation?"

I don't know the answer to that question, but if it's "yes," I would think this would be a good place to ask, and if it's "no," I would look for a more code-oriented site in the network, depending on the specifics of your question.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .