Skip to content

Instantly share code, notes, and snippets.

@tkf
Created September 21, 2010 18:00
Show Gist options
  • Save tkf/590140 to your computer and use it in GitHub Desktop.
Save tkf/590140 to your computer and use it in GitHub Desktop.
build/*
waf-*
.waf*
.lock-wafbuild
% -*- mode: tex -*-
\documentclass[10pt]{article}
\usepackage{graphicx}
\begin{document}
\LaTeX document with generated figures.
\includegraphics[width=90mm]{sin.pdf}
\end{document}
import sys
import pylab
import numpy
figpath = sys.argv[1]
x = numpy.linspace(0, 10, num=200)
y = numpy.sin(x)
pylab.plot(x, y)
pylab.savefig(figpath)
# -*- sh -*-
waf=waf-1.6.1
if [ ! -e $waf ]
then
wget http://waf.googlecode.com/files/$waf
fi
python $waf "$@"
top = '.'
out = 'build'
def configure(conf):
## http://alan.lamielle.net/2009/09/29/using-waf-to-build-latex-documents
conf.check_tool('tex') ## not conf.load!
if not conf.env.PDFLATEX:
conf.fatal('could not find the program pdflatex')
def build(bld):
bld(rule='python ${SRC} ${TGT}',
target='sin.pdf',
source='sin.py',
before='pdflatex',
)
figs = 'sin.pdf'
bld(name = 'main',
features = 'tex',
source = 'main.tex',
## after = figs,
deps = figs,
outs = 'pdf',
prompt = 0, ## 1 to see output of pdflatex
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment