Training basic latex

60
Training Basic Latex Edited by: Nguyen Duc Minh Khoi Email: [email protected] Website: http://nguyenducminhkhoi.blogspot.com @HCMC University of Technology, Spring 2013 Main reference: THE NOT SO SHORT INTRODUCTION TO LATEX2Ε by Tobias Oetiker Hubert Partl, Irene Hyna and Elisabeth Schlegl

description

Basic Latex

Transcript of Training basic latex

Page 1: Training basic latex

Training Basic Latex Edited by: Nguyen Duc Minh Khoi

Email: [email protected]

Website: http://nguyenducminhkhoi.blogspot.com

@HCMC University of Technology, Spring 2013

Main reference: THE NOT SO SHORT INTRODUCTION TO LATEX2Ε by Tobias Oetiker Hubert Partl, Irene Hyna and Elisabeth Schlegl

Page 2: Training basic latex

1/12/2013 Training Basic Latex 2

Contents:

Things you need to know

Typesetting Text

Specialities

Typeset Mathematical formulae

Producing Mathematical graphics

Page 3: Training basic latex

Things you need to know

1/12/2013 Training Basic Latex 3

Page 4: Training basic latex

Things you need to know Tex, Latex

TEX

is a computer program created by Donald E. Knuth

is aimed at typesetting text and mathematical formulae

LATEX

enables authors to typeset and print their work at the highest typo-graphical quality, using a predefined, professional layout

was originally written by Leslie Lamport

uses the TEX formatter as its typesetting engine

These days LATEX is maintained by Frank Mittelbach

1/12/2013 4 Training Basic Latex

Page 5: Training basic latex

Things you need to know Author, Book Designer, Typesetter

To publish something:

authors give their typed manuscript to a publishing company.

One of their book designers then decides the layout of the document and writes his instructions into the manuscript and then gives it to a typesetter

typesetter who typesets the book according to these instructions.

In a LATEX environment,

LATEX takes the role of the book designer and uses TEX as its typesetter.

But LATEX is “only” a program and therefore needs more guidance. The author has to provide additional information to describe the logical structure of his work.

This information is written into the text as “LATEX commands.”

1/12/2013 Training Basic Latex 5

Page 6: Training basic latex

Things you need to know Latex’s advantages

LATEX prevents formatting errors by forcing the author to declare the logical structure of his document. LATEX then chooses the most suitable layout.

Professionally crafted layouts are available, which make a document really look as if “printed.”

The typesetting of mathematical formulae is supported in a convenient way.

Users only need to learn a few easy-to-understand commands that specify the logical structure of a document.

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

TEX, the formatting engine of LATEX2ε, is highly portable and free. Therefore the system runs on almost any hardware platform available.

1/12/2013 Training Basic Latex 6

Page 7: Training basic latex

Things you need to know Latex’s installation

On Linux OS systems: use Texlive as compiler and gedit as text editor

On Mac OS: use MacTex as compiler and text wrangler as text editor

On Windows: use MikTex as compiler and notepad++ as text editor

Or you can use texclipse as text editor (full support for latex) on multiple platform

On website:

verbosus

MonkeyTeX

LaTeX Lab

ShareLaTeX

WriteLaTeX

1/12/2013 Training Basic Latex 7

Page 8: Training basic latex

Things you need to know Latex’s installation (cont.) - Texclipse

1/12/2013 Training Basic Latex 8

Page 9: Training basic latex

Things you need to know Files encounter

1/12/2013 Training Basic Latex 9

Page 10: Training basic latex

Typesetting Text

1/12/2013 Training Basic Latex 10

Page 11: Training basic latex

Typesetting Text Input files

Spaces:

Several consecutive whitespace characters are treated as one “space”.

Whitespace at the start of a line is generally ignored, and a single line break is treated as “whitespace.”

An empty line between two lines of text defines the end of a paragraph. Several empty lines are treated the same as one empty line.

