33
ME 601A, 2016-17, SEM II IIT Kanpur

ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

ME 601A, 2016-17, SEM IIIIT Kanpur

Page 2: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

What are TeX and LaTeX?

• LaTeX is a typesetting systems suitable for producing scientific and mathematical documents— LaTeX enables authors to typeset and print their work at the highest

typographical quality.— LaTeX is pronounced “Lay-tech”.— LaTeX uses TeX formatter as its typesetting engine.

• TeX is a program written by Donald Kunth for typesetting text and mathematical formulas

Page 3: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

Why LaTeX ?• Easy to use, especially for typing mathematical

formulas

• Portability (Windows, Unix, Mac)

• Stability and interchangeability

Page 4: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

Why LaTeX ? contd...• High quality

Most journals /conferences have their LaTeX styles

One will be forced to use it, since everyone else around is using it.

Page 5: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

Why LaTeX ? contd... Documentation and forums

A universal acceptance among researchers

Error finding and troubleshooting are not difficult

Page 6: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

J[x(⋅),u(⋅)] = F (x(t),u(t),t)dtt0

∞∫

Page 7: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

References for LaTeX— The not so short introduction to LaTeX2e

http://tobi.oetiker.ch/lshort/lshort.pdf— Comprehensive TeX archive network

http://www.ctan.org/— Beginning LaTeX

http://www.cs.cornell.edu/Info/Misc/LaTeX-Tutorial/LaTeX-Home.html

— Google

Leslie Lamport

H. Kopka

Page 8: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

Process to Create a Document Using LaTeX

TeX input filefile.tex

DVI filefile.dvi

Output filefile.ps or file.pdf

Run LaTeX program

Run Device Driver

Your source LaTeX document

Device independent output

> latex file.tex > xdiv file.dvi > dvips file.dvi> pdflatex file.tex

Unix Commands

runs latex previewercreates .pscreates .pdf directly

Page 9: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

How to Setup LaTeX for Windows

• Download and install MikTeXhttp://www.miktex.org/

• Install Ghostscript and Gsviewhttp://pages.cs.wisc.edu/~ghost/

• Install Acrobat Reader

• Install Editor— WinEdt

http://www.winedt.com/— TexnicCenter

http://www.texniccenter.org/— Emacs, vi, etc.

LaTeX package

PS device driver …

TeXShopiTexMacTexmaker…

For MAC Users

Page 10: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

How to Use LaTeX to Create Documents

• Start with a skeletal document (create it by yourself, get it from your classmates, download it from journals’ website)

• Fill stuff (text, formula, figure, table …) into your skeletal document

• Run LaTeX to generate output and make modifications

• Learn as you go

Page 11: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

% This is an example.tex

\documentclass {article}

\begin {document}

This is a test

\end {document}

Example.tex

Writing a document in Latex

Page 12: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

Basic Structure of LaTeX Document

\documentclass [12pt]{article}

\usepackage {color}\usepackage {graphicx}

\begin{document}

\end{document}

Define the types of the document (article, book, thesis …)

Preamble. Incorporate packages or define macros here

Main body, stuff to be printed, title, authors, abstract, sections, references, ….

Page 13: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

Title/Author Information and Document Structure

\begin{document}

\title {A Very Simple Introduction to LaTeX}

\author {names}

\thanks{AMS UCSC}…

\maketitle

\section{Introduction}

\subsection{Subsection Heading Here}

\end{document}

Page 14: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

Example.tex

Writing a document in Latex

(1) latex Example.tex Example.dvi (2) dvips Example.dvi Example.ps (3) ps2pdf Example.ps Example.pdf

Section and Subsection

% This is an example.tex

\documentclass [12pt]{article}\begin {document}\title {This is an example}\author {James Bond}\maketitle

\section {Introduction}\subsection {Experiment}

\end {document}

Page 15: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

Example.texWriting a document in Latex

Equations\documentclass [12pt]{article}\begin {document}\title {This is an example}\author {James Bond}\maketitle\section {Introduction}\begin {equation}g_{ \gamma_{n}}(t) =\frac{1}{ \sqrt{s_{n}}}\;g(\frac{t-p_{n}}{s_{n}})\,\exp\left\{j(2\pi f_{n}t+\phi_{n})\right\},\label {eq1}\end {equation}\end {document}

Page 16: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

Example.texWriting a document in Latex

Equations\documentclass [12pt]{article}\begin {document}\title {This is an example}\author {James Bond}\maketitle\section {Introduction}\begin {equation}g_{ \gamma_{n}}(t) =\frac{1}{ \sqrt{s_{n}}}\;g(\frac{t-p_{n}}{s_{n}})\,\exp\left\{j(2\pi f_{n}t+\phi_{n})\right\},\label {eq1}\end {equation}\end {document}

S_n - subscriptS^n - superscript

Math commands

Page 17: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

Matrices \begin{vmatrix} x & y \\ z & v \end{vmatrix}

\begin{Vmatrix} x & y \\ z & v \end{Vmatrix}

\begin{bmatrix} x & y \\ z & v \end{bmatrix}

\documentclass{article} \usepackage{amsmath}\begin{document} \[ A = \begin{matrix}\begin{pmatrix}x &

y\end{pmatrix}\\\mbox{}\end{matrix} \begin{pmatrix} a & b \\ c & d \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} \]

