<?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>Guy Rutenberg &#187; LaTeX</title>
	<atom:link href="http://www.guyrutenberg.com/tag/latex/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.guyrutenberg.com</link>
	<description>Keeping track of what I do</description>
	<lastBuildDate>Wed, 16 Jun 2010 19:53:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>\lyxframeend Undefined when Using Beamer with Lyx</title>
		<link>http://www.guyrutenberg.com/2009/07/22/lyxframeend-undefined-when-using-beamer-with-lyx/</link>
		<comments>http://www.guyrutenberg.com/2009/07/22/lyxframeend-undefined-when-using-beamer-with-lyx/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 14:40:14 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Beamer]]></category>
		<category><![CDATA[Errors]]></category>
		<category><![CDATA[LyX]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=411</guid>
		<description><![CDATA[I&#8217;m using LyX for the first time with Beamer. Making the title page was smooth. But when I&#8217;ve tried adding a new frame (using BeginFrame) I was confronted with the following error

 \lyxframeend
                 {}\lyxframe{Outline}
The control sequence at the end [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using LyX for the first time with Beamer. Making the title page was smooth. But when I&#8217;ve tried adding a new frame (using BeginFrame) I was confronted with the following error</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"> \lyxframeend
                 {}\lyxframe{Outline}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.</pre></div></div>

<p>After comparing my document to example (working) beamer documents I&#8217;ve found out that you must have an EndFrame command after your last frame.Too bad it wasn&#8217;t documented anywhere I&#8217;ve found as this little thing drove me crazy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2009/07/22/lyxframeend-undefined-when-using-beamer-with-lyx/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Emulating Kav-Mafrid (em-dash) for the David Font</title>
		<link>http://www.guyrutenberg.com/2009/07/11/emulating-kav-mafrid-em-dash-for-the-david-font/</link>
		<comments>http://www.guyrutenberg.com/2009/07/11/emulating-kav-mafrid-em-dash-for-the-david-font/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 06:37:09 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[culmus-latex]]></category>
		<category><![CDATA[Hebrew]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=395</guid>
		<description><![CDATA[The David font that is used in Culmus-LaTeX lacks support of Kav-Mafrid, the ligature that is created by two consecutive dashes, --. Because the regular Hebrew dash, Maqaf, is position near the top of the line, one can&#8217;t use it instead of the Kav-Mafrid and expect a graphically pleasant result (while Kav-Mafrid can replace Maqaf [...]]]></description>
			<content:encoded><![CDATA[<p>The David font that is used in <a href="/culmus-latex">Culmus-LaTeX</a> lacks support of Kav-Mafrid, the ligature that is created by two consecutive dashes, <code>--</code>. Because the regular Hebrew dash, Maqaf, is position near the top of the line, one can&#8217;t use it instead of the Kav-Mafrid and expect a graphically pleasant result (while Kav-Mafrid can replace Maqaf and the text would still look ok). To make things even more problematic, this ligature is supported by Culmus-LaTeX&#8217;s default font, Frank Ruehl, which means one can&#8217;t easily switch fonts without hurting the layout.<br />
<span id="more-395"></span></p>
<p>At first, I&#8217;ve tried to use the English dash and en-dash but result weren&#8217;t satisfactory. Both of them were too light and positioned too low to be used in an Hebrew text written in the Culmus fonts (see screenshot).</p>
<p>So finally, I&#8217;ve decided to write a simple macro to emulate a Kav-Mafrid for the David font.</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\newcommand</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\dd</span></span><span style="color: #E02020; ">}{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\lower</span>0.17em<span style="color: #800000; font-weight: normal;">\hbox</span><span style="color: #E02020; ">{</span>-<span style="color: #800000; font-weight: normal;">\kern</span>-0.13em-</span><span style="color: #E02020; ">}}</span></pre></div></div>

<p>The command works by kerning two Hebrew, Maqaf&#8217;s, together (with a slight overlap to adjust width), and lowering their position to the middle of the line.</p>
<p>In the following screensot the first line features the Frank Ruehl font and it\&#8217;s Maqaf and Kav-Mafrid. The second line featured the david font with a Maqaf and the missing Kav-Mafrid ligature. The third line features the David font with English dash and en-dash. The last line uses David with the regular Maqaf and the <code>\dd{}</code> macro.<br />
<div id="attachment_397" class="wp-caption alignnone" style="width: 208px"><img src="http://www.guyrutenberg.com/wp-content/uploads/2009/07/dash-example.png" alt="Different dash examples" title="dash-example" width="198" height="232" class="size-full wp-image-397" /><p class="wp-caption-text">Different dash examples</p></div></p>
<p>As it can be seen, the <code>\dd{}</code> macro does provide a good alternative for the Kav-Mafrid. However this solution isn&#8217;t perfect. One can improve the macro by detecting if the Kav-Mafrid ligature is present in the current font and if so, use it instead of the kerned one. This would enable one to use the macro and safely switch fonts, knowing he will always get the best Kav-Mafrid possible.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2009/07/11/emulating-kav-mafrid-em-dash-for-the-david-font/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Hyperref to Work with Hebrew (in XeTeX)</title>
		<link>http://www.guyrutenberg.com/2009/06/27/getting-hyperref-to-work-with-hebrew-in-xetex/</link>
		<comments>http://www.guyrutenberg.com/2009/06/27/getting-hyperref-to-work-with-hebrew-in-xetex/#comments</comments>
		<pubDate>Sat, 27 Jun 2009 10:18:54 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[Hebrew]]></category>
		<category><![CDATA[hyperref]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=389</guid>
		<description><![CDATA[The hyperref package is notoriously known to cause problem with RTL text, which unfortunately include Hebrew. In this post I present some preliminary workarounds that enable the user to use the  hyperref package with Hebrew and possibly other RTL languages. The solution requires XeTeX which is available in TeXLive. I had no success, yet, [...]]]></description>
			<content:encoded><![CDATA[<p>The <code>hyperref</code> package is notoriously known to cause problem with RTL text, which unfortunately include Hebrew. In this post I present some preliminary workarounds that enable the user to use the  <code>hyperref</code> package with Hebrew and possibly other RTL languages. The solution requires XeTeX which is available in TeXLive. I had no success, yet, to port the workaround to pdfTeX, which is more popular.<br />
<span id="more-389"></span></p>
<p>The problem is that because TeX doesn&#8217;t store information regarding the direction of text inside the dvi, RTL text is actually stored in reverse. When a link is inserted in such text, the command to start the link ends up after the command to end the link, which is problematic. When trying to compile such document with pdfTex it throws errors like:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">! pdfTeX error (ext4): pdf_link_stack empty, \pdfendlink used without \pdfstart</pre></div></div>

<p>On the otherhand XeTeX behaves a little nicer and compiles the document, but the wrong parts of the text are marked as links.</p>
<p>My workaround basically changes the order of the start and end link commands. Thus, in RTL text the commands get reversed and actually end up in the correct order. The workaround doesn&#8217;t support links spanning multiple lines and color links (although link border is supported). Further work needs to be done in order to support links in the table of contents. I could get it to work only in LTR mode (which isn&#8217;t good). You should insert the following code to your preamble in order to enable the workaround.</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\<span style="color: #800000; font-weight: bold;">makeatletter</span></span>
<span style="color: #800000; font-weight: normal;">\<span style="color: #800000; font-weight: bold;">def</span></span><span style="color: #800000; font-weight: normal;">\hyper</span>@link#1#2#3<span style="color: #E02020; ">{</span><span style="color: #2C922C; font-style: italic;">%</span>
  <span style="color: #800000; font-weight: normal;">\if</span>@rl
    <span style="color: #800000; font-weight: normal;">\setLR</span>
      <span style="color: #800000; font-weight: normal;">\begingroup</span>
      <span style="color: #800000; font-weight: normal;">\hyper</span>@linkend
        #3
      <span style="color: #800000; font-weight: normal;">\hyper</span>@linkstart<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;">#2</span><span style="color: #E02020; ">}</span>
    <span style="color: #800000; font-weight: normal;">\setRL</span>
  <span style="color: #800000; font-weight: normal;">\else</span>
    <span style="color: #800000; font-weight: normal;">\hyper</span>@linkstart<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;">#2</span><span style="color: #E02020; ">}</span>
        #3
    <span style="color: #800000; font-weight: normal;">\hyper</span>@linkend
  <span style="color: #800000; font-weight: normal;">\fi</span>
<span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\<span style="color: #800000; font-weight: bold;">makeatother</span></span></pre></div></div>

<p>I&#8217;ll also note that in order to generate correct pdf bookmarks (not in gibberish), you should set <code>unicode=false</code> in the <code>hyperref</code>&#8217;s options.</p>
<p>You can find a working example bellow (and the corresponding PDF output <a href="/wp-content/uploads/2009/06/xetex-hyperref-test.pdf">here</a>).</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\<span style="color: #800000; font-weight: bold;">documentclass</span></span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">article</span><span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\usepackage</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">fontspec</span><span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\usepackage</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">xunicode</span><span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\usepackage</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">bidi</span><span style="color: #E02020; ">}</span>
&nbsp;
<span style="color: #800000; font-weight: normal;">\usepackage</span><span style="color: #E02020; ">[</span><span style="color: #C08020; font-weight: normal;">unicode=false,
 bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
 breaklinks=false,pdfborder=<span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">0 0 1</span><span style="color: #E02020; ">}</span>,backref=false,colorlinks=false</span><span style="color: #E02020; ">]</span>
 <span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">hyperref</span><span style="color: #E02020; ">}</span>
&nbsp;
<span style="color: #800000; font-weight: normal;">\<span style="color: #800000; font-weight: bold;">makeatletter</span></span>
<span style="color: #800000; font-weight: normal;">\<span style="color: #800000; font-weight: bold;">def</span></span><span style="color: #800000; font-weight: normal;">\hyper</span>@link#1#2#3<span style="color: #E02020; ">{</span><span style="color: #2C922C; font-style: italic;">%</span>
  <span style="color: #800000; font-weight: normal;">\if</span>@rl
    <span style="color: #800000; font-weight: normal;">\setLR</span>
      <span style="color: #800000; font-weight: normal;">\begingroup</span>
      <span style="color: #800000; font-weight: normal;">\hyper</span>@linkend
        #3
      <span style="color: #800000; font-weight: normal;">\hyper</span>@linkstart<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;">#2</span><span style="color: #E02020; ">}</span>
    <span style="color: #800000; font-weight: normal;">\setRL</span>
  <span style="color: #800000; font-weight: normal;">\else</span>
    <span style="color: #800000; font-weight: normal;">\hyper</span>@linkstart<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;">#2</span><span style="color: #E02020; ">}</span>
        #3
    <span style="color: #800000; font-weight: normal;">\hyper</span>@linkend
  <span style="color: #800000; font-weight: normal;">\fi</span>
<span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\<span style="color: #800000; font-weight: bold;">makeatother</span></span>
<span style="color: #800000; font-weight: normal;">\setromanfont</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">Times New Roman</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>
<span style="color: #800000; font-weight: normal;">\setRL</span>
<span style="color: #800000; font-weight: normal;">\title</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">בדיקה</span><span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\author</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">גיא רוטנברג</span><span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\date</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\maketitle</span>
<span style="color: #800000; font-weight: normal;">\pagebreak</span><span style="color: #E02020; ">{</span></span><span style="color: #2020C0; font-weight: normal;"><span style="color: #E02020; ">}</span>
&nbsp;
<span style="color: #800000; font-weight: normal;">\section</span><span style="color: #E02020; ">{</span><span style="color: #00008B; font-weight: bold;">סעיף ראשון</span></span><span style="color: #E02020; ">}</span><span style="color: #800000; font-weight: normal;">\<span style="color: #800000; font-weight: bold;">label</span></span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">testlabel</span><span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\subsection</span><span style="color: #E02020; ">{</span><span style="color: #00008B; font-weight: bold;">תת-סעיף ראשון</span><span style="color: #E02020; ">}</span><span style="color: #800000; font-weight: normal;">\<span style="color: #800000; font-weight: bold;">label</span></span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">testlabel2</span><span style="color: #E02020; ">}</span>
&nbsp;
לה לה
&nbsp;
לי לי
&nbsp;
לו לו
&nbsp;
<span style="color: #800000; font-weight: normal;">\pagebreak</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\section</span><span style="color: #E02020; ">{</span><span style="color: #00008B; font-weight: bold;">סעיף שני</span></span><span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\subsection</span><span style="color: #E02020; ">{</span><span style="color: #00008B; font-weight: bold;">תת-סעיף ראשון</span><span style="color: #E02020; ">}</span>
&nbsp;
לה לה
&nbsp;
<span style="color: #800000; font-weight: normal;">\subsection</span><span style="color: #E02020; ">{</span><span style="color: #00008B; font-weight: bold;">תת-סעיף שני</span><span style="color: #E02020; ">}</span>
&nbsp;
לי לי
חלק <span style="color: #800000; font-weight: normal;">\<span style="color: #800000; font-weight: bold;">ref</span></span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">testlabel</span><span style="color: #E02020; ">}</span>
אבגד
<span style="color: #800000; font-weight: normal;">\hyperref</span><span style="color: #E02020; ">[</span><span style="color: #C08020; font-weight: normal;">testlabel2</span><span style="color: #E02020; ">]{</span><span style="color: #2020C0; font-weight: normal;">בדיקה ארוכה</span><span style="color: #E02020; ">}</span>
&nbsp;
<span style="color: #800000; font-weight: normal;">\setLR</span>
This is a test for LTR links. See section <span style="color: #800000; font-weight: normal;">\<span style="color: #800000; font-weight: bold;">ref</span></span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">testlabel</span><span style="color: #E02020; ">}</span> and <span style="color: #800000; font-weight: normal;">\hyperref</span><span style="color: #E02020; ">[</span><span style="color: #C08020; font-weight: normal;">testlabel2</span><span style="color: #E02020; ">]{</span><span style="color: #2020C0; font-weight: normal;">long label</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;">document</span></span><span style="color: #E02020; ">}</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2009/06/27/getting-hyperref-to-work-with-hebrew-in-xetex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Algorithm Float Label for Hebrew Document</title>
		<link>http://www.guyrutenberg.com/2009/06/18/algorithm-float-label-for-hebrew-document/</link>
		<comments>http://www.guyrutenberg.com/2009/06/18/algorithm-float-label-for-hebrew-document/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 16:00:12 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Hebrew]]></category>
		<category><![CDATA[LyX]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=379</guid>
		<description><![CDATA[For a while now I&#8217;ve refrained from using the very nice Algorithm environment for LaTeX papers I wrote in Hebrew due to the way it&#8217;s label was displayed. The English label was displayed in reverse.


For sometime before letting go of the issue, I&#8217;ve tried to correct the direction of the label. It could have been [...]]]></description>
			<content:encoded><![CDATA[<p>For a while now I&#8217;ve refrained from using the very nice Algorithm environment for LaTeX papers I wrote in Hebrew due to the way it&#8217;s label was displayed. The English label was displayed in reverse.</p>
<p><img src="http://www.guyrutenberg.com/wp-content/uploads/2009/06/algorithm-before.png" alt="algorithm-before" title="algorithm-before" width="230" height="150" class="aligncenter size-full wp-image-380" /><br />
<span id="more-379"></span><br />
For sometime before letting go of the issue, I&#8217;ve tried to correct the direction of the label. It could have been fixed by marking the float as English text in LyX (I use it for editing Hebrew papers, as it makes editing multi-lingual texts easy), effectively adding <code>\selectlanguage{english}</code> before the <code>\begin{algorithm}</code> line. However, it resulted in display mess in LyX and some LaTeX errors when compiling (also it seemed LaTeX could complete the first pass).</p>
<p>Today, I&#8217;ve decided to tackle and solve the problem for a new paper I&#8217;m writing. After searching a bit for a way to override the Algorithm environment label, I&#8217;ve found a general way to override a float label in LaTeX:</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\floatname</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">floatname</span><span style="color: #E02020; ">}{</span><span style="color: #2020C0; font-weight: normal;">floatlabel</span><span style="color: #E02020; ">}</span></pre></div></div>

<p>So for our case it would look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\floatname</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">algorithm</span><span style="color: #E02020; ">}{</span><span style="color: #2020C0; font-weight: normal;">אלגוריתם</span><span style="color: #E02020; ">}</span></pre></div></div>

<p>You should put it in your LaTeX preamble (Documents->Settings in LyX). This neatly fixes the problem (see screenshot below).</p>
<p><img src="http://www.guyrutenberg.com/wp-content/uploads/2009/06/algorithm-after.png" alt="algorithm-after" title="algorithm-after" width="303" height="163" class="aligncenter size-full wp-image-381" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2009/06/18/algorithm-float-label-for-hebrew-document/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Drawing Finite Automata and State Machines</title>
		<link>http://www.guyrutenberg.com/2008/11/09/drawing-finite-automata-and-state-machines/</link>
		<comments>http://www.guyrutenberg.com/2008/11/09/drawing-finite-automata-and-state-machines/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 16:05:51 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Graphviz]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=158</guid>
		<description><![CDATA[I had to draw couple of Finite Automata and Turing Machines for some university assignments. Usually I would have done it using Inkscape (as it is my favorite tool for creating figures for my LaTeX documents), but doing it manually is pretty tedious work. Inkscape diagram tool is currently sub par, so everything have to [...]]]></description>
			<content:encoded><![CDATA[<p>I had to draw couple of Finite Automata and Turing Machines for some university assignments. Usually I would have done it using Inkscape (as it is my favorite tool for creating figures for my LaTeX documents), but doing it manually is pretty tedious work. Inkscape diagram tool is currently sub par, so everything have to be done by hand. It&#8217;s OK if you need to draw one State Machine  once in a while, but not suitable for larger quantities. I&#8217;ve also tried using Dia, but it also required lots of manual tweaking and tuning.</p>
<p>To my surprise, <a href="http://www.graphviz.org/">Graphviz</a> (and especially the <code>dot</code> utility) turned out to be the (almost) perfect tool for the job. It lets you describe the graph in a simple text-based way, and it handles the graph layout by himself. This is somewhat like LaTeX but for graphs (you concentrate on content not layout).</p>
<p>My Finite Automata needed no manual tweaking and resulted in a very nice graphs. For more complicated State Machines it&#8217;s sometimes necessary to do some manual tuning. The commands I found most useful to tweak the graph were:</p>
<ul>
<li>Grouping nodes to be in the same level  &#8211; <code>{ rank="same"; "q1"; "q2"; "q3"}</code>. The other options for <code>rank</code> can affect how the group is positioned relative to the other nodes in the graph (<code>source</code>, above all, <code>sink</code> bellow all).</li>
<li>Adding weight to edges &#8211; <code>q1 -&gt; q2 [weight="10"]</code>. This affects the cost of strecting the edge. The higher the weight the straighter the edges will be.</li>
<li> Adding invisible edges &#8211; <code>q1 -&gt; q3 [style="invis"]</code>. This allowed me to control the order of the nodes in the same rank (height).</li>
</ul>
<p>Last but not least Graphivz can generate the graphs in variety for formats including eps, pdf and svg (which allows post-processing with inkscape).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2008/11/09/drawing-finite-automata-and-state-machines/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>LaTeX Error: Command \textquotedbl unavailable in encoding HE8</title>
		<link>http://www.guyrutenberg.com/2008/10/12/latex-error-command-textquotedbl-unavailable-in-encoding-he8/</link>
		<comments>http://www.guyrutenberg.com/2008/10/12/latex-error-command-textquotedbl-unavailable-in-encoding-he8/#comments</comments>
		<pubDate>Sun, 12 Oct 2008 17:08:48 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[Errors]]></category>
		<category><![CDATA[LyX]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=115</guid>
		<description><![CDATA[I was testing today the SVN version of LyX 1.6.0 and 1.5.7. Due to a change in the way the double quotation mark (&#8220;) is handled, adding it to Hebrew text resulted in the following LaTeX error:

LaTeX Error: Command \textquotedbl unavailable in encoding HE8


This could be solved by adding the following line to your LaTeX [...]]]></description>
			<content:encoded><![CDATA[<p>I was testing today the SVN version of <a href="http://www.lyx.org">LyX</a> 1.6.0 and 1.5.7. Due to a change in the way the double quotation mark (&#8220;) is handled, adding it to Hebrew text resulted in the following LaTeX error:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">LaTeX Error: Command \textquotedbl unavailable in encoding HE8</pre></div></div>

<p><span id="more-115"></span></p>
<p>This could be solved by adding the following line to your LaTeX preamble:</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\<span style="color: #800000; font-weight: bold;">let</span></span><span style="color: #800000; font-weight: normal;">\textquotedbl</span>=&quot;</pre></div></div>

<p>This line will define the <code>\textquotedb</code> to be the double quotation mark, and the document will compile look the same as it looked in older versions of LyX.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2008/10/12/latex-error-command-textquotedbl-unavailable-in-encoding-he8/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Equality-at and Relation-at LaTeX Macros.</title>
		<link>http://www.guyrutenberg.com/2008/04/19/equality-at-and-relation-at-latex-macros/</link>
		<comments>http://www.guyrutenberg.com/2008/04/19/equality-at-and-relation-at-latex-macros/#comments</comments>
		<pubDate>Sat, 19 Apr 2008 05:36:30 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[LaTeX]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=51</guid>
		<description><![CDATA[These are two useful LaTeX macros for creating equality-at and (the more general) relation-at signs. These macros depend on the mathtools package. As with all other macros you should add them to you preamble in order to use.
The general macro is the \relat. It takes two arguments, the relation and an expression where the relation [...]]]></description>
			<content:encoded><![CDATA[<p>These are two useful LaTeX macros for creating equality-at and (the more general) relation-at signs. These macros depend on the mathtools package. As with all other macros you should add them to you preamble in order to use.</p>
<p>The general macro is the <code>\relat</code>. It takes two arguments, the relation and an expression where the relation takes place (the &#8220;at&#8221;). The equality-at macro, <code>\eqat</code> is a specific case of <code>\relat</code>. I&#8217;ve created it because it is commonly used and only requires passing the &#8220;at&#8221; argument.<br />
<span id="more-51"></span><br />
Here is the LaTeX code for the macros.</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\newcommand</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\relat</span></span><span style="color: #E02020; ">}[</span><span style="color: #C08020; font-weight: normal;">2</span><span style="color: #E02020; ">]{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\mathrel</span><span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\bigg</span>|_<span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\mathrlap</span><span style="color: #E02020; ">{</span>#2</span><span style="color: #E02020; ">}}</span><span style="color: #800000; font-weight: normal;">\mathrlap</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">#1</span><span style="color: #E02020; ">}</span><span style="color: #800000; font-weight: normal;">\hphantom</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">{</span><span style="color: #2020C0; font-weight: normal;">}_{#2</span><span style="color: #E02020; ">}}}}</span>
<span style="color: #800000; font-weight: normal;">\newcommand</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\eqat</span></span><span style="color: #E02020; ">}[</span><span style="color: #C08020; font-weight: normal;">1</span><span style="color: #E02020; ">]{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\mathrel</span><span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\bigg</span>|_<span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\mathrlap</span><span style="color: #E02020; ">{</span>#1</span><span style="color: #E02020; ">}}</span><span style="color: #800000; font-weight: normal;">\mathrlap</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">=</span><span style="color: #E02020; ">}</span><span style="color: #800000; font-weight: normal;">\hphantom</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">{</span><span style="color: #2020C0; font-weight: normal;">}_{#1</span><span style="color: #E02020; ">}}}}</span></pre></div></div>

<p>This is a basic example of how to use the macros. It should also give you an idea how they look.</p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;">documentclass<span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">article</span><span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\pagestyle</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">empty</span><span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\usepackage</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">mathtools</span><span style="color: #E02020; ">}</span>
&nbsp;
<span style="color: #800000; font-weight: normal;">\newcommand</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\relat</span></span><span style="color: #E02020; ">}[</span><span style="color: #C08020; font-weight: normal;">2</span><span style="color: #E02020; ">]{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\mathrel</span><span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\bigg</span>|_<span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\mathrlap</span><span style="color: #E02020; ">{</span>#2</span><span style="color: #E02020; ">}}</span><span style="color: #800000; font-weight: normal;">\mathrlap</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">#1</span><span style="color: #E02020; ">}</span><span style="color: #800000; font-weight: normal;">\hphantom</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">{</span><span style="color: #2020C0; font-weight: normal;">}_{#2</span><span style="color: #E02020; ">}}}}</span>
<span style="color: #800000; font-weight: normal;">\newcommand</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\eqat</span></span><span style="color: #E02020; ">}[</span><span style="color: #C08020; font-weight: normal;">1</span><span style="color: #E02020; ">]{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\mathrel</span><span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\bigg</span>|_<span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\mathrlap</span><span style="color: #E02020; ">{</span>#1</span><span style="color: #E02020; ">}}</span><span style="color: #800000; font-weight: normal;">\mathrlap</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">=</span><span style="color: #E02020; ">}</span><span style="color: #800000; font-weight: normal;">\hphantom</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">{</span><span style="color: #2020C0; font-weight: normal;">}_{#1</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: #E02020; ">\[</span><span style="color: #C08020; font-weight: normal;">
<span style="color: #800000; font-weight: normal;">\Delta</span>=<span style="color: #800000; font-weight: normal;">\left</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;">array</span></span><span style="color: #E02020; ">}{</span><span style="color: #2020C0; font-weight: normal;">cc</span><span style="color: #E02020; ">}</span> P <span style="color: #E02020; ">&amp;</span> Q<span style="color: #E02020; ">\\</span> f' <span style="color: #E02020; ">&amp;</span> g'<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;">array</span></span><span style="color: #E02020; ">}</span><span style="color: #800000; font-weight: normal;">\right</span></span><span style="color: #E02020; ">]</span>
<span style="color: #800000; font-weight: normal;">\eqat</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\Gamma</span></span><span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\left</span><span style="color: #E02020; ">[</span><span style="color: #C08020; font-weight: normal;"><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;">array</span></span><span style="color: #E02020; ">}{</span><span style="color: #2020C0; font-weight: normal;">cc</span><span style="color: #E02020; ">}</span> -2t <span style="color: #E02020; ">&amp;</span> 4t<span style="color: #E02020; ">\\</span> 1 <span style="color: #E02020; ">&amp;</span> -2<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;">array</span></span><span style="color: #E02020; ">}</span><span style="color: #800000; font-weight: normal;">\right</span></span><span style="color: #E02020; ">]</span>
<span style="color: #E02020; ">\]</span>
<span style="color: #E02020; ">\[</span><span style="color: #C08020; font-weight: normal;">
<span style="color: #800000; font-weight: normal;">\cos</span> x <span style="color: #800000; font-weight: normal;">\relat</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\leq</span></span><span style="color: #E02020; ">}{</span><span style="color: #2020C0; font-weight: normal;">x=<span style="color: #800000; font-weight: normal;">\frac</span><span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\pi</span></span><span style="color: #E02020; ">}{</span><span style="color: #2020C0; font-weight: normal;">3</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;"><span style="color: #800000; font-weight: normal;">\sqrt</span><span style="color: #E02020; ">{</span>@</span><span style="color: #E02020; ">}}{</span><span style="color: #2020C0; font-weight: normal;">2</span><span style="color: #E02020; ">}</span>
<span style="color: #E02020; ">\</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></div></div>

<p>And the output for the example is<br />
<a href='http://www.guyrutenberg.com/wp-content/uploads/2008/04/relat-example.png'><img src="http://www.guyrutenberg.com/wp-content/uploads/2008/04/relat-example.png" alt="" title="relat-example" width="235" height="100" class="alignnone size-full wp-image-53" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2008/04/19/equality-at-and-relation-at-latex-macros/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Notes About Using amsmath split Environment In Hebrew Documents</title>
		<link>http://www.guyrutenberg.com/2008/04/09/notes-about-using-amsmath-split-enviroment-in-hebrew-documents/</link>
		<comments>http://www.guyrutenberg.com/2008/04/09/notes-about-using-amsmath-split-enviroment-in-hebrew-documents/#comments</comments>
		<pubDate>Wed, 09 Apr 2008 04:25:19 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[amsmath]]></category>
		<category><![CDATA[Errors]]></category>
		<category><![CDATA[Hebrew]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/2008/04/09/notes-about-using-amsmath-split-enviroment-in-hebrew-documents/</guid>
		<description><![CDATA[Recently I&#8217;ve worked on a Hebrew document in LaTeX and wanted to use the split environment to typeset some multiline formula. The document which compiled just fine till that point, failed to compile with the following error:

Package amsmath Error: \begin{split} won't work here.


I was using LyX, so I&#8217;ve assumed that it would generate the correct [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve worked on a Hebrew document in LaTeX and wanted to use the split environment to typeset some multiline formula. The document which compiled just fine till that point, failed to compile with the following error:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Package amsmath Error: \begin{split} won't work here.</pre></div></div>

<p><span id="more-49"></span></p>
<p>I was using <a href="http://www.lyx.org/">LyX</a>, so I&#8217;ve assumed that it would generate the correct syntax for this environment. But the error clearly said that the <code>\begin{split}</code> was used wrong. I&#8217;ve went through the <a href="ftp://ftp.ams.org/pub/tex/doc/amsmath/amsldoc.pdf">user&#8217;s guide</a> for the <code>amsmath</code> package and rechecked the syntax. The document has a very handy section that contain common error messages and explanations. I was happy to find out that the error I got was documented there. Unfortunately, the explanation only confirmed that LyX generated the appropriated code for the <code>split</code> environment. </p>
<p>At this point, I&#8217;ve decided to export the document to a LaTeX file and manually tweak it till I find a solution. I&#8217;ve removed everything from the document apart from some Hebrew text and the <code>split</code> formula. I&#8217;ve suspected this error had to do with the Hebrew, as nobody else reported errors using <code>split</code> to the LyX mailing list. I&#8217;ve remembered that someone mentioned to me once that LaTex is very sensitive to the order the packages are added. So I&#8217;ve started to play with the order and moved the <code>\usepackage</code> statements around. When I&#8217;ve put the <code>\usepackage{babel}</code> above the <code>\usepackage{amsmath}</code> the document suddenly compiled fine.</p>
<p>Some further testing showed that in order for the <code>split</code> environment to work properly in an Hebrew document the <code>babel</code> package must be included before <code>amsmath</code> and any other package that depends on it (like <code>mathtools</code>).</p>
<p>Getting things to work back in LyX was a bit more tricky. LyX automatically adds the <code>babel</code> package after the LaTeX preamble, and by default it adds the <code>amsmath</code> when needed, but it does so before the LaTeX preamble. This, as you can see, results in the <code>\usepackage{amsmath}</code> appearing before the <code>\usepackage{babel}</code>. The solution had to override the placements of both statements.</p>
<p>The first step is to go to Document->Settings->Math Options and uncheck both &#8220;Use the AMS math package automatically&#8221; and &#8220;Use the AMS math package&#8221;. This won&#8217;t prevent you from using any to the <code>amsmath</code> package feature if you include it manually (like we will do). The next step is to go to Documents->Settings->LaTeX Preamble, and insert directly at the top of the preamble the following two lines:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">\usepackage{babel}
\usepackage{amsmath}</pre></div></div>

<p>Now the Hebrew document will compile fine even if you use the <code>amsmath</code>&#8217;s <code>split</code> environment. Note that LyX will add <code>\usepackage</code> statement for for <code>babel</code> after the preamble despite the fact you already have one. But don&#8217;t worry, LaTeX will ignore that second statement and no harm will be done.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2008/04/09/notes-about-using-amsmath-split-enviroment-in-hebrew-documents/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Add Explanation to LaTeX Formulas (Equations)</title>
		<link>http://www.guyrutenberg.com/2008/01/04/add-explanations-to-latex-formulas/</link>
		<comments>http://www.guyrutenberg.com/2008/01/04/add-explanations-to-latex-formulas/#comments</comments>
		<pubDate>Fri, 04 Jan 2008 17:28:00 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[LaTeX]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/2008/01/04/add-explanations-to-latex-formulas/</guid>
		<description><![CDATA[When writing a document that contains mathematics, many time the need to add an explanation (e.g. stating the theorem used) is raised. To answer this need I wrote two short LaTeX macros: \explain and \explainup.


\newcommand{\explain}[2]{\underset{\mathclap{\overset{\uparrow}{#2}}}{#1}}
\newcommand{\explainup}[2]{\overset{\mathclap{\underset{\downarrow}{#2}}}{#1}}

This macros add the explanation below and above the formula.
The first argument is the relation (actually it can be anything) that [...]]]></description>
			<content:encoded><![CDATA[<p>When writing a document that contains mathematics, many time the need to add an explanation (e.g. stating the theorem used) is raised. To answer this need I wrote two short LaTeX macros: <code>\explain</code> and <code>\explainup</code>.<br />
<span id="more-35"></span></p>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\newcommand</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\explain</span></span><span style="color: #E02020; ">}[</span><span style="color: #C08020; font-weight: normal;">2</span><span style="color: #E02020; ">]{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\underset</span><span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\mathclap</span><span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\overset</span><span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\uparrow</span></span><span style="color: #E02020; ">}{</span><span style="color: #2020C0; font-weight: normal;">#2</span><span style="color: #E02020; ">}}}{</span><span style="color: #2020C0; font-weight: normal;">#1</span><span style="color: #E02020; ">}}</span>
<span style="color: #800000; font-weight: normal;">\newcommand</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\explainup</span></span><span style="color: #E02020; ">}[</span><span style="color: #C08020; font-weight: normal;">2</span><span style="color: #E02020; ">]{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\overset</span><span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\mathclap</span><span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\underset</span><span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\downarrow</span></span><span style="color: #E02020; ">}{</span><span style="color: #2020C0; font-weight: normal;">#2</span><span style="color: #E02020; ">}}}{</span><span style="color: #2020C0; font-weight: normal;">#1</span><span style="color: #E02020; ">}}</span></pre></div></div>

<p>This macros add the explanation below and above the formula.<br />
The first argument is the relation (actually it can be anything) that needs be explained, for example =. The second argument is the actual explanation. </p>
<p>The macros depend on the <code>mathtools</code> package by</p>
<h4>Example</h4>

<div class="wp_syntax"><div class="code"><pre class="latex" style="font-family:monospace;"><span style="color: #800000; font-weight: normal;">\<span style="color: #800000; font-weight: bold;">documentclass</span></span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">article</span><span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\usepackage</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">mathtools</span><span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\<span style="color: #800000; font-weight: bold;">makeatletter</span></span>
&nbsp;
<span style="color: #800000; font-weight: normal;">\newcommand</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\explain</span></span><span style="color: #E02020; ">}[</span><span style="color: #C08020; font-weight: normal;">2</span><span style="color: #E02020; ">]{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\underset</span><span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\mathclap</span><span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\overset</span><span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\uparrow</span></span><span style="color: #E02020; ">}{</span><span style="color: #2020C0; font-weight: normal;">#2</span><span style="color: #E02020; ">}}}{</span><span style="color: #2020C0; font-weight: normal;">#1</span><span style="color: #E02020; ">}}</span>
<span style="color: #800000; font-weight: normal;">\newcommand</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\explainup</span></span><span style="color: #E02020; ">}[</span><span style="color: #C08020; font-weight: normal;">2</span><span style="color: #E02020; ">]{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\overset</span><span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\mathclap</span><span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\underset</span><span style="color: #E02020; ">{</span><span style="color: #800000; font-weight: normal;">\downarrow</span></span><span style="color: #E02020; ">}{</span><span style="color: #2020C0; font-weight: normal;">#2</span><span style="color: #E02020; ">}}}{</span><span style="color: #2020C0; font-weight: normal;">#1</span><span style="color: #E02020; ">}}</span>
&nbsp;
<span style="color: #800000; font-weight: normal;">\<span style="color: #800000; font-weight: bold;">makeatother</span></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;">document</span></span><span style="color: #E02020; ">}</span>
&nbsp;
<span style="color: #E02020; ">\[</span><span style="color: #C08020; font-weight: normal;">
	U_x<span style="color: #800000; font-weight: normal;">\explain</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">=</span><span style="color: #E02020; ">}{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\textrm</span><span style="color: #E02020; ">{</span>C.-R.</span><span style="color: #E02020; ">}}</span>V_y<span style="color: #800000; font-weight: normal;">\explainup</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #800000; font-weight: normal;">\geq</span></span><span style="color: #E02020; ">}{</span><span style="color: #2020C0; font-weight: normal;">V(x,y)=ye^x</span><span style="color: #E02020; ">}</span>0
<span style="color: #E02020; ">\</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></div></div>

<p>Will result in</p>
<p><a href="http://www.guyrutenberg.com/wp-content/uploads/2007/12/test.png"><img src='http://www.guyrutenberg.com/wp-content/uploads/2007/12/test.thumbnail.png' title='explain-macro.png' alt='explain-macro.png' /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2008/01/04/add-explanations-to-latex-formulas/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Installing IvriTex-1.2.1 on teTex-3.0</title>
		<link>http://www.guyrutenberg.com/2007/02/16/installing-ivritex-121-on-tetex-30/</link>
		<comments>http://www.guyrutenberg.com/2007/02/16/installing-ivritex-121-on-tetex-30/#comments</comments>
		<pubDate>Fri, 16 Feb 2007 11:41:12 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[Hebrew]]></category>
		<category><![CDATA[IvriTex]]></category>

		<guid isPermaLink="false">http://temp.sikumuna.com/2007/02/16/installing-ivritex-121-on-tetex-30/</guid>
		<description><![CDATA[Few days ago I finally decided to install Ivritex-1.2.1 on my system. I&#8217;m running a tetex-3.0. The new version of Ivritex includes some very important improvements and, at least for me, the most important thing is support for the Culmus fonts. tetex-3.0 introduced a major directory change which cause many problem with installing packages which [...]]]></description>
			<content:encoded><![CDATA[<p>Few days ago I finally decided to install Ivritex-1.2.1 on my system. I&#8217;m running a tetex-3.0. The new version of Ivritex includes some very important improvements and, at least for me, the most important thing is support for the <a href="http://culmus.sourceforge.net/">Culmus</a> fonts. tetex-3.0 introduced a major directory change which cause many problem with installing packages which are unaware of the changes. In this post I will try to walk through the installation process.</p>
<p>TEXMF will be the directory of you local TeX tree (usually /usr/share/texmf). Before Begining the installation process make sure you have the Culmus fonts installed. Apparently Culmus is not optional it&#8217;s a requirement. I&#8217;ll assume that your Culmus fonts are installed in /usr/share/fonts/culmus.</p>
<ol>
<li> Download the ivritex-1.2.1 source-code from <a href="https://sourceforge.net/project/showfiles.php?group_id=33341&amp;package_id=25386&amp;release_id=405161">here</a> .</li>
<li> Extract the archive into a temporary directory.</li>
<li>Save the diff file below a file named &#8220;Makefile_patch&#8221; and save it inside ivritex-1.2.1/fonts/culmus .</li>
<li> Apply the patch by going to the ivritex-1.2.1/fonts/culmus directory (under the directory where you extracted the source archive) and executing &#8220;patch Makefile_patch. The patch will alter the places where some file will be installed.</li>
<li>As root execute &#8220;updmap &#8211;enable Map culmus.map&#8221;.</li>
<li>Still as root execute &#8220;mktexlsr&#8221;.</li>
<li>Ivritex 1.2.1 should be installed now.</li>
</ol>

<div class="wp_syntax"><div class="code"><pre class="diff" style="font-family:monospace;">--- Makefile	<span style="">2007</span>-02-<span style="">14</span> <span style="">19</span>:<span style="">59</span>:<span style="">52.000000000</span> +0200
<span style="color: #888822;">+++ Makefilenew	<span style="">2007</span>-02-<span style="">16</span> <span style="">10</span>:<span style="">11</span>:<span style="">07.000000000</span> +0200</span>
<span style="color: #440088;">@@ -<span style="">20</span>,<span style="">8</span> +<span style="">20</span>,<span style="">8</span> @@</span>
 vf_target     = $<span style="">&#40;</span>TEX_ROOT<span style="">&#41;</span>/fonts/vf/culmus
 # this is where ivritex will eventually be:
 tex_target    = $<span style="">&#40;</span>TEX_ROOT<span style="">&#41;</span>/tex/generic/babel
<span style="color: #991111;">-encode_dir    = $<span style="">&#40;</span>TEX_ROOT<span style="">&#41;</span>/dvips/base</span>
<span style="color: #991111;">-dvips_cfg_dir = $<span style="">&#40;</span>TEX_ROOT<span style="">&#41;</span>/dvips/config</span>
<span style="color: #00b000;">+encode_dir    = $<span style="">&#40;</span>TEX_ROOT<span style="">&#41;</span>/fonts/enc/dvips/base</span>
<span style="color: #00b000;">+map_dir       = $<span style="">&#40;</span>TEX_ROOT<span style="">&#41;</span>/fonts/map/</span>
 sysconf       = $<span style="">&#40;</span>DESTDIR<span style="">&#41;</span>/etc
 updmap_dir    = $<span style="">&#40;</span>sysconf<span style="">&#41;</span>/texmf/updmap
 #culmus_target = $<span style="">&#40;</span>PREFIX<span style="">&#41;</span>/fonts/culmus
<span style="color: #440088;">@@ -<span style="">137</span>,<span style="">11</span> +<span style="">137</span>,<span style="">11</span> @@</span>
 	mkdir -p $<span style="">&#40;</span>sysconf<span style="">&#41;</span>/texmf/updmap.d
 	echo &quot;Map culmus.map&quot; &amp;gt;$<span style="">&#40;</span>sysconf<span style="">&#41;</span>/texmf/updmap.d/10culmus.cfg
 else
<span style="color: #991111;">-	mkdir -p $<span style="">&#40;</span>dvips_cfg_dir<span style="">&#41;</span></span>
<span style="color: #991111;">-	cp culmus.map $<span style="">&#40;</span>dvips_cfg_dir<span style="">&#41;</span>/</span>
<span style="color: #00b000;">+	mkdir -p $<span style="">&#40;</span>map_dir<span style="">&#41;</span></span>
<span style="color: #00b000;">+	cp culmus.map $<span style="">&#40;</span>map_dir<span style="">&#41;</span>/</span>
   ifeq <span style="">&#40;</span>$<span style="">&#40;</span>tetex_ver<span style="">&#41;</span>,<span style="">2</span><span style="">&#41;</span>
 	# this should run mktexlsr as well
<span style="color: #991111;">-	$<span style="">&#40;</span>updmap<span style="">&#41;</span> --enable Map $<span style="">&#40;</span>dvips_cfg_dir<span style="">&#41;</span>/culmus.map</span>
<span style="color: #00b000;">+	$<span style="">&#40;</span>updmap<span style="">&#41;</span> --enable Map $<span style="">&#40;</span>map_dir<span style="">&#41;</span>/culmus.map</span>
   else # for tetex-<span style="">1</span>
     ifeq <span style="">&#40;</span>$<span style="">&#40;</span>tetex_ver<span style="">&#41;</span>,<span style="">1</span><span style="">&#41;</span>
 	# TODO: fill in sed line here</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2007/02/16/installing-ivritex-121-on-tetex-30/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

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