Glad you got it working! Just for future reference, here's how I usually set things up:
- I make a stack.yaml file with contents something like the following:
The important part here is the 'flags' section which makes sure that the diagrams-builder-pgf and diagrams-builder-rasterific executables will be installed (just the -pgf one would do as well, depending on your needs).
- Then I call pdflatex with a command like
stack exec --package diagrams-lib --package diagrams-pgf --package diagrams-contrib --package diagrams-builder --package palette -- pdflatex --enable-write18 lectures.tex
(with whatever packages I need). I'm not sure if all of this is 100% necessary, but this is the way I've been able to get things to consistently work without creating an actual Haskell package with a .cabal file etc. In particular without the --package arguments it seems that stack sometimes gets confused about what needs to be in scope in the exec environment while running pdflatex.