-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
51 lines (42 loc) · 1.34 KB
/
build.sh
File metadata and controls
51 lines (42 loc) · 1.34 KB
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
#!/bin/bash
# Create build directory
mkdir -p build
# Function to check if command succeeded
check_success() {
if [ $? -ne 0 ]; then
echo "Error: $1 failed!"
exit 1
fi
}
# First compilation to generate .aux files
echo "First compilation..."
pdflatex -interaction=nonstopmode -output-directory=build main.tex
check_success "First pdflatex run"
# Check if .bib file exists and biber is needed
if [ -f "refs.bib" ]; then
echo "Processing bibliography with biber..."
biber --debug build/main
check_success "Biber run"
# Show biber log for debugging
echo "=== Biber Log ==="
cat build/main.blg | tail -10
# Second compilation to include citations
echo "Second compilation..."
pdflatex -interaction=nonstopmode -output-directory=build main.tex
check_success "Second pdflatex run"
# Third compilation to resolve cross-references and finalize
echo "Third compilation..."
pdflatex -interaction=nonstopmode -output-directory=build main.tex
check_success "Third pdflatex run"
else
echo "Warning: refs.bib not found, skipping bibliography processing"
fi
echo "Build complete!"
# Check if PDF was generated successfully
if [ -f "build/main.pdf" ]; then
xdg-open build/main.pdf
echo "Build again if the pictures do not show up."
else
echo "Error: PDF not generated!"
exit 1
fi