<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>LaTeX and Miscellaneous</title>
	<atom:link href="http://chenfuture.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://chenfuture.wordpress.com</link>
	<description>Someone's trash, my treasure?</description>
	<lastBuildDate>Fri, 09 Dec 2011 20:16:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='chenfuture.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>LaTeX and Miscellaneous</title>
		<link>http://chenfuture.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://chenfuture.wordpress.com/osd.xml" title="LaTeX and Miscellaneous" />
	<atom:link rel='hub' href='http://chenfuture.wordpress.com/?pushpress=hub'/>
		<item>
		<title>The cases environment in latex</title>
		<link>http://chenfuture.wordpress.com/2011/11/28/the-cases-environment-in-latex/</link>
		<comments>http://chenfuture.wordpress.com/2011/11/28/the-cases-environment-in-latex/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 20:49:33 +0000</pubDate>
		<dc:creator>Jie</dc:creator>
				<category><![CDATA[latex]]></category>

		<guid isPermaLink="false">http://chenfuture.wordpress.com/?p=183</guid>
		<description><![CDATA[The cases environment defined by the amsmath package sets each case to be inline math style. This will look ugly when the formulas in the cases are complicated, such as fractions or integrals. Consider the following sample code: \usepackage{amsmath} \[ f(x)= \begin{cases} \frac{1}{2(x-1)}, &#38; x&#62;1 \\ \frac{\Gamma(x)}{2^{x-1}}, &#38; 0&#60;x&#60;1 \end{cases} \] The result looks like [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chenfuture.wordpress.com&amp;blog=1061854&amp;post=183&amp;subd=chenfuture&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The <code>cases</code> environment defined by the amsmath package sets each case to be inline math style. This will look ugly when the formulas in the cases are complicated, such as fractions or integrals. Consider the following sample code:</p>
<blockquote><p><code>\usepackage{amsmath}<br />
\[<br />
f(x)=<br />
\begin{cases}<br />
\frac{1}{2(x-1)}, &amp; x&gt;1 \\<br />
\frac{\Gamma(x)}{2^{x-1}}, &amp; 0&lt;x&lt;1<br />
\end{cases}<br />
\]<br />
</code></p></blockquote>
<p>The result looks like this:</p>
<p><a href="http://chenfuture.files.wordpress.com/2011/11/cases.png"><img class="aligncenter size-full wp-image-192" title="cases" src="http://chenfuture.files.wordpress.com/2011/11/cases.png?w=500" alt=""   /></a></p>
<p>The solution is to use the <code>dcases</code> environment provided by the mathtools package instead. The prefix `d&#8217; means `display&#8217;. It will set the cases in displayed math style (exactly the same as <code>\frac</code> versus <code>\dfrac</code>). So if we write the following code</p>
<blockquote><p><code>\usepackage{amsmath,<span style="color:#ff0000;">mathtools</span>}<br />
\[<br />
f(x)=<br />
\begin{<span style="color:#ff0000;">d</span>cases}<br />
\frac{1}{2(x-1)}, &amp; x&gt;1 \\<br />
\frac{\Gamma(x)}{2^{x-1}}, &amp; 0&lt;x&lt;1<br />
\end{<span style="color:#ff0000;">d</span>cases}<br />
\]<br />
</code></p></blockquote>
<p>then we will see the result which looks like this:</p>
<p><a href="http://chenfuture.files.wordpress.com/2011/11/dcases.png"><img class="aligncenter size-full wp-image-193" title="dcases" src="http://chenfuture.files.wordpress.com/2011/11/dcases.png?w=500" alt=""   /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chenfuture.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chenfuture.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chenfuture.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chenfuture.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/chenfuture.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/chenfuture.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/chenfuture.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/chenfuture.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chenfuture.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chenfuture.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chenfuture.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chenfuture.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chenfuture.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chenfuture.wordpress.com/183/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chenfuture.wordpress.com&amp;blog=1061854&amp;post=183&amp;subd=chenfuture&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://chenfuture.wordpress.com/2011/11/28/the-cases-environment-in-latex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e344ab59b489c2fc1bad4c1c2a47484?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jie</media:title>
		</media:content>

		<media:content url="http://chenfuture.files.wordpress.com/2011/11/cases.png" medium="image">
			<media:title type="html">cases</media:title>
		</media:content>

		<media:content url="http://chenfuture.files.wordpress.com/2011/11/dcases.png" medium="image">
			<media:title type="html">dcases</media:title>
		</media:content>
	</item>
		<item>
		<title>Syracuse PSTricks Page</title>
		<link>http://chenfuture.wordpress.com/2011/11/10/syracuse-pstricks-page/</link>
		<comments>http://chenfuture.wordpress.com/2011/11/10/syracuse-pstricks-page/#comments</comments>
		<pubDate>Thu, 10 Nov 2011 19:35:13 +0000</pubDate>
		<dc:creator>Jie</dc:creator>
				<category><![CDATA[latex]]></category>

		<guid isPermaLink="false">http://chenfuture.wordpress.com/?p=180</guid>
		<description><![CDATA[http://melusine.eu.org/syracuse/pstricks/ Many fantastic PSTricks examples.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chenfuture.wordpress.com&amp;blog=1061854&amp;post=180&amp;subd=chenfuture&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://melusine.eu.org/syracuse/pstricks/" title="Syracuse PSTricks Page" target="_blank">http://melusine.eu.org/syracuse/pstricks/</a></p>
<p>Many fantastic PSTricks examples.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chenfuture.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chenfuture.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chenfuture.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chenfuture.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/chenfuture.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/chenfuture.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/chenfuture.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/chenfuture.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chenfuture.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chenfuture.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chenfuture.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chenfuture.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chenfuture.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chenfuture.wordpress.com/180/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chenfuture.wordpress.com&amp;blog=1061854&amp;post=180&amp;subd=chenfuture&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://chenfuture.wordpress.com/2011/11/10/syracuse-pstricks-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e344ab59b489c2fc1bad4c1c2a47484?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jie</media:title>
		</media:content>
	</item>
		<item>
		<title>Bocher’s formula</title>
		<link>http://chenfuture.wordpress.com/2011/04/27/bochner%e2%80%99s-formula/</link>
		<comments>http://chenfuture.wordpress.com/2011/04/27/bochner%e2%80%99s-formula/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 20:29:43 +0000</pubDate>
		<dc:creator>Jie</dc:creator>
				<category><![CDATA[math]]></category>

		<guid isPermaLink="false">http://chenfuture.wordpress.com/?p=151</guid>
		<description><![CDATA[A colleague of mine mentioned to me today the Bocher&#8217;s formula for computing the coefficients of the characteristic polynomial of a matrix. It seems that this formula does not appear too often in textbooks or literature. I&#8217;ll just write down the formula and the idea of a simple proof here. Let the characteristic polynomial of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chenfuture.wordpress.com&amp;blog=1061854&amp;post=151&amp;subd=chenfuture&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A colleague of mine mentioned to me today the Bocher&#8217;s formula for computing the coefficients of the characteristic polynomial of a matrix. It seems that this formula does not appear too often in textbooks or literature. I&#8217;ll just write down the formula and the idea of a simple proof here.</p>
<p>Let the characteristic polynomial of a matrix <img src='http://s0.wp.com/latex.php?latex=A&amp;bg=ffffff&amp;fg=444444&amp;s=0' alt='A' title='A' class='latex' /> be</p>
<p style="text-align:center;"><img src='http://s0.wp.com/latex.php?latex=%5Cdisplaystyle%7Bp%28%5Clambda%29%3D%5Clambda%5En%2Ba_1%5Clambda%5E%7Bn-1%7D%2B%5Ccdots%2Ba_n.%7D&amp;bg=ffffff&amp;fg=444444&amp;s=0' alt='&#92;displaystyle{p(&#92;lambda)=&#92;lambda^n+a_1&#92;lambda^{n-1}+&#92;cdots+a_n.}' title='&#92;displaystyle{p(&#92;lambda)=&#92;lambda^n+a_1&#92;lambda^{n-1}+&#92;cdots+a_n.}' class='latex' /></p>
<p>Then the coefficients can be computed by<br />
<img src='http://s0.wp.com/latex.php?latex=a_1%3D-tr%28A%29%2C&amp;bg=ffffff&amp;fg=444444&amp;s=0' alt='a_1=-tr(A),' title='a_1=-tr(A),' class='latex' /><br />
<img src='http://s0.wp.com/latex.php?latex=a_2%3D-%5Cfrac%7B1%7D%7B2%7D%5Cleft%28a_1tr%28A%29%2Btr%28A%5E2%29%5Cright%29%2C&amp;bg=ffffff&amp;fg=444444&amp;s=0' alt='a_2=-&#92;frac{1}{2}&#92;left(a_1tr(A)+tr(A^2)&#92;right),' title='a_2=-&#92;frac{1}{2}&#92;left(a_1tr(A)+tr(A^2)&#92;right),' class='latex' /><br />
<img src='http://s0.wp.com/latex.php?latex=a_3%3D-%5Cfrac%7B1%7D%7B3%7D%5Cleft%28a_2tr%28A%29%2Ba_1tr%28A%5E2%29%2Btr%28A%5E3%29%5Cright%29%2C&amp;bg=ffffff&amp;fg=444444&amp;s=0' alt='a_3=-&#92;frac{1}{3}&#92;left(a_2tr(A)+a_1tr(A^2)+tr(A^3)&#92;right),' title='a_3=-&#92;frac{1}{3}&#92;left(a_2tr(A)+a_1tr(A^2)+tr(A^3)&#92;right),' class='latex' /><br />
<img src='http://s0.wp.com/latex.php?latex=%5Cvdots&amp;bg=ffffff&amp;fg=444444&amp;s=0' alt='&#92;vdots' title='&#92;vdots' class='latex' /><br />
<img src='http://s0.wp.com/latex.php?latex=a_n%3D-%5Cfrac%7B1%7D%7Bn%7D%5Cleft%28a_%7Bn-1%7Dtr%28A%29%2B%5Ccdots%2Ba_1tr%28A%5E%7Bn-1%7D%29%2Btr%28A%5En%29%5Cright%29.&amp;bg=ffffff&amp;fg=444444&amp;s=0' alt='a_n=-&#92;frac{1}{n}&#92;left(a_{n-1}tr(A)+&#92;cdots+a_1tr(A^{n-1})+tr(A^n)&#92;right).' title='a_n=-&#92;frac{1}{n}&#92;left(a_{n-1}tr(A)+&#92;cdots+a_1tr(A^{n-1})+tr(A^n)&#92;right).' class='latex' /></p>
<p>To prove the formula, note that the coefficient <img src='http://s0.wp.com/latex.php?latex=a_j&amp;bg=ffffff&amp;fg=444444&amp;s=0' alt='a_j' title='a_j' class='latex' /> is the summation of all possible products of j eigenvalues, i.e.,</p>
<p style="text-align:center;"><img src='http://s0.wp.com/latex.php?latex=%5Cdisplaystyle%7Ba_j%3D%28-1%29%5Ej%5Csum_%7B%5C%7Bt_1%5Ccdots+t_j%5C%7D%5Cin+C_n%5Ej%7D%5Clambda_%7Bt_1%7D%5Ccdots%5Clambda_%7Bt_j%7D%2C%7D&amp;bg=ffffff&amp;fg=444444&amp;s=0' alt='&#92;displaystyle{a_j=(-1)^j&#92;sum_{&#92;{t_1&#92;cdots t_j&#92;}&#92;in C_n^j}&#92;lambda_{t_1}&#92;cdots&#92;lambda_{t_j},}' title='&#92;displaystyle{a_j=(-1)^j&#92;sum_{&#92;{t_1&#92;cdots t_j&#92;}&#92;in C_n^j}&#92;lambda_{t_1}&#92;cdots&#92;lambda_{t_j},}' class='latex' /></p>
<p>where <img src='http://s0.wp.com/latex.php?latex=C_n%5Ej&amp;bg=ffffff&amp;fg=444444&amp;s=0' alt='C_n^j' title='C_n^j' class='latex' /> denotes the j-combination of numbers from 1 to n, and the trace of <img src='http://s0.wp.com/latex.php?latex=A%5Ei&amp;bg=ffffff&amp;fg=444444&amp;s=0' alt='A^i' title='A^i' class='latex' /> is the sum of the <img src='http://s0.wp.com/latex.php?latex=j&amp;bg=ffffff&amp;fg=444444&amp;s=0' alt='j' title='j' class='latex' />th power of the eigenvalues, i.e.,</p>
<p style="text-align:center;"><img src='http://s0.wp.com/latex.php?latex=%5Cdisplaystyle%7Btr%28A%5Ei%29%3D%5Csum_%7Bt%3D1%7D%5En%5Clambda_t%5Ei.%7D&amp;bg=ffffff&amp;fg=444444&amp;s=0' alt='&#92;displaystyle{tr(A^i)=&#92;sum_{t=1}^n&#92;lambda_t^i.}' title='&#92;displaystyle{tr(A^i)=&#92;sum_{t=1}^n&#92;lambda_t^i.}' class='latex' /></p>
<p>In addition, we have</p>
<p style="text-align:center;"><img src='http://s0.wp.com/latex.php?latex=%5Cdisplaystyle%7B%5Cleft%28%5Csum_%7B%5C%7Bt_1%5Ccdots+t_j%5C%7D%5Cin+C_n%5Ej%7D%5Clambda_%7Bt_1%7D%5Ccdots%5Clambda_%7Bt_j%7D%5Cright%29%5Cleft%28%5Csum_%7Bt_%7Bj%2B1%7D%3D1%7D%5En%5Clambda_%7Bt_%7Bj%2B1%7D%7D%5Ei%5Cright%29%3D%5Csum_%7B%5C%7Bt_1%5Ccdots+t_%7Bj%2B1%7D%5C%7D%5Cin+C_n%5E%7Bj%2B1%7D%7D%5Clambda_%7Bt_1%7D%5Ccdots%5Clambda_%7Bt_j%7D%5Clambda_%7Bt_%7Bj%2B1%7D%7D%5Ei%2B%5Csum_%7B%5C%7Bt_1%5Ccdots+t_j%5C%7D%5Cin+C_n%5Ej%7D%5Clambda_%7Bt_1%7D%5Ccdots%5Clambda_%7Bt_%7Bj-1%7D%7D%5Clambda_%7Bt_j%7D%5E%7Bi%2B1%7D.%7D&amp;bg=ffffff&amp;fg=444444&amp;s=0' alt='&#92;displaystyle{&#92;left(&#92;sum_{&#92;{t_1&#92;cdots t_j&#92;}&#92;in C_n^j}&#92;lambda_{t_1}&#92;cdots&#92;lambda_{t_j}&#92;right)&#92;left(&#92;sum_{t_{j+1}=1}^n&#92;lambda_{t_{j+1}}^i&#92;right)=&#92;sum_{&#92;{t_1&#92;cdots t_{j+1}&#92;}&#92;in C_n^{j+1}}&#92;lambda_{t_1}&#92;cdots&#92;lambda_{t_j}&#92;lambda_{t_{j+1}}^i+&#92;sum_{&#92;{t_1&#92;cdots t_j&#92;}&#92;in C_n^j}&#92;lambda_{t_1}&#92;cdots&#92;lambda_{t_{j-1}}&#92;lambda_{t_j}^{i+1}.}' title='&#92;displaystyle{&#92;left(&#92;sum_{&#92;{t_1&#92;cdots t_j&#92;}&#92;in C_n^j}&#92;lambda_{t_1}&#92;cdots&#92;lambda_{t_j}&#92;right)&#92;left(&#92;sum_{t_{j+1}=1}^n&#92;lambda_{t_{j+1}}^i&#92;right)=&#92;sum_{&#92;{t_1&#92;cdots t_{j+1}&#92;}&#92;in C_n^{j+1}}&#92;lambda_{t_1}&#92;cdots&#92;lambda_{t_j}&#92;lambda_{t_{j+1}}^i+&#92;sum_{&#92;{t_1&#92;cdots t_j&#92;}&#92;in C_n^j}&#92;lambda_{t_1}&#92;cdots&#92;lambda_{t_{j-1}}&#92;lambda_{t_j}^{i+1}.}' class='latex' /></p>
<p>The above indicates that the first part of <img src='http://s0.wp.com/latex.php?latex=%28-1%29%5Eja_jtr%28A%5Ei%29&amp;bg=ffffff&amp;fg=444444&amp;s=0' alt='(-1)^ja_jtr(A^i)' title='(-1)^ja_jtr(A^i)' class='latex' /> cancels the second part of <img src='http://s0.wp.com/latex.php?latex=%28-1%29%5E%7Bj-1%7Da_%7Bj-1%7Dtr%28A%5E%7Bi%2B1%7D%29&amp;bg=ffffff&amp;fg=444444&amp;s=0' alt='(-1)^{j-1}a_{j-1}tr(A^{i+1})' title='(-1)^{j-1}a_{j-1}tr(A^{i+1})' class='latex' />, whereas the second part of <img src='http://s0.wp.com/latex.php?latex=%28-1%29%5Eja_jtr%28A%5Ei%29&amp;bg=ffffff&amp;fg=444444&amp;s=0' alt='(-1)^ja_jtr(A^i)' title='(-1)^ja_jtr(A^i)' class='latex' /> cancels the first part of <img src='http://s0.wp.com/latex.php?latex=%28-1%29%5E%7Bj%2B1%7Da_%7Bj%2B1%7Dtr%28A%5E%7Bi-1%7D%29.&amp;bg=ffffff&amp;fg=444444&amp;s=0' alt='(-1)^{j+1}a_{j+1}tr(A^{i-1}).' title='(-1)^{j+1}a_{j+1}tr(A^{i-1}).' class='latex' /> The rest of proof becomes obvious now.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chenfuture.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chenfuture.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chenfuture.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chenfuture.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/chenfuture.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/chenfuture.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/chenfuture.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/chenfuture.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chenfuture.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chenfuture.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chenfuture.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chenfuture.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chenfuture.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chenfuture.wordpress.com/151/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chenfuture.wordpress.com&amp;blog=1061854&amp;post=151&amp;subd=chenfuture&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://chenfuture.wordpress.com/2011/04/27/bochner%e2%80%99s-formula/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e344ab59b489c2fc1bad4c1c2a47484?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jie</media:title>
		</media:content>
	</item>
		<item>
		<title>Mess up Matlab codes and outputs in LaTeX</title>
		<link>http://chenfuture.wordpress.com/2011/04/15/mess-up-matlab-codes-and-outputs-in-latex/</link>
		<comments>http://chenfuture.wordpress.com/2011/04/15/mess-up-matlab-codes-and-outputs-in-latex/#comments</comments>
		<pubDate>Fri, 15 Apr 2011 22:03:44 +0000</pubDate>
		<dc:creator>Jie</dc:creator>
				<category><![CDATA[latex]]></category>
		<category><![CDATA[matlab]]></category>

		<guid isPermaLink="false">http://chenfuture.wordpress.com/?p=127</guid>
		<description><![CDATA[You do not want to mess up, right? When writing a LaTeX document, you may once in a while want to include some Matlab codes and/or outputs (preferably typeset using typewriter font if you have the same taste as me) during the course of your writing. What I used to do was to copy and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chenfuture.wordpress.com&amp;blog=1061854&amp;post=127&amp;subd=chenfuture&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You do not want to mess up, right? When writing a LaTeX document, you may once in a while want to include some Matlab codes and/or outputs (preferably typeset using typewriter font if you have the same taste as me) during the course of your writing. What I used to do was to copy and paste the Matlab codes into my LaTeX file, execute the codes in Matlab, then do another copy and paste to place the results in my LaTeX file, and finally decorate them in a verbatim block or something like that. Guess what, Matlab provides a command, called <code>publish</code>, that helps you do all these in a simpler way.</p>
<p>In a nutshell, the way to use <code>publish</code> is to first type in the texts (as your usually LaTeX editing), including Matlab codes, in a single <code>.m</code> file. Let&#8217;s say the file name is <code>example.m</code>. Then, in Matlab, you issue the command</p>
<blockquote><p><code>publish('example.m', struct('format','latex','outputDir','ltx-src'));</code></p></blockquote>
<p>It means that you want Matlab to process <code>example.m</code> and output a LaTeX file <code>example.tex</code> (that you can compile to get pdf) in the sub-directory <code>ltx-src</code>. This is it. Instead of writing <code>example.tex</code>, you write a file <code>example.m</code>.</p>
<p>So, how should I write <code>example.m</code>? It is best to give an example. See the following:</p>
<blockquote><p>
<code>%%<br />
% &lt;latex&gt;<br />
% The eigenvalues of a circulant matrix can be<br />
% obtained by performing FFT on the first column<br />
% of the matrix. First, let us construct a<br />
% $5\times5$ circulant matrix \verb|C| whose first<br />
% column \verb|c| is generated with random input:<br />
% &lt;/latex&gt;<br />
</code></p>
<p><code>c = rand(5,1);<br />
% sad that Matlab does not provide a circulant()<br />
% command...<br />
C = toeplitz(c, c([1 end:-1:2]))</code></p>
<p><code>%%<br />
% &lt;latex&gt;<br />
% The eigenvalues of \verb|C| are nothing but<br />
% &lt;/latex&gt;</code></p>
<p><code>lambda = fft(c)</code></p>
<p><code>%%<br />
% &lt;latex&gt;<br />
% Check it out! The output is the same as using<br />
% the \verb|eig| command:<br />
% &lt;/latex&gt;</code></p>
<p><code>eig(C)</code></p>
<p><code>%%<br />
% Fun, isn't it?<br />
</code></p>
</blockquote>
<p>It is nothing but a script file that Matlab can execute, right? The trick part is that all the texts and LaTeX markups are buried in comment blocks. How the Matlab command <code>publish</code> makes a LaTeX output is that whenever it meets a whole block of comments starting with &#8216;<code>%%</code>&#8216;, it strips the comment signs and decorates the whole block using the pair <code>\begin{par}</code> and <code>\end{par}</code>. On the other hand, whenever it meets a block of codes that does not start with &#8216;<code>%%</code>&#8216;, Matlab knows that they are executable commands. Matlab uses <code>\begin{verbatim}</code> and <code>\end{verbatim}</code> to typeset these command texts, and automatically add the Matlab outputs of the commands, which are also decorated by the <code>\begin{verbatim}</code> and <code>\end{verbatim}</code> pair, in the LaTeX file. Something I am not satisfied is that Matlab does not recognize LaTeX commands such as <code>\verb||</code>. I have to put <code>&lt;latex&gt;&lt;/latex&gt;</code> so that Matlab can do a verbatim copy of <code>\verb||</code>, instead of expand the text <code>\verb||</code> in some weird way, in the output LaTeX file.</p>
<p>It is time to try the above example yourself. Have fun.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chenfuture.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chenfuture.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chenfuture.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chenfuture.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/chenfuture.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/chenfuture.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/chenfuture.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/chenfuture.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chenfuture.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chenfuture.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chenfuture.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chenfuture.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chenfuture.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chenfuture.wordpress.com/127/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chenfuture.wordpress.com&amp;blog=1061854&amp;post=127&amp;subd=chenfuture&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://chenfuture.wordpress.com/2011/04/15/mess-up-matlab-codes-and-outputs-in-latex/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e344ab59b489c2fc1bad4c1c2a47484?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jie</media:title>
		</media:content>
	</item>
		<item>
		<title>Call by value or call by reference?</title>
		<link>http://chenfuture.wordpress.com/2010/12/15/call-by-value-or-call-by-reference/</link>
		<comments>http://chenfuture.wordpress.com/2010/12/15/call-by-value-or-call-by-reference/#comments</comments>
		<pubDate>Wed, 15 Dec 2010 19:30:08 +0000</pubDate>
		<dc:creator>Jie</dc:creator>
				<category><![CDATA[matlab]]></category>

		<guid isPermaLink="false">http://chenfuture.wordpress.com/?p=118</guid>
		<description><![CDATA[In C, if you pass in a pointer to a function, the content of the involved variable may be changed. In Matlab, however, if you pass in an array as an argument, the content of the array will never be changed after the function call, even if the variable with the same name is modified [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chenfuture.wordpress.com&amp;blog=1061854&amp;post=118&amp;subd=chenfuture&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In C, if you pass in a pointer to a function, the content of the involved variable may be changed. In Matlab, however, if you pass in an array as an argument, the content of the array will never be changed after the function call, even if the variable with the same name is modified within the function, unless the variable is also output. Ok, now comes the question: What if the function called by Matlab is written in C as a mex function? Haha, have fun with the following three tests, t1, t2, and t3.</p>
<blockquote><p><code><span style="color:#0000ff;">/* File: t1.c */</span><br />
#include </code></p>
<p><code>void foo(double *a)<br />
{<br />
a[0] = 1;<br />
}</code></p>
<p><code> </code><code>void main(void)<br />
{<br />
double a[2] = {0};<br />
foo(a);<br />
printf("first element of array a = %g\n", a[0]);<br />
}<br />
</code></p></blockquote>
<blockquote><p><code><span style="color:#0000ff;">% File: t2.m</span><br />
function t2()</code></p>
<p><code>a = zeros(2,1);<br />
foo(a);<br />
fprintf(1, 'first element of array a = %g\n', a(1));</code></p>
<p><code>function foo(a)</code></p>
<p><code> </code><code>a(1) = 1;<br />
</code></p></blockquote>
<blockquote><p><code><span style="color:#0000ff;">% File: t3.m</span><br />
function t3()</code></p>
<p><code> </code><code>a = zeros(2,1);<br />
foo_mex(a);<br />
fprintf(1, 'first element of array a = %g\n', a(1));<br />
</code></p></blockquote>
<blockquote><p><code><span style="color:#0000ff;">/* File: foo_mex.c */</span><br />
#include "mex.h"</code></p>
<p><code> </code><code>void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])<br />
{<br />
double *a = mxGetPr(prhs[0]);<br />
a[0] = 1;<br />
}<br />
</code></p></blockquote>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chenfuture.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chenfuture.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chenfuture.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chenfuture.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/chenfuture.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/chenfuture.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/chenfuture.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/chenfuture.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chenfuture.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chenfuture.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chenfuture.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chenfuture.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chenfuture.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chenfuture.wordpress.com/118/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chenfuture.wordpress.com&amp;blog=1061854&amp;post=118&amp;subd=chenfuture&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://chenfuture.wordpress.com/2010/12/15/call-by-value-or-call-by-reference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e344ab59b489c2fc1bad4c1c2a47484?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jie</media:title>
		</media:content>
	</item>
		<item>
		<title>A sample MATLAB code for defining functions with cases</title>
		<link>http://chenfuture.wordpress.com/2010/05/20/a-sample-matlab-code-for-defining-functions-with-cases/</link>
		<comments>http://chenfuture.wordpress.com/2010/05/20/a-sample-matlab-code-for-defining-functions-with-cases/#comments</comments>
		<pubDate>Fri, 21 May 2010 04:48:48 +0000</pubDate>
		<dc:creator>Jie</dc:creator>
				<category><![CDATA[matlab]]></category>

		<guid isPermaLink="false">http://chenfuture.wordpress.com/?p=110</guid>
		<description><![CDATA[The code should be self-explaning.. function y = f(x) y1 = x.* (x&#60;0); y2 = x.^2 .* (x&#62;=0) .* (x&#60;2); y3 = 4 .* (x&#62;=2); y = y1 + y2 + y3;<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chenfuture.wordpress.com&amp;blog=1061854&amp;post=110&amp;subd=chenfuture&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The code should be self-explaning..</p>
<blockquote><p><code>function y = f(x)<br />
y1 = x.* (x&lt;0);<br />
y2 = x.^2 .* (x&gt;=0) .* (x&lt;2);<br />
y3 = 4 .* (x&gt;=2);<br />
y = y1 + y2 + y3;<br />
</code></p></blockquote>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chenfuture.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chenfuture.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chenfuture.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chenfuture.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/chenfuture.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/chenfuture.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/chenfuture.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/chenfuture.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chenfuture.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chenfuture.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chenfuture.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chenfuture.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chenfuture.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chenfuture.wordpress.com/110/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chenfuture.wordpress.com&amp;blog=1061854&amp;post=110&amp;subd=chenfuture&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://chenfuture.wordpress.com/2010/05/20/a-sample-matlab-code-for-defining-functions-with-cases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e344ab59b489c2fc1bad4c1c2a47484?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jie</media:title>
		</media:content>
	</item>
		<item>
		<title>LaTeX Handwritten Symbol Recognition</title>
		<link>http://chenfuture.wordpress.com/2009/10/21/latex-handwritten-symbol-recognition/</link>
		<comments>http://chenfuture.wordpress.com/2009/10/21/latex-handwritten-symbol-recognition/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 23:32:13 +0000</pubDate>
		<dc:creator>Jie</dc:creator>
				<category><![CDATA[web link & blog]]></category>

		<guid isPermaLink="false">http://chenfuture.wordpress.com/?p=105</guid>
		<description><![CDATA[http://detexify.kirelabs.org/classify.html<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chenfuture.wordpress.com&amp;blog=1061854&amp;post=105&amp;subd=chenfuture&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://detexify.kirelabs.org/classify.html">http://detexify.kirelabs.org/classify.html</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chenfuture.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chenfuture.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chenfuture.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chenfuture.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/chenfuture.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/chenfuture.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/chenfuture.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/chenfuture.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chenfuture.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chenfuture.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chenfuture.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chenfuture.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chenfuture.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chenfuture.wordpress.com/105/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chenfuture.wordpress.com&amp;blog=1061854&amp;post=105&amp;subd=chenfuture&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://chenfuture.wordpress.com/2009/10/21/latex-handwritten-symbol-recognition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e344ab59b489c2fc1bad4c1c2a47484?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jie</media:title>
		</media:content>
	</item>
		<item>
		<title>A few old LaTeX posts</title>
		<link>http://chenfuture.wordpress.com/2009/02/07/a-few-old-latex-posts/</link>
		<comments>http://chenfuture.wordpress.com/2009/02/07/a-few-old-latex-posts/#comments</comments>
		<pubDate>Sat, 07 Feb 2009 22:53:02 +0000</pubDate>
		<dc:creator>Jie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chenfuture.wordpress.com/?p=91</guid>
		<description><![CDATA[I decided it would be beneficial to post some articles that I had written and posted elsewhere quite long ago.  This idea came from someone asking me today &#8220;How to change the font of an article from computer modern to sans serif?&#8221; My brain went short for a while, until I realized that I indeed [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chenfuture.wordpress.com&amp;blog=1061854&amp;post=91&amp;subd=chenfuture&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I decided it would be beneficial to post some articles that I had written and posted elsewhere quite long ago.  This idea came from someone asking me today &#8220;How to change the font of an article from computer modern to sans serif?&#8221; My brain went short for a while, until I realized that I indeed had written something about tex fonts previously and maybe the answer was there. It&#8217;s the first time I had recognized how useful these shits were to me.. (Honestly I have to admit that after finishing those posts I regretted wasting time on writing nothing useful at all.) So, anyways, I put some of these posts back in this blog.</p>
<p>PS: The answer to the above question of changing to sans serif fonts is a simply line of code:</p>
<blockquote><p><code>\renewcommand{\rmdefault}{cmss}</code></p></blockquote>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chenfuture.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chenfuture.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chenfuture.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chenfuture.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/chenfuture.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/chenfuture.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/chenfuture.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/chenfuture.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chenfuture.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chenfuture.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chenfuture.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chenfuture.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chenfuture.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chenfuture.wordpress.com/91/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chenfuture.wordpress.com&amp;blog=1061854&amp;post=91&amp;subd=chenfuture&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://chenfuture.wordpress.com/2009/02/07/a-few-old-latex-posts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e344ab59b489c2fc1bad4c1c2a47484?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jie</media:title>
		</media:content>
	</item>
		<item>
		<title>TeX Fonts (III): postscript</title>
		<link>http://chenfuture.wordpress.com/2009/02/07/tex-fonts-iii-postscript/</link>
		<comments>http://chenfuture.wordpress.com/2009/02/07/tex-fonts-iii-postscript/#comments</comments>
		<pubDate>Sat, 07 Feb 2009 22:52:44 +0000</pubDate>
		<dc:creator>Jie</dc:creator>
				<category><![CDATA[latex]]></category>

		<guid isPermaLink="false">http://chenfuture.wordpress.com/?p=85</guid>
		<description><![CDATA[In TeX, a font requires two definition/description files: a metric definition file (.tfm) as introduced in the previous post, and a glyph shape description file (.gf from METAFONT, .pfa/.pfb for printer fonts, etc). The TeX font metric file *.tfm only specifies the dimensions of each character in the font, as well as a list of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chenfuture.wordpress.com&amp;blog=1061854&amp;post=85&amp;subd=chenfuture&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In TeX, a font requires two definition/description files: a <span style="color:#0000ff;"><span class="emph">metric definition file (.tfm)</span></span> as introduced             in the previous post, and a <span style="color:#0000ff;"><span class="emph">glyph shape description file</span> (.gf from METAFONT, .pfa/.pfb for printer             fonts, etc)</span>. The TeX font metric file *.tfm only specifies the dimensions of each character in the             font, as well as a list of kerning and ligature pairs. It does not tell how actually a character             looks like. The shapes of the characters are only described in the glyph file. The output of a TeX             file, *.dvi, merely contains information about a large number of bounding boxes and their relative             positions. Hence, in order to print the document to paper or to screen, a dvi file has to be             interpreted using a dvi driver with glyph definition in mind. dvips is one such             driver. It converts a dvi file to a PostScript file. Yap, or xdvi, or other dvi previewers,             are essentially dvi drivers. They assume glyph information, otherwise they have no way of rendering             the fonts stored in *.dvi.</p>
<p>Indeed, a large part of fonts talked about in this post are no longer TeX fonts. TeX only recognizes             fonts from .tfm files&#8212;bounding boxes and kerning informations. METAFONT can produce glyph files             (.gf), but fonts we commonly used today are Adobe fonts (.afm), TrueType fonts (.ttf), etc. Corresponding             tools are designed to convert these fonts into TeX font metrics, such as afm2tfm, ttf2tfm, recognized             by the latex program, as well as into glyph files (ttf2pk, etc) used by the dvi drivers (dvips, Yap, xdvi, etc). The             relationships are illustrated in the following figure. (I slightly cheat in the figure in that the             Adobe font metric .afm will only be converted to TeX font metric .tfm, but no information is deduced             for glyph file.)</p>
<p style="text-align:center;"><img class="alignnone size-full wp-image-86" title="texfonts" src="http://chenfuture.files.wordpress.com/2009/02/texfonts.jpg?w=500" alt="texfonts"   /></p>
<p>[To be finished..]</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chenfuture.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chenfuture.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chenfuture.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chenfuture.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/chenfuture.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/chenfuture.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/chenfuture.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/chenfuture.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chenfuture.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chenfuture.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chenfuture.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chenfuture.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chenfuture.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chenfuture.wordpress.com/85/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chenfuture.wordpress.com&amp;blog=1061854&amp;post=85&amp;subd=chenfuture&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://chenfuture.wordpress.com/2009/02/07/tex-fonts-iii-postscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e344ab59b489c2fc1bad4c1c2a47484?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jie</media:title>
		</media:content>

		<media:content url="http://chenfuture.files.wordpress.com/2009/02/texfonts.jpg" medium="image">
			<media:title type="html">texfonts</media:title>
		</media:content>
	</item>
		<item>
		<title>TeX Fonts (II): fd, def, and tfm</title>
		<link>http://chenfuture.wordpress.com/2009/02/07/tex-fonts-ii-fd-def-and-tfm/</link>
		<comments>http://chenfuture.wordpress.com/2009/02/07/tex-fonts-ii-fd-def-and-tfm/#comments</comments>
		<pubDate>Sat, 07 Feb 2009 22:52:29 +0000</pubDate>
		<dc:creator>Jie</dc:creator>
				<category><![CDATA[latex]]></category>

		<guid isPermaLink="false">http://chenfuture.wordpress.com/?p=81</guid>
		<description><![CDATA[When we compile a TeX source, such as using &#8220;latex helloworld.tex&#8221;, the latex program searches for the font definition file ‹enc›‹family›.fd according to the font encoding and family specification inside the LaTeX source, loads the encoding definition ‹enc›enc.def, and typesets each individual character by consulting the TeX font metric file ‹family›[‹size›].tfm. These three files are [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chenfuture.wordpress.com&amp;blog=1061854&amp;post=81&amp;subd=chenfuture&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When we compile a TeX source, such as using &#8220;<code>latex helloworld.tex</code>&#8221;, the latex program searches for the font definition file <span style="color:#0000ff;">‹enc›‹family›.fd</span> according to the font encoding and family specification inside the LaTeX source, loads the encoding definition <span style="color:#0000ff;">‹enc›enc.def</span>, and typesets each individual character by consulting the TeX font metric file <span style="color:#0000ff;">‹family›[‹size›].tfm</span>. These three files are key to generating the output dvi file.</p>
<p>The font definition file <span style="color:#0000ff;">‹enc›‹family›.fd</span> simply declares the existence of some font, and provides a pointer to the metric file that the latex program should consult when typesetting the document. For example, in the txfont package, which provides characters in the Adobe Times font for both texts and formulas, there is one file t1txr.fd defining the txr font family using T1 encoding. The second and third commands read:</p>
<blockquote><p><code> \DeclareFontFamily{T1}{txr}{}<br />
\DeclareFontShape{T1}{txr}{m}{n}{t1xr}{}</code></p></blockquote>
<p>It essentially says that a txr font with T1 encoding is defined. Whenever a T1 txr medium normal font is requested, LaTeX should use the t1xr.tfm metric file for all font sizes ( means &#8220;for all sizes&#8221;).</p>
<p>The corresponding encoding definition file <span style="color:#0000ff;">‹enc›enc.def</span> defines the encoding. Let us see an example first to have an idea about what &#8220;encoding&#8221; means. In t1enc.def, there are four lines saying:</p>
<blockquote><p><code> \DeclareFontEncoding{T1}{}{}<br />
\DeclareTextAccent{\'}{T1}{1}<br />
\DeclareTextSymbol{\ae}{T1}{230}<br />
\DeclareTextComposite{\"}{T1}{a}{228}</code></p></blockquote>
<p>The first line declares the existence of T1 encoding. The following lines mean that when this encoding is in effect the <code>\'{x}</code> command should superimpose character 1 (accent acute) over the character x, that <code>\ae</code> should produce character 230 (the æ ligature), and that <code>\"a</code> should produce character 228 (the umlaut ä). It would be much clearer to compare the above three commands with the corresponding ones in OT1 encoding (ot1enc.def):</p>
<blockquote><p><code> \DeclareTextAccent{\'}{OT1}{19}<br />
\DeclareTextSymbol{\ae}{OT1}{26}<br />
(no composite command \"a defined)</code></p></blockquote>
<p>One can see that, under different encodings, the same character has different indices in the character table. The same command can be issued to reference the same character, while it&#8217;s also possible that some characters exist in one encoding but not in the other. The encoding defined in LY1enc.def used by Y&amp;Y TeX systems allows access to all the characters in a standard Adobe roman font.</p>
<p>Finally, the TeX font metric file <span style="color:#0000ff;">‹family›[‹size›].tfm</span> is a binary file that defines width, depth, and height of each character, as well as the kerning pairs and ligature substitutions to be used with the font. LaTeX consults the tfm file to decide where to put characters when typesetting. The tfm file name has an optional [‹size›] field. For example, the cmr family has metric files cmr5.tfm, cmr6.tfm, cmr7.tfm, cmr8.tfm, cmr8.tfm, cmr10.tfm, cmr12.tfm, and cmr17.tfm. Each file fine tunes the size of each character and is used when different font sizes are correspondingly declared.</p>
<p>To summarize, when typesetting the document, latex requires three important files to get the correct encoding and character size information. Latex computes the locations of each character and outputs the dvi file.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chenfuture.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chenfuture.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chenfuture.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chenfuture.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/chenfuture.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/chenfuture.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/chenfuture.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/chenfuture.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chenfuture.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chenfuture.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chenfuture.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chenfuture.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chenfuture.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chenfuture.wordpress.com/81/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chenfuture.wordpress.com&amp;blog=1061854&amp;post=81&amp;subd=chenfuture&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://chenfuture.wordpress.com/2009/02/07/tex-fonts-ii-fd-def-and-tfm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e344ab59b489c2fc1bad4c1c2a47484?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jie</media:title>
		</media:content>
	</item>
	</channel>
</rss>
