6

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.

8
  • 2
    You may want to have a look at eplain.tex
    – egreg
    Jul 2, 2016 at 23:20
  • 1
    this wiki may help, here is the link for the file that egreg mentionned eplain.tex
    – Cfun
    Jul 2, 2016 at 23:34
  • 1
    For a wide answer about programming on Latex. About defining new commands
    – Cfun
    Jul 2, 2016 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. Jul 3, 2016 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, 2016 at 5:09

1 Answer 1

9

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.

You must log in to answer this question.

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