-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathcompile_document.sh
More file actions
executable file
·81 lines (48 loc) · 1.22 KB
/
compile_document.sh
File metadata and controls
executable file
·81 lines (48 loc) · 1.22 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
#
# File : compile_document.sh
# Author : Mauricio Villarroel
# Created : Apr 11, 2019
# ____________________________________________________________________________
#
# Copyright (C) 2013-2022 Mauricio Villarroel. All rights reserved.
#
# SPDX-License-Identifer: GPL-2.0-only
# ____________________________________________________________________________
#
show_help() {
cat << EOF
Compile a LaTeX document
Usage:
compile_document.sh file_name
Where:
file_name : The main LaTeX cile to compile
Example:
compile_document.sh sample_4yp_report.tex
The above command will compile the sample 4YP report.
EOF
}
#
# Check command line arguments
#
if [ "$#" -ne 1 ]; then
echo "Illegal number of parameters"
show_help
exit -1
fi
file_name=$1
# Check if the document exists
if [ -e "$file_name" ]; then
file_name=$(basename $1)
else
echo "ERROR: The LaTeX document does not exists: $file_name"
exit -1
fi
# Extract the file name without the extension
document_name=$(echo "$file_name" | cut -f 1 -d '.')
#
# Compile document
#
latexmk -pdflatex=lualatex -pdf $document_name
makeglossaries $document_name
latexmk -pdflatex=lualatex -pdf $document_name