Sunteți pe pagina 1din 51

LATEX WORKSHOP

Habib Ghaffari Hadighe

Objectives of workshop
You should be able to install latex in your computer. You should know the basic commands of latex. You should know how to prepare your documents with latex. You should know how to debug and solve your problem.

Outline

What is Latex? How we can install it in our computers? Basic Commands in Latex.

Writing articles, reports and thesis using Latex.


Useful application that helps to prepare documents faster.
3

WHAT IS LATEX?

What is Latex?
LaTeX is a document preparation system for high-quality typesetting. It is most often used for medium-to-large technical or scientific documents but it can be used for almost any form of publishing. LaTeX is not a word processor! Instead, LaTeX encourages authors not to worry too much about the appearance of their documents but to concentrate on getting the right content.

Why Latex?

Output Quality

TeX has the best output. Sample of Complex Document Compaire documents generated by word and TeX TeX knows typesetting. For instance, it automatically classifies each mathematical symbol as a variable, or a relation, etc., and sets them with appropriate amounts of surrounding space. It also sizes superscripts and subscripts, radicals, brackets, and many other things. The result is that, because your document follows the conventions of professional typesetting, your readers will know exactly what you mean.

Why Latex?

Superior Engineering:
TeX is fast : On today's machines TeX is very

fast. It is easy on memory and disk space, too. TeX is stable : TeX's designer has frozen the central engine, the actual tex program. Documents that run today will still run in ten years, or fifty. So "stable" means more than that it actually works. It means that it will continue to work, forever.

Why Latex?

Superior Engineering:
TeX is stable, but not rigid : A system locked into 1978's technology would today have gaps. That's why TeX is extendable, so that innovations can be added on. An example is the LaTeX macro package, which is the most popular way to use TeX today. It extends TeX by adding conveniences such as automatic cross references, sectioning, indexing, a table of contents, automatic numbering of chapters, sections, theorems, etc., in a variety of styles, and a straightforward but powerful way to make tables.
8

Why Latex?

Superior Engineering:

The input is plain text: TeX's source files are portable to any computing platform. They are compact.
A binary input format, especially a proprietary one, is bad for cooperation: probably you have had to go through the trouble of upgrading a word processor version because coworkers upgraded and you could no longer read their files. With TeX systems that rarely happens the last time that a LaTeX release lost even a small amount of compatibility was in 1995. Another advantage of plain text is that the text may be automatically generated, for instance if it is drawn out of a database for a report. Getting a word processor into that work flow is a challenge. But TeX fits right in.

Why Latex?

Superior Engineering:
The output can be anything: As with inputting, TeX's outputting step is separate from its typesetting. The TeX engine's results can be converted to a printer language such as PostScript or to PDF or HTML, or, probably, to whatever will appear in the future. And, the typesetting line breaks, etc. will be the same no matter where your output appears.
10

Why latex?

Freedom:
TeX is free: The source of the main tex en-

gine is open; the Free Software Foundation uses it for their documents. All of the other main components are open, also. TeX runs anywhere : Whatever platform meets your needs Windows, Macintosh, a variety of Unix even Android and IOS, or almost anything else you can get TeX, either freely distributed or in a commercial version.
11

Why Latex?

Popularity :

Using the same system as many other people

has advantages. For instance, you can get answers to your questions. And, because of this large user base, your system is sure to be around for years. Most scientists, especially academic scientists, know TeX. Research preprints, drafts of textbooks, and conference proceedings, all are regularly produced with TeX. As a result, many publishers of technical material are set up to work with it.
12

Why Latex?

Summary
TeX is a typesetting system that produces

publication-quality output, even for difficult material such as mathematics. It is freely available. Its design makes it shine in areas where the system familiar to most beginning computer users, word processors, falls short. Briefly, that is, it was designed well.

13

How we can install it in our computers?

Outline

Basic Software for different Operating Systems. Introducing Some Tex Editor Softwares.

15

Basic Software for Tex

Windows :
Miktex, Tex live

Linux:
Tex Live

Macintash :
MacTex
16

Tex Editor softwares

Winedit

Tex Maker
Tex Work Bibtex
17

BASIC COMMANDS IN LATEX

BASIC COMMANDS IN LATEX

This is the first sample code:

Frist Sample File

19

BASIC COMMANDS IN LATEX


To write a Tex Command we should start comand with \. To make a Text part as comment we should use %. We should use \\ for going to next line wherever we want. For making a one row span between two parts of text we should make at least one line space between two parts in the text.

20

BASIC COMMANDS IN LATEX

Document Class :

When Latex processes an input le, it expects

it to follow a certain structure. Thus every input le must start with the command \documentclass[options]{class}
For Example:
\documentclass[11pt,twoside,a4paper]{article}

which instructs to typeset the document as an article with a base font size of eleven points, and to produce a layout suitable for double sided printing on A4 paper.
21

BASIC COMMANDS IN LATEX

Document Class :
Basic Document Classes: Article : for articles in scientic journals, presentations, short reports, program documentation, invitations, . . . proc : a class for proceedings based on the article class. minimal: is as small as it can get. It only sets a page size and a base font. It is mainly used for debugging purposes. report: for longer reports containing several chapters, small books, PhD theses, . . . book : for real book. slides: for slides.
22

BASIC COMMANDS IN LATEX


The default font size for each class is 10 point. You can use 11 point or 12 a4paper, letterpaper, . . . Used for defines the page size. twoside, oneside Species whether double or single sided output should be generated.

