Friday, November 18, 2011

How to include HTML code snippets in an HTML file?

To have a quick reference at hand, today I was writing a note on how to include software code in my blog posts. I was listing things such as what HTML tags to use and how to use them. To make myself comfortable with HTML, I thought of writing the note as an HTML file. HTML provides <pre>. . .</pre> tags for including verbatim text in your HTML file. However, I quickly realized that any HTML code included in the <pre>. . .</pre> is not treated as verbatim text. It is executed as HTML code. I searched online and after some time, found the following solution.

Instead of using < and > to enclose HTML tags in the code snippet that you want to display, use &lt; and &gt;. For example, to display the <b>. . .</b> tags that you would use to get bold text, type:

    &lt;b&gt; . . .&lt;/b&gt;

Wednesday, November 16, 2011

Look up the LaTeX Command for a Symbol

Today I came across a post on John D. Cook's blog that mentions a really neat online utility called Detexify. You can use the utility to find the LaTeX command of a symbol by drawing the symbol with your mouse.

The following shows a screenshot from the Detexify website. I drew the symbol in the box on the left; you can see the results of that drawing on the right.