Commit cf7fe99d authored by Robert Ricci's avatar Robert Ricci

Start of the template for handouts for assignments

Uses Makerules from my proposal LaTeX skeletons
parent 70c31128
DOCUMENTS=handout
include Makerules
## -*- mode: Makefile -*-
##
## This is a sufficient `Makefile', but not a great one.
##
## "Normal" PDF is generated via `pdflatex'. This is the route you take if you
## make `<doc>.pdf'.
##
###############################################################################
## These variables can be set by Makefiles that include this file. At a
## minimum, DOCUMENTS or SUBDIRS should be set, all of the others are optional
# The root documents, minus their `.tex' file name extensions. Each of these
# is a (phony) Make target.
#
#DOCUMENTS := prop
# Individual pieces of the root document: These can get built as separate PDFs
# with the 'make parts' target
#PARTS := summary description refs
# Sub-directories that should be recursed into
#SUBDIRS := adm
# Generated LaTeX files (budget tables).
#
#BUDTABLES :=
# "Extra" figures, not made from `.fig' or `.svg' files. These must have file
# name extensions because we don't want to infer them.
#
#EXTRAFIGEPS :=
#
#EXTRAFIGPDF :=
#
#EXTRAFIGWWW :=
# The first root file listed in `DOCUMENTS' is the default target. Override
# the DOC variable if you want to to be something else
DOC ?= $(firstword $(DOCUMENTS))
###############################################################################
TEXINPUTS ?= .:./figs:./texstuff::
BUILDDIR ?= ./.build
#
# Needed to use bibtex properly in the builddir
#
CURDIR = $(shell pwd)
BIBINPUTS ?= $(CURDIR):$(CURDIR)/bib::
export TEXINPUTS
export BIBINPUTS
LATEX ?= latex
PDFLATEX ?= pdflatex
BIBTEX ?= bibtex
PS2PDF ?= ps2pdf14
FIG2DEV ?= fig2dev
INKSCAPE ?= inkscape
EPSTOPDF ?= epstopdf
PDFLATEXFLAGS ?= --interaction=nonstopmode --halt-on-error \
--file-line-error --output-directory=$(BUILDDIR)
# See below for some long-winded comments about these options.
#
PS2PDFFLAGS ?= -sPAPERSIZE=letter -dPDFSETTINGS=/printer \
-dUseCIEColor \
-dEmbedAllFonts=true -dSubsetFonts=true -dMaxSubsetPct=100
PS2PDFFLAGS_EPS ?= -dEPSCrop -dPDFSETTINGS=/printer \
-dUseCIEColor \
-dEmbedAllFonts=true -dSubsetFonts=true -dMaxSubsetPct=100
TEX4HT ?= tex4ht
T4HT ?= t4ht
# TEXBITS should exclude the root files, but it does not.
TEXBITS ?= $(wildcard *.tex) $(BUDTABLES)
BIBBITS ?= $(wildcard *.bib) $(wildcard bib/*.bib)
FIGBITS ?= $(wildcard figs/*.fig)
SVGBITS ?= $(wildcard figs/*.svg)
# If you want to avoid requiring inkscape, comment out the line above and
# uncomment this one
#SVGBITS ?=
FIGEPS ?= $(FIGBITS:.fig=.eps) $(SVGBITS:.svg=.eps) $(EXTRAFIGEPS)
FIGPDF ?= $(FIGBITS:.fig=.pdf) $(SVGBITS:.svg=.pdf) $(EXTRAFIGPDF)
FIGWWW ?= $(FIGBITS:.fig=.png) $(SVGBITS:.svg=.png) $(EXTRAFIGWWW)
DEPS ?= $(wildcard *.cls) $(wildcard *.sty) $(wildcard *.cfg) \
$(TEXBITS) $(BIBBITS) \
$(MAKEFILE_LIST)
###############################################################################
# Some commends about `PS2PDFFLAGS'.
#
# -Pdownload35 --- Embed the standard PostScript fonts. The USENIX author
# instructions (and many other conference instructions) ask that *all* fonts be
# embedded in PDF documents. Note that you *must* use this option in order for
# `ps2pdf14' to produce working PDF. Note that the the name of the embedded
# `Times' font is called `Nimbus'. (See the `ps2pk.map' file.)
#
# -u ps2pk.map --- I think this is not required, but it doesn't hurt. I think
# `dvips' consults it anyway. I could be wrong; maybe it is required in some
# cases.
#
# -d... --- For the `ps2pdf' options the deal with font embedding, I believe
# that all of these are the standard values for modern versions of Ghostscript
# (7.05+).
#
# Note that you can use the `pdffonts' tool to check that all the fonts are
# embedded.
#
# Some random but handy URLs for these things:
# <http://www.crhc.uiuc.edu/~mjmille2/howtos/latex-howtos/>
# <http://www.cs.wisc.edu/~ghost/doc/gnu/7.05/Ps2pdf.htm>
###############################################################################
.DELETE_ON_ERROR:
.PHONY: all clean realclean
all::
clean::
realclean::
###############################################################################
all:: $(DOC)
define def-doc-rule
.PHONY: $1
$1: $1.pdf
endef
$(foreach d,$(DOCUMENTS),$(eval $(call def-doc-rule,$d)))
.PHONY: pdf
pdf: $(DOC).pdf
.PHONY: html
html: $(DOC)-www.html
define def-www-rule
$1-www.html: $1-www.dvi
$$(TEX4HT) $$(basename $$@)
$$(T4HT) $$(basename $$@)
endef
# And if you have `wwwis' <http://bloodyeck.com/wwwis/>,
# wwwis *.html
$(foreach d,$(DOCUMENTS),$(eval $(call def-www-rule,$d)))
.PHONY: parts
parts: $(addsuffix .pdf,$(PARTS))
####
$(addsuffix .pdf,$(DOCUMENTS)): $(DEPS) $(FIGPDF)
$(addsuffix -www.dvi,$(DOCUMENTS)): $(DEPS) $(FIGWWW)
# Why be subtle?
# Use a special job name to keep our output docs separate from those along the
# "normal" route to PDF.
%-www.dvi: %-www.tex
$(LATEX) -jobname $(basename $@) $(basename $<)
- $(BIBTEX) $(basename $@)
$(LATEX) -jobname $(basename $@) $(basename $<)
$(LATEX) -jobname $(basename $@) $(basename $<)
$(LATEX) -jobname $(basename $@) $(basename $<)
# Why be subtle?
%.pdf: %.tex | $(BUILDDIR)
$(PDFLATEX) -draftmode $(PDFLATEXFLAGS) $(basename $<)
- cd $(BUILDDIR) && $(BIBTEX) $(basename $@)
$(PDFLATEX) -draftmode $(PDFLATEXFLAGS) $(basename $<)
$(PDFLATEX) $(PDFLATEXFLAGS) $(basename $<)
mv $(BUILDDIR)/$@ $@
# Rules to build the partial files listed in PARTS
define def-part-rule
$1: $1.pdf ;
$1.pdf: $(DOC).pdf | $(BUILDDIR)
$(PDFLATEX) $(PDFLATEXFLAGS) -jobname=part-$1 \
"\includeonly{$1}\input{$(DOC)}"
mv $(BUILDDIR)/part-$1.pdf $1.pdf
endef
$(foreach part,$(PARTS),$(eval $(call def-part-rule,$(part))))
%.bbl: %.aux
$(BIBTEX) $(basename $@)
$(BUILDDIR):
mkdir -p $(BUILDDIR)
####
%.eps: %.svg
$(INKSCAPE) \
$< \
--export-eps=$@
%.eps: %.jpg
$(INKSCAPE) \
$< \
--export-eps=$@ \
--export-text-to-path
%.eps: %.fig
$(FIG2DEV) -L eps $< $@
%.pdf: %.fig
$(FIG2DEV) -L pdf $< $@
# "-m 1.5 -S 4": magnify and smooth
%.png: %.fig
$(FIG2DEV) -L png -m 1.5 -S 4 $< $@
# This method produces small PDFs that have tight bounding boxes.
$(SVGBITS:.svg=.pdf): %.pdf: %.eps
$(PS2PDF) $(PS2PDFFLAGS_EPS) $< $@
#####
$(BUDTABLES): \
budget-tables/budget.py \
budget-tables/currency.py \
budget-tables/em.py \
budget-tables/run \
budget-tables/table.py \
budget-tables/template.em
budget-all-1.tex:
(cd budget-tables && ./run Both 1.0 AllBudgetTableOne) > $@
###############################################################################
## Simple rules for making sub-directories
# To cause make to get run for target bar in subdirectory foo, create a
# dependency on foo/bar.MAKE
%.MAKE:
@$(MAKE) -w -C $(dir $@) $(basename $(notdir $@))
# In conjection with the rule above, you can depend on bar-subdirs to
# build target bar in all subdirectories
%-subdirs: $(addsuffix /%.MAKE,$(SUBDIRS)) ;
# ... and do this for some common rules
all:: all-subdirs
clean:: clean-subdirs
realclean:: realclean-subdirs
###############################################################################
## Some generally useful magic bits
# Given a list of directory/target, make dependency strings for the .MAKE rule
# above, suitable for going and building those targets
define recursivedeps
$(foreach bit,$(1), $(dir $(bit))/$(basename $(notdir $(bit))).MAKE)
endef
###############################################################################
clean::
$(RM) -r $(BUILDDIR)
$(RM) *.backup *~
realclean:: clean
$(RM) $(foreach doc, $(DOCUMENTS), $(doc).{pdf,ps,eps})
$(RM) $(foreach part, $(PARTS), $(part).{pdf,ps,eps})
$(RM) *-www.css *-www.html *-www?.html *-www*.png
$(RM) $(BUDTABLES)
$(RM) $(FIGBITS:.fig=.eps) $(SVGBITS:.svg=.eps)
$(RM) $(FIGBITS:.fig=.pdf) $(SVGBITS:.svg=.pdf)
$(RM) $(FIGBITS:.fig=.png) $(SVGBITS:.svg=.png)
###############################################################################
## End of file.
\documentclass{article}[10pt]
\title{Homework \#1}
\author{}
\date{\today}
\begin{document}
\maketitle
\end{document}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment