<?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>Inspirated &#187; LaTeX</title>
	<atom:link href="http://inspirated.com/tag/latex/feed" rel="self" type="application/rss+xml" />
	<link>http://inspirated.com</link>
	<description>krkhan&#039;s blog</description>
	<lastBuildDate>Thu, 05 Apr 2012 16:19:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Using overlays for source code listings in LaTeX Beamer</title>
		<link>http://inspirated.com/2010/03/08/using-overlays-for-source-code-listings-in-latex-beamer</link>
		<comments>http://inspirated.com/2010/03/08/using-overlays-for-source-code-listings-in-latex-beamer#comments</comments>
		<pubDate>Mon, 08 Mar 2010 16:33:19 +0000</pubDate>
		<dc:creator>krkhan</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Beamer]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://inspirated.com/?p=271</guid>
		<description><![CDATA[The standard way of including source code listings in Beamer is to use the semiverbatim environment. Needless to say, it does not provide all the syntax highlighting and line-numbering love of the listings package. Combine the two and you have something pretty as well as extremely helpful in delivering presentations which have code: 1 2 [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>The standard way of including source code listings in Beamer is to use the <code>semiverbatim</code> environment. Needless to say, it does not provide all the syntax highlighting and line-numbering love of the <code>listings</code> package. Combine the two and you have something pretty as well as extremely helpful in delivering presentations which have code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
40
41
42
43
44
45
46
47
</pre></td><td class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #E02020; ">\</span><span style="color: #800000;">documentclass</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">beamer</span><span style="color: #E02020; ">}</span>
&nbsp;
<span style="color: #800000; font-weight: normal;">\setbeamercovered</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">transparent</span><span style="color: #E02020; ">}</span>
&nbsp;
<span style="color: #E02020; ">\</span><span style="color: #800000;">usepackage</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">pxfonts</span><span style="color: #E02020; ">}</span>
<span style="color: #E02020; ">\</span><span style="color: #800000;">usepackage</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">listings</span><span style="color: #E02020; ">}</span>
&nbsp;
<span style="color: #C00000; font-weight: normal;">\begin</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">document</span></span><span style="color: #E02020; ">}</span>
&nbsp;
<span style="color: #800000; font-weight: normal;">\lstset</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">language=python,
        numbers=left,
        numberstyle=<span style="color: #800000; font-weight: normal;">\tiny</span>,
        showstringspaces=false,
        aboveskip=-40pt,
        frame=leftline
        </span><span style="color: #E02020; ">}</span>
&nbsp;
<span style="color: #C00000; font-weight: normal;">\begin</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">frame</span></span><span style="color: #E02020; ">}[</span><span style="color: #C08020; font-weight: normal;">fragile</span><span style="color: #E02020; ">]</span>
<span style="color: #800000; font-weight: normal;">\frametitle</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">\<span style="color: #800000;">texttt</span>{parrot.py</span><span style="color: #E02020; ">}}</span>
<span style="color: #C00000; font-weight: normal;">\begin</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">semiverbatim</span></span><span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\pause</span>
<span style="color: #C00000; font-weight: normal;">\begin</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">lstlisting</span></span><span style="color: #E02020; ">}</span>
if __name__ == &quot;__main&quot;:
&nbsp;
<span style="color: #C00000; font-weight: normal;">\end</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">lstlisting</span></span><span style="color: #E02020; ">}</span>
&nbsp;
<span style="color: #800000; font-weight: normal;">\pause</span>
<span style="color: #C00000; font-weight: normal;">\begin</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">lstlisting</span></span><span style="color: #E02020; ">}[</span><span style="color: #C08020; font-weight: normal;">firstnumber=last</span><span style="color: #E02020; ">]</span>
    print &quot;Oh yes, the, uh,
           the Norwegian Blue...&quot;
    print &quot;What's, uh...
           What's wrong with it? &quot;
&nbsp;
<span style="color: #C00000; font-weight: normal;">\end</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">lstlisting</span></span><span style="color: #E02020; ">}</span>
&nbsp;
<span style="color: #800000; font-weight: normal;">\pause</span>
<span style="color: #C00000; font-weight: normal;">\begin</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">lstlisting</span></span><span style="color: #E02020; ">}[</span><span style="color: #C08020; font-weight: normal;">firstnumber=last</span><span style="color: #E02020; ">]</span>
    print &quot;I'll tell you what's wrong with it,
           my lad.&quot;
    print &quot;'E's dead,
           that's what's wrong with it!&quot;
&nbsp;
<span style="color: #C00000; font-weight: normal;">\end</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">lstlisting</span></span><span style="color: #E02020; ">}</span>
<span style="color: #C00000; font-weight: normal;">\end</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">semiverbatim</span></span><span style="color: #E02020; ">}</span>
<span style="color: #C00000; font-weight: normal;">\end</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">frame</span></span><span style="color: #E02020; ">}</span>
&nbsp;
<span style="color: #C00000; font-weight: normal;">\end</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">document</span></span><span style="color: #E02020; ">}</span></pre></td></tr></table></div>

<p style="text-align: center"><img src="http://inspirated.com/uploads/beamer-listings.jpg" alt="Overlayed Listings in Beamer" /></p>
<div class="shr-publisher-271"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><hr />
<p><small><a href="http://inspirated.com/2010/03/08/using-overlays-for-source-code-listings-in-latex-beamer">Permalink</a> |
<a href="http://inspirated.com/2010/03/08/using-overlays-for-source-code-listings-in-latex-beamer#comments">One comment</a>
<br/>
Post tags: <a href="http://inspirated.com/tag/beamer" rel="tag">Beamer</a>, <a href="http://inspirated.com/tag/code" rel="tag">Code</a>, <a href="http://inspirated.com/tag/latex" rel="tag">LaTeX</a>, <a href="http://inspirated.com/tag/technology" rel="tag">Technology</a>, <a href="http://inspirated.com/tag/tutorial" rel="tag">Tutorial</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://inspirated.com/2010/03/08/using-overlays-for-source-code-listings-in-latex-beamer/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Defense</title>
		<link>http://inspirated.com/2010/03/03/the-defense</link>
		<comments>http://inspirated.com/2010/03/03/the-defense#comments</comments>
		<pubDate>Wed, 03 Mar 2010 17:08:43 +0000</pubDate>
		<dc:creator>krkhan</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Beamer]]></category>
		<category><![CDATA[ITTC]]></category>
		<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[Rants]]></category>

		<guid isPermaLink="false">http://inspirated.com/?p=269</guid>
		<description><![CDATA[Continuing the process of presenting my proposal for the graduation project, I was required to do a presentation. Now, I have never really liked PowerPoint and for more reasons than it being a product of Microsoft (I was never really into OpenOffice.org Impress either). In fact, I have never liked doing presentations in the first [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Continuing the process of presenting my <a href="http://inspirated.com/2010/02/16/houston-tranquility-base-here-the-proposal-has-landed">proposal</a> for the graduation project, I was required to do a presentation. Now, I have never really liked PowerPoint and for more reasons than it being a product of Microsoft (I was never really into OpenOffice.org Impress either).</p>
<p>In fact, I have never liked doing presentations in the first place. My preferred means of communicating an idea is through written material or face-to-face discussions. Anyhow, seeing as I <em>had</em> to do a formal presentation, I turned towards the solution that would provide some additional attraction for me: <img src="http://inspirated.com/uploads/latex.jpg" alt="LaTeX" /> <a href="http://latex-beamer.sourceforge.net/">Beamer</a>.</p>
<p>After fiddling around with my <code>.tex</code> for a few hours, I was able to create something which <em>looked</em> <sup>[*]</sup> far more professional, sexier and informative than anything I had ever created using traditional presentation software:</p>
<p style="text-align: center"><a href="http://inspirated.com/uploads/ittc-defense-presentation.pdf">ittc-defense-presentation.pdf<br />
<img src="http://inspirated.com/uploads/ittc-defense-presentation-thumb.jpg" alt="Presentation Screenshot" /></a></p>
<p>To view the presentation you have to open it in &#8220;Slide Show&#8221; mode of your favorite PDF reader. What totally blew me away was the ease with which I could create lovely bibliographic references, mathematical equations and little fun things like navigational bar on top of every page. Perhaps it&#8217;s got to do something with the mindset of a programmer, but I certainly became more productive with Beamer within a couple of hours than I had been throughout my experience with PowerPoint/Impress.</p>
<p style="font-size: x-small"><sup>[*]</sup> Whether they <em>were</em> professional, sexy or informative is a totally different matter and has very little to do with either LaTeX or Beamer.</p>
<div class="shr-publisher-269"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><hr />
<p><small><a href="http://inspirated.com/2010/03/03/the-defense">Permalink</a> |
<a href="http://inspirated.com/2010/03/03/the-defense#comments">2 comments</a>
<br/>
Post tags: <a href="http://inspirated.com/tag/beamer" rel="tag">Beamer</a>, <a href="http://inspirated.com/tag/ittc" rel="tag">ITTC</a>, <a href="http://inspirated.com/tag/latex" rel="tag">LaTeX</a>, <a href="http://inspirated.com/tag/rants" rel="tag">Rants</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://inspirated.com/2010/03/03/the-defense/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>(GUI, Mathematical Equations, Scientific Plotting) = (GTK+, LaTeX, Matplotlib)</title>
		<link>http://inspirated.com/2010/01/06/gui-mathematical-equations-scientific-plotting-gtk-latex-matplotlib</link>
		<comments>http://inspirated.com/2010/01/06/gui-mathematical-equations-scientific-plotting-gtk-latex-matplotlib#comments</comments>
		<pubDate>Wed, 06 Jan 2010 05:16:17 +0000</pubDate>
		<dc:creator>krkhan</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Equation]]></category>
		<category><![CDATA[Flag 42]]></category>
		<category><![CDATA[Graphics]]></category>
		<category><![CDATA[GTK+]]></category>
		<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[Matplotlib]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Plot]]></category>
		<category><![CDATA[PyGTK]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[TeX]]></category>

		<guid isPermaLink="false">http://inspirated.com/?p=259</guid>
		<description><![CDATA[GTK+ needs no introduction. LaTeX is the first thing that pops in anyone&#8217;s mind if mathematical equations&#8217; typesetting is under consideration. Matplotlib &#8212; while not as well-known as the former two &#8212; is the super easy and elegant solution for scientific plotting on *nix platforms. For an application demo, I required all three. Past experience [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>GTK+ needs no introduction. LaTeX is the first thing that pops in anyone&#8217;s mind if mathematical equations&#8217; typesetting is under consideration. Matplotlib &#8212; while not as well-known as the former two &#8212; is the super easy and elegant solution for scientific plotting on *nix platforms.</p>
<p>For an application demo, I required all three. Past experience has taught me that the most straightforward way of &#8220;gluing&#8221; things together is Python. GTK+ therefore = PyGTK. Next up was LaTeX, and a previous solution of mine for <a href="http://inspirated.com/2009/09/10/howto-use-latex-mathematical-expressions-in-pygtk">embedding LaTeX in PyGTK</a> came to the rescue. The final requirement of Matplotlib was fulfilled without any hassle since the library was already written in Python.</p>
<p>The collective result was pretty:</p>
<p style="text-align: center"><a href="http://inspirated.com/uploads/radareq-0.1.tar.gz">radareq-0.1.tar.gz</a></p>
<p style="text-align: center; font-size: x-small"><a href="http://inspirated.com/uploads/gtk-latex-matplotlib.png"><img src="http://inspirated.com/uploads/gtk-latex-matplotlib-thumb.jpg" alt="Screenshot of GTK+ with LaTeX and Matplotlib" width="400" height="316" /></a><br />
(Click on the image for larger version.)</p>
<p>The linked tarball contains the Python scripts for the application. For everything to run smoothly, LaTeX and Matplotlib packages need to be installed on your system. If you encounter any issues running the code, feel free to flame your distribution for the apparent lack of sanity regarding package management.</p>
<div class="shr-publisher-259"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><hr />
<p><small><a href="http://inspirated.com/2010/01/06/gui-mathematical-equations-scientific-plotting-gtk-latex-matplotlib">Permalink</a> |
<a href="http://inspirated.com/2010/01/06/gui-mathematical-equations-scientific-plotting-gtk-latex-matplotlib#comments">2 comments</a>
<br/>
Post tags: <a href="http://inspirated.com/tag/code" rel="tag">Code</a>, <a href="http://inspirated.com/tag/equation" rel="tag">Equation</a>, <a href="http://inspirated.com/tag/flag-42" rel="tag">Flag 42</a>, <a href="http://inspirated.com/tag/graphics" rel="tag">Graphics</a>, <a href="http://inspirated.com/tag/gtk" rel="tag">GTK+</a>, <a href="http://inspirated.com/tag/latex" rel="tag">LaTeX</a>, <a href="http://inspirated.com/tag/matplotlib" rel="tag">Matplotlib</a>, <a href="http://inspirated.com/tag/open-source" rel="tag">Open Source</a>, <a href="http://inspirated.com/tag/plot" rel="tag">Plot</a>, <a href="http://inspirated.com/tag/pygtk" rel="tag">PyGTK</a>, <a href="http://inspirated.com/tag/python" rel="tag">Python</a>, <a href="http://inspirated.com/tag/tex" rel="tag">TeX</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://inspirated.com/2010/01/06/gui-mathematical-equations-scientific-plotting-gtk-latex-matplotlib/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>HOWTO: Use LaTeX mathematical expressions in PyGTK</title>
		<link>http://inspirated.com/2009/09/10/howto-use-latex-mathematical-expressions-in-pygtk</link>
		<comments>http://inspirated.com/2009/09/10/howto-use-latex-mathematical-expressions-in-pygtk#comments</comments>
		<pubDate>Thu, 10 Sep 2009 17:04:19 +0000</pubDate>
		<dc:creator>krkhan</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Equation]]></category>
		<category><![CDATA[Flag 42]]></category>
		<category><![CDATA[Graphics]]></category>
		<category><![CDATA[GTK+]]></category>
		<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PyGTK]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[TeX]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://inspirated.com/?p=243</guid>
		<description><![CDATA[I had never really laid my hands on LaTeX until I required it in one of the helper applications for my graduation project. Unfortunately, the requirement wasn&#8217;t as simple as producing some documents as I had to embed mathematical expressions on the fly in my PyGTK apps. Googling around for the solution, I found GtkMathView [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>I had never really laid my hands on LaTeX until I required it in one of the helper applications for my graduation project. Unfortunately, the requirement wasn&#8217;t as simple as producing some documents as I had to embed mathematical expressions on the fly in my PyGTK apps. Googling around for the solution, I found <a href="http://helm.cs.unibo.it/mml-widget/">GtkMathView</a> which accomplished something similar to this albeit using MathML. However, my luck ran out on me again as the widget lacked Python bindings. The other solution was to generate transparent PNGs on the fly and include them as <code>GtkImage</code>s. This worked rather well, as the final code allowed easy modifications to the generated expressions.</p>
<p>Requirements for the code were:</p>
<ul>
<li><a href="http://www.latex-project.org/">LaTeX</a></li>
<li><a href="http://sourceforge.net/projects/dvipng/">dvipng</a></li>
<li><a href="http://code.google.com/p/latexmath2png/">latexmath2png</a></li>
</ul>
<p>Final results:</p>
<div style="text-align: center"><img src="http://inspirated.com/uploads/gtktex.jpg" alt="LaTeX in PyGTK" /></div>
<p>And the simple code behind it:</p>
<div style="text-align: center"><a href="http://inspirated.com/uploads/gtktex.zip">gtktex.py</a></div>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
40
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span>
<span style="color: #483d8b;">&quot;&quot;&quot;An example demonstrating usage of latexmath2png module for embedding math
equations in PyGTK
&nbsp;
Author: Kamran Riaz Khan &lt;krkhan@inspirated.com&gt;
&quot;&quot;&quot;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> gtk
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
<span style="color: #ff7700;font-weight:bold;">import</span> latexmath2png
&nbsp;
pre = <span style="color: #483d8b;">'gtktex_'</span>
eqs = <span style="color: black;">&#91;</span>
	r<span style="color: #483d8b;">'$<span style="color: #000099; font-weight: bold;">\a</span>lpha_i &gt; <span style="color: #000099; font-weight: bold;">\b</span>eta_i$'</span>,
	r<span style="color: #483d8b;">'$<span style="color: #000099; font-weight: bold;">\s</span>um_{i=0}^<span style="color: #000099; font-weight: bold;">\i</span>nfty x_i$'</span>,
	r<span style="color: #483d8b;">'$<span style="color: #000099; font-weight: bold;">\l</span>eft(<span style="color: #000099; font-weight: bold;">\f</span>rac{5 - <span style="color: #000099; font-weight: bold;">\f</span>rac{1}{x}}{4}<span style="color: #000099; font-weight: bold;">\r</span>ight)$'</span>,
	r<span style="color: #483d8b;">'$s(t) = <span style="color: #000099; font-weight: bold;">\m</span>athcal{A}<span style="color: #000099; font-weight: bold;">\s</span>in(2 <span style="color: #000099; font-weight: bold;">\o</span>mega t)$'</span>,
	r<span style="color: #483d8b;">'$<span style="color: #000099; font-weight: bold;">\s</span>um_{n=1}^<span style="color: #000099; font-weight: bold;">\i</span>nfty<span style="color: #000099; font-weight: bold;">\f</span>rac{-e^{i<span style="color: #000099; font-weight: bold;">\p</span>i}}{2^n}$'</span>
	<span style="color: black;">&#93;</span>
latexmath2png.<span style="color: black;">math2png</span><span style="color: black;">&#40;</span>eqs, <span style="color: #dc143c;">os</span>.<span style="color: black;">getcwd</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>, prefix = pre<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> window_destroy<span style="color: black;">&#40;</span>widget<span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>, <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>eqs<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>:
		<span style="color: #dc143c;">os</span>.<span style="color: black;">unlink</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">getcwd</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>, <span style="color: #483d8b;">'%s%d.png'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>pre, i + <span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
	gtk.<span style="color: black;">main_quit</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
window = gtk.<span style="color: black;">Window</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
window.<span style="color: black;">set_border_width</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">10</span><span style="color: black;">&#41;</span>
window.<span style="color: black;">set_title</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'LaTeX Equations in GTK'</span><span style="color: black;">&#41;</span>
window.<span style="color: black;">connect</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'destroy'</span>, window_destroy<span style="color: black;">&#41;</span>
vbox = gtk.<span style="color: black;">VBox</span><span style="color: black;">&#40;</span>spacing = <span style="color: #ff4500;">10</span><span style="color: black;">&#41;</span>
window.<span style="color: black;">add</span><span style="color: black;">&#40;</span>vbox<span style="color: black;">&#41;</span>
&nbsp;
images = <span style="color: black;">&#91;</span><span style="color: #008000;">None</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">*</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>eqs<span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #008000;">len</span><span style="color: black;">&#40;</span>eqs<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>:
	images<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span> = gtk.<span style="color: black;">image_new_from_file</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'%s%d.png'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>pre, i + <span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
	vbox.<span style="color: black;">pack_start</span><span style="color: black;">&#40;</span>images<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
&nbsp;
window.<span style="color: black;">show_all</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
gtk.<span style="color: black;">main</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<div class="shr-publisher-243"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --><hr />
<p><small><a href="http://inspirated.com/2009/09/10/howto-use-latex-mathematical-expressions-in-pygtk">Permalink</a> |
<a href="http://inspirated.com/2009/09/10/howto-use-latex-mathematical-expressions-in-pygtk#comments">2 comments</a>
<br/>
Post tags: <a href="http://inspirated.com/tag/code" rel="tag">Code</a>, <a href="http://inspirated.com/tag/equation" rel="tag">Equation</a>, <a href="http://inspirated.com/tag/flag-42" rel="tag">Flag 42</a>, <a href="http://inspirated.com/tag/graphics" rel="tag">Graphics</a>, <a href="http://inspirated.com/tag/gtk" rel="tag">GTK+</a>, <a href="http://inspirated.com/tag/latex" rel="tag">LaTeX</a>, <a href="http://inspirated.com/tag/open-source" rel="tag">Open Source</a>, <a href="http://inspirated.com/tag/pygtk" rel="tag">PyGTK</a>, <a href="http://inspirated.com/tag/python" rel="tag">Python</a>, <a href="http://inspirated.com/tag/tex" rel="tag">TeX</a>, <a href="http://inspirated.com/tag/tutorial" rel="tag">Tutorial</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://inspirated.com/2009/09/10/howto-use-latex-mathematical-expressions-in-pygtk/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.689 seconds -->

