0% found this document useful (0 votes)
2 views

Introduction to LaTeX2

This document is an introduction to LATEX, covering the basics of creating documents using the typesetting program. It outlines objectives, essential components like the preamble and body, and various LATEX structures such as commands, text formatting, packages, comments, and math environments. Additionally, it includes exercises for practical application of the learned concepts.

Uploaded by

lokesh31052k3
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Introduction to LaTeX2

This document is an introduction to LATEX, covering the basics of creating documents using the typesetting program. It outlines objectives, essential components like the preamble and body, and various LATEX structures such as commands, text formatting, packages, comments, and math environments. Additionally, it includes exercises for practical application of the learned concepts.

Uploaded by

lokesh31052k3
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Introduction to LATEX

Prof. Frenkel, [email protected]


June 26, 2024

Contents
1 Hello World! 2

2 Objectives 2

3 The Basics 2
3.1 Preamble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3.2 Body . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

4 LATEX structures and environments 3


4.1 Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4.2 Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4.3 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4.4 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4.5 Math . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

5 Exercises 4

1
1 Hello World!
Welcome to the introduction to LATEX. This is the first workshop in a series in-
tended to introduce you to the LATEX typesetting program. In this introduction
we will introduce the basics, how to get started with LATEX as well as provide
a few opportunities for you to try things out on your own. As we go through
the content of this workshop you will want to follow along both in the typeset
document as well as in the .tex document to better understand how to create
your own documents in the future.
This workshops is the first in a series designed to get your comfortable cre-
ating your own LATEX documents. This workshop will concentrate on how to
get started and basic commands. The second

2 Objectives
• Understand the required components to a LATEX document
• Introduce the purpose of packages and discuss useful packages for begin-
ners

• Learn how to use basic commands and how to write mathematical equa-
tions
• Provide an opportunity to practice the skills you are developing

3 The Basics
We will start off by introducing important concepts for creating your own LATEX
documents.

3.1 Preamble
The preamble is the first part of a LATEX document. It will be used to call
packages for the document and to define parameters of both the document and
its packages where needed. The preamble will always begin with the command
\documentclass{} and end with the command \begin{document}.

3.2 Body
The body of a LATEX document can is where the content will go. The docu-
ment body will begin with the command \begin{document} and end with the
command end{document}.

2
4 LATEX structures and environments
There are several important structures and environments that are critical to
building a LATEX environment. In this section we will take about commands,
text, packages, comments, and math.

4.1 Commands
Commands are structures within LATEX that are read by the compiler and in-
struct it to take a certain action. Commands can range in purpose from in-
serting a symbol such as \pi π to creating complicated structures like tables
or matrices. Command always start with a \. Commands can have a few
different formats but generally a command will have the following structure
\command[option argument]{required}.
Commands are case sensitive and generally speaking will end at a point of
punctuation or number. For example take a look at what happens if I type \pi9
π9.
There are also many commands in LATEX that use the form \begin{argument}
it is very important to remember that all of these commands must have a
corresponding \end{argument} or there will be an error when you compile.
Some common commands like this are \begin{document}, \begin{equation},
\begin{matrix}, and \begin{tabular}.

4.2 Text
Text is easy to input in LATEX. Once inside of the body of your document text
can be entered and will be compiled. Commands can be used to format and
adjust text. A new paragraph can be entered by living a blank space in the
source document.
Some common text commands are \textbf{} for boldface, \textit{} for
italics, \Large for large, \tiny for tiny, and \emph{} for emphasis.

4.3 Packages
Package belong in the preamble. They are used to import additional features
into a LATEX document. To call a package use the command \usepackage{}.

4.4 Comments
Comments can be include in a document by using the % symbol. The complier
will ignore anything that follows the %.

4.5 Math
Math is a very important environment with LATEX. It is what allows equations
to be easily written and to be visual appealing. But, LATEXmust be told that

3
it is in a math environment to display properly and to use certain commands.
Take for example the following equation:

2sin(x)=y
2 sin(x) = y

An immediate difference can be seen in the way that the mathematics is dis-
played.
This simplest way to display math is to use $ to surround the mathematical
text. A $ will active the math environment until another $ appears. This is
useful for writing in line math. For example I can place the equation 2 sin(x) =
y. You should also note that certain commands can only be used in math mode
for example if I want to insert the π symbol I need to be in a math environment.
Another useful mathematical environment is display mode. This can be
started by using the command \[ and ended using the command \]. The
display mode is helpful for taking math outside of a line of text for example:

2 sin(x) = y

can be written using display mode, and I don’t need to do anything extra to
create the spacing or centering.
Another method for displaying mathematics is to use a command that cre-
ates a mathematical environment such as \begin{equation}. Notice what
happens if I use \begin{equation}:

2 sin(x) = y (1)

See how there is now an equation number. More complex environments for
mathematics writing are discussed in the intermediate level workshop.

5 Exercises
Question 1:
After the comment in the .tex file is a mathematical equation that will only run
if the amsmath package is included in the preamble. Edit the .tex file so that
this equation will display:

Question 2:
Can you write the quadratic equation?

Question 3:
Test your skills at formatting a sentence. Below this sentence write something
that has boldface, italics, and the symbol for 3.14 in it.

Question 4:
Use the command \begin{itemize} to create an ingredient list for your favorite
recipe.

4
Question 5:
Make yourself the Author of this document, and change the date to your birth-
day or any other day you would like.

You might also like