Você está na página 1de 19

.

......
An Introduction to L
A
T
E
X
Dr. Abhijit Sarkar
Machine Design Section
Department of Mechanical Engineering
Indian Institute of Technology Madras
Chennai - 600 036, TN, India.
October 11, 2012
A. Sarkar (Mech Engg. @IITM) ID6020 Mar 2012 1 / 19
Outline & Objective
...
1
Introduction
...
2
Basic L
A
T
E
Xcommands
...
3
Bibtex
.
Objective
..
......
Appreciation of the features in L
A
T
E
X.
Preparation of documents and presentations in L
A
T
E
X
A. Sarkar (Mech Engg. @IITM) ID6020 Mar 2012 2 / 19
Introduction
What is L
A
T
E
X?
L
A
T
E
Xis a typesetting program.
The user prepares an input le which is compiled by L
A
T
E
Xto
generate an output pdf le.
The input le contains dierent L
A
T
E
Xcommands and the text
material.
Typical commands - formatting, inserting mathematical symbols
and equations, inserting pictures, etc.
High quality technical documents can be generated eciently
using L
A
T
E
X.
Most reputed journals, international conferences, university
thesis encourage documentation through L
A
T
E
X.
Learning curve for L
A
T
E
Xis steep in the begining but with some
experience the user grows comfort in the usage.
A. Sarkar (Mech Engg. @IITM) ID6020 Mar 2012 3 / 19
Introduction
Installing L
A
T
E
X
L
A
T
E
Xis a freeware.
Various installations of L
A
T
E
Xare available depending on the
Operating System, 32bit/64 bit, etc. Example - Miktex 2.9
A front end text editor with special formatting for the latex
commands is also helpful. MikTex 2.9 comes with the frontend
texworks. Others can be downloaded separately such as
Texniccenter, Texmaker, gvim, etc.
Variants are available for compiling e.g. - Latex, pdatex, Tex,
XeLatex, etc.
Exercise: Install L
A
T
E
Xin your system. You will get a lot of help
on this from the web.
A. Sarkar (Mech Engg. @IITM) ID6020 Mar 2012 4 / 19
Basic L
A
T
E
Xcommands
Structure of a L
A
T
E
Xinput le
\documentclass[a4paper, 12pt]{article}
% This is a comment
% Every document should begin with
% a document class specification
\usepackage{amsmath}
\usepackage{graphicx,subfigure}
% additional packages to be included during the
% compilation process
\newcommand{\drop}[1]{}
\begin{document}
\section{Introduction}
This is the introduction
\section{Conclusion}
This is the conclusion
\end{document}
A. Sarkar (Mech Engg. @IITM) ID6020 Mar 2012 5 / 19
Basic L
A
T
E
Xcommands
Sectioning and Subsectioninng
\section{Introduction}
\label{sect:intro}
This is introduction
\section{Method}
\label{sect:method}
This is the method.
\section{Results}.
Using the method described in
section \ref{sect:method},
following results are obtained.
\subsection{Validation}
Old Results Reproduced
\subsection{Novel Results}
New Results
\section{Conclusion}
1. Introduction
This is introduction
2. Method
This is the method
3. Results
Using the method de-
scribed in
section 2, following
results are obtained.
3.1 Validation
Old Results Repro-
duced
3.2 Novel Results
New Results
4. Conclusion
A. Sarkar (Mech Engg. @IITM) ID6020 Mar 2012 6 / 19
Basic L
A
T
E
Xcommands
Setting the margins
\topmargin0.1in
The top margin of the page is set as 0.1in.
\textheight9.5in
The text portion contained in the page is of height 9.0in .
\textwidth6.5in
The text portion contained in the page is 6.5in wide.
\oddsidemargin0.1in
For odd pages a margin of 0.1in is given on the left side.
\evensidemargin0.1in
For even pages a margin of 0.1in is given on the left side.
Negative values may also be used in topmargin, oddsidemargin,
evensidemargin to reduce the margin.
A. Sarkar (Mech Engg. @IITM) ID6020 Mar 2012 7 / 19
Basic L
A
T
E
Xcommands
Fonts
\textbf{Bold}
\textit{Italics}
\textsl{Slanted}
\textsc{SmallCaps}
\textsf{Sans Serif}
\texttt{Typewriter}
\textcolor{red}{Red}
\underline{Underline}
\underline{\textbf{Important}}
\fbox{boxed}
Bold
Italics
Slanted
SmallCaps
Sans Serif
Typewriter
Red
Underline
Important
boxed
Font size can be changed by the following commands
\small{}, \tiny{}, \large{}, \Large{}, \Huge{}
A. Sarkar (Mech Engg. @IITM) ID6020 Mar 2012 8 / 19
Basic L
A
T
E
Xcommands
Math environment
Mathematical symbols and formulae are typeset in math environment
Text. $\alpha + 1 = \beta$
This is a equation
\begin{equation}
\nabla^2 \phi = 0
\label{laplace}
\end{equation}
Refer equation (\ref{laplace}).
This is an unnumbered equation
\begin{displaymath}
\nabla^2 \psi + k^2 \psi = 0
\end{displaymath}
Text. + 1 =
This is a equation

2
= 0 (1)
Refer equation (1)
This is an unnumbered
equation

