请参阅下面的代码:如何在不inputBASE_NAME
情况下将参数BASE_NAME = myfile
发送到命令行。 我只想input
$make pdf myfile
BASE_NAME = myfile LATEX = latex PDFLATEX = pdflatex BIBTEX = bibtex MAKEINDEX = makeindex DVIPS = dvips PS2PDF = ps2pdf pdf: $(BASE_NAME).pdf ps: $(BASE_NAME).ps $(BASE_NAME).ps: $(BASE_NAME).tex $(LATEX) $< $(BIBTEX) $(BASE_NAME) $(LATEX) $< $(LATEX) $< $(DVIPS) -Ppdf $(BASE_NAME) $(BASE_NAME).pdf: $(BASE_NAME).tex $(PDFLATEX) $< clean: rm -f $(BASE_NAME)*.ps $(BASE_NAME)*.dvi *.log \ *.aux *.blg *.toc \ missfont.log $(BASE_NAME)*.bbl $(BASE_NAME)*.out \ $(BASE_NAME)*.lof $(BASE_NAME)*.lot open: acroread $(BASE_NAME).pdf
另外,如何使用选项types
$make pdf -o myfile
生成PDF,然后从选项-o
打开它?
这本身不是一个TeX问题,但是…
如果您指定通用规则而不是特定规则,则会更好。 另外,如果你想打开你的文件, Makefile
约定会提示make open
make -o
命令而不是make -o
。
我通常这样做
# The only thing that changes! TEXFILES = firstfile.tex secondfile.tex PDFS = ${TEXFILES:%.tex=%.pdf} all: $(PDFS) open: all for x in ${PDFS}; do (xpdf $$x &); done # You can write a similar rule for ps... %.pdf: %.tex pdflatex $* -bibtex $* pdflatex $* - while ( grep -q '^LaTeX Warning: Label(s) may have changed' $*.log || \ grep -q '^Package natbib Warning: Citation(s) may have changed' $*.log ) \ do pdflatex $*; done clean: $(RM) *.aux *.bbl *.dvi *.log *.out *.toc *.blg *.lof *.lot distclean: clean $(RM) $(PDFS)
我想你应该改变你的Makefile
就像鲍里斯写道:
%.pdf: %.tex pdflatex $<
你可以运行make myfile.pdf
或者make foo.pdf
或者其他东西。