# -*- makefile -*- # Assumes each *.tex file is a file that will create # both a Beamer slide file and a handout, AFTER RUNNING LGRIND ON THE LaTeX FILE. # Should work for all files matching that pattern without any extra # customisation. # Copyright (C) 2005 Nick Urbanik # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #LATEX = latex --interaction=batchmode #PDFLATEX = pdflatex --interaction=batchmode LATEX = latex PDFLATEX = pdflatex LGRIND = lgrind -d /usr/local/share/texmf/tex/latex/lgrind/lgrindef VIEWER = xpdf beamer_slide_files = $(wildcard *.tex) slides = $(beamer_slide_files:%.tex=%.pdf) handouts = $(beamer_slide_files:%.tex=%-handout.pdf) handouts_ps = $(beamer_slide_files:%.tex=%-handout.ps) figures = $(wildcard *.fig) epsfigs = $(figures:.fig=.eps) pdffigs = $(figures:.fig=.pdf) cli2.pdf # These are xfig files with embedded LaTeX to process with figfrag-nick: figs_to_frag = $(shell grep -l '\\\\' *.fig) pdf_figs_to_frag = $(figs_to_frag:.fig=.pdf) all: $(handouts) \ $(slides) \ $(handouts_ps) $(slides) $(handouts): Makefile $(pdffigs) # Assuming that all figures are included with \includegraphics, and that # each of these is on one line only, not broken into two or more, # we can get a list of included graphics files with: # $ grep \\includegraphics *.tex | sed -r 's/.*\{(.*)\}.*/\1/' # cli2 # basic_shell_use_output_redirection # basic_shell_use_input_redirection # operator-operands # function-box # output-port-embedded # input-port-embedded tidy: rm -f *.log *.ps *.toc *.aux *.eepic *.bak *.lg *.out *.idx *~ \ *.nav *.snm *.out *.vrb clean: tidy rm -f *.dvi *.pdf %.pdf: %.lg @echo @echo \* @echo \* Compiling $< @echo \* pdflatex $< @while ( grep "Rerun to get cross-references" \ $(subst .lg,.log,$<) >/dev/null ); do \ echo '** Re-running LaTeX **'; \ pdflatex $<; \ done %.dvi: %.lg @echo @echo \* @echo \* Compiling $< @echo \* latex $< @while ( grep "Rerun to get cross-references" \ $(subst .lg,.log,$<) >/dev/null ); do \ echo '** Re-running LaTeX **'; \ latex $<; \ done %.lg: %.tex @echo @echo \* @echo \* running lgrind on $< @echo \* $(LGRIND) -e -lCC $< | lgrindpp.pl > $@ # Cancel the built in rule that uses tex to produce dvi files: %.dvi: %.tex # See http://freshmeat.net/articles/view/667/ # 1. latex file.tex # 2. dvips -Ppdf -G0 file.dvi -o file.ps # 3. ps2pdf13 -dPDFsettings=/prepress file.ps file.pdf # Two points to note: # * The -G0 parameter passed to dvips is used to get around a # bug in GhostScript which converts the "f" character to a # pound sign in the final PDF. # * The -dPDFsettings parameter for ps2pdf13 is used to prevent # downsampling of EPS images when they are converted to PDF. # Without this switch, EPS graphics in the final PDF look # very fuzzy, especially when viewed with a projector. %.ps: %.dvi @echo @echo \* @echo \* Converting $< to PostScript @echo \* dvips -Ppdf -D 600 -G0 -o $@ $< %.pdf: %.ps @echo @echo \* @echo \* Converting $< to PDF @echo \* ps2pdf14 -dPDFsettings=/prepress $< $@ %-4up.ps: %-vsimple.ps @echo @echo \* @echo \* Converting $< to 4up, ready for printing @echo \* psnup -m12mm -b-2mm -pa4 -4 -l $< > $@ %-8up.ps: %-vsimple.ps @echo @echo \* @echo \* Converting $< to 8up, ready for printing @echo \* psnup -m10mm -b-2mm -pa4 -8 -l $< > $@ %-handout-a5.tex: %.tex @echo @echo \* @echo \* Converting $< to $@ @echo \* sed 's/^\\documentclass\[\(.*\)\]{beamer}/\\documentclass[10pt,a5paper]{article}\% DO NOT EDIT---WILL BE OVERWRITTEN\n\\usepackage{beamerarticle,geometry,graphicx}\% DO NOT EDIT---WILL BE OVERWRITTEN\n\\geometry{margin=10mm,includehead,headheight=15pt,headsep=5mm}\% DO NOT EDIT---WILL BE OVERWRITTEN\n\\usepackage{fancyhdr}\% DO NOT EDIT---WILL BE OVERWRITTEN\n\\usepackage[breaklinks]{hyperref}\% DO NOT EDIT---WILL BE OVERWRITTEN/' $< > $@ # sed 's/^\\documentclass\[total,pdf\]{prosper}/\\documentclass[nopagebreak,ps,10pt,a5paper]{ppr-prv}\% DO NOT EDIT---WILL BE OVERWRITTEN\n\\geometry{margin=10mm}\% DO NOT EDIT---WILL BE OVERWRITTEN/' $< > $@ #sed 's/^\\documentclass\[total,\(.*\)\]{prosper}/\\documentclass[ps,\1]{ppr-prv}\% DO NOT EDIT---WILL BE OVERWRITTEN/' $< > $@ %-handout.ps: %-handout-a5.ps @echo @echo \* @echo \* Converting $< to $@ @echo \* psnup -Pa5 -pa4 -2 $< $@ %-vsimple.tex: %.tex @echo @echo \* @echo \* Converting $< to $@ @echo \* sed 's/^\\usepackage\[toc,highlight,Tycja\]{HA-prosper}/\\usepackage[toc,highlight,vsimple]{HA-prosper}\% DO NOT EDIT---WILL BE OVERWRITTEN/' $< > $@ lpr: $(DOCUMENT)-handout.ps @echo @echo \* @echo \* Printing $< @echo \* lpr $< # %.pdf: %.dvi # @echo # @echo \* # @echo \* Converting $< to PDF # @echo \* # dvips -o - -Ppdf $< | ps2pdf13 - $@ %: %-4up.ps @echo @echo \* @echo \* Spawning viewer for $< @echo \* $(VIEWER) -landscape $< %.tex: %.c @echo @echo \* @echo \* Formatting C program $< to $@ @echo \* c2lt $< > $@ %.gz: % @echo @echo \* @echo \* Compressing $< @echo \* gzip $< $(pdf_figs_to_frag): $(figs_to_frag) overbar-tex @echo @echo \* @echo \* Running figfrag-nick on $^ @echo \* for i in $(filter %.fig,$^);do figfrag-nick -i overbar-tex "$$i";done # $(foreach fig,$(figs_to_frag),$(call figfrag-nick -i overbar-tex $(fig))) #for i in $^;do figfrag-nick -i overbar-tex "\\$i";done %.eps: %.obj @echo @echo \* @echo \* Producing Encapsulated PostScript for $< @echo \* tgif -print -eps -color $< %.pdf: %.eps @echo @echo \* @echo \* Producing Encapsulated PostScript for $< @echo \* epstopdf $< %.eps: %.fig @echo @echo \* @echo \* Producing $@ from $< @echo \* fig2dev -L eps $< $@ %.eepic: %.fig @echo @echo \* @echo \* Producing EEPIC for $< @echo \* fig2dev -L eepic $< $@ # Stop GNU make from overzealous deletion of intermediate files .PRECIOUS: %.eps