"metaK.php" and "metabook.php" exist in the directory 'working\meta\*'. // Further, "metak.php" is the metadata file associated with the reading that will become Chapter k. There should be no gaps in the sequence of k's. // The metadata files are just simple php files - all they do is define key chapter-specific variables (e.g. the author's name). // ^^^ svn update ^^^ // The first task is to read the metadata associated with the book itself, in order to begin constructing the string that will eventually become the whole source for the book. include('meta/metabook.php'); $book = $bookpreamble; // The next steps are recursive - we do it once for each chapter to be included. // For each chapter, the following code will: // i) Define reading-specific variables. // ii) Parse the tex file for it's body content. // iii) Construct a string that will constitute the tex source for the chapter, $newchapter. // iv) Add this string to the string, $book chapter-by-chapter. // Following this, it is a matter of // v) Ending the $book string with "\end{document}". // vi) Convert the string, $book, into a file, book.tex // vii) Complile book.tex to produce book.pdf include("license.php"); for ($k = 1; $k <= 11; $k++) { $defin = "meta/meta$k.php"; include($defin); $filepath = "$dirname/$sourcefile"; include('bodyparse.php'); // 'bodyparse.php' will take a tex file, $filepath, and create a string, $body, which just has the body of the tex document. include('refigure.php'); // 'refigure.php' will take re-label the path to the figure files so that {figure.eps} becomes {$dirname/figure.eps}. $newchapter = "\\chapter\{$title} $copyright_notice"; $book = $book.$newchapter.$body ; } $end = "\end{document}"; $book = $book.$end; include('stringtofile.php'); // 'stringtofile.php' converts a string, $book, to a file, book.tex. // The file ./working/book.tex contains the tex source for the book, where the associated files are stored in their original directories in the working directory. ?>