Skip to content

Instantly share code, notes, and snippets.

@vbkaisetsu
Created October 28, 2014 08:15
Show Gist options
  • Save vbkaisetsu/25291ebed39af96b4066 to your computer and use it in GitHub Desktop.
Save vbkaisetsu/25291ebed39af96b4066 to your computer and use it in GitHub Desktop.
make pdf with svg
MAIN:=tech-report.tex
SOURCES:=$(wildcard sections/*.tex figures/*.tex tables/*.tex)
STYLE:=$(wildcard *.sty)
BIB:=$(wildcard *.bib)
FIGURES:=$(wildcard figures/*.eps figures/*.pdf figures/*.svg)
PDFFIGURES:=$(wildcard figures/*.pdf)
SVGFIGURES:=$(wildcard figures/*.svg)
SVGPDFFILES:=$(SVGFIGURES:%.svg=%.pdf)
XBBFILES:=$(PDFFIGURES:%.pdf=%.xbb) $(SVGPDFFILES:%.pdf=%.xbb)
DVIFILES:=$(MAIN:%.tex=%.dvi)
PDFFILES:=$(MAIN:%.tex=%.pdf)
RELEASEFILES:=$(MAIN:%.tex=%.release-stamp)
all: $(XBBFILES) $(PDFFILES)
check: all $(FIGURES)
$(PDFFILES): $(DVIFILES)
umask 002 ; dvipdfmx -f ptex-ipaex.map -o $@.tmp $<
mv $@.tmp $@
%.dvi: $(MAIN) $(STYLE) $(SOURCES) $(BIB) $(FIGURES)
platex -halt-on-error -kanji=utf8 $(MAIN) # create draft input
pbibtex -kanji=utf-8 tech-report
-mendex $(<:%.tex=%)
platex -halt-on-error -kanji=utf8 $(MAIN) # create draft content with correct spacing for index and toc
-mendex $(<:%.tex=%) # recreate index with correct page number
platex -halt-on-error -kanji=utf8 $(MAIN) # recreate toc with correct page number
%.xbb: %.pdf
-ebb -x $<
$(SVGPDFFILES): %.pdf: %.svg
-rsvg-convert $< --format=pdf --output=$@
clean:
-rm -f *.dvi *.aux *~ *.log *.out *.ilg *.idx *.pdf *.bbl *.blg *.nav *.snm *.toc figures/*.xbb $(SVGPDFFILES)
.PHONY: clean all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment