Starting with L
ATEX...
Dr. Manmath Narayan Sahoo
Aesthetics of Technical Writing: L
ATEX
10th Jan, 2015
Department of Computer Science and Engineering
National Institute of Technology Rourkela
Table of contents
1Global structure
2Creating A L
ATEXDocument
3L
ATEXInput File Structure
4Dividing the document
5Page Style
6Text style and size
Global structure
Global structure
\documentclass{...}
\begin{document}
...
\end{document}
Global structure
Preamble
Document classes
Packages
Creating A LATEXDocument
Document classes
Every input file start with the command
\documentclass{...}
article For articles in scientific journals, presentations,
short reports, program documentation, invitations.
report For longer reports containing several chapters,
small books, thesis.
book For real books.
beamer For writing presentations.
letter For writing letters.
IEEEtran For articles with the IEEE Transactions format.
Example: \documentclass{article}
Creating A LATEXDocument
Document classes
Start of document text
\begin{document}
content...
\end{document}
Example:
\begin{document}
This is my first document prepared in LATEX.
\end{document}
LATEXInput File Structure
Document classes
Font size (10 or 11 or 12)
\documentclass[options]{class}
Example: \documentclass[12]{article}
Example:
\documentclass[12]{article}
\begin{document}
This is my first document prepared in LATEX.
\end{document}
LATEXInput File Structure
Paper Format
\documentclass[options]{class}
Paper Format
letterpaper
a4paper
a5paper
b5paper
legalpaper
executivepaper
Example: \documentclass[a4paper,11pt]{article}
Page format
onecolumn or twocolumn
oneside or twoside
Example: \documentclass[11pt,twocolumn,twoside]{article}
LATEXInput File Structure
Sample programs
\documentclass[12]{article}
\begin{document}
This is my first document prepared in LATEX.
\end{document}
\documentclass[a4paper,11pt]{article}
\begin{document}
This is my first document prepared in LATEX.
\end{document}
LATEXInput File Structure
Packages
To include graphics, colored text or source code from a file into your
document, you need to enhance the capabilities of L
ATEX. Such
enhancements are called packages. Some packages come with the
L
ATEXbase distribution.
\usepackage[options]{package}
\usepackage{package1,package2,package3}
Example:
\documentclass[11pt,a4paper]{report}
\usepackage{color}
\usepackage[margin=2cm]{geometry}
\begin{document}
...
\end{document}
LATEXInput File Structure
Packages
Packages are written in between
\documentclass{class}
\begin{document}
\usepackage{amsmath}: Mathematical typesetting
\usepackage{graphicx}: Adding images
\usepackage{geometry}: Geometrical setup
Packages are used according to requirements.
LATEXInput File Structure
The document environment
Title
Abstract
Sectioning commands
LATEXInput File Structure
Title
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.
\title{Write title here}
\author{Author’s Name}
\date{\today}
Example:
\documentclass[11pt,a4paper]{report}
\usepackage[margin=2cm]{geometry}
\begin{document}
\title{How to Structure a LaTeX Document}
\author{Andrew Roberts}
\date{December 2004}
\maketitle
\end{document}
LATEXInput File Structure
Title (Sample program)
\title{Title}
\author{Author 1\\
Address line 11\\
Address line 12\\
Address line 13
\and
Author 2\\
Address line 21\\
Address line 22\\
Address line 23}
\date{Month Date, Year}
Title
Author1
Address line11
Address line12
Address line13
Author2
Address line21
Address line22
Address line23
Month Date, Year
Dividing the document
Sectioning Commands
\chapter{title}
\section{title}
\subsection{title}
\subsubsection{title}
Example: \chapter{Sample Chapter}
Example: \section[Results]{Results of the proposed protocol}
Dividing the document
Line Spacing and Margin
Line Spacing
\linespread{1.6}
or
\usepackage{setspace}
\doublespacing
Margin
\usepackage[top=2in,bottom=1in,left=1in,right=1in]{geometry}
Page Style
Page Style
Page Heading
It should always go between the \documentclass{article} and
the \begin{document} commands.
\pagestyle{empty} --> no head, no foot
\pagestyle{plain} --> no head, foot contains only page#
\pagestyle{headings} --> Chapter/Section headings
and page# on head, no foot
\pagestyle{myheadings} --> Customized headings
\thispagestyle{} (For single page only)
pagestyle{myheadings}
\markright{right head} --> for onside
\markboth{left head}{right head} --> for twoside
Page Style
Page Style
pagestyle{headings}
Page Style
Page Numbering
arabic Indo-Arabic numerals
roman lowercase Roman numerals
Roman upper case Roman numerals
alph lowercase English letters
Alph uppercase English letters
Example: \pagenumbering{Roman}
Text style and size
Text Style
\textit{...} italic
\emph{text} emphasized
\textsl{...} slanted
\textsc{...} Small Caps
\textup{...} upright
\textbf{...} boldface
\bf{} boldface
\textrm{...} roman
\texttt{...} typewriter
Text style and size
Text Style
STYLE COMMAND DECLARATION
S H A P E
upright extup{upright} {\upshape upright}
italic extit{italic} {\itshape italic}
slanted extsl{slanted} {\slshape slanted}
SMALL CAP extsc{small cap} {\scshape small cap}
S E R I E S
medium extmd{medium} {\mdseries medium}
boldface extbf{boldface} {fseries boldface}
FA M I LY
roman extrm{roman} {mfamily roman}
sans serif extsf{sans serif} {\sffamily sans serif}
typewriter exttt{typewriter} { tfamily typewriter}
\textsf{\textbf{sans serif family, boldface series, upright shape}}\\
\textrm{\textsl{roman family, medium series, slanted shape}}
sans serif family, boldface series, upright shape
roman family, medium series, slanted shape
Text style and size
Text Size
size{ iny size} size {\large size}
size{\scriptsize size} size {\Large size}
size{ootnotesize size}size {\LARGE size}
size{\small size} size{\huge size}
size{ormalsize size}size{\Huge size}
Text style and size
Starting New Lines and New Pages
\newpage : To force a new page
\\ : line break
Text Justifying
\begin{center}
This is line one. \\
This is line two. \\
This is line three.
\end{center}
\begin{flushright}
This line is right justified.
\end{flushright}
\begin{flushleft}
This line is left justified.
\end{flushleft}
Text style and size
Special Characters
For displaying any type of special character
\symbol
Examples:
$ : \$
# : \#
& : \&
% : \%