1/12/2013 Training Basic Latex 11

Page 12: Training basic latex

Typesetting Text Input files (cont.)

Special Characters:

Latex Commands:

are case sensitive

start with a backslash \ and then have a name consisting of letters only. Command names are terminated by a space, a number or any other ‘non-letter.

If you want to get a space after a command, you have to put either an empty parameter {} and a blank or a special spacing command after the command name.

1/12/2013 Training Basic Latex 12

Page 13: Training basic latex

Typesetting Text Input files (cont.)

Comments:

a % character while processing an input file, it ignores the rest of the present line, the line break, and all whitespace at the beginning of the next line.

write notes into the input file, which will not show up in the printed version.

1/12/2013 Training Basic Latex 13

Page 14: Training basic latex

Typesetting Text Input file Structure

1/12/2013 Training Basic Latex 14

Page 15: Training basic latex

Typesetting Text The Layout of the documents

M

1/12/2013 Training Basic Latex 15

Page 16: Training basic latex

1/12/2013 Training Basic Latex 16

Page 17: Training basic latex

Typesetting Text The Layout of the documents (cont.)

1/12/2013 Training Basic Latex 17

Page 18: Training basic latex

Typesetting Text The Layout of the documents (cont.)

1/12/2013 Training Basic Latex 18

Page 19: Training basic latex

Typesetting Text Line Breaking and Page Breaking

To break a line, use:

starts a new line without starting a new paragraph:

additionally prohibits a page break after the forced line break:

Start a new page:

Several words can be kept together on one line with the command:

1/12/2013 Training Basic Latex 19

Page 20: Training basic latex

Typesetting Text Special character and strings

Quotation marks:

Dash and hyphens:

1/12/2013 Training Basic Latex 20

Page 21: Training basic latex

Typesetting Text Special character and strings (cont.)

Degree symbols (℃):

Euro currency symbols (€):

Ellipsis (…)

1/12/2013 Training Basic Latex 21

Page 22: Training basic latex

Typesetting Text Titles, Chapters and Sections

For article class:

If you want to split your document in parts without influencing the section or chapter numbering use:

When you work with the report or book class, an additional top-level sectioning command becomes available:

1/12/2013 Training Basic Latex 22

Page 23: Training basic latex

Typesetting Text Foot notes and emphasized words

Footnotes:

Emphasized words:

1/12/2013 Training Basic Latex 23

Page 24: Training basic latex

Typesetting Text Environments

1/12/2013 Training Basic Latex 24

Page 25: Training basic latex

Typesetting Text Environments – Flushleft, flushright, center

1/12/2013 Training Basic Latex 25

Page 26: Training basic latex

Typesetting Text Quote, Quotation, Abstract

1/12/2013 Training Basic Latex 26

Page 27: Training basic latex

Typesetting Text Verbatim, tabular

\begin{verbatim} and \end{verbatim} will be directly printed, as if typed on a typewriter:

Tabular:

1/12/2013 Training Basic Latex 27

L: left aligned column R: right aligned column C: center aligned column

Page 28: Training basic latex

Specialties

1/12/2013 Training Basic Latex 28

Page 29: Training basic latex

Specialties Figures and Tables

1/12/2013 Training Basic Latex 29

Page 30: Training basic latex

Specialties Figures and Tables (cont.)

1/12/2013 Training Basic Latex 30

Page 31: Training basic latex

Specialties Bibliography

Produce a bibliography with the thebibliography environment. Each entry starts with:

The marker is then used to cite the book, article or paper within the document.

1/12/2013 Training Basic Latex 31

Page 32: Training basic latex

Specialties Table of contents (TOC)

Create table of contents:

In preamble section, add:

To describe title, author and the date written

Make title commands:

Cross references:

1/12/2013 Training Basic Latex 32

Page 33: Training basic latex

Specialties Indexing

In the preamble:

Content of the index is specified with:

1/12/2013 Training Basic Latex 33

Page 34: Training basic latex

