-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlatexInit
executable file
·37 lines (26 loc) · 1.07 KB
/
latexInit
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
#!/usr/bin/bash
### script to initialize a LaTeX document ###
## TODO:
## - choose the LaTeX compilation type (pdflatex, latex) and the output
## file type (pdf, ps, dvi), and modify the latexmkrc and ultipack (options
## for graphicx, hyperref and cleveref) files accordingly
## FLAG TO COPY THE TEMPLATE FOR A LATEX DOCUMENT INTO THE PARENT DIRECTORY ##
MAINFLG=0
## DESIRED NAME FOR THE LATEX DOCUMENT (without extension) ##
NAME="document"
##########
# get the name of the current directory
DIR=$(echo "${PWD##*/}")
# create relative symlinks for the gitignore and latexmkrc files
# into the parent directory
ln -s $DIR/latexmkrc ../.latexmkrc
ln -s $DIR/gitignore ../.gitignore
ln -s $DIR/ultipack.tex ../ultipack.tex
ln -s $DIR/mathDefinitions.tex ../mathDefinitions.tex
# only copy the template document if requested
if [ $MAINFLG -eq 1 ]; then
# find and replace current directory name in main.tex (input commands)
sed -i s/input{latex/input{$DIR/g main.tex
# move and rename the template document file into the parent directory
mv main.tex ../$NAME.tex
fi