5 # Generate a full Faust documentation, in a '*-mdoc' top directory
6 # and open the resulting pdf file
11 # Warning : this script requires several things to be installed :
12 # - svg2pdf, from the Cairo 2D graphics library;
13 # - pdflatex, to compile the tex file;
14 # - breqn, a latex package to break equations;
21 echo Usage
: args of faust2mathviewer should be a
\'.dsp
\' file, or a list of
\'.dsp
\' files.
25 # Visit each directory transmited as argument,
26 # in order to convert .svg files into pdf.
27 # This function uses the svg2pdf command,
28 # from the Cairo 2D graphics library.
35 FILES
=`ls | grep -E "\.svg"`
36 for SRC
in $FILES ; do
44 echo error
: \'$DIR\' is not a directory.
50 # Main loop of this script :
51 # 1. Compile `faust -mdoc` to generate the TeX file and SVG block-diagrams.
52 # 2. Move to the "${FILEPATH%.dsp}-mdoc" directory created by faust.
53 # 3. Convert SVG files into PDF files recursively (with svg2pdf).
54 # 4. Compile pdflatex twice (including the top-level block-diagram).
55 # 5. Copy some important files where needed.
57 if [[ $
(uname
) == Darwin
]]; then
59 export PATH
="/usr/texbin:$PATH"
64 for FILEPATH
in $@
; do
65 if [ -f $FILEPATH ] ; then
66 FILENAME
=`basename $FILEPATH` &&
69 faust
-o ${FILEPATH%.dsp}.cpp
--mathdoc $FILEPATH &&
70 cd ${FILEPATH%.dsp}-mdoc/ &&
71 cd svg
&& convert_svgdirs2pdf svg-
* && cd ..
&&
72 cd tex
&& pdflatex
${FILENAME%.dsp}.tex
&& pdflatex
${FILENAME%.dsp}.tex
&& cd ..
&&
73 mkdir
-p pdf
&& cp tex
/${FILENAME%.dsp}.pdf pdf
&&
74 mkdir
-p cpp
&& mv ..
/${FILENAME%.dsp}.cpp cpp
&&
75 ${OPEN} tex
/${FILENAME%.dsp}.pdf
&&
79 echo error
: \'$FILENAME\' does not have a
\'.dsp
\' extension.