User:Mattrix/Graph-O-Matic

Here is a script I botched together for converting GNUPlot files into PNGs. To see its output go to User:Mattrix/Scripts. If you'd like any help using it then please ask on the talk page. Here's some hints:
 * It requires gnuplot, LaTeX (including dvips and a few packages) and ImageMagick.
 * You might like to fiddle with the number after -density on the convert line.


 * 1) !/bin/sh
 * 2) This shell script is Copyright (c) 2005 "Mattrix"
 * 3) < http://en.wikibooks.org/wiki/User:Mattrix/Graph-O-Matic >
 * 4) Permission is hereby granted, free of charge, to any person obtaining
 * 5) a copy of this shell script (the "Software"), to deal in the Software
 * 6) without restriction, including without limitation the rights to use,
 * 7) copy, modify, merge, publish, distribute, sublicense, and/or sell
 * 8) copies of the Software, and to permit persons to whom the Software is
 * 9) furnished to do so, subject to the following conditions:
 * 10) The above copyright notice and this permission notice shall be included
 * 11) in all copies or substantial portions of the Software.
 * 12) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * 13) EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * 14) MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * 15) IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * 16) CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * 17) TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * 18) SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 * 1) IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * 2) CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * 3) TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * 4) SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

cat > ${1}_temp_commands < ${1}_temp_doc.tex < /dev/null || { echo "LaTeX run failed."; exit; } dvips -E ${1}_temp_doc.dvi 2> /dev/null || { echo "dvips run failed."; exit; } convert -density 150 ${1}_temp_doc.ps ${1}.png || { echo "convert run failed."; exit; }
 * 1) LaTeX->dvi2ps->ImageMagick

rm ${1}_temp_*
 * 1) Cleanup

echo "${1}.png produced." echo "If uploading to wikibooks, please copy and paste the ${1} source file and link to User:Mattrix/Graph-O-Matic on the image description page. I also suggest you waive any potential copyrights with the tag."
 * 1) Say some stuff


 * 1) If you want to automatically open the image, uncomment the following line
 * 2) and change the viewer if desired
 * 3) gqview ${1}.png