请参阅以下代码:如何在不键入BASE_NAME = myfile
的情况下将参数BASE_NAME
发送到命令行。我只想进入
$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
另外,我如何使用选项类型
$make pdf -o myfile
生成PDF然后从选项-o
打开它?
答案 0 :(得分:2)
这不是一个TeX问题本身,但是......
如果您指定通用规则而不是特定规则,则会更好。此外,如果您要打开文件,Makefile
约定会建议使用命令make open
而不是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)
答案 1 :(得分:1)
我认为你应该像鲍里斯写的那样改变你的Makefile
:
%.pdf: %.tex
pdflatex $<
您可以运行make myfile.pdf
或make foo.pdf
或其他任何内容。