Skip to content

Instantly share code, notes, and snippets.

@mberz
Last active June 29, 2020 08:43
Show Gist options
  • Select an option

  • Save mberz/d75bc4d51c8d67a6a54b2bb26bf565f8 to your computer and use it in GitHub Desktop.

Select an option

Save mberz/d75bc4d51c8d67a6a54b2bb26bf565f8 to your computer and use it in GitHub Desktop.
SConstruct for Latex PDF compilation
# -*- mode: python -*-
# SCons build file
import os
# If using dot2tex, uncomment the following.
#
# LaTeX will not error out if dot2tex is not found, but without it, we can't
# generate our Graphviz graphs. Don't let execution continue if it isn't found.
# from distutils.spawn import find_executable
# if find_executable('dot2tex') is None:
# raise SystemExit("SConstruct: program not found: dot2tex")
# Use this to inherit the PATH environmental variable if necessary.
#
# This will be necessary, e.g., for finding pygmentize for minted installed in
# the Python user directory (e.g., ~/.local).
# env = Environment(ENV={'PATH': os.environ['PATH']})
env = Environment()
# Use Biber instead of BiBTeX.
env.Replace(BIBTEX='biber')
# Enable SyncTeX. This is personal, but I use it, and I would
# recommend it to everybody.
env.AppendUnique(PDFLATEXFLAGS='-synctex=1')
# Shell escape. Needed by minted and dot2tex to name a few.
# env.AppendUnique(PDFLATEXFLAGS='-shell-escape')
# Look in standard directory ~/texmf for .sty files.
# env.SetDefault(TEXMFHOME=os.path.join(os.environ['HOME'], 'texmf'))
basename = 'document'
pdf = env.PDF(basename + '.tex')
env.Clean(pdf, basename + '.synctex.gz')
Default(pdf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment