Installing and running the Literate Programming tool noweb on Windows 7


Step 1

Install MinGW (which will include msys):

The self-installer file's name is mingw-get-setup.

Ensure that the gcc and g++ facilities are included in the distribution.

Add C:\MinGW\bin (or wherever the bin is) to your $PATH

Step 2

Install Icon (32-bit Cygwin):, and add it to your Program Files directory

Add C:\Program Files\icon-v951\bin to your $PATH

Note that .\bin includes icont.exe but not iconc.exe. This is okay but has implications later.

Step 3

Download the noweb (noweb-2.11b) tar file:, and add it to your Program Files directory

Step 4

Create a directory called nowebFiles on the C drive and fill it with the following sub-directories:


Replace lines 9 and 11 of the Makefile in C:\Program Files\noweb-2.11b\src with


Replace lines 21-27 with


Add C:\nowebFiles\usr\local\noweb to your $PATH

Add C:\nowebFiles\usr\local\noweb\man to your $MANPATH (which you may have to define)

Step 5

Replace all instances of nt, markup, mnt and finduses with nt.exe, markup.exe, mnt.exe and finduses.exe in lines 100-105 of the above Makefile:

install-code: install-shell
-mkdir $(BIN) $(LIB) 2>/dev/null
strip c/nt.exe c/markup.exe c/mnt.exe c/finduses.exe
cp c/nt.exe c/markup.exe c/mnt.exe c/finduses.exe $(LIB)
cd $(LIBSRC); make ICONT=$(ICONT) ICONC=$(ICONC) LIB=$(LIB) BIN=$(BIN) install
cd lib; make LIB=$(LIB) install

Step 6

Open the GNU shell (msys) located in C:\MinGW\msys\1.0 (or wherever) and move to noweb's src directory C:\Program Files\noweb-2.11b\src

Enter 'awkname awk' to rename all instances of 'nawk' that appear in such files as (C:\nowebFiles\usr\local\noweb\lib) btdefn, noidx, pipedocs, toascii, tohtml, toroff, totex, and unmarkup. (There are others, but the awkname script seems to deal with them all.)

Enter 'make all install' and cross your fingers...


Copy the TeX style file noweb.sty in C:\nowebFiles\usr\local\tex\inputs to whatever working directory you are in (or to an appropriate TeX distribution folder)

Using msys, move to noweb's examples directory (C:\Program Files\noweb-2.11b\examples). Make sure noweb.sty is in this directory (or an appropriate TeX distribution folder)

Save the following in the file hello.nw (taken from


\section{Hello world}

Today I awoke and decided to write
some code, so I started to write Hello World in \textsf C.

#include <stdio.h>

int main(int `argc, char *argv[]) {
printf("Hello World!\n");
return 0;
\noindent \ldots then I did the same in PHP.

echo "Hello world!\n";
Later the same day some lawyer reminded me about licenses.
So, here it is:

This work is placed in the public domain.


Be sure that the backtick in '`argc' is pasted as a genuine backtick and not an apostrophe. The filter 'btdefn' uses this character to build an index.

To create a LaTeX file (a process known as 'weaving'), enter one of the following (in the msys shell):

noweave -latex hello.nw > hello.tex

noweave -index -latex hello.nw > hello.tex

noweave -filter btdefn -index -latex hello.nw > hello.tex

noweave -filter l2h -filter btdefn -index -html hello.nw | htmltoc > hello.html

To create a source code file (a process known as 'tangling'), enter:

notangle -filter btdefn -Rhello.c hello.nw > hello.c

notangle -filter btdefn -Rhello.php hello.nw > hello.php

noting that '-Rhello.c' is the root chunk, which can be referred to as simply * when the root is written as <<*>> in the nw file.

Try some of the other examples in the ./noweb/examples folder.

* Note that these instructions are for the Icon installation (as opposed to the awk installation, which is inferior due to its limited filter functionality).