web/html/ch04-handout.html~
changeset 0 8083d21c0020
equal deleted inserted replaced
-1:000000000000 0:8083d21c0020
       
     1 <html>
       
     2 <head>
       
     3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
       
     4 <title>Chapter 1. </title>
       
     5 <link rel="stylesheet" href="/review/support/styles.css" type="text/css">
       
     6 <meta name="generator" content="DocBook XSL Stylesheets V1.74.3">
       
     7 <link rel="shortcut icon" type="image/png" href="/review/support/figs/favicon.png">
       
     8 <script type="text/javascript" src="/review/support/jquery-min.js"></script>
       
     9 <script type="text/javascript" src="/review/support/form.js"></script>
       
    10 <script type="text/javascript" src="/review/support/hsbook.js"></script>
       
    11 </head>
       
    12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="chapter" id="chap04_handout">
       
    13 <div class="titlepage"></div>
       
    14 <div class="toc">
       
    15 <p><b>Table of Contents</b></p>
       
    16 <dl>
       
    17 <dt><span class="article"><a href="#id2325149">LaTeX</a></span></dt>
       
    18 <dd><dl>
       
    19 <dt><span class="section"><a href="#tex-latex">1. TeX &amp; LaTeX</a></span></dt>
       
    20 <dd><dl>
       
    21 <dt><span class="section"><a href="#tex">1.1. TeX</a></span></dt>
       
    22 <dt><span class="section"><a href="#latex">1.2. LaTeX</a></span></dt>
       
    23 </dl></dd>
       
    24 <dt><span class="section"><a href="#wysiwg-vs-wysiwm">2. WYSIWG vs. WYSIWM</a></span></dt>
       
    25 <dt><span class="section"><a href="#hello-world">3. Hello World</a></span></dt>
       
    26 <dd><dl>
       
    27 <dt><span class="section"><a href="#compiling-output">3.1. Compiling &amp; Output</a></span></dt>
       
    28 <dt><span class="section"><a href="#a-peek-at-the-source">3.2. A peek at the source</a></span></dt>
       
    29 </dl></dd>
       
    30 <dt><span class="section"><a href="#where-do-we-want-to-go">4. Where do we want to go</a></span></dt>
       
    31 <dt><span class="section"><a href="#some-basics">5. Some Basics</a></span></dt>
       
    32 <dd><dl>
       
    33 <dt><span class="section"><a href="#spaces">5.1. Spaces</a></span></dt>
       
    34 <dt><span class="section"><a href="#line-page-breaks">5.2. Line &amp; Page Breaks</a></span></dt>
       
    35 <dt><span class="section"><a href="#paragraphs">5.3. Paragraphs</a></span></dt>
       
    36 <dt><span class="section"><a href="#special-characters">5.4. Special Characters</a></span></dt>
       
    37 <dt><span class="section"><a href="#commands">5.5. Commands</a></span></dt>
       
    38 <dt><span class="section"><a href="#environments">5.6. Environments</a></span></dt>
       
    39 </dl></dd>
       
    40 <dt><span class="section"><a href="#some-structural-elements">6. Some Structural Elements</a></span></dt>
       
    41 <dd><dl>
       
    42 <dt><span class="section"><a href="#documentclass">6.1. 
       
    43         <code class="literal">\documentclass</code>
       
    44       </a></span></dt>
       
    45 <dt><span class="section"><a href="#parts-chapters-and-sections">6.2. Parts, Chapters and Sections</a></span></dt>
       
    46 <dt><span class="section"><a href="#top-matter">6.3. Top Matter</a></span></dt>
       
    47 <dt><span class="section"><a href="#abstract">6.4. Abstract</a></span></dt>
       
    48 <dt><span class="section"><a href="#appendices">6.5. Appendices</a></span></dt>
       
    49 <dt><span class="section"><a href="#table-of-contents">6.6. Table of Contents</a></span></dt>
       
    50 </dl></dd>
       
    51 <dt><span class="section"><a href="#elementary-text-typesetting">7. Elementary Text Typesetting</a></span></dt>
       
    52 <dd><dl>
       
    53 <dt><span class="section"><a href="#emphasizing">7.1. Emphasizing</a></span></dt>
       
    54 <dt><span class="section"><a href="#quotation-marks">7.2. Quotation Marks</a></span></dt>
       
    55 <dt><span class="section"><a href="#dashes-and-hyphens">7.3. Dashes and Hyphens</a></span></dt>
       
    56 <dt><span class="section"><a href="#footnotes">7.4. Footnotes</a></span></dt>
       
    57 <dt><span class="section"><a href="#flushleft-flushright-and-center">7.5. Flushleft, Flushright, and Center</a></span></dt>
       
    58 <dt><span class="section"><a href="#itemize-enumerate-and-description">7.6. Itemize, Enumerate, and Description</a></span></dt>
       
    59 <dt><span class="section"><a href="#quote-quotation-and-verse">7.7. Quote, Quotation, and Verse</a></span></dt>
       
    60 <dt><span class="section"><a href="#verbatim">7.8. Verbatim</a></span></dt>
       
    61 </dl></dd>
       
    62 <dt><span class="section"><a href="#tables-figures-and-captions">8. Tables, Figures and Captions</a></span></dt>
       
    63 <dd><dl>
       
    64 <dt><span class="section"><a href="#the-tabular-environment">8.1. The 
       
    65         <code class="literal">\tabular</code> environment
       
    66       </a></span></dt>
       
    67 <dt><span class="section"><a href="#importing-graphics">8.2. Importing Graphics</a></span></dt>
       
    68 <dt><span class="section"><a href="#floats">8.3. Floats</a></span></dt>
       
    69 <dt><span class="section"><a href="#captions">8.4. Captions</a></span></dt>
       
    70 <dt><span class="section"><a href="#list-of-figures-tables">8.5. List of Figures, Tables</a></span></dt>
       
    71 <dt><span class="section"><a href="#cross-references">8.6. Cross References</a></span></dt>
       
    72 </dl></dd>
       
    73 <dt><span class="section"><a href="#bibliography">9. Bibliography</a></span></dt>
       
    74 <dd><dl>
       
    75 <dt><span class="section"><a href="#thebibliography-environment">9.1. 
       
    76         <code class="literal">thebibliography</code> environment
       
    77       </a></span></dt>
       
    78 <dt><span class="section"><a href="#bibtex">9.2. BibTeX</a></span></dt>
       
    79 </dl></dd>
       
    80 <dt><span class="section"><a href="#typesetting-math">10. Typesetting Math</a></span></dt>
       
    81 <dd><dl>
       
    82 <dt><span class="section"><a href="#math-mode">10.1. Math Mode</a></span></dt>
       
    83 <dt><span class="section"><a href="#single-equations">10.2. Single Equations</a></span></dt>
       
    84 <dt><span class="section"><a href="#basic-elements">10.3. Basic Elements</a></span></dt>
       
    85 <dt><span class="section"><a href="#multiple-equations">10.4. Multiple Equations</a></span></dt>
       
    86 <dt><span class="section"><a href="#arrays-and-matrices">10.5. Arrays and Matrices</a></span></dt>
       
    87 </dl></dd>
       
    88 <dt><span class="section"><a href="#miscellaneous-stuff">11. Miscellaneous Stuff</a></span></dt>
       
    89 <dd><dl>
       
    90 <dt><span class="section"><a href="#presentations">11.1. Presentations</a></span></dt>
       
    91 <dt><span class="section"><a href="#including-code">11.2. Including Code</a></span></dt>
       
    92 <dt><span class="section"><a href="#including-files">11.3. Including files</a></span></dt>
       
    93 </dl></dd>
       
    94 <dt><span class="section"><a href="#recommended-reading">12. Recommended Reading</a></span></dt>
       
    95 </dl></dd>
       
    96 </dl>
       
    97 </div>
       
    98 <div class="article" title="LaTeX">
       
    99 <div class="titlepage">
       
   100 <div><div><h2 class="title">
       
   101 <a name="id2325149"></a>LaTeX</h2></div></div>
       
   102 <hr>
       
   103 </div>
       
   104 <div class="toc">
       
   105 <p><b>Table of Contents</b></p>
       
   106 <dl>
       
   107 <dt><span class="section"><a href="#tex-latex">1. TeX &amp; LaTeX</a></span></dt>
       
   108 <dd><dl>
       
   109 <dt><span class="section"><a href="#tex">1.1. TeX</a></span></dt>
       
   110 <dt><span class="section"><a href="#latex">1.2. LaTeX</a></span></dt>
       
   111 </dl></dd>
       
   112 <dt><span class="section"><a href="#wysiwg-vs-wysiwm">2. WYSIWG vs. WYSIWM</a></span></dt>
       
   113 <dt><span class="section"><a href="#hello-world">3. Hello World</a></span></dt>
       
   114 <dd><dl>
       
   115 <dt><span class="section"><a href="#compiling-output">3.1. Compiling &amp; Output</a></span></dt>
       
   116 <dt><span class="section"><a href="#a-peek-at-the-source">3.2. A peek at the source</a></span></dt>
       
   117 </dl></dd>
       
   118 <dt><span class="section"><a href="#where-do-we-want-to-go">4. Where do we want to go</a></span></dt>
       
   119 <dt><span class="section"><a href="#some-basics">5. Some Basics</a></span></dt>
       
   120 <dd><dl>
       
   121 <dt><span class="section"><a href="#spaces">5.1. Spaces</a></span></dt>
       
   122 <dt><span class="section"><a href="#line-page-breaks">5.2. Line &amp; Page Breaks</a></span></dt>
       
   123 <dt><span class="section"><a href="#paragraphs">5.3. Paragraphs</a></span></dt>
       
   124 <dt><span class="section"><a href="#special-characters">5.4. Special Characters</a></span></dt>
       
   125 <dt><span class="section"><a href="#commands">5.5. Commands</a></span></dt>
       
   126 <dt><span class="section"><a href="#environments">5.6. Environments</a></span></dt>
       
   127 </dl></dd>
       
   128 <dt><span class="section"><a href="#some-structural-elements">6. Some Structural Elements</a></span></dt>
       
   129 <dd><dl>
       
   130 <dt><span class="section"><a href="#documentclass">6.1. 
       
   131         <code class="literal">\documentclass</code>
       
   132       </a></span></dt>
       
   133 <dt><span class="section"><a href="#parts-chapters-and-sections">6.2. Parts, Chapters and Sections</a></span></dt>
       
   134 <dt><span class="section"><a href="#top-matter">6.3. Top Matter</a></span></dt>
       
   135 <dt><span class="section"><a href="#abstract">6.4. Abstract</a></span></dt>
       
   136 <dt><span class="section"><a href="#appendices">6.5. Appendices</a></span></dt>
       
   137 <dt><span class="section"><a href="#table-of-contents">6.6. Table of Contents</a></span></dt>
       
   138 </dl></dd>
       
   139 <dt><span class="section"><a href="#elementary-text-typesetting">7. Elementary Text Typesetting</a></span></dt>
       
   140 <dd><dl>
       
   141 <dt><span class="section"><a href="#emphasizing">7.1. Emphasizing</a></span></dt>
       
   142 <dt><span class="section"><a href="#quotation-marks">7.2. Quotation Marks</a></span></dt>
       
   143 <dt><span class="section"><a href="#dashes-and-hyphens">7.3. Dashes and Hyphens</a></span></dt>
       
   144 <dt><span class="section"><a href="#footnotes">7.4. Footnotes</a></span></dt>
       
   145 <dt><span class="section"><a href="#flushleft-flushright-and-center">7.5. Flushleft, Flushright, and Center</a></span></dt>
       
   146 <dt><span class="section"><a href="#itemize-enumerate-and-description">7.6. Itemize, Enumerate, and Description</a></span></dt>
       
   147 <dt><span class="section"><a href="#quote-quotation-and-verse">7.7. Quote, Quotation, and Verse</a></span></dt>
       
   148 <dt><span class="section"><a href="#verbatim">7.8. Verbatim</a></span></dt>
       
   149 </dl></dd>
       
   150 <dt><span class="section"><a href="#tables-figures-and-captions">8. Tables, Figures and Captions</a></span></dt>
       
   151 <dd><dl>
       
   152 <dt><span class="section"><a href="#the-tabular-environment">8.1. The 
       
   153         <code class="literal">\tabular</code> environment
       
   154       </a></span></dt>
       
   155 <dt><span class="section"><a href="#importing-graphics">8.2. Importing Graphics</a></span></dt>
       
   156 <dt><span class="section"><a href="#floats">8.3. Floats</a></span></dt>
       
   157 <dt><span class="section"><a href="#captions">8.4. Captions</a></span></dt>
       
   158 <dt><span class="section"><a href="#list-of-figures-tables">8.5. List of Figures, Tables</a></span></dt>
       
   159 <dt><span class="section"><a href="#cross-references">8.6. Cross References</a></span></dt>
       
   160 </dl></dd>
       
   161 <dt><span class="section"><a href="#bibliography">9. Bibliography</a></span></dt>
       
   162 <dd><dl>
       
   163 <dt><span class="section"><a href="#thebibliography-environment">9.1. 
       
   164         <code class="literal">thebibliography</code> environment
       
   165       </a></span></dt>
       
   166 <dt><span class="section"><a href="#bibtex">9.2. BibTeX</a></span></dt>
       
   167 </dl></dd>
       
   168 <dt><span class="section"><a href="#typesetting-math">10. Typesetting Math</a></span></dt>
       
   169 <dd><dl>
       
   170 <dt><span class="section"><a href="#math-mode">10.1. Math Mode</a></span></dt>
       
   171 <dt><span class="section"><a href="#single-equations">10.2. Single Equations</a></span></dt>
       
   172 <dt><span class="section"><a href="#basic-elements">10.3. Basic Elements</a></span></dt>
       
   173 <dt><span class="section"><a href="#multiple-equations">10.4. Multiple Equations</a></span></dt>
       
   174 <dt><span class="section"><a href="#arrays-and-matrices">10.5. Arrays and Matrices</a></span></dt>
       
   175 </dl></dd>
       
   176 <dt><span class="section"><a href="#miscellaneous-stuff">11. Miscellaneous Stuff</a></span></dt>
       
   177 <dd><dl>
       
   178 <dt><span class="section"><a href="#presentations">11.1. Presentations</a></span></dt>
       
   179 <dt><span class="section"><a href="#including-code">11.2. Including Code</a></span></dt>
       
   180 <dt><span class="section"><a href="#including-files">11.3. Including files</a></span></dt>
       
   181 </dl></dd>
       
   182 <dt><span class="section"><a href="#recommended-reading">12. Recommended Reading</a></span></dt>
       
   183 </dl>
       
   184 </div>Introduction
       
   185   <p id="x_c8"></a>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</p>
       
   186 <div class="section" title="1. TeX &amp; LaTeX">
       
   187 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
       
   188 <a name="tex-latex"></a>1. TeX &amp; LaTeX</h2></div></div></div>
       
   189 <div class="section" title="1.1. TeX">
       
   190 <div class="titlepage"><div><div><h3 class="title">
       
   191 <a name="tex"></a>1.1. TeX</h3></div></div></div>
       
   192 <p id="x_c9"></a>TeX is a typesetting system designed by Donald Knuth, the renowned Computer Scientist and Emeritus professor at Stanford University. Typesetting is placing text onto a page with all the style formatting defined, so that content looks as intended.</p>
       
   193 <p id="x_ca"></a>It was designed with two goals in mind-</p>
       
   194 <div class="orderedlist"><ol class="orderedlist" type="1">
       
   195 <li class="listitem"><p id="x_cb"></a>To allow anybody to produce high-quality books using a reasonable amount of effort.</p></li>
       
   196 <li class="listitem"><p id="x_cc"></a>To provide a system that would give the exact same results on all computers, now and in the future</p></li>
       
   197 </ol></div>
       
   198 <p id="x_cd"></a>TeX is well known for it's stability and portability.</p>
       
   199 <p id="x_ce"></a>TeX is pronounced as "tech".</p>
       
   200 <p id="x_cf"></a>The current version of TeX is 3.1415926 and is converging to π.</p>
       
   201 </div>
       
   202 <div class="section" title="1.2. LaTeX">
       
   203 <div class="titlepage"><div><div><h3 class="title">
       
   204 <a name="latex"></a>1.2. LaTeX</h3></div></div></div>
       
   205 <p id="x_d0"></a>LaTeX was originally written by Leslie Lamport in the early 1980s. It is an extension of TeX, consisting of TeX macros and a program to parse the LaTeX files. It is easier to use than TeX itself, at the same time producing the same quality of output.</p>
       
   206 <p id="x_d1"></a>LaTeX is pronounced either as "Lah-tech" or "Lay-tech"</p>
       
   207 </div>
       
   208 </div>
       
   209 <div class="section" title="2. WYSIWG vs. WYSIWM">
       
   210 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
       
   211 <a name="wysiwg-vs-wysiwm"></a>2. WYSIWG vs. WYSIWM</h2></div></div></div>
       
   212 <p id="x_d2"></a>WYSIWG is an acronym for "What You See Is What You Get". Word processors, are typically WYSIWG tools. LaTeX, TeX or other TeX based tools are not. They are typesetting or text formatting or document description programs. They can be called WYSIWM or "What You See Is What you Mean" systems, since you give a description of how things look, and LaTeX typesets the document for you.</p>
       
   213 <p id="x_d3"></a>Here are a few reasons, why you should use LaTeX -</p>
       
   214 <div class="blockquote"><blockquote class="blockquote"><div class="itemizedlist"><ul class="itemizedlist" type="*">
       
   215 <li class="listitem" style="list-style-type: *"><p id="x_d4"></a>LaTeX produces documents with excellent visual quality, especially mathematical and scientific documents.</p></li>
       
   216 <li class="listitem" style="list-style-type: *"><p id="x_d5"></a>It does the typesetting to you. Typically, when one works with a word-processor, the user is doing the text formatting or typesetting along with typing out the content. LaTeX allows the user to concentrate on the content leaving aside the typesetting to LaTeX.</p></li>
       
   217 <li class="listitem" style="list-style-type: *"><p id="x_d6"></a>It is light on your resources as compared to most of the word processors available today.</p></li>
       
   218 <li class="listitem" style="list-style-type: *"><p id="x_d7"></a>It is well known for it's stability and for it's virtually bug free code base.</p></li>
       
   219 <li class="listitem" style="list-style-type: *"><p id="x_d8"></a>It encourages users to structure documents by meaning rather than appearance, thereby helping produce well structured documents.</p></li>
       
   220 <li class="listitem" style="list-style-type: *"><p id="x_d9"></a>It uses plain text files as input, which have a lot of well known advantages over binary files. To state a few, they can be opened with any editor on any operating system, they are smaller in size compared to the binaries, can be version controlled and can be processed using widely used text processing utilities.</p></li>
       
   221 <li class="listitem" style="list-style-type: *"><p id="x_da"></a>The output can be generated in more than one formats.</p></li>
       
   222 <li class="listitem" style="list-style-type: *"><p id="x_db"></a>It is free software (free as in freedom) and gratis too.</p></li>
       
   223 <li class="listitem" style="list-style-type: *"><p id="x_dc"></a>It is widely used.</p></li>
       
   224 </ul></div></blockquote></div>
       
   225 </div>
       
   226 <div class="section" title="3. Hello World">
       
   227 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
       
   228 <a name="hello-world"></a>3. Hello World</h2></div></div></div>
       
   229 <p id="x_dd"></a>OK, let's get started with our first LaTeX document. Open up your favorite editor and type in the following code.</p>
       
   230 <pre class="programlisting">%hello.tex - First LaTeX document
       
   231 \documentclass{article}
       
   232 
       
   233 \begin{document}
       
   234   Hello, World!
       
   235 \end{document}
       
   236 
       
   237 </pre>
       
   238 <p id="x_de"></a>Save the file as 
       
   239       <code class="literal">hello.tex</code> and open up a terminal to compile your 
       
   240       <code class="literal">tex</code> file to get the output in a 
       
   241       <code class="literal">pdf</code> format.
       
   242     </p>
       
   243 <div class="section" title="3.1. Compiling &amp; Output">
       
   244 <div class="titlepage"><div><div><h3 class="title">
       
   245 <a name="compiling-output"></a>3.1. Compiling &amp; Output</h3></div></div></div>
       
   246 <pre class="programlisting">$pdflatex hello.tex
       
   247 
       
   248 Output written on hello.pdf (1 page, 5733 bytes).
       
   249 Transcript written on hello.log.
       
   250 
       
   251 </pre>
       
   252 <p id="x_df"></a>Open the 
       
   253         <code class="literal">hello.pdf</code> to see the output as shown.
       
   254       </p>
       
   255 <div class="mediaobject"><img src="examples/hello.jpg"></div>
       
   256 <p id="x_e0"></a>Note: The command 
       
   257         <code class="literal">latex</code> is often used to get the 
       
   258         <code class="literal">dvi</code> output. But, throughout this course, we shall use pdflatex to compile our documents.
       
   259       </p>
       
   260 </div>
       
   261 <div class="section" title="3.2. A peek at the source">
       
   262 <div class="titlepage"><div><div><h3 class="title">
       
   263 <a name="a-peek-at-the-source"></a>3.2. A peek at the source</h3></div></div></div>
       
   264 <p id="x_e1"></a>
       
   265         <code class="literal">%hello.tex - First LaTeX document</code>
       
   266       </p>
       
   267 <div class="blockquote"><blockquote class="blockquote"><p id="x_e2"></a>This line is a comment. LaTeX ignores this line and it is meant only for the human readers. LaTeX ignores anything after a 
       
   268           <code class="literal">%</code> symbol to the end of the line.
       
   269         </p></blockquote></div>
       
   270 <p id="x_e3"></a>
       
   271         <code class="literal">\documentclass{article}</code>
       
   272       </p>
       
   273 <div class="blockquote"><blockquote class="blockquote"><p id="x_e4"></a>This line is a command and sets the 
       
   274           <code class="literal">documentclass</code> of the document to 
       
   275           <code class="literal">article</code>. LaTeX has other classes like 
       
   276           <code class="literal">report</code>, 
       
   277           <code class="literal">book</code>, 
       
   278           <code class="literal">letter</code>, etc. The typesetting of the document varies depending on the 
       
   279           <code class="literal">documentclass</code> of the document.
       
   280         </p></blockquote></div>
       
   281 <p id="x_e5"></a>
       
   282         <code class="literal">\begin{document}</code>
       
   283       </p>
       
   284 <div class="blockquote"><blockquote class="blockquote"><p id="x_e6"></a>This line informs LaTeX that this is the beginning of the content of the document.</p></blockquote></div>
       
   285 <p id="x_e7"></a>
       
   286         <code class="literal">Hello, World!</code>
       
   287       </p>
       
   288 <div class="blockquote"><blockquote class="blockquote"><p id="x_e8"></a>This is the actual text displayed in the document.</p></blockquote></div>
       
   289 <p id="x_e9"></a>
       
   290         <code class="literal">\end{document}</code>
       
   291       </p>
       
   292 <div class="blockquote"><blockquote class="blockquote"><p id="x_ea"></a>This line tells LaTeX that the document is complete and LaTeX will simply ignore anything written after this line.</p></blockquote></div>
       
   293 </div>
       
   294 </div>
       
   295 <div class="section" title="4. Where do we want to go">
       
   296 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
       
   297 <a name="where-do-we-want-to-go"></a>4. Where do we want to go</h2></div></div></div>
       
   298 <p id="x_eb"></a>During the course of this session we will learn how to do various things in LaTeX and try to produce the sample document provided.</p>
       
   299 </div>
       
   300 <div class="section" title="5. Some Basics">
       
   301 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
       
   302 <a name="some-basics"></a>5. Some Basics</h2></div></div></div>
       
   303 <p id="x_ec"></a>Before we get started with creating the document, let's try to understand a few things that would be useful during the course of this session.</p>
       
   304 <div class="section" title="5.1. Spaces">
       
   305 <div class="titlepage"><div><div><h3 class="title">
       
   306 <a name="spaces"></a>5.1. Spaces</h3></div></div></div>
       
   307 <p id="x_ed"></a>LaTeX treats multiple empty spaces (or lines) as a single space (or line). An empty line between two lines of text is considered as a change of paragraphs.</p>
       
   308 </div>
       
   309 <div class="section" title="5.2. Line &amp; Page Breaks">
       
   310 <div class="titlepage"><div><div><h3 class="title">
       
   311 <a name="line-page-breaks"></a>5.2. Line &amp; Page Breaks</h3></div></div></div>
       
   312 <p id="x_ee"></a>LaTeX usually does the job of breaking up your content into lines and pages, and does it well. But under some circumstances, you might want to instruct LaTeX to break line or start a new page at a particular point.</p>
       
   313 <p id="x_ef"></a>
       
   314         <code class="literal">\\</code> or 
       
   315         <code class="literal">\newline</code> command is used to create a new line at the point where the command is issued. Appending 
       
   316         <code class="literal">*</code> to 
       
   317         <code class="literal">\\</code>,  instructs LaTeX to create a new line, without creating a new page at that point.
       
   318       </p>
       
   319 </div>
       
   320 <div class="section" title="5.3. Paragraphs">
       
   321 <div class="titlepage"><div><div><h3 class="title">
       
   322 <a name="paragraphs"></a>5.3. Paragraphs</h3></div></div></div>
       
   323 <p id="x_f0"></a>As already mentioned, LaTeX considers an empty line between two lines of text as a new paragraph. 
       
   324         <code class="literal">\par</code> command may also be used to start a newline. It is equivalent to the blank line.
       
   325       </p>
       
   326 <p id="x_f1"></a>By default LaTeX indents new paragraphs. If you do not wish to have the paragraph indented, you can use the 
       
   327         <code class="literal">\nointend</code> command at the beginning of the paragraph.
       
   328       </p>
       
   329 </div>
       
   330 <div class="section" title="5.4. Special Characters">
       
   331 <div class="titlepage"><div><div><h3 class="title">
       
   332 <a name="special-characters"></a>5.4. Special Characters</h3></div></div></div>
       
   333 <p id="x_f2"></a>LaTeX associates special meaning to the  characters 
       
   334         <code class="literal">~ # $ % ^ &amp; _ { } \</code>.
       
   335       </p>
       
   336 <p id="x_f3"></a>To have these characters in the text of your document, you need to prefix a backslash to them. 
       
   337         <code class="literal">\~ \# \% \$ \^ \&amp; \_ \{ \} \textbackslash</code>
       
   338       </p>
       
   339 </div>
       
   340 <div class="section" title="5.5. Commands">
       
   341 <div class="titlepage"><div><div><h3 class="title">
       
   342 <a name="commands"></a>5.5. Commands</h3></div></div></div>
       
   343 <div class="itemizedlist"><ul class="itemizedlist" type="*">
       
   344 <li class="listitem" style="list-style-type: *"><p id="x_f4"></a>All LaTeX commands start with a backslash 
       
   345             <code class="literal">\</code>.
       
   346           </p></li>
       
   347 <li class="listitem" style="list-style-type: *"><p id="x_f5"></a>Like the commands in Linux, they are case sensitive.</p></li>
       
   348 <li class="listitem" style="list-style-type: *"><p id="x_f6"></a>They usually have a backslash followed by a consisting of letters only. Any character other than letters, like space, numbers or special characters terminate the command.</p></li>
       
   349 <li class="listitem" style="list-style-type: *"><p id="x_f7"></a>The commands for producing special characters in the text, is an exception. They contain a backslash followed by a single special character.</p></li>
       
   350 <li class="listitem" style="list-style-type: *"><p id="x_f8"></a>Commands may have parameters, which are supplied to them by enclosing them in curly braces 
       
   351             <code class="literal">{ }</code>.
       
   352           </p></li>
       
   353 <li class="listitem" style="list-style-type: *"><p id="x_f9"></a>They may also have a few optional parameters which are added after the name in square brackets 
       
   354             <code class="literal">[ ]</code>.
       
   355           </p></li>
       
   356 </ul></div>
       
   357 </div>
       
   358 <div class="section" title="5.6. Environments">
       
   359 <div class="titlepage"><div><div><h3 class="title">
       
   360 <a name="environments"></a>5.6. Environments</h3></div></div></div>
       
   361 <p id="x_fa"></a>Environments are very similar to the commands, except that they effect larger parts of the document. For example, we used the 
       
   362         <code class="literal">document</code> environment in our first LaTeX document.
       
   363       </p>
       
   364 <div class="itemizedlist"><ul class="itemizedlist" type="*">
       
   365 <li class="listitem" style="list-style-type: *"><p id="x_fb"></a>They begin with a 
       
   366             <code class="literal">\begin</code> and end with a 
       
   367             <code class="literal">\end</code>
       
   368           </p></li>
       
   369 <li class="listitem" style="list-style-type: *"><p id="x_fc"></a>In general environments can be nested within each other.</p></li>
       
   370 </ul></div>
       
   371 </div>
       
   372 </div>
       
   373 <div class="section" title="6. Some Structural Elements">
       
   374 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
       
   375 <a name="some-structural-elements"></a>6. Some Structural Elements</h2></div></div></div>
       
   376 <div class="section" title="6.1.  \documentclass">
       
   377 <div class="titlepage"><div><div><h3 class="title">
       
   378 <a name="documentclass"></a>6.1. 
       
   379         <code class="literal">\documentclass</code>
       
   380       </h3></div></div></div>
       
   381 <p id="x_fd"></a>As already stated, the 
       
   382         <code class="literal">documentclass</code> command tells LaTeX, the type of the document that you intend to create. Each class has a few differences in how the content of the document is typeset. We presently have it set to the article class. Let us try changing it to the report class.
       
   383       </p>
       
   384 <p id="x_fe"></a>Note that the top matter of the document appears in a different page for the report class.</p>
       
   385 <p id="x_ff"></a>Some of the LaTeX classes that you may want to use are, article, proc, report, book, slides, letter.</p>
       
   386 <p id="x_100"></a>The 
       
   387         <code class="literal">documentclass</code> command also accepts a few optional parameters. For example:
       
   388       </p>
       
   389 <p id="x_101"></a>\documentclass[12pt,a4paper,oneside,draft]{report}</p>
       
   390 <p id="x_102"></a>
       
   391         <code class="literal">12pt</code> specifies the size of the main font in the document. The relative sizes of the various fonts is maintained, when the font size is changed. If no size is specified, 
       
   392         <code class="literal">10pt</code> is assumed by default.
       
   393       </p>
       
   394 <p id="x_103"></a>
       
   395         <code class="literal">a4paper</code> specifies the size of the paper to be used for the document.
       
   396       </p>
       
   397 <p id="x_104"></a>
       
   398         <code class="literal">oneside</code> specifies that the document will be printed only on one side of the paper. The 
       
   399         <code class="literal">article</code> and 
       
   400         <code class="literal">report</code> classes are 
       
   401         <code class="literal">oneside</code> by default and the 
       
   402         <code class="literal">book</code> class is 
       
   403         <code class="literal">twoside</code>.
       
   404       </p>
       
   405 <p id="x_105"></a>
       
   406         <code class="literal">draft</code> marks the hyphenation and justification problems in the document with a small square in the right hand margin of the document, so that they can be easily spotted.
       
   407       </p>
       
   408 <p id="x_106"></a>Note: Everything written in between the 
       
   409         <code class="literal">\documentclass</code> command and the 
       
   410         <code class="literal">\begin{document}</code> command is called the Preamble.
       
   411       </p>
       
   412 </div>
       
   413 <div class="section" title="6.2. Parts, Chapters and Sections">
       
   414 <div class="titlepage"><div><div><h3 class="title">
       
   415 <a name="parts-chapters-and-sections"></a>6.2. Parts, Chapters and Sections</h3></div></div></div>
       
   416 <p id="x_107"></a>Often documents are divided into various parts, chapters, sections and subsections. LaTeX provides an intuitive mechanism to include this in your documents. It has various commands like 
       
   417         <code class="literal">part</code>, 
       
   418         <code class="literal">chapter</code>, 
       
   419         <code class="literal">section</code>, 
       
   420         <code class="literal">subsection</code>, 
       
   421         <code class="literal">subsubsection</code>, 
       
   422         <code class="literal">paragraph</code> and 
       
   423         <code class="literal">subparagraph</code>. Note that all these commands are not available in all the document classes. The 
       
   424         <code class="literal">chapter</code> command is available only in books and reports. Also, the 
       
   425         <code class="literal">letter</code> document class does not have any of these commands.
       
   426       </p>
       
   427 <p id="x_108"></a>Let us now give our document some structure, using these commands.</p>
       
   428 <p id="x_109"></a>Note that you do not need to provide any numbers to the commands. LaTeX automatically takes care of the numbering. Also, you do not need to enclose the text of a block within 
       
   429         <code class="literal">\begin</code> and 
       
   430         <code class="literal">\end</code> commands. LaTeX starts a new block each time it finds a sectioning command. :
       
   431       </p>
       
   432 <pre class="programlisting">\section[Short Title]{This is a very long title and the Short Title will appear in the Table of Contents.}
       
   433 
       
   434 
       
   435 </pre>
       
   436 <div class="section" title="6.2.1. Section Numbering">
       
   437 <div class="titlepage"><div><div><h4 class="title">
       
   438 <a name="section-numbering"></a>6.2.1. Section Numbering</h4></div></div></div>
       
   439 <p id="x_10a"></a>As already, you don't need to explicitly do any numbering in LaTeX. Parts are numbered using roman numerals; Chapters and sections are numbered using decimal numbers. When the table of contents is inserted into a document, all the numbered headings automatically appear in it.</p>
       
   440 <p id="x_10b"></a>By default LaTeX has numbering up 2 levels, i.e, the parts, chapters, sections and subsections are numbered. You can change this by setting the 
       
   441           <code class="literal">secnumdepth</code> counter using the 
       
   442           <code class="literal">\setcounter</code> command. The following command removes numbering of the subsections. Only parts, chapters and sections are numbered. :
       
   443         </p>
       
   444 <pre class="programlisting">\setcounter{secnumdepth}{1}
       
   445 
       
   446 </pre>
       
   447 <p id="x_10c"></a>A sectioning command appended with an asterisk gives an unnumbered heading that is not included in the table of contents. :</p>
       
   448 <pre class="programlisting">\section*{Introduction}
       
   449 
       
   450 </pre>
       
   451 </div>
       
   452 </div>
       
   453 <div class="section" title="6.3. Top Matter">
       
   454 <div class="titlepage"><div><div><h3 class="title">
       
   455 <a name="top-matter"></a>6.3. Top Matter</h3></div></div></div>
       
   456 <p id="x_10d"></a>The information about the document such as it's title, the date, the author(s) information etc, is collectively known as the topmatter. Though there is no command called 
       
   457         <code class="literal">topmatter</code>, the term topmatter is frequently used in LaTeX documentation.
       
   458       </p>
       
   459 <p id="x_10e"></a>Let us input the top matter for our document now. :</p>
       
   460 <pre class="programlisting">\title{LaTeX - A How-to}
       
   461 \author{The FOSSEE Team}
       
   462 \date
       
   463 
       
   464 </pre>
       
   465 <p id="x_10f"></a>The  commands 
       
   466         <code class="literal">\title</code> and  
       
   467         <code class="literal">\author</code> are self explanatory. The 
       
   468         <code class="literal">\date</code> command automatically puts in today's date into the document. Now let us compile and look at the result.
       
   469       </p>
       
   470 <p id="x_110"></a>You would observe that the details do not appear in the document after recompilation. This is because, LaTeX has not been instructed what to do with the top matter information that you have given it. Use the 
       
   471         <code class="literal">\maketitle</code> command within the document environment to instruct LaTeX to place the top matter information into the document.
       
   472       </p>
       
   473 </div>
       
   474 <div class="section" title="6.4. Abstract">
       
   475 <div class="titlepage"><div><div><h3 class="title">
       
   476 <a name="abstract"></a>6.4. Abstract</h3></div></div></div>
       
   477 <p id="x_111"></a>Lets now place and abstract in the document using the 
       
   478         <code class="literal">abstract</code> environment of LaTeX. The abstract appears in the document after the topmatter but before the main body of the document. :
       
   479       </p>
       
   480 <pre class="programlisting">\begin{abstract}
       
   481 The abstract abstract.
       
   482 \end{abstract}
       
   483 
       
   484 
       
   485 </pre>
       
   486 </div>
       
   487 <div class="section" title="6.5. Appendices">
       
   488 <div class="titlepage"><div><div><h3 class="title">
       
   489 <a name="appendices"></a>6.5. Appendices</h3></div></div></div>
       
   490 <p id="x_112"></a>LaTeX allows for separate numbering for appendices. 
       
   491         <code class="literal">\appendix</code> command indicates that the sections following are to be included in the appendix. :
       
   492       </p>
       
   493 <pre class="programlisting">\appendix
       
   494 \chapter{First Appendix}
       
   495 
       
   496 </pre>
       
   497 </div>
       
   498 <div class="section" title="6.6. Table of Contents">
       
   499 <div class="titlepage"><div><div><h3 class="title">
       
   500 <a name="table-of-contents"></a>6.6. Table of Contents</h3></div></div></div>
       
   501 <p id="x_113"></a>Parts, chapters or sections that have been auto numbered by LaTeX automatically appear in the Table of Contents (ToC). 
       
   502         <code class="literal">\tableofcontents</code> command places a the ToC, where the command has been issued.
       
   503       </p>
       
   504 <p id="x_114"></a>The counter 
       
   505         <code class="literal">tocdepth</code> specifies the depth up to which headings appear in the ToC. It can be set using the 
       
   506         <code class="literal">\setcounter</code> command as shown below. :
       
   507       </p>
       
   508 <pre class="programlisting">\setcounter{tocdepth}{3}
       
   509 
       
   510 </pre>
       
   511 <p id="x_115"></a>Unnumbered sections can be placed in the table of contents using the 
       
   512         <code class="literal">\addcontentsline</code> command as shown below. :
       
   513       </p>
       
   514 <pre class="programlisting">\section*{Introduction}
       
   515 \addcontentsline{toc}{section}{Introduction}
       
   516 
       
   517 </pre>
       
   518 <p id="x_116"></a>Note: To get the correct entries in your table of contents, you will need to run one extra compilation, each time. This is because, the entries of the table of contents are collected during each compilation of the document and utilized during the next compilation.</p>
       
   519 </div>
       
   520 </div>
       
   521 <div class="section" title="7. Elementary Text Typesetting">
       
   522 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
       
   523 <a name="elementary-text-typesetting"></a>7. Elementary Text Typesetting</h2></div></div></div>
       
   524 <div class="section" title="7.1. Emphasizing">
       
   525 <div class="titlepage"><div><div><h3 class="title">
       
   526 <a name="emphasizing"></a>7.1. Emphasizing</h3></div></div></div>
       
   527 <p id="x_117"></a>
       
   528         <span class="emphasis"><em>Italic</em></span> font is generally used to emphasize text. The 
       
   529         <code class="literal">\emph</code> command may be used to achieve this effect in LaTeX. :
       
   530       </p>
       
   531 <pre class="programlisting">This is the \emph{emphasized text}.
       
   532 
       
   533 </pre>
       
   534 <p id="x_118"></a>If the 
       
   535         <code class="literal">\emph</code> command is nested within another emphasize command, LaTeX emphasized that text using normal fonts. :
       
   536       </p>
       
   537 <pre class="programlisting">\emph{Did you wonder what happens when we try \emph{emphasizing text} within \emph{emphasized text}}?
       
   538 
       
   539 </pre>
       
   540 <p id="x_119"></a>        <span class="emphasis"><em>This is emphasized text, and</em></span> this is emphasized text with normal font 
       
   541         <span class="emphasis"><em>, within</em></span> emphasized text.
       
   542       </p>
       
   543 </div>
       
   544 <div class="section" title="7.2. Quotation Marks">
       
   545 <div class="titlepage"><div><div><h3 class="title">
       
   546 <a name="quotation-marks"></a>7.2. Quotation Marks</h3></div></div></div>
       
   547 <p id="x_11a"></a>When typing in LaTeX, the double quotation mark 
       
   548         <code class="literal">"</code> character shouldn't be used. The grave accent `
       
   549         <code class="literal">
       
   550           <code class="literal"> character produces the left quote and the apostrophe </code>'
       
   551         </code> character produces the right quote. To obtain double quotes they are, each, used twice. :
       
   552       </p>
       
   553 <pre class="programlisting">`` Here is an example of putting `text' in quotes ''
       
   554 
       
   555 </pre>
       
   556 </div>
       
   557 <div class="section" title="7.3. Dashes and Hyphens">
       
   558 <div class="titlepage"><div><div><h3 class="title">
       
   559 <a name="dashes-and-hyphens"></a>7.3. Dashes and Hyphens</h3></div></div></div>
       
   560 <p id="x_11b"></a>LaTeX has four dashes of different lengths. Three of them can be produces with different number of consecutive dashes. The short dashes are used for hyphens, slightly longer ones for number ranges and the longest ones for comments. The fourth one is a mathematical symbol, the minus sign. :</p>
       
   561 <pre class="programlisting">The names of these dashes are: `-' hyphen, `--' en-dash, `---' em-dash and `$-$' minus sign.
       
   562 
       
   563 </pre>
       
   564 <p id="x_11c"></a>The names for these dashes are: ‘‐’ hyphen, ‘–’ en-dash, ‘—’ em-dash and ‘−’ minus sign.</p>
       
   565 </div>
       
   566 <div class="section" title="7.4. Footnotes">
       
   567 <div class="titlepage"><div><div><h3 class="title">
       
   568 <a name="footnotes"></a>7.4. Footnotes</h3></div></div></div>
       
   569 <p id="x_11d"></a>With the command:</p>
       
   570 <pre class="programlisting">\footnote{footnote text}
       
   571 
       
   572 </pre>
       
   573 <p id="x_11e"></a>a footnote is printed at the foot of the current page. Footnotes should always be put after the word or sentence they refer to. Footnotes referring to a sentence or part of it should therefore be put after the comma or period.</p>
       
   574 <p id="x_11f"></a>Note: Look at the 
       
   575         <code class="literal">\marginpar</code> command to insert margin notes
       
   576       </p>
       
   577 </div>
       
   578 <div class="section" title="7.5. Flushleft, Flushright, and Center">
       
   579 <div class="titlepage"><div><div><h3 class="title">
       
   580 <a name="flushleft-flushright-and-center"></a>7.5. Flushleft, Flushright, and Center</h3></div></div></div>
       
   581 <p id="x_120"></a>The environments 
       
   582         <code class="literal">flushleft</code> and 
       
   583         <code class="literal">flushright</code> generate paragraphs that are either left- or right-aligned.
       
   584       </p>
       
   585 <p id="x_121"></a>The 
       
   586         <code class="literal">center</code> environment generates centered text.
       
   587       </p>
       
   588 </div>
       
   589 <div class="section" title="7.6. Itemize, Enumerate, and Description">
       
   590 <div class="titlepage"><div><div><h3 class="title">
       
   591 <a name="itemize-enumerate-and-description"></a>7.6. Itemize, Enumerate, and Description</h3></div></div></div>
       
   592 <p id="x_122"></a>LaTeX has three different environments for producing lists. Itemize, Enumerate and Description allow you to produce lists of various types in LaTeX.</p>
       
   593 <p id="x_123"></a>Itemize is used to produce unnumbered lists. The bullets of the list can be easily changed to use any character. Enumerate environment allows you to produce auto-numbered lists. The description environment, allows you to produce a list of definitions. These environments can be nested within each other, easily.</p>
       
   594 <pre class="programlisting">\begin{itemize}
       
   595   \item Now we move onto some elementary \emph{Text Typesetting}.
       
   596   \item How do we get \emph{emphasized or italic text}?
       
   597   \item \emph{Did you wonder what happens when we try \emph{emphasizing text} within \emph{emphasized text}}?
       
   598   \item ``Beautiful is better than ugly.''
       
   599 \end{itemize}
       
   600 
       
   601 \begin{description}
       
   602   \item[Description] This list is a description list. 
       
   603   \item[Enumerate] Numbered lists are often useful.
       
   604     \begin{enumerate}
       
   605     \item First
       
   606     \item Second
       
   607     \item Third
       
   608     \item \ldots
       
   609     \end{enumerate}
       
   610   \item[Itemize] The list above this description list is an itemize list.
       
   611 \end{description}
       
   612 
       
   613 </pre>
       
   614 </div>
       
   615 <div class="section" title="7.7. Quote, Quotation, and Verse">
       
   616 <div class="titlepage"><div><div><h3 class="title">
       
   617 <a name="quote-quotation-and-verse"></a>7.7. Quote, Quotation, and Verse</h3></div></div></div>
       
   618 <p id="x_124"></a>LaTeX provides a 
       
   619         <code class="literal">quote</code> environment that can be used for quoting, highlighting important material, etc. :
       
   620       </p>
       
   621 <pre class="programlisting">The Zen of Python
       
   622 \begin{quote}
       
   623   The Zen of Python, by Tim Peters
       
   624 
       
   625   Beautiful is better than ugly.
       
   626   Explicit is better than implicit.
       
   627   Simple is better than complex.
       
   628   Complex is better than complicated.
       
   629   Flat is better than nested.
       
   630   Sparse is better than dense.
       
   631   Readability counts.
       
   632   Special cases aren't special enough to break the rules.
       
   633   Although practicality beats purity.
       
   634   Errors should never pass silently.
       
   635   Unless explicitly silenced.
       
   636   In the face of ambiguity, refuse the temptation to guess.
       
   637   There should be one-- and preferably only one --obvious way to do it.
       
   638   Although that way may not be obvious at first unless you're Dutch.
       
   639   Now is better than never.
       
   640   Although never is often better than *right* now.
       
   641   If the implementation is hard to explain, it's a bad idea.
       
   642   If the implementation is easy to explain, it may be a good idea.
       
   643   Namespaces are one honking great idea -- let's do more of those!
       
   644 \end{quote}
       
   645 
       
   646 </pre>
       
   647 <p id="x_125"></a>LaTeX provides two other similar environments, the quotation and the verse environments.</p>
       
   648 <p id="x_126"></a>The quotation environment can be used for longer quotes which have several paragraphs, since it indents the first line of each paragraph.</p>
       
   649 <p id="x_127"></a>The verse environment may be used to quote verses or poems, since the line breaks are important in quoting them. The lines are separated using 
       
   650         <code class="literal">\\\\</code> at the end of a line and an empty line after each verse.
       
   651       </p>
       
   652 </div>
       
   653 <div class="section" title="7.8. Verbatim">
       
   654 <div class="titlepage"><div><div><h3 class="title">
       
   655 <a name="verbatim"></a>7.8. Verbatim</h3></div></div></div>
       
   656 <p id="x_128"></a>The verbatim environment allows us to insert pre-formatted text in a LaTeX document. It is useful for inserting code samples within the document. The verbatim text needs to be enclosed between 
       
   657         <code class="literal">\begin{verbatim}</code> and 
       
   658         <code class="literal">\end{verbatim}</code>. :
       
   659       </p>
       
   660 <pre class="programlisting">\begin{verbatim}
       
   661 from numpy import *
       
   662 a = linspace(0, 5, 50, endpoint = False)
       
   663 \end{verbatim}
       
   664 
       
   665 from numpy import *
       
   666 a = linspace(0, 5, 50, endpoint = False)
       
   667 
       
   668 </pre>
       
   669 <p id="x_129"></a>To insert verbatim text in-line, the 
       
   670         <code class="literal">\verb</code> command can be used. :
       
   671       </p>
       
   672 <pre class="programlisting">The verb command allows placing \verb|verbatim text| in-line. 
       
   673 
       
   674 </pre>
       
   675 <p id="x_12a"></a>The | is just an example of a delimiter character. You can use any character except letters, * or space.</p>
       
   676 </div>
       
   677 </div>
       
   678 <div class="section" title="8. Tables, Figures and Captions">
       
   679 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
       
   680 <a name="tables-figures-and-captions"></a>8. Tables, Figures and Captions</h2></div></div></div>
       
   681 <div class="section" title="8.1. The \tabular environment">
       
   682 <div class="titlepage"><div><div><h3 class="title">
       
   683 <a name="the-tabular-environment"></a>8.1. The 
       
   684         <code class="literal">\tabular</code> environment
       
   685       </h3></div></div></div>
       
   686 <p id="x_12b"></a>The 
       
   687         <code class="literal">tabular</code> environment allows you to typeset tables in LaTeX. 
       
   688         <code class="literal">\begin{tabular}[pos]{col fmt}</code> command can be used to specify the parameters of the table and start creating the table.
       
   689       </p>
       
   690 <p id="x_12c"></a>The 
       
   691         <code class="literal">pos</code> argument specifies the vertical position of the table relative to the baseline of the surrounding text. It can take on the values 
       
   692         <code class="literal">t</code> for top, 
       
   693         <code class="literal">b</code> for bottom, or 
       
   694         <code class="literal">c</code> for center.
       
   695       </p>
       
   696 <p id="x_12d"></a>The 
       
   697         <code class="literal">col fmt</code> argument specifies the formatting of the columns of the table. You need to explicitly specify the formatting for each of the columns in the table. The 
       
   698         <code class="literal">col fmt</code> argument can take on the following values.
       
   699       </p>
       
   700 <div class="informaltable"><table border="1">
       
   701 <colgroup>
       
   702 <col width="4">
       
   703 <col width="12">
       
   704 <col width="37">
       
   705 </colgroup>
       
   706 <tbody>
       
   707 <tr>
       
   708 <td>
       
   709                 <p id="x_12e"></a>
       
   710                   <code class="literal">l</code>
       
   711                 </p>
       
   712               </td>
       
   713 <td>
       
   714                 <p id="x_12f"></a>left justified column content</p>
       
   715               </td>
       
   716 <td class="auto-generated"> </td>
       
   717 </tr>
       
   718 <tr>
       
   719 <td>
       
   720                 <p id="x_130"></a>
       
   721                   <code class="literal">r</code>
       
   722                 </p>
       
   723               </td>
       
   724 <td>
       
   725                 <p id="x_131"></a>right justified column content</p>
       
   726               </td>
       
   727 <td class="auto-generated"> </td>
       
   728 </tr>
       
   729 <tr>
       
   730 <td>
       
   731                 <p id="x_132"></a>
       
   732                   <code class="literal">c</code>
       
   733                 </p>
       
   734               </td>
       
   735 <td>
       
   736                 <p id="x_133"></a>centered column content</p>
       
   737               </td>
       
   738 <td class="auto-generated"> </td>
       
   739 </tr>
       
   740 <tr>
       
   741 <td>
       
   742                 <div class="variablelist"><dl>
       
   743 <dt><span class="term">
       
   744                       <code class="literal">*{n}{col}</code>
       
   745                     </span></dt>
       
   746 <dd><p></p></dd>
       
   747 </dl></div>
       
   748               </td>
       
   749 <td>
       
   750                 <p id="x_134"></a>produces 
       
   751                   <code class="literal">n</code> columns with the 
       
   752                   <code class="literal">col</code> type of formatting 
       
   753                   <code class="literal">*{3}{c}</code> is the same as {c c c}
       
   754                 </p>
       
   755               </td>
       
   756 <td class="auto-generated"> </td>
       
   757 </tr>
       
   758 <tr>
       
   759 <td>
       
   760                 <p id="x_135"></a>``|</p>
       
   761               </td>
       
   762 <td>
       
   763                 <p id="x_136"></a>produces a vertical line.</p>
       
   764               </td>
       
   765 <td class="auto-generated"> </td>
       
   766 </tr>
       
   767 </tbody>
       
   768 </table></div>
       
   769 <p id="x_137"></a>Now we look at how to input the actual entries of the tables. Each horizontal row in a table is separated by 
       
   770         <code class="literal">\\</code>. Each column entry of a row is separated by 
       
   771         <code class="literal">&amp;</code>.
       
   772       </p>
       
   773 <p id="x_138"></a>The 
       
   774         <code class="literal">\hline</code> command allows you to draw horizontal lines between two rows of the table. But it does not allow you do draw partial lines. 
       
   775         <code class="literal">\cline{a-b}</code> draws a horizontal line from column 
       
   776         <code class="literal">a</code> to column 
       
   777         <code class="literal">b</code>. :
       
   778       </p>
       
   779 <pre class="programlisting">\begin{tabular}{|c|c|}
       
   780   \hline
       
   781   \verb+l+ &amp; left justified column content\\ 
       
   782   \hline
       
   783   \verb+r+ &amp; right justified column content\\ 
       
   784   \hline
       
   785   \verb+c+ &amp; centered column content\\ 
       
   786   \hline
       
   787   \verb+*{n}{col}+ &amp; produces \verb+n+ columns with the\\
       
   788                  &amp; \verb+col+ type of formatting\\
       
   789   \cline{2-2}
       
   790                  &amp;\verb+*{3}{c}+ is the same as \verb+{c c c}+ \\
       
   791   \hline
       
   792   \verb+|+ &amp; produces a vertical line\\ 
       
   793   \hline
       
   794 \end{tabular}
       
   795 
       
   796 </pre>
       
   797 </div>
       
   798 <div class="section" title="8.2. Importing Graphics">
       
   799 <div class="titlepage"><div><div><h3 class="title">
       
   800 <a name="importing-graphics"></a>8.2. Importing Graphics</h3></div></div></div>
       
   801 <p id="x_139"></a>To include images in LaTeX, we require to use an additional package known as 
       
   802         <code class="literal">graphicx</code>.  To load a package, we use the 
       
   803         <code class="literal">\usepackage</code> directive in the preamble of the document. :
       
   804       </p>
       
   805 <pre class="programlisting">\usepackage{graphicx}
       
   806 
       
   807 </pre>
       
   808 <p id="x_13a"></a>When compiling with 
       
   809         <code class="literal">pdflatex</code> command,  
       
   810         <span class="strong"><strong>jpg</strong></span>, 
       
   811         <span class="strong"><strong>png</strong></span>, 
       
   812         <span class="strong"><strong>gif</strong></span> and 
       
   813         <span class="strong"><strong>pdf</strong></span> images can be inserted.
       
   814       </p>
       
   815 <pre class="programlisting">\includegraphics[optional arguments]{imagename}
       
   816 
       
   817 </pre>
       
   818 <p id="x_13b"></a>A few 
       
   819         <code class="literal">optional arguments</code>:
       
   820       </p>
       
   821 <div class="blockquote"><blockquote class="blockquote">
       
   822 <div class="variablelist"><dl>
       
   823 <dt><span class="term">
       
   824               <code class="literal">width=x</code>, 
       
   825               <code class="literal">height=x</code>
       
   826             </span></dt>
       
   827 <dd>
       
   828 <p></p>
       
   829 <p id="x_13c"></a>If only the height or width is specified, the image is scaled, maintaining the aspect ratio.</p>
       
   830 </dd>
       
   831 </dl></div>
       
   832 <div class="blockquote"><blockquote class="blockquote">
       
   833 <div class="variablelist"><dl>
       
   834 <dt><span class="term">
       
   835                 <code class="literal">keepaspectratio</code>
       
   836               </span></dt>
       
   837 <dd>
       
   838 <p></p>
       
   839 <p id="x_13d"></a>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.</p>
       
   840 </dd>
       
   841 </dl></div>
       
   842 <div class="blockquote"><blockquote class="blockquote">
       
   843 <div class="variablelist"><dl>
       
   844 <dt><span class="term">
       
   845                   <code class="literal">scale=x</code>
       
   846                 </span></dt>
       
   847 <dd>
       
   848 <p></p>
       
   849 <p id="x_13e"></a>Scale the image by a factor of 
       
   850                     <code class="literal">x</code>. For example, 
       
   851                     <code class="literal">scale=2</code>, will double the image size.
       
   852                   </p>
       
   853 </dd>
       
   854 </dl></div>
       
   855 <div class="blockquote"><blockquote class="blockquote"><div class="variablelist"><dl>
       
   856 <dt><span class="term">
       
   857                     <code class="literal">angle=x</code>
       
   858                   </span></dt>
       
   859 <dd>
       
   860 <p></p>
       
   861 <div class="blockquote"><blockquote class="blockquote"><p id="x_13f"></a>This option can be used to rotate the image by 
       
   862                         <code class="literal">x</code> degrees, counter-clockwise.
       
   863                       </p></blockquote></div>
       
   864 </dd>
       
   865 </dl></div></blockquote></div>
       
   866 </blockquote></div>
       
   867 </blockquote></div>
       
   868 </blockquote></div>
       
   869 <pre class="programlisting">\includegraphics[scale=0.8, angle=30]{lion_orig.png}
       
   870 
       
   871 </pre>
       
   872 </div>
       
   873 <div class="section" title="8.3. Floats">
       
   874 <div class="titlepage"><div><div><h3 class="title">
       
   875 <a name="floats"></a>8.3. Floats</h3></div></div></div>
       
   876 <p id="x_140"></a>Tables and Figures need to be treated in a special manner, since they cannot be split over pages, and they are referred to as floats in LaTeX.</p>
       
   877 <p id="x_141"></a>When there is not enough space on a page, to fit in a table or figure, it is floated over to the next page filling up the current page with text. LaTeX has float environments called table and figure for tables and images, respectively.</p>
       
   878 <p id="x_142"></a>Anything enclosed within the table or figure environments will be treated as floats. :</p>
       
   879 <pre class="programlisting">\begin{figure}[pos] or 
       
   880 \begin{table}[pos]
       
   881 
       
   882 </pre>
       
   883 <p id="x_143"></a>The 
       
   884         <code class="literal">pos</code> parameter specifies the placement of the float. The possible values it can take are as follows.
       
   885       </p>
       
   886 <div class="informaltable"><table border="1">
       
   887 <colgroup>
       
   888 <col width="12">
       
   889 <col width="68">
       
   890 </colgroup>
       
   891 <thead><tr>
       
   892 <th>
       
   893                 <p id="x_144"></a>Specifier</p>
       
   894               </th>
       
   895 <th>
       
   896                 <p id="x_145"></a>Permission</p>
       
   897               </th>
       
   898 </tr></thead>
       
   899 <tbody>
       
   900 <tr>
       
   901 <td>
       
   902                 <p id="x_146"></a>h</p>
       
   903               </td>
       
   904 <td>
       
   905                 <p id="x_147"></a>at approximately the same place where it occurs in the source</p>
       
   906               </td>
       
   907 </tr>
       
   908 <tr>
       
   909 <td>
       
   910                 <p id="x_148"></a>t</p>
       
   911               </td>
       
   912 <td>
       
   913                 <p id="x_149"></a>at the top of the page.</p>
       
   914               </td>
       
   915 </tr>
       
   916 <tr>
       
   917 <td>
       
   918                 <p id="x_14a"></a>b</p>
       
   919               </td>
       
   920 <td>
       
   921                 <p id="x_14b"></a>at the bottom of the page.</p>
       
   922               </td>
       
   923 </tr>
       
   924 <tr>
       
   925 <td>
       
   926                 <p id="x_14c"></a>p</p>
       
   927               </td>
       
   928 <td>
       
   929                 <p id="x_14d"></a>on a special page for floats only.</p>
       
   930               </td>
       
   931 </tr>
       
   932 <tr>
       
   933 <td>
       
   934                 <p id="x_14e"></a>!</p>
       
   935               </td>
       
   936 <td>
       
   937                 <p id="x_14f"></a>Override LaTeX's internal parameters for good positions</p>
       
   938               </td>
       
   939 </tr>
       
   940 <tr>
       
   941 <td>
       
   942                 <p id="x_150"></a>H</p>
       
   943               </td>
       
   944 <td>
       
   945                 <p id="x_151"></a>nearly equivalent to h!</p>
       
   946               </td>
       
   947 </tr>
       
   948 </tbody>
       
   949 </table></div>
       
   950 <p id="x_152"></a>Examples:</p>
       
   951 <pre class="programlisting">\begin{figure}[h]
       
   952 \centering
       
   953 \includegraphics[scale=0.8, angle=30]{lion_orig.png}
       
   954 \end{figure}
       
   955 
       
   956 
       
   957 </pre>
       
   958 </div>
       
   959 <div class="section" title="8.4. Captions">
       
   960 <div class="titlepage"><div><div><h3 class="title">
       
   961 <a name="captions"></a>8.4. Captions</h3></div></div></div>
       
   962 <p id="x_153"></a>The 
       
   963         <code class="literal">\caption{text}</code> command allows you to add captions to images or tables. LaTeX automatically numbers your tables and figures and you need not include numbers in the captions that you write. The caption appears below or on top of the image (or table), depending on whether you place it after or before the 
       
   964         <code class="literal">importgraphics</code> (or 
       
   965         <code class="literal">tabular</code>) command.
       
   966       </p>
       
   967 <p id="x_154"></a>\begin{figure}[h] \centering \includegraphics[scale=0.8]{lion_orig.png} \caption{CTAN lion drawing by Duane Bibby; thanks to www.ctan.org} \end{figure}</p>
       
   968 <p id="x_155"></a>The caption command also, like the section command, has the short caption optional parameter. The short caption will appear in the list of tables or figures.</p>
       
   969 </div>
       
   970 <div class="section" title="8.5. List of Figures, Tables">
       
   971 <div class="titlepage"><div><div><h3 class="title">
       
   972 <a name="list-of-figures-tables"></a>8.5. List of Figures, Tables</h3></div></div></div>
       
   973 <p id="x_156"></a>LaTeX can automatically generate a List of Tables or Figures, with the table or figure numbers, the captions and page numbers on which they appear. This can be done using the 
       
   974         <code class="literal">\listoftables</code> or 
       
   975         <code class="literal">listoffigures</code> commands.
       
   976       </p>
       
   977 <p id="x_157"></a>Note: Just like table of contents, these lists also require an extra compilation.</p>
       
   978 </div>
       
   979 <div class="section" title="8.6. Cross References">
       
   980 <div class="titlepage"><div><div><h3 class="title">
       
   981 <a name="cross-references"></a>8.6. Cross References</h3></div></div></div>
       
   982 <p id="x_158"></a>LaTeX has a very efficient mechanism of inserting cross-references in documents.</p>
       
   983 <p id="x_159"></a>The command 
       
   984         <code class="literal">\label{name}</code> is used to label figures, tables or segments of text. 
       
   985         <code class="literal">\ref{name}</code> refers to the object marked by the 
       
   986         <code class="literal">name</code> by it's numbering (figure, table, section etc.) 
       
   987         <code class="literal">\pageref{name}</code> gives the page number of the object which has been labeled with 
       
   988         <code class="literal">name</code>.
       
   989       </p>
       
   990 <p id="x_15a"></a>Note: Cross referencing also requires an extra compilation, like table of contents.</p>
       
   991 </div>
       
   992 </div>
       
   993 <div class="section" title="9. Bibliography">
       
   994 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
       
   995 <a name="bibliography"></a>9. Bibliography</h2></div></div></div>
       
   996 <p id="x_15b"></a>Bibliography or references can be added to LaTeX documents in two ways - using the 
       
   997       <code class="literal">thebibliography</code> environment, or using BibTeX. Let's first look at using the 
       
   998       <code class="literal">\thebibliography</code> environment and then move on to BibTeX.
       
   999     </p>
       
  1000 <div class="section" title="9.1.  thebibliography environment">
       
  1001 <div class="titlepage"><div><div><h3 class="title">
       
  1002 <a name="thebibliography-environment"></a>9.1. 
       
  1003         <code class="literal">thebibliography</code> environment
       
  1004       </h3></div></div></div>
       
  1005 <p id="x_15c"></a>Writing bibliographies in LaTeX using the 
       
  1006         <code class="literal">thebibliography</code> environment is pretty easy. You simply have to list down all the bibliography items within the bibliography environment.
       
  1007       </p>
       
  1008 <p id="x_15d"></a>Each entry of the bibliography begins with the command 
       
  1009         <code class="literal">\bibitem[label]{name}</code>. The name is used to cite the bibliography item within the document using  
       
  1010         <code class="literal">\cite{name}</code>. The label option replaces the numbers from the auto enumeration with the labels given. :
       
  1011       </p>
       
  1012 <pre class="programlisting">He used this lion in the illustrations for D Knuth's original TeXbook\cite{DKnuth}, for L Lamport's LaTeX book\cite{LLamport}
       
  1013 
       
  1014 \begin{thebibliography}{99}
       
  1015   \bibitem{DKnuth} Donald E. Knuth (1984). \emph{The TeXbook} (Computers and Typesetting, Volume A). Reading, Massachusetts: Addison-Wesley. ISBN 0-201-13448-9.
       
  1016 
       
  1017   \bibitem{LLamport} Lamport, Leslie (1994). \emph{LaTeX: A document preparation system: User's guide and reference}.
       
  1018    illustrations by Duane Bibby (2nd ed.). Reading, Mass: Addison-Wesley Professional. 
       
  1019 \end{thebibliography}
       
  1020 
       
  1021 </pre>
       
  1022 <p id="x_15e"></a>The 
       
  1023         <code class="literal">99</code> in the example above indicates the maximum width of the label that the references may get. We here assume that the number of Bibliography items will be less than 100. If your document has less than 10 references, you may want to replace 
       
  1024         <code class="literal">99</code> with 
       
  1025         <code class="literal">9</code>.
       
  1026       </p>
       
  1027 </div>
       
  1028 <div class="section" title="9.2. BibTeX">
       
  1029 <div class="titlepage"><div><div><h3 class="title">
       
  1030 <a name="bibtex"></a>9.2. BibTeX</h3></div></div></div>
       
  1031 <p id="x_15f"></a>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.</p>
       
  1032 <p id="x_160"></a>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.</p>
       
  1033 <p id="x_161"></a>The BibTeX database is stored in a 
       
  1034         <code class="literal">.bib</code> file. The structure of the file is quite simple and an example is shown below. :
       
  1035       </p>
       
  1036 <pre class="programlisting">@book{Lamport94,
       
  1037 author    = "Leslie Lamport",
       
  1038 title     = "A Document Preparation System: User's Guide and Reference",
       
  1039 publisher = "Addison-Wesley Professional",
       
  1040 year      = "1994",
       
  1041 edition    = "second",
       
  1042 note      = "illustrations by Duane Bibby"
       
  1043 }
       
  1044 
       
  1045 </pre>
       
  1046 <p id="x_162"></a>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, 
       
  1047         <code class="literal">article, book, conference, manual, proceedings, unpublished</code>.
       
  1048       </p>
       
  1049 <p id="x_163"></a>The type of reference is followed by a left curly brace, and immediately followed by the citation key. The citation key, 
       
  1050         <code class="literal">Lamport94</code> in the example above is used to cite this reference using the command 
       
  1051         <code class="literal">\cite{Lamport94}</code>.
       
  1052       </p>
       
  1053 <p id="x_164"></a>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.</p>
       
  1054 <p id="x_165"></a>To get your LaTeX document to use the bibliography database, you just add the following lines to your LaTeX document. :</p>
       
  1055 <pre class="programlisting">\bibliographystyle{plain}
       
  1056 \bibliography{LaTeX}
       
  1057 
       
  1058 </pre>
       
  1059 <p id="x_166"></a>Bibliography styles are files that tell BibTeX how to format the information stored in the 
       
  1060         <code class="literal">.bib</code> database file. The style file for this example is 
       
  1061         <code class="literal">plain.bst</code>. Note that you do not need to add the 
       
  1062         <code class="literal">.bst</code> 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.
       
  1063       </p>
       
  1064 <p id="x_167"></a>The 
       
  1065         <code class="literal">bibliography</code> command specifies the file that should be used as the database for references. The file used in this example is 
       
  1066         <code class="literal">LaTeX.bib</code>
       
  1067       </p>
       
  1068 <div class="section" title="9.2.1. Compiling">
       
  1069 <div class="titlepage"><div><div><h4 class="title">
       
  1070 <a name="compiling"></a>9.2.1. Compiling</h4></div></div></div>
       
  1071 <p id="x_168"></a>Adding BibTeX based references, slightly complicates the process of compiling the document to obtain the desired output. The exact workings of LaTeX and BibTeX will not be explained here. The procedure for obtaining the output (without any explanations) is as follows:</p>
       
  1072 <div class="orderedlist"><ol class="orderedlist" type="1">
       
  1073 <li class="listitem"><p id="x_169"></a>Compile the 
       
  1074               <code class="literal">.tex</code> file using 
       
  1075               <code class="literal">pdflatex</code> - 
       
  1076               <code class="literal">$pdflatex LaTeX(.tex)</code>
       
  1077             </p></li>
       
  1078 <li class="listitem"><p id="x_16a"></a>Compile the 
       
  1079               <code class="literal">.bib</code> file using 
       
  1080               <code class="literal">bibtex</code> -  
       
  1081               <code class="literal">$bibtex LaTeX(.bib)</code>
       
  1082             </p></li>
       
  1083 <li class="listitem"><p id="x_16b"></a>Compile the 
       
  1084               <code class="literal">.tex</code> file again.
       
  1085             </p></li>
       
  1086 <li class="listitem"><p id="x_16c"></a>Compile the 
       
  1087               <code class="literal">.tex</code> file for one last time!
       
  1088             </p></li>
       
  1089 </ol></div>
       
  1090 </div>
       
  1091 </div>
       
  1092 </div>
       
  1093 <div class="section" title="10. Typesetting Math">
       
  1094 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
       
  1095 <a name="typesetting-math"></a>10. Typesetting Math</h2></div></div></div>
       
  1096 <p id="x_16d"></a>It is advisable to use the AMS-LaTeX bundle to typeset mathematics in LaTeX. It is a collection of packages and classes for mathematical typesetting.</p>
       
  1097 <p id="x_16e"></a>We load 
       
  1098       <code class="literal">amsmath</code> by issuing the 
       
  1099       <code class="literal">\usepackage{amsmath}</code> in the preamble. Through out this section, it is assumed that the 
       
  1100       <code class="literal">amsmath</code> package has been loaded.
       
  1101     </p>
       
  1102 <div class="section" title="10.1. Math Mode">
       
  1103 <div class="titlepage"><div><div><h3 class="title">
       
  1104 <a name="math-mode"></a>10.1. Math Mode</h3></div></div></div>
       
  1105 <p id="x_16f"></a>There are a few differences between the 
       
  1106         <span class="emphasis"><em>math mode</em></span> and the 
       
  1107         <span class="emphasis"><em>text mode</em></span>:
       
  1108       </p>
       
  1109 <div class="orderedlist"><ol class="orderedlist" type="1">
       
  1110 <li class="listitem"><p id="x_170"></a>Most spaces and line breaks do not have any significance, as all spaces are either derived logically from the mathematical expressions, or have to be specified with special commands such as 
       
  1111             <code class="literal">\</code>, 
       
  1112             <code class="literal">\quad</code> or 
       
  1113             <code class="literal">\qquad</code>
       
  1114           </p></li>
       
  1115 <li class="listitem"><p id="x_171"></a>Empty lines are not allowed.</p></li>
       
  1116 <li class="listitem"><p id="x_172"></a>Each letter is considered to be the name of a variable and will be typeset as such. If you want to typeset normal text within a formula, then you have to enter the text using the \text{...} command</p></li>
       
  1117 </ol></div>
       
  1118 </div>
       
  1119 <div class="section" title="10.2. Single Equations">
       
  1120 <div class="titlepage"><div><div><h3 class="title">
       
  1121 <a name="single-equations"></a>10.2. Single Equations</h3></div></div></div>
       
  1122 <p id="x_173"></a>Mathematical equations can be inserted in-line within a paragraph (
       
  1123         <span class="emphasis"><em>text style</em></span>), or the paragraph can be broken to typeset it separately (
       
  1124         <span class="emphasis"><em>display style</em></span>).
       
  1125       </p>
       
  1126 <p id="x_174"></a>A mathematical equation within a paragraph is entered between 
       
  1127         <code class="literal">$</code> and 
       
  1128         <code class="literal">$</code>. Larger equations are set apart from the paragraph, by enclosing them within 
       
  1129         <code class="literal">\begin{equation}</code> and 
       
  1130         <code class="literal">\end{equation}</code>. If you don't wish to number a particular equation, the starred version of equation can be used. 
       
  1131         <code class="literal">\begin{equation*}</code> and 
       
  1132         <code class="literal">\end{equation*}</code>
       
  1133       </p>
       
  1134 <p id="x_175"></a>The equation can also be cross referenced using the 
       
  1135         <code class="literal">\label</code> and 
       
  1136         <code class="literal">\eqref</code> commands.
       
  1137       </p>
       
  1138 </div>
       
  1139 <div class="section" title="10.3. Basic Elements">
       
  1140 <div class="titlepage"><div><div><h3 class="title">
       
  1141 <a name="basic-elements"></a>10.3. Basic Elements</h3></div></div></div>
       
  1142 <p id="x_176"></a>Greek Letters can are entered as 
       
  1143         <code class="literal">\alpha, \beta, \gamma, \delta, ...</code> for lowercase letters and 
       
  1144         <code class="literal">\Alpha, \Beta, \Gamma, ...</code> for uppercase ones.
       
  1145       </p>
       
  1146 <p id="x_177"></a>Exponents and subscripts can be typeset using the carat 
       
  1147         <code class="literal">^</code> and the underscore 
       
  1148         <code class="literal">_</code> respectively. Most of the math mode commands act only on the next character. If you want a command to affect several characters, they need to be enclosed in curly braces.
       
  1149       </p>
       
  1150 <p id="x_178"></a>The 
       
  1151         <code class="literal">\sqrt</code> command is used to typeset the square root symbol. LaTeX of the root sign is determined automatically. The nth root is generated with 
       
  1152         <code class="literal">\sqrt[n]</code>.
       
  1153       </p>
       
  1154 <p id="x_179"></a>To explicitly show a multiplication a dot may be shown. 
       
  1155         <code class="literal">\cdot</code> could be used, which typesets the dot to the center. 
       
  1156         <code class="literal">\cdots</code> is three centered dots while 
       
  1157         <code class="literal">\ldots</code> sets the dots on the baseline. Besides that 
       
  1158         <code class="literal">\vdots</code> for vertical and 
       
  1159         <code class="literal">\ddots</code> can be used for diagonal dots.
       
  1160       </p>
       
  1161 <p id="x_17a"></a>A fraction can be typeset with the command 
       
  1162         <code class="literal">\frac{..}{..}</code>
       
  1163       </p>
       
  1164 <p id="x_17b"></a>The integral operator is generated with 
       
  1165         <code class="literal">\int</code>, the sum operator with 
       
  1166         <code class="literal">\sum</code>, and the product operator with 
       
  1167         <code class="literal">\prod</code>. The upper and lower limits are specified with 
       
  1168         <code class="literal">^</code> and 
       
  1169         <code class="literal">_</code> like subscripts and superscripts.
       
  1170       </p>
       
  1171 <p id="x_17c"></a>LaTeX provides all kinds of braces as delimiters. The round and square brackets can be produces using the keys on the keyboard and appending a backslash. Other delimiters can be produced using special commands of LaTeX. Placing 
       
  1172         <code class="literal">\left</code> in front of an opening delimiter and 
       
  1173         <code class="literal">\right</code> in front of a closing delimiter, instructs LaTeX to automatically take care of the sizes of the delimiters.
       
  1174       </p>
       
  1175 </div>
       
  1176 <div class="section" title="10.4. Multiple Equations">
       
  1177 <div class="titlepage"><div><div><h3 class="title">
       
  1178 <a name="multiple-equations"></a>10.4. Multiple Equations</h3></div></div></div>
       
  1179 <p id="x_17d"></a>Long formulae that run over several lines or equation systems, can be typeset using the 
       
  1180         <code class="literal">align</code> or 
       
  1181         <code class="literal">align*</code> environments. 
       
  1182         <code class="literal">align</code> numbers each of the lines in the environment, and 
       
  1183         <code class="literal">align*</code> as expected, does not number any of them.
       
  1184       </p>
       
  1185 <p id="x_17e"></a>The 
       
  1186         <code class="literal">&amp;</code> is used to align the equations vertically and the 
       
  1187         <code class="literal">\\</code> command is used to break the lines. Line numbering can be skipped for a particular line in the 
       
  1188         <code class="literal">align</code> environment by placing a 
       
  1189         <code class="literal">\nonumber</code> before the line break.
       
  1190       </p>
       
  1191 <pre class="programlisting">\begin{align}
       
  1192 \alpha^2 + \beta^2 &amp;= \gamma^2 \\
       
  1193 \sum_{i=1}^ni &amp;= \frac{n(n+1)}{2}\\
       
  1194 \sqrt{-1} &amp;= \pm1 \nonumber
       
  1195 \end{align}
       
  1196 
       
  1197 
       
  1198 </pre>
       
  1199 </div>
       
  1200 <div class="section" title="10.5. Arrays and Matrices">
       
  1201 <div class="titlepage"><div><div><h3 class="title">
       
  1202 <a name="arrays-and-matrices"></a>10.5. Arrays and Matrices</h3></div></div></div>
       
  1203 <p id="x_17f"></a>To typeset arrays, use the 
       
  1204         <code class="literal">array</code> environment. It works similar to the 
       
  1205         <code class="literal">tabular</code> environment. The 
       
  1206         <code class="literal">\\</code> command is used to break the lines. :
       
  1207       </p>
       
  1208 <pre class="programlisting">\begin{equation*}
       
  1209 \mathbf{X} = \left(
       
  1210  \begin{array}{ccc}
       
  1211  a_1 &amp; a_2 &amp; \ldots \\
       
  1212  b_1 &amp; b_2 &amp; \ldots \\
       
  1213  \vdots &amp; \vdots &amp; \ddots
       
  1214  \end{array} \right)
       
  1215 \end{equation*}
       
  1216 
       
  1217 </pre>
       
  1218 <p id="x_180"></a>The 
       
  1219         <code class="literal">array</code> environment can also be used to typeset piecewise functions by using a “.” as an invisible 
       
  1220         <code class="literal">\right</code> delimiter :
       
  1221       </p>
       
  1222 <pre class="programlisting">\begin{equation*}
       
  1223 f(x) = \left\{
       
  1224  \begin{array}{rl}
       
  1225    0 &amp; \text{if } x \le 0\\
       
  1226    1 &amp; \text{if } x &gt; 0
       
  1227  \end{array} \right.
       
  1228  \end{equation*}
       
  1229 
       
  1230 </pre>
       
  1231 <p id="x_181"></a>Six different types of matrix environments are available in the 
       
  1232         <code class="literal">amsmath</code> package for typesetting matrices.  They essentially have different delimiters: 
       
  1233         <code class="literal">matrix</code> (none), 
       
  1234         <code class="literal">pmatrix</code> (, 
       
  1235         <code class="literal">bmatrix</code> [, 
       
  1236         <code class="literal">Bmatrix</code> {, 
       
  1237         <code class="literal">vmatrix</code> | and 
       
  1238         <code class="literal">Vmatrix</code> ‖. In these matrix environments, the number of columns need not be specified, unlike the 
       
  1239         <code class="literal">array</code> environment. :
       
  1240       </p>
       
  1241 <pre class="programlisting">\begin{equation*}
       
  1242   \begin{matrix}
       
  1243   1 &amp; 2 \\
       
  1244   3 &amp; 4
       
  1245   \end{matrix} \qquad
       
  1246 
       
  1247   \begin{bmatrix}
       
  1248   1 &amp; 2 &amp; 3 \\
       
  1249   4 &amp; 5 &amp; 6 \\
       
  1250   7 &amp; 8 &amp; 9
       
  1251   \end{bmatrix}
       
  1252 \end{equation*}
       
  1253 
       
  1254 </pre>
       
  1255 </div>
       
  1256 </div>
       
  1257 <div class="section" title="11. Miscellaneous Stuff">
       
  1258 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
       
  1259 <a name="miscellaneous-stuff"></a>11. Miscellaneous Stuff</h2></div></div></div>
       
  1260 <div class="section" title="11.1. Presentations">
       
  1261 <div class="titlepage"><div><div><h3 class="title">
       
  1262 <a name="presentations"></a>11.1. Presentations</h3></div></div></div>
       
  1263 <p id="x_182"></a>LaTeX has quite a few options to produce presentation slides. We shall look at the 
       
  1264         <code class="literal">beamer</code> class, which is well developed and easy to use. We shall only briefly look at some of the features of beamer. For the best documentation, look at the beamer user guide.
       
  1265       </p>
       
  1266 <p id="x_183"></a>To write a 
       
  1267         <code class="literal">beamer</code> presentation, it is recommended that you use one of the templates that beamer provides. We shall use the 
       
  1268         <code class="literal">speaker_introduction</code> template to get started with beamer.
       
  1269       </p>
       
  1270 <p id="x_184"></a>As you can see, the document begins with the 
       
  1271         <code class="literal">documentclass</code> being set to beamer.
       
  1272       </p>
       
  1273 <p id="x_185"></a>The 
       
  1274         <code class="literal">\setbeamertemplate</code> command sets the template for various parameters. The 
       
  1275         <code class="literal">background canvas</code>, 
       
  1276         <code class="literal">headline</code> and 
       
  1277         <code class="literal">footline</code> are being set using the command.
       
  1278       </p>
       
  1279 <p id="x_186"></a>
       
  1280         <code class="literal">\usetheme</code> command sets the theme to be used in the presentation.
       
  1281       </p>
       
  1282 <p id="x_187"></a>Notice that each slide is enclosed within 
       
  1283         <code class="literal">\begin{frame}</code> and 
       
  1284         <code class="literal">\end{frame}</code> commands. The 
       
  1285         <code class="literal">\begin{frame}</code> command can be passed the Title and Subtitle of the slide as parameters.
       
  1286       </p>
       
  1287 <p id="x_188"></a>To achieve more with beamer, it is highly recommended that you look at the 
       
  1288         <code class="literal">beameruserguide</code>.
       
  1289       </p>
       
  1290 </div>
       
  1291 <div class="section" title="11.2. Including Code">
       
  1292 <div class="titlepage"><div><div><h3 class="title">
       
  1293 <a name="including-code"></a>11.2. Including Code</h3></div></div></div>
       
  1294 <p id="x_189"></a>The 
       
  1295         <code class="literal">listings</code> package can be used to embed source code into your LaTeX document. We shall briefly explore inserting python code into our document.
       
  1296       </p>
       
  1297 <p id="x_18a"></a>Obviously, you first need to tell LaTeX that you want it to use the 
       
  1298         <code class="literal">listings</code> package, using the 
       
  1299         <code class="literal">\usepackage</code> command. :
       
  1300       </p>
       
  1301 <pre class="programlisting">\usepackage{listings}
       
  1302 
       
  1303 </pre>
       
  1304 <p id="x_18b"></a>Then, we tell LaTeX that we are going to embed Python code into this document. A simple code highlighting for Python code can be achieved using this. :</p>
       
  1305 <pre class="programlisting">\lstset{language=Python,
       
  1306         showstringspaces=false,
       
  1307        }
       
  1308 
       
  1309 </pre>
       
  1310 <p id="x_18c"></a>You might want to customize the code highlighting further using other variables like 
       
  1311         <code class="literal">basicstyle</code>, 
       
  1312         <code class="literal">commentstyle</code>, 
       
  1313         <code class="literal">stringstyle</code>, 
       
  1314         <code class="literal">keywordstyle</code> etc. For detailed information on all this, you should look at the 
       
  1315         <code class="literal">listings</code> package documentation.
       
  1316       </p>
       
  1317 <p id="x_18d"></a>You include a block of code into your document by enclosing it within the 
       
  1318         <code class="literal">lstlisting</code> environment. :
       
  1319       </p>
       
  1320 <pre class="programlisting">\begin{lstlisting}
       
  1321 string="Hello, World! "
       
  1322 for i in range(10):
       
  1323     print string*i
       
  1324 \end{lstlisting} 
       
  1325 
       
  1326 </pre>
       
  1327 <p id="x_18e"></a>You can also include source code files directly into your latex document, using the 
       
  1328         <code class="literal">lstinputlisting</code> command. :
       
  1329       </p>
       
  1330 <pre class="programlisting">\lstinputlisting[lastline=20]{lstexample.py}
       
  1331 
       
  1332 </pre>
       
  1333 <p id="x_18f"></a>This command includes the first 20 lines of the file 
       
  1334         <code class="literal">lstexample.py</code> into out LaTeX document.
       
  1335       </p>
       
  1336 </div>
       
  1337 <div class="section" title="11.3. Including files">
       
  1338 <div class="titlepage"><div><div><h3 class="title">
       
  1339 <a name="including-files"></a>11.3. Including files</h3></div></div></div>
       
  1340 <p id="x_190"></a>When working on a large document, it is convenient sometimes, to split the large file into smaller input files and club them together at the time of compiling.</p>
       
  1341 <p id="x_191"></a>The 
       
  1342         <code class="literal">\input</code> or 
       
  1343         <code class="literal">\include</code> commands may be used to embed one LaTeX file into another. The 
       
  1344         <code class="literal">\input</code> command is equivalent to a copy and paste of the document, just before the compilation. The 
       
  1345         <code class="literal">\include</code> command is exactly similar, except for the fact that it creates a new page every time it is issued.
       
  1346       </p>
       
  1347 <p id="x_192"></a>
       
  1348         <code class="literal">\input{file}</code> or 
       
  1349         <code class="literal">\include{file}</code> commands will include the file 
       
  1350         <code class="literal">file1.tex</code> with in the file where the command has been issued. Note that you do not need to specify the 
       
  1351         <code class="literal">.tex</code> extension of the file.
       
  1352       </p>
       
  1353 <p id="x_193"></a>The 
       
  1354         <code class="literal">\includeonly</code> is useful for debugging or testing the LaTeX document that you are creating, since it restricts the 
       
  1355         <code class="literal">\include</code> command. Only the files which are given as arguments to the 
       
  1356         <code class="literal">\includeonly</code> command will be included in the document (wherever a 
       
  1357         <code class="literal">\include</code> command for those files, has been issued).
       
  1358       </p>
       
  1359 <div class="section" title="11.3.1. A note on filenames">
       
  1360 <div class="titlepage"><div><div><h4 class="title">
       
  1361 <a name="a-note-on-filenames"></a>11.3.1. A note on filenames</h4></div></div></div>
       
  1362 <p id="x_194"></a>Never use filenames or directories that contain spaces. Make filenames as long or short as you would like, but strictly avoid spaces. Stick to upper or lower case letters (without accents), the digits, the hyphen and the full stop or period.</p>
       
  1363 </div>
       
  1364 </div>
       
  1365 </div>
       
  1366 <div class="section" title="12. Recommended Reading">
       
  1367 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
       
  1368 <a name="recommended-reading"></a>12. Recommended Reading</h2></div></div></div>
       
  1369 <div class="orderedlist"><ol class="orderedlist" type="1">
       
  1370 <li class="listitem"><p id="x_195"></a>
       
  1371           <span class="emphasis"><em>LaTeX Wikibook</em></span>
       
  1372         </p></li>
       
  1373 <li class="listitem"><p id="x_196"></a>
       
  1374           <span class="emphasis"><em>The Not So Short Introduction to LaTeX2e</em></span> by Tobias Oetikar et al..
       
  1375         </p></li>
       
  1376 </ol></div>
       
  1377 </div>
       
  1378 </div>
       
  1379 </div></body>
       
  1380 </html>