How to Make a Presentation with LATEX? Introduction to Beamer
Total Page:16
File Type:pdf, Size:1020Kb
1 / 45 How to make a presentation with LATEX? Introduction to Beamer Hafida Benhidour Department of computer science King Saud University December 19, 2016 2 / 45 Contents Introduction to LATEX Introduction to Beamer 3 / 45 Introduction to LATEX I LATEXis a computer program for typesetting text and mathematical formulas. I Uses commands to create mathematical symbols. I Not a WYSIWYG program. It is a WYWIWYG (what you want is what you get) program! I The document is written as a source file using a markup language. I The final document is obtained by converting the source file (.tex file) into a pdf file. 4 / 45 Advantages of Using LATEX I Professional typesetting: best output. I It is the standard for scientific documents. I Processing mathematical (& other) symbols. I Knowledgeable and helpful user group. I Its FREE! I Platform independent. 5 / 45 Installing LATEX I Linux: 1. Install TeXLive from your package manager. 2. Install a LATEXeditor of your choice: TeXstudio, TexMaker, etc. I Windows: 1. Install MikTeX from http://miktex.org (this is the LATEXcompiler). 2. Install a LATEXeditor of your choice: TeXstudio, TeXnicCenter, etc. I Mac OS: 1. Install MacTeX (this is the LATEXcompiler for Mac). 2. Install a LATEXeditor of your choice. 6 / 45 TeXstudio 7 / 45 Structure of a LATEXDocument All latex documents have the following structure: n documentclass[...] f ... g n usepackage f ... g n b e g i n f document g ... n end f document g I Commands always begin with a backslash n: ndocumentclass, nusepackage. I Commands are case sensitive and consist of letters only. I Some commands have parameters. I Square brackets [ ] after the command name are for optional parameters. I Curly braces f g after the command name are for required parameters 8 / 45 The command: ndocumentclass a r t i c l e r e p o r t n documentclass[options] f beamer g book l e t t e r I First line of all LATEXdocuments. I Specifies the type of the document: I article (research paper), report (multi-chapter document), book (for books), beamer (for presentations). I [options] can be used to set font size (10, 11, or 12 pt), set paper size, use one or two columns, etc. n documentclass[12pt ,a4paper ,twocolumn] f a r t i c l e g I Most publishers (Springer, Elsevier, IEEE, ACM etc.) have their own document classes. These are predefined classes. 9 / 45 Packages n usepackage f package g I Packages add new features and commands to LaTeX. I Common packages: I amsmath, amssymb: for math symbols. I graphicx: for including graphics and images. n documentclass f r e p o r t g n usepackage f c o l o r g n usepackage f g r a p h i c x g n b e g i n f document g ... n end f document g 10 / 45 Input the Text The body of the text is written after the nbeginfdocumentg command: n b e g i n f document g Enter the document content here n end f document g Remark nbeginf...g commands always need to be followed (eventually) by nendf...g commands. 11 / 45 A Simple LATEXDocument The following is a very basic LATEXdocument: This is some sample text. n documentclass f a r t i c l e g n usepackage f g r a p h i c x g n b e g i n f document g This i s some sample text. n end f document g This gives the following output: 1 12 / 45 Sections of a Paper First thing: you have to indicate the title and the author(s) of the paper: n t i t l e f t i t l e g n a u th o r f a u t h o r s g n date f date g n m a k e t i t l e Remark Without nmaketitle, the title and authors do not appear in the output. Example n t i t l e fThe Theory of Relativity g n a u th o r f Albert Einstein g n date f01/01/1926g n m a k e t i t l e 13 / 45 Sections of a Paper n thanks f ... g n b e g i n f a b s t r a c t g .... n end f a b s t r a c t g n b e g i n f keywords g ... n end f keywords g nthanks creates a footnote with whatever is in the braces. Usually used after authors' names for academic information Example n thanks f I want to thank the University of Princeton for supporting this work. g n b e g i n f a b s t r a c t g In this paper, I introduce a new theory to explain how time and space are related. n end f a b s t r a c t g n b e g i n f keywords g Relativity; space; time n end f keywords g 14 / 45 Sections The document should be divided into sections, subsections, etc. Important commands: n s e c t i o n f Title of first section g ... n s u b s e c t i o n f Title of the sub−s e c t i o n g ... n s e c t i o n f Title of second section g ... n s u b s e c t i o n f ... g ... n subsubsection f ... g ... LATEXformates the section titles and numbers them according to the document class being used. 15 / 45 A Simple LATEXDocument The following is a sample of a LATEXdocument (.tex file): n documentclass f a r t i c l e g n usepackage f graphics ,amsmath,amssymbg n b e g i n f document g n t i t l e fThe Theory of Relativity g n a u th o r f Albert Einstien g n date f01/01/1926g n m a k e t i t l e n b e g i n f a b s t r a c t g In this paper, I introduce a new theory to explain ... n end f a b s t r a c t g n s e c t i o n f Introduction g What is time and space?... n s e c t i o n fThe Theory g Time and space are linked... n s u b s e c t i o n f Proof g This the proof to my theory n end f document g 16 / 45 A Simple LATEXDocument Converting the (.tex) file to obtain the pdf file: 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 17 / 45 Cross-referencing Cross references can be made using the commands nlabel and nref. Example n s e c t i o n f Introduction g n l a b e l f s e c : i n t r o g This is the introduction ... n s e c t i o n f C o n c l u s i o n g As mentioned in Section n r e f f s e c : i n t r o g , we have . I LATEXupdates the references automatically. I It is possible to use any identifier as a label. I 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. 18 / 45 Inserting Tables To include tables, you must use the following commands. n b e g i n f t a b l e g n c a p t i o n fAn Example of a Table g n l a b e l f t a b l e example g n c e n t e r i n g Table: An Example of a n b e g i n f t a b u l a r g f j c j c j g Table n h l i n e Student & Grade nn Student Grade n h l i n e 12&13 nn 12 13 n h l i n e n end f t a b u l a r g The results of the n end f t a b l e g experiments are shown in Table 1. Table n r e f f t a b l e example g shows a table. 19 / 45 Inserting Images To include images, you must use a graphics package. The most common is graphicx. Figure 1 shows the F i g u r e n r e f f fig :monalisa g painting. shows the painting. n b e g i n f f i g u r e g n c e n t e r i n g% To center the image n includegraphics [width =2.5cm] f monalisa.jpg g % Path and file name n c a p t i o n fThe Monalisa g n l a b e l f fig :monalisa g n end f f i g u r e g Figure: The Monalisa 20 / 45 Inserting Images In general, a figure is included using: n b e g i n f f i g u r e g [ o p t i o n s ] n c e n t e r i n g n includegraphics[options] f f i l e nameg n c a p t i o n f Figure title g n l a b e l f l a b e l g n end f f i g u r e g I In nbeginffigureg[options], you can specify the position option: 1.