Goal

Generate sane C files and Latex documents from Lyx, suitable for use from a Makefile.

Sadly notangle is not able to un-lyx-ify lyx noweb documents, it requires Lyx to do TeX export, which Lyx can do:

lyx -e literate FILENAME.lyx

which produces FILENAME.tex

If noweb is used works on the .Lyx file, we find some problems:

In a code scrap, a newline is not used to signify a newline, these signify a newline:

\begin_inset Newline newline
\end_inset

notangle is also unable to un-escape backslashes in the code scrap, which come out as:

\backslash

notangles's -L mode is also broken and ruins the indentation included noweb blocks in the generated code, as well as interrupting multi-line #define's.

Noweave with Lyx also generates spoiled output, with << in the code becoming a guillemot (double chevron as a single character), the fact that chunk names fail if they have an underscore in the name; e.g. <<file_name.c>>

Solution

Some awk scripts to fixup notangle output and some sed filters to fixup the weave output.

Files

I don't have access to uploads on this wiki so the files will be somewhat out of date.

Installation

Ultimately you may want to have noweb-lyx.lyx accessible from your build tree so that you can automatically extract the latest notanglefix-filter and Makefile.inc, but generally you will just need to extract a Makefile.inc and notanglefix-filter and put them in your source tree.

For generating better noweave output you will need to change the Lyx noweb convertor to: