|
2 | 2 |
|
3 | 3 | set -ex |
4 | 4 |
|
| 5 | +TEXLIVE_DOCKER="texlive/texlive@sha256:18f1e85aecc7ad016159110c97eb15475325a9b42e86c9f0f554ba071f7207d3" |
| 6 | + |
5 | 7 | # source: https://stackoverflow.com/questions/29436275/how-to-prompt-for-yes-or-no-in-bash |
6 | 8 | function yes_or_no { |
7 | 9 | while true; do |
@@ -32,29 +34,52 @@ if [[ -e submission.tex ]] && [[ $1 -ef submission.tex ]]; then |
32 | 34 | exit 1 |
33 | 35 | fi |
34 | 36 |
|
| 37 | +if [[ ! -e graphicscache.sty ]]; then |
| 38 | + echo "Please copy graphicscache.sty to this directory to include it in the release." |
| 39 | + exit 1 |
| 40 | +fi |
| 41 | + |
| 42 | +if ! command -v docker || ! docker container ls &> /dev/null; then |
| 43 | + echo "Docker is not installed or you are not member of the docker group. Using your latex installation directly, but it might not match arXiv's one." |
| 44 | + function run() { |
| 45 | + "$@" |
| 46 | + } |
| 47 | + function run_in_test_release() { |
| 48 | + ( cd test_release && "$@" ) |
| 49 | + } |
| 50 | +else |
| 51 | + echo "Found docker, using it." |
| 52 | + function run() { |
| 53 | + docker run --rm --user $(id -u):$(id -g) -v $(pwd):$(pwd) -w $(pwd) ${TEXLIVE_DOCKER} "$@" |
| 54 | + } |
| 55 | + function run_in_test_release() { |
| 56 | + docker run --rm --user $(id -u):$(id -g) -v $(pwd)/test_release:$(pwd)/test_release -w $(pwd)/test_release ${TEXLIVE_DOCKER} "$@" |
| 57 | + } |
| 58 | +fi |
| 59 | + |
35 | 60 | echo "1) Running latexpand to strip comments and unify your .tex file..." |
36 | | -latexpand --empty-comments $1 > submission.tex |
| 61 | +run latexpand --empty-comments $1 > submission.tex |
37 | 62 |
|
38 | 63 | echo |
39 | 64 | echo "2) Running pdflatex (log in release.log)..." |
40 | | -pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log |
41 | | -pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log |
| 65 | +run pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log |
| 66 | +run pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log |
42 | 67 |
|
43 | 68 | if grep -F "run Biber on the file" release.log &> /dev/null; then |
44 | | - biber submission |
| 69 | + run biber submission |
45 | 70 | else |
46 | | - bibtex submission |
| 71 | + run bibtex submission |
47 | 72 | fi |
48 | 73 |
|
49 | | -pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log |
50 | | -pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log |
| 74 | +run pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log |
| 75 | +run pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log |
51 | 76 |
|
52 | 77 | echo |
53 | 78 | echo "3) Running pdflatex with render=false to determine needed files..." |
54 | 79 | mv submission.tex submission.tex.orig |
55 | 80 | echo '\makeatletter\def\graphicscache@inhibit{true}\makeatother' > submission.tex |
56 | 81 | cat submission.tex.orig >> submission.tex |
57 | | -pdflatex -shell-escape -interaction nonstopmode -recorder submission.tex &>> release.log |
| 82 | +run pdflatex -shell-escape -interaction nonstopmode -recorder submission.tex &>> release.log |
58 | 83 |
|
59 | 84 | grep "^INPUT" submission.fls \ |
60 | 85 | | cut -d ' ' --complement -f 1 \ |
@@ -90,14 +115,11 @@ if [[ -e test_release ]]; then |
90 | 115 | fi |
91 | 116 | fi |
92 | 117 |
|
93 | | -( |
94 | | - mkdir test_release |
95 | | - cd test_release |
96 | | - tar xf ../release.tar |
97 | | - pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log |
98 | | - pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log |
99 | | - pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log |
100 | | -) |
| 118 | +mkdir test_release |
| 119 | +tar -xf release.tar -C test_release |
| 120 | +run_in_test_release pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log |
| 121 | +run_in_test_release pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log |
| 122 | +run_in_test_release pdflatex -shell-escape -interaction nonstopmode submission.tex &>> release.log |
101 | 123 |
|
102 | 124 | echo |
103 | 125 | echo "Finished. Please check test_release/submission.pdf for correctness." |
|
0 commit comments