Parcourir la source

Merge pull request #144 from henrybear327/improvement/latexmk

Use latexmk instead of pdflatex for PDF generation
Jim Huang il y a 3 ans
Parent
commit
413c7d54cd
3 fichiers modifiés avec 7 ajouts et 4 suppressions
  1. 2 0
      .gitignore
  2. 3 4
      Makefile
  3. 2 0
      README.md

+ 2 - 0
.gitignore

@@ -18,6 +18,8 @@ lkmpg.pdf
 *.toc
 *.bbl
 *.blg
+*.fdb_latexmk 
+*.fls
 
 # make4ht
 *.html

+ 3 - 4
Makefile

@@ -2,10 +2,9 @@ PROJ = lkmpg
 all: $(PROJ).pdf
 
 $(PROJ).pdf: lkmpg.tex
-	pdflatex -shell-escap $<
-	bibtex $(PROJ) >/dev/null || echo
-	pdflatex -shell-escape $< 2>/dev/null >/dev/null
+	@if ! hash latexmk; then echo "No Latexmk found. See https://mg.readthedocs.io/latexmk.html for installation."; exit 1; fi
 	rm -rf _minted-$(PROJ)
+	latexmk -shell-escape lkmpg.tex -pdf
 
 html: lkmpg.tex html.cfg assets/Manrope_variable.ttf
 	sed $ 's/\t/    /g' lkmpg.tex > lkmpg-for-ht.tex
@@ -19,7 +18,7 @@ indent:
 	(cd examples; find . -name '*.[ch]' | xargs clang-format -i)
 
 clean:
-	rm -f *.dvi *.aux *.log *.ps *.pdf *.out lkmpg.bbl lkmpg.blg lkmpg.lof lkmpg.toc
+	rm -f *.dvi *.aux *.log *.ps *.pdf *.out lkmpg.bbl lkmpg.blg lkmpg.lof lkmpg.toc lkmpg.fdb_latexmk lkmpg.fls
 	rm -rf html
 
 .PHONY: html

+ 2 - 0
README.md

@@ -40,6 +40,8 @@ $ brew install --cask mactex
 $ sudo tlmgr update --self
 ```
 
+Note that `latexmk` is required to generated PDF, and it probably has been installed on your OS already. If not, please follow the [installation guide](https://mg.readthedocs.io/latexmk.html#installation).
+
 Alternatively, using [Docker](https://docs.docker.com/) is recommended, as it guarantees the same dependencies with our GitHub Actions workflow.
 After install [docker engine](https://docs.docker.com/engine/install/) on your machine, pull the docker image [twtug/lkmpg](https://hub.docker.com/r/twtug/lkmpg) and run in isolated containers.