[gedit-list] Making an external tool to Metapost compiling



Hello,

I try to make an external tool that compile a metapost file and show the n creates figures in a file name mproof.pdf.
The problem is the variable number of figures ... This code works as far as 6 figures, which is fine normally.

I am very bad in bash stuff. I need some help to improve this tool.

-----------------------------------------------------------
#!/bin/sh
# [Gedit Tool]
# Comment=Mpost
# Name=Mpost
# Shortcut=F12
# Applicability=all
# Input=nothing
# Output=output-panel

xdotool key "ctrl+s"
mpost "$GEDIT_CURRENT_DOCUMENT_NAME"
i="$GEDIT_CURRENT_DOCUMENT_NAME"
j=${i%.*}
if [ -f "$j.6" ]; then 
tex mproof "$j.1" "$j.2" "$j.3" "$j.4" "$j.5" "$j.6"
elif [ -f "$j.5" ];
then 
tex mproof "$j.1" "$j.2" "$j.3" "$j.4" "$j.5"
elif [ -f "$j.4" ]; then 
tex mproof "$j.1" "$j.2" "$j.3" "$j.4"
elif [ -f "$j.3" ]; then 
tex mproof "$j.1" "$j.2" "$j.3"
elif [ -f "$j.2" ]; then 
tex mproof "$j.1" "$j.2"
elif [ -f "$j.2" ]; then 
tex mproof "$j.1" "$j.2"
else 
tex mproof "$j.1"
fi
dvips -ta4 mproof.dvi -o
ps2pdf mproof.ps
evince mproof.pdf&
-----------------------------------------------------------------------------------------

Thank you


--
Denis LE FUR
dlefur gmail com

http://mathsp.tuxfamily.org/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]