aboutsummaryrefslogtreecommitdiffstats
path: root/model_doc/latex2svg.sh
blob: 76260da70573fd8c44113c21f3d6fcd63980f8c7 (plain)
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
#!/bin/bash

if [ $# -eq 1 ]
then
    :
else
    echo $#
    echo "Usage $0 <base name>"
    exit
fi


# you need gs-common, pstoedit and skencil to
# get this script working
export BASENAME="`basename $1 .tex`";
echo $BASENAME

latex ${BASENAME}.tex

dvips ${BASENAME}.dvi
# Outline fonts
eps2eps -dNOCACHE ${BASENAME}.ps ${BASENAME}2.ps

# Fix bounding box
ps2epsi  ${BASENAME}2.ps  ${BASENAME}.ps
rm ${BASENAME}2.ps

# Convert to Sketch
pstoedit -f sk  ${BASENAME}.ps  ${BASENAME}.sk

# Convert to SVG
skconvert  ${BASENAME}.sk  ${BASENAME}.svg

echo -e return "\"\c" >${BASENAME}.info

cat ${BASENAME}.svg | sed -e ':a;N;$!ba;s/\n//g' -e 's/\"/\\\"/g' >>${BASENAME}.info

echo \"\; >>${BASENAME}.info