diff --git a/CHANGES.markdown b/CHANGES.markdown
--- a/CHANGES.markdown
+++ b/CHANGES.markdown
@@ -1,3 +1,11 @@
+0.7.1 (16 June 2015)
+--------------------
+
+- allow `base-orphans-0.4`
+- add `diagrams-pgf` executable
+- add diagrams-latex option to use \input instead of \includegraphics,
+  for use with diagrams-pgf
+
 0.7.0.4 (1 June 2015)
 ---------------------
 
diff --git a/README.markdown b/README.markdown
--- a/README.markdown
+++ b/README.markdown
@@ -13,19 +13,24 @@
 [BlogLiterately](http://hackage.haskell.org/package/BlogLiterately))
 to compile diagrams embedded in
 [Markdown](http://daringfireball.net/projects/markdown/)-formatted
-blog posts.
+blog posts, and by the
+[diagrams-latex.sty](https://github.com/diagrams/diagrams-builder/blob/master/latex/diagrams-latex.sty)
+package for embedding diagrams in LaTeX documents (see below).
 
-An executable specific to the
-[cairo backend](http://github.com/diagrams/diagrams-cairo) is included
-(more executables specific to other backends will be included in the
-future).  It takes an input file and an expression to render and
-outputs an image file, using the cairo backend.  If you want it you
-must explicitly enable the cairo flag with `-fcairo`.
-		     
+Executables specific to the
+[cairo](http://github.com/diagrams/diagrams-cairo), [svg](http://github.com/diagrams/diagrams-svg),
+[postscript](http://github.com/diagrams/diagrams-postscript), [rasterific](http://github.com/diagrams/diagrams-rasterific), and [PGF](http://github.com/diagrams/diagrams-pgf) backends are included.  Each
+takes an input file and an expression to render and outputs an image
+file using the appropriate backend.  You must explicitly enable
+whichever executables you want using flags like `-fcairo`, `-fsvg`,
+and so on.
+
 A LaTeX package, `diagrams-latex.sty`, is also provided in the
 `latex/` directory of the source distribution, which renders diagrams
-code found within `diagram` environments.  It makes use of the
-`diagrams-builder-cairo` executable, so if you want to use
+code found within `diagram` environments.  It can make use of any of
+the `diagrams-builder-cairo`, `diagrams-builder-postscript`, or
+`diagrams-builder-pgf` executables, so if you want to use
 `diagrams-latex.sty` you should install `diagrams-builder` with the
-`-fcairo` option.  Note that `diagrams-latex.sty` is licensed under
-the GPL.
+appropriate option.  Note that `diagrams-latex.sty` is licensed under
+the GPL.  For more information on using `diagrams-latex.sty`, see
+[this tutorial](http://projects.haskell.org/diagrams/doc/latex.html).
diff --git a/diagrams-builder.cabal b/diagrams-builder.cabal
--- a/diagrams-builder.cabal
+++ b/diagrams-builder.cabal
@@ -1,5 +1,5 @@
 name:                diagrams-builder
-version:             0.7.0.4
+version:             0.7.1
 synopsis:            hint-based build service for the diagrams graphics EDSL.
 
 description:         @diagrams-builder@ provides backend-agnostic tools for
@@ -49,7 +49,7 @@
                        Diagrams.Builder.Modules
                        Diagrams.Builder.CmdLine
   build-depends:       base >=4.2 && < 4.9,
-                       base-orphans >= 0.3 && < 0.4,
+                       base-orphans >= 0.3 && < 0.5,
                        mtl >= 2.1 && < 2.3,
                        diagrams-lib >= 1.3 && < 1.4,
                        hint >= 0.4 && < 0.5,
@@ -94,6 +94,11 @@
   default:     False
   manual:      True
 
+flag pgf
+  description: install PGF-specific builder tool
+  default:     False
+  manual:      True
+
 executable diagrams-builder-cairo
   main-is:             diagrams-builder-cairo.hs
   hs-source-dirs:      src/tools
@@ -175,3 +180,24 @@
                        cmdargs >= 0.6 && < 0.11,
                        lens >= 3.8 && < 4.12,
                        JuicyPixels >= 3.1.5 && < 3.3
+
+executable diagrams-builder-pgf
+  main-is:             diagrams-builder-pgf.hs
+  hs-source-dirs:      src/tools
+  default-language:    Haskell2010
+  other-extensions:    DeriveDataTypeable
+                       RecordWildCards
+
+  if !flag(pgf)
+    buildable: False
+
+  if flag(pgf)
+    build-depends:     base >= 4 && < 5,
+                       filepath,
+                       directory,
+                       diagrams-builder,
+                       diagrams-lib >= 0.6 && < 1.4,
+                       diagrams-pgf,
+                       bytestring >= 0.10.2 && < 0.11,
+                       cmdargs >= 0.6 && < 0.11,
+                       lens >= 3.8 && < 4.12
diff --git a/latex/diagrams-latex.sty b/latex/diagrams-latex.sty
--- a/latex/diagrams-latex.sty
+++ b/latex/diagrams-latex.sty
@@ -88,6 +88,9 @@
 \def\dtt@backend{cairo}  % use cairo as the default backend
 \DeclareOptionX{extension}[]{\def\dtt@extension{#1}}
 \def\dtt@extension{pdf}  % default output extension of .pdf
+\newif\ifdtt@input \dtt@inputfalse
+\DeclareOptionX{input}{\dtt@inputtrue}
+\DeclareOptionX{noinput}{\dtt@inputfalse}
 
 \ExecuteOptionsX{shell}
 
@@ -234,7 +237,13 @@
 }
 
 \long\gdef\diagramslatexgraphicsinclude{\diagramslatexgraphicsprocess%
-    \IfFileExists{\dtt@figname.\dtt@extension}{{\includegraphics{\dtt@figname.\dtt@extension}}}
+    \IfFileExists{\dtt@figname.\dtt@extension}{
+      \ifdtt@input
+        {\input{\dtt@figname.\dtt@extension}}
+      \else
+        {\includegraphics{\dtt@figname.\dtt@extension}}
+      \fi
+    }
     {\PackageWarningNoLine{diagrams-latex}
             {Please convert \dtt@figname.hs manually}}
 }
diff --git a/src/tools/diagrams-builder-pgf.hs b/src/tools/diagrams-builder-pgf.hs
new file mode 100644
--- /dev/null
+++ b/src/tools/diagrams-builder-pgf.hs
@@ -0,0 +1,59 @@
+{-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE RecordWildCards    #-}
+
+module Main where
+
+import qualified Data.ByteString.Builder     as BSB
+import qualified Data.ByteString.Lazy        as BSL
+import           Diagrams.Backend.PGF
+import           Diagrams.Backend.PGF.Render (Options (..))
+import           Diagrams.Builder
+import           Diagrams.Prelude            hiding (height, width)
+
+import           System.Directory            (copyFile,
+                                              createDirectoryIfMissing)
+import qualified System.FilePath             as FP
+
+import           System.Console.CmdArgs      hiding (def)
+
+compileExample :: Build -> IO ()
+compileExample (Build{..}) = do
+  let ext = FP.takeExtension outFile
+      standalone = case ext of
+                     ".pgf" -> False
+                     ".tex" -> True
+  f   <- readFile srcFile
+
+  createDirectoryIfMissing True dir
+
+  let w = fmap realToFrac width :: Maybe Double
+      h = fmap realToFrac height :: Maybe Double
+      bopts = mkBuildOpts PGF (zero :: V2 Double) (PGFOptions def (mkSizeSpec2D w h) False standalone)
+                & snippets .~ [f]
+                & imports  .~ [ "Diagrams.Backend.PGF" ]
+                & diaExpr  .~ expr
+                & decideRegen .~ (hashedRegenerate (\_ opts -> opts) dir)
+
+  res <- buildDiagram bopts
+  case res of
+    ParseErr err    -> putStrLn ("Parse error in " ++ srcFile) >> putStrLn err
+    InterpErr ierr  -> putStrLn ("Error while compiling " ++ srcFile) >>
+                       putStrLn (ppInterpError ierr)
+    Skipped hash    -> copyFile (mkFile (hashToHexStr hash) ext) outFile
+    OK hash pgf -> let cached = mkFile (hashToHexStr hash) ext
+                   in do BSL.writeFile cached (BSB.toLazyByteString pgf)
+                         copyFile cached outFile
+ where
+  mkFile base ext = dir FP.</> base FP.<.> ext
+
+build :: Build
+build =
+  defaultBuildOpts
+  { outFile  = "out.pgf" &= typFile &= help "Output file (default: \"out.pgf\")" }
+  &= summary "The diagrams-builder-PGF program, for dynamically rendering diagrams using the PGF backend.  Give it a source file and an expression to render (which may refer to things declared in the source file), and it outputs an image, using hashing to avoid rerendering images unnecessarily. Use a .pgf extension to get PGF code, suitable for inputting directly into a LaTeX file.  Use a .tex extensions to get a standalone TeX file.\n\nIf you have installed the diagrams-lib and diagrams-pgf packages in a sandbox, set the environment variable DIAGRAMS_SANDBOX to that directory so the builder can compile your diagram. For example, \"export DIAGRAMS_SANDBOX=~/diagrams/.cabal-sandbox\". If you have package databases for multiple versions of GHC in that sandbox, you will need to set the full path to the package database (it ends in \".conf.d\")."
+  &= program "diagrams-builder-pgf"
+
+main :: IO ()
+main = do
+  opts <- cmdArgs build
+  compileExample opts