2
+ k
2
= 0
A. Sarkar (Mech Engg. @IITM) ID6020 Mar 2012 9 / 19
Basic L
A
T
E
Xcommands
Typesetting Mathematical Formulae
Input Command
\alpha + \beta = \gamma
Output: + =
Input Command
\frac{D f}{D t} = \frac{\partial f}{\partial t} +
u \frac{\partial f}{\partial x}
Output:
Df
Dt
=
f
t
+ u
f
x
Input command
\int_0^1 x^2 \, dx = \frac{1}{3}
Output:

1
0
x
2
dx =
1
3
Input command
\tau_{ij} n_j = T_i
Output:
ij
n
j
= T
i
A. Sarkar (Mech Engg. @IITM) ID6020 Mar 2012 10 / 19
Basic L
A
T
E
Xcommands
More Mathematical Formulae
Input Command:
\sum_{n=1}^{N} n = \frac{n(n+1)}{2}
Output:

N
n=1
n =
n(n+1)
2
Input Command:
\frac{D u}{D t} =
\overbrace{\frac{\partial u}{\partial t}}^{\mbox{
Local}} +
\underbrace{u \frac{\partial u}{\partial x}}_{\mbox{
Convective}}
Output:
Du
Dt
=
Local
..
u
t
+ u
u
x
..
Convective
A. Sarkar (Mech Engg. @IITM) ID6020 Mar 2012 11 / 19
Basic L
A
T
E
Xcommands
More Mathematical Formulae
Input Command:
\left(\stackrel{\rightarrow}{a} \otimes
\stackrel{\rightarrow}{b} \right)
\stackrel{\rightarrow}{c}
= \left( \stackrel{\rightarrow}{b}
\cdot \stackrel{\rightarrow}{c}
\right) \stackrel{\rightarrow}{a}
Output:
_

b
_

c =
_

b


c
_

a
Input Command:
\int_V \nabla \cdot \stackrel{\rightarrow}{v} \, dV
=
\oint_S \stackrel{\rightarrow}{v} \cdot \hat{n} \, dS
Output:

V


v dV =

v n dS
A. Sarkar (Mech Engg. @IITM) ID6020 Mar 2012 12 / 19
Basic L
A
T
E
Xcommands
Long Equations
Input Command:
\begin{gather}
\mathcal{A} = a + b + \ldots z \\ \nonumber
\alpha + \beta + \ldots
\end{gather}
Output:
A = a + b + c . . . + (2)
+ + + . . .
Input Command:
\begin{eqnarray}
x + y & = & 3 \\ x - y & = & 1 \\
\Rightarrow x = 2 & \& & y = 1 \nonumber
\end{eqnarray}
Output
x + y = 3 (3)
x y = 1 (4)
x = 2 & y = 1
A. Sarkar (Mech Engg. @IITM) ID6020 Mar 2012 13 / 19
Basic L
A
T
E
Xcommands
Typesetting Matrices
Input Command:
\begin{displaymath}
\left[
\begin{array}{cc}
\alpha & \beta \\
\gamma & \delta
\end{array}
\right]
\left\{
\begin{array}{c}
x_1 \\
x_2
\end{array}
\right\}
\end{displaymath}
Output
_


_ _
x
1
x
2
_
A. Sarkar (Mech Engg. @IITM) ID6020 Mar 2012 14 / 19
Basic L
A
T
E
Xcommands
Typesetting Tables
\begin{table}[htbp]
\begin{tabular}{||l|c|c||} \hline
\textbf{Name} & Dept & CGPA \\ \hline \hline
Abc & ME & x.y \\ \hline
Pqr & ME & y.x \\ \hline
\end{tabular}
\caption{Caption}
\label{tab1}
\end{table}
Table \ref{tab1} can be
refered in this way
Name Dept CGPA
Abc ME x.y
Pqr ME y.x
Table: Caption
Table 1 can be
refered in this
way
A. Sarkar (Mech Engg. @IITM) ID6020 Mar 2012 15 / 19
Basic L
A
T
E
Xcommands
Inserting Pictures
It is best to insert picture les in the form of .eps (latex) or .jpg
(pdatex) format
L
A
T
E
Xcommand for inserting a picture le
\begin{figure}
\includegraphics[width=0.5in]{iitm2.eps}
\caption{IITM Logo}
\label{figlogo}
\end{figure}
The figure \ref{figlogo} can be refered in this way.
Output
Figure: IITM Logo
The gure 1 can be refered in this way.
A. Sarkar (Mech Engg. @IITM) ID6020 Mar 2012 16 / 19
Basic L
A
T
E
Xcommands
New commands
Input:
\newcommand{\be}{\begin{equation}}
\newcommand{\ee}{\end{equation}}
\newcommand{\drop}[1]{}
\begin{document}
bla bla
\be
\alpha \beta = \gamma
\ee
\drop{This is rejected .}
\end{document}
Output: bla bla
= (1)
A. Sarkar (Mech Engg. @IITM) ID6020 Mar 2012 17 / 19
References
...
1
L
A
T
E
XA Docment Preparation System Users Guide and
Reference Manual - L. Lamport, Pearson Education, 2009.
...
2
The not so short introduction to L
A
T
E
X- T. Oetiker, et. al. 2006
(available on net).
...
3
The L
A
T
E
Xcompanion - M. Goosens, F. Mittelbach and A.
Samarin, Addison Wesley, 1994.
A. Sarkar (Mech Engg. @IITM) ID6020 Mar 2012 18 / 19
Thank You
A. Sarkar (Mech Engg. @IITM) ID6020 Mar 2012 19 / 19

Você também pode gostar