5

I'd like to try to create a document structure and table of contents in pure TeX. Does anyone know of any resources or examples to do this? My purpose is mainly educational, to learn how to write macros and structure documents in pure TeX.

I know how to define basic commands using \def, and I've written documents in plain TeX but I don't understand enough about programming in TeX to feel able to tackle a big task like this.

  • 2
    You may want to have a look at eplain.tex – egreg Jul 2 '16 at 23:20
  • 1
    this wiki may help, here is the link for the file that egreg mentionned eplain.tex – SAM Jul 2 '16 at 23:34
  • 1
    For a wide answer about programming on Latex. About defining new commands – SAM Jul 2 '16 at 23:43
  • 3
    if you'd like to look at a perhaps rather unconventional collection of tables of contents prepared with plain tex, you can look at the tugboat contents. (much of tugboat is now set with latex, but the contents, front matter and calendar are still "plain only".) you can see the typeset contents as part of each issue, linked from tug.org/TUGboat , and the input for the contents can be found at ctan; go to ctan.org/search and search for "tugboat". these contents files are compiled by hand (it's possible to automate, but easier manual), if questions, please ask. – barbara beeton Jul 3 '16 at 1:40
  • 2
    I'm sure that OPmac has this type of functionality, and it is I believe written in plain TeX petr.olsak.net/opmac-e.html – A Feldman Jul 3 '16 at 5:09
8

If you are willing to use a macro package for that, I can recommend the compact opmac macros. They provide access to a multitude of LaTeX's features in a simple manner.

\input opmac
\maketoc
\sec Hello World
\bye

enter image description here

If you want to implement it on your own, you can just look at opmac.tex to get inspiration. The source is very readable and easy to understand.

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.