USIG Latex

Introduction

TeX is a computer program for typesetting documents, created by D. E. Knuth. Typesetting involves formatting of the input text. TeX is a mathematical typesetting mark-up language. A file created using TeX may be printed on different kinds of printers and high-resolution typesetting machines. TeX is widely used by publishers to typeset books and mathematical journals.

LaTeX is a variant of TeX, written by Leslie Lamport. LaTeX is a document preparation system and document markup language for the TeX typesetting programs. LaTeX focuses on the structure of the document; TeX focuses on the visual typesetting details. LaTeX is a popular method of using TeX.

LaTeX is a family of programs designed to produce publication-quality typeset documents. It is particularly strong when working with mathematical symbols. It is suited for the production of long articles and books. It facilitates automatic numbering of chapters, sections, theorems, equations etc., and cross-referencing. LaTeX is widely used by academia and scientists because of its high-quality typesetting features achieved due to TeX. It offers programmable desktop publishing features.

LaTeX is free software, distributed under the LaTeX Project Public License. Here, we work in the Windows environment, while working with LaTeX.

Create Latex Document

To create a TeX document—

·         Create a TeX file using a text editor. Some editors are specifically created for working with LaTeX like WinEdt.

·         Save the TeX file with the .tex extension.

·        Compile and run the TeX file. If you are using a LaTeX text editor, you can use the menu commands to run the file. For example, in WinEdt, Accessories>LaTeX, will execute the file and show the output.

·        A program Yap previews and prints your LaTeX output.

Components Of A Latex Document

·         A LaTeX document must contain the following three components:

1. \documentclass{article}

2. \begin{document}

3. \end{document}

·         \documentclass{article} tells LaTeX about the kind of document, as there are different style rules for different kinds of documents. We use the article document class. Other classes include report, book, and letter.

·         The default font size for each class is 10 point.

·         To use 11 point write, \documentclass [11pt]{article}. To use 12 point write \documentclass[12pt] {article}.

·         The \documentclass command must appear at the start of the LaTeX document, before any other LaTeX commands.

·         The space between \documentclass and \begin{document} is called the preamble. The commands for LaTeX that affect the whole document should be included in the preamble.

·         The body of the document, where all text is included, must occur between the \begin{document} and \end{document} commands.


 

Latex Commands

Here, the common commands in LaTeX are described briefly.

Typing LaTeX Commands

·         Surround any text that is to be printed as it is, with a \begin{verbatim} and a \end{verbatim} command.

Page Numbering and Headings—

command \pagestyle

It should always be between \documentclass{article} and \begin{document}. It can take the following forms:

·         \pagestyle{plain} is the default. It puts page number at the centre of the bottom of the page and provides no headings.

·         \pagestyle{empty} provides neither page numbers nor headings.

·         \pagestyle{headings} provides page numbers and headings from any \section that you are using.

·         \pagestyle{myheadings} provides page numbers and custom headings. o It can also be applied to a single page using \thispagestyle instead of \pagestyle.

Creating a Title Page

Insert between the \documentclass command and \begin{document} command. The commands are:

·         \title{your title here}

·         \author{your name here}

·         \date{current date}

·         \maketitle

After specifying the arguments of \title, \author, and \date, use \maketitle for this part to be typeset.

\documentclass can take titlepage option—\documentclass[titlepage]{article}.

By default, all entries produced by these commands are centered on the lines in which they appear.

Choose the break points with the \\ command.

To have author names side by side, use \and command.

Sections—

·         \section{sectiontitle} numbers the sections

·         \section*{sectiontitle} does not number the section.

·         Both create separate sections with titles in a larger font size.

Cross-References—

·         \label{name} to label the point in the document with some mnemonic

·         Section \ref{name} to refer to that point. \ref{name} will be replaced by the number of the section containing the corresponding \label command. As with your bibliography citations, run LaTeX twice to generate these references.

Abstracts—

Place text between \begin{abstract} and \end{abstract} commands. The abstract should come immediately after \maketitle.

Double Spacing—

Put \renewcommand{\baselinestretch}{2} in the preamble

Hyphenation—

- (a single dash) is for hyphenating words.

-- (two dashes) is for ranges of numbers. 

$-$ is a minus sign in math mode.

Quotation Marks—

Beginning and ending quotation marks differ. In LaTeX, use “(on left side of the keyboard) to begin a quotation and ” (on right side of the keyboard) to end a quotation.

Changing the Appearance of Words—

·         \underline{phrase} to underline a phrase,

·         \textbf{phrase} to print a phrase in boldface, and

·         \emph{phrase} to italicize a phrase. 

Spacing Between Words—

·         One blank space is the same as thousand blank spaces.

·         Tabs are treated like blank spaces.

·         Blanks at the end of a line are ignored.

·         A single “Enter” is treated like a blank space.

·         More than one “ Enter” marks the beginning of a new paragraph.

Indenting—

By default LaTeX indents new paragraphs unless the paragraph follows a section heading. To change the indentation, use the \indent and \noindent commands, at the beginning of the paragraph in question.

·         To choose the amount of indentation, use the command \setlength{\parindent}{size of indentation with unit}.

·         This command affects the whole document, it should go in the preamble, between the \docu-mentclass and \begin{document}.

Centering Text—

By default, LaTeX will start all text at the left margin. To center a title, a table, etc., surround it with the commands \begin{center} and \end{center}.

Line Breaks—

Use a ~ for a space that should not be used to break a line.

·         LaTeX inserts more space at the end of a sentence then between its words. For an abbreviation like Dr. in the middle of a sentence, use a ~ (if the line should not be broken there) or a \ followed by a space (if the line could be broken there).

·         To force a line to break at a given point, use \\.