Added lab workbook and related files.
authorPuneeth Chaganti <punchagan@fossee.in>
Tue, 31 Aug 2010 18:52:49 +0530
changeset 107 80a8b46754f8
parent 106 43ca1381dbef
child 108 d90e054894cd
Added lab workbook and related files.
latex/lab-workbook.tex
latex/workbook/bibtex.rst
latex/workbook/example1.tex
latex/workbook/example10.tex
latex/workbook/example2.tex
latex/workbook/example3.tex
latex/workbook/example4.tex
latex/workbook/example5.tex
latex/workbook/example6.tex
latex/workbook/example7.tex
latex/workbook/example8.tex
latex/workbook/example9.tex
latex/workbook/lion_orig.png
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/latex/lab-workbook.tex	Tue Aug 31 18:52:49 2010 +0530
@@ -0,0 +1,133 @@
+% Created 2010-08-31 Tue 18:51
+\documentclass[11pt]{article}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{fixltx2e}
+\usepackage{graphicx}
+\usepackage{longtable}
+\usepackage{float}
+\usepackage{wrapfig}
+\usepackage{soul}
+\usepackage{textcomp}
+\usepackage{marvosym}
+\usepackage{wasysym}
+\usepackage{latexsym}
+\usepackage{amssymb}
+\usepackage{hyperref}
+\tolerance=1000
+\providecommand{\alert}[1]{\textbf{#1}}
+
+\title{Lab Workbook --- \LaTeX}
+\author{FOSSEE}
+\date{August, 2010}
+
+\begin{document}
+
+\maketitle
+
+\setcounter{tocdepth}{3}
+\tableofcontents
+\vspace*{1cm}
+
+\section{Lab-1}
+\label{sec-1}
+
+
+\begin{enumerate}
+\item Compile and produce a pdf output of \texttt{example1.tex}.
+\item Modify \texttt{example1.tex} replacing \texttt{LaTeX} with \texttt{\textbackslash{}LaTeX}.
+\item Add a title, author and date to the document.
+\item What happens if \texttt{\textbackslash{}date} is replaced by \texttt{\textbackslash{}date\{IIT, Bombay\}} ?
+\item Debug and compile examples 2, 3, 4, 5
+\item Provide a document (pdf and source) with a TOC, but has been
+     compiled only once. Exercise for Debugging.
+\item What happens when you add the following \LaTeX{} code to the
+     document from the previous question? 
+     
+\begin{verbatim}
+      \renewcommand{\contentsname}{What is Here?}
+\end{verbatim}
+
+\item Experiment with setting the secnumdepth counter to 1, 0, -1.
+\item Debug and compile example 6.
+\item Experiment with the options of \texttt{\textbackslash{}documentclass}.
+
+\begin{itemize}
+\item 10pt, 11pt, 12pt sets the size of the text of the document.
+\item onecolumn, twocolumn
+\item draft --- makes \LaTeX{} highlight problems in typesetting to
+        be looked at by a human.
+\end{itemize}
+
+\end{enumerate}
+\section{Lab-2}
+\label{sec-2}
+
+
+\begin{enumerate}
+\item \texttt{\textbackslash{}newpage} command adds a page break. Add some page breaks to
+     example 6 and see how the command works.
+\item Try out the commands \texttt{\textbackslash{}pagestyle} and \texttt{\textbackslash{}thispagestyle} with the
+     following parameters and look at the outputs obtained.
+
+\begin{itemize}
+\item \texttt{empty},
+\item \texttt{plain},
+\item \texttt{heading}
+\end{itemize}
+
+\item Add the following description list describing the options to
+     \texttt{\textbackslash{}includegraphics} command to a document and look at the output. 
+
+\begin{verbatim}
+\begin{description}
+\item[{\texttt{width=x}, \texttt{height=x}}] 
+If only the height or width is specified, the image is scaled, maintaining the aspect ratio.
+
+\item[{\texttt{keepaspectratio}}]  
+This parameter can either be set to true or false. When set to true, the image is scaled according to both width and height, without changing the aspect ratio, so that it does not exceed both the width and the height dimensions.
+
+\item[{\texttt{angle=x}}] 
+This option can be used to rotate the image by \texttt{x} degrees, counter-clockwise.
+
+\end{description}
+\end{verbatim}
+\item \texttt{\textbackslash{}ldots} is used to get ellipsis in \LaTeX{} documents.
+\item Read the manual of listings package and learn how to include a
+     set of lines from a file into a \LaTeX{} document. Include a few
+     lines from your previous lab exercises of ULT.
+\item To change the line spacing of your document
+     \texttt{\textbackslash{}usepackage\{setspace\}} and then specify the line spacing of
+     your document, using \texttt{\textbackslash{}doublespace}, \texttt{\textbackslash{}onehalfspace}, etc.
+\item Debug and compile examples 9, 10
+\end{enumerate}
+\section{Lab-3}
+\label{sec-3}
+
+
+\begin{enumerate}
+\item Debug and compile example 7.
+\item BibTeX is another way of handling bibliography. Look at
+       bibtex.rst and change draft.tex to use BibTeX.
+\item As you would've already observed, \LaTeX{} compilation produces a
+       lot of other files along with the pdf output.
+
+\begin{itemize}
+\item .log --- gives a log of what happened during last
+         compilation.
+\item .toc --- stores section headers. Edit this file and observe
+         changes in this document to see how the compilation of \LaTeX{}
+         works and why two compilations are required for table of
+         contents to work.
+\item .aux --- used to share information between consecutive
+         compiler runs.
+\end{itemize}
+
+\item Prepare a presentation in beamer with solutions to any 10
+       problems from the Lab workbook.
+\item Debug and compile example 8.
+\item Finish the incomplete parts of the draft to obtain the complete
+       output of the sample document that we started out to prepare.
+\end{enumerate}
+
+\end{document}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/latex/workbook/bibtex.rst	Tue Aug 31 18:52:49 2010 +0530
@@ -0,0 +1,35 @@
+BibTeX
+~~~~~~
+
+The previous section explained the process of listing references at the end of a document and embedding cross references. In this section let us explore the BibTeX environment for keeping track of references.
+
+Using BibTeX is a very convenient method to use, when writing multiple documents in a single area or field. BibTeX allows you to create a database of all your references and use them as and when required. 
+
+The BibTeX database is stored in a ``.bib`` file. The structure of the file is quite simple and an example is shown below. 
+::
+
+  @book{Lamport94,
+  author    = "Leslie Lamport",
+  title     = "A Document Preparation System: User's Guide and Reference",
+  publisher = "Addison-Wesley Professional",
+  year      = "1994",
+  edition    = "second",
+  note      = "illustrations by Duane Bibby"
+  }
+
+Each bibliography entry starts with a declaration of the type of the reference being mentioned. The reference is in the above example is of the book type. BibTeX has a wide range of reference types, for example, ``article, book, conference, manual, proceedings, unpublished``.
+
+The type of reference is followed by a left curly brace, and immediately followed by the citation key. The citation key, ``Lamport94`` in the example above is used to cite this reference using the command ``\cite{Lamport94}``. 
+
+This is followed by the relevant fields and their values, listed one by one. Each entry must be followed by a comma to delimit one field from the other. 
+
+To get your LaTeX document to use the bibliography database, you just add the following lines to your LaTeX document. 
+::
+
+  \bibliographystyle{plain}
+  \bibliography{LaTeX}
+
+Bibliography styles are files that tell BibTeX how to format the information stored in the ``.bib`` database file. The style file for this example is ``plain.bst``. Note that you do not need to add the ``.bst`` extension to the filename.  If you wish to achieve a particular style of listing the bibliography items and citing them, you should use an appropriate style file. 
+
+The ``bibliography`` command specifies the file that should be used as the database for references. The file used in this example is ``LaTeX.bib``
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/latex/workbook/example1.tex	Tue Aug 31 18:52:49 2010 +0530
@@ -0,0 +1,4 @@
+\documentclass{article}
+\begin{document}
+This is my first LaTeX document. 
+\end{document}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/latex/workbook/example10.tex	Tue Aug 31 18:52:49 2010 +0530
@@ -0,0 +1,19 @@
+\documentclass{article}
+\begin{document}
+This is my simple document with nested lists. 
+\begin{enumerate}
+\item First Enumerated Item. 
+\item Second Enumerated Item. 
+\item Third Enumerated Item. 
+  \begin{itemize}
+  \item First Item.
+  \item Second Item.
+  \item Third Item.
+    \begin{itemize}
+    \item First Sub-Item.
+    \item Second Sub-Item.
+    \item Third Sub-Item.
+    \item Fourth Sub-Item.
+    \end{itemize}
+\end{enumerate}
+\end{document}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/latex/workbook/example2.tex	Tue Aug 31 18:52:49 2010 +0530
@@ -0,0 +1,26 @@
+\documentclass{article}
+\title{Python}
+\author{Wikipedia}
+\maketitle
+\begin{document}
+Python is a general-purpose high-level programming language whose
+design philosophy emphasizes code readability. Python aims to combine
+"remarkable power with very clear syntax", and its standard library is
+large and comprehensive. Its use of indentation for block delimiters
+is unusual among popular programming languages.
+
+Python supports multiple programming paradigms, primarily but not
+limited to object oriented, imperative and, to a lesser extent,
+functional programming styles. It features a fully dynamic type system
+and automatic memory management, similar to that of Scheme, Ruby,
+Perl, and Tcl. Like other dynamic languages, Python is often used as a
+scripting language, but is also used in a wide range of non-scripting
+contexts. 
+
+The reference implementation of Python (CPython) is free and open
+source software and has a community-based development model, as do all
+or nearly all of its alternative implementations. CPython is managed
+by the non-profit Python Software Foundation.
+
+This content is from Wikipedia's Python page. 
+\end{document}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/latex/workbook/example3.tex	Tue Aug 31 18:52:49 2010 +0530
@@ -0,0 +1,23 @@
+\documentclass{article}
+\begin{document}
+Python is a general-purpose high-level programming language whose
+design philosophy emphasizes code readability.[3] Python aims to
+combine "remarkable power with very clear syntax",[4] and its standard
+library is large and comprehensive. Its use of indentation for block
+delimiters is unusual among popular programming languages. 
+
+Python supports multiple programming paradigms, primarily but not
+limited to object oriented, imperative and, to a lesser extent,
+functional programming styles. It features a fully dynamic type system
+and automatic memory management, similar to that of Scheme, Ruby,
+Perl, and Tcl. Like other dynamic languages, Python is often used as a
+scripting language, but is also used in a wide range of non-scripting
+contexts. 
+
+The reference implementation of Python (CPython) is free and open
+source software and has a community-based development model, as do all
+or nearly all of its alternative implementations. CPython is managed
+by the non-profit Python Software Foundation.
+
+This content is from Wikipedia's Python page. 
+\end{docment}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/latex/workbook/example4.tex	Tue Aug 31 18:52:49 2010 +0530
@@ -0,0 +1,11 @@
+\documentclass{article}
+\title{A Glimpse at Scipy}
+\author{FOSSEE}
+date{2010}
+\begin{document}
+\maketitle
+SciPy is open-source software for mathematics, science, and
+engineering.   
+\end{document}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/latex/workbook/example5.tex	Tue Aug 31 18:52:49 2010 +0530
@@ -0,0 +1,24 @@
+\documentclass{article}
+\begin{document}
+\begin{abstract}
+  This content is from Wikipedia page on Python. 
+\end{abstract}
+Python is a general-purpose high-level programming language whose
+design philosophy emphasizes code readability. Python aims to combine
+"remarkable power with very clear syntax", and its standard library is
+large and comprehensive. Its use of indentation for block delimiters
+is unusual among popular programming languages.
+
+Python supports multiple programming paradigms, primarily but not
+limited to object oriented, imperative and, to a lesser extent,
+functional programming styles. It features a fully dynamic type system
+and automatic memory management, similar to that of Scheme, Ruby,
+Perl, and Tcl. Like other dynamic languages, Python is often used as a
+scripting language, but is also used in a wide range of non-scripting
+contexts. 
+
+The reference implementation of Python (CPython) is free and open
+source software and has a community-based development model, as do all
+or nearly all of its alternative implementations. CPython is managed
+by the non-profit Python Software Foundation.
+\end{document}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/latex/workbook/example6.tex	Tue Aug 31 18:52:49 2010 +0530
@@ -0,0 +1,31 @@
+%hello.tex - First LaTeX document
+\documentclass[12pt]{article}
+
+\title{LaTeX}
+\author{The FOSSEE Team}
+\date{August 2010}
+
+\begin{document}
+\maketitle
+\tableofcontents
+
+\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.
+
+\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. 
+
+\end{document}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/latex/workbook/example7.tex	Tue Aug 31 18:52:49 2010 +0530
@@ -0,0 +1,13 @@
+\documentclass{article}
+\begin{document}
+This is my first LaTeX document. 
+\begin{equation}
+  a^2 + b^2 = c^2 
+\end{equation}
+\[
+\begin{pmatrix}
+\alpha& \beta^{*}\\
+\gamma^{*}& \delta
+\end{pmatrix}
+\]
+\end{document}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/latex/workbook/example8.tex	Tue Aug 31 18:52:49 2010 +0530
@@ -0,0 +1,176 @@
+\documentclass[english]{beamer}
+
+% generated by Docutils <http://docutils.sourceforge.net/>
+\usepackage{fixltx2e} % LaTeX patches, \textsubscript
+\usepackage{cmap} % fix search and cut-and-paste in PDF
+\usepackage{babel}
+\usepackage[T1]{fontenc}
+\usepackage[latin1]{inputenc}
+\usepackage{listings}
+\usepackage{amsmath}
+\lstset{
+  language=TeX,
+  basicstyle=\small\ttfamily,
+  commentstyle=\ttfamily\color{blue},
+  stringstyle=\ttfamily\color{orange},
+  showstringspaces=false,
+  breaklines=true,
+  postbreak = \space\dots
+}
+
+\usepackage{ifthen}
+\usepackage{longtable}
+\usepackage{array}
+\setlength{\extrarowheight}{2pt}
+\newlength{\DUtablewidth} % internal use in tables
+
+\mode<presentation>
+{
+  \usetheme{Warsaw}
+  \useoutertheme{infolines}
+  \setbeamercovered{transparent}
+}
+
+
+\title{\LaTeX}
+\author[FOSSEE] {FOSSEE}
+\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT
+  Bombay}
+\date{}
+
+%% Delete this, if you do not want the table of contents to pop up at
+%% the beginning of each subsection:
+\AtBeginSubsection[]
+{
+  \begin{frame}<beamer>
+    \frametitle{Outline}
+    \tableofcontents[currentsection,currentsubsection]
+  \end{frame}
+}
+
+\AtBeginSection[]
+{
+  \begin{frame}<beamer>
+    \frametitle{Outline}
+    \tableofcontents[currentsection,currentsubsection]
+  \end{frame}
+}
+
+\begin{document}
+
+% Document title
+\begin{frame}
+  \maketitle  
+\end{frame}
+
+\section{Introduction}
+
+\begin{frame}
+  \frametitle{\LaTeX~- Introduction}
+  \begin{itemize}
+  \item Typesetting program
+  \item Excellently Typeset Documents - specially Math
+  \item Anything from one page articles to books. 
+  \item Based on \TeX
+  \item Pronounced ``Lah-tech'' or ``Lay-tech''
+  \end{itemize}
+\end{frame}
+
+\begin{frame}
+  \frametitle{This Course}
+  \begin{itemize}
+  \item Look at Sample document - \texttt{sample.pdf}
+  \item The document will be produced by the end of the course. 
+  \item First Hour - Basic Structure
+  \item Second Hour - Text, Tables, Figures, References
+  \item Third Hour - Math, Bibliography, Presentations
+  \end{itemize}
+\end{frame}
+
+
+\begin{frame}
+  \frametitle{A Look at the Sample Document}
+  \begin{itemize}
+  \item Title, Author, Date
+  \item Abstract
+  \item Sections
+  \item Subsections
+  \item Appendix
+  \item References/Bibliography
+  \item Tables
+  \item Figures
+  \item Math
+  \end{itemize}
+\end{frame}
+
+\begin{frame}[fragile]
+  \frametitle{The source \& compilation}
+  Write the following code into the file \texttt{draft.tex}.
+  \begin{lstlisting}
+    \documentclass{article}
+    \begin{document}
+    SciPy is open-source software for mathematics, 
+    science, and engineering.   
+    \end{document}
+  \end{lstlisting}
+  To compile the document, do the following in your terminal: 
+  \begin{lstlisting}[language=bash]
+    $ pdflatex draft.tex
+  \end{lstlisting}
+  This produces the output file \texttt{draft.pdf} %%$
+  Note: \texttt{latex} command is often used to get \texttt{dvi}
+  output. Throughout this course, we shall use \texttt{pdflatex} to
+  compile our documents to \texttt{pdf} output.
+\end{frame}  
+
+\section{Structure of the Document}
+
+\begin{frame}[fragile]
+  \frametitle{\lstinline+documentclass+}
+  \begin{itemize}
+  \item \LaTeX~typesets based on \lstinline{documentclass}
+  \item Defines structure and formatting of a document
+  \item \LaTeX~is a document based mark-up
+  \item Mark-up --- a system of annotating text, adding extra
+    information to specify structure and presentation of text
+  \item Document based markup $\rightarrow$ you don't have to worry
+    about each element individually 
+  \item Allows you to focus on content, rather than appearance.
+  \end{itemize}
+\end{frame}
+
+\begin{frame}
+  \frametitle{Environments and Commands}
+  \lstinline{document} is an environment, present in every document. 
+  \begin{itemize}
+  \item Environments
+    \begin{itemize}
+    \item \lstinline{\begin} and \lstinline{\end} define the beginning
+      and end of an environment
+    \item All the content of the document is placed inside the
+      \lstinline{document} environment 
+    \end{itemize}
+  \item Commands
+    \begin{itemize}
+    \item All commands begin with \textbackslash
+    \item They are case-sensitive
+    \item Only alpha caracthers; other characters terminate commands
+    \end{itemize}
+  \end{itemize}
+\end{frame}
+
+
+\begin{frame}[fragile]
+  \frametitle{Top Matter}
+  Let's add the Title, Author's name and the date to the document.
+  \begin{itemize}
+  \item Add title, author and date. Compile. Nothing changes.
+  \end{itemize}
+  \begin{lstlisting}
+    \title{A Glimpse at Scipy}
+    \author{FOSSEE}
+    \date{June 2010}
+  \end{lstlisting}
+  \tiny{See \texttt{hg} rev1 of draft.}
+\end{frame}
+\end{document}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/latex/workbook/example9.tex	Tue Aug 31 18:52:49 2010 +0530
@@ -0,0 +1,11 @@
+\documentclass{article}
+\begin{document}
+This document contains a figure. 
+The figure \ref{fig:lion} is a drawing by Duane Bibby. 
+\begin{figure}
+\centering
+\label{fig:lion}
+\caption[CTAN Lion]{CTAN lion drawing by Duane Bibby; thanks to www.ctan.org}
+\includegraphics[scale=0.8, angle=30]{lion_orig.png}
+\end{figure}
+\end{document}
Binary file latex/workbook/lion_orig.png has changed