Workshop

on

Organized By

CEAS Library

Instructor

Amal Chaturvedi

Graduate Assistant

**LaTeX**

Introduction

Pronounced 'lay-tech' or 'lah-tech'

Document preparation system for high quality typesetting

Uses markup commands and a typesetting program TEX

Used for publishing scientific reports, articles, theses, books etc.

Don't

need to worry about the formatting

Concentrate

on the content

.tex

(input)

LaTeX

.dvi

(Printer)

(PostScript)

(Portable Document Format)

(designed so that the output can be printed/viewed on any device)

Source text marked up with logical structure

Document classes define the formatting of the content

1. Consistent layout, fonts, tables etc. throughout the presentation

II. Mathematical formulae can be easily typeset

III. Indices, references, footnotes can be easily generated

IV. Correctly structured document (document style could be easily changed)

I. Does not follow WYSIWYG. Cannot see the final output straight away

II. Need to learn the markup commands

III. Sometimes more tedious than visual approach (eg. tables)

Let's Begin!

Windows

Linux

Most distributions have a TeX system including LaTeX.

Check software source for a TeX package, otherwise

Install TexLive directly

MacOS X

MacTex: A complete TeX system with LaTeX

proTeXt : Easy to install complete LaTeX system

or

Download MikTeX and TeXnicCenter individually

MikTeX : the actual compiler

TeXnicCenter : text editor which knows where MikTeX is on the system

Compile the code : click on

or press Ctrl+f7

\documentclass{article}

\usepackage{babel}

\begin{document}

\title{CEAS Library}

\author{Amal Chaturvedi}

\date{\today}

\maketitle

...

Contents

...

\begin{bibliography}

...

\end{bibliography}

\end{document}

}

}

}

}

Preamble

Front Matter

Body

Back Matter

Environments in LaTeX

Sometimes using the general commands while writing long paragraphs could be troublesome

Environments - Paragraph styles / formatting

\begin{environment name}

...

\end{environment name}

Environment name : abstract, center, figure etc.

Math

Environments in Math

Math

Displaymath

Equation

\begin{math}...\end{math}

LaTeX Shorthand : \(...\)

TeX Shorthand : $...$

\begin{displaymath}...\end{displaymath}

LaTeX Shorthand : \[...\]

TeX Shorthand : $$...$$

displays the mathematical statements in the same line with the general text

Separates the mathematical formulae with the general text

used to number the formulae

\begin{equation}...\end{equation}

Directly accessible symbols

+-==!/()[]<>|'

Some commonly used math commands

Fractions :

\frac{numerator}{denominator}

eg. \frac{a}{b}

\frac{\frac{a}{b}-\frac{a+b}{c-d}}{c+d}

Powers and Indices :

Power : x^n, x^2n, x^{2n} (What's the difference?)

Index : x_n, x_2n, x_{2n}

Roots and Brackets :

Root : \sqrt[n]{\frac{a}{b+c}} ; n is optional

Brackets : (\frac{a}{b}) \times \left(\frac{c}{d}\right)

Images

Things to know

\usepackage{graphicx} in the preamble

Supports .eps, .jpeg, .png

\begin{figure}...\end{figure}

\includegraphics[optional1,optional 2..]{image}

Don't forget to put the image in the same folder

Bibliography

Two ways to include Bibliography

Bibitem

To add the references manually

Not going to use the same references again?

Environment : thebibliography

use at the end of the document

Cross-referenced and numbers itself automatically

References are not portable

\begin{thebibliography}{100}

\bibitem{cite_key}

Author's Name,

\emph{\LaTeX: A Document Preparation System}.

Cincinnati, Ohio,

nth Edition,

2011.

\end{thebibliography}

To Cite

Put \cite{cite_key} at the end of the sentence or the paragraph

e.g. ,Latex makes the tedious report writing so easy. \cite{amal}

Multiple Citations

Separate them by a comma

e.g., Latex makes the tedious report writing so easy. \cite{amal, cite_key2, cite_key3}

Need a Database for the References?

BibTeX

Simple and Easy

Uses a structured bibliography .bib file

.bib file should be in the same folder

@ref_type{uniq_key,

field1 = "...",

field2 = "...",

...

}

ref_type : article, book, etc.

field : author, title, volume, year, etc.

uniq_key : defined by you to cite the reference

@article{goossens93,

author = "Michel Goossens",

title = "LaTeX",

year = "1993",

publisher = "Addison-Wesley",

address = "Reading, Massachusetts"

}

Order of fields is not important

Using the Database

\bibliography{bibfile_name} - No need to use the .bib extension

\bibliographystyle{style}

Standard styles : plain, alpha, abbrv, unsort

Publishers often supply their own style files

Citing References

\cite{ref_key1, ref_key2, ...}

Major Databases support BibTeX reference entries

Preferences

Bibliography Manager

Download Citations

Select the article

Export Formats

Select the article

Export

Packages

\usepackage[package-opts]{package_name}

Always declared in the preamble

Simplifies complex tasks

Provides new commands / environments

eg. babel, color, geometry etc.

You can create almost all necessary things using specific packages

Math

Tables

Images

Language Support

PPTs (Use Beamer) and

Many More...

Superior output than Word Processors

Stable : Never crashes / gets corrupted

It's Free !

complex structures such as footnotes, references, table of contents, and bibliographies can be generated easily

http://www.engrlib.uc.edu/workshops/latex/

www.andy-roberts.net/misc/latex/

www.tex.ac.uk/cgi-bin/texfaq2html?introduction=yes

LaTeX wiki book

http://www.latex-project.org

Thanks for attending the CEAS Library workshop

Please do take the Survey!!

Press F5 or click on to see the output

(Screen)

Sectioning Commands

\chapter{name}

\section{name}

\subsection{name}

etc.

Let's try a few maths commands!

Inline :

We all know that $\frac{1}{23} \times 23 = 1$. This was an easy fraction.

We all know that \(\frac{1}{23} \times 23 = 1 \). This was an easy fraction.

or

We all know that \begin{math}\frac{1}{23} \times 23 = 1 \end{math}. This was an easy fraction.

Separate Line :

This one works $$lim_{x\to\infty}\frac{1+\frac{1}{1+x}}{x}$$ for the next line.

This one works \[lim_{x\to\infty}\frac{1+\frac{1}{1+x}}{x}\] for the next line.

or

This one works \begin{displaymath} lim_{x\to\infty}\frac{1+\frac{1}{1+x}}{x} \end{displaymath} for the next line.

Numbering the equations :

\begin{equation}

(a+b)^2=a^2+b^2+2ab

\end{equation}

\includegraphics{image_name}

\includegraphics[scale=0.5]{image_name}

\includegraphics[width=0.25]{image_name}

\includegraphics[scale=0.5,angle=45]{image_name}

\includegraphics[trim=10mm 25mm 5mm 8mm,clip]{image_name}

\begin{figure}

\begin{center}

\includegraphics[scale=0.05]{paris}

\end{center}

\caption{Eiffel Tower at Night}

\end{figure}

\begin{figure}

\begin{center}

\includegraphics[scale=0.05,angle = 45]{paris}

\end{center}

\caption{Eiffel Tower at Night}

\end{figure}

Welcome

to

CEAS Library Workshops

Instructor

Amal Chaturvedi

Graduate Assistant

CEAS Library

Special symbols

$ & % # _ { } \

To use these symbols

\$ \& \% \# \_ \{ \} \backslash