latex_intro_supplement

Download as pdf or txt
Download as pdf or txt
You are on page 1of 37

LATEXTutorial

Kudirat Jimoh
Computing and Intelligent Systems Research Group
Department of Information and Communication Technology

. sun State University, Òsogbo

December 11, 2024


Presentation Outline

1. Introduction
2. Installation
3. Structure of a document
4. Equations
5. Tables
6. Lists
7. Figures
8. Bibliography
9. Tables of references
10. References
Introduction

1. LATEX is a typesetting system that allows you to create


scientific documents of high quality.

2. The LaTeX system is a markup language that handles


typesetting and rendering. It is originally created by
Donald Knuth who promotes it pronounciation as
lah-teck and lay-teck .

3. It is a software system for document preparation which


uses plain text as opposed to the formatted text found in
What You See Is What You Get word processors like
Microsoft Word, LibreOffice Writer and Apple Pages.
Introduction

What do I need to use LATEX?


4. In order to use LATEX we need two different components
to be installed in our computer: a LATEX editor and
MiKTeX.

There are several LATEX editors that can be used.


Examples are:
MikTeX is a Windows application to manage all the
packages you need to use with LATEX.1 It is free and you
have to download it from http://www.miktex.org.
Introduction (continued)

1. You will need at least a LATEX compiler.

2. To make life easier you can use a LATEX editor

3. For more advanced uses of LATEX you might need to


install some other packages
Installing a TEX system

TeX Live can be installed on Windows, Mac OS X and


UNIX/Linux. http://tug.org/texlive.
▶ Windows: An alternative to TeXLive is to install proTeXt
from http://www.tug.org/protext. This is a MikTeX
based installation that includes the TeXStudio editor.
▶ Mac OS X: Download and install MacTeX from
http://www.tug.org/mactex.
▶ Linux: Check documentation for your distribution. A
TEX system might already be installed. In Ubuntu use the
command: sudo apt-get install texlive-full texstudio
Running LATEX
▶ Create your latex file with your favourite text editor and
save the file with a .tex file extension.
▶ Here are the commands used for compiling the LaTeX
source and viewing the final document.
▶ If you are using a GUI editors like TexWorks, TeXStudio,
TeXniCenter, TeXShop, or Kile you will click on different
buttons that will run these commands to compile the
LaTeX source and view the final document.
COMMANDS COMMENTS
latex file.tex run latex to create a dvi file
pdflatex file.tex run pdflatex to create a pdf file
xdvi file.dvi view a dvi file
yap file.dvi view a dvi file (dvi viewer for MikTeX only)
Running LATEX

COMMANDS COMMENTS
dvips -o file.ps file.dvi convert a dvi file to a postcript file
dvips file.dvi convert file.dvi to postscript and print
dvipdf file.dvi convert file.dvi to a pdf file
gv file.ps run ghostview to view a postscript file
ps2pdf file.ps file.pdf convert a postscript file to a pdf file
acroread file.pdf run Acrobat Reader to view a pdf file.
xpdf file.pdf run xpdf to view a pdf file.
Structure of a Document
▶ In the preamble, there are many options, depending upon
the style as shown in the Figure 1;

▶ The intrinsic document styles are: article, book, letter,


report, and slides.

Figure: 1 The Structure of a LATEX Document


Structure of a Document
▶ Let us try the following code shown in Figure 2 and save
it with a name;

▶ The intrinsic document styles are: article, book, letter,


report, and slides.

Figure: 2: My First LATEX Source File


Classes

Several different default classes, extendable by modules or


packages:

1. Article
2. Report
3. Letter
4. Book
▶ Let’s try them out on example2.tex

▶ Warning : the class Letter does not support sections,


abstract and tables and Book does not support abstract
Section
Let us try the code shown in Figure 3 to implement our
section and chapter.

Figure: 3: Section Source code

▶ Notice that there is a very useful menu in Texmaker for


the sections:
Section Continues
Let us try the following codes shown in Figure 4:

Figure: 4: An Introductory Document Source (Result in Figure 5)


Section Continues
Let us check if we are able to get the result shown in Figure 5
following codes:

Figure: 5: An Introductory Document Result (Source in Figure 4)


Fonts and Paragraphs
Figure 6 shows the source to produce different paragraph
positions: centered, flush left, flush right, and justified (the
default).

Figure: 6: Positioning Paragraphs Source (Result in Figure 7)


Fonts and Paragraphs
I hope we are able to get the result shown in Figure 7.

Figure: 7: Positioning Paragraphs Result (Source in Figure 6)


Fonts and Paragraphs
Instead of the center environment, you can use the command;
they differ in that the environment skips a line before and after
the paragraph, shown in Figures 8.

Figure: 8: Centering Source


Basic Commands

Table1 lists the fonts that are intrinsic in a basic latex


installation. (More fonts are available in packages, usually free
of charge.)

In technical writing, you will have particular use for the italic
font, as it is used when introducing a new term. For example,
Basic Commands
Some of the basic commands for formatting are shown in
Figure 9.

Figure: 9: Intrinsic Font Styles

For easy access, you can use quick command: LATEX −−


Font Styles
List
To create lists use itemize or enumerate (in Texmaker in the

menu ‘LaTeX List Environment’) as shown 10

Figure: 10: Itemize List Environment Source (Result in Figure 11)


List Continues

Figure: 11: Enumerate List Environment Source (Result in Figure


12)
List Continues

Figure: 11: Enumerate List Environment result (Source in Figure


10)
Making Tables
A table is made with the tabular environment, which has the
following syntax as shown in Figure 13

Figure: Table Structure Syntax


Making Tables


The easiest way is to use the menu ‘Wizard Quick Tabular’
Making Tables Continues

Table: 1: Table Example


Town Temperature Pluviometry
Ilé Ifè. 22 0mm
E.de. 23 10cm
Òsogbo 20 5mm
Figure and Graphics

Use the menu ‘LaTeX’ includegraphicsfile’ to import your
graphics. Important: you can only import .png, or .jpg or .pdf
files when you use the compiler PDFLaTeX as shown in Figure
14 .

Figure: Syntax for Inserting Graphics


Figure and Graphics

1. Please don’t try to change the position of your Figure.


LATEX puts the Figure at the best place in your
document given its size.

2. To refer to a Figure use references as explained in the


next slide.
Mathematical Equation
Firstly let us look at some special characters as shown in
Figure 15

Figure: 12:Writing Special Characters


Mathematical Equation

Another class of special characters are letters with accents.


Figure 16 shows some common examples;

Figure: 16:Some Special Accents


Math Mode
One can write mathematical expressions by entering math
mode, signified by delimiters ...

Examples of some of the operations are shown in Figure 17.

Figure: 17:Some Mathematical Operation


Math Mode
Examples of some of the operations are shown in Figure 18.

Figure: 18:Variable Size Mathematical Operation Symbols


Math Mode

Let us try to implement the following equations:

xa+b

x a+b

c+d
xa+b
x+y
4
References

Using the tag:

You can make reference to:


1. Figure
2. Table
3. Equation
4. Section etc
Bibliography
1. To write a bibliography in LATEX, Create a new file
named bib file

2. In this .bib file put the articles, books, etc. you want to
make reference to using the Bibliography menu in
Texmaker.

3. Don’t forget to fill in the first field just after @article or


@InProceedings etc. It contains the key you will use to
cite this item in your paper.

4. To cite the paper with the key ‘Einstein’ use in your .tex
file.

5. At the end of your .tex file (before end of the document)


write:
Bibliography
Table of Content

1. Table of content: just write tableofcontent at the


beginning of your document.

2. Table of figures:

3. List of tables:
References
▶ LATEX A Document Preparation System, 2nd Edition,
Leslie Lamport.
▶ The LATEX Companion, Michael Goossens, Frank
Mittlebach, and Alexander Samarin.
▶ The TEX user group website www.tug.org and in
particular http://www.tug.org/begin.html.
▶ LATEX A Document Preparation System website
http://www.latex-project.org/.
▶ Learn LATEX, by Edward R. Scheinerman http:
//www.ams.jhu.edu/ers/teaching/learn-latex/.
▶ The (Not So) Short Introduction to LaTeX2e
http://ctan.tug.org/tex-archive/info/lshort/
english/lshort.pdf.
▶ UVic’s thesis template and instructions can be found at
http:
//www.uvic.ca/library/featured/collections/

You might also like