<?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>The Endeavour &#187; Typography</title>
	<atom:link href="http://www.johndcook.com/blog/category/typography/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.johndcook.com/blog</link>
	<description>The blog of John D. Cook</description>
	<lastBuildDate>Fri, 10 Feb 2012 23:03:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Gutenberg + Readability</title>
		<link>http://www.johndcook.com/blog/2011/12/18/gutenberg-readability/</link>
		<comments>http://www.johndcook.com/blog/2011/12/18/gutenberg-readability/#comments</comments>
		<pubDate>Sun, 18 Dec 2011 15:28:36 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Typography]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10248</guid>
		<description><![CDATA[Here&#8217;s a very simple idea: Use Project Gutenberg for content and Readability for style.
Project Gutenberg has a large collection of public domain books in digital form. The books are available in several formats, none of which are ideal for reading. Project Gutenberg provides text without much styling in order to make it easier for people [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a very simple idea: Use <a href="http://www.gutenberg.org/">Project Gutenberg</a> for content and <a href="http://www.readability.com/bookmarklets">Readability</a> for style.</p>
<p>Project Gutenberg has a large collection of public domain books in digital form. The books are available in several formats, none of which are ideal for reading. Project Gutenberg provides text without much styling in order to make it easier for people to use the content as they please.</p>
<p>You can go to the HTML version of a book on Gutenberg and use Readability (or <a href="http://www.instapaper.com/">Instapaper</a>) to format it for easier reading. Importing the HTML page to a <a href="http://www.amazon.com/gp/product/B0051VVOB2/ref=as_li_tf_tl?ie=UTF8&amp;tag=theende-20&amp;link_code=as3&amp;camp=211189&amp;creative=373489&amp;creativeASIN=B0051VVOB2">Kindle</a> similarly improves the formatting.</p>
<p style="text-align: center;">***</p>
<p>Has anyone made a style sheet to approximate the look of Readability or Instapaper? I&#8217;d like to use something like that to improve the appearance of the static HTML pages on my site.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2011/12/18/gutenberg-readability/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Readability</title>
		<link>http://www.johndcook.com/blog/2011/11/28/readability/</link>
		<comments>http://www.johndcook.com/blog/2011/11/28/readability/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 14:52:34 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Software development]]></category>
		<category><![CDATA[Typography]]></category>
		<category><![CDATA[Literate programming]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=10071</guid>
		<description><![CDATA[The Readability bookmarklet lets you reformat any web to make it easier to read. It strips out flashing ads and other distractions. It uses black text on a white background, wide margins, a moderate-sized font, etc. I use Readability fairly often. (Instapaper is a similar service. I discuss it at the end of this post.)
Yesterday [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.readability.com/bookmarklets">Readability bookmarklet</a> lets you reformat any web to make it easier to read. It strips out flashing ads and other distractions. It uses black text on a white background, wide margins, a moderate-sized font, etc. I use Readability fairly often. (Instapaper is a similar service. I discuss it at the end of this post.)</p>
<p>Yesterday I used it to reformat an <a href="http://axiom-developer.org/axiom-website/litprog.html">article</a> on literate programming. For some inexplicable reason, the author chose to use a lemon yellow background. It&#8217;s ironic that the article is about making source  code easier to read. The <em>content</em> of the article is easy to read, but the <em>format</em> is not.</p>
<p>Readability to the rescue! Here are before and after screen shots.</p>
<p>Before:</p>
<p style="text-align:center"><img src="http://www.johndcook.com/lemon.png" alt="" width="252" height="228" /></p>
<p>After:</p>
<p style="text-align:center"><img src="http://www.johndcook.com/readability" alt="" width="283" height="213" /></p>
<p>I recommend the article, <a href="http://axiom-developer.org/axiom-website/litprog.html">Example of Literate Programming in HTML</a>, and I also recommend using reformatting the page unless you enjoy reading black text on a yellow background.</p>
<p>Readability did a good job until about half way through the article. The article has C and HTML code examples, and perhaps these confused Readability. (Readability usually handles code samples well. It correctly formats the first few code samples in this article.) The last half of the article renders like source code, and the font gets smaller and smaller.</p>
<p style="text-align:center"><img src="http://www.johndcook.com/readability_fail.png" alt="" width="181" height="161" /></p>
<p>I ran the page through an <a href="http://htmlhelp.com/tools/validator/">HTML validator</a> to see whether some malformed HTML could be the source of the problem. The validator found numerous problems, so perhaps that was the issue.</p>
<p>I haven&#8217;t seen Readability fail like this before. I&#8217;ve been surprised how well it has handled some pages I thought might trip it up.</p>
<p>I ended up saving the article and editing its source, changing the <code>bgcolor</code> value to white. It&#8217;s a nice article on literate programming once you get past the formatting. The best part of the article is the first section, and that much Readability formats correctly.</p>
<p><strong>Instapaper</strong></p>
<p><a href="http://www.instapaper.com/">Instapaper</a> reformats web pages similarly. It produces a narrower column of text, but otherwise the output looks quite similar.</p>
<p>Instapaper did not discover the title of the literate programming article. (The title of the article was not in an <code>&lt;h1&gt;</code> tag as software might expect but was only in a <code>&lt;title&gt;</code> tag in the page header.) However, it did format the entire body of the article correctly.</p>
<p>I find it slightly more convenient to use the Readability bookmarklet than to submit a link to Instapaper. I imagine there are browser plug-ins that make Instapaper just as easy to use, though I haven&#8217;t looked into this because I&#8217;m usually satisfied with Readability.</p>
<p><strong>Related posts</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2008/01/15/literate-programming-and-statistics/">Literate programming and statistics</a><br />
<a href="http://www.johndcook.com/blog/2008/04/07/tricky-code/">Tricky code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2011/11/28/readability/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Draw a symbol, look it up</title>
		<link>http://www.johndcook.com/blog/2011/11/12/unicode-character-recognition/</link>
		<comments>http://www.johndcook.com/blog/2011/11/12/unicode-character-recognition/#comments</comments>
		<pubDate>Sat, 12 Nov 2011 14:18:34 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Typography]]></category>
		<category><![CDATA[Unicode]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=9924</guid>
		<description><![CDATA[LaTeX users may know about Detexify, a web site that lets you draw a character then looks up its TeX command. Now there&#8217;s a new site Shapecatcher that does the same thing for Unicode. According to the site, &#8220;Currently, there are 10,007 Unicode character glyphs in the database.&#8221; It does not yet support Chinese, Japanese, [...]]]></description>
			<content:encoded><![CDATA[<p>LaTeX users may know about <a href="http://detexify.kirelabs.org/classify.html">Detexify</a>, a web site that lets you draw a character then looks up its TeX command. Now there&#8217;s a new site <a href="http://shapecatcher.com/index.html">Shapecatcher</a> that does the same thing for Unicode. According to the site, &#8220;Currently, there are 10,007 Unicode character glyphs in the database.&#8221; It does not yet support Chinese, Japanese, or Korean.</p>
<p>For example, I drew a treble clef on the page:</p>
<p style="text-align:center"><img src="http://www.johndcook.com/draw_treble.png" alt="" width="400" height="251" /></p>
<p>The site came back with a list of possible matches, and the first one was what I was hoping for:</p>
<p style="text-align:center"><img src="http://www.johndcook.com/g_clef.png" alt="" width="300" height="86" /></p>
<p>Interestingly, the sixth possible match on the list was a symbol for contour integration:</p>
<p style="text-align:center"><img src="http://www.johndcook.com/contour_integral.png" alt="" width="320" height="72" /></p>
<p>Notice the treble clef response has a funny little box on the right side. That&#8217;s because my browser did not have a glyph to display that Unicode character. The browser did have a glyph for the contour integration symbol and displayed it.</p>
<p>Another Unicode resource I recommend is this <a href="http://inamidst.com/stuff/unidata/">Unicode Codepoint Chart</a>. It is organized by code point value, in blocks of 256. If you were looking for the contour integration symbol above, for example, you could click on a link &#8220;U+2200 to U+22FF: Mathematical Operators&#8221; and see a grid of 256 symbols and click on the one you&#8217;re looking for. This site gives more detail about each character than does Shapecatcher. So you might use Shapecatcher to find where to start looking, then go to the Unicode Codepoint Chart to find related symbols or more details.</p>
<p><strong>Other posts on Unicode</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2008/04/05/why-unicode-is-subtle/">Why Unicode is subtle</a><br />
<a href="http://www.johndcook.com/blog/2010/01/16/disappointing-state-of-unicode-fonts/">The disappointing state of Unicode fonts</a><br />
Entering Unicode characters in <a href="http://www.johndcook.com/blog/2008/08/17/three-ways-to-enter-unicode-characters-in-windows/">Windows</a> and <a href="http://www.johndcook.com/blog/2008/08/18/entering-unicode-characters-in-linux/">Linux</a><br />
<a href="http://www.johndcook.com/blog/2009/01/14/how-to-insert-graphics-in-twitter-messages/">Inserting graphics in Twitter messages</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2011/11/12/unicode-character-recognition/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Typesetting &#8220;C#&#8221; in LaTeX</title>
		<link>http://www.johndcook.com/blog/2011/10/18/typesetting-c-in-latex/</link>
		<comments>http://www.johndcook.com/blog/2011/10/18/typesetting-c-in-latex/#comments</comments>
		<pubDate>Tue, 18 Oct 2011 10:26:26 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Typography]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[LaTeX]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=9694</guid>
		<description><![CDATA[How do you refer to the C# programming language in LaTeX? Simply typing C# doesn&#8217;t work because # is a special character in LaTeX. You could type C\#. That works, but it looks a little odd. The number sign is too big and too low.

What about using a musical sharp sign, i.e. C$\sharp$? That also [...]]]></description>
			<content:encoded><![CDATA[<p>How do you refer to the C# programming language in LaTeX? Simply typing <code>C#</code> doesn&#8217;t work because <code>#</code> is a special character in LaTeX. You could type <code>C\#</code>. That works, but it looks a little odd. The number sign is too big and too low.<span id="more-9694"></span></p>
<p style="text-align:center"><img src="http://www.johndcook.com/csharp1.png" alt="" width="42" height="25" /></p>
<p>What about using a musical sharp sign, i.e. <code>C$\sharp$</code>? That also looks a little odd. Even though the language is pronounced &#8220;C sharp,&#8221; it&#8217;s usually written with a number sign, not a sharp.</p>
<p style="text-align:center"><img src="http://www.johndcook.com/csharp2.png" alt="" width="35" height="25" /></p>
<p>Let&#8217;s look at recommended ways of typesetting C++ to see whether that helps. The top answer to <a href="http://tex.stackexchange.com/questions/4302/prettiest-way-to-typeset-c">this question</a> on TeX Stack Exchange is to define a new command as follows:</p>
<pre>\newcommand{\CC}{C\nolinebreak\hspace{-.05em}\raisebox{.4ex}{\tiny\bf +}\nolinebreak\hspace{-.10em}\raisebox{.4ex}{\tiny\bf +}}</pre>
<p>This does several things. First, it prevents line breaks between the constituent characters. It also does several things to the plus signs:</p>
<ul>
<li>Draws them in closer</li>
<li>Makes them smaller</li>
<li>Raises them</li>
<li>Makes them bold</li>
</ul>
<p>The result is what we&#8217;re subconsciously accustomed to seeing in print.</p>
<p style="text-align:center"><img src="http://www.johndcook.com/cpp.png" alt="" width="46" height="21" /></p>
<p>Here&#8217;s an analogous command for C#.</p>
<pre>\newcommand{\CS}{C\nolinebreak\hspace{-.05em}\raisebox{.6ex}{\tiny\bf \#}}</pre>
<p>And here&#8217;s the output. The number sign is a little too small.</p>
<p style="text-align:center"><img src="http://www.johndcook.com/csharp3.png" alt="" width="35" height="21" /></p>
<p>To make a little larger number sign, replace <code>\tiny</code> with <code>\scriptsize</code>.</p>
<p style="text-align:center"><img src="http://www.johndcook.com/csharp4.png" alt="" width="38" height="21" /></p>
<p><strong>Related posts</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2010/05/12/complexity-of-html-and-latex/">Comparing the complexity of HTML and LaTeX</a><br />
<a href="http://www.johndcook.com/blog/2010/02/15/top-latex-mistakes/">Top four LaTeX mistakes</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2011/10/18/typesetting-c-in-latex/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Typesetting chemistry in LaTeX</title>
		<link>http://www.johndcook.com/blog/2010/12/08/typesetting-chemistry-in-latex/</link>
		<comments>http://www.johndcook.com/blog/2010/12/08/typesetting-chemistry-in-latex/#comments</comments>
		<pubDate>Wed, 08 Dec 2010 19:30:52 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Typography]]></category>
		<category><![CDATA[LaTeX]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=7275</guid>
		<description><![CDATA[Yesterday I gave the following tip on TeXtip:
Set chemical formulas with math Roman. Example: sulfate is  $\mathrm{SO_4^{2-}}$
TorbjoernT and scmbradley let me know there&#8217;s a better way: use Martin Hansel&#8217;s package mhchem. The package is simpler to use and it correctly handles subtle typographical details.
Using the mhchem package, sulfate would be written \ce{SO4^2-}. In addition [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I gave the following tip on <a href="http://twitter.com/#!/TeXtip">TeXtip</a>:</p>
<blockquote><p>Set chemical formulas with math Roman. Example: sulfate is  $\mathrm{SO_4^{2-}}$</p></blockquote>
<p><a rel="nofollow" href="http://twitter.com/TorbjoernT">TorbjoernT</a> and <a rel="nofollow" href="http://twitter.com/scmbradley">scmbradley</a> let me know there&#8217;s a better way: use Martin Hansel&#8217;s package <code>mhchem</code>. The package is simpler to use and it correctly handles subtle typographical details.</p>
<p>Using the <code>mhchem</code> package, sulfate would be written <code>\ce{SO4^2-}</code>. In addition to chemical compounds, <code>mhchem</code> has support for bonds, arrows, and related chemical notation.</p>
<p>Example:</p>
<p style="text-align:left"><img src="http://www.johndcook.com/mhchem.png" alt="" width="209" height="156" /></p>
<p>Source:</p>
<pre>
\documentclass{article}
\usepackage[version=3]{mhchem}
\parskip=0.1in
\begin{document}

\ce{SO4^2-}

\ce{^{227}_{90}Th+}

\ce{A\bond{-}B\bond{=}C\bond{#}D}

\ce{CO2 + C -&gt; 2CO}

\ce{SO4^2- + Ba^2+ -&gt; BaSO4 v}

\end{document}
</pre>
<p>&nbsp;</p>
<p>For more information, see the <a href="http://www.ctan.org/tex-archive/macros/latex/contrib/mhchem/mhchem.pdf">mhchem package documentation</a>.</p>
<p><strong>Related posts</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2010/02/15/top-latex-mistakes/">Top four LaTeX mistakes</a><br />
<a href="http://www.johndcook.com/blog/2008/11/24/link-to-web-pages-from-latex-pdf/">Hyperlinks in LaTeX-generated PDF</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2010/12/08/typesetting-chemistry-in-latex/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Complexity of HTML and LaTeX</title>
		<link>http://www.johndcook.com/blog/2010/05/12/complexity-of-html-and-latex/</link>
		<comments>http://www.johndcook.com/blog/2010/05/12/complexity-of-html-and-latex/#comments</comments>
		<pubDate>Thu, 13 May 2010 02:55:32 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Typography]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[LaTeX]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=5327</guid>
		<description><![CDATA[Sometime around 1994, my office mate introduced me to HTML by saying it was 10 times simpler than LaTeX. At the time I thought he was right. Now I&#8217;m not so sure. Maybe he was right in 1994 when the expectations for HTML were very low.
It is easier to bang out a simple, ugly HTML [...]]]></description>
			<content:encoded><![CDATA[<p>Sometime around 1994, my office mate introduced me to HTML by saying it was 10 times simpler than LaTeX. At the time I thought he was right. Now I&#8217;m not so sure. Maybe he <em>was</em> right in 1994 when the expectations for HTML were very low.</p>
<p>It is easier to bang out a simple, ugly HTML page than to write your first LaTeX document. When you compare the time required to make an attractive document, the effort becomes more comparable. The more sophisticated you get, the simpler LaTeX becomes by comparison. </p>
<p>Of course the two languages are not exactly comparable. HTML targets a web browser while LaTeX targets paper. HTML would be much simpler if people only used it to create documents to print out on their own printer. A major challenge with HTML is not knowing how someone else will use your document. You don&#8217;t know what browser they will view it with, at what resolution, etc. For that matter, you don&#8217;t know whether they&#8217;re even going to <em>view</em> it at all &mdash; they may use a screen reader to <em>listen</em> to the document. </p>
<p>Writing HTML is much more complicated than writing LaTeX if you take a broad view of all that is required to do it well: learning about accessibility and internationalization, keeping track of browser capabilities and market shares, adapting to evolving standards, etc.  The closer you look into it, the less HTML has in common with LaTeX. The two languages are not simply two systems of markup; they address different problems.</p>
<p><strong>Related links</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2008/08/03/side-benefits-of-accessibility/">Side benefits of accessibility</a><br />
<a href="http://www.johndcook.com/math_symbols.html">Math symbols in HTML, XML, TeX, and Unicode</a><br />
<a href="http://www.johndcook.com/blog/2010/02/15/top-latex-mistakes/">Top four LaTeX mistakes</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2010/05/12/complexity-of-html-and-latex/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Top four LaTeX mistakes</title>
		<link>http://www.johndcook.com/blog/2010/02/15/top-latex-mistakes/</link>
		<comments>http://www.johndcook.com/blog/2010/02/15/top-latex-mistakes/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 13:52:13 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Typography]]></category>
		<category><![CDATA[LaTeX]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=3169</guid>
		<description><![CDATA[Here are four of the most common typesetting errors I see in books and articles created with LaTeX.
1) Quotes
Quotation marks in LaTeX files begin with two back ticks, ``, and end with two single quotes, ''.

The first &#8220;Yes&#8221; was written as
``Yes.''
in LaTeX while the one with the backward opening quote was written as
"Yes."
2) Differentials
Differentials, most [...]]]></description>
			<content:encoded><![CDATA[<p>Here are four of the most common typesetting errors I see in books and articles created with LaTeX.</p>
<p><strong>1) Quotes</strong></p>
<p>Quotation marks in LaTeX files begin with two back ticks, <code>``</code>, and end with two single quotes, <code>''</code>.</p>
<p><img class="alignnone" src="http://www.johndcook.com/latexmistake1.png" alt="" width="82" height="81" /></p>
<p>The first &#8220;Yes&#8221; was written as</p>
<pre>``Yes.''</pre>
<p>in LaTeX while the one with the backward opening quote was written as</p>
<pre>"Yes."</pre>
<p><strong>2) Differentials</strong></p>
<p>Differentials, most commonly the dx at the end of an integer, should have a little space separating them from other elements. The &#8220;dx&#8221; is a unit and so it needs a little space to keep from looking like the product of &#8220;d&#8221; and &#8220;x.&#8221; You can do this in LaTeX by inserting <code>\,</code> before and between differentials.</p>
<p><img class="alignnone" src="http://www.johndcook.com/latexmistake2a.png" alt="" width="126" height="131" /></p>
<p>The first integral was written as</p>
<pre> \int_0^1 f(x) \, dx</pre>
<p>while the second forgot the <code>\,</code> and was written as</p>
<pre> \int_0^1 f(x)  dx</pre>
<p>The need for a little extra space around differentials becomes more obvious in multiple integrals.</p>
<p><img class="alignnone" src="http://www.johndcook.com/latexmistake2b.png" alt="" width="156" height="77" /></p>
<p>The first was written as</p>
<pre>dx \, dy = r \, dr \, d\theta</pre>
<p>while the second was written as</p>
<pre>dx  dy = r  dr  d\theta</pre>
<p><strong>3) Multi-letter function names</strong></p>
<p>The LaTeX commands for typesetting functions like sin, cos, log, max, etc. begin with a backslash. The command <code>\log</code> keeps &#8220;log,&#8221; for example, from looking like the product of variables &#8220;l&#8221;, &#8220;o&#8221;, and &#8220;g.&#8221;</p>
<p><img class="alignnone" src="http://www.johndcook.com/latexmistake3a.png" alt="" width="115" height="79" /></p>
<p>The first example above was written as</p>
<pre>\log e^x = x</pre>
<p>and the second as</p>
<pre>log e^x = x</pre>
<p>The double angle identity for sine is readable when properly typeset and a jumbled mess when the necessary backslashes are left out.</p>
<p><img class="alignnone" src="http://www.johndcook.com/latexmistake3b.png" alt="" width="184" height="71" /></p>
<p>The first example was written</p>
<pre>\sin 2u = 2 \sin u \cos u</pre>
<p>and the second as</p>
<pre>sin 2u = 2 sin u cos u</pre>
<p><strong>4) Failure to use math mode</strong></p>
<p>LaTeX uses math mode to distinguish variables from ordinary letters. Variables are typeset in math italic, a special style that is not the same as ordinary italic prose.</p>
<p><img class="alignnone" src="http://www.johndcook.com/latexmistake4.png" alt="" width="404" height="74" /></p>
<p>The first sentence was written as</p>
<pre>Given a matrix $A$ and vector $b$, solve $Ax = b$.</pre>
<p>and the second as</p>
<pre>Given a matrix A and vector b, solve Ax = b.</pre>
<p><strong>Related posts</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2009/07/15/microsoft-word-equation-editor/">Microsoft equation editor</a><br />
<a href="http://www.johndcook.com/blog/2008/09/16/four-ways-to-convert-excel-tables-to-latex/">Converting Excel tables to LaTeX</a><br />
<a href="http://www.johndcook.com/blog/2009/03/15/typesetting-music-in-latex-and-lilypond/">Typesetting music in LaTeX</a><br />
<a href="http://www.johndcook.com/blog/2008/04/03/microsoft-word-and-latex/">Contrasting Word and LaTeX</a><br />
<a href="http://www.johndcook.com/blog/2008/12/15/fonts-translations-python/">Things that work best when you don&#8217;t notice them</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2010/02/15/top-latex-mistakes/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>The disappointing state of Unicode fonts</title>
		<link>http://www.johndcook.com/blog/2010/01/16/disappointing-state-of-unicode-fonts/</link>
		<comments>http://www.johndcook.com/blog/2010/01/16/disappointing-state-of-unicode-fonts/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 00:58:50 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Typography]]></category>
		<category><![CDATA[Unicode]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=4186</guid>
		<description><![CDATA[Modern operating systems understand Unicode internally, but font support for Unicode is spotty. For an example of the problems this can cause, take a look at these screen shots of how the same Twitter message appears differently depending on what program is used to read it.
No font can display all Unicode characters. According to Wikipedia
&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>Modern operating systems understand Unicode internally, but font support for Unicode is spotty. For an example of the problems this can cause, take a look at these <a href="http://www.johndcook.com/blog/2009/01/14/how-to-insert-graphics-in-twitter-messages/">screen shots</a> of how the same Twitter message appears differently depending on what program is used to read it.</p>
<p>No font can display all Unicode characters. According to <a href="http://en.wikipedia.org/wiki/Unicode_fonts">Wikipedia</a></p>
<blockquote><p>&#8230; it would be impossible to create such a font in any common font format, as Unicode includes over 100,000 characters, while no widely-used font format supports more than 65,535 glyphs.</p></blockquote>
<p>However, the biggest problem isn&#8217;t the number of characters a font can display. Most Unicode characters are quite rare. About 30,000 characters are enough to display the vast majority of characters in use in all the world&#8217;s languages as well as a generous selection of symbols. However Unicode fonts vary greatly in their support even for the more commonly used ranges of characters. See this <a href="http://en.wikipedia.org/wiki/Unicode_fonts#Comparison_of_fonts">comparison chart</a>. The only range completely covered by all Unicode fonts in the chart is the 128 characters of Latin Extended-A.</p>
<p><a href="http://unifoundry.com/unifont.html">Unifont</a> supports all printable characters in the <a href="http://www.unicode.org/roadmaps/bmp/">basic multilingual plane</a>, characters U+0000 through U+FFFF. This includes the 30,000 characters mentioned above plus many more. Unifont isn&#8217;t pretty, but it&#8217;s complete. As far as I know, it&#8217;s the only font that covers the characters below U+FFFF.</p>
<p><strong>Related posts</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2008/04/05/why-unicode-is-subtle/">Why Unicode is subtle</a></p>
<p>Entering Unicode characters in <a href="http://www.johndcook.com/blog/2008/08/17/three-ways-to-enter-unicode-characters-in-windows/">Windows</a>, <a href="http://www.johndcook.com/blog/2008/08/18/entering-unicode-characters-in-linux/">Linux</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2010/01/16/disappointing-state-of-unicode-fonts/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Free alternative to Consolas font</title>
		<link>http://www.johndcook.com/blog/2009/09/21/free-alternative-to-consolas-font/</link>
		<comments>http://www.johndcook.com/blog/2009/09/21/free-alternative-to-consolas-font/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 16:39:58 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Typography]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=3206</guid>
		<description><![CDATA[Consolas is my favorite monospace font. It&#8217;s a good programmer&#8217;s font because it exaggerates the differences between some characters that may easily be confused. It ships with Visual Studio and with many other Microsoft products. See this post for examples.
I recently found out about Inconsolata, a free font similar to Consolas. Inconsolata is part of [...]]]></description>
			<content:encoded><![CDATA[<p>Consolas is my favorite monospace font. It&#8217;s a good programmer&#8217;s font because it exaggerates the differences between some characters that may easily be confused. It ships with Visual Studio and with many other Microsoft products. See <a href="http://www.johndcook.com/blog/2008/10/31/changing-the-r-console-fonts/">this post</a> for examples.</p>
<p>I recently found out about <a href="http://levien.com/type/myfonts/inconsolata.html">Inconsolata</a>, a free font similar to Consolas. Inconsolata is part of the <a href="http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&amp;item_id=OFL_fonts">OFL font collection</a> from <a href="http://www.sil.org/">SIL International</a>.</p>
<p style="text-align:center"><img title="Inconsolata font sample" src="http://www.johndcook.com/inconsolata.png" alt="" width="406" height="214" /></p>
<p>Another interesting font from SIL is  <a href="http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&amp;item_id=andika">Andika</a>, mentioned previously <a href="http://www.johndcook.com/blog/2009/06/10/a-couple-thoughts-on-typography/">here</a>. The Andika home page describes this font as follows.</p>
<blockquote><p>Andika is a sans serif, Unicode-compliant font designed especially for literacy use, taking into account the needs of beginning readers. The focus is on clear, easy-to-perceive letterforms that will not be readily confused with one another.</p></blockquote>
<p><strong>Related posts</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2008/10/31/changing-the-r-console-fonts/">Better R console fonts</a><br />
<a href="http://www.johndcook.com/blog/2009/07/24/windows-console-fonts/">Adding fonts to the PowerShell console</a><br />
<a href="http://www.johndcook.com/blog/2009/06/10/a-couple-thoughts-on-typography/">Comic Sans and dyslexia</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/09/21/free-alternative-to-consolas-font/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>How to write multi-part definitions in LaTeX</title>
		<link>http://www.johndcook.com/blog/2009/09/14/latex-multi-part-definitions/</link>
		<comments>http://www.johndcook.com/blog/2009/09/14/latex-multi-part-definitions/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 21:40:29 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Typography]]></category>
		<category><![CDATA[LaTeX]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=3131</guid>
		<description><![CDATA[This post explains how to typeset multi-part definitions in LaTeX.
The absolute value function is a simple example of a two-part definition.

The Möbius function is a more complicated example of a three-part definition.

Here&#8217;s how you could write LaTeX for the absolute value definition.
&#124;x&#124; =
\left\{
	\begin{array}{ll}
		x  &#38; \mbox{if } x \geq 0 \\
		-x &#38; \mbox{if } x [...]]]></description>
			<content:encoded><![CDATA[<p>This post explains how to typeset multi-part definitions in LaTeX.</p>
<p>The absolute value function is a simple example of a two-part definition.</p>
<p style="text-align:center"><img src="http://www.johndcook.com/absolutevalue.gif" alt="absolute value definition" width="154" height="41" /></p>
<p>The Möbius function is a more complicated example of a three-part definition.</p>
<p style="text-align:center"><img src="http://www.johndcook.com/threepartdef.gif" alt="definition of Mobius function" width="365" height="60" /></p>
<p>Here&#8217;s how you could write LaTeX for the absolute value definition.</p>
<pre>|x| =
\left\{
	\begin{array}{ll}
		x  &amp; \mbox{if } x \geq 0 \\
		-x &amp; \mbox{if } x &lt; 0
	\end{array}
\right.</pre>
<p>The right-hand side of the equation is an array with an opening brace sized to fit on the left. Braces are special characters and so the opening brace needs to be escaped with a backslash. LaTeX requires a <code>\right</code> for every <code>\left</code> but the dot in <code>\right.</code> says to make the matching container on the right side empty.</p>
<p>Since this pattern comes up fairly often, it&#8217;s handy to have a command to encapsulate it. We define <code>\twopartdef</code> as follows.</p>
<pre>\newcommand{\twopartdef}[4]
{
	\left\{
		\begin{array}{ll}
			#1 &amp; \mbox{if } #2 \\
			#3 &amp; \mbox{if } #4
		\end{array}
	\right.
}</pre>
<p>Then we could call it as follows:</p>
<pre>|x| = \twopartdef { x } {x \geq 0} {-x} {x &lt; 0}</pre>
<p>The command <code>\threepartdef</code> is very similar to <code>\twopartdef</code>.</p>
<pre>\newcommand{\threepartdef}[6]
{
	\left\{
		\begin{array}{lll}
			#1 &amp; \mbox{if } #2 \\
			#3 &amp; \mbox{if } #4 \\
			#5 &amp; \mbox{if } #6
		\end{array}
	\right.
}</pre>
<p>You could call <code>\threepartdef</code> for the Möbius function as follows.</p>
<pre>\mu(n) = \threepartdef
{1}      {n=1}
{0}      {a^2 \,|\, n \mbox{ for some } a &gt; 1}
{(-1)^r} {n \mbox{ has } r \mbox{ distinct prime factors}}</pre>
<p><strong>Related posts</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2009/03/15/typesetting-music-in-latex-and-lilypond/">Typesetting music in LaTeX</a><br />
<a href="http://www.johndcook.com/blog/2009/01/14/how-to-display-side-by-side-figurs-in-latex/">How to display side-by-side figures in LaTeX</a><br />
<a href="http://www.johndcook.com/blog/2008/07/24/including-images-in-latex-files/">Including images in LaTeX</a><br />
<a href="http://www.johndcook.com/blog/2008/07/24/latex-and-powerpoint-presentations/">LaTeX and PowerPoint presentations</a><br />
<a href="http://www.johndcook.com/blog/2008/11/24/how-to-put-pdf-properties-in-a-latex-file/">How to put PDF properties in a LaTeX file</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/09/14/latex-multi-part-definitions/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Adding fonts to the PowerShell and cmd.exe consoles</title>
		<link>http://www.johndcook.com/blog/2009/07/24/windows-console-fonts/</link>
		<comments>http://www.johndcook.com/blog/2009/07/24/windows-console-fonts/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 18:40:11 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Typography]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=2727</guid>
		<description><![CDATA[The default font options for the PowerShell console are limited: raster fonts and Lucida Console. Raster fonts are the default, though Lucida Console is an improvement. In my opinion, Consolas is even better, but it&#8217;s not on the list of options.
Mastering PowerShell by Tobias Weltner explains how to expand the list of font options for [...]]]></description>
			<content:encoded><![CDATA[<p>The default font options for the PowerShell console are limited: raster fonts and Lucida Console. Raster fonts are the default, though Lucida Console is an improvement. In my opinion, <a href="http://www.johndcook.com/blog/2008/10/31/changing-the-r-console-fonts/">Consolas</a> is even better, but it&#8217;s not on the list of options.</p>
<p><a href="http://powershell.com/cs/blogs/ebook/default.aspx">Mastering PowerShell</a> by Tobias Weltner explains how to expand the list of font options for the PowerShell console. The same trick increases the list of font options in the Windows command prompt <code>cmd.exe</code> as well. The book is free for download. See page 16 for details. However, I have two comments about the instructions it gives.</p>
<p>First, the book says &#8220;The name must be exactly the same as the official font name, just the way it&#8217;s stated under [registry key].&#8221; However, the Consolas font is listed in the registry as &#8220;Consolas (True Type)&#8221;. You should enter &#8220;Consolas&#8221; and leave out the parenthetical description.</p>
<p>Second, the book says &#8220;the new font will work only after you either log off at least once or restart your computer.&#8221; When I tried it, logging off was not sufficient; I had to reboot my computer before the font change would work.</p>
<p><strong>Update</strong>: In order to make this post self-contained, I&#8217;ve added below the necessary information from <em>Mastering PowerShell</em>.</p>
<p>Run <code>regedit.exe</code> and navigate to <code>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont</code>.</p>
<p>Right-click in the panel on the right side and create a new string value. Name that value &#8220;0&#8243; or &#8220;00&#8243; or however many zeros you need to create a new key. That string&#8217;s value is the name of the font to add.</p>
<p><strong>Update</strong>: See <a href="http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q247815">Necessary criteria for fonts to be available in a command window</a></p>
<p><strong>Related posts</strong>:</p>
<p><a href="http://www.johndcook.com/blog/2008/08/17/improved-powershell-prompt/">Improved PowerShell prompt</a><br />
<a href="http://www.johndcook.com/blog/2009/06/10/a-couple-thoughts-on-typography/">A couple thoughts on typography</a><br />
<a href="http://www.johndcook.com/blog/2008/10/31/changing-the-r-console-fonts/">Better R console fonts</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/07/24/windows-console-fonts/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>I owe Microsoft Word an apology</title>
		<link>http://www.johndcook.com/blog/2009/07/15/microsoft-word-equation-editor/</link>
		<comments>http://www.johndcook.com/blog/2009/07/15/microsoft-word-equation-editor/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 15:29:52 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Math]]></category>
		<category><![CDATA[Typography]]></category>
		<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[MS Office]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=2660</guid>
		<description><![CDATA[I tried to use the Equation Editor in Microsoft Word years ago and hated it. It was hard to use and produced ugly output. I tried it again recently and was pleasantly surprised. I&#8217;m using Word 2007. I don&#8217;t remember what version I&#8217;d tried before.
I&#8217;ve long said that  math written in Word is ugly, [...]]]></description>
			<content:encoded><![CDATA[<p>I tried to use the Equation Editor in Microsoft Word years ago and hated it. It was hard to use and produced ugly output. I tried it again recently and was pleasantly surprised. I&#8217;m using Word 2007. I don&#8217;t remember what version I&#8217;d tried before.</p>
<p>I&#8217;ve long said that  math written in Word is ugly, and it usually is. But the fault lies with users, like myself, not with Word. I realize now that the problem is that most people writing math in Word are not using the Equation Editor. LaTeX produces ugly math too when people do not use it correctly, though this happens less often.</p>
<p>Math typography is subtle. For example, mathematical symbols are set in an italic font that is not quite the same as the italic font used in prose. Also, word-like symbols such as &#8220;log&#8221; or &#8220;cos&#8221; are not set in italics. I imagine most people do not consciously notice these conventions — I never noticed until I learned to use LaTeX — but subconsciously notice when the conventions are violated. The conventions of math typography give clues that help readers distinguish, for example, the English indefinite article &#8220;a&#8221; from a variable named &#8220;a&#8221; and to distinguish the symbol for maximum from the product of variables &#8220;m&#8221;, &#8220;a&#8221;, and &#8220;x.&#8221;</p>
<p>Microsoft&#8217;s Equation Editor typesets math correctly. Word documents usually do not, but only because folks usually do not use the Equation Editor. In the following example, I set the same equation three times: using ordinary text, using ordinary italic for the &#8220;x&#8221;, and finally using the Equation Editor.</p>
<p style="text-align:center"><img src="http://www.johndcook.com/wordmath.png" alt="screen shot of trig identity using MS Word" width="297" height="174" /></p>
<p>Note that the &#8220;x&#8221; in the third version is not the same as the italic &#8220;x&#8221; in the second version. The prose in this example is set in Calibri font and the Equation Editor uses Cambria Math font. Also, I did not tell Word to format &#8220;sin&#8221; and &#8220;cos&#8221; one way and &#8220;x&#8221; another or tell it what font to use; I simply typed <code>sin^2 x + cos^2 x = 1</code> into the Equation Editor and it formatted the result as above. I haven&#8217;t used it much, but the Equation Editor seems to be more capable and easier to use than I thought.</p>
<p>Here are a few more examples of Equation Editor output.</p>
<p style="text-align:center"><img src="http://www.johndcook.com/wordmath2.png" alt="examples of math using Word: Gaussian integral, Fourier series, quadratic equation" width="389" height="248" /></p>
<p>I still prefer using LaTeX for documents containing math symbols. I&#8217;ve used LaTeX for many years and I can typeset equations very quickly using it. But I&#8217;m glad to know that Word can typeset equations well and that the process is easier than I thought.</p>
<p>I tried out the Equation Editor because <a href="http://www.twitter.com/afwings">Bob Matthews</a> suggested I try <a href="http://www.dessci.com/en/products/mathtype/default.htm">MathType</a>, a third-party equation editor add-on for Microsoft Word. I haven&#8217;t tried MathType yet but from what I hear it produces even better output.</p>
<p><strong>Related post</strong>: <a href="http://www.johndcook.com/blog/2008/04/03/microsoft-word-and-latex/">Contrasting Microsoft Word and LaTeX</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/07/15/microsoft-word-equation-editor/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>A couple thoughts on typography</title>
		<link>http://www.johndcook.com/blog/2009/06/10/a-couple-thoughts-on-typography/</link>
		<comments>http://www.johndcook.com/blog/2009/06/10/a-couple-thoughts-on-typography/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 18:17:44 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Typography]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=2453</guid>
		<description><![CDATA[Font embedding not such a good idea?
The most recent Boag World podcast interviewed Mark Boulton. Boulton has a contrarian opinion on font embedding. Nearly all web designers are excited about font embedding (the ability to have fonts download on-the-fly if a page uses a font not installed on the user&#8217;s computer). Bolton&#8217;s not so sure [...]]]></description>
			<content:encoded><![CDATA[<h3>Font embedding not such a good idea?</h3>
<p>The most recent Boag World podcast interviewed <a href="http://boagworld.com/podcast/169">Mark Boulton</a>. Boulton has a contrarian opinion on font embedding. Nearly all web designers are excited about font embedding (the ability to have fonts download on-the-fly if a page uses a font not installed on the user&#8217;s computer). Bolton&#8217;s not so sure this is a good idea. Fonts are designed for a purpose, and most fonts were designed for print. The handful of fonts that were designed first for online viewing (<a href="http://www.microsoft.com/typography/web/fonts/verdana/default.htm">Verdana</a>, Georgia, etc.) are widely installed. If font embedding were a way to broaden the pallet of fonts designed for use on a computer monitor, that would be great. But the most likely use of font embedding would be to allow designers to use more fonts online that were not designed to be used online.</p>
<h3>Comic Sans and dyslexia</h3>
<p>Comic Sans is terribly overused. It&#8217;s not a bad font, but it&#8217;s often used in inappropriate contexts and has become a cliché for poor typographical taste.</p>
<p>However, I heard somewhere that people with dyslexia can read Comic Sans more easily than most other fonts. I think the explanation was that the font breaks some typical symmetries. For example, a &#8220;p&#8221; is not an exact mirror image of a &#8220;q.&#8221; (The former has a more pronounced serif on top.) On the other hand, the &#8220;b&#8221; and &#8220;d&#8221; do look like near mirror images. I wonder whether anyone has designed a font specifically to help people with dyslexia. Maybe such  fonts would exaggerate the asymmetries that were accidental in the design of Comic Sans. Delivering such fonts would be a good application of font embedding.</p>
<p><strong>Update</strong>: Karl Ove Hufthammer left a comment pointing out <a href="http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&amp;item_id=andika">Andika</a>, a font with &#8220;easy-to-perceive letterforms that will not be readily confused with one another.&#8221; Here&#8217;s a <a href="http://scripts.sil.org/cms/scripts/render_download.php?site_id=nrsi&amp;format=file&amp;media_id=AndikaBasic_TypeSample&amp;filename=AndikaBasic_TypeSample.pdf">sample</a>.</p>
<p><strong>Related posts</strong></p>
<p><a href="http://www.johndcook.com/blog/2009/03/12/periodic-table-of-typefaces/">Periodic table of typefaces</a><br />
<a href="http://www.johndcook.com/blog/2008/12/15/fonts-translations-python/">Things that work best when you don&#8217;t notice them</a><br />
<a href="http://www.johndcook.com/blog/2008/10/31/changing-the-r-console-fonts/">Better R console fonts</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/06/10/a-couple-thoughts-on-typography/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sharps and flats in HTML</title>
		<link>http://www.johndcook.com/blog/2009/03/16/sharps-and-flats-in-html/</link>
		<comments>http://www.johndcook.com/blog/2009/03/16/sharps-and-flats-in-html/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 17:44:20 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Typography]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Music]]></category>
		<category><![CDATA[Unicode]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1767</guid>
		<description><![CDATA[Apparently there&#8217;s no HTML entity for the flat symbol, ♭. In my previous post, I just spelled out B-flat because I thought that was safer; it&#8217;s possible not everyone would have the fonts installed to display B♭ correctly.
So how do you display music symbols for flat, sharp, and natural in HTML? You can insert any [...]]]></description>
			<content:encoded><![CDATA[<p>Apparently there&#8217;s no HTML entity for the flat symbol, ♭. In my <a href="http://www.johndcook.com/blog/2009/03/15/typesetting-music-in-latex-and-lilypond/">previous post</a>, I just spelled out B-flat because I thought that was safer; it&#8217;s possible not everyone would have the fonts installed to display B♭ correctly.</p>
<p>So how do you display music symbols for flat, sharp, and natural in HTML? You can insert any symbol if you know its Unicode value, though you run the risk that someone viewing the page may not have the necessary fonts installed to view the symbol. Here are the Unicode values for flat, natural, and sharp.</p>
<p style="text-align: center"><img src="http://www.johndcook.com/flatsharp.png" alt="" width="206" height="88" /></p>
<p>Since the flat sign has Unicode value U+266D, you could enter &amp;#x266d; into HTML to display that symbol.</p>
<p>The sharp sign raises an interesting question. I&#8217;m sure most web pages referring to G-sharp would use the number sign # (U+0023) rather than the sharp sign ♯ (U+266F). And why not? The number sign is conveniently located on a standard keyboard and the sharp sign isn&#8217;t. It would be nice if people used sharp symbols rather than number signs. It would make it easier to search on specifically musical terms. But it&#8217;s not going to happen.</p>
<p>Related posts:</p>
<p><a href="http://www.johndcook.com/blog/2008/08/18/entering-unicode-characters-in-linux/">Entering Unicode characters in Linux</a><br />
<a href="http://www.johndcook.com/blog/2008/08/17/three-ways-to-enter-unicode-characters-in-windows/">Three ways to enter Unicode characters in Windows</a><br />
<a href="http://www.johndcook.com/blog/2008/06/14/greek-letters-and-math-symbols-in-xhtml/">Greek letters and math symbols in (X)HTML</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/03/16/sharps-and-flats-in-html/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Typesetting music in LaTeX and LilyPond</title>
		<link>http://www.johndcook.com/blog/2009/03/15/typesetting-music-in-latex-and-lilypond/</link>
		<comments>http://www.johndcook.com/blog/2009/03/15/typesetting-music-in-latex-and-lilypond/#comments</comments>
		<pubDate>Sun, 15 Mar 2009 22:44:50 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Music]]></category>
		<category><![CDATA[Typography]]></category>
		<category><![CDATA[LaTeX]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1762</guid>
		<description><![CDATA[I tried typesetting music in LaTeX some time ago and gave up. The packages I found were hard to install, the examples didn&#8217;t work, etc. This weekend I decided to try again. I tried plowing through the MusiXTeX documentation and got no further than I did last time.
I posted a note on StackOverflow and got [...]]]></description>
			<content:encoded><![CDATA[<p>I tried typesetting music in LaTeX some time ago and gave up. The packages I found were hard to install, the examples didn&#8217;t work, etc. This weekend I decided to try again. I tried plowing through the <a href="http://icking-music-archive.org/software/indexmt6.html">MusiXTeX</a> documentation and got no further than I did last time.</p>
<p>I posted a note on <a href="http://stackoverflow.com/questions/648429/typesetting-music-in-latex">StackOverflow</a> and got some good responses. Nikhil Chelliah suggested I look at <a href="http://lilypond.org/web/">LilyPond</a>. I had looked at LilyPond before, and <a href="http://twitter.com/jleedev">@jleedev</a> explained <a href="http://lilypond.org/doc/v2.12/Documentation/user/lilypond-program/LaTeX">how to integrate LaTeX and LilyPond</a>.</p>
<p>Here&#8217;s some sheet music I included in my previous post, <a href="http://www.johndcook.com/blog/2009/03/15/march-in-74-time/">March in 7/4 time</a>.</p>
<p style="text-align: center"><img src="http://www.johndcook.com/march74.png" alt="sheet music example" width="384" height="101" /></p>
<p>Here&#8217;s a full-sized <a href="http://www.johndcook.com/march74.pdf">PDF file</a> version of the music above. And here&#8217;s the LilyPond source code used to create the music.</p>
<pre>\relative c' {
\time 7/4
\key f \major
\clef treble
f g f \times 2/3{ c8 c c} f4 g a
g a8. bes16 a4 g f g c,
f g f \times 2/3{ c8 c c} f4 g a
g a8. bes16 a4 g f e f
}</pre>
<p>The notation looks cryptic at first, but it makes sense after a few minutes. The command <code>\relative c'</code> means that the following pitches will be relative to middle C. For example, the first note, F, is the F closest to middle C. Each note is the same length as the previous note by default, and the first note is a quarter note by default. The notation <code>c8</code> means that the C is an eighth note, except it&#8217;s in the context of a triplet (<code>\times 2/3</code>) and so it&#8217;s an eighth note triplet. The next F is denoted <code>f4</code> to indicate that we&#8217;re back to quarter notes.</p>
<p>The notation <code>a8.</code> says that the A is a dotted eighth note. For the next note, <code>bes16</code> means a B-flat sixteenth note. The suffix &#8220;es&#8221; stands for &#8220;flat&#8221; and &#8220;is&#8221; stands for &#8220;sharp.&#8221; (The documentation says it&#8217;s Dutch. I&#8217;ve never seen it before.) I don&#8217;t understand why I had to tell it that the B was flat. The code specified earlier that the key was F major, which implies B&#8217;s are flat. I suppose the code for individual notes is decoupled from the code to draw the key signature. That would make entering music painful in keys that have lots of sharps or flats. Maybe there&#8217;s a way to specify default sharps or flats.</p>
<p>The comma in <code>c,</code> gives the absolute pitch of the C. In <code>relative</code> mode, LilyPond assumes by default that each pitch name refers to the pitch closest to its predecessor. The C closest to the previous note, F, would have been the C up one fourth rather than down one fifth, so the comma was necessary to tell LilyPond to go down.</p>
<p>If I were to do a lot of music processing, I&#8217;d probably look at a commercial package such as <a href="http://www.sibelius.com/">Sibelius</a>. But for now I&#8217;m just interested in producing small excerpts like that above, and it looks like LilyPond may be fine.</p>
<p><strong>Update</strong>: I double checked the rules about flats etc. Yes, I do have to specify explicitly that the B in this example is B-flat. If I just say <code>b</code> rather than <code>bes</code>, LilyPond will add a natural sign in front of the B! It&#8217;s strange. It is aware of the key signature: when I tell it the B is flat, it says &#8220;OK, then I don&#8217;t have to mark that specially since it&#8217;s implicit in the key signature.&#8221; And if I don&#8217;t tell it the B is flat, it says &#8220;Oh, that&#8217;s an exception to the key signature. Better mark it with a natural sign.&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/03/15/typesetting-music-in-latex-and-lilypond/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Periodic table of Typefaces</title>
		<link>http://www.johndcook.com/blog/2009/03/12/periodic-table-of-typefaces/</link>
		<comments>http://www.johndcook.com/blog/2009/03/12/periodic-table-of-typefaces/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 08:50:23 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Typography]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1721</guid>
		<description><![CDATA[Squidspot.com has created an interesting period table of typefaces.

Related post: Periodic table of Perl operators
]]></description>
			<content:encoded><![CDATA[<p>Squidspot.com has created an interesting <a href="http://www.squidspot.com/Periodic_Table_of_Typefaces/Periodic_Table_of_Typefaces_large.jpg">period table of typefaces</a>.</p>
<p style="text-align: center"><a href="http://www.squidspot.com/Periodic_Table_of_Typefaces/Periodic_Table_of_Typefaces_large.jpg"><img src="http://www.johndcook.com/typefaces.png" alt="thumbnail of period table of typefaces from Squidspot.com" width="288" height="192" /></a></p>
<p>Related post: <a href="http://www.johndcook.com/blog/2008/02/21/periodic-table-of-perl-operators/">Periodic table of Perl operators</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2009/03/12/periodic-table-of-typefaces/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Why is TeX so popular in Germany?</title>
		<link>http://www.johndcook.com/blog/2008/12/16/why-is-tex-so-popular-in-germany/</link>
		<comments>http://www.johndcook.com/blog/2008/12/16/why-is-tex-so-popular-in-germany/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 03:25:55 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Typography]]></category>
		<category><![CDATA[LaTeX]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=978</guid>
		<description><![CDATA[A lot of good (La)TeX resources come from Germany. I assume from the amount of development and support activity, there are probably a lot of users as well. Does anyone know why TeX is apparently so strong in Germany? Is there something about the German language that TeX supports particularly well?
]]></description>
			<content:encoded><![CDATA[<p>A lot of good (La)TeX resources come from Germany. I assume from the amount of development and support activity, there are probably a lot of users as well. Does anyone know why TeX is apparently so strong in Germany? Is there something about the German language that TeX supports particularly well?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2008/12/16/why-is-tex-so-popular-in-germany/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Things that work best when you don&#8217;t notice them</title>
		<link>http://www.johndcook.com/blog/2008/12/15/fonts-translations-python/</link>
		<comments>http://www.johndcook.com/blog/2008/12/15/fonts-translations-python/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 17:46:02 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Typography]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=1100</guid>
		<description><![CDATA[Fonts, translations, and programming languages have one thing in common: they work best when you don&#8217;t notice them.
If someone says &#8220;Hey, look at this cool font I just found!&#8221; you probably wouldn&#8217;t want to read a book set in that font. At least to an untrained eye, a great font will not stand out in [...]]]></description>
			<content:encoded><![CDATA[<p>Fonts, translations, and programming languages have one thing in common: they work best when you don&#8217;t notice them.</p>
<p>If someone says &#8220;Hey, look at this cool font I just found!&#8221; you probably wouldn&#8217;t want to read a book set in that font. At least to an untrained eye, a great font will not stand out in a list of small samples. You have to see large blocks of text set in a font to appreciate it. Even then, most people will not consciously appreciate a very readable font.</p>
<p>Translations are similar. If you find yourself saying &#8220;What an interesting translation!&#8221; then the translator has probably fallen down on the job. A good translation is neither archaic nor trendy. It does not draw attention to itself but allows you to focus on the original content. I believe the <a href="http://www.amazon.com/gp/product/1581344368?ie=UTF8&amp;tag=theende-20&amp;linkCode=xm2&amp;camp=1789&amp;creativeASIN=1581344368">English Standard Version</a> achieves that with Bible translation.</p>
<p>Python is like a good font or a good translation. For years I&#8217;d look into Python briefly when someone would recommend it. I&#8217;d thumb through a Python book, but it all looked rather plain. Only later did I come to appreciate that the beauty of Python is that it <em>is</em> rather plain. It doesn&#8217;t call attention to itself. It just gets out of your way and lets you write programs. It seems to me that compared to other programming language communities, the Python community brags less about their language <em>per se</em> and more about what they&#8217;re able to do with it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2008/12/15/fonts-translations-python/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Better R console fonts</title>
		<link>http://www.johndcook.com/blog/2008/10/31/changing-the-r-console-fonts/</link>
		<comments>http://www.johndcook.com/blog/2008/10/31/changing-the-r-console-fonts/#comments</comments>
		<pubDate>Fri, 31 Oct 2008 12:11:43 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Typography]]></category>
		<category><![CDATA[Rstats]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/?p=758</guid>
		<description><![CDATA[The default installation of R on Windows uses Courier New for the console font. Unfortunately, this font offers low contrast between the letter &#8216;l&#8217; and the number &#8216;1.&#8217; There is also poor contrast between the letter &#8216;O&#8217; and the number &#8216;0.&#8217; The contrast between period and commas is OK.
Lucida Console is an improvement. It has [...]]]></description>
			<content:encoded><![CDATA[<p>The default installation of R on Windows uses Courier New for the console font. Unfortunately, this font offers low contrast between the letter &#8216;l&#8217; and the number &#8216;1.&#8217; There is also poor contrast between the letter &#8216;O&#8217; and the number &#8216;0.&#8217; The contrast between period and commas is OK.</p>
<p>Lucida Console is an improvement. It has high contrast between &#8216;l&#8217; and &#8216;1&#8242;, though &#8216;O&#8217; and &#8216;0&#8242; are still hard to distinguish. But my favorite console font is <a rel="nofollow" href="http://en.wikipedia.org/wiki/Consolas">Consolas</a>. It offers strong contrast between &#8216;l&#8217; and &#8216;1&#8242;, commas and periods, and especially between lower case &#8216;o&#8217;, upper case &#8216;O&#8217;, and the number &#8216;0.&#8217;</p>
<p><img class="aligncenter" src="http://www.johndcook.com/rfonts.gif" alt="" width="363" height="88" /></p>
<p>Consolas is more legible while also fitting more characters into the same horizontal space. It can do this because it uses ClearType anti-aliasing while the other two fonts do not. Here is a sample of the three fonts magnified 4x to show the anti-aliasing.</p>
<p><img class="aligncenter" src="http://www.johndcook.com/antialias.gif" alt="" width="267" height="192" /></p>
<p>I found setting the default console font in R a little tricky. Clicking on the Edit -&gt; GUI preferences menu brings up the Rgui Configuration Editor. From there it&#8217;s obvious how to change the font. However, what I found surprising is that clicking the &#8220;OK&#8221; button only changes the font for the current session. I can&#8217;t think of another application that behaves analogously. To set your choice of font for all future sessions, click &#8220;Save&#8221; rather than &#8220;OK.&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2008/10/31/changing-the-r-console-fonts/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Holy Grail of CSS</title>
		<link>http://www.johndcook.com/blog/2008/08/14/the-holy-grail-of-css/</link>
		<comments>http://www.johndcook.com/blog/2008/08/14/the-holy-grail-of-css/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 12:22:34 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Typography]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/2008/08/14/the-holy-grail-of-css/</guid>
		<description><![CDATA[Basic tasks are simple in CSS, but even slightly harder tasks can be incredibly difficult. Controlling fonts, margins, and so forth is a piece of cake. But controlling page layout is another matter. In his book Refactoring HTML, Elliotte Rusty Harold describes a technique as
so tricky that it took any smart people quite a few [...]]]></description>
			<content:encoded><![CDATA[<p>Basic tasks are simple in <abbr title="cascading style sheets, a language for specifying web page layout">CSS</abbr>, but even slightly harder tasks can be incredibly difficult. Controlling fonts, margins, and so forth is a piece of cake. But controlling page layout is another matter. In his book <a href="http://www.amazon.com/gp/product/0321503635/002-0840105-5765668?ie=UTF8&amp;tag=theende-20&amp;linkCode=xm2&amp;camp=1789&amp;creativeASIN=0321503635">Refactoring HTML</a>, Elliotte Rusty Harold describes a technique as</p>
<blockquote><p>so tricky that it took any smart people quite a few years of experimentation to develop the technique show here.  In fact, so many people searched for this while believing that it didn&#8217;t actually exist that this technique goes under the name &#8220;The Holy Grail.&#8221;</p></blockquote>
<p>What is the incredibly difficult task that took so many years to discover? Teaching a web browser to play chess using only style sheets? No, three column layout. I kid you not. He goes on to say</p>
<blockquote><p>The goal is simple: two fixed-width columns on the left and the right and a liquid center for the content in the middle.  (That something so frequently needed was so hard to invent doesn&#8217;t speak well of CSS as a language, but it s the language we have to work with.)</p></blockquote>
<p>You can read more about the Holy Grail of CSS in an <a href="http://www.alistapart.com/articles/holygrail">article by Matthew Levine</a>.</p>
<p>I appreciate the advantages of CSS, though I do wish it didn&#8217;t have such a <a href="http://www.google.com/url?sa=t&amp;ct=res&amp;cd=1&amp;url=http%3A%2F%2Fwww.joelonsoftware.com%2Farticles%2FLordPalmerston.html&amp;ei=7SKkSKPQDoi0eayO3SA&amp;usg=AFQjCNEUT4Kp0VCcYXO2wQqz1aGHSz6yrg&amp;sig2=ZL_g6EiIuMDC01NP3kdcnQ">hockey stick learning curve</a>. I&#8217;ve heard people say not to bother learning overly difficult technologies because if you find it too difficult, so will everyone else and it will die off. But CSS seems to be firmly established with no competitor.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2008/08/14/the-holy-grail-of-css/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>LaTeX and PowerPoint presentations</title>
		<link>http://www.johndcook.com/blog/2008/07/24/latex-and-powerpoint-presentations/</link>
		<comments>http://www.johndcook.com/blog/2008/07/24/latex-and-powerpoint-presentations/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 05:28:25 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Typography]]></category>
		<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[MS Office]]></category>
		<category><![CDATA[PDF]]></category>

		<guid isPermaLink="false">http://www.johndcook.com/blog/2008/07/24/latex-and-powerpoint-presentations/</guid>
		<description><![CDATA[I use LaTeX for math documents and PowerPoint for presentations. When I need to make a math presentation, I can&#8217;t have everything I want in one environment. I usually go with PowerPoint.
Yesterday I tried the LaTeX Beamer package based on a friend&#8217;s recommendation. I believe I&#8217;ll switch to using this package as my default for [...]]]></description>
			<content:encoded><![CDATA[<p>I use LaTeX for math documents and PowerPoint for presentations. When I need to make a math presentation, I can&#8217;t have everything I want in one environment. I usually go with PowerPoint.</p>
<p>Yesterday I tried the LaTeX Beamer package based on a friend&#8217;s recommendation. I believe I&#8217;ll switch to using this package as my default for math presentations. Here are my notes on my experience with Beamer.</p>
<p><strong><em>Installation</em></strong></p>
<p>Beamer is available from <a href="https://sourceforge.net/projects/latex-beamer/">SourceForge</a>. The installation instructions begin by saying “Put all files somewhere where TeX can find them.” This made me think Beamer would be another undocumented software package, but just a few words later the instructions point to a 224-page PDF <a href="http://www.ctan.org/tex-archive/macros/latex/contrib/beamer/doc/beameruserguide.pdf">manual</a> with plenty of detail. However, I would recommend a couple minor corrections to the documentation.</p>
<ol>
<li>The manual says that if you want to install Beamer under MiKTeX, use the update wizard. But the update wizard will only update packages already installed. To install new packages with MiKTeX, use the Package Manager. (Command line <code>mpm.exe</code> or GUI <code>mpm_mfc.exe</code>.)</li>
<li>The manual says to install <code>latex-beamer</code>, <code>pgf</code>, and <code>xcolor</code>. The Package Manager shows no <code>latex-beamer</code> package, but does show a <code>beamer</code> package.</li>
</ol>
<p>The installation went smoothly overall. However, the MiKTeX Package Manager doesn&#8217;t let you know when packages have finished installing. You just have to assume when it quits giving new messages that it must be finished. At least that was my experience using the graphical version.</p>
<p><strong><em>Using Beamer</em></strong></p>
<p>I found Bruce Byfield&#8217;s <a href="http://www.linux.com/feature/120746">introduction to Beamer</a> helpful. The Beamer package is simple to use and well documented.</p>
<p>It&#8217;s nice to use real math typography rather than using PowerPoint hacks or pasting in LaTeX output as images. I also like animating bullet points simply by adding <code>\pause</code> to the end of an enumerated item.</p>
<p><strong><em>Inserting images</em></strong></p>
<p>The biggest advantage that PowerPoint has over LaTeX is working with images. With PowerPoint you can:</p>
<ol>
<li>Paste images directly into your presentations.</li>
<li>Edit files in place.</li>
<li>Carry around your entire presentation as a single file.</li>
<li>Include multiple image formats in a consistent way.</li>
</ol>
<p>The last point may not seem like much until you&#8217;ve tried to figure out <a href="http://www.johndcook.com/blog/2008/07/24/including-images-in-latex-files/">how to include images in LaTeX</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johndcook.com/blog/2008/07/24/latex-and-powerpoint-presentations/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

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