23

BASIC COMMANDS IN LATEX


For starting the body of the text, we should use \begin{document} command. For ending the body of text, we should use \end{document} command.

24

BASIC COMMANDS IN LATEX

Add Title to your article :

Sample 2 File
25

BASIC COMMANDS IN LATEX

The title of the whole document is generated by useing \maketitle The contents of the title have to be dened by the commands (\title{...}, \author{...} and optionally \date{...}) before calling \maketitle.

26

BASIC COMMANDS IN LATEX

Adding Abstract:

Sample 3 File
27

BASIC COMMANDS IN LATEX

Adding Chapters and Sections:

Sample 4 File
28

BASIC COMMANDS IN LATEX


Since the Article does not have any chapter, we can not add chapter to an article document. If we do this we will absolutely get an error when the Tex engine going to generate the export file. For using chapter we should use other types of documents that have chapter inside such as report or book. Sample5 file

29

BASIC COMMANDS IN LATEX

Sample 6 File

30

BASIC COMMANDS IN LATEX

Adding a figure:
For inserting a figure inside of your document

you should use \includegraphics[key=value, . . . ]{le} Different kind of files could be added as a figure (jpg,gif,png,pdf,eps). For using this command the graphicx package should be added to your document.

31

BASIC COMMANDS IN LATEX

Adding a package to document:

\usepackage[options]{package}
For adding figures we should add graphicx package to the top of the document after document class. \usepackage{graphicx}
32

BASIC COMMANDS IN LATEX

33

BASIC COMMANDS IN LATEX


sample7 \begin{figure}[placement specifier] ... figure contents ... \end{figure} Placements:


h: Place the float here, i.e., approximately at the

same point it occurs in the source text t: Position at the top of the page. b: Position at the bottom of the page. p:Put on a special page for floats only. !:Override internal parameters LaTeX uses for determining "good" float positions.

34

BASIC COMMANDS IN LATEX


Adding Table: For adding a table you shoud use a structure like this: \begin{tabular}[pos]{table spec}

Sample8 If you have a table that it size would be bigger than a one page, you can use long table instead of tabular. Sample9
35

BASIC COMMANDS IN LATEX


Add equation to your document: \begin{equation} \end{equation}


C=a+b \lable{e1}

If you need to add a equation within the text you can use $...$. If you need to add more than one equation in the same time use eqnarray instead of equation: \begin{eqnarray} \end{eqnarray} Remember not to have any space before and after the equations.
C=a+b \\ Sin(x)=y

36

BASIC COMMANDS IN LATEX

Operators:
Greek letters: \alpha, \beta, \gamma, \Gamma, \pi, \Pi, \phi, \varphi, \Phi Operatiors : \lim_{x \to \infty} \exp(-x) = 0 Powers and indices: k_{n+1} = n^2 + k_n^2 - k_{n-1}

37

BASIC COMMANDS IN LATEX


Accessories: \usepackage{amsmath} Matrix: \begin{bmatrix}
x & y \\ z&v

\end{bmatrix}

sample10
38

BASIC COMMANDS IN LATEX

Writing codes:

\begin{verbatim} For i=1 to 10 Print I; next \end{verbatim}

sample11
39

BASIC COMMANDS IN LATEX


Writing an algorithm: \usepackage{algorithm2e}


\begin{algorithm} \caption{The algorithm of whole research} \label{algc3a1} \textbf{Step 1:} Create a dome using a mathematical form as the virtual sky\\ \textbf{Step 2:} Put the light source in the sun's position using Julian dating by consideration of specific location, date and time\\ \end{algorithm}

sample12

40

BASIC COMMANDS IN LATEX

For generating the content we should use the \tableofcontents command. For Genrating the List of figures we should use the \listoffigures command. For Generating the list of tables we should use \listoftables command. For breaking a page and start with new page we should use \pagebreak command.
41

BASIC COMMANDS IN LATEX

For making a part of text Bold, we should use \textbf{text} command. For making a part of text Italic, we should use \emph {text} command.

42

Questions and Answers

43

Outline of afternoon workshop

Bibtex and Bibloghraphy

Writing article in journals using Latex


Writing These using Latex.

44

Creating a bibliography
Especially in scientific documents, a list of references or bibliography is very common. We shall work out how to typeset a bibliography and how to refer to its entries.

45

Creating a bibliography

Creating a Bibloghraphy:
For creating a bibloghraphy part, you should

add a thebibliography enviroument to the end of your document.

Sample14

46

BASIC COMMANDS IN LATEX

Using BIBTEX:
To use BIBTEX, your LATEX input file must contain

a \bibliographystyle command. This command specifies the bibliography style, which determines the format of the source list. For example, the command
\bibliographystyle{plain}

The \bibliographystyle command can go

anywhere after the \begin{document) command.

47

BASIC COMMANDS IN LATEX

Using BIBTEX:
STANDARD ENTRY TYPES: @article
An article from a journal or magazine

@book
A book with an explicit publisher

@booklet
A work that is printed and bound, but without a named publisher or sponsoring institution

48

BASIC COMMANDS IN LATEX

Using BIBTEX:
We should use \cite{itemlabel} for citing a

paper after adding it to bib file. Sample 13

49

Using different templates

Using Journals Templates.

Using Thesis Templates.

50

Face book Group

You can join to our Facebook group for sharing your question with us and also with our other members. Latex for UTM Students

51

S-ar putea să vă placă și