\end{document}

Page 18: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

Matrices

Page 19: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

% This is an example.tex

\documentclass [12pt]{article}\usepackage {epsfig, graphicx}\begin {document}

\begin {figure}\epsfxsize =4.5in\centerline {\epsffile{platypus.eps}}\caption {Sample Figure.}\label {fig1}\end {figure}

\end {document}

Example.tex

Writing a document in Latex

(1) latex Example.tex Example.dvi (2) dvips Example.dvi Example.ps (3) ps2pdf Example.ps Example.pdf

Figures

Page 20: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

% This is an example.tex

\documentclass [12pt]{article}\usepackage {epsfig, graphicx}\begin {documen}

\begin {table}\centering\begin {tabular}{|c|c|c|c|c|} \hline

Method &Groups & Normal & Abnormal & Total \\ \hline

LR & Normal & 40 & 11 & 51\\& Abnormal & 17 & 22 & 39 \\\hline

\% & Normal & \bf{78.4} & 21.6 & 100 \\& Abnormal & 43.6 & \bf {56.4} & 100 \\\hline

\end {tabular} \caption {Sample Table}\label {tab1}

\end {table}\end {document}

Example.texWriting a document in Latex

Table

Page 21: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

\usepackage[margin=3cm]{geometry} \usepackage{array} \usepackage[table]{xcolor}

Page 22: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

% This is an example.tex\documentclass [12pt]{article}

\begin {document}\section {Introduction}\label {intro}

This is section on Introduction.

\subsection {experiment}\label {exp}

This is an example subsection.Please refer Section.\ref {intro} for introduction. Refer Section \ref {exp}

\end {document}

Example.tex

Writing a document in Latex

Very easy to manage all the references in long documents

References within a document

Page 23: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

% This is an example.tex\documentclass [12pt]{article}\bibliographystyle {IEEEtran}\begin {document}\section {Introduction}\label {intro}

This is section on Introduction.

\subsection {experiment}\label {exp}

This is an example subsection. Thiswork is based on the MP algorithm \cite {mallat2}

\bibliography {bibfile}\end {document}

Example.tex

Writing a document in Latex

Order and numbering of the references are automatic.

Citing other works

Page 24: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

Example Document From IEEE

Suppose you want to write a paper for IEEE journals

•Download LaTeX template from IEEE website

http://www.ieee.org/web/publications/authors/transjnl/index.html

•Open example LaTeX file (bare_jrnl.tex) and modify it

•No need to worry about things like margin, font, …

bare_jrnl.tex click to open it in TeXShop

Page 25: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

Standard Environments

\begin{env_name}stuff

\end{enc_name}

\begin{itemize}\item The first item\item The second item

\end{itemize}

\begin{enumerate}\item The first item\item The second item

\end{enumerate}

Environment name (env_name) can bedocument, itemize, enumerate, tabular, etc.

Page 26: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

How to Input Math Formulas

• Use \( … \) for in-line and \[ … \] for displaying math formulas

• Spaces inside \( … \) and $ … $ are ignored. If needed, use “\ ” to add space

• Use \mbox{…} for words inside math formulas

Page 27: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

Figures

\begin{figure}\centering\includegraphics {name of the figure file}\caption{Put the caption here}

\end{figure}

You can insert figures in pdf, jpg, eps, and other formats into your document.

Multiple figures can be inserted using \subfigure

Page 28: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

Cross Referencing

LaTeX generates numbers for Theorem, Equation, Section, Figure and other environments automatically. You can access them with \label and \ref

\section{Introduction} \label{sec:intro}

….

In Section \ref{sec:intro}

Page 29: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

Reference and Citation

In the article style, this reference list is labeled "References"; in the report style, it is labeled "Bibliography".

\begin{thebibliography} {widest-label}

\bibitem[label]{cite_key} . . .

\end{thebibliography}

widest-label: Text that, when printed, is approximately as wide as the widest item label produces by the \bibitem commands.

Page 30: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

Reference and Citation

If you know you have between 10 and 99 publications, you can start with \begin{thebibliography}[99]. Use any two digit number in the argument, since all numerals are the same width.

If you are using customized labels, put the longest label in argument, i.e., type \begin{thebibliography}[Longest-name]

Page 31: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

Reference and Citation

One can also use bibTeX package to generate reference listhttp://www.hep.manchester.ac.uk/u/jenny/jcwdocs/latex/bibtexbasics.html

• cite_key is used to cite publication inside the document.

• To cite a publication from the reference list, use the \cite command.

• The argument to \cite may be one key, or two or more keys, separated by commas.

\begin{thebibliography} {widest-label}

\bibitem[label]{cite_key} . . .

\end{thebibliography}

Page 32: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

Acknowledgements Coronel University Library, Document Creation Tutorial

TeXWorks and TeXTonic

Leslie Lamport

Introduction to LaTeX : Dept. of Applied Math & StatisticsSchool of EngineeringUniversity of California

Page 33: ME 601A, 2016-17, SEM II IIT Kanpurhome.iitk.ac.in/~dasgupta/teaching/LSSC...What are TeXand LaTeX? • LaTeX is a typesetting systems suitable for producing scientific and mathematical

Thank You!