introduction to latex - it496ksu.files.wordpress.com to latex ... latex is an extension of tex ... ...

37
Introduction to Latex A workshop by Dr. Ala’ Eshmawi

Upload: lethuy

Post on 14-May-2018

297 views

Category:

Documents


7 download

TRANSCRIPT

Introduction to Latex

A workshop by Dr. Ala’

Eshmawi

Introduction

TeX is essentially a Markup Language (like

HTML, XML and RTF)

TeX written by Donald Knuth in 70´s

A revolution in typesetting

Latex is an extension of TeX

Macro packages to make TeX easier to

use

Latex vs. Word Processors

High typeset quality

Easy to include math formulas

Easy to deal with formatting images and tables

inside text paragraphs.

Good for large documents

Source file format is not bounded to a particular OS

or platform

Latex implementations exists for all platforms

(Windows, Mac,..)

Latex is free

Example of Latex document

\documentclass{article}

\title{Simple Example}

\author{Ahmed Ali}

\date{November 2015}

\begin{document}

\maketitle

Hello world!

\end{document}

Example of Latex document

Downloading Latex

MiKTeX :

a complete LaTeX system for Windows.

http://www.miktex.org/

TexMaker:

Free cross-platform LaTeX editor since

2003 (Windows, MacOsX, Linux)

http://www.xm1math.net/texmaker/downl

oad.html

Latex File Structure

Document Class

Predefined Formats (article, report, book,..).

Packages used

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

Main Body

Text and Bibliography References.

The Basics

Document Class

\documentclass[options]{class}

options = a4paper, 11pt, 12pt, 10pt, twocolumn, landscape,...

class = article, report, book,...

Packages

\usepackage{package name}

Package name : (examples)

epsfig = insert PS pictures into the document.

fancyhdr = easy definition of footer and header.

hyperref = manage links/URL within the document.

graphicx = insert graphic files within a document.

Body of Text

Start with \begin{document}

End with \end{document}

Typesetting Text \\ or \newline and \newpage

Bold \textbf{……………} or \bf

Italics \emph{…………} or \textit{………} or \it

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

Format Contd.

\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.

Body of Text cont…

Using Multiple Files \input{filename.tex}

\include{filename.tex}

This is a good idea to separate the formatting from the real writing and to split the large documents into small parts.

Main differences between \input and \include :

Feature \input \include

Allows calling a file that calls another √ xForces NewPage x √Good for book chapters x √Good for a long article with discrete sections √ x

The .tex extension is optional

Body of Text cont…

\input \include

Format

Sections and subsection \section{Latex is Great} 1. Latex is Great

\subsection{Why Latex is Great} 1.1 Why Latex is Great

\subsubsection{Reason one} 1.1.1 Reason one

Titles, Authors and others \title{…}

\author{…}

\date{…}

Lists

Two types of lists itemize Bullets

enumerate Numbering

Lists can be recursive (nested)

Formats

◦ \begin{itemize}

◦ \item ……

◦ \item ……

◦ \end{itemize}

◦ \begin{enumerate}

◦ \item ……

◦ \item ……

◦ \end{enumerate}

Lists

Example of Latex document

Bibliography using Bibtex

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}

Bibliography using Bibtex

You need a file (e.g. myref.bib) where you

have the Bibtex of your reference (e.g. a

book, an article, website..etc.)

Put the file in the same folder of your Latex

file.

Inside your text , cite a reference using :

\cite{……}

\citeN {……}

\shortcite{……}

Bibliography examplemyref.bib

Example.tex

2

How to use Latex

1 Create new Latex document

2a new Latex document

How to use Latex

How to use Latex

3

Type your Latex text

4Save the file as (example.tex)

How to use Latex

5

Build your file (example.tex)

Choose PDFLaTeX from the dropdown menu

If your text has no errors then the PDF file for this Latex will be created and opened

How to use Latex

The created PDF file for (example.tex) is then opened

6

1 Create a new document

How to create Bibtex files

2a new document

How to create Bibtex files

3Type your Bibtex

How to create Bibtex files

4 (Save As ) your Bibtex file

How to create Bibtex files

5 Type a name for the file and add extension (.bib) (e.g. myref.bib) and put it in the same folder where your Latex file is saved

How to create Bibtex files

6The file after saving as .bib

How to create Bibtex files

8Now you can cite any refrence in that file

How to use Bibtex files

Specify your Bibtex file (myref)

7

9

Now run BibTex command (you might need to run PDFTeX – BibTeX commands for several times for cross referencing

How to use Bibtex files

The editor might prompt you to install needed packages. Just click Install to continue

How to use Bibtex files

Conclusions

Latex is phd thesis.

Latex is good for large documents, reports,

papers.

Mathematical formulas are easy.

Formatting figures and tables inside a large

document is easier.

Referencing is easier using Latex.

http://www.docs.is.ed.ac.uk/skills/documents/3722/3722-2014.pdf

https://www.tug.org/twg/mactex/tutorials/ltxprimer-1.0.pdf

https://en.wikibooks.org/wiki/LaTeX

Useful Links