diff options
Diffstat (limited to 'reproduce/analysis/make/paper.mk')
-rw-r--r-- | reproduce/analysis/make/paper.mk | 49 |
1 files changed, 40 insertions, 9 deletions
diff --git a/reproduce/analysis/make/paper.mk b/reproduce/analysis/make/paper.mk index 5227e55..6d69d49 100644 --- a/reproduce/analysis/make/paper.mk +++ b/reproduce/analysis/make/paper.mk @@ -44,7 +44,7 @@ $(mtexdir)/project.tex: $(mtexdir)/verify.tex # If no PDF is requested, or if LaTeX isn't available, don't # continue to building the final PDF. Otherwise, merge all the TeX # macros into one for building the PDF. - @if [ -f .local/bin/pdflatex ] && [ x"$(pdf-build-final)" != x ]; then + @if [ -f .local/bin/latex ] && [ x"$(pdf-build-final)" != x ]; then # Put a LaTeX input command for all the necessary macro files. rm -f $(mtexdir)/project.tex @@ -86,7 +86,7 @@ $(mtexdir)/project.tex: $(mtexdir)/verify.tex # # NOTE: `$(mtexdir)/project.tex' is an order-only-prerequisite for # `paper.bbl'. This is because we need to run LaTeX in both the `paper.bbl' -# recipe and the `paper.pdf' recipe. But if `tex/src/references.tex' hasn't +# recipe and the `paper.pdf' recipe. But if `tex/src/references.bib' hasn't # been modified, we don't want to re-build the bibliography, only the final # PDF. $(texbdir)/paper.bbl: tex/src/references.tex $(mtexdir)/dependencies-bib.tex \ @@ -95,21 +95,45 @@ $(texbdir)/paper.bbl: tex/src/references.tex $(mtexdir)/dependencies-bib.tex \ @macros=$$(cat $(mtexdir)/project.tex) if [ x"$$macros" != x ]; then + # Unfortunately I can't get bibtex to look into a special + # directory for the references, so we'll copy it here. + p=$$(pwd) + if ! [ -L $(texbdir)/references.bib ]; then + ln -s $$p/tex/src/references.tex $(texbdir)/references.bib + fi + + # Copy the improved IEEE bst file into the build directory. + # The improved bst file provides ArXiv clickable URLs and + # if available, open-access URLs based on the DOIs, with + # closed-access URLs as a fallback, via https://oadoi.org . + cp -pv $$p/tex/src/IEEEtran_openaccess.bst $(texbdir) + # We'll run LaTeX first to generate the `.bcf' file (necessary # for `biber') and then run `biber' to generate the `.bbl' file. - p=$$(pwd) export TEXINPUTS=$$p: cd $(texbdir); - # The pdflatex option '-shell-escape' is "normally disallowed for + # Note: the option '-shell-escape' is "normally disallowed for # security reasons" according to the `info pdflatex' manual, but # is enabled here in order to allow the use of PGFPlots. If you # do not use PGFPlots, then you should remove the `-shell-escape' # option for better security. See # https://savannah.nongnu.org/task/?15694 for details. - pdflatex -shell-escape -halt-on-error $$p/paper.tex - biber paper - + latex -shell-escape -halt-on-error $$p/paper.tex + bibtex paper + + # Hack: tidy up eprint+doi style that didn't work in .bst file. + # TODO (better): read Part 4 of + # http://mirrors.ctan.org/info/bibtex/tamethebeast/ttb_en.pdf + # and fix the .bst style properly. + cp paper.bbl paper-tmp.bbl \ + && sed -e "s/\'/EOLINE/g" paper-tmp.bbl \ + | tr -d '\n' \ + | sed -e 's/\([0-9]\)\( \|EOLINE\)}/\1}/g' \ + | sed -e 's/\([^,]\) *\( \|EOLINE\) *\\eprint/\1, \\eprint/g' \ + | sed -e 's/\([^,]\) *\( \|EOLINE\) *\\doi/\1, \\doi/g' \ + | sed -e 's/EOLINE/\n/g' > paper.bbl + latex -shell-escape -halt-on-error $$p/paper.tex fi @@ -134,13 +158,20 @@ paper.pdf: $(mtexdir)/project.tex paper.tex $(texbdir)/paper.bbl p=$$(pwd) export TEXINPUTS=$$p: cd $(texbdir) + # See above for a warning and brief discussion on the the # pdflatex option `-shell-escape'. - pdflatex -shell-escape -halt-on-error $$p/paper.tex + latex -shell-escape -halt-on-error $$p/paper.tex + + # Convert the DVI to PostScript, and the PostScript to PDF. The + # `-dNOSAFER' option to GhostScript allows transparencies in the + # conversion from PostScript to PDF, see + # https://www.ghostscript.com/doc/current/Language.htm#Transparency + dvips paper.dvi + ps2pdf -dNOSAFER paper.ps # Come back to the top project directory and copy the built PDF # file here. cd $$p cp $(texbdir)/$@ $(final-paper) - fi |