Last active
February 11, 2016 12:02
-
-
Save akafael/87f7be49f850ff090a93 to your computer and use it in GitHub Desktop.
Makefile to combine LaTeX and Python using PythonTeX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Makefile for Latex + Pythontex | |
# Pythontex Reference: https://github.com/gpoore/pythontex | |
# @author Rafael Lima | |
## | |
# Compiler Options | |
TEX = pdflatex | |
TEXFLAGS = --enable-write18 --shell-escape | |
NAME = magicReport | |
## | |
# Recipes: | |
## | |
.PHONY = ALL | |
ALL: $(NAME).pdf | |
# Compile and open pdf | |
$(NAME).pdf: $(NAME).tex $(NAME).pytxcode | |
$(TEX) $(TEXFLAGS) $(NAME).tex &&\ | |
$(TEX) $(NAME).tex &&\ | |
xdg-open $(@)& | |
$(NAME).pytxcode: $(NAME).tex | |
$(TEX) $(TEXFLAGS) $< | |
pythontex $< | |
# Generate Python free latex code | |
.PHONY = pythonfree | |
pythonfree: $(NAME).tex | |
depythontex $< | |
# Remove generated files | |
.PHONY = clean | |
clean-tex: | |
rm -f $(NAME).aux $(NAME).bbl $(NAME).blg $(NAME).log $(NAME).idx $(NAME).out\ | |
$(NAME).nav $(NAME).snm $(NAME).toc $(NAME).vrb | |
clean-py: | |
rm -f $(NAME).py* | |
rm -fr pythontex-files-* | |
.PHONY = clean-all | |
clean-all: clean-tex clean-py | |
rm -f $(NAME).pdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment