<?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>Scienco.org &#187; Latex</title>
	<atom:link href="http://www.scienco.org/tag/latex/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scienco.org</link>
	<description>Life&#039;s too short to be unenthusiastic</description>
	<lastBuildDate>Wed, 14 Jul 2010 19:06:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
	<atom:link rel="next" href="http://www.scienco.org/tag/latex/feed/?page=2" />

		<item>
		<title>WatexyML &#8211; Google Wave Robot to convert Latex code to MathML &#8211; almost ready</title>
		<link>http://www.scienco.org/2010/matexy-google-wave-robot-to-convert-latex-code-to-mathml-almost-ready/</link>
		<comments>http://www.scienco.org/2010/matexy-google-wave-robot-to-convert-latex-code-to-mathml-almost-ready/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 07:05:33 +0000</pubDate>
		<dc:creator>Mikkel Meyer Andersen</dc:creator>
				<category><![CDATA[Robots]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Google Wave]]></category>
		<category><![CDATA[Latex]]></category>
		<category><![CDATA[MathML]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Watexy]]></category>
		<category><![CDATA[WatexyML]]></category>

		<guid isPermaLink="false">http://www.scienco.org/?p=245</guid>
		<description><![CDATA[I&#8217;ve been working on a robot just like Watexy, but instead of converting Latex to images, it should convert to MathML-fonts. And I&#8217;m actually quite far with the robot, so I assume that something will be ready within a couple of days (or maybe a week). Stay tuned! Oh &#8211; and I removed the ads [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a robot just like Watexy, but instead of converting Latex to images, it should convert to MathML-fonts. And I&#8217;m actually quite far with the robot, so I assume that something will be ready within a couple of days (or maybe a week). Stay tuned!</p>
<p>Oh &#8211; and I removed the ads on the site. They was indeed annoying! I hope that you will help the development and server expenses by donating a bit if you can afford it. And thanks to those who already donated &#8211; it&#8217;s much appreciated!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scienco.org/2010/matexy-google-wave-robot-to-convert-latex-code-to-mathml-almost-ready/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Watexy version 14 – with both inline and display math mode</title>
		<link>http://www.scienco.org/2009/watexy-version-14-%e2%80%93-with-both-inline-and-display-math-mode/</link>
		<comments>http://www.scienco.org/2009/watexy-version-14-%e2%80%93-with-both-inline-and-display-math-mode/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 23:15:01 +0000</pubDate>
		<dc:creator>Mikkel Meyer Andersen</dc:creator>
				<category><![CDATA[Robots]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Google Wave]]></category>
		<category><![CDATA[Latex]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Watexy]]></category>

		<guid isPermaLink="false">http://www.scienco.org/?p=241</guid>
		<description><![CDATA[Now version 14 of watexy@appspot.com is released. $ $x$ $ makes an inline equation (with the $-signs immediately following each other and not with a space as here). \[ 4 + 5 \] makes an equation in &#8220;display math mode&#8221;, i.e. centred on its own line. Edit by clicking at the equation (the image). There [...]]]></description>
			<content:encoded><![CDATA[<p>Now version 14 of watexy@appspot.com is released.</p>
<p>$ $x$ $ makes an inline equation (with the $-signs immediately following each other and not with a space as here).<br />
\[ 4 + 5 \] makes an equation in &#8220;display math mode&#8221;, i.e. centred on its own line. Edit by clicking at the equation (the image).</p>
<p>There are still a few misbehaviours/new feature suggestions:</p>
<ul>
<li>Inline equations still doesn&#8217;t support &lt; and &gt;</li>
<li>It&#8217;s still not possible to edit the inline equations</li>
<li>Have an align environment so that several equations can be shown underneath each other</li>
<li>The height of the equation in display math mode doesn&#8217;t always adjust automatically, so it may be necessary to either click it to edit and the press cancel or view another wave and go back to the original one</li>
<li>The history of how an equations is changed (editing by clicking on it) is not recorded, so for know it&#8217;s not possible to track changes to a single equations. Yet.</li>
</ul>
<p>I&#8217;m of course still working to fix these things, but it might not be solved until January because I&#8217;m going to travel the rest of the year.</p>
<p>Thanks a lot for your support and all the feedback. Please continue to comment on how the robot is made, bugs, and suggestions! I&#8217;m also on Twitter at <a href="http://twitter.com/mikldk">http://twitter.com/mikldk</a>.</p>
<p>A last request: If you can afford, please donate money to support my work and expenses. You&#8217;ll find the donate-button in the upper right corner of this page. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.scienco.org/2009/watexy-version-14-%e2%80%93-with-both-inline-and-display-math-mode/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>Watexy-test (with edit and working &lt; and &gt;)</title>
		<link>http://www.scienco.org/2009/watexy-test-with-edit-and-working-and/</link>
		<comments>http://www.scienco.org/2009/watexy-test-with-edit-and-working-and/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 01:45:28 +0000</pubDate>
		<dc:creator>Mikkel Meyer Andersen</dc:creator>
				<category><![CDATA[Robots]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Google Wave]]></category>
		<category><![CDATA[Latex]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Watexy]]></category>

		<guid isPermaLink="false">http://www.scienco.org/?p=233</guid>
		<description><![CDATA[I&#8217;m a new version of Watexy with the possibility to edit equations and fixes the bug with &#60; and &#62; not working. The testing-robot is: watexy-test@appspot.com It only works in wave.google.com and not in wavesandbox.com for some reason. I hope you&#8217;ll take the time to give it a try and some feedback to improve it.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a new version of Watexy with the possibility to edit equations and fixes the bug with &lt; and &gt; not working.</p>
<p>The testing-robot is:<br />
watexy-test@appspot.com</p>
<p><span style="text-decoration: line-through;">It only works in wave.google.com and not in wavesandbox.com for some reason.</span></p>
<p>I hope you&#8217;ll take the time to give it a try and some feedback to improve it.</p>
<p><a href="http://www.scienco.org/wp-content/watexy-test.PNG"><img class="aligncenter size-full wp-image-234" title="watexy-test" src="http://www.scienco.org/wp-content/watexy-test.PNG" alt="watexy-test" width="536" height="416" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.scienco.org/2009/watexy-test-with-edit-and-working-and/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Watexy version 12 &#8211; now supporting multiple equations in one blip</title>
		<link>http://www.scienco.org/2009/watexy-version-12-now-supporting-multiple-equations-in-one-blip/</link>
		<comments>http://www.scienco.org/2009/watexy-version-12-now-supporting-multiple-equations-in-one-blip/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 00:00:52 +0000</pubDate>
		<dc:creator>Mikkel Meyer Andersen</dc:creator>
				<category><![CDATA[Robots]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Google Wave]]></category>
		<category><![CDATA[Latex]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Watexy]]></category>

		<guid isPermaLink="false">http://www.scienco.org/?p=231</guid>
		<description><![CDATA[First of all, thanks for the feed-back in [1]. I&#8217;ve now fixed three things: 1) It&#8217;s now possible to put more than one equation in a blip, and they all get nicely/properly displayed, thanks to Michael, post 18 in [1] for a possible solution 2) Instead of using http://www.forkosh.dreamhost.com/mathtex.cgi , I&#8217;ve now installed the program [...]]]></description>
			<content:encoded><![CDATA[<p>First of all, thanks for the feed-back in [1].</p>
<p>I&#8217;ve now fixed three things:<br />
1) It&#8217;s now possible to put more than one equation in a blip, and they all get nicely/properly displayed, thanks to Michael, post 18 in [1] for a possible solution<br />
2) Instead of using http://www.forkosh.dreamhost.com/mathtex.cgi , I&#8217;ve now installed the program on one of my own servers (thanks a lot for both the software and the service)<br />
3) Multi-line is supported, such that the equation can be written over multiple lines and still be matched correctly</p>
<p>Please do not hesitate to comment this version as well!</p>
<p>By the way, I&#8217;m sorry for the delay with this new version. My life as an exchange student in Australia has been a bit hectic with all the travelling besides the studies.</p>
<p>[1]: http://www.scienco.org/2009/watexy-latex-robot-for-google-wave/</p>
<p>The new code is as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># Python reference:</span>
<span style="color: #808080; font-style: italic;"># http://wave-robot-python-client.googlecode.com/svn/trunk/pydocs/index.html</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Shortcut to the important OpBasedDocument</span>
<span style="color: #808080; font-style: italic;"># http://wave-robot-python-client.googlecode.com/svn/trunk/pydocs/waveapi.ops.OpBasedDocument-class.html</span>
&nbsp;
__author__ = <span style="color: #483d8b;">'mikl@mikl.dk (Mikkel Meyer Andersen)'</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">from</span> waveapi <span style="color: #ff7700;font-weight:bold;">import</span> events
<span style="color: #ff7700;font-weight:bold;">from</span> waveapi <span style="color: #ff7700;font-weight:bold;">import</span> model
<span style="color: #ff7700;font-weight:bold;">from</span> waveapi <span style="color: #ff7700;font-weight:bold;">import</span> robot
<span style="color: #ff7700;font-weight:bold;">from</span> waveapi <span style="color: #ff7700;font-weight:bold;">import</span> document
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> OnRobotAdded<span style="color: black;">&#40;</span>properties, context<span style="color: black;">&#41;</span>:
  <span style="color: #483d8b;">&quot;&quot;&quot;Invoked when the robot has been added.&quot;&quot;&quot;</span>
  root_wavelet = context.<span style="color: black;">GetRootWavelet</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
  root_wavelet.<span style="color: black;">CreateBlip</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">GetDocument</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">SetText</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Hi. My name is Watexy and I'm here to help you presenting Latex in waves. Just put the latex between $$ and $$, e.g. $$2+2=5$$.&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> reversed_iterator<span style="color: black;">&#40;</span><span style="color: #008000;">iter</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">reversed</span><span style="color: black;">&#40;</span><span style="color: #008000;">list</span><span style="color: black;">&#40;</span><span style="color: #008000;">iter</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> OnBlipSubmitted<span style="color: black;">&#40;</span>properties, context<span style="color: black;">&#41;</span>:
  <span style="color: #483d8b;">&quot;&quot;&quot;Invoked when a blip has been added.&quot;&quot;&quot;</span>
  blip = context.<span style="color: black;">GetBlipById</span><span style="color: black;">&#40;</span>properties<span style="color: black;">&#91;</span><span style="color: #483d8b;">'blipId'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> 
  blip_text_view = blip.<span style="color: black;">GetDocument</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
  matches = <span style="color: #dc143c;">re</span>.<span style="color: black;">finditer</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\$</span><span style="color: #000099; font-weight: bold;">\$</span>(.+?)<span style="color: #000099; font-weight: bold;">\$</span><span style="color: #000099; font-weight: bold;">\$</span>'</span>, blip_text_view.<span style="color: black;">GetText</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>, <span style="color: #dc143c;">re</span>.<span style="color: black;">DOTALL</span><span style="color: black;">&#41;</span>
&nbsp;
  <span style="color: #483d8b;">&quot;&quot;&quot;
  Reverse list such that the last items will be changed first, such that
  the positions for the first items doesn't change
  &quot;&quot;&quot;</span>
  matches = reversed_iterator<span style="color: black;">&#40;</span>matches<span style="color: black;">&#41;</span>
&nbsp;
  <span style="color: #ff7700;font-weight:bold;">for</span> m <span style="color: #ff7700;font-weight:bold;">in</span> matches:
    <span style="color: #483d8b;">&quot;&quot;&quot;
    The +/- 2 is because of the length of the $$'s. 
    If not removed, the loop will run infintely! 
    &quot;&quot;&quot;</span>
    blip_text_view.<span style="color: black;">DeleteRange</span><span style="color: black;">&#40;</span>document.<span style="color: black;">Range</span><span style="color: black;">&#40;</span>m.<span style="color: black;">start</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>-<span style="color: #ff4500;">2</span>, m.<span style="color: black;">end</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>+<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
    image = document.<span style="color: black;">Image</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'http://meyer.fm/cgi-bin/mathtex.cgi?'</span> + m.<span style="color: black;">group</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>, caption=m.<span style="color: black;">group</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
    blip_text_view.<span style="color: black;">InsertElement</span><span style="color: black;">&#40;</span>m.<span style="color: black;">start</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>-<span style="color: #ff4500;">2</span>, image<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">'__main__'</span>:
  myRobot = robot.<span style="color: black;">Robot</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'watexy'</span>,
      image_url=<span style="color: #483d8b;">'http://watexy.appspot.com/assets/icon.png'</span>,
      version=<span style="color: #483d8b;">'12'</span>,
      profile_url=<span style="color: #483d8b;">'http://watexy.appspot.com/'</span><span style="color: black;">&#41;</span>
  myRobot.<span style="color: black;">RegisterHandler</span><span style="color: black;">&#40;</span>events.<span style="color: black;">WAVELET_SELF_ADDED</span>, OnRobotAdded<span style="color: black;">&#41;</span>
  myRobot.<span style="color: black;">RegisterHandler</span><span style="color: black;">&#40;</span>events.<span style="color: black;">BLIP_SUBMITTED</span>, OnBlipSubmitted<span style="color: black;">&#41;</span>
  myRobot.<span style="color: black;">Run</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.scienco.org/2009/watexy-version-12-now-supporting-multiple-equations-in-one-blip/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Watexy &#8211; Latex robot for Google Wave</title>
		<link>http://www.scienco.org/2009/watexy-latex-robot-for-google-wave/</link>
		<comments>http://www.scienco.org/2009/watexy-latex-robot-for-google-wave/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 00:06:04 +0000</pubDate>
		<dc:creator>Mikkel Meyer Andersen</dc:creator>
				<category><![CDATA[Robots]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Google Wave]]></category>
		<category><![CDATA[Latex]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Watexy]]></category>

		<guid isPermaLink="false">http://www.scienco.org/?p=216</guid>
		<description><![CDATA[I finally got access to a Google Wave sandbox account, making it possible to start experimenting. The first thing I made was a Latex robot. By adding the robot, it&#8217;s possible to write Latex in Waves. Afterwards, simply by putting Latex between two $&#8217;s: $$\lim_{n \to \infty} \frac{1}{n} = 0$$ Watexy then changes the Wave [...]]]></description>
			<content:encoded><![CDATA[<p>I finally got access to a Google Wave sandbox account, making it possible to start experimenting. The first thing I made was a Latex robot. By adding the robot, it&#8217;s possible to write Latex in Waves. Afterwards, simply by putting Latex between two $&#8217;s:</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #8020E0; font-weight: normal;">$$<span style="color: #800000; font-weight: normal;">\lim</span>_<span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">n <span style="color: #800000; font-weight: normal;">\to</span> <span style="color: #800000; font-weight: normal;">\infty</span></span><span style="color: #E02020; ">}</span> <span style="color: #800000; font-weight: normal;">\frac</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">1</span><span style="color: #E02020; ">}{</span><span style="color: #2020C0; font-weight: normal;">n</span><span style="color: #E02020; ">}</span> = 0$</span>$</pre></div></div>

<p>Watexy then changes the Wave and inserts the Latex as an image instead of the text.</p>
<p>You can try it yourself by adding watexy [this-funny-curly-a] appspot.com to your Wave-conversations. <a href="http://www.scienco.org/wp-content/watexy-v009.zip">You can download the source here.</a></p>
<p>There&#8217;s still a quite big bug: It&#8217;s only the first Latex-image that gets substituted correctly. The following gets inserted some positions wrong, and the deletion of the text isn&#8217;t correct neither. But the images itself are correct, only the substitution isn&#8217;t working properly. But I&#8217;m working on that!</p>
<p>The more technical part: the robot is written in Python, hence using the Google Wave Python API. It&#8217;s the first time I&#8217;ve tried that (thought it was a good possibility to learn it). The robot basically works by getting triggered when a new blip is submitted. Then it searches for Latex-code in that and substitutes it with pictures. Although the code is quite simple, it shows some very basic concepts on how to alter/change the contents of Waves on-the-fly (deleting text and inserting images, but it could be other things as well) with robots. The Latex-source-to-image is done by the <a title="http://www.forkosh.dreamhost.com/source_mathtex.html#webservice" href="http://www.forkosh.dreamhost.com/source_mathtex.html#webservice">http://www.forkosh.dreamhost.com/source_mathtex.html#webservice</a> service.</p>
<p>The core Python comprising the robot is this:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># Python reference:</span>
<span style="color: #808080; font-style: italic;"># http://wave-robot-python-client.googlecode.com/svn/trunk/pydocs/index.html</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Shortcut to the important OpBasedDocument</span>
<span style="color: #808080; font-style: italic;"># http://wave-robot-python-client.googlecode.com/svn/trunk/pydocs/waveapi.ops.OpBasedDocument-class.html</span>
&nbsp;
<span style="color: #483d8b;">&quot;&quot;&quot; 
Known bugs:
- From (and including) the second Latex-fragment, the positioning gets wrong
  &gt; Probably the document needs some kind of updatering
  &gt; Even though it's a bit strange since the re matches all the Latex correctly
&quot;&quot;&quot;</span>  
&nbsp;
__author__ = <span style="color: #483d8b;">'mikl@mikl.dk (Mikkel Meyer Andersen)'</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">from</span> waveapi <span style="color: #ff7700;font-weight:bold;">import</span> events
<span style="color: #ff7700;font-weight:bold;">from</span> waveapi <span style="color: #ff7700;font-weight:bold;">import</span> model
<span style="color: #ff7700;font-weight:bold;">from</span> waveapi <span style="color: #ff7700;font-weight:bold;">import</span> robot
<span style="color: #ff7700;font-weight:bold;">from</span> waveapi <span style="color: #ff7700;font-weight:bold;">import</span> document
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> OnRobotAdded<span style="color: black;">&#40;</span>properties, context<span style="color: black;">&#41;</span>:
  <span style="color: #483d8b;">&quot;&quot;&quot;Invoked when the robot has been added.&quot;&quot;&quot;</span>
  root_wavelet = context.<span style="color: black;">GetRootWavelet</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
  root_wavelet.<span style="color: black;">CreateBlip</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">GetDocument</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">SetText</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Hi. My name is Watexy and I'm here to help you presenting Latex in waves. Just put the latex between $$ and $$, e.g. $$2+2=5$$. This robot uses the http://www.forkosh.dreamhost.com/source_mathtex.html#webservice service.&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> OnBlipSubmitted<span style="color: black;">&#40;</span>properties, context<span style="color: black;">&#41;</span>:
  <span style="color: #483d8b;">&quot;&quot;&quot;Invoked when a blip has been added.&quot;&quot;&quot;</span>
  blip = context.<span style="color: black;">GetBlipById</span><span style="color: black;">&#40;</span>properties<span style="color: black;">&#91;</span><span style="color: #483d8b;">'blipId'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> 
  blip_text_view = blip.<span style="color: black;">GetDocument</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
  latex_regex = <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\$</span><span style="color: #000099; font-weight: bold;">\$</span>(.+?)<span style="color: #000099; font-weight: bold;">\$</span><span style="color: #000099; font-weight: bold;">\$</span>'</span><span style="color: black;">&#41;</span>
  m = latex_regex.<span style="color: black;">search</span><span style="color: black;">&#40;</span>blip_text_view.<span style="color: black;">GetText</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
  <span style="color: #483d8b;">&quot;&quot;&quot; 
  Only replace one Latex-fragment at a time, because replaceing one fragment
  changes the text positions in the rest. That's why re.finditer isn't used.  
  &quot;&quot;&quot;</span>
  <span style="color: #ff7700;font-weight:bold;">while</span> m <span style="color: #66cc66;">!</span>= <span style="color: #008000;">None</span>:
    <span style="color: #483d8b;">&quot;&quot;&quot;
    The +/- 2 is because of the length of the $$'s. 
    If not removed, the loop will run infintely! 
    &quot;&quot;&quot;</span>
    blip_text_view.<span style="color: black;">DeleteRange</span><span style="color: black;">&#40;</span>document.<span style="color: black;">Range</span><span style="color: black;">&#40;</span>m.<span style="color: black;">start</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>-<span style="color: #ff4500;">2</span>, m.<span style="color: black;">end</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>+<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
    image = document.<span style="color: black;">Image</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'http://www.forkosh.dreamhost.com/mathtex.cgi?'</span> + m.<span style="color: black;">group</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>, caption=m.<span style="color: black;">group</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
    blip_text_view.<span style="color: black;">InsertElement</span><span style="color: black;">&#40;</span>m.<span style="color: black;">start</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>-<span style="color: #ff4500;">2</span>, image<span style="color: black;">&#41;</span>    
    m = latex_regex.<span style="color: black;">search</span><span style="color: black;">&#40;</span>blip_text_view.<span style="color: black;">GetText</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">'__main__'</span>:
  myRobot = robot.<span style="color: black;">Robot</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'watexy'</span>, 
      image_url=<span style="color: #483d8b;">'http://watexy.appspot.com/assets/icon.png'</span>,
      version=<span style="color: #483d8b;">'9'</span>,
      profile_url=<span style="color: #483d8b;">'http://watexy.appspot.com/'</span><span style="color: black;">&#41;</span>  
  myRobot.<span style="color: black;">RegisterHandler</span><span style="color: black;">&#40;</span>events.<span style="color: black;">WAVELET_SELF_ADDED</span>, OnRobotAdded<span style="color: black;">&#41;</span>
  myRobot.<span style="color: black;">RegisterHandler</span><span style="color: black;">&#40;</span>events.<span style="color: black;">BLIP_SUBMITTED</span>, OnBlipSubmitted<span style="color: black;">&#41;</span>
  myRobot.<span style="color: black;">Run</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.scienco.org/2009/watexy-latex-robot-for-google-wave/feed/</wfw:commentRss>
		<slash:comments>38</slash:comments>
		</item>
	</channel>
</rss>
