2 Install a LATEXeditor of your choice: TeXstudio, TexMaker, etc. ..... Linux: Under Debian or Ubuntu, you can type the .... option and use the theme default.
Hafida Benhidour Introduction to LATEX Introduction to Beamer
Introduction to Latex and Beamer How to write a scientific paper using LATEX. How to make a presentation using Beamer ?
Hafida Benhidour Department of computer science King Saud University
December 19, 2016
1 / 50
Contents
Hafida Benhidour Introduction to LATEX Introduction to Beamer
1 Introduction to LATEX
2 Introduction to Beamer
2 / 50
Introduction to LATEX Hafida Benhidour Introduction to LATEX Introduction to Beamer
LATEXis a computer program for typesetting text and mathematical formulas. Uses commands to create mathematical symbols. Not a WYSIWYG program. It is a WYWIWYG (what you want is what you get) program! The document is written as a source file using a markup language. The final document is obtained by converting the source file (.tex file) into a pdf file.
3 / 50
Advantages of Using LATEX Hafida Benhidour Introduction to LATEX Introduction to Beamer
Professional typesetting: best output. It is the standard for scientific documents. Processing mathematical (& other) symbols. Knowledgeable and helpful user group. Its FREE! Platform independent.
4 / 50
Installing LATEX Hafida Benhidour Introduction to LATEX Introduction to Beamer
Linux: 1 2
Install TeXLive from your package manager. Install a LATEXeditor of your choice: TeXstudio, TexMaker, etc.
Windows: Install MikTeX from http://miktex.org (this is the LATEXcompiler). 2 Install a LATEXeditor of your choice: TeXstudio, TeXnicCenter, etc. 1
Mac OS: 1 2
Install MacTeX (this is the LATEXcompiler for Mac). Install a LATEXeditor of your choice.
5 / 50
TeXstudio
Hafida Benhidour Introduction to LATEX Introduction to Beamer
6 / 50
Structure of a LATEXDocument All latex documents have the following structure: Hafida Benhidour Introduction to LATEX Introduction to Beamer
\ documentclass [ . . . \ usepackage { . . . }
]{...}
\ b e g i n { document } ... \ end { document }
Commands always begin with a backslash \: \documentclass, \usepackage. Commands are case sensitive and consist of letters only. Some commands have parameters. Square brackets [ ] after the command name are for optional parameters. Curly braces { } after the command name are for required parameters 7 / 50
The command: \documentclass
Hafida Benhidour Introduction to LATEX Introduction to Beamer
article report \ d o c u m e n t c l a s s [ o p t i o n s ] { beamer } book letter
First line of all LATEXdocuments. Specifies the type of the document: article (research paper), report (multi-chapter document), book (for books), beamer (for presentations).
[options] can be used to set font size (10, 11, or 12 pt), set paper size, use one or two columns, etc. \ d o c u m e n t c l a s s [ 1 2 pt , a 4 p a p e r , twocolumn ] { a r t i c l e }
Most publishers (Springer, Elsevier, IEEE, ACM etc.) have their own document classes. These are predefined classes. 8 / 50
Packages
Hafida Benhidour Introduction to LATEX Introduction to Beamer
\ usepackage { package }
Packages add new features and commands to LaTeX. Common packages: amsmath, amssymb: for math symbols. graphicx: for including graphics and images. \ documentclass { report } \ usepackage { c o l o r } \ usepackage { graphicx } \ b e g i n { document } ... \ end { document }
9 / 50
Input the Text
Hafida Benhidour Introduction to LATEX Introduction to Beamer
The body of the text is written after the \begin{document} command: \ b e g i n { document } E n t e r t h e document c o n t e n t h e r e \ end { document }
Remark \begin{...} commands always need to be followed (eventually) by \end{...} commands.
10 / 50
A Simple LATEXDocument Hafida Benhidour Introduction to LATEX Introduction to Beamer
The following is a very basic LATEXdocument:
This is some sample text.
\ documentclass { a r t i c l e } \ usepackage { graphicx } \ b e g i n { document } T h i s i s some sample t e x t . \ end { document }
This gives the following output: 1
11 / 50
Sections of a Paper
Hafida Benhidour Introduction to LATEX Introduction to Beamer
First thing: you have to indicate the title and the author(s) of the paper: \title{title} \ author { authors } \ date { date } \ maketitle
Remark Without \maketitle, the title and authors do not appear in the output. Example \ t i t l e {The Theory o f R e l a t i v i t y } \ author { Albert E i n s t e i n } \ d a t e {01/01/1926} \ maketitle 12 / 50
Sections of a Paper
Hafida Benhidour Introduction to LATEX Introduction to Beamer
\ thanks { . . . } \ b e g i n { a b s t r a c t } . . . . \ end { a b s t r a c t } \ b e g i n { k e y w o r d s } . . . \ end { k e y w o r d s }
\thanks creates a footnote with whatever is in the braces. Usually used after authors’ names for academic information Example \ t h a n k s { I want t o t h a n k t h e U n i v e r s i t y o f P r i n c e t o n f o r s u p p o r t i n g t h i s work . } \ begin { abstract } I n t h i s p a p e r , I i n t r o d u c e a new t h e o r y t o e x p l a i n how t i m e and s p a c e a r e r e l a t e d . \ end { a b s t r a c t } \ b e g i n { k e y w o r d s } R e l a t i v i t y ; s p a c e ; t i m e \ end { keywords } 13 / 50
Sections
Hafida Benhidour Introduction to LATEX Introduction to Beamer
The document should be divided into sections, subsections, etc. Important commands: \ section { T i t l e of f i r s t section } ... \ s u b s e c t i o n { T i t l e o f t h e sub−s e c t i o n } ... \ s e c t i o n { T i t l e of second s e c t i o n } ... \ subsection {...} ... \ subsubsection { . . . } ...
LATEXformates the section titles and numbers them according to the document class being used. 14 / 50
A Simple LATEXDocument Hafida Benhidour Introduction to LATEX Introduction to Beamer
The following is a sample of a LATEXdocument (.tex file): \ documentclass { a r t i c l e } \ u s e p a c k a g e { g r a p h i c s , amsmath , amssymb } \ b e g i n { document } \ t i t l e {The Theory o f R e l a t i v i t y } \ author { Albert E i n s t i e n } \ d a t e {01/01/1926} \ maketitle \ begin { abstract } I n t h i s p a p e r , I i n t r o d u c e a new t h e o r y t o e x p l a i n ... \ end { a b s t r a c t } \ section { Introduction } What i s t i m e and s p a c e ? . . . \ s e c t i o n {The Theory } Time and s p a c e a r e l i n k e d . . . \ su bse ct ion { Proof } T h i s t h e p r o o f t o my t h e o r y \ end { document }
15 / 50
A Simple LATEXDocument Converting the (.tex) file to obtain the pdf file: Hafida Benhidour Introduction to LATEX Introduction to Beamer
The Theory of Relativity Albert Einstien 01/01/1926 Abstract In this paper, I introduce a new theory to explain how time and space are related.
1
Introduction
What is time and space?...
2
The Theory
Time and space are linked...
2.1
Proof
This the proof to my theory
1
16 / 50
Cross-referencing
Hafida Benhidour
Cross references can be made using the commands \label and \ref.
Introduction to LATEX
Example
Introduction to Beamer
\ section { Introduction } \ l a b e l { sec : i n t r o } This i s the i n t r o d u c t i o n . . . \ section { Conclusion } As m e n t i o n e d i n S e c t i o n \ r e f { s e c : i n t r o } , we h a v e . . .
LATEXupdates the references automatically. It is possible to use any identifier as a label. It is custom to use the prefixes: sec:xxx for section labels, fig:xxx for figure labels, chap:xxx for chapter labels, tab:xxx for table labels, eq:xxx for equation labels. 17 / 50
Inserting Tables
Hafida Benhidour Introduction to LATEX Introduction to Beamer
To include tables, you must use the following commands. \ begin { table } \ c a p t i o n {An Example o f a Table } \ l a b e l { t a b l e example } \ centering \ begin { tabular }{| c | c |} \hline S t u d e n t & Grade \\ \ h l i n e 12 & 13 \\ \hline \ end { t a b u l a r } \ end { t a b l e } Table \ r e f { t a b l e example } shows a t a b l e .
Table : An Example of a Table
Student 12
Grade 13
The results of the experiments are shown in Table 1.
18 / 50
Inserting Images
Hafida Benhidour Introduction to LATEX Introduction to Beamer
To include images, you must use a graphics package. The most common is graphicx. Figure 1 shows the painting. Figure \ r e f { f i g : monalisa } shows t h e p a i n t i n g . \ begin { f i g u r e } \ c e n t e r i n g % To c e n t e r t h e image \ i n c l u d e g r a p h i c s [ width =2.5cm ] { m o n a l i s a . j p g } % Path and f i l e name \ c a p t i o n {The M o n a l i s a } \ l a b e l { f i g : monalisa } \ end { f i g u r e }
Figure : The Monalisa 19 / 50
Inserting Images In general, a figure is included using: Hafida Benhidour Introduction to LATEX Introduction to Beamer
\ begin { f i g u r e }[ options ] \ centering \ i n c l u d e g r a p h i c s [ o p t i o n s ] { f i l e name} \ caption { Figure t i t l e } \label{label} \ end { f i g u r e }
In \begin{figure}[options], you can specify the position option: 1 2 3 4
t: top of page. h: here. !: let the compiler decide. Any combination can be used.
The compiler tries its best to fulfill your wish, but not necessarily. In \includegraphics[options], you can specify the height, the width, the angle of rotation of the image. 20 / 50
Typesetting Mathematical Equations
Hafida Benhidour Introduction to LATEX Introduction to Beamer
Latex is extremely good at typesetting math equations. Equations are written as text. Inline equations (equations within the text) are written between $ and $. Example Tex document: Assume t h a t $ \ a l p h a x +
\ b e t a y =1$ , t h e n
Pdf document: Assume that αx + βy = 1, then
21 / 50
Typesetting Mathematical Equations
Hafida Benhidour
Equations on a separate line are enclosed between \[ and \].
Introduction to LATEX
Example
Introduction to Beamer
Tex document: Assume t h a t : \[ \ a l p h a x + \ b e t a y =1, \] then . . .
Pdf document: Assume that: αx + βy = 1, then ... 22 / 50
Typesetting Mathematical Equations
Hafida Benhidour Introduction to LATEX Introduction to Beamer
Numbered equations are written within the equation environment. Example Tex document: Assume t h a t : \ begin { equation } \ l a b e l { eq : my−e q u a t i o n } %