-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmdgEntriesSVGit2.sh
executable file
·60 lines (56 loc) · 1.91 KB
/
mdgEntriesSVGit2.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: mdgEntriesSVGit2.sh
#
# USAGE: mdgEntriesSVGit2.sh [/path/to/listOfSVGFiles]
#
# DESCRIPTION: Used for generating needed LaTeX codes for inclusion of SVGs into LaTeX
#
# AUTHOR: J.L.A. Uro ([email protected])
# VERSION: 1.0.1
# LICENSE: Creative Commons Attribution 4.0 International License (CC-BY)
# CREATED: 2017.09.08 15:58:16 +08
# REVISION: 2024/07/16 11:43:31
#==================================================================================
#----------------------------------------------------------------------------------
# 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 --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/gfmt-/}
catToFile "\addcontentsline{toc}{subsection}{$ifileB}
\begin{figure}[H]
\centering
\def\svgwidth{\columnwidth}
\input{${ifile/.svg}.pdf_tex}
\end{figure}
\nopagebreak[4]
\vspace{-0.15in}
{\scriptsize For audio (midi): \hyperref{./${ifile/.svg/}.mid}{}{}{${ifile/.svg/}.mid}}
"
done < $svgfiles
###
##
#