author | Puneeth Chaganti <punchagan@fossee.in> |
Tue, 31 Aug 2010 18:49:43 +0530 | |
changeset 104 | 828c65311bdf |
parent 103 | 313bebeb7862 |
child 157 | 3174d4803cd5 |
permissions | -rw-r--r-- |
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
1 |
LaTeX |
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
2 |
===== |
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
3 |
|
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
4 |
Introduction |
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
5 |
------------ |
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
6 |
|
104 | 7 |
LaTeX is a typesetting program that produces excellently typeset |
8 |
documents. Typesetting is placing text onto a page with all the style |
|
9 |
formatting defined, so that content looks as intended. It is |
|
10 |
extensively used for producing high quality scientific and |
|
11 |
mathematical documents. It is also used for producing other kinds of |
|
12 |
documents, ranging from simple one page articles or letters to |
|
13 |
books. LaTeX is based on the TeX typesetting language. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
14 |
|
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
15 |
LaTeX is pronounced either as "Lah-tech" or "Lay-tech" |
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
16 |
|
104 | 17 |
In this course, we shall use the sample document, ``sample.pdf``, as a |
18 |
tool to learn various commands of LaTeX. By the end of the sessions on |
|
19 |
LaTeX, we will have produced a copy of that document, starting from |
|
20 |
scratch. |
|
21 |
||
22 |
A Look at the Sample Document |
|
23 |
----------------------------- |
|
24 |
||
25 |
Let's first look at the basic structure of the sample document. |
|
26 |
||
27 |
Slides with screen shots of |
|
28 |
||
29 |
* Title, Author, Date |
|
30 |
* Abstract |
|
31 |
* Sections |
|
32 |
* Subsections |
|
33 |
* Appendix |
|
34 |
* References/Bibliography |
|
35 |
* Tables |
|
36 |
* Figures |
|
37 |
* Math |
|
38 |
||
39 |
Writing the source & compiling it |
|
40 |
--------------------------------- |
|
41 |
||
42 |
Let's begin with a simple hello world, to see how to write a LaTeX |
|
43 |
document and compile it. Write the following code into the file |
|
44 |
``draft.tex``. :: |
|
45 |
||
46 |
\documentclass{article} |
|
47 |
\begin{document} |
|
48 |
SciPy is open-source software for mathematics, science, and engineering. |
|
49 |
\end{document} |
|
50 |
||
51 |
To compile the document, do the following in your terminal:: |
|
52 |
||
53 |
$ pdfLaTeX draft.tex |
|
54 |
||
55 |
This produces the output file ``draft.pdf`` |
|
56 |
||
57 |
Note: The ``LaTeX`` command is often used, instead of ``pdfLaTeX`` to |
|
58 |
get the ``dvi`` output. But, throughout this course, we shall use |
|
59 |
pdfLaTeX to compile our documents. |
|
60 |
||
61 |
``\documentclass`` |
|
62 |
------------------ |
|
63 |
||
64 |
The documentclass command, defines the structure and formatting of our |
|
65 |
document. LaTeX typsets the document, based on the documentclass. |
|
66 |
||
67 |
LaTeX is a document based markup language. |
|
68 |
||
69 |
First of all, a markup language is a system of annotating text or |
|
70 |
adding in extra information to the text that specifies it's structure |
|
71 |
or presentation. |
|
72 |
||
73 |
LaTeX is a document based markup and not an element based one. You |
|
74 |
generally don't have to worry about typesetting each of the elements |
|
75 |
of your document. Choosing an appropriate documentclass, gives you a |
|
76 |
suitable typesetting. You as an author can worry about the content of |
|
77 |
the document, rather than the appearance or presentation of the |
|
78 |
document. |
|
79 |
||
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
80 |
Why should you use it? |
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
81 |
~~~~~~~~~~~~~~~~~~~~~~ |
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
82 |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
83 |
A few reasons for using LaTeX - |
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
84 |
|
104 | 85 |
* It produces documents with excellent visual quality. |
86 |
* It does the typesetting for you, leaving you - the author - to |
|
87 |
focus on writing the content. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
88 |
* It makes writing math just as easy as writing simple text. |
104 | 89 |
* It's renowned for it's stability and a virtually bug free code |
90 |
base. |
|
91 |
* It is light on your resources as compared to most of the word |
|
92 |
processors available today. |
|
93 |
* It uses plain text files as input and can give output in a variety |
|
94 |
of formats including PDFs and html making it platform independent. |
|
56
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
95 |
* It is free software (free as in freedom) and gratis too. |
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
96 |
* It is widely used and has a large user community. |
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
97 |
|
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
98 |
|
104 | 99 |
``\begin`` and ``\end`` commands define environments. In our document, |
100 |
we have the document environment, which defines the beginning and end |
|
101 |
of the content of the document. We place all the content of the |
|
102 |
document within this environment. |
|
56
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
103 |
|
104 | 104 |
Also, as you may have noticed, all the commands in LaTeX begin with a |
105 |
``\``. Note that they are case sensitive. Command names in LaTeX |
|
106 |
usually have only alpha characters. Any characters other than alpha |
|
107 |
characters, terminate the command name. Parameters to commands are |
|
108 |
passed in ``{ }``. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
109 |
|
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
110 |
|
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
111 |
Top Matter |
104 | 112 |
---------- |
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
113 |
|
104 | 114 |
Let us begin with adding the Title, Author's name and the date to the |
115 |
document. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
116 |
|
56
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
117 |
:: |
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
118 |
|
104 | 119 |
\documentclass{article} |
120 |
\title{A Glimpse at Scipy} |
|
121 |
\author{FOSSEE} |
|
122 |
\date{June 2010} |
|
123 |
\begin{document} |
|
124 |
\maketitle |
|
125 |
SciPy is open-source software for mathematics, science, and engineering. |
|
126 |
\end{document} |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
127 |
|
104 | 128 |
We add the title, the author and the date to the document before the |
129 |
``\begin{document}`` directive. We compile the document to see if the |
|
130 |
details appear in the document, but they donot. These details do not |
|
131 |
appear in the document until we use the ``\maketitle`` command with |
|
132 |
the document environment to instruct LaTeX to place the top matter |
|
133 |
information into the document. Now the document has these details, on |
|
134 |
compiling again. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
135 |
|
104 | 136 |
If no date is specified, LaTeX automatically inserts the current date. |
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
137 |
|
104 | 138 |
Abstract |
139 |
-------- |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
140 |
|
104 | 141 |
Next we shall add an abstract to our document. LaTeX provides an |
142 |
environment, for adding an abstract to the document. :: |
|
143 |
||
144 |
\documentclass{article} |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
145 |
|
104 | 146 |
\title{A Glimpse at Scipy} |
147 |
\author{FOSSEE} |
|
148 |
\date{June 2010} |
|
149 |
||
150 |
\begin{document} |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
151 |
|
104 | 152 |
\maketitle |
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
153 |
|
104 | 154 |
\begin{abstract} |
155 |
This document shows a glimpse of the features of Scipy that will be explored during this course. |
|
156 |
\end{abstract} |
|
157 |
||
158 |
SciPy is open-source software for mathematics, science, and engineering. |
|
159 |
\end{document} |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
160 |
|
104 | 161 |
The abstract environment is placed at the location where we wish it to |
162 |
appear in the document. |
|
163 |
||
164 |
Sections |
|
165 |
-------- |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
166 |
|
104 | 167 |
Now let's look at how to add (chapters,) sections and sub-sections to |
168 |
our document. Let's add the section headings and sub headings present |
|
169 |
in our sample document to the working copy of our document. |
|
170 |
||
171 |
``\section``, ``\subsection``, ``\subsubsection`` |
|
172 |
||
173 |
On compiling, we can see that the headings of the sections and the |
|
174 |
sub-sections appear in the document. |
|
175 |
||
176 |
You may have noticed that LaTeX automatically numbers the sections. To |
|
177 |
prevent a section from getting numbered, an asterix is appended to the |
|
178 |
corresponding sectioning command. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
179 |
|
104 | 180 |
If the document was a longer document, we could have used a report or |
181 |
a book class. (Note: Books donot have the abstract environment.) Let's |
|
182 |
look at what happens to the document, when we change it to the report |
|
183 |
class. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
184 |
|
104 | 185 |
The numbering strangely begins from zero, now. This is because, |
186 |
chapters have an additional sectioning command called |
|
187 |
``\chapter``. The chapter is one level above a section and since, our |
|
188 |
document does not have a ``\chapter`` command, the sections are |
|
189 |
numbered from 0. To change this, we add a chapter command before the |
|
190 |
first section. We say:: |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
191 |
|
104 | 192 |
\chapter{One} |
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
193 |
|
104 | 194 |
Now, observe that we now have a chapter title appearing and the |
195 |
numbering starting from 1. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
196 |
|
104 | 197 |
Also, note that the subsubsections donot get a numbering now. This is |
198 |
controlled by a variable called the secnumdepth. By default it is set |
|
199 |
to 2. We can now, change it to 3 and get numbering for subsubsections |
|
200 |
also. :: |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
201 |
|
104 | 202 |
\setcounter{secnumdepth}{3} |
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
203 |
|
104 | 204 |
What do you expect to happen if we changed the secnumdepth to 1? What |
205 |
if it is 0? -1? {Lab excercise} |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
206 |
|
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
207 |
|
104 | 208 |
Appendix |
209 |
-------- |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
210 |
|
104 | 211 |
Notice that our document also has an appendix. Let's add an appendix |
212 |
to our document. |
|
213 |
||
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
214 |
:: |
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
215 |
|
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
216 |
\appendix |
104 | 217 |
\section{Plotting using Pylab} |
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
218 |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
219 |
Table of Contents |
104 | 220 |
----------------- |
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
221 |
|
104 | 222 |
Our sample document is not long enough to warrant a table of contents, |
223 |
but let us learn to add a table of contents to a LaTeX document. If |
|
224 |
you ever tried adding a table of contents, to a document in a |
|
225 |
wordprocessor, you would know how much of a trouble it is. In LaTeX, |
|
226 |
it is a matter of just one command and placing the command at the |
|
227 |
location where you would want to have the table of contents. Let's now |
|
228 |
add a table of contents to our draft. Now, compile the document and |
|
229 |
look at the output document. It does not have the table of contents! |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
230 |
|
104 | 231 |
On the first compilation only the "Contents" heading appears in the |
232 |
document, but the actual table does not appear. You will need to |
|
233 |
compile your document once more, for the actual table to appear in |
|
234 |
your document. On the first run, LaTeX has gone through your document |
|
235 |
and generated a temporary file (``.toc``), with the entries that |
|
236 |
should go into the table of contents. These entries are made, when you |
|
237 |
compile your document for the second time. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
238 |
|
104 | 239 |
Note that any section/block that has been numbered automatically |
240 |
appears in the table of contents. It is possible to get un-numbered |
|
241 |
sections, for instance a Preface or a Foreword section to appear in |
|
242 |
the Table of Contents. |
|
243 |
||
244 |
Let's change our Introduction section to be an un-numbered one and try |
|
245 |
to make it appear in the table-of-contents. :: |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
246 |
|
104 | 247 |
\section*{Introduction} |
248 |
\addcontentsline{toc}{section}{Intro} |
|
249 |
||
250 |
We shall talk about adding and managing bibliographies, later in the |
|
251 |
course. |
|
252 |
||
253 |
Now, that we have the basic structure of the document, let's get into |
|
254 |
the content and the details of it. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
255 |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
256 |
Typesetting Text |
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
257 |
---------------- |
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
258 |
|
104 | 259 |
Let's begin with adding the second paragraph to the introduction |
260 |
section. Let's place the text of the second para, after the first |
|
261 |
line, that we already have. Now, compile the document. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
262 |
|
104 | 263 |
Notice, that the second para appears in continuation with the previous |
264 |
line. To start a new paragraph in LaTeX, we need to insert an empty |
|
265 |
line. Multiple empty lines are considered as a single empty line. To |
|
266 |
start a new line, use the ``\newline`` or ``\\`` command. Notice the |
|
267 |
difference (in the output), in starting a new paragraph and starting a |
|
268 |
newline. A new paragraph is indented. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
269 |
|
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
270 |
Quotation Marks |
104 | 271 |
--------------- |
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
272 |
|
104 | 273 |
Look at the quotation marks around the text, Sigh Pie. They are not |
274 |
formatted properly. To place quotation marks in LaTeX, you should use |
|
275 |
````` character for the left quote & ``'`` character for the right |
|
276 |
quote. For double quotes, they should be used twice. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
277 |
|
104 | 278 |
Fonts |
279 |
----- |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
280 |
|
104 | 281 |
The names of the software tools, Scilab, Matlab, etc. appear in |
282 |
italics or emphasized as it is called in LaTeX. To emphasize text, the |
|
283 |
``\emph`` command is used. |
|
284 |
||
285 |
Let's also add the contents of the subsection "Sub-packages of |
|
286 |
Scipy". We shall add the table as plain text, until we learn how to |
|
287 |
edit tables. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
288 |
|
104 | 289 |
Let's try and form a tabular structure by separating the left and |
290 |
right columns using spaces. On compiling we find that LaTeX doesn't |
|
291 |
add multiple spaces between words. Just like multiple empty lines, |
|
292 |
multiple spaces are considered as a single space. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
293 |
|
104 | 294 |
The names of the sub-packages appear in a fixed width font in the |
295 |
sample document provided to us. The headings of the columns appear in |
|
296 |
bold-face. Let's make changes to this effect. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
297 |
|
104 | 298 |
``\textbf`` is used to change text to bold face and ``\texttt`` is |
299 |
used to change text to fixed width font. |
|
56
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
300 |
|
104 | 301 |
We could also change the separating - (hyphen) to an em-dash (or |
302 |
en-dash) -- is em-dash and --- is an em-dash, to improve the |
|
303 |
appearance of the document. |
|
56
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
304 |
|
104 | 305 |
Lists |
306 |
----- |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
307 |
|
104 | 308 |
The section on Use of Scipy in this course, contains lists. Let's now |
309 |
add lists to our document. The ``enumerate`` environment adds numbered |
|
310 |
lists to our document and the ``itemize`` environment adds un-numbered |
|
311 |
lists. ``\item`` command adds a new entry to a list. Note, that LaTeX |
|
312 |
can easily handle nested lists. In fact most environments can be |
|
313 |
embedded within other environments, without any problems. |
|
314 |
||
315 |
LaTeX also has a description list, which shall be looked at, during |
|
316 |
the lab sessions. |
|
317 |
||
318 |
Footnotes, Labels and References |
|
319 |
-------------------------------- |
|
320 |
||
321 |
Let's now add the footnote to pylab. LaTeX provides a footnote command |
|
322 |
to add a footnote. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
323 |
|
104 | 324 |
We added the footnote with Appendix A, as plain text. But, in case we |
325 |
added another Appendix before the section on using ``pylab``, the |
|
326 |
footnote will have to be edited. To avoid this, LaTeX provides a handy |
|
327 |
system of labels and referencing. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
328 |
|
104 | 329 |
We first add a label to the section that we want to refer in this |
330 |
footnote. Then, we change the footnote, and add the reference to this |
|
331 |
label instead of the character A. If you look at the output after |
|
332 |
compiling the document once, you will see that the footnote has |
|
333 |
question marks instead of the section number. You will have to |
|
334 |
compile once again, for the section number to appear in the footnote. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
335 |
|
104 | 336 |
|
337 |
Including code |
|
338 |
-------------- |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
339 |
|
104 | 340 |
In the footnote above, and in the table for the sub-packages list, we |
341 |
used the ``\texttt`` command to get a fixed width font. But we could |
|
342 |
instead use an environment provided by LaTeX to include pre-formatted |
|
343 |
text or code. LaTeX by default provides the verbatim environment to |
|
344 |
include pre-formatted text. You can try that out during the lab |
|
345 |
session. We shall look at using the listings package, specifically |
|
346 |
meant for including code in our document. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
347 |
|
104 | 348 |
First of all you need to tell LaTeX, that you want to use the listings |
349 |
package in your document. We add the directive |
|
350 |
``\usepackage{listings}`` to the preamble of our document. |
|
351 |
||
352 |
Then we set the language of the code that we are going to embed into |
|
353 |
our document. For this we use the lstset command. :: |
|
354 |
||
355 |
\lstset{language=Python, |
|
356 |
showstringspaces=false,} |
|
357 |
||
358 |
The listings package allows you to use color and do a lot of things |
|
359 |
with your embedded code, but all that during a lab exercise. |
|
360 |
||
361 |
Now, to put a line of code, inline and not as a separate block, we use |
|
362 |
the ``\lstinline`` command. We change the name pylab in the footnote |
|
363 |
to use lstinline instead of the texttt. To embed a block of code, we |
|
364 |
use the lstlisting environment (``\begin{lstlisting}`` and |
|
365 |
``\end{lstlisting}``). For example, let's add the code to the Appendix |
|
366 |
of our document. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
367 |
|
104 | 368 |
Figures, Tables and Floats |
369 |
-------------------------- |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
370 |
|
104 | 371 |
Let's now add the figure, to the appendix. |
372 |
||
373 |
To include graphics in a LaTeX document, we need to use the graphicx |
|
374 |
package. Add the ``\usepackage{graphicx}`` directive to the preamble |
|
375 |
of the document. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
376 |
|
104 | 377 |
To add the graphic, use the ``includegraphics`` command. The relative |
378 |
path of the image that we wish to include is passed as an argument to |
|
379 |
includegraphics. It takes an optional argument of scaling the |
|
380 |
image. We use a scale of 0.4 to scale our image. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
381 |
|
104 | 382 |
It takes other optional arguments. |
383 |
||
384 |
``width=x``, ``height=x`` |
|
385 |
If only the height or width is specified, |
|
386 |
the image is scaled, maintaining the aspect ratio. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
387 |
|
104 | 388 |
``keepaspectratio`` |
389 |
This parameter can either be set to true or false. When set to |
|
390 |
true, the image is scaled according to both width and height, |
|
391 |
without changing the aspect ratio, so that it does not exceed both |
|
392 |
the width and the height dimensions. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
393 |
|
104 | 394 |
``angle=x`` |
395 |
This option can be used to rotate the image by ``x`` degrees, |
|
396 |
counter-clockwise. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
397 |
|
104 | 398 |
Figures (and tables) are treated specially because, they cannot be |
399 |
broken across pages. They are "floated" across to the next page, if |
|
400 |
they donot fit on the current page, filling the current page with |
|
401 |
text. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
402 |
|
104 | 403 |
To make our graphic into a float, we should enlose it within a figure |
404 |
environment. For a table, the table environment should be used. We now |
|
405 |
move our graphic into a figure environment. The figure environment |
|
406 |
takes an additional parameter for the location of the |
|
407 |
float. ``\begin{figure}[hbtp!]``. The specifiers ``htbp`` are |
|
408 |
permissions to place the float at various locations. ``t`` for top of |
|
409 |
page, ``b`` for bottom of page, ``p`` for a separate page for floats |
|
410 |
and ``h`` for here, as in the same place where the command appears in |
|
411 |
the source. ``!`` mark overrides a few of LaTeX's internal parameters |
|
412 |
for good position of floats. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
413 |
|
104 | 414 |
The figure environment also, allows us to add a caption to the graphic |
415 |
using the ``\caption`` command. |
|
416 |
||
417 |
To place the graphic in the center aligned in the page, we use the |
|
418 |
center environment. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
419 |
|
104 | 420 |
To label a figure, we just add a label with in the figure |
421 |
environment. Note, that the label to a figure should be added after |
|
422 |
the caption command. Also, note that tables are auto-numbered. |
|
56
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
423 |
|
104 | 424 |
Let us finish the appendix, by adding the content present at the |
425 |
beginning of the appendix. The bibliographic citations will be dealt |
|
426 |
with later. |
|
56
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
427 |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
428 |
Tables |
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
429 |
~~~~~~ |
56
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
430 |
|
104 | 431 |
Now, let us look at the other kind of floats - Tables. We shall |
432 |
convert the list of sub-packages in the sub-packages section to a |
|
433 |
table. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
434 |
|
104 | 435 |
To begin a table, we use the tabular environment. And to make this a |
436 |
float, it is enclosed in the table environment. The table environment |
|
437 |
also allows us to add captions to the table and Tables are also auto |
|
438 |
numbered. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
439 |
|
104 | 440 |
The tabular environment takes as arguments the columns and the |
441 |
formatting of each column. The possible arguments to the tabular |
|
442 |
environment are |
|
56
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
443 |
|
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
444 |
+---------------+------------------------------------+ |
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
445 |
| ``l`` | left justified column content | |
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
446 |
+---------------+------------------------------------+ |
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
447 |
| ``r`` | right justified column content | |
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
448 |
+---------------+------------------------------------+ |
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
449 |
| ``c`` | centered column content | |
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
450 |
+---------------+------------------------------------+ |
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
451 |
| ``|`` | produces a vertical line. | |
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
452 |
+---------------+------------------------------------+ |
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
453 |
|
104 | 454 |
It also takes an optional parameter that specifies the position of the |
455 |
table; ``t`` for top, ``b`` for bottom, or ``c`` for center. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
456 |
|
104 | 457 |
Each column of a table is separated by an ``&`` symbol and each row is |
458 |
separated by a new line. The ``\hline`` command allows you to draw |
|
459 |
horizontal lines between two rows of the table. But it does not allow |
|
460 |
you do draw partial lines. ``\cline{a-b}`` draws a horizontal line |
|
461 |
from column ``a`` to column ``b``. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
462 |
|
104 | 463 |
We also add a label to the table and refer to it in the first line of |
464 |
the section. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
465 |
|
104 | 466 |
You could also add a listoftables or listoffigures to the document, |
467 |
similar to the way we added table of contents. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
468 |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
469 |
Typesetting Math |
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
470 |
---------------- |
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
471 |
|
104 | 472 |
Now we shall move to typesetting the Math in the sample document given |
473 |
to us. We shall start with the Matrices subsection. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
474 |
|
104 | 475 |
In general, it is advised to use the AMS-LaTeX bundle to typeset |
476 |
mathematics in LaTeX. AMS-LaTeX is a collection of packages and |
|
477 |
classes for mathematical typesetting. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
478 |
|
104 | 479 |
We load ``amsmath`` by issuing the ``\usepackage{amsmath}`` in the |
480 |
preamble. Through out this section, it is assumed that the ``amsmath`` |
|
481 |
package has been loaded. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
482 |
|
104 | 483 |
Let's now typeset the matrix A. |
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
484 |
|
104 | 485 |
To typeset math, we just have to enclose it within ``\(`` and ``\)`` |
486 |
or a pair of ``$`` signs. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
487 |
|
104 | 488 |
To typeset the matrix A, we use the ``bmatrix`` environment. It works |
489 |
similar to a tabular environment - ``&`` is used to demarcate columns |
|
490 |
and ``\\`` is used to add a new row. ``bmatrix`` environment gives the |
|
491 |
``[`` ``]`` as delimiters. There are 5 other matrix environments |
|
492 |
giving matrices with other delimiters - ``matrix`` (none), ``pmatrix`` |
|
493 |
``(``, ``Bmatrix`` ``{``, ``vmatrix`` ``|`` and ``Vmatrix`` ``||``. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
494 |
|
104 | 495 |
To write the name of the matrix A, a bold-faced A is used. This is |
496 |
obtained by using the ``\mathbf`` command. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
497 |
|
104 | 498 |
This subsection doesn't have much more math. The next section on |
499 |
inverse doesn't have anything new except for writing inverse of A. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
500 |
|
104 | 501 |
To typeset superscripts in LaTeX, the ``^`` character is used. The |
502 |
carat operator just acts on the next character. To have multiple |
|
503 |
characters as superscript they must be enclosed in ``{ }``. Similarly |
|
504 |
for typesetting text as subscripts the ``_`` character is used. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
505 |
|
104 | 506 |
To typeset the summation symbol, use the command ``\sum.`` The upper |
507 |
and lower limits are specified using the ``^`` and ``_`` |
|
508 |
characters. Similarly, the integral symbol is obtained using the |
|
509 |
``\int`` command. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
510 |
|
104 | 511 |
Next, let us type in the equation present in the section on |
512 |
Determinants. Note that it is different from all the math we've typed |
|
513 |
until now, since it is not inline and is "displayed", in the LaTeX |
|
514 |
lingo. LaTeX has a number of environments for displaying equations, |
|
515 |
with minor subtle differences. In general use ``\[`` ``\]`` to typeset |
|
516 |
displayed equations without numbering them. ``\begin{equation*}`` is |
|
517 |
equivalent to it. To obtain numbered equations use |
|
518 |
``\begin{equation}``. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
519 |
|
104 | 520 |
Next we wish to typeset a group of equations. The equation environment |
521 |
does not accept ``\\`` to get a new line. For multiple equations |
|
522 |
amsmath has a handful of environments with subtle differences. We |
|
523 |
shall use the ``eqnarray`` environment. ``eqnarray*`` environment |
|
524 |
gives unnumbered equations, as expected. The ``eqnarray`` environment |
|
525 |
works similar to a table environment. The parts of the equation that |
|
526 |
need to be aligned are indicated using an ``&`` symbol. The |
|
527 |
``newline`` command is used to enter a every new equation after the |
|
528 |
first one. We now typeset the equations in the section on linear |
|
529 |
equations using the ``eqnarray`` environment. (The equations in the |
|
530 |
determinants section use ``eqnarray*``) |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
531 |
|
104 | 532 |
We next typeset the math in the section on polynomials. To typeset |
533 |
fractions use the ``\frac`` command. To typeset surds, we use the |
|
534 |
``\sqrt`` command with the optional paramter of ``[n]``. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
535 |
|
104 | 536 |
Inserting Greek letters into LaTeX is simple. ``\alpha``, ``\beta``, |
537 |
``\gamma``, ... on for small letters and ``\Alpha``, ``\Beta``, |
|
538 |
``\Gamma``, ... for capital. |
|
539 |
||
540 |
Also, math environments do not give extra spaces using the space or |
|
541 |
tab characters. The following commands are available to specify the |
|
542 |
spacing required. |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
543 |
|
104 | 544 |
+---------+--------------------+---------+ |
545 |
| Abbrev. | Spelled out | Example | |
|
546 |
+---------+--------------------+---------+ |
|
547 |
| ``\,`` | ``\thinspace`` | | |
|
548 |
+---------+--------------------+---------+ |
|
549 |
| ``\:`` | ``\medspace`` | | |
|
550 |
+---------+--------------------+---------+ |
|
551 |
| ``\;`` | ``\thickspace`` | | |
|
552 |
+---------+--------------------+---------+ |
|
553 |
| | ``\quad`` | | |
|
554 |
+---------+--------------------+---------+ |
|
555 |
| | ``\qquad`` | | |
|
556 |
+---------+--------------------+---------+ |
|
557 |
| ``\!`` | ``\negthinspace`` | | |
|
558 |
+---------+--------------------+---------+ |
|
559 |
| | ``\negmedspace`` | | |
|
560 |
+---------+--------------------+---------+ |
|
561 |
| | ``\negthickspace`` | | |
|
562 |
+---------+--------------------+---------+ |
|
101
e529bec52b6f
Revised latex handout for new sees course; will drop this and make it more need based.
Puneeth Chaganti <punchagan@gmail.com>
parents:
63
diff
changeset
|
563 |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
564 |
Bibliography |
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
565 |
------------ |
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
566 |
|
104 | 567 |
Let's now look at how to write bibliography and cite references. |
36
4c4c8a9795b2
Edited Arrays & Matrices and Bibliography sections.
Puneeth Chaganti <puneeth@fossee.in>
parents:
30
diff
changeset
|
568 |
|
104 | 569 |
Writing bibliographies in LaTeX using the ``thebibliography`` |
570 |
environment is pretty easy. You simply have to list down all the |
|
571 |
bibliography items within the bibliography environment. |
|
56
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
572 |
|
104 | 573 |
Each entry of the bibliography begins with the command |
574 |
``\bibitem[label]{name}``. The name is used to cite the bibliography |
|
575 |
item within the document using ``\cite{name}``. The label option |
|
576 |
replaces the numbers from the auto enumeration with the labels given. |
|
36
4c4c8a9795b2
Edited Arrays & Matrices and Bibliography sections.
Puneeth Chaganti <puneeth@fossee.in>
parents:
30
diff
changeset
|
577 |
|
104 | 578 |
The ``9`` passed as an argument to ``thebibliography`` command |
579 |
indicates the maximum width of the label that the references will |
|
580 |
have. In our sample document, we have less than 10 items in the |
|
581 |
Bibliography and therefore we use 9. |
|
36
4c4c8a9795b2
Edited Arrays & Matrices and Bibliography sections.
Puneeth Chaganti <puneeth@fossee.in>
parents:
30
diff
changeset
|
582 |
|
104 | 583 |
Presentations with Beamer |
584 |
------------------------- |
|
36
4c4c8a9795b2
Edited Arrays & Matrices and Bibliography sections.
Puneeth Chaganti <puneeth@fossee.in>
parents:
30
diff
changeset
|
585 |
|
104 | 586 |
Using beamer for you presentations is a good idea, since you can use |
587 |
the LaTeX that you have used for the report/document for the |
|
588 |
presentation as well. |
|
36
4c4c8a9795b2
Edited Arrays & Matrices and Bibliography sections.
Puneeth Chaganti <puneeth@fossee.in>
parents:
30
diff
changeset
|
589 |
|
104 | 590 |
To write a ``beamer`` presentation, it is recommended that we use one |
591 |
of the templates that beamer provides. We shall use the |
|
592 |
``speaker_introduction`` template to get started with beamer. |
|
36
4c4c8a9795b2
Edited Arrays & Matrices and Bibliography sections.
Puneeth Chaganti <puneeth@fossee.in>
parents:
30
diff
changeset
|
593 |
|
104 | 594 |
As you can see, the document begins with the ``documentclass`` being |
595 |
set to beamer. |
|
36
4c4c8a9795b2
Edited Arrays & Matrices and Bibliography sections.
Puneeth Chaganti <puneeth@fossee.in>
parents:
30
diff
changeset
|
596 |
|
104 | 597 |
``\usetheme`` command sets the theme to be used in the presentation. |
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
598 |
|
104 | 599 |
``\usecolortheme`` command sets the color theme of the presentation. |
56
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
600 |
|
104 | 601 |
Notice that each slide is enclosed within ``\begin{frame}`` and |
602 |
``\end{frame}`` commands. The ``\begin{frame}`` command can be passed |
|
603 |
the Title and Subtitle of the slide as parameters. |
|
56
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
604 |
|
104 | 605 |
The title page of the presentation can be set like any other LaTeX |
606 |
document. |
|
56
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
607 |
|
104 | 608 |
To do overlays, use the ``\pause`` command. It does sequential |
609 |
overlays. Non sequential overlays can also be done. (Lab exercise.) |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
610 |
|
104 | 611 |
If you have fragile environments like ``verbatim`` or ``lstlisting``, |
612 |
you need to give the frame an optional parameter ``[fragile]``. |
|
30
3ca8ab883c13
First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff
changeset
|
613 |
|
104 | 614 |
To achieve more with beamer, it is highly recommended that you look at |
615 |
the ``beameruserguide``. |
|
56
eee394eb05fc
Added Loops section in ULT, modified LaTeX handout to use examples from sample doc.
Puneeth Chaganti <puneeth@fossee.in>
parents:
36
diff
changeset
|
616 |