PUBLISHING DOCUMENTS USING LATEX
Ch:12
What is Latex
Using Latex
General features of Latex
Latex
Latex Language
Arguments
Latex
Latex Code
\documentclass[12pt]{article}
\title{Line handling in \Latex}
\date{May 2013}
\begin{document}
\section{Continuous Text}
\textsf{We have no wings, we cannot fly but we have legs to sail and climb by slow degrees and by and by the cloudy summits of our time}
\section{Text with seperate Lines}
\textsf{Heights by great men reached and kept \\were not attained by a sudden flight\\but they, while their companious slept,\\were toiling upwards in the night} \end{document}
Output
Reserved Characters
Group
Environment
To use latex, we need any ________software.
__________is a very popular Latex distribution available in ununtu linux.
Tex Live
Latex document can be created in which type of software?
any plain text editor like gedit or Scite.
What is the full form of PDF?
Portable Document Format.
What is the extension of Latex file?
.tex
Which command of Latex is used to create a PDF file?
pdflatex
Which command of Latex is used to view a PDF file?
evince pfdfilename
A Latex command starts with which character?
\
Some commands accept additional information called __________.
arguments
How many types of arguments are there in Latex?
2 Types
Name the types of arguments in Latex?
Optional arguments are written after the command name enclosed in _____________ brackets.
square brackets. [ ]
Mandatory argument are written after optional arguments enclosed in _____________ brackets.
curly braces. { }
In the example “documentclass[12pt]{article}” which is optional argument?
[12pt]
In the example “documentclass[12pt]{article}” which is mandatory argument?
{article}
What is the use of \\ in Latex?
Linebreak
Structure of a Latex Document
A LaTeX document has two parts.
(1) Preamble (2) content
(1) The preamble contains metadata ie. Data about data.
The metadata is information about the document
For eg. What kind of document it is
who is the author
when was it created etc…
(2) The content part contains the actual contents written between \begin{document} and \end{document}
The Preamble
Latex supports creation of a wide variety of documents.
The first element in preamble must be \documentclass{document-class-name}
Document Class | Purpose |
article | For writing individual articles. |
book | For writing entire books. |
slides | For creating presentation slides. It automatically sets larger font size. |
letter | For writing letters |
beamer | For generating presentations similar to office suites using the beamer package. |
Other Options of document class
Document Class | Purpose |
10pt | Sets the size of main font in the document to 10 points |
A4paper, Letterpaper Legalpaper | Defines the paper size. |
Fleqn | Displayed formulas and equctions are flushed left. |
Landscape | Changes the layout of the document to print in landscape mode |
The document class declaration is followed by optional package declaration.
Latex itself provides many common typesetting requirements
Latex also allows users to write packages that provide additional functionality.
There is a large community of LaTeX users who develop new LaTeX packages or enhance existing ones to cater to their own needs and then share them with others over the comprehensive TeX Archive network(CTAN)
To use one or more packages in our documents, we need to declare them in the preamble as \usepackage{package-name}
Package | Description |
Amsmath | Contains the advanced math extensions developed for American Mathematical Society |
Color | Adds support for colored text |
Easylist | Adds support for multilevel lists |
Geometry | For page layout taks like setting paper size, orientation margins etc. |
Listings | Has special features for including programming code within the document. |
setspace | Lets you change line spacing |
The Document Environment
The document environments for articles and slides will only have a title followed by the main content of the document.
A title is automatically generated by LaTeX when it sees the \maketitle command.
The document environment of a book is divided into three main parts.
(1) The front matter
(2) The main matter
(3) The back matter
The title, table of contents and the preface comes in the front matter.
The primary contents in the form of chapters, sections and subsections comes in the main matter.
The bibliography, index and references comes in the back matter.
The main contents of a book has a hierarchical structure, where
a book is divided into parts
Parts are divided into chapters
Chapters are divided into sections
Sections are divided into subsections
Subsections are divided into subsubsections
Subsubsections are divided into paragraphs
Paragraphs are divided into subparagraphs.
Each one of these accepts one compulsory argument, the title and one optional argument, title for table of contents.
The parts, chapters, sections are numbered automatically by LaTeX.
The parts are numbered in Roman numerals (I, II, III )
The chapters, sections, subsections etc are numbered in Arabic numerals(1, 2, 3)
Pages in the front matter are numbered using Roman numerals(I,II,III)
pages in the main matter and back matter are numbered in Arabic numerals(1,2,3,).
For eg. \section* can be used to create a section that is not automatically numbered.
By default elements are assigned number up to level 2 that is up to section and subsection.
Sub subsections and further divisions are not assigned numbers.
This can be changed by modifying built-in counter commnad \setcounter
For eg. \setcounter{secnumdepth}{3}
Elements are assigned a number formed by appending a period(.) and the element number to the number of parent element.
Chapters are an exception as their assigned number does not have the part number and period in front of them.
TOC (Table of contents)
A well formatted table of contents(TOC) is automatically generated from element titles when it encounters \tableofcontents command
By default a TOC has entries up to level 2 (subsection)
It can be changed by altering the vlaue of built-in counter tocdepth.
Normally Latex processes the source file sequentially from beginning to end.
It cannot move back and forth.
To create TOC, Latex runs the file twice because TOC comes at the beginning of a book in front matter.
Creating file in Latex
Start SciTE.
Select File 🡪 New
Write the Latex code.
Select File 🡪 save
Select Tools 🡪 Build or press F7
The out put window will show several message. If the last line (in blue rolor) reads Exit code:0 then compilation was successful.
Select Tools 🡪 Go or press F5.
Using Mathematical Symbols
Letters of Greek alphabet have their corresponding commands like \alpha , \beta , \gema , \pi etc.
These words with lower case letters produce lower case symbol.
The same commands, when used with the first letter in uppercase produces capital Greek letter.
Other symbols
Other symbols
Other symbols
Using Mathematical Operators
The power operator (x2) and the index operator(x1) are implemented using the the generic superscript operator (^) and (_) respectedly.
x2 can be written as x^2
Same way x1 can be written as x_1
Absolute values can be denoted by enclosing the expression between two | (Vertical bar) Symbols.
Fractions are created using the command \frac{Numerator}{Denominator}.
\sqrt{x} is used to display square root of x.
These operators can also be nested one inside another.