sagemath / cloud

*MOVED TO* https://github.com/sagemathinc/cocalc
https://cocalc.com
Other
137 stars 31 forks source link

LaTeX: condemn messy files into subdirectory #140

Open haraldschilly opened 10 years ago

haraldschilly commented 10 years ago

Building latex files always produces a list of additional files. By adding -output-directory build to the pdflatex command, all files are moved into the subdir build. Of course, this breaks what the SMC's latex editor expects … and one also has to look into this subdirectory for the actual *.pdf file.

Here is a makefile I'm using, which for example hard-links the pdf files into the root dir. It uses latexmk to produce the files, which would need -pdf -pdflatex="pdflatex -interact=nonstopmode -output-directory --shell-escape %O %S" for adopting it in SMC (or something like that ...)

OUTDIR=build
TEXFILES=$(wildcard *.tex)
PDFFILES=$(patsubst %.tex,$(OUTDIR)/%.pdf,$(TEXFILES))
BIBFILES=$(wildcard *.bib)
MAIN=<MAIN FILENAME>.tex
MAINPDF=$(patsubst %.tex,%.pdf,$(MAIN))
LATEX=latexmk -outdir=$(OUTDIR)

.PHONY=clean cleanall distclean build

build: $(MAINPDF)

$(MAINPDF): $(TEXFILES) $(BIBFILES)
    $(LATEX) -pdf $(MAIN)
    ln -f $(OUTDIR)/$(MAINPDF) .

distclean:
    $(RM) -f *.pdf *.dvi
    $(RM) -Rf $(OUTDIR)

cleanall: clean
    $(LATEX) -C
    $(RM) -f *.pdf *.dvi

clean:
    $(LATEX) -c

show:
    xdg-open $(MAINPDF)
haraldschilly commented 10 years ago

well, for now, this is just a nice idea but needs more work. it turned out, that using a subdirectory doesn't work with some of the working files. in particular it concerns the biblatex files for the references.