Questions tagged [literate-programming]

Literate programming keeps code and its (extensive) documentation in a single source file. The documentation is typically typeset with TeX or LaTeX. Tools are used to extract the code (for compilations) and the documentation (for processing with (La)TeX) from the source file.

Literate programming was promoted by Donald Knuth who developed TeX (and most of his other software) as a literate program. His original tools where specifically tailored for the programming languages he used but more recent literate programming systems are often language agnostic. Within the TeX.SE community, Sweave is the best-known literate programming system that combines LaTeX and R code.

Traditionally, the process of extracting code from a literate program is called tangling and extracting (La)TeX code is called weaving.

50 questions
24
votes
5 answers

How to do literate programming in TeX?

How can I do literate programming in TeX where TeX, or some variant, is both the used programming language and what is used for typesetting the document? Is there more than one way to do it or different approaches for different TeX variants? I would…
N.N.
  • 36,163
13
votes
1 answer

Using doc/docstrip with other computer languages

The docstrip package mentions that it can be used to strip files of computer languages other than (La)TeX. I am looking to find a way to document other languages, for example JavaScript in a literate way. /* Some comment lines here and…
yannisl
  • 117,160
6
votes
0 answers

Capacity of ctangle exceeded

I'm interested in looking at (and maybe modifying) the code in MetaFont/MetaPost. To generate their C code, I applied ctangle to mp.w, and got an error message saying "token capacity exceeded". Running ctangle on smaller files works OK, so I think…
bubba
  • 2,462