latex/handout.rst
author Puneeth Chaganti <puneeth@fossee.in>
Mon, 24 Aug 2009 05:33:40 +0530
changeset 30 3ca8ab883c13
child 36 4c4c8a9795b2
permissions -rw-r--r--
First Draft of LaTeX handout added.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
     1
LaTeX
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
     2
=====
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
     3
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
     4
Introduction
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
     5
------------
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
     6
LaTeX is a typesetting program that is excellent for producting scientific and mathematical documents of high typographical quality. It is also suitable for producing all sorts of other documents, from simple letters to complete books. LaTeX uses TeX as its formatting engine.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
     7
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
     8
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
     9
TeX & LaTeX
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    10
~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    11
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    12
TeX
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    13
+++
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    14
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    15
TeX is a typesetting system designed and mostly written by Donald Knuth. It was designed with two goals in mind-
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    16
  
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    17
1. To allow anybody to produce high-quality books using a reasonable amount of effort. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    18
2. To provide a system that would give the exact same results on all computers, now and in the future
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    19
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    20
It’s also a Turing-complete programming language, in the sense that it supports the if-else construct, it can calculate (the calculations are performed while compiling the document), etc., but you would find it very hard to make anything else but typesetting with it. The fine control TeX offers makes it very powerful, but also difficult and time-consuming to use.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    21
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    22
TeX is renowned for being extremely stable, for running on many different kinds of computers, and for being virtually bug free. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    23
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    24
The version number of TeX is converging to π and is now at 3.1415926.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    25
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    26
The characters T, E, X in the name come from capital Greek letters tau, epsilon, and chi, as the name of TeX derives from the Greek: τέχνη (skill, art, technique); for this reason, TeX's creator Donald Knuth promotes a /tɛx/ pronunciation
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    27
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    28
LaTeX
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    29
+++++
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    30
LaTeX is a macro package based on TeX created by Leslie Lamport. It was intended to provide a high-level language that provides access to TeX. It essentially comprises a collection of TeX macros and a program to process LaTeX documents. For the end-users, it is much simpler to use than TeX. It has become the dominant method for using TeX (relatively few people write in TeX anymore).
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    31
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    32
LaTeX is pronounced either as "Lah-tech" or "Lay-tech"
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    33
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    34
WYSIWG vs. WYSIWM
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    35
~~~~~~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    36
The Advantages-
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    37
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    38
  * It is free (both as in free-beer and free-speech)
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    39
  * It is platform independent. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    40
  * It is very stable. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    41
  * LaTeX is ASCII and any text editor of your choice can be used to view and edit the source.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    42
  * The typesetting is better, especially the maths.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    43
  * It encourages Authors to write well-structured texts, since specifying structure is an integral part of how LaTeX works.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    44
  * LaTeX is extensible. If you want a new feature, you can look around for a free add-on or write one yourself. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    45
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    46
and some Disadvantages - 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    47
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    48
  * Font selection is difficult 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    49
  * LaTeX's not good at flowing text around pictures.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    50
  * LaTeX encourages (almost insists on) structured writing and the separation of style from content. This is not the way that many people (especially non-programmers) are used to working.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    51
  * Without a WYSIWYG front end, it's not always easy to find out how to do things.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    52
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    53
LaTeX Source
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    54
~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    55
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    56
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    57
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    58
  %hello.tex - First LaTeX document
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    59
  \documentclass{article}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    60
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    61
  \begin{document}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    62
    Hello, World!
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    63
  \end{document}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    64
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    65
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    66
Spaces
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    67
++++++
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    68
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    69
LaTeX ignores whitespaces. Multiple white spaces are treated as one space. An empty line between two lines of text is considered as a change of paragraphs. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    70
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    71
Special Characters
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    72
++++++++++++++++++
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    73
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    74
The characters ``~ # $ % ^ & _ { } \`` have special meanings associated with them.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    75
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    76
These characters can be used in your document by adding a prefix backslash. ``\~ \# \% \$ \^ \& \_ \{ \} \textbackslash``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    77
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    78
Comments
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    79
++++++++
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    80
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    81
% character is used to insert comments into a LaTeX document. All the text from the % character to the end of that line is ignored by LaTeX.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    82
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    83
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    84
LaTeX Commands
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    85
++++++++++++++
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    86
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    87
* LaTeX commands are case sensitive. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    88
* They start with a backslash ``\``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    89
* They come in two formats
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    90
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    91
  - a backslash followed by a name consisting of letters only. These command names are terminated by any non-letter. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    92
  - a backslash followed by exactly one non-character. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    93
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    94
* Some commands need to be given a parameter, which is enclosed in curly braces ``{ }``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    95
* Some command support optional parameters, which are added after the name in square brackets ``[ ]``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    96
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    97
LaTeX Environments
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    98
++++++++++++++++++
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
    99
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   100
Environments are similar in their role, to commands, except that they effect a larger part of the document.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   101
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   102
* They begin with a ``\begin`` and end with a ``\end``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   103
* Nested environments are generally supported
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   104
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   105
Anything in LaTeX can be expressed in terms of Commands and Environments.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   106
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   107
Hello, World!
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   108
~~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   109
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   110
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   111
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   112
  %hello.tex - First LaTeX document
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   113
  \documentclass{article}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   114
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   115
  \begin{document}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   116
    Hello, World!
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   117
  \end{document}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   118
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   119
Now, look at what each line does. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   120
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   121
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   122
``%hello.tex - First LaTeX document``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   123
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   124
  This line is a comment. Comments in LaTeX begin with a %
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   125
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   126
``\documentclass{article}``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   127
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   128
  This line is a command and sets the documentclass to be used for this document to ``article``. If you want to change the appearance of the document, you simply have to change the documentclass. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   129
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   130
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   131
``\begin{document}``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   132
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   133
  This line is the beginning of a LaTeX environment called ``document``. It informs LaTeX that the content of the document is beginning. Anything between the ``\documentclass`` line and this line is called the *preamble*
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   134
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   135
``Hello, World!``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   136
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   137
  This is the text that is displayed in the document. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   138
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   139
``\end{document}``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   140
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   141
  The ``document`` environment ends here. It tells LaTeX that the document is complete and anything written after this line will be ignored by LaTeX.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   142
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   143
Compiling & Output
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   144
~~~~~~~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   145
``latex`` command can be used to get ``dvi`` output. But, we shall be using ``pdflatex`` all through this document and producing ``pdf`` output.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   146
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   147
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   148
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   149
  $pdflatex hello.tex
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   150
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   151
  Output written on hello.pdf (1 page, 5733 bytes).
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   152
  Transcript written on hello.log.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   153
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   154
.. .. image:: sample/hello.jpg
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   155
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   156
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   157
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   158
Document Structure
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   159
------------------
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   160
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   161
This section gives a basic idea about the general sturcture of a LaTeX document. LaTeX is different from other typesetting software in that, it requires the user to specify the logical and semantic structure of the text. Therefore, it helps (almost forces) the author to organize his text better and hence improving the structure and clarity of the document. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   162
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   163
``\documentclass``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   164
~~~~~~~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   165
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   166
The type of the document to be created is specified using the ``\documentclass`` command. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   167
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   168
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   169
  \documentclass[options]{class}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   170
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   171
Here, ``class`` defines the type of document that is to be created. The LaTeX distribution provides a variety of document class, that can be used for a variety of purposes. The ``options`` parameter customizes various properties of the document. The options have to be separated by commas. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   172
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   173
For example ``\documentclass[11pt, twoside, a4paper]{article}`` produces a document of the article class with the base font size as eleven points, and to produce a layout suitable for double sided printing on A4 paper. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   174
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   175
Some of the document classes that are available in LaTeX are ``article, report, book, slides, letter``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   176
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   177
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   178
The document environment
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   179
~~~~~~~~~~~~~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   180
The text of the document is enclosed in between the commands ``\begin{document}`` and ``\end{document}`` which identify the beginning and the end of the document respectively. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   181
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   182
The reason for marking off the beginning of your text is that LaTeX allows you to insert extra setup specifications before it. The reason for marking off the end of your text is to provide a place for LaTeX to be programmed to do extra stuff automatically at the end of the document, like making an index.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   183
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   184
A useful side-effect of marking the end of the document text is that you can store comments or temporary text underneath the \end{document} in the knowledge that LaTeX will never try to typeset them
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   185
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   186
Preamble
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   187
~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   188
Everything written in between the ``\documentclass`` command and the ``\begin{document}`` command is called the Preamble. It normally contains commands that effect the whole document. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   189
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   190
Packages
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   191
~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   192
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   193
While writing your document, you will probably find that there are some areas where basic LaTeX cannot solve your problem. If you want to include graphics, coloured text or source code from a file into your document, you need to enhance the capabilities of LaTeX. Such enhancements are called packages. Packages are activated with the  
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   194
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   195
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   196
  \usepackage[options]{package}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   197
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   198
command, where package is the name of the package and options is a list of keywords that trigger special features in the package. Some packages come with the LaTeX2e distribution and others are provided separately. You can even write your own packages, if and when required. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   199
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   200
Top Matter
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   201
~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   202
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   203
At the beginning of most documents there will be information about the document itself, such as the title and date, and also information about the authors, such as name, address, email etc. All of this type of information within Latex is collectively referred to as top matter. Although never explicitly specified (there is no \topmatter command) you are likely to encounter the term within Latex documentation.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   204
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   205
An example::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   206
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   207
  \documentclass[11pt,a4paper,oneside]{report}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   208
  \title{LaTeX - A Howto}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   209
  \author{The FOSSEE Team}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   210
  \date{August 2009}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   211
  \maketitle
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   212
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   213
The ``\title``, ``\author`` and ``\date`` commands are self-explanaotry. You put the title, author name, and date in curly braces after the relevant command. If no date command is used, today's date is insert by default. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   214
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   215
Topmatter is always finished by the ``\maketitle`` command
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   216
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   217
Abstract
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   218
~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   219
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   220
As most research papers have an abstract, there are predefined commands for telling LaTeX which part of the content makes up the abstract. This should appear in its logical order, therefore, after the top matter, but before the main sections of the body. This command is available for the document class article and report, but not book. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   221
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   222
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   223
  \documentclass{article}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   224
  \begin{abstract}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   225
  Your abstract goes here...
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   226
  \end{abstract}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   227
  \begin{document}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   228
  ...
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   229
  \end{document}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   230
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   231
By default, LaTeX will use the word “Abstract” as a title for your abstract, if you want to change it into anything else, e.g. “Executive Summary”, add the following line in the preamble::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   232
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   233
    \renewcommand{\abstractname}{Executive Summary}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   234
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   235
Sectioning Commands
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   236
~~~~~~~~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   237
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   238
The commands for inserting sections are fairly intuitive. Of course, certain commands are appropriate to different document classes. For example, a book has chapters but an article doesn’t.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   239
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   240
Examples::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   241
  
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   242
  \Chapter{LaTeX}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   243
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   244
  \section{Introduction}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   245
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   246
  \subsection{TeX & LaTeX}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   247
  
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   248
  \subsubsection{TeX}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   249
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   250
Notice that you do not need to specify section numbers. LaTeX will sort that out for you! Also, for sections, you do not need to markup which content belongs to a given block, using \begin and \end commands, for example. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   251
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   252
All the titles of the sections are added automatically to the table of contents (if you decide to insert one). But if you make manual styling changes to your heading, for example a very long title, or some special line-breaks or unusual font-play, this would appear in the Table of Contents as well, which you almost certainly don’t want. LaTeX allows you to give an optional extra version of the heading text which only gets used in the Table of Contents and any running heads, if they are in effect. This optional alternative heading goes in [square brackets] before the curly braces. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   253
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   254
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   255
  \section[Short Title]{This is a very long title and the Short Title will appear in the Table of Contents.}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   256
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   257
Section Numbering
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   258
+++++++++++++++++
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   259
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   260
You don't need to explicitly do any section numbering as LaTeX does it automatically. Parts get roman numerals, Chapters and Sections get decimal numbering and Appendices are lettered. You can change the depth to which section numbering occurs, which is set to 2 by default. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   261
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   262
For example, if you want only the Parts, Chapters and Sections to be numbered and not the subsections, subsubsections etc., you can set the ``secnumdepth`` to 1 using the ``\setcounter`` command. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   263
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   264
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   265
  \setcounter{secnumdepth}{1}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   266
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   267
To get an unnumbered section heading which does not go into the Table of Contents, follow the command name with an asterisk before the opening curly brace.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   268
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   269
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   270
  \subsection*{Introduction}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   271
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   272
All the divisional commands from ``\part*`` to ``\subparagraph*`` have this “starred” version which can be used on special occasions for an unnumbered heading when the setting of ``secnumdepth`` would normally mean it would be numbered.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   273
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   274
Appendices
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   275
~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   276
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   277
The separate numbering of appendices is also supported by LaTeX. The \appendix macro can be used to indicate that following sections or chapters are to be numbered as appendices.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   278
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   279
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   280
  \appendix
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   281
  \chapter{First Appendix}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   282
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   283
  \appendix
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   284
  \section{First Appendix}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   285
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   286
Table of Contents
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   287
~~~~~~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   288
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   289
All auto-numbered headings get entered in the Table of Contents (ToC) automatically. Just add the command ``\tableofcontents`` at the point where you want it placed. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   290
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   291
The counter ``tocdepth`` specifies what depth to take the ToC to. It can be set using the ``\setcounter`` command as shown below. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   292
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   293
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   294
  \setcounter{tocdepth}{3}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   295
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   296
If you want the unnumbered section to be in the table of contents anyway, use the ``\addcontentsline`` command like this.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   297
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   298
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   299
  \section*{Introduction}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   300
  \addcontentsline{toc}{section}{Introduction}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   301
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   302
Entries for the ToC are recorded each time you process your document, and re- produced the next time you process it, so you need to re-run LaTeX one extra time to ensure that all ToC pagenumber references are correctly calculated. We’ve already seen how to use the optional argument to the sectioning commands to add text to the ToC which is slightly different from the one printed in the body of the document. It is also possible to add extra lines to the ToC, to force extra or unnumbered section headings to be included.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   303
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   304
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   305
Bibliography
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   306
~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   307
Any good research paper will have a whole list of references. LaTeX, therefore, has a sane way to manage your references. There are two ways to insert references into your LaTeX document:
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   308
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   309
1. You can embed them within the doucment itself. It's simpler, but it can be time consuming if you are writing several papers about similar subjects so that you often have to cite the same references
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   310
2. You can store them in an external BibTeX file and then link them to your current document. You can also use a BibTeX style to define how they should appear. This way you create a small databases of the references you might need, and use them as and when you need to cite them. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   311
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   312
We shall discuss this in more detail in the Bibliography section. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   313
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   314
Including files
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   315
~~~~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   316
When you are working on a large document, you might want to split the input files into multiple files. LaTeX has three methods for inserting one file into another when compiling. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   317
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   318
1. ``\input``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   319
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   320
  It is equivalent to an automatic cut-paste just before compiling. To include ``file1.tex`` in our document, we just say
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   321
  ::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   322
  
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   323
    \input{file1}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   324
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   325
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   326
2. ``\include``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   327
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   328
  It is similar to the ``\input`` command, except that it inserts a new page, each time it is executed. So, it is useful for inserting large blocks like new chapters. To inlcude chapter1.tex in our document, we say
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   329
  ::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   330
    
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   331
    \include{chapter1}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   332
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   333
3. ``\includeonly``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   334
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   335
  This command is useful in restricting the ``\include`` commands that we wish to be executed. For example, if we have ``\include{chapter1}``, ``\include{chapter2}`` and ``\include{chapter3}`` in the document, but we wish to just verify the changes made to ``chapter1.tex`` and ignore the other chapters for a while, we could add the following command to the preamble.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   336
  ::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   337
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   338
    \includeonly{chapter1}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   339
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   340
A note on filenames
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   341
+++++++++++++++++++
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   342
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   343
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.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   344
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   345
Typesetting Text
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   346
----------------
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   347
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   348
Line and Page Breaks
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   349
~~~~~~~~~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   350
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   351
Books are often typeset with each line having the same length. LaTeX inserts the necessary line breaks and spaces between words by optimizing the con- tents of a whole paragraph. If necessary, it also hyphenates words that would not fit comfortably on a line. How the paragraphs are typeset depends on the document class.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   352
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   353
In special cases it might be necessary to order LaTeX to start a newline. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   354
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   355
``\\`` or ``\newline`` starts a newline without starting a new paragraph. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   356
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   357
``\\*`` additionally prohibits a page break after the line break. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   358
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   359
[Optional material::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   360
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   361
  \linebreak[n], \nolinebreak[n], \pagebreak[n], \nopagebreak[n]
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   362
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   363
  \hyphenation
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   364
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   365
  \mbox
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   366
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   367
]
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   368
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   369
Symbols & More Special Characters
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   370
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   371
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   372
Quotation Marks
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   373
+++++++++++++++
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   374
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   375
You should not use the " for quotation marks as you would on a typewriter. In publishing there are special opening and closing quotation marks. In  A LaTeX, use two ` (grave accent) for opening quotation marks and two ' (vertical quote) for closing quotation marks. For single quotes you use just one of each.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   376
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   377
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   378
  `` Here is an example of putting `text' in quotes ''
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   379
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   380
“ Here is an example of putting ‘text’ in quotes ”
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   381
Need to include an image as example. ?
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   382
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   383
Dashes and Hyphens
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   384
++++++++++++++++++
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   385
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   386
LaTeX has four kinds of dashes. Three of them can be accessed with different number of consecutive dashes. The fourth one is a mathematical symbol, the minus sign. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   387
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   388
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   389
  The names of these dashes are: `-' hyphen, `--' en-dash, `---' em-dash and `$-$' minus sign.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   390
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   391
The names for these dashes are: ‘‐’ hyphen, ‘–’ en-dash, ‘—’ em-dash and ‘−’ minus sign.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   392
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   393
Tilde(~)
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   394
++++++++
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   395
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   396
A character often seen in web addresses is the tilde. To generate this in LaTeX you can use ``\~`` but the result ˜ is not really what you want. Try ``$\sim$`` instead.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   397
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   398
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   399
  http://www.rich.edu/\~{}bush\\
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   400
  http://www.clever.edu/$\sim$demo
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   401
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   402
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   403
http://www.rich.edu/˜bush
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   404
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   405
http://www.clever.edu/~demo
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   406
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   407
Ellipsis
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   408
++++++++
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   409
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   410
On a typewriter, a comma or a period takes the same amount of space as any other letter. In book printing, these characters occupy only a little space and are set very close to the preceding letter. Therefore, you cannot enter ‘ellipsis’ by just typing three dots, as the spacing would be wrong. Instead, there is a special command for these dots. It is called ``\ldots``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   411
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   412
Emphasized Words
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   413
~~~~~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   414
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   415
If a text is typed using a typewriter, important words are emphasized by underlining them.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   416
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   417
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   418
  \underline{text}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   419
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   420
In printed books, however, words are emphasized by typesetting them in an *italic* font. LaTeX provides the command
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   421
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   422
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   423
 \emph{text}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   424
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   425
to emphasize text. If you use emphasizing inside emphasized text, LaTeX uses normal font for emphasizing. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   426
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   427
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   428
  \emph{This is emphasized text, and \emph{this is emphasized text with normal font}, within emphasized text.}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   429
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   430
*This is emphasized text, and* this is emphasized text with normal font, *within emphasized text.*
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   431
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   432
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   433
Cross References
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   434
~~~~~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   435
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   436
In books, reports and articles, there are often cross-references to figures, tables and special segments of text. LaTeX provides the following commands for cross referencing::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   437
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   438
  \label{marker}, \ref{marker} and \pageref{marker} 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   439
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   440
where ``marker`` is an identifier chosen by the user. LaTeX replaces ``\ref`` by the number of the section, subsection, figure, table, or theorem after which the corresponding ``\label`` command was issued. ``\pageref`` prints the page number of the page where the ``\label`` command occurred. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   441
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   442
As with the section titles, the numbers from the previous run are used. Therefore, to get the correct numbering, you will need to compile twice. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   443
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   444
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   445
Footnotes
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   446
~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   447
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   448
With the command::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   449
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   450
  \footnote{footnote text}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   451
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   452
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.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   453
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   454
[optional::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   455
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   456
  \marginpar - Margin notes. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   457
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   458
]
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   459
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   460
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   461
Itemize, Enumerate, and Description
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   462
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   463
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   464
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   465
  \begin{enumerate}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   466
    \item You can mix the list   environments to your taste:
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   467
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   468
    \begin{itemize}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   469
      \item But it might start to look silly.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   470
      \item[-] With a dash.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   471
    \end{itemize}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   472
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   473
  \item Therefore remember:
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   474
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   475
    \begin{description}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   476
      \item[Stupid] things will not become smart 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   477
       because they are in a list.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   478
      \item[Smart] things, though, can be
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   479
       presented beautifully in a list
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   480
    \end{description}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   481
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   482
  \end{enumerate}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   483
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   484
1. You can mix the list environments to your taste:
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   485
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   486
   * But it might start to look silly
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   487
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   488
   - With a dash. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   489
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   490
2. Therefore remember:
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   491
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   492
  **Stupid** things will not become smart because they are in a list
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   493
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   494
  **Smart** things, though, can be presented beautifully in a list. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   495
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   496
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   497
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   498
Flushleft, Flushright, and Center
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   499
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   500
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   501
The environments ``flushleft`` and ``flushright`` generate paragraphs that are either left- or right-aligned. The ``center`` environment generates centered text.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   502
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   503
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   504
Quote, Quotation, and Verse
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   505
~~~~~~~~~~~~~~~~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   506
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   507
The ``quote`` environment is useful for quotes, important phrases and examples.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   508
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   509
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   510
  A typographical rule of thumb for the line length is:
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   511
  \begin{quote}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   512
  On average, no line should
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   513
  be longer than 66 characters.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   514
  \end{quote}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   515
  This is why LaTeX pages have
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   516
  such large borders by default
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   517
  and also why multicolumn print
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   518
  is used in newspapers.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   519
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   520
A typographical rule of thumb for the line length is:
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   521
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   522
  On average, no line should be longer than 66 characters.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   523
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   524
This is why LaTeX pages have such large borders by default and also why multicolumn print is used in newspapers.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   525
  
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   526
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   527
There are two similar environments: the quotation and the verse environments. The quotation environment is useful for longer quotes going over several paragraphs, because it indents the first line of each paragraph.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   528
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   529
The verse environment is useful for poems where the line breaks are important. The lines are separated by issuing a \\\\ at the end of a line and an empty line after each verse.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   530
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   531
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   532
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   533
Abstract
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   534
~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   535
In scientific publications it is customary to start with an abstract which gives the reader a quick overview of what to expect. LaTeX provides the abstract environment for this purpose. Normally abstract is used in documents typeset with the article document class. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   536
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   537
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   538
  \begin{abstract}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   539
  The abstract abstract.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   540
  \end{abstract}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   541
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   542
Verbatim
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   543
~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   544
Text that is enclosed between ``\begin{verbatim}`` and ``\end{verbatim}`` will be directly printed, as if typed on a typewriter, with all line breaks and spaces, without any LaTeX command being executed.     
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   545
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   546
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   547
  \begin{verbatim}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   548
  10 PRINT "HELLO WORLD ";
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   549
  20 GOTO 10
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   550
  \end{verbatim}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   551
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   552
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   553
10 PRINT "HELLO WORLD ";
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   554
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   555
20 GOTO 10
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   556
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   557
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   558
Within a paragraph, similar behavior can be accessed with
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   559
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   560
  
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   561
  \verb+text+ 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   562
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   563
The + is just an example of a delimiter character. You can use any character except letters, * or space.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   564
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   565
The starred verstion of the verbatim environment emphasizes the spaces in the text. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   566
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   567
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   568
  \begin{verbatim*}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   569
  10 PRINT "HELLO WORLD ";
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   570
  20 GOTO 10
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   571
  \end{verbatim*}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   572
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   573
10␣PRINT␣"HELLO␣WORLD␣";
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   574
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   575
20␣GOTO␣10
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   576
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   577
Tables, Figures and Captions
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   578
----------------------------
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   579
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   580
The ``\tabular`` environment
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   581
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   582
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   583
The tabular environment can be used to typeset beautiful tables with optional horizontal and vertical lines. LaTeX determines the width of the columns automatically.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   584
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   585
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   586
  \begin{tabular}[pos]{table spec}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   587
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   588
The table spec argument defines the format of the table. Use an ``l`` for a column of left-aligned text, ``r`` for right-aligned text, and ``c`` for centred text; ``p{width}`` for a column containing justified text with line breaks, and ``|`` for a vertical line.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   589
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   590
If the text in a column is too wide for the page, LaTeX won’t automatically wrap it. Using ``p{width}`` you can define a special type of column which will wrap-around the text as in a normal paragraph.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   591
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   592
The pos argument specifies the vertical position of the table relative to the baseline of the surrounding text. Use either of the letters ``t`` , ``b`` and ``c`` to specify table alignment at the top, bottom or center.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   593
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   594
Within a tabular environment, ``&`` jumps to the next column, ``\\`` starts a new line and ``\hline`` inserts a horizontal line. You can add partial lines by using the ``\cline{i-j}``, where ``i`` and ``j`` are the column numbers the line should extend over.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   595
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   596
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   597
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   598
  \begin{tabular}{|r|l|}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   599
  \hline
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   600
  7C0 & hexadecimal \\
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   601
  3700 & octal \\ \cline{2-2}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   602
  11111000000 & binary \\
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   603
  \hline \hline
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   604
  1984 & decimal \\
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   605
  \hline
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   606
  \end{tabular}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   607
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   608
[include an image of a table, as example]
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   609
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   610
Importing Graphics
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   611
~~~~~~~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   612
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   613
Strictly speaking, LaTeX cannot manage pictures directly: in order to introduce graphics within documents, LaTeX just creates a box with the same size of the image you want to include and embeds the picture, without any other processing. This means you will have to take care that the images you want to include are in the right format to be included. This is not such a hard task because LaTeX supports the most common picture formats around.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   614
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   615
We need to load the ``graphicx`` package in the preamble of the document to be able to include images. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   616
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   617
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   618
  \usepackage{graphicx}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   619
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   620
When compiling with ``pdflatex`` command, (which we assume is being used all through this course) you can insert **jpg**, **png** and **pdf** files. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   621
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   622
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   623
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   624
  \includegraphics[optional arguments]{imagename}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   625
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   626
A few ``optional arguments``:
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   627
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   628
  ``width=xx``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   629
    specify the width of the imported image to ``xx``. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   630
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   631
  ``height=xx``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   632
    specify the height of the imported image to ``xx``. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   633
    Specifying only the width or height of the image will scale the image whilst maintaining the aspect ratio. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   634
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   635
  ``keepaspectratio``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   636
    This can be either set to true or false. When set to true, it will scale the image according to both width and height, without distorting the image so that it does not exceed both the width and the height dimensions. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   637
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   638
  ``scale=xx``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   639
    Scale the image by a factor of ``xx``. For eg. ``scale=2``, will double the image size. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   640
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   641
  ``angle=xx``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   642
    This option can be used to rotate the image by ``xx`` degrees, anti-clockwise. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   643
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   644
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   645
Floats
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   646
~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   647
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   648
Figures and Tables need special treatment, because they cannot be broken across pages. One method would be to start a new page every time a figure or a table is too large to fit on the present page. This approach would leave pages partially empty, which looks very bad.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   649
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   650
The solution to this problem is to ‘float’ any figure or table that does not fit on the current page to a later page, while filling the current page with body text. LaTeX offers two environments for floating bodies; one for tables and one for figures. To take full advantage of these two environments it is important to understand approximately how LaTeX handles floats internally. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   651
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   652
Any material enclosed in a figure or table environment will be treated as floating matter. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   653
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   654
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   655
  \begin{figure}[placement specifier] or 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   656
  \begin{table}[placement specifier]
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   657
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   658
Both float environments support an optional parameter called the placement specifier. This parameter is used to tell LaTeX about the locations to which the float is allowed to be moved. A placement specifier is constructed by building a string of float-placing permissions.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   659
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   660
+-----------+-------------------------------------------------------------------+
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   661
| Specifier | Permission                                                        |
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   662
+-----------+-------------------------------------------------------------------+
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   663
|   h       |  Place the float here                                             |
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   664
|           |  (approximately at the same point it occurs in the source text)   |
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   665
+-----------+-------------------------------------------------------------------+
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   666
|   t       |  Position at the top of the page.                                 |
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   667
+-----------+-------------------------------------------------------------------+
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   668
|   b       |  Position at the bottom of the page.                              |
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   669
+-----------+-------------------------------------------------------------------+
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   670
|   p       |  Put on a special page for floats only.                           |
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   671
+-----------+-------------------------------------------------------------------+
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   672
|   !       |  Override internal parameters Latex uses for determining “good”   | 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   673
|           |  float positions.                                                 |
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   674
+-----------+-------------------------------------------------------------------+
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   675
|   H       |  Places the float at precisely the location in the LaTeX code.    | 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   676
|           |  Requires the float package. ``\usepackage{float}``.              |
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   677
|           |  This is somewhat equivalent to h!                                |
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   678
+-----------+-------------------------------------------------------------------+
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   679
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   680
Examples::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   681
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   682
  \begin{table}[!hbp]
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   683
  \begin{tabular}{...}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   684
  ... table data ...
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   685
  \end{tabular}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   686
  \end{table}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   687
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   688
  \begin{figure}[b]
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   689
    \includegraphics[scale=0.5]{image1.jpg}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   690
  \end{figure}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   691
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   692
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   693
Captions
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   694
~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   695
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   696
It is always good practice to add a caption to any figure or table. All you need to do is use the ``\caption{text}`` command within the float environment. LaTeX will automatically keep track of the numbering of figures, so you do not need to include this within the caption text.     
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   697
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   698
The location of the caption is traditionally underneath the float. However, it is up to you to therefore insert the caption command after the actual contents of the float (but still within the environment). If you place it before, then the caption will appear above the float.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   699
::
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   700
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   701
  \begin{figure}[b]
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   702
    \caption{This is a caption at the top of the image}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   703
    \includegraphics[scale=0.5]{image1.jpg}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   704
  \end{figure}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   705
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   706
  \begin{figure}[b]
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   707
    \includegraphics[scale=0.5]{image1.jpg}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   708
    \caption{This is a caption at the bottom of the image}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   709
  \end{figure}
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   710
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   711
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   712
List of Figures, Tables
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   713
~~~~~~~~~~~~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   714
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   715
Captions can be listed in a “List of Tables” or a “List of Figures” section by using the ``\listoftables`` or ``\listoffigures`` commands, respectively. The caption used for each table or figure will appear in these lists, along with the table or figure numbers, and page numbers that they appear on.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   716
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   717
The ``\caption`` command also has an optional parameter, ``\caption[short]{long}`` which is used for the List of Tables or List of Figures. Typically the short description is for the caption listing, and the long description will be placed beside the figure or table. This is particularly useful if the caption is long, and only a “one-liner” is desired in the figure/table listing. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   718
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   719
Typesetting Math
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   720
----------------
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   721
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   722
If you wish to typset advanced mathematics, it is best to use the AMS-LaTeX bundle, which is a collection of packages and classes for mathematical typsetting. Note that LaTeX does, provide some basic features and environments for mathematical typsetting, but they are limited and in some cases even inconsistent. We shall stick to using the ``amsmath`` package from the AMS-LaTeX bundle, throughout this course. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   723
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   724
We load ``amsmath`` by issuing the ``\usepackage{amsmath}`` in the preamble. Through out this section, it is assumed that the ``amsmath`` package has been loaded. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   725
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   726
Math Mode
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   727
~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   728
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   729
There are a few differences between the *math mode* and the *text mode*:
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   730
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   731
1. 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 ``\,``, ``\quad`` or ``\qquad``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   732
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   733
2. Empty lines are not allowed.  
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   734
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   735
3. 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
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   736
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   737
Single Equations
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   738
~~~~~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   739
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   740
There are two ways to typeset mathematical equations in LaTeX - inline within a paragraph (*text style*), or the paragraph can be broken to typeset it separately (*display style*). 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   741
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   742
A mathematical equation within a paragraph is entered between ``$`` and ``$``.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   743
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   744
If you want the larger equations to be set apart from the paragraph, it is better to use the display style. To do this, you enclose the equations within ``\begin{equation}`` and ``\end{equation}``. You can then \label an equation number and refer to it somewhere else in the text by using the ``\eqref`` command. If you want to name the equation something specific, you ``\tag`` it instead. You can’t use ``\eqref`` with ``\tag``. If you donot want LaTeX to number a particular equation, use the starred version of equation using an ``\begin{equation*}`` and ``\end{equation*}``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   745
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   746
[need to include images as examples?]
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   747
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   748
Building Blocks of a Mathematical Formula
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   749
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   750
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   751
Greek Letters can are entered as ``\alpha, \beta, \gamma, \delta, ...`` for lowercase letters and ``\Alpha, \Beta, \Gamma, ...`` for uppercase ones. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   752
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   753
Exponents and Subscripts can be specified using the ^ and the _ character. Most math mode commands act only on the next character, so if you want a command to affect several characters, you have to group them together using curly braces: {...}.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   754
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   755
The square root is entered as ``\sqrt``; the nth root is generated with ``\sqrt[n]``. The size of the root sign is determined automatically by LaTeX. If just the sign is needed, use ``\surd``.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   756
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   757
To explicitly show a multiplication a dot may be shown. \cdot could be used, which typesets the dot to the centre. \cdots is three centered dots while \ldots sets the dots on the baseline. Besides that, there are \vdots for vertical and \ddots for diagonal dots.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   758
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   759
A fraction can be typeset with the command ``\frac{...}{...}``
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   760
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   761
The integral operator is generated with ``\int``, the sum operator with ``\sum``, and the product operator with ``\prod``. The upper and lower limits are specified with ``^`` and ``_`` like subscripts and superscripts.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   762
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   763
If you put ``\left`` in front of an opening delimiter and ``\right`` in front of a closing delimiter, LaTeX will automatically determine the correct size of the delimiter. Note that you must close every ``\left`` with a corresponding ``\right``.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   764
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   765
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   766
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   767
Vertically Aligned Material
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   768
~~~~~~~~~~~~~~~~~~~~~~~~~~~
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   769
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   770
Multiple Equations
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   771
++++++++++++++++++
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   772
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   773
For formulae running over several lines or for equation systems, you can use the environments ``align`` and ``align*`` instead of ``equation`` and ``equation*``. With ``align`` each line gets an equation number. The ``align*`` does not number anything. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   774
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   775
The ``align`` environments center the single equation around the ``&`` sign. The ``\\`` command breaks the lines. If you only want to enumerate some of equations, use ``\nonumber`` to remove the number. It has to be placed before the ``\\``.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   776
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   777
Arrays and Matrices
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   778
+++++++++++++++++++
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   779
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   780
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   781
Bibliography
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   782
------------
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   783
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   784
You can produce a bibliography with the ``thebibliography`` environment.
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   785
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   786
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   787
--------------------------------------------------------
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   788
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   789
Acknowledgements, Attributions
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   790
------------------------------
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   791
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   792
1. *LaTeX Wikibook*
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   793
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   794
2. *The Not So Short Introduction to LaTeX2e* by Tobias Oetikar et. al. 
3ca8ab883c13 First Draft of LaTeX handout added.
Puneeth Chaganti <puneeth@fossee.in>
parents:
diff changeset
   795