-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_outputdir.sh
59 lines (46 loc) · 2.58 KB
/
test_outputdir.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
cd /tmp/
rm -r outputdir-test-folder 2>/dev/null
mkdir outputdir-test-folder
cd outputdir-test-folder
mkdir aa
cat > a.tex << 'eof'
\documentclass{article}
\usepackage{outputdir}
\outputdirstopifundefined
\typeout{^^J^^J>>>>>\meaning\outputdir^^J^^J}
\begin{document}
\end{document}
eof
set -x
rm a.fls a.aux aa/a.fls aa/a.aux
pdflatex a.tex </dev/null | grep '>>>>>' | diff --color=always - <(true)
pdflatex -recorder a.tex </dev/null | grep '>>>>>' | diff --color=always - <(echo '>>>>>macro:->/tmp/outputdir-test-folder/')
pdflatex a.tex </dev/null | grep '>>>>>' | diff --color=always - <(echo '>>>>>macro:->/tmp/outputdir-test-folder/') # after one run of recorder, following run can use
pdflatex -output-directory=aa/ a.tex </dev/null | grep '>>>>>' | diff --color=always - <(echo '>>>>>macro:->/tmp/outputdir-test-folder/') # unfortunately this one is [INCORRECT]
pdflatex -shell-escape -output-directory=aa/ a.tex </dev/null | grep '>>>>>' | diff --color=always - <(true) # it successfully determine that something is wrong
rm a.fls a.aux aa/a.fls aa/a.aux
lualatex a.tex </dev/null | grep '>>>>>' | diff --color=always - <(echo '>>>>>macro:->./') # sometimes it's relative, but it's okay
lualatex -output-directory=aa/ a.tex </dev/null | grep '>>>>>' | diff --color=always - <(echo '>>>>>macro:->aa//') # sometimes the / is doubled but it's also okay
lualatex -output-directory=aa a.tex </dev/null | grep '>>>>>' | diff --color=always - <(echo '>>>>>macro:->aa/')
cat > a.tex << 'eof'
\documentclass{article}
\usepackage[default=bb]{outputdir}
\typeout{^^J^^J>>>>>\meaning\outputdir^^J^^J}
\begin{document}
\end{document}
eof
rm a.fls a.aux aa/a.fls aa/a.aux
pdflatex -output-directory=aa/ a.tex </dev/null | grep '>>>>>' | diff --color=always - <(echo '>>>>>macro:->bb') # if suggested should use. In this case cannot determine something is [INCORRECT]
pdflatex -shell-escape -output-directory=aa/ a.tex </dev/null | grep '>>>>>' | diff --color=always - <(echo '>>>>>undefined') # shell-escape can detect something is wrong, but cannot fix it
pdflatex -recorder -shell-escape -output-directory=aa/ a.tex </dev/null | grep '>>>>>' | diff --color=always - <(echo '>>>>>macro:->aa//') # recorder can fix it
# ======== give correct suggestion here
cat > a.tex << 'eof'
\documentclass{article}
\usepackage[default=aa]{outputdir}
\typeout{^^J^^J>>>>>\meaning\outputdir^^J^^J}
\begin{document}
\end{document}
eof
rm a.fls a.aux aa/a.fls aa/a.aux
pdflatex -shell-escape -output-directory=aa/ a.tex </dev/null | grep '>>>>>' | diff --color=always - <(echo '>>>>>macro:->aa') # shell-escape should confirm