Skip to content

Instantly share code, notes, and snippets.

@dergachev
Forked from pixelite/Vagrant-sphinx-pdflatex.md
Last active December 28, 2015 19:09
Show Gist options
  • Save dergachev/7548576 to your computer and use it in GitHub Desktop.
Save dergachev/7548576 to your computer and use it in GitHub Desktop.

First create a Vagrantfile:

vagrant init precise64

Then add the following to the new Vagrantfile:

config.vm.provision :shell, :inline => <<-EOT
  apt-get update
  apt-get -y install python-pip
  pip install sphinx
  # all these packages are necessary, otherwise running "make latexpdf" gives errors
  apt-get install -y texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
EOT

Note that these latex packages add up to about 1GB of space, and will take 10 minutes (or more) to download. If that's OK, provision the VM:

vagrant up # takes like 10 minutes...

Everything succeed? Then the following will work for a suitably-configured sphinx Makefile:

vagrant ssh
cd /vagrant
make latexpdf # assumes you have a sphinx compatible Makefile which has been customized to support latexpdf

Error messages from pdflatex

  • I can't find file ptmr8t'.` : means missing package texlive-fonts-recommended
  • titlesec.sty not found: means missing package texlive-latex-extra
  • "LaTeX Error: "cmap.sty" not found" : missing package texlive-latex-recommended

Other

# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
# config.vm.network :private_network, ip: "192.168.33.10"
# config.vm.network :public_network
# config.ssh.forward_agent = true
config.vm.provider :virtualbox do |vb|
# vb.customize ["modifyvm", :id, "--memory", "128"]
end
config.vm.provision :shell, :inline => <<-EOT
apt-get update
apt-get -y install python-pip
pip install sphinx
# all these packages are necessary, otherwise running "make latexpdf" gives errors
apt-get install -y texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
EOT
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment