Where are the best places to look if one would like to understand the LaTeX2e source code?


  • 13
    texdoc source2e – Axel Sommerfeldt Jun 21 '13 at 6:58
  • 1
    Did you read the source code (.dtx files)? – Joseph Wright Jun 21 '13 at 7:20
  • @JosephWright Oops :-) I've only ever stared at the docstrip-generated latex.ltx and have thus been wondering where all this community knowledge comes from. I think the reason why I didn't know is that whenever someone pasted snippets from the LaTeX source (in answers on this site), I've searched them, and was led to something like latex.ltx, which is of course unannotated. So I simply didn't look in the right place or didn't follow pointers far enough. The header of latex.ltx does mention docstrip, but I didn't know that dtx was a format for annotated sources. Thanks! – Lover of Structure Jun 21 '13 at 8:48
  • 2
    @LoverofStructure one useful tip if you are looking at latex.ltx and decide to switch to the documented form, search backwards for %%% and it which tell you which documented file the bit you are looking at came from. – David Carlisle Jun 21 '13 at 12:17

As indicated in the comments the source is all written in dtx source form and can be typeset with a fully indexed cross referenced documented form documenting every command and indexing the use of every command in the source. You can process the sources yourself with latex and makeindex but most distributions have a source2e.pdf ready made.

  • Oops :-) See my comment above. – Lover of Structure Jun 21 '13 at 8:54
  • 2
    @LoverofStructure Personally I always use latex.ltx (which is usually to hand in my emacs) rather than source2e, but then I made source2e I don't want to have to read it as well:-) – David Carlisle Jun 21 '13 at 8:57
  • 3
    @HeikoOberdiek: there's no hope of clarifying your own docs (apart from the odd typo). you need a user to point out the problems. source2e is, of course, too bulky to use as a quick reference, so if you know the stuff, it's reasonable to read the source. (i do, and i don't know latex half as well as david or you...) – wasteofspace Jun 21 '13 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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