sttp/latex/examples/final.tex
changeset 0 27e1f5bd2774
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sttp/latex/examples/final.tex	Tue Mar 02 18:43:02 2010 +0530
@@ -0,0 +1,199 @@
+%hello.tex - First LaTeX document
+\documentclass[11pt,a4paper,twoside]{article}
+
+\usepackage{graphicx}
+\usepackage{listings}
+\usepackage{amsmath}
+
+\lstset{language=Python, showstringspaces=false}
+\bibliographystyle{plain}
+
+\title{LaTeX - A Two Hour Introduction}
+\author{The FOSSEE Team}
+\date{August 2009}
+
+
+\begin{document}
+\maketitle
+\tableofcontents
+\listoftables
+\listoffigures
+\begin{abstract}
+This is a sample document to be used in the STTP course for a quick introduction to \LaTeX
+\end{abstract}
+\section{Introduction}
+LaTeX is a typesetting program used to produce excellently typeset documents. It is extensively used for producing high quality scientific and mathematical documents. It may also be used for producing other kinds of documents, ranging from simple one page articles or letters 
+\section{Structural Elements}
+Let us now look at giving a better structure to our document. 
+\subsection{documentclass}
+The \verb+documentclass+ variable tells \LaTeX, the type of document we wish to prepare. 
+
+\subsection{Sections, Chapters and Parts}
+We shall first look at how to divide the document into Sections, Chapters and Parts. 
+
+\subsubsection{Appendices}
+I can't tell you how to add an appendix, in the main document. Refer Appendix \ref{append} to see how to do it. 
+
+\section{Text Typesetting}
+\begin{itemize}
+\item Now we move onto some elementary \emph{Text Typesetting}.
+
+\item How do we get \emph{emphasized or italic text}?
+
+\item \emph{Did you wonder what happens when we try \emph{emphasizing text} within \emph{emphasized text}}?
+
+\item ``Beautiful is better than ugly.''
+
+\item `In the face of ambiguity, refuse the temptation to guess.'
+
+\item LaTeX has 4 different types of dashes. The names of these dashes are: `-' hyphen, `--' en-dash, `---' em-dash and `$-$' minus sign. \footnote{We shall look at how to do math in a later section}
+
+\item \LaTeX has \verb+enumerate+, \verb+itemize+ and \verb+description+ commands to generate lists. 
+
+\end{itemize}
+
+\begin{flushleft}This is left flushed text. \LaTeX normally produces text with no white space at the end of the line. But, this text isn't so, if you can see.\end{flushleft}
+\begin{flushright}Similarly, Right-aligned Text here\end{flushright}
+\begin{center} and centered text here.\end{center}
+
+\begin{description}
+  \item[Description] This list is a description list. 
+  \item[Enumerate] Numbered lists are often useful.
+    \begin{enumerate}
+    \item First
+    \item Second
+    \item Third
+    \item \ldots
+    \end{enumerate}
+  \item[Itemize] The list above this description list is an itemize list.
+\end{description}
+
+\subsection{Quotes \& Verbatim Text}
+Since the \emph{Zen of Python} instructs that, 
+\begin{quote}
+Readability counts.
+\end{quote}
+we use the \verb+quote+ environment to include quotes. 
+
+\begin{verbatim}
+def signum( r ):
+    """returns 0 if r is zero
+    -1 if r is negative
+    +1 if r is positive"""
+    if r < 0:
+        return -1
+    elif r > 0:
+        return 1
+    else:
+        return 0
+\end{verbatim}
+
+\section{Tables \& Figures}
+
+\begin{table}[h]
+\caption{A simple table, on making tables}
+\centering
+\begin{tabular}{|c|c|}
+  \hline
+  \verb+l+ & left justified column content\\ 
+  \hline
+  \verb+r+ & right justified column content\\ 
+  \hline
+  \verb+c+ & centered column content\\ 
+  \hline
+  \verb+*{n}{col}+ & produces \verb+n+ columns with the\\
+                   & \verb+col+ type of formatting\\
+  \cline{2-2}
+                   &\verb+*{3}{c}+ is the same as \verb+{c c c}+ \\
+  \hline
+  \verb+|+ & produces a vertical line\\ 
+  \hline
+\end{tabular}
+\end{table}
+
+\begin{figure}
+\centering
+\caption[CTAN Lion]{CTAN lion drawing by Duane Bibby; thanks to www.ctan.org}
+\label{fig:lion}
+\includegraphics[scale=0.8, angle=30]{lion_orig.png}
+\end{figure}
+
+List of Tables and List of figures can be autogenerated suigng the \verb+\listoftables+ and \verb+\listoffigures+ commands. Let's insert them after the table of contents. 
+
+Cross referencing is one of the best features of \LaTeX. The CTAN lion has the figure number \ref{fig:lion} and is on page number \pageref{fig:lion}
+
+It was drawn by Duane Bibby, a well-known commercial artist. He used this lion in the illustrations for Donald Knuth's original TeXbook\cite{Knuth84}, for Leslie Lamport's LaTeX book\cite{Lamport94}, and for other books having to do with TeX, so his work is familiar to everyone in the community. 
+
+%% \begin{thebibliography}{99}
+%%   \bibitem{Knuth84} Donald E. Knuth (1984). \emph{The TeXbook} (Computers and Typesetting, Volume A). Reading, Massachusetts: Addison-Wesley. ISBN 0-201-13448-9.
+  
+%%   \bibitem{Lamport94} Lamport, Leslie (1994). \emph{LaTeX: A document preparation system: User's guide and reference}.
+%%      illustrations by Duane Bibby (2nd ed.). Reading, Mass: Addison-Wesley Professional. 
+%% \end{thebibliography}
+
+\section{Typesetting Math}
+The equation $F=m \cdot a$ is an equation, that has been set inline. 
+Equation \eqref{force} is the same equation typeset in the display style. Note, that it is also numbered. 
+\begin{equation}
+\label{force}
+F=m\cdot a
+%%\tag{Fore-acceleration}
+\end{equation}
+More equations --- vertically aligned. 
+
+\begin{align}
+\alpha^2 + \beta^2 &= \gamma^2 \\
+\sum_{i=1}^ni &= \frac{n(n+1)}{2}\\
+\sqrt{-1} &= \pm1 \nonumber \\
+y &= \frac{r_1^2-r_3^2-x^2+(x-i)^2+j^2}{2j} \nonumber \\
+  &= \frac{r_1^2-r_3^2+i^2+j^2}{2j}-\frac{i}{j}x \\
+\end{align}
+
+\begin{equation*}
+s(t) = \left\{
+ \begin{array}{rl}
+   0 & \text{if } t \le 0\\
+   1 & \text{if } t > 0
+ \end{array} \right.
+\end{equation*}
+
+\begin{equation*}
+\mathbf{X} = \left(
+ \begin{array}{ccc}
+ a_1 & a_2 & \ldots \\
+ b_1 & b_2 & \ldots \\
+ \vdots & \vdots & \ddots
+ \end{array} \right)
+\end{equation*}
+
+\begin{equation}
+  \begin{matrix}
+  1 & 2 \\
+  3 & 4
+  \end{matrix} \qquad \& \qquad 
+  \begin{bmatrix}
+  1 & 2 & 3 \\
+  4 & 5 & 6 \\
+  7 & 8 & 9
+  \end{bmatrix}
+\end{equation}
+
+\section{Miscellaneous}
+\subsection{Presentations}
+\subsection{Including Code}
+\begin{lstlisting}
+string="Hello, World! "
+for i in range(10):
+    print string*i
+\end{lstlisting} 
+\subsection{Including files}
+\input{final-include}
+
+\bibliography{final}
+
+\appendix
+\section{Appendices - How to}
+\label{append}
+Every Part, Chapter or Section that follows the \verb+\appendix+ command is included in the appendix. Appendices have auto numbering too. The numbering begins freshly in the appendices. 
+
+\end{document}