Mathematics (Latex Script)

May 18, 2007

Latex on WordPress : A Primer

Yesterday I came across a post Math for the Masses on WordPress.com, announcing the avaibility of Latex on WordPress.com . I should learn it, I thought, and started searching for good tutorials to get me started. I got good ones, particularly Short Math Guide for Latex by Michael Downes, that helped me to start. However all sources were not relevant for Latex as implemented on WordPress.com, (i.e. most of codes on beginning pages did not work on WordPress.com). I searched hard to find a tutorial that could start from start, and couldn’t. Now that I have started learning successfully, I though if I could fill this gap.

Latex is designed to help authors write the content without much worrying of how it would reproduce on page. If I had to write constantly on a single line, as I have been doing till now on this post then there is not concern but what if I need to go above or below the line. Of course HTML tags for SubScript and SuperScript would have helped but Latex does more so lets get started with Latex, the SubScript and SuperScript.

Latex code on WordPress.com post should start with and end with a . To make a character Subscript or Superscript you can add an underscore “_” or an accent “^” respectively. See codes below and their respective Latex rendering.
H_2O
H_2O

2^n+1
2^n+1

You might have noticed that only one character that immediately follows the “_” or “^” is shifted from its position. What if you wanted it to do it for more than one character say whole of n+1 above? You can achieve that by enclosing them between curly braces { } which can be used everywhere you need to group a particular set of characters and can be nested.

2^{n+1}
2^{n+1}

So these were the most basic things about latex. Latex have a number of commands that start with a backslash “\”. Here is the first command that shows the Latex logo.

\LaTeX
\LaTeX

All the Latex command are case sensitive. So if you make any mistake in that, you will end up with a error note, like below, instead of the desired and expected rendering.
\latex

Let’s get on to next command “\frac” which will help you render fractions. This command expects two values to be passed just after it. If you need to render 1/2 the command can be either of the below commands, both will render identically.
\frac12
\frac{1}{2} (For clarity)
\frac12

You can use frac command to create more complex fractions as the one below:
\frac{a+b}{c+d}
\frac{a+b}{c+d}

Now let’s add up all above to form the Compound Interest Formula.
A=P(1+\frac{R}{100})^t
A=P(1+\frac{R}{100})^t

Using “\sqrt” command you can render the Square root sign as below
h = \sqrt{l^2 + b^2}
h = \sqrt{l^2 + b^2}

sqrt command in extended form can be used to form Cube root and others too
sqrt[3]{xyz}
\sqrt[3]{xyz}

If you want to render trigonomertical formulas then “\alpha”, “\beta”, “\theta”, “\sin”, “\cos”, “\tan” etc. commands can help you get them

\sin\alpha \cos\beta \tan\theta
\sin\alpha \cos\beta \tan\theta

Found interesting? then read the PDF file link given on the top of post or visit the Latex Project site. The discussion here is sufficient to get you started with Latex and for more of advanced feature I may post sometime later, as I said the post is related to latex on WordPress.com and I cannot just blindly post all feature of Latex without confirming the working on wordpress.com Blog.


How to embed video in HTML

May 4, 2007

To embed video in HTML  use below objects. These objects are predefined and has capability of showing video and audio files.

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“>
<html>
  <head>
    <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>
    <title>Hindi Bhasha | Google Groups</title>
  </head>
  <body>
  <div>
    <OBJECT id=music height=230 width=230 classid=clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95>
      <PARAM NAME=”AutoStart” VALUE=”True”>
      <PARAM NAME=”Balance” VALUE=”0″>
      <PARAM NAME=”DisplaySize” VALUE=”1″>
      <PARAM NAME=”Filename” VALUE=”http://east.streamguys.com/WMOD-demo/sample-video.wmv“>
      <PARAM NAME=”Mute” VALUE=”0″>
      <PARAM NAME=”SelectionStart” VALUE=”-1″>
      <PARAM NAME=”SelectionEnd” VALUE=”-1″>
      <PARAM NAME=”ShowControls” VALUE=”-1″>
      <PARAM NAME=”ShowAudioControls” VALUE=”-1″>
      <PARAM NAME=”ShowDisplay” VALUE=”0″>
      <PARAM NAME=”ShowPositionControls” VALUE=”-1″>
      <PARAM NAME=”Volume” VALUE=”1″>
      <PARAM NAME=”AudioStream” VALUE=”-1″>
      <PARAM NAME=”AutoSize” VALUE=”0″>
      <PARAM NAME=”AnimationAtStart” VALUE=”-1″>
      <PARAM NAME=”AllowScan” VALUE=”-1″>
      <PARAM NAME=”AllowChangeDisplaySize” VALUE=”-1″>
      <PARAM NAME=”AutoRewind” VALUE=”1″>
      <PARAM NAME=”BaseURL” VALUE=”">
      <PARAM NAME=”BufferingTime” VALUE=”5″>
      <PARAM NAME=”CaptioningID” VALUE=”">
      <PARAM NAME=”ClickToPlay” VALUE=”-1″>
      <PARAM NAME=”CursorType” VALUE=”0″>
      <PARAM NAME=”CurrentPosition” VALUE=”-1″>
      <PARAM NAME=”CurrentMarker” VALUE=”0″>
      <PARAM NAME=”DefaultFrame” VALUE=”mainframe”>
      <PARAM NAME=”DisplayBackColor” VALUE=”1″>
      <PARAM NAME=”DisplayForeColor” VALUE=”16777215″>
      <PARAM NAME=”DisplayMode” VALUE=”1″>
      <PARAM NAME=”Enabled” VALUE=”-1″>
      <PARAM NAME=”EnableContextMenu” VALUE=”-1″>
      <PARAM NAME=”EnablePositionControls” VALUE=”-1″>
      <PARAM NAME=”EnableFullScreenControls” VALUE=”0″>
      <PARAM NAME=”EnableTracker” VALUE=”-1″>
      <PARAM NAME=”InvokeURLs” VALUE=”-1″>
      <PARAM NAME=”Language” VALUE=”-1″>
      <PARAM NAME=”PlayCount” VALUE=”1″>
      <PARAM NAME=”PreviewMode” VALUE=”0″>
      <PARAM NAME=”Rate” VALUE=”1″>
      <PARAM NAME=”SAMILang” VALUE=”">
      <PARAM NAME=”SAMIStyle” VALUE=”">
      <PARAM NAME=”SAMIFileName” VALUE=”">
      <PARAM NAME=”SendOpenStateChangeEvents” VALUE=”-1″>
      <PARAM NAME=”SendWarningEvents” VALUE=”-1″>
      <PARAM NAME=”SendErrorEvents” VALUE=”-1″>
      <PARAM NAME=”SendKeyboardEvents” VALUE=”0″>
      <PARAM NAME=”SendMouseClickEvents” VALUE=”0″>
      <PARAM NAME=”SendMouseMoveEvents” VALUE=”0″>
      <PARAM NAME=”SendPlayStateChangeEvents” VALUE=”-1″>
      <PARAM NAME=”ShowCaptioning” VALUE=”0″>
      <PARAM NAME=”ShowGotoBar” VALUE=”0″>
      <PARAM NAME=”ShowStatusBar” VALUE=”1″>
      <PARAM NAME=”ShowTracker” VALUE=”-1″>
      <PARAM NAME=”TransparentAtStart” VALUE=”1″>
      <PARAM NAME=”VideoBorderWidth” VALUE=”1″>
      <PARAM NAME=”VideoBorderColor” VALUE=”1″>
      <PARAM NAME=”VideoBorder3D” VALUE=”0″>
      <PARAM NAME=”WindowlessVideo” VALUE=”0″>
    </OBJECT>
  </DIV>
  <object classid=”CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6″
    type=”application/x-oleobject” id=”Player”
    standby=”Loading content…” codebase=”http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701“>

    <param name=”autoStart” value=”true”/>
    <param name=”balance” value=”0″/>
    <param name=”currentPosition” value=”0″/>
    <param name=”enableContextMenu” value=”false”/>
    <param name=”enabled” value=”true”/>
    <param name=”fullScreen” value=”false”/>
    <param name=”mute” value=”false”/>
    <param name=”playCount” value=”1″/>
    <param name=”rate” value=”1.0″/>
    <param name=”uiMode” value=”full”/>
    <param name=”url” value=”http://www.microsoft.com/seminar/en/20030425rpcreate/20030425RPCreate_100k.asx”/>
    <param name=”volume” value=”70″/>
  </OBJECT>
  </body>
</html>