diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/make_latex |
Initial commit
Diffstat (limited to 'support/make_latex')
-rw-r--r-- | support/make_latex/make_latex | 142 | ||||
-rw-r--r-- | support/make_latex/make_latex.man | 242 | ||||
-rw-r--r-- | support/make_latex/make_latex.pdf | bin | 0 -> 54891 bytes |
3 files changed, 384 insertions, 0 deletions
diff --git a/support/make_latex/make_latex b/support/make_latex/make_latex new file mode 100644 index 0000000000..a646c525f0 --- /dev/null +++ b/support/make_latex/make_latex @@ -0,0 +1,142 @@ +# make_latex +# - A file to be included to enable make(1) to process LaTeX files. +# Suitable for single-part documents with BibTeX references and diagrams. +# David Beasley, <David.Beasley@cm.cf.ac.uk>, December 1992 +# Department of Computing Mathematics, Univeristy of Wales College of Cardiff. +# Last Update: 13/10/93 +# +# Note on commands: +# 'make doc1.dvi' - creates dvi file if make thinks that something has changed. +# 'make doc1' - also creates dvi file, unconditionally (useful if you havent +# specified _all_ the things it depends on) +# +# Refer to man entry for make(1) for explanation of syntax and command options + +.KEEP_STATE: + +# ---- The following shows the type of entries required in each Makefile ---- + +# include $(HOME)/lib/make_latex +# # Name(s) of LaTeX document file(s) (without suffixes) +# # eg. +# FILES = doc1 doc2 +# +# # List here dependencies of documents on other files (eg diagrams +# # from .gnu files) eg. +# doc1.dvi : fig1.ps fig2.ps fig3.ps +# doc2.dvi : diag1.ps diag2.ps +# +# # Names of additional files to be deleted by TIDY and CLEAN commands +# TIDYFILES = x +# CLEANFILES = y + +# --------------- The following defaults may be user-configured -------------- + +# Default name(s) of BibTeX source files, eg. +BIBFILES = $(HOME)/Refs/myrefs.bib + +# default printer resolution +PRINT_RES = 300 + +# Switch over resolution between lo and hi res devices +PR_RES_BOUNDARY = 400 + +# default printer names +PRINTER = lw0 # for output below $(PR_RES_BOUNDARY) +PR_HI_RES = lwpro # for output >= $(PR_RES_BOUNDARY) + +# name of print command +LPR = lpr + +# options given to lpr command - delete after printing by default +PR_OPT = -r + +# Pattern(s) to match for old versions of files to be deleted by 'make clean' +OLDVERSIONS = *% + +# -------------- Lines below here shouldnt need changing ----------------- + +# default page range to print +PAGE_F = -999999 +PAGE_T = 999999 + +# name of BibTeX command +BIBTEX = bibtex + +# name of LaTeX command +LATEX = latex + +# names of all DVI files +DVIFILES = $(FILES:%=%.dvi) + +# assume that all dvi files named depend on all bib files named +$(FILES:%=%.bbl) : $(BIBFILES) + + +# -------------- generic target names ---------------- + +# create all dvi files +all: $(DVIFILES) + +#create all postscript files +allps: $(FILES:%=%.ps) + +# print all files +allpr: $(FILES:%=%.pr) + +# delete all files which can easily be regenerated +tidy: + -rm -f $(DVIFILES) $(TIDYFILES) + -rm -f $(FILES:%=%.ps) $(FILES:%=%.log) $(FILES:%=%.blg) + +# delete all files which can be regenerated +clean: tidy + -rm -f $(FILES:%=%.aux) $(FILES:%=%.bbl) $(CLEANFILES) + @# delete editor old-version files + -rm -f $(OLDVERSIONS) + +# -------------- pattern matching rules -------------- + +# ensure that the bbl file gets regenerated if the bib file is changed +%.bbl : $(BIBFILES) + @# if there is no aux file, skip this, it will get done later + -@if [ -r $*.aux ] ;\ + then $(BIBTEX) $* ; \ + fi + +# create a dvi file from a tex file +% %.dvi: %.tex + $(LATEX) $* + -@egrep -c 'Citation .* undefined.' $*.log && ($(BIBTEX) $*;$(LATEX) $*) + -@grep 'Rerun to get cross-references right' $*.log && $(LATEX) $* + +# create postscript file of a dvi file +%.ps: %.dvi + @if [ $(PAGE_F) -lt -999998 ] ;\ + then echo dvips -D $(PRINT_RES) -l $(PAGE_T) -o $@ $* ;\ + dvips -D $(PRINT_RES) -l $(PAGE_T) -o $@ $* ;\ + else echo dvips -D $(PRINT_RES) -p $(PAGE_F) -l $(PAGE_T) -o $@ $* ;\ + dvips -D $(PRINT_RES) -p $(PAGE_F) -l $(PAGE_T) -o $@ $* ;\ + fi + +# create postscript file of a gnu plot +%.ps: %.gnu + gnuplot $< + +# create a latex picture file from an xfig file +%.pic: %.fig + fig2dev -L latex $< $@ + +# create a postscript file from an xfig file +%.ps: %.fig + fig2dev -L ps $< $@ + +# send a postcript file to be laser printed +%.pr: %.ps + @if [ $(PRINT_RES) -lt $(PR_RES_BOUNDARY) ] ;\ + then echo $(LPR) $(PR_OPT) -P$(PRINTER) $< ;\ + $(LPR) $(PR_OPT) -P$(PRINTER) $< ;\ + else echo $(LPR) $(PR_OPT) -P$(PR_HI_RES) $< ;\ + $(LPR) $(PR_OPT) -P$(PR_HI_RES) $< ;\ + fi + diff --git a/support/make_latex/make_latex.man b/support/make_latex/make_latex.man new file mode 100644 index 0000000000..a004b23421 --- /dev/null +++ b/support/make_latex/make_latex.man @@ -0,0 +1,242 @@ +.TH make_latex 5 "13 October 1993" "" +.SH NAME +make_latex \- Makefile rules for LaTeX documents +.SH SYNOPSIS +.B ~/lib/make_latex +.SH DESCRIPTION +The make(1) utility provides a general mechanism for regenerating a file +which depends upon other files, when any of those other files is +altered. The action is recursive. Although make(1) is normally used +for compiling programs, there is no reason why make should not be used +in other circumstances where several files must be brought together, +and appropriately processed, in order to produce a desired result. + +For example, to print a LaTeX document, a postscript file is required, +which depends upon a .dvi file, and other .ps files of included figures. +The .dvi file depends on a .tex file, the .ps files of included figures, +and a .bib file. The .ps files of included figures may themseleves depend +on .fig files or .gnu files generated by other utilities. Thus we have +a tree of file dependencies, which is exactly what make was designed to +cope with. + +.I make_latex +provides a set of rules which tell make(1) how to generate a file at +one level in the file dependency tree, given the files at the next +level higher up in the tree. Users need only specify the file dependencies +in a makefile, and make(1) can do the rest. When anything is altered, +make determines what needs to be done to bring other files up to date. + +.I make_latex +knows how to do the following: + + \- send a .ps file to be printed + \- convert a .dvi file to a .ps file + \- convert a .tex file to a .dvi file (including running BibTeX if necessary) + \- convert a gnuplot(1) file to a .ps file + \- convert an xfig(1) file to a .ps file + \- convert an xfig(1) file to a latex picture file + \- tidy up intermediate files + +Other capabilities can easily be added, according to individual user's +requirements. + +.SH INSTALLATION +The \fImake_latex\fR file should be installed in any convenient directory. +Since make_latex is not large, we suggest that each user has their own +copy, and places it in directory ~/lib + +Some entries in the make_latex file will probably need customising to +provide convenient defaults for each user. These appear near the top +of the file. (Note that it is possible to override any of these +settings on an individual basis. See below). +.TP 10 +.B BIBFILES +The name(s) of the BibTeX files which hold your references. +.TP +.B PRINT_RES +The printer resolution (dots per inch) +at which you normally print. 300 should be ok for most people. +.TP +.B PRINTER +The name of the printer to which +normal resolution print jobs should be sent by default. +.TP +.B PR_HI_RES +The name of the printer to which +high resolution (>400 dpi) print jobs should be sent by default. +.TP +.B LPR +The name of the print command. lpr should be ok for most people. +.TP +.B PR_OPT +The default options to be sent with each print command. Generally set to "-r", +to delete a postscript file after printing it. +.TP +.B OLDVERSIONS +The filename pattern(s) to match for files to be deleted by a "make clean" +(see below). + +.SH MAKEFILE FORMAT +In each directory holding LaTeX documents, a file named \fIMakefile\fR +is required. A sample file is as follows: + + include $(HOME)/lib/make_latex + FILES = myfile paper + myfile.dvi : fig1.ps fig2.ps part2.tex + paper.dvi : complex.ps dna.ps + +The first line loads the rules from the +.I make_latex +file. The second line (an example of a \fImacro assignment\fR) specifies +the names (without extensions) of all the +major LaTeX files in the directory. The final two lines specify file +dependencies. In this example, myfile.tex has two included figures, fig1.ps +and fig2.ps, and also an included LaTeX file, part2.tex. + +If a file exists called fig1.fig (generated by xfig(1)) or fig1.gnu (a +gnuplot(1) file), make knows that fig1.ps depends on fig1.fig or fig1.gnu +\- there is no need to specify this. + +Entries on each line are separated by whitespace. If there are more +entries than can fit on a single line, line breaks must be escaped by +the "\\" character. + +Note that the order of lines in the \fIMakefile\fR +is not critical, except as noted in the section: Overriding Defaults. + +.SH TARGETS FOR MAKE + +Processing is initiated with the command make(1), followed by the name(s) +of the "target" files to be generated. For example, + + make myfile.ps + +will do all that is necessary to generate myfile.ps; it will +run LaTeX on myfile.tex (and if required, BibTeX, followed by +re-running LaTeX), then run dvips on myfile.dvi to produce myfile.ps. +Similarly, "make myfile.dvi" will just generate myfile.dvi. +The command "make myfile" will also generate myfile.dvi, but will +work unconditionally, even if make doesnt think that anything has +changed. (This can be useful if, for example, a style file is altered, +and make doesnt know about the dependency.) + +The command + + make myfile.pr + +is an example of a special target. It does not produce a file called +"myfile.pr" \- instead it generates myfile.ps, and then sends it to be +printed. + +Other special targets are: +.TP 10 +.B all +to generate all .dvi files +.TP +.B allps +to generate all .ps files +.TP +.B allpr +to generate and print all .ps files +.TP +.B tidy +to delete log files and intermediate files which can easily be recovered +.TP +.B clean +to tidy, and delete intermediate files which can less +easily be recovered + +.SH OVERRIDING DEFAULTS + +Default macro assignments can easily be overridden on a +per-Makefile or per-LaTeX file basis. For example, to specify +"alternate.bib" (a file in the current directory) as the BibTeX source +file for all LaTeX files in the \fIMakefile\fR, insert the line: + + BIBFILES = alternate.bib + +(This line must come after the "include" line.) If you wish to specify +that "alternate.bib" should be consulted \fIin addition to\fR the +default BibTeX file(s), use: + + BIBFILES += alternate.bib + +To override a default value only for specific LaTeX files in the +\fIMakefile\fR, a \fIconditional macro assignment\fR can be used, +with the format: + + <target> [...] := <macro assignment> + +For example, to specify a different BibTeX file for myfile.tex, use: + + myfile.dvi := BIBFILES = newrefs.bib + +which in effect means "when generating the file myfile.dvi, use the +assignment: BIBFILES = newrefs.bib". Another example: to specify a +different printer for plan.tex, use: + + plan.pr := PR_LO_RES = laser1 + +Note that it is important use the right target name. An entry of the +form: + + plan.ps := PR_LO_RES = laser1 + +would have no effect, since the value of PR_LO_RES is irrelevant while +plan.ps is being generated. + +.SH COMMAND LINE OPTIONS + +In addition to being able to override defaults in the \fIMakefile\fR, +macro values can be specified on the command line. For example, to print +plan.tex on printer "pr1", use: + + make PRINTER=pr1 plan.pr + +Note that no spaces are allowed around the "=". Note also that command +line macro assignments do not override conditional macro assignments in +the \fIMakefile\fR. The assignments you would be most likely to want to +change on the command line are: +.TP 10 +.B PRINTER +Printing device for low resolution (<400 dpi) output. +.TP +.B PRINT_RES +Resolution (dots per inch) to print at. +.TP +.B PR_HI_RES +Printing device for high resolution (>400 dpi) output. +.TP +.B PAGE_F +Page number to start printing from. +.TP +.B PAGE_T +Page number to print up to. + +.SH TIDYING UP + +The targets +.B tidy +and +.B clean +can be used to delete unimportant files. + +.B Tidy +will delete all .dvi, .ps, .log, and .blg files generated from any +file specified in the FILES assignment. It also deletes any files +specified in an assignment to TIDYFILES. Note that other .ps files +(such as those generated from .fig or .gnu files) are \fInot\fR +deleted, unless specified in a TIDYFILES assignment. + +.B Clean +will delete all +.B tidy +files, and also delete .aux and .bbl files generated from any +file specified in the FILES assignment. Editor backup files +which match the pattern specified in OLDVERSIONS are also deleted, +along with any files specified in an assignment to CLEANFILES. + +.SH SEE ALSO +make(1), latex(1), bibtex(1) +.SH AUTHOR +David Beasley <David.Beasley@cm.cf.ac.uk> diff --git a/support/make_latex/make_latex.pdf b/support/make_latex/make_latex.pdf Binary files differnew file mode 100644 index 0000000000..ec3454fc7a --- /dev/null +++ b/support/make_latex/make_latex.pdf |