Skip to content

Instantly share code, notes, and snippets.

@lux01
Created September 5, 2012 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lux01/3634609 to your computer and use it in GitHub Desktop.
Save lux01/3634609 to your computer and use it in GitHub Desktop.
A Windows PowerShell script to ease the process of generating LaTeX enabled gnuplot graphs. See http://luxlooks.wordpress.com/epslatex-script/ for more information.
foreach( $i in $args ) {
$figurename = $i
}
$fontface = "times"
$fontsize = "scriptsize"
$outputname = "c$figurename"
$outputtex = "c$figurename.tex"
gnuplot "$figurename"
echo "\documentclass{article}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{mathcomp}
\usepackage{textcomp}
\usepackage{color}
\usepackage{times}
\newcommand{\var}{\mathrm{\Var}}
\begin{document}
\pagestyle{empty}
\begin{figure}
\$fontsize
\input{$figurename}
\end{figure}
\end{document}" | out-file -force -encoding ASCII "$outputtex"
latex "$outputname"
dvips "$outputname.dvi"
ps2eps -f "$outputname.ps"
epstopdf "$outputname.eps"
rm "$outputname.aux"
rm "$outputname.log"
rm "$outputname.tex"
rm "$outputname.dvi"
rm "$outputname.eps"
rm "$outputname.ps"
rm "$figurename.tex"
rm "$figurename.eps"
if (Test-Path "$figurename.pdf")
{
rm "$figurename.pdf"
}
mv "$outputname.pdf" "$figurename.pdf"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment