Tuesday, 17 September 2013

LaTeX: Itemize and Enumerate

Previously, we talk about paragraph, spacing, and indentation. What about listing in $\mathrm{\LaTeX}$?

Just like MS Word, $\mathrm{\LaTeX}$ has both bullet and alphanumeric environment for listing. Bullet listing is constructed inside the itemize domain. For example,

The codes above generate list with sublists. The outer list uses bullet for entries (Line 5 and Line 14) while the sublists (Line 7-12 and Line 16-20) use hyphen. The itemize domain can have up to three nested lists, each with a particular character for entries. Here is something worth to explore,

This returns Output 1, the first list with entries Line 5-6 uses bullets, then a sublist under Line 6 with two entries (Line 8-9) uses hyphen, another subsublist uses asterisk, and further down to subsubsublist, dot or period is utilize. If we go further to the fourth nested list we get error that says, "Too deeply nested".

Saturday, 14 September 2013

LaTeX: Paragraph, Spacing, and Indentation

Let us visit the history of Statistics (source here), and utilize this for demonstrations of paragraph, spacing, and indentation in $\mathrm{\LaTeX}$. Consider the following:

Output 1
Executing these, we will have Output 1. This is the simplest way we can do to separate multiple paragraphs in $\mathrm{\LaTeX}$. That is, by allotting single white space between them (paragraph), or that is two white spaces from the last line of the preceding paragraph.

Output 2
To extend the distance between passages, say into double line spacing, just put \\ at every end of it and you will have Output 2. Hence from the above codes, the first paragraph will end with Ibrahim Al-Kadi.\\, second with element in history.\\, and so on. There is option for the magnitude of space, say 0.5 centimeter, or 0.2 inch spacing is achieve by \\[0.5cm] and \\[0.2in], respectively. Now what happen when white spaces are omitted on the above codes, and leave \\ at the end of every paragraphs? I want you to explore that.

I have shown you the manual procedure so far. Manual in the sense that, every time we want space between the passages we manually put \\[option] with optional option. We can actually declare spacing globally, and that is by setting the length of \parskip, for example \setlength{\parskip}{0.3cm} extends 0.3 centimeter space between the paragraphs.

Any declaration within the preamble is considered global, and any declaration within the body is considered local.

What about the spacing between the lines? How can we modify this?

Monday, 9 September 2013

LaTeX: Introduction - First Document

Let us start with a simple $\mathrm{\LaTeX}$ document. Open your text editor (Texmaker, TeXnicCenter, TeXworks, etc.), then go to File>New, and paste the following:

Save this and make sure the file has .tex extension. You should have something like this
SampleTeX.tex in Texmaker
In Texmaker: Press F1 to compile and view the output (Mac users should manually click the blue right arrow next to the paste button, because F1 won't work). The output is in PDF format with text on the top-left corner of the page that says the statement in Output 1. Now let us investigate these line by line. $\mathrm{\LaTeX}$ document always starts with \documentclass which sets the document you are to create. In this case the document class is article, {article}, with font size option set to 12 point, [12pt].
Output 1: SampleTeX.tex

All $\mathrm{\LaTeX}$ tag always start with backslash (\), use braces ({}) to enclose arguments, and brackets ([]) to enclose options of the arguments.

Click here for list of document classes and options. Proceeding to the third line, we declare the beginning of our document. This implies that anything between this line and its corresponding end (\end{document}) will be included in the output.

The block of codes from \documentclass[12pt]{article} to the line before the \begin{document} is sometimes called the preamble. This is where you setup the properties of your document.

Saturday, 7 September 2013

LaTeX: Download and Installation

Are you using MS Word for your paper works? And MS PowerPoint for your presentations? Why not try something that is FREE, powerful than those commercial products? Something that is quite challenging but FUN to use. Introducing $\mathrm{\LaTeX}$, a document markup language similar to HTML but outputs in PDF format.

I prefer $\mathrm{\LaTeX}$ because it produces beautiful mathematical equations that MS Word cannot. $\mathrm{\LaTeX}$ is used by publishers like O'Reilly and Springer for books that involve mathematics and statistics.

Now let me guide you on getting started with $\mathrm{\LaTeX}$ on Windows, Mac and Ubuntu.

For Windows users:
  • Go to this site, download what is recommended for your system;
  • follow the instructions in installation; after that,
  • download the TeXMaker here, and install. (TeXMaker is a $\mathrm{\LaTeX}$ text-editor with many features including syntax highlighting)
For Mac users:
  • Go to this site, download the MacTeX.pkg;
  • follow the instructions in installation; after that,
  • download the TeXMaker here, and install.
For Ubuntu users:
  • Open Ubuntu Software Center, search for TeXMaker, then click Install. (This will install TeXlive as well)

We will start with our first $\mathrm{\LaTeX}$ document in my next post.

Friday, 6 September 2013

C/C++: Frequency Distribution

The first 40 raw data of Systolic Blood pressure (in mmHg) of Simplified Biostatistics by Abubakar S. Asaad is utilize in the demonstration below.


C Codes:

C++ Codes: