-
Notifications
You must be signed in to change notification settings - Fork 0
/
mdgEntriesSVGgg2.sh
executable file
·60 lines (56 loc) · 1.9 KB
/
mdgEntriesSVGgg2.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
60
#!/bin/bash
#===================================================================================
#
# FILE: mdgEntriesSVGgg2.sh
#
# USAGE: mdgEntriesSVGgg2.sh [/path/to/listOfSVGFiles]
#
# DESCRIPTION: Used for generating needed LaTeX codes for inclusion of SVGs into LaTeX
#
# AUTHOR: J.L.A. Uro (justineuro@gmail.com)
# VERSION: 1.0.0
# LICENSE: Creative Commons Attribution 4.0 International License (CC-BY)
# CREATED: 08.23.2024 21:47:49
# REVISION:
#==================================================================================
#----------------------------------------------------------------------------------
# input the list of SVG files; create the output filename, backup previous if exists
#----------------------------------------------------------------------------------
svgfiles=$1
filen=$svgfiles.output
if [ -f $filen ]; then
mv $filen $filen.bak
fi
#----------------------------------------------------------------------------------
# create cat-to-output-file function
#----------------------------------------------------------------------------------
catToFile(){
cat >> $filen << EOT
$1
EOT
}
#----------------------------------------------------------------------------------
# write entries into output file
#----------------------------------------------------------------------------------
i=0
while read ifile;
do
i=`expr $i + 1`
inkscape --export-filename=${ifile/.svg/}.pdf -w 621 -h 450 --export-area-drawing --export-latex $ifile
echo -e "file $i: converted $ifile to \n\t ${ifile/.svg/}.pdf, \n\t ${ifile/.svg/}.pdf_tex"
ifileA=${ifile/.svg/}
ifileB=${ifileA/ggst-/}
catToFile "\addcontentsline{toc}{subsection}{$ifileB}
\begin{figure}[H]
\centering
\def\svgwidth{\columnwidth}
\input{${ifile/.svg}.pdf_tex}
\end{figure}
\nopagebreak[4]
\vspace{-0.30in}
{\footnotesize For audio (midi): \hyperref{./${ifile/.svg/}.mid}{}{}{${ifile/.svg/}.mid}}
"
done < $svgfiles
###
##
#