Specialties Hypertext links

For complete hypertext links

Or embed explicit links:

1/12/2013 Training Basic Latex 34

Page 35: Training basic latex

Specialties Big Projects

Use \includeonly comment in preamble first

Then use:

Use:

This makes LATEX skim through your document only checking for proper syntax and usage of the commands, but doesn’t produce any (DVI) output.

1/12/2013 Training Basic Latex 35

Page 36: Training basic latex

Specialties Install Extra Packages Most LATEX installations come with a large set of pre-installed style packages

But many more are available on the net. (e.g.: http://www.ctan.org/ )

Or download template from www.latextemplates.com

Or using package manager of each compiler to install extra packages

1/12/2013 Training Basic Latex 36

Page 37: Training basic latex

Typesetting Mathematical Formulae

1/12/2013 Training Basic Latex 37

Page 38: Training basic latex

Typesetting Mathematical Formulae AMS-LATEX – Single Equation AMS-LATEX is produced by The American Mathematical Society and it is used

extensively for mathematical typesetting.

1/12/2013 Training Basic Latex 38

Without numbering

Page 39: Training basic latex

Typesetting Mathematical Formulae Single Equations (cont.)

1/12/2013 Training Basic Latex 39

Page 40: Training basic latex

Typesetting Mathematical Formulae Single Equations (cont.)

1/12/2013 Training Basic Latex 40

Page 41: Training basic latex

Typesetting Mathematical Formulae Single Equations (cont.)

1/12/2013 Training Basic Latex 41

Page 42: Training basic latex

Typesetting Mathematical Formulae Single Equations (cont.)

1/12/2013 Training Basic Latex 42

Page 43: Training basic latex

Typesetting Mathematical Formulae Single Equations (cont.)

1/12/2013 Training Basic Latex 43

Page 44: Training basic latex

Typesetting Mathematical Formulae Multiple Equations (cont.)

1/12/2013 Training Basic Latex 44

Page 45: Training basic latex

Typesetting Mathematical Formulae Array and Matrices

1/12/2013 Training Basic Latex 45

Page 46: Training basic latex

Typesetting Mathematical Formulae Array and Matrices (cont.)

1/12/2013 Training Basic Latex 46

Page 47: Training basic latex

Typesetting Mathematical Formulae Theorems, lemmas…

1/12/2013 Training Basic Latex 47

Page 48: Training basic latex

Typesetting Mathematical Formulae Theorems, lemmas… (cont.)

1/12/2013 Training Basic Latex 48

Page 49: Training basic latex

Producing Mathematical graphics

1/12/2013 Training Basic Latex 49

Page 50: Training basic latex

Producing Mathematical graphics Picture environment – basic operations

1/12/2013 Training Basic Latex 50

Page 51: Training basic latex

Producing Mathematical graphics Line segments

1/12/2013 Training Basic Latex 51

Page 52: Training basic latex

Producing Mathematical graphics Arrows

1/12/2013 Training Basic Latex 52

Page 53: Training basic latex

Producing Mathematical graphics Circles

1/12/2013 Training Basic Latex 53

Page 54: Training basic latex

Producing Mathematical graphics Text and formulas

1/12/2013 Training Basic Latex 54

Page 55: Training basic latex

Producing Mathematical graphics Multiput, linethickness

1/12/2013 Training Basic Latex 55

Page 56: Training basic latex

Producing Mathematical graphics Ovals

1/12/2013 Training Basic Latex 56

Page 57: Training basic latex

Producing Mathematical graphics Predefined picture box

1/12/2013 Training Basic Latex 57

Page 58: Training basic latex

Producing Mathematical graphics Quadratic Bézier Curves

1/12/2013 Training Basic Latex 58

Page 59: Training basic latex

Producing Mathematical graphics The PGF and TikZ Graphics Packages (from latextemplates.com)

1/12/2013 Training Basic Latex 59

Page 60: Training basic latex

Thank for your listening!