6

The WEB system is great, but it's a little cumbersome sometimes and very much rigid in its design. Is there a LaTeX document class for WEB-style documents?

I'd like to program in other languages than Pascal and C---perhaps even generalized as a 'pure' algorithm.

  • I would add that Google searching along the lines of LaTeX web class doesn't get me very far... – Sean Allred Aug 21 '13 at 23:07
  • cs.tufts.edu/~nr/noweb suggests noweb comes with a latex back end – David Carlisle Aug 21 '13 at 23:13
  • @DavidCarlisle A LaTeX backend is not the same as a LaTeX interface (as LyX and the like). (Now to be honest, I haven't formally used noweb, but this is my impression.) – Sean Allred Aug 21 '13 at 23:32
2

An old question without an answer; maybe you solved the problem already. But as it is not closed yet I want to share my ideas.

The question is not very clear. As stated in the comments (1) the answer may look at the output, i.e., you want to have LaTeX code instead of TeX code as the result of the weave process, or you want (2) to write LaTeX code instead of Pascal in WEB, or, as you mention Lyx, you want (3) the status of your WEB coding, i.e., the output of weave, appear as DVI or PDF output. (I assume you do not want to talk about Lyx noweb class.)

(1) can be achieved with noweb; (2) can be done with noweb or with spider; (3) is difficult because weave has not one but two input files and needs no open ends; but you can do it.

About (1): As mentioned in the comments noweb has different backends and you can make one to output LaTeX instead of TeX. But according to your answer to the comment this seems not to be your question/problem. Moreover, it does not make sense as no one looks at the output of weave.

About (2): WEB is a TeX/Pascal combination and CWEB is a TeX/C combination. The language is important as the corresponding weave process has to format the code. For advocates of literate programming this is an important point; see this article of Bart Childs. But on the other hand this approach leads to a lot of different systems to support the paradigm of literate programming for different programming languages. See the CACM articles about literate programming.

So if you want LaTeX as a programming language you first have to define how LaTeX has to be formatted. TeX code is usually output without special markup in typewriter fonts. This is ideal for noweb but doesn't fulfill the criteria of the above cited article by Childs for a useful tool. (This article shows how to deal with plain.tex.)

You can use spider an earlier system by the author of noweb (see the cited article by Childs) to implement your format rules.

I use a noweb like style but have coded my own backend and output the code as described above; see this example. noweb reduces the number of WEB commands but this comes with a price about the fine control of the output.

About (3): This is a little bit difficult. The weave processor needs two input files (.web and .ch) and it must find all section titles. So if you use in your code the name of a chunk that hasn't been coded yet, weave fails. That means, you need a different program that outputs what is written as .web without checking for completeness; and it has to deal with loose ends that are not cited yet. This is possible (my first replacement for noweb's weave gives only warnings) but I don't think such a tool has been made public.

If you start to code in a WEB like system you may not feel the need to have incomplete output. The features of your editor are more important, I think.

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.