+ All Categories
Home > Software > Introduction to latex by Rouhollah Nabati

Introduction to latex by Rouhollah Nabati

Date post: 11-Apr-2017
Category:
Upload: nabati
View: 118 times
Download: 2 times
Share this document with a friend
51
Introduction to Latex CE Dep, IAUSDJ.ac.ir 25-9-95(14 Dec, 2016)
Transcript
Page 1: Introduction to latex by Rouhollah Nabati

Introduction to Latex

CE Dep, IAUSDJ.ac.ir25-9-95(14 Dec, 2016)

Page 2: Introduction to latex by Rouhollah Nabati

high typographical quality of the documents 

LaTex is de facto standard and is installed at many universities

Can be run on most operating systems Equations, citations, figures, tables, etc.,

can be labeled so that cross referencing is automated

LaTex is free! LaTex is not WYSIWYG(What You See Is What You Get)

Page 3: Introduction to latex by Rouhollah Nabati

First consider what type of paper you are writing so that you know whose packages to install. Physics uses The Physical Review Packages Math uses The AMS packages, which is also useful

for writing just a general document or a Logic report. Chemistry even uses some specialized packages,

but much of its writing can be achieved through AMS. If you are interested in exploring chemistry packages further follow the link to get started. Click Here.

Most can just be searched on Google, or found using the MikTex package manager.

Page 4: Introduction to latex by Rouhollah Nabati

Keep all of the associated files in a single directory.

Latex was probably originally made for linux, so it is a little picky about path names.

Path names should have not special symbols or spaces. In fact the folder that you place the files in should be kept in the root directory on a windows machine.

Also if you use any specialized style files they should also be kept with the projects files. These are .sty files.

Page 6: Introduction to latex by Rouhollah Nabati

TeX is essentially a Markup Language (like HTML, XML and RTF)

LaTex is an extension of TeX Macro packages to make TeX easier to

use

Presentaion is based onTroy D. Milner and Simon Cuce slides

Page 7: Introduction to latex by Rouhollah Nabati

Late 1970s -> 1989: TeX by Don Knuth Decent typesetting by the authors! Same output now as in the future Low level, but powerful Frozen development

Starting early 1980s: LaTeX by Leslie Lamport High level language (macros, really) for TeX Easy to use! Current version is Latex2e

Page 8: Introduction to latex by Rouhollah Nabati

Some say LAY-teck Some say LAH-teck Some say LAY-tech (as in “Bach”) Some say LAY-tex

… According to Wikipedia: Knuth says

/tex/ (as in Bach) Lamport says “whatever…”

Page 9: Introduction to latex by Rouhollah Nabati

High typeset qualityEasy to include math formulasSource file format is not bounded to

a particular OS or platformLatex implementations exists for all

platforms (DOS, Windows, Unices,..)

Page 10: Introduction to latex by Rouhollah Nabati

De facto standard for scientific publishing

Very few bugsGood for large documentsCan run even on 386 PCNot very easy to learn!

Page 11: Introduction to latex by Rouhollah Nabati

\documentclass{article} \title{Simple Example} \author{Rouhollah Nabati} \date{December 2016} \begin{document} \maketitleHello world, Salam! \end{document}

Page 12: Introduction to latex by Rouhollah Nabati

Your Latex File Your Bibtex File

Latex compile x3

Bibtex compile x2

Latex compile x3

Your Postscript File

dvips compile x1Device independentoutput .dvi

(a text file)

Page 13: Introduction to latex by Rouhollah Nabati

Document Class ▪ There are 4 main predefined classes: article,

letter, report, book, and slides.Packages used

▪ Added Functionality (graphics, reference style,...).

Main Body▪ Text and Bibliography References.

Page 14: Introduction to latex by Rouhollah Nabati

Document Class▪ \documentclass[options]{class}▪ options = a4paper, 11pt, 12pt, 10pt,

twocolumn, landscape,...▪ class = article, report, book,...

Packages▪ \usepackage{package name}▪ epsfig = insert PS pictures into the document▪ fancyhdr = easy definition of footer and

header

Page 15: Introduction to latex by Rouhollah Nabati

Start with \begin{document}End with \end{document}Typesetting Text

\\ or \newline and \newpage % comments Bold \textbf{……………} or \bf Italics \emph{…………} or \textit{………}

or \it Underline \underline{…………} or \ul

Page 16: Introduction to latex by Rouhollah Nabati

Including Multiple Files \input{filename.tex}

Page 17: Introduction to latex by Rouhollah Nabati

The Physical Review package ads something new to the title. It ads the Abstract section.

\begin{abstract}Abstract text

\end{abstract}After this section you can put the

make title command.

Page 18: Introduction to latex by Rouhollah Nabati

Sections \section{…} = 1. Latex is Great \subsection{…} = 1.1 Why Latex is Great \subsubsection{…} = 1.1.1 Reason One \appendix - changes numbering scheme \chapter{…} - To be used with book and

report document classes Titles, Authors and others

\title{…} \author{…} \footnote{…}

Page 19: Introduction to latex by Rouhollah Nabati

\maketitle - Display Title and Author \tableofcontents - generates TOC \listoftables - generates LOT \listoffigures - generates LOF Labels

\label{marker} - Marker in document. \pageref{marker} - Displays page no. of

marker. \ref{marker} - Displays section location of

marker. Itemize

Use either enumerate, itemize or description. see handout for example.

Page 20: Introduction to latex by Rouhollah Nabati

Source \begin{itemize} \item Apple \item Orange \end{itemize}

Result Apple Orange

Page 21: Introduction to latex by Rouhollah Nabati

Enumerate instead of itemize gives a numbered list

Lists can be recursive

Page 22: Introduction to latex by Rouhollah Nabati

Something between \begin{name} \end{name}

Many command, for example \bf affect the text until the end of environment

Environments can be recursiveExamples:

itemize, center, abstract

Page 23: Introduction to latex by Rouhollah Nabati

Group is some text between { and }Many commands work until the end

of the groupCode

put {one word \bf in bold} hereResult

put one word in bold here

Page 24: Introduction to latex by Rouhollah Nabati

Environments center, flushleft, flushright

Example \begin{flushright} Right aligned \end{flushright}

ResultRight ali gned

Page 25: Introduction to latex by Rouhollah Nabati

\tiny \scriptsize \footnotesize \small \normalsize \large \Large \LARGE

\huge \Huge

Page 26: Introduction to latex by Rouhollah Nabati

\documentclass{article} \title{Simple Example} \author{Rouhollah Nabati} \date{December 2016} \begin{document} \maketitle

Hello world! \end{document}

Page 27: Introduction to latex by Rouhollah Nabati

Columns \begin{tabular}{|…|…|} \end{tabular}

Rows & - Split text into columns \\ - End a row \hline - Draw line under row e.g. 123123 & 34.00\\ \hline

Two Columnsl = automatically adjust size, left justifyr = automatically adjust size, right justifyp = set size e.g p{4.7cm}c = centre text

Page 28: Introduction to latex by Rouhollah Nabati

\begin{tabular}{|l|r|c|} \hlineDate & Price & Size \\ \hlineYesterday & 5 & big \\ \hlineToday & 3 & small \\ \hline \end{tabular}

Date Price Size Yesterday 5 Big Today 3 Small

Page 29: Introduction to latex by Rouhollah Nabati

Floating objects can stop splitting of tables and images over pages. \begin{figure}[options] \end{figure} \begin{table}[options] \end{table}

They will now appear in the List of Figures (LOF) and List of Tables (LOT).

Options (recommendations)h = place table heret = place at top of pageb = place at bottom of page

Page 30: Introduction to latex by Rouhollah Nabati

\begin{figure}[ht] \centering\epsfig{file=uni.ps,

width=5cm} \caption{Azad University of

Sanandaj} \label{uni} \end{figure}

Figure~\ref{uni} shows...

Page 31: Introduction to latex by Rouhollah Nabati

Use epsfig package \usepackage{epsfig} Including images in main body \epsfig{file=filename.eps,

width=10cm, height=9cm, angle=90}

Creating EPS - Use xv and/or xfig.MS Power Point, save as GIF and

convert to EPS.

Page 32: Introduction to latex by Rouhollah Nabati

\usepackage{graphicx} \begin{figure}[h] \centering \captionsetup{justification=centering} \includegraphics[width=85mm]{img-1} \caption{Illustration of the iteration

process of building a full tree. The firts 5 iteration of DURT.}

\label{fig-DURT} \end{figure}

Page 33: Introduction to latex by Rouhollah Nabati

Put simple equation between two $

$t=0$$E=mc^2$$n^{n-1}$

Page 34: Introduction to latex by Rouhollah Nabati

You need an equation by itself. That is also numbered. You do this with

\begin{equation} \frac{1}{N} \sum_{i=1}^{n} \frac{2N_i}{k_i*(k_i-1)}

\end{equation} If you wish to leave it unnumbered simply

put an asterisk at the end of the word equation. \begin{equation*} equation \end{equation}

Page 35: Introduction to latex by Rouhollah Nabati

\usepackage{algorithm} \begin{algorithm} \caption{EDSS Algorithm} \begin{algorithmic}[1] \Procedure{EDSS}{$T$}\Comment{$T$ is

the number of iterations} \While{$t\not=T$}

\State $t\gets T$ \State\textbf{Step 0:} Node "0" generated.

\EndWhile\label{euclidendwhile} \EndProcedure \end{algorithmic} \end{algorithm}

Page 36: Introduction to latex by Rouhollah Nabati

\usepackage{algorithm} \begin{algorithm} \caption{EDSS Algorithm} \begin{algorithmic}[1] \Procedure{EDSS}{$T$}\Comment{$T$ is

the number of iterations} \While{$t\not=T$}

\State $t\gets T$ \State\textbf{Step 0:} Node "0" generated.

\EndWhile\label{euclidendwhile} \EndProcedure \end{algorithmic} \end{algorithm}

Page 37: Introduction to latex by Rouhollah Nabati

\begin{figure}[h] \begin{tikzpicture} \begin{axis}[ %title={Clustering coefficient distribution in proposed

model for N=15 and T=4}, xlabel={Clustering coefficient}, ylabel={Count}, xmin=0, xmax=1.2, ytick={1,2,3,4,5}, …. ] \addplot[ \label{plot:CC-distribution} \end{figure}

Page 38: Introduction to latex by Rouhollah Nabati

\Ref {Label} -> Reference to Figure, Section, Equation and etc. \Ref{sec:introduction}

\Cite{Label} -> Cite an article listed in Bibliographgy \cite{newman-2000}

Page 39: Introduction to latex by Rouhollah Nabati

\begin{thebibliography}{} \bibitem[Come95]{Come95} Comer,D. E., {\it Internetworking with

TCP/IP:Principles, Protocols and

Architecture},volume 1, 3rd edition. Prentice-Hall,1995. \end{thebibliography}

Page 40: Introduction to latex by Rouhollah Nabati

Bibliography information is stored in a *.bib file, in Bibtex format.

Include chicago package \usepackage{chicago}

Set referencing style \bibliographystyle{chicago}

Create reference section by \bibliography{bibfile with no extension}

Page 41: Introduction to latex by Rouhollah Nabati

@book{Come95,author=“D. E. Comer”, title={Internetworking with TCP/IP:

Principles, Protocols and Architecture},

publisher=“Prentice-Hall”,year=1995,volume=1,edition=“Third”}

Page 42: Introduction to latex by Rouhollah Nabati

Citing references in text \cite{cuc98} = (Cuce 1998) \citeN{cru98} = Crud (1998) \shortcite{tom98} = (Tom, et. al. 1998)

Creating Bibtex Files Use Emacs with extensions. or copy Bibtex entries from bibliography

database.

Page 43: Introduction to latex by Rouhollah Nabati

\begin{center} {\large $$ y=\

frac{a^3+2c_{x}}{1+\sqrt{b_{x}}} $$ \\

\vspace{0.2in} $$ Q=\sum_{i=1}^{j}\

int_{\mu}^{\infty}f(x_{j})dx $$ \\

\vspace{0.2in} $$ \Psi = \oint_{- \

infty}^{\infty}f_{xy}({\frac{\partial

Qx}{\partial Qy}})^{\Im_{\pi}^ \prime} $$ \\ }

Page 44: Introduction to latex by Rouhollah Nabati

UNIX based systems xdvi, ghostview, fixps, emacs with

latex/bibtex support.Windows 98/NT

Ghostview, Acrobat Distiller, Acrobat Reader, Scientific Workplace (not the best), the Bibtex viewer is good. Paint Shop Pro, Latex and Emacs

Page 45: Introduction to latex by Rouhollah Nabati

Download XeTeX from https://sourceforge.net/projects/xetex/

Or farsixetex 

Page 46: Introduction to latex by Rouhollah Nabati

Beamer Beamer is a LaTeX document class for

creating slides for presentations. Beamer provides the ability to make

"handouts“

Powerdot Powerdot is a LaTeX class for making

professional-looking presentation slides.

Page 47: Introduction to latex by Rouhollah Nabati

Latex is optimal for master and phd thesis?

Mathematical formulae are easy. Use bibtex search engines Consider converting Postscript files

to PDF (more widespread in Windows world) and to conserve space.

Page 49: Introduction to latex by Rouhollah Nabati

http://www.miktex.org/http://www.toolscenter.org/http://www.ocf.berkeley.edu/~jjlin/lat

ex/http://en.wikibooks.org/wiki/LaTeXLatex math symbols

http://web.ift.uib.no/Fysisk/Teori/KURS/WRK/TeX/symALL.html

LaTex project page http://www.latex-project.org/

Google is your friend…

amsmathIt contains the advanced math extensions for LaTeX. The complete

documentation should be in your LaTeX distribution; the file is called amsdoc, and can be dvi or pdf. For more information, see the chapter about Mathetics.

amssymb It adds new symbols in to be used in math mode.amsthm It introduces the proof environment and the \theoremstyle command. For

more information see the Theoremssection.

arrayIt extends the possibility of LaTeX to handle tables, fixing some bugs and

adding new features. Using it, you can create very complicated and customized tables. For more information, see the Tables section.

babelIt provides the internationalization of LaTeX. It has to be loaded in any

document, and you have to give as an option the main language you are going to use in the document. For more information see the Internationalization section.

biblatex Advanced bibliography handling. It is the package to use for writing a thesis.bm Allows use of bold greek letters in math mode using the \bm{...} command.

This supersedes the amsbsy package.

booktabsprovides ex tra com mands as well as be hind-the-scenes op ti mi sa tion for

producing tables. Guide lines are given as to what con sti tutes a good ta ble in the package documentation.

caption Allows customization of appearance and placement of captions for figures, tables, etc.

cancel Provides commands for striking out mathematical expressions. The syntax is \cancel{x} or \cancelto{0}{x}

chemmacros Part of a bundle to typeset chemistry easily and consistent.

changepage To easily change the margins of pages. The syntax is

enumitem Adds support for arbitrarily-deep nested lists (useful for outlines). See List Structures.

esint Adds additional integral symbols, for integrals over squares, clockwise integrals over sets, etc.

eucal Other mathematical symbols.fancyhdr To change header and footer of any page of the document. It is described in

the Page Layout section.

Page 50: Introduction to latex by Rouhollah Nabati

He who learns, teaches.

Page 51: Introduction to latex by Rouhollah Nabati

Thank you foryour attention.


Recommended