TUTORIAL 3: MY FIRST LATEX DOCUMENT
CHRISTOPHER RARIDAN
Abstract. Upon completion of this tutorial, the author should
be able to produce a very basic LATEX document. This tutorial
will introduce the amsart documentclass and the author will learn
how to enter text (sentences and paragraphs), how to save a LaTeX
document, how to compile a LaTeX document, and how to do some
basic error checking.
1. Welcome
(1) Hello. My name is Dr. Christopher Raridan (Dr. R).
(2) I want to welcome you to the LATEX Tutorial Series.
(3) In this tutorial I will introduce you to the amsart documentclass.
(4) By the end of this tutorial, you should know how to enter text
(sentences and paragraphs), how to save a LaTeX document,
how to compile a LaTeX document, and how to do some basic
error checking.
(5) Please note that this is the third in a series of tutorials which
will introduce you to LATEX.
Part of Math 3006, Communication in Mathematics, Clayton State University.
1
2
C. RARIDAN
(6) We start this tutorial with the assumption that you have successfully completed Tutorials 1 and 2, and subsequent tutorials
will build from this one.
(7) Hopefully, Windows and Mac users will have a similar experience.
2. Getting Started
(1) Let’s create a folder called “LaTeX Tutorials” in which to save
our work.
(2) It doesn’t really matter where you create this folder.
(3) For convenience, I’m going to create it in my Documents
folder.
(4) Inside this folder, create a new folder entitled “My First LaTeX
Document.”
(5) Open TeXworks.
(6) You should have a blank .tex file.
(7) We will refer to this file as the LATEX document, code, or source.
3. LATEX Comments
(1) This first thing that I want to discuss with you is commenting.
(2) Comments are usually notes that you write to yourself.
(3) They are written in the LATEX code but do not display in the
PDF output of the file.
TUTORIAL 3: MY FIRST LATEX DOCUMENT
3
(4) They can also be very helpful for someone, say a collaborator,
who is looking at your LATEX code.
(5) We might say something like “We’re commenting out some
text.”
(6) Type “%” (the percent symbol) at the beginning of any comments.
(7) Type “% Typesetting by,” followed by your name, then hit
[Enter].
(8) Type “% E-mail:,” followed by your CSU e-mail address, then
hit [Enter].
(9) If you like, enter an alternate e-mail address, commented out,
of course, and hit [Enter].
(10) I like a lot of whitespace in my LATEX code, so I am going to hit
[Enter] a few more times.
(11) I think that a little extra whitespace in the LATEX code makes
it easier to read.
(12) Note that LATEX ignores whitespace, so this will not affect your
output.
4. The Preamble
(1) The first part of every LATEX document is the preamble.
(2) The preamble is where you set any features of your LATEX document, such as the documentclass and/or any packages that you
would like to use.
4
C. RARIDAN
(3) The preamble tells LATEX “what to do and how to do it.”
(4) For now, we’ll keep the preamble simple and add more later as
we need it.
(5) Type “% BEGIN PREAMBLE” and hit [Enter] twice.
(6) Type “\documentclass{amsart}” and hit [Enter] twice.
(7) Type “% END PREAMBLE” and hit [Enter] several times.
(8) Again, the amount of whitespace is up to you.
5. The Content
(1) The second part of every LATEX document is the actual content,
your work.
(2) This part has two subparts.
(3) The first is sometimes referred to as “top matter” and includes
the title of your article, your name, your e-mail address, your
physical address, and other such items.
(4) We will discuss top matter in Tutorial 6.
(5) For now, let’s focus on the second part, which is where you
put the various sections of your article: the actual text, math
symbols, equations, etc.
(6) Type “% BEGIN DOCUMENT” and hit [Enter] twice.
(7) We’re now going to create our first LATEX environment.
TUTORIAL 3: MY FIRST LATEX DOCUMENT
5
(8) LATEX environments use “\begin{arg}” and “\end{arg},”
where arg is replace by some argument, i.e., a structure.
(9) Type “\begin{document}” and hit [Enter] a few times–four
times should be enough.
(10) Type “\end{document}.”
(11) It is a very good idea to type “\begin{},” hit [Enter] a few
times, then type “\end{}” for any LATEX environments first,
and then type the content that goes into that environment.
(12) This will help to ensure that you have matched each \begin{}
with an \end{}.
(13) Between \begin{document} and \end{document}, type the phrase
“Hello World!”.
(14) Click [File] > Save As....
(15) Navigate to your “My First LaTeX Document” folder.
(16) Inside that folder, name your file My-First-LaTeX-Document.tex.
(17) Note the dashes and the LATEX extension .tex.
(18) It is generally considered good form to name files (.tex or otherwise) as a single string using dashes, underscores, or CamelCaps.
(19) Click [Save] to save your file.
(20) To view the output, we need to Build/Compile/Typeset the
LATEX document.
6
C. RARIDAN
(21) Click the [Green Arrow]
in the upper left-hand part of the
TeXworks menu to typeset your document.
(22) Alternatively, you can type [Ctrl]+[T].
(23) I will probably use the phrase “[Ctrl]+[T] to typeset” when I
want to compile a LATEX document in the future.
(24) When working with LATEX, most people typeset their documents
often in an effort to minimize errors.
(25) If you didn’t get that the first time: PLEASE TYPESET YOUR
LATEX DOCUMENT OFTEN! This will help you to fix errors,
should they arise, more easily.
(26) If there are no errors, you should now see the PDF output of
your LATEX code in a window next to your code.
(27) If there are errors, please double-check that you have typed
everything exactly as described.
(28) It may be helpful to refer to Section 6 for more information.
(29) If you cannot find your errors at this early stage, it may be
easier for you to come see me, Dr. Raridan, or Dr. Williams,
or Dr. Bailey.
(30) Assuming there are no errors, we continue.
(31) Let’s resize the TeXworks editor window (the LATEX code) and
PDF output so that your two files are displayed nicely (i.e, large
enough).
TUTORIAL 3: MY FIRST LATEX DOCUMENT
7
(32) This may not be necessary on a desktop computer with a large
monitor, but is very helpful on laptop computers.
(33) Drag the left-hand side of your PDF output window so that you
can see the entire page of output easily.
(34) Do the same for your LATEX code, changing the right-hand side
and the size of the Tags menu.
(35) Now, let’s return to typing in our LATEX document.
(36) Place your cursor after the exclamation point in “Hello World!”.
(37) To start a new paragraph in LATEX, hit [Enter] twice.
(38) That is, you leave one blank line between two paragraphs.
(39) There is no need to [Tab]; LATEX will do this automatically.
(40) Also note that in Tutorials 1 and 2, we configured TeXworks so
that it would automatically wrap lines.
(41) In other words, you do not have to hit [Enter] at the end of a
line of text–just keep typing and the TeXworks editor will go to
a new line when the text reaches the edge of the editor window.
(42) Type a few more sentences: “The first part of every LaTeX
document is called the preamble, which contains
information about the documentclass and packages.
The second part of every LaTeX document is the actual
content, which contains text and any relevant
mathematical expressions.”
(43) [Ctrl]+[T] to typeset.
8
C. RARIDAN
(44) The file is automatically saved when you typeset the document.
(45) You may want to adjust the size of your TeXworks editor window and the PDF output if they are not to your liking.
(46) Generally speaking, the LATEX code seems easiest to read when
the editor window is about 5-6 inches wide.
6. Errors!?!
(1) If you have no errors, then you will see your PDF output after
typesetting a LATEX document.
(2) If you do have errors, then LATEX will very often “tell you what
you did wrong.”
(3) Let’s see what happens if we force an error.
(4) Change “\end{document}” to “\end{documet}”. That is, misspell the word “document.”
(5) [Ctrl]+[T] to typeset.
(6) Notice that LATEX knows that you did something wrong and
offers a possible fix:
! LaTeX Error: \begin{document} ended by \end{documnt}
(7) Notice
also
that
[Red Stopsign]
the
[Green Arrow]
is
now
a
.
(8) Because LATEX is a programming language, it will only do what
you tell it to do.
TUTORIAL 3: MY FIRST LATEX DOCUMENT
9
(9) If you have errors in your code, then LATEX cannot do anything
until those errors are corrected!
(10) This may not always be so easy to do.
(11) Correct the errors in your code.
(12) Click the [Red Stopsign]
[Green Arrow]
so that it becomes a
again.
(13) Click the [Green Arrow]
.
(14) Alternatively, after you have fixed an error you can type
[Ctrl]+[T] twice.
(15) A word of advice: Typeset your documents regularly to minimize the possibility and/or frequency of errors.
(16) Note that typesetting your document automatically saves the
current version, hence another reason to typeset often.
7. Other Files
(1) When TeXworks typesets any LATEX document, it creates several auxiliary documents that it needs to provide functionality.
(2) Navigate to the “My First LaTeX Document” folder.
(3) Inside this folder, you will probably find several files with the
same name but different extensions.
(4) You may have an Auxiliary File (.aux), a GZ File (.synctex),
a Text Document (.txt), a LATEX Document (.tex), and a PDF
(.pdf), as well as others.
10
C. RARIDAN
(5) The .tex file is the LATEX code used by your TeXworks editor
and the .pdf is your PDF output file.
(6) The .tex and .pdf files are the only files that you really need
to worry about, but don’t delete the others.
(7) Again, the other files are created by LATEX and are needed by
TeXworks to create the output document.
(8) If you do delete these files, then they will be regenerated the
next time you compile the LATEX code.
8. The GZ File and SyncTeX
(1) After typesetting your document, right-click on some part of
the code, and choose Jump to PDF.
(2) Notice that this highlights the corresponding text in your output PDF.
(3) Now, right-click on some text in the PDF, and choose Jump
to Source.
(4) Notice that this highlights the corresponding code in your LATEX document.
(5) This ability to “jump back-and forth” is especially helpful when
editing lengthy documents.
Department of Mathematics, Clayton State University, Morrow,
Georgia 30260
E-mail address: [email protected]
© Copyright 2026 Paperzz