latexImageMakefile 896 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
# Makefile Krita docs latex-imageconvert
# Convert all non standard image formats to latex friendly
#
# Latex can work with svg, but inkscape is needed!
#
WDIR=${PWD}

SVGCC=inkscape
# image conversion
SIPS=sips
CONVERT=convert


SVGToPDF := $(wildcard *.svg)
GIFToPNG := $(wildcard *.gif)
svgConverted := $(SVGToPDF:.svg=.pdf)
gifConverted := $(GIFToPNG:.gif=.png)

all: $(gifConverted) $(svgConverted)
	# Modify paths from original tex file
	sed -i -e 's/}\.svg/}\.pdf/g; s/}\.gif/}\.png/g' kritaManual.tex
	sed -i -e 's/^LATEXMKOPTS.*$//LATEXMKOPTS=-xelatex -interaction=nonstopmode/' Makefile
	# compile TeX file
	# xelatex kritaManual.tex -interaction nonstopmode

%.pdf: %.svg
	$(SVGCC) $(WDIR)/$< -z -A $(WDIR)/$@

%.png: %.gif
ifeq ($(TERM_PROGRAM),Apple_Terminal)
	$(SIPS) -s format png $< --out $@
else
	$(CONVERT) $< -flatten PNG32:$@
endif

clean:
	rm $(gifConverted) $(svgConverted)