Vous êtes sur la page 1sur 26

Starting with LATEX...

Dr. Manmath Narayan Sahoo


Aesthetics of Technical Writing: LATEX

10th Jan, 2015

Department of Computer Science and Engineering


National Institute of Technology Rourkela

Table of contents

Global structure

Creating A LATEXDocument

LATEXInput File Structure

Dividing the document

Page Style

Text 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
report
book
beamer
letter
IEEEtran
Example:

For articles in scientific journals, presentations,


short reports, program documentation, invitations.
For longer reports containing several chapters,
small books, thesis.
For real books.
For writing presentations.
For writing letters.
For articles with the IEEE Transactions format.

\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 LATEX. Such
enhancements are called packages. Some packages come with the
LATEXbase 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{Authors 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
Author 1
Address line 11
Address line 12
Address line 13

Author 2
Address line 21
Address line 22
Address line 23

Month Date, Year

LATEXInput File Structure

Creating Abstract

\begin{document}
...
\begin{abstract}
content...
\end{abstract}
\tableofcontents
...
\end{document}

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
roman
Roman
alph
Alph

Indo-Arabic numerals
lowercase Roman numerals
upper case Roman numerals
lowercase English letters
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
C OMMAND
\textup{upright}
\textit{italic}
\textsl{slanted}
SMALL CAP \textsc{small cap}
medium
\textmd{medium}
boldface
\textbf{boldface}
roman
\textrm{roman}
sans serif
\textsf{sans serif}
typewriter \texttt{typewriter}

FAMILY SERIES

SHAPE

STYLE

upright
italic
slanted

D ECLARATION
{\upshape upright}
{\itshape italic}
{\slshape slanted}
{\scshape small cap}
{\mdseries medium}
{\bfseries boldface}
{\rmfamily roman}
{\sffamily sans serif}
{\ttfamily 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
{\tiny size}

size

{\large size}

size

{\scriptsize size}

size

{\Large size}

size

{\footnotesize size}

size

{\small size}

size

{\normalsize size}

size

size

size

size

{\LARGE size}
{\huge 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:
$ : \$
# : \#
& : \&
% : \%

Text style and size

an
h
T

u!
o
kY

Vous aimerez peut-être aussi