-
Notifications
You must be signed in to change notification settings - Fork 1
/
latex_tmp_gen.sh
executable file
·47 lines (33 loc) · 1.4 KB
/
latex_tmp_gen.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
#!/bin/bash
echo "################################################"
echo "# LaTeX Template Generator Script #"
echo "# Author: Yu-Chen(Abner), Den #"
echo "################################################"
read -p "Enter the file path for the new LaTeX file: " file_path
echo "Selected file path: $file_path"
mkdir -p "$file_path"
preamble_path="${file_path}/preamble"
mkdir -p "$preamble_path"
echo "Preamble folder created: $preamble_path"
echo "Adding preamble files..."
cp "preamble/code_preamble.tex" "$preamble_path"
cp "preamble/general_preamble.tex" "$preamble_path"
echo "Preamble files copied to: $preamble_path"
read -p "Enter the name for the new LaTeX file: " file_name
tex_file="$file_path/$file_name.tex"
echo "start writing template contents..."
echo "\\documentclass[a4paper, 12pt]{article}" > "$tex_file"
echo "\\input{preamble/code_preamble}" >> "$tex_file"
echo "\\input{preamble/general_preamble}" >> "$tex_file"
echo "\\title{My LaTeX Template}" >> "$tex_file"
echo "\\author{Your Name}" >> "$tex_file"
echo "\\date{\\today}" >> "$tex_file"
echo "" >> "$tex_file"
echo "\\begin{document}" >> "$tex_file"
echo "" >> "$tex_file"
echo "\\maketitle" >> "$tex_file"
echo "" >> "$tex_file"
echo "This is a simple LaTeX template created with a shell script." >> "$tex_file"
echo "" >> "$tex_file"
echo "\\end{document}" >> "$tex_file"
echo "LaTeX template created: $tex_file"