Monday 13 April 2009

LaTeX Introduction 4: Simple Math 2

This tutorial is still on simple mathematical expression. Processing document using Latex is very different from using proprietary word processing software which is based on GUI (Graphical User Interface). Using Latex, what you see in winEdt is not the final result you will get. Always compile the document after you make make any change and see the result.

Try this template first and after that do make exploration by yourself.


\documentclass[11pt]{article}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{latexsym}

\setlength{\textwidth}{16cm}
\setlength{\hoffset}{-2cm}
\setlength{\textheight}{24.5cm}
\setlength{\voffset}{-2cm}

\setlength{\parindent}{0cm}
\addtolength{\parskip}{2mm}

\newcommand{\R}{\mathbb{R}} % What is this ?

\pagestyle{empty}

\begin{document}

\leftline{{\bf Demo 4 \hfill LEARNING \LaTeX{}}} % Header for first page different way with demo 3

\medskip % This is for medium skip

\leftline{{\bf 2008 -- 2009}}

\bigskip

\centerline{\bf Demo \LaTeX{} 4}

\bigskip

\subsection*{Some common mistakes}

\begin{itemize}
\item Always put numerals in math mode. Thus, do $27.3$, not 27.3.
\emph{When you have numerals like 27.3 in emphasized text, you usually want them in roman,
like $27.3$, not emphasized.} Also, a negative number, -273, will look wrong if left in
text mode. In math mode you get a proper minus sign $-273$.

When giving a range, $200-300$ will look like a subtraction. Here you can do
$200$-$300$ if you prefer. Notice the difference in the various dashes:
one dash is $200$-$300$, two dashes is $200$--$300$, three dashes is
$200$---$300$.

For numerals with units you can do $42\text{km}^2$.

\item Avoid blank lines around displays. Thus do not do
\begin{verbatim} % Hurufnya verbatim dan menampilkan apa adanya tanpa mengeksekusi perintah
For $W_1 = \{(q_1,\,0,\,0,\,0)\st q_1\in\R\}$ we have

$$
W_1^\perp = \{(q_1,\,q_2,\,0,\,p_2)\st q_1, q_2, p_2\in\R\}.
$$

For $W_2 = \{(q_1,\,q_2,\,0,\,0)\st q_1,q_2\in\R\}$ we have
% baris kosong tidak boleh
$$
W_2^\perp = \{(q_1,\,q_2,\,0,\,0)\st q_1, q_2 \in\R\} = W_2.
$$
\end{verbatim}
If you want to `set off' displays in your tex file, do this:
\begin{verbatim}
For $W_1 = \{(q_1,\,0,\,0,\,0)\st q_1\in\R\}$ we have
% % Untuk menampilkan spasi kosong hendaknya pakai % saja jangan dibiarkan kosong
$$
W_1^\perp = \{(q_1,\,q_2,\,0,\,p_2)\st q_1, q_2, p_2\in\R\}.
$$
%
For $W_2 = \{(q_1,\,q_2,\,0,\,0)\st q_1,q_2\in\R\}$ we have
%
$$
W_2^\perp = \{(q_1,\,q_2,\,0,\,0)\st q_1, q_2 \in\R\} = W_2.
$$
\end{verbatim}
\end{itemize}


\end{document}

Sunday 12 April 2009

LaTEX Introduction 3: Section and subsection

It is relatively easy to handle structure of document in LaTEX especially on section and sub section management. Try the following template and do make self experiment.

\documentclass[11pt]{article}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{latexsym}

\setlength{\textwidth}{16cm}
\setlength{\hoffset}{-2cm}
\setlength{\textheight}{24.5cm}
\setlength{\voffset}{-2cm}

\setlength{\parindent}{0cm}
\addtolength{\parskip}{2mm}

\begin{document}
\leftline{\textbf{Demo LaTEX 3}\hfill \textbf{2008 -- 2009}} % print the left and right text

\begin{center}
\Large\textbf{Demonstration 3: Sections and Sub Sections}
\end{center}

\bigskip

% \section*{Introduction}

\section{Basic definitions and examples}
One more advantage of LaTEX is in section and subsection handling. This is section 1. You do not need to print number of chapter and LaTEX will set it automatically.


\section{First results}
This is section 2.

\subsection{The situation in the 20th century}
This subsection 2.1

\subsection{Recent developments}
This is subsection 2.2

\section{More results}

This is section 3

\section{Concluding Remarks}
This is section 4
% \tableofcontents


\end{document}