GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Issues
1
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
nigel.stanger
/
Handbook
Browse code
- Altered pdfcrop rules slightly.
- Added general rule for R -> PDF.
master
1 parent
5fc27da
commit
bbbfca9955d6683697e6e0e094dba57ac501402c
nstanger
authored
on 18 Feb 2010
Patch
Showing
1 changed file
make-includes/standard_rules.make
Ignore Space
Show notes
View
make-includes/standard_rules.make
################################################################################ # # File: $Id$ # # Standard rules for a variety of situations. Includes standard suffixes and # paths. # # ################################################################################ ################################################################################ # # Required make variables. These should be defined by the calling makefile. # # SUBJECT_CODE # The paper number for the current paper, e.g., 212. # PAPER_NUMBER?=$(error The required make variable PAPER_NUMBER has not been defined. Please set it to the correct value) # # IMGDIR # The path to the directory that contains images, e.g., images. # IMGDIR?=$(error The required make variable IMGDIR has not been defined. Please set it to the directory in which images are located) ################################################################################ # # Default rules. # # # PDF from LaTeX via DVI, typically for images drawn using PSTricks). # %.pdf %-print.pdf: $(IMGDIR)/%.tex latex --jobname=$(IMGDIR)/$* $< dvips -q -f $(IMGDIR)/$* | ps2eps -q -l | epstopdf -f -o=$(IMGDIR)/$@ # # PDF from LaTeX. # %.pdf: %.tex pdflatex $< pdflatex $< # # 2-up PDF from 1-up PDF. # %-2up.pdf: %.pdf pdfnup $< --nup 2x1 --outfile $@ # # Derived XML with inclusions from source XML without inclusions. # %-derived.xml: %.xml xmllint --xinclude $< > $@ # # LaTeX from derived XML. # %.tex: %-derived.xml $(call xslt,$<,xml2latex.xsl,$(call xslt_parameter,paper,$(PAPER_NUMBER))) > $@ # # HTML from derived XML. # %.html: %-derived.xml $(call xslt,$<,xml2html.xsl,$(call xslt_parameter,paper,$(PAPER_NUMBER))) > $@ # # PNG from TIFF (normal) # %.png %-print.png %-web.png: %.tif convert "$<" $(IMGDIR)/$@ # # PNG from TIFF (slide background) # # We lighten these so that they don't overwhelm the text. Note that 15% is # too light for most data projectors, so let's try 33% and see what # happens... (this looks far too much on screen, but data projectors tend # to wash things out much, much more). # # Includes both blurred and unblurred versions, use as required. # %-BG.png: $(IMGDIR)/%.tif convert $< -threshold "-1" -depth 16 - | composite -dissolve 33% $< - $(IMGDIR)/$@ # %-BG-blur.png: %.tif convert -blur 0.5 $< $(IMGDIR)/$*.png convert $(IMGDIR)/$*.png -threshold "-1" -depth 16 - | composite -dissolve 33% $(IMGDIR)/$*.png - $(IMGDIR)/$@ # # PNG from PICT. # %.png %-print.png %-web.png: %.pict convert "$<" $(IMGDIR)/$@ # # PDF from Ploticus. # %.pdf %-print.pdf: %.plo ploticus -eps -tightcrop -o stdout $< | shiftbbox | epstopdf --filter --outfile=$(IMGDIR)/$@ # # PDF from R. # This assumes that the first argument to the R script is the output filename # for the resultant PDF. # %.pdf %-print.pdf: %.R R --slave --file=$< --args "$(IMGDIR)/$@" pdfcrop $(IMGDIR)/$@ -mv $(IMGDIR)/$*-crop.pdf $(IMGDIR)/$@ # # PDF from PS # %.pdf %-print.pdf: %.ps ps2eps --ignoreBB --nohires --loose < $< | ps2pdf -dEPSCrop - $(IMGDIR)/$@ # # PDF from EPS # %.pdf %-print.pdf: %.eps ps2eps --ignoreBB --nohires --loose < $< | ps2pdf -dEPSCrop - $(IMGDIR)/$@ # # PDF from SVG (via Inkscape) # We remove the intermediate file manually rather than through the tidy/clean # mechanism. We don't use Inkscape's --export-area-drawing option to crop, # because it crops slightly too closely. # %.pdf %-print.pdf: %.svg inkscape --file=$< --without-gui --export-pdf=$(IMGDIR)/$@ pdfcrop $(IMGDIR)/$@ -mv $(IMGDIR)/$*-crop.pdf $(IMGDIR)/$@ # # PNG from SVG (via Inkscape) # This is weird: --export-pdf writes the output image exactly where you tell # it, whereas --export-png seems to write it relative to the original image?? # So if the original is in images/foo.svg, then --export-pdf=images/foo.pdf # will create images/foo.pdf, but --export-png=images/foo.png looks like it's # trying to create images/images/foo.png. --export-png=foo.png will create # images/foo.png. # # ?!?!?! Argh. Bug report submitted to Inkscape. # %.png %-print.png %-web.png: %.svg inkscape --file=$< --without-gui --export-area-drawing --export-background-opacity=1.0 --export-dpi=96 --export-png=$@ %-web-zoom.png: %.svg inkscape --file=$< --without-gui --export-area-drawing --export-background-opacity=1.0 --export-dpi=144 --export-png=$@ # # PNG from PNG (change the name) # %-web.png: %.png cp $< $(IMGDIR)/$@ %-print.png: %.png cp $< $(IMGDIR)/$@
################################################################################ # # File: $Id$ # # Standard rules for a variety of situations. Includes standard suffixes and # paths. # # ################################################################################ ################################################################################ # # Required make variables. These should be defined by the calling makefile. # # SUBJECT_CODE # The paper number for the current paper, e.g., 212. # PAPER_NUMBER?=$(error The required make variable PAPER_NUMBER has not been defined. Please set it to the correct value) # # IMGDIR # The path to the directory that contains images, e.g., images. # IMGDIR?=$(error The required make variable IMGDIR has not been defined. Please set it to the directory in which images are located) ################################################################################ # # Default rules. # # # PDF from LaTeX via DVI, typically for images drawn using PSTricks). # %.pdf %-print.pdf: $(IMGDIR)/%.tex latex --jobname=$(IMGDIR)/$* $< dvips -q -f $(IMGDIR)/$* | ps2eps -q -l | epstopdf -f -o=$(IMGDIR)/$@ # # PDF from LaTeX. # %.pdf: %.tex pdflatex $< pdflatex $< # # 2-up PDF from 1-up PDF. # %-2up.pdf: %.pdf pdfnup $< --nup 2x1 --outfile $@ # # Derived XML with inclusions from source XML without inclusions. # %-derived.xml: %.xml xmllint --xinclude $< > $@ # # LaTeX from derived XML. # %.tex: %-derived.xml $(call xslt,$<,xml2latex.xsl,$(call xslt_parameter,paper,$(PAPER_NUMBER))) > $@ # # HTML from derived XML. # %.html: %-derived.xml $(call xslt,$<,xml2html.xsl,$(call xslt_parameter,paper,$(PAPER_NUMBER))) > $@ # # PNG from TIFF (normal) # %.png %-print.png %-web.png: %.tif convert "$<" $(IMGDIR)/$@ # # PNG from TIFF (slide background) # # We lighten these so that they don't overwhelm the text. Note that 15% is # too light for most data projectors, so let's try 33% and see what # happens... (this looks far too much on screen, but data projectors tend # to wash things out much, much more). # # Includes both blurred and unblurred versions, use as required. # %-BG.png: $(IMGDIR)/%.tif convert $< -threshold "-1" -depth 16 - | composite -dissolve 33% $< - $(IMGDIR)/$@ # %-BG-blur.png: %.tif convert -blur 0.5 $< $(IMGDIR)/$*.png convert $(IMGDIR)/$*.png -threshold "-1" -depth 16 - | composite -dissolve 33% $(IMGDIR)/$*.png - $(IMGDIR)/$@ # # PNG from PICT. # %.png %-print.png %-web.png: %.pict convert "$<" $(IMGDIR)/$@ # # PDF from Ploticus. # %.pdf %-print.pdf: %.plo ploticus -eps -tightcrop -o stdout $< | shiftbbox | epstopdf --filter --outfile=$(IMGDIR)/$@ # # PDF from PS # %.pdf %-print.pdf: %.ps ps2eps --ignoreBB --nohires --loose < $< | ps2pdf -dEPSCrop - $(IMGDIR)/$@ # # PDF from EPS # %.pdf %-print.pdf: %.eps ps2eps --ignoreBB --nohires --loose < $< | ps2pdf -dEPSCrop - $(IMGDIR)/$@ # # PDF from SVG (via Inkscape) # We remove the intermediate file manually rather than through the tidy/clean # mechanism. We don't use Inkscape's --export-area-drawing option to crop, # because it crops slightly too closely. # %.pdf %-print.pdf: %.svg inkscape --file=$< --without-gui --export-pdf=$(IMGDIR)/$*-tmp.pdf pdfcrop $(IMGDIR)/$*-tmp.pdf $(IMGDIR)/$@ -rm -f $(IMGDIR)/$*-tmp.pdf # # PNG from SVG (via Inkscape) # This is weird: --export-pdf writes the output image exactly where you tell # it, whereas --export-png seems to write it relative to the original image?? # So if the original is in images/foo.svg, then --export-pdf=images/foo.pdf # will create images/foo.pdf, but --export-png=images/foo.png looks like it's # trying to create images/images/foo.png. --export-png=foo.png will create # images/foo.png. # # ?!?!?! Argh. Bug report submitted to Inkscape. # %.png %-print.png %-web.png: %.svg inkscape --file=$< --without-gui --export-area-drawing --export-background-opacity=1.0 --export-dpi=96 --export-png=$@ %-web-zoom.png: %.svg inkscape --file=$< --without-gui --export-area-drawing --export-background-opacity=1.0 --export-dpi=144 --export-png=$@ # # PNG from PNG (change the name) # %-web.png: %.png cp $< $(IMGDIR)/$@ %-print.png: %.png cp $< $(IMGDIR)/$@
Show line notes below