<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Presented Without Proof &#187; bash</title>
	<atom:link href="http://301south.net/tag/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://301south.net</link>
	<description>(an exercise for the reader)</description>
	<lastBuildDate>Fri, 23 Jul 2010 22:15:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Convert LaTeX figures to stand-alone graphics</title>
		<link>http://301south.net/2009/08/convert-latex-figures-to-stand-alone-graphics/</link>
		<comments>http://301south.net/2009/08/convert-latex-figures-to-stand-alone-graphics/#comments</comments>
		<pubDate>Sun, 16 Aug 2009 00:02:12 +0000</pubDate>
		<dc:creator>brandon</dc:creator>
				<category><![CDATA[null]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[file oriented programming]]></category>
		<category><![CDATA[pstricks]]></category>
		<category><![CDATA[TeX]]></category>

		<guid isPermaLink="false">http://301south.net/?p=88</guid>
		<description><![CDATA[As I am wont to do, I&#8217;ve been frittering away the hours poking and prodding TeX to make beautiful graphics.  This is my way of giving myself the impression of working hard, and actually accomplishing things, though not things that necessarily advance my career.
I&#8217;m quite fond of PSTricks, a LaTeX package which allows the author [...]]]></description>
			<content:encoded><![CDATA[<p>As I am wont to do, I&#8217;ve been frittering away the hours poking and prodding TeX to make beautiful graphics.  This is my way of giving myself the impression of working hard, and actually accomplishing things, though not things that necessarily advance my career.</p>
<p>I&#8217;m quite fond of <a href="http://www.tug.org/PSTricks/main.cgi?file=examples">PSTricks</a>, a LaTeX package which allows the author to make use of PostScript&#8217;s extensive computational and graphical capabilities from within a TeX document.  My project for this week was to come up with a way to give these figures to my advisor, who works exclusively in MS Word.  So what I needed was a way to export TeX figures to graphics files.  Here&#8217;s what I came up with.<br />
<span id="more-88"></span><br />
Essentially, I create a file which includes the <code>\pspicture</code> environment and all the graphics commands, which I call <code>somepicture.fig</code>.  I then <code>\input{somepicture.fig}</code> into my main document when I want the picture to appear.  When I then want to convert the picture into a standalone graphic, I run a script called <code>figuretops.sh</code><a href="http://301south.net/~b/doc/figuretops.sh">(link to file)</a> which performs the conversion by making use of the very neat &#8220;file here&#8221; notation in bash:</p>
<pre>cat &gt;&gt; filename.tex &lt;&lt;EOF
\documentclass{article}
\usepackage{pstricks-add}
\usepackage{calc}

\begin{document}
\thispagestyle{empty}
\color{white}
\fbox{
\color{black}
\input{}
}
\end{document}
EOF</pre>
<p>When I run LaTeX on this file, it gets to the blank <code>\input{}</code> directive and asks the user for the filename.  I solve this by <code>echo</code>ing the filename into the LaTeX invocation in the bash script.  I then clean up temporary files and use</p>
<pre>convert -density 300 somefigure.eps somefigure.png</pre>
<p>to convert the eps image to a 300-DPI image.</p>
<p>Here&#8217;s a <a href="http://301south.net/~b/doc/displacement-annotated.fig">source figure</a>, the <a href="http://301south.net/~b/doc/figuretops.sh">bash script</a>, and an image it produced:</p>
<p style="text-align: center"><a href="http://301south.net/files/2009/08/displacement.png"><img class="size-medium wp-image-89 aligncenter" src="http://301south.net/files/2009/08/displacement-400x195.png" alt="displacement" width="400" height="195" /></a></p>
<p>Here&#8217;s another (naively crafted: <a href="http://301south.net/~b/doc/basic-mfa-model.fig">TeX source</a>) but more interesting figure:</p>
<p style="text-align: center">
<a href="http://301south.net/files/2009/08/basic-mfa-model.png"><img class="aligncenter size-large wp-image-95" src="http://301south.net/files/2009/08/basic-mfa-model-800x417.png" alt="basic-mfa-model" width="560" height="292" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://301south.net/2009/08/convert-latex-figures-to-stand-alone-graphics/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
