Your Guide to documentclass LaTeX: Types and options | (2023)

What is documentclass LaTeX?

Every LaTeX document starts with a \begin{document} command and ends with an \end{document} command. LaTeX ignores anything that follows the \end{document}. The part of the source code file that precedes the \begin{document} declaration is called the preamble.

The first command of the preamble has to be \docummentclass (although technically it can be preceded with prepended files). This command takes a single mandatory argument that is one of the predefined classes of document that LaTeX has built-in. In this tutorial, we are going to explain and see the differences and similarities of these document classes, and what should each one be used for. We will also talk about the multiple optional arguments that the \documentclass command takes, and that can be used to customize the appearance of our document.

There are also third-party document classes that are written and distributed as external packages. Some of these classes, like beamer Your Guide to documentclass LaTeX: Types and options | (1)to make presentations and memoirYour Guide to documentclass LaTeX: Types and options | (2) to extend the functionalities of the book class, are very popular and useful, but we won’t cover them here, since they are much more sophisticated and complex than the predefined classes.

LaTeX document classes and their use

The document classes available in plain LaTeX are reported in the following table:

latex document classesUsage
articleTo produce articles for scientific journals, short reports, program documentation, and, in general, any kind of short document that doesn’t need a complex division into chapters and parts.
reportA kind of long article that can contain several chapters. It is usually used for small books and thesis.
bookUsed to typeset real books, includes all the kinds of typesetting standards that one may expect from a printed book: chapters and parts, two kinds of pages, a front matter, etc
slidesIt was used to produce slides, although the external package beamer Your Guide to documentclass LaTeX: Types and options | (3)is much more powerful for this purpose.
letterFor writing letters.
  • The first two document classes are the basic ones; if you don’t know what document class you should use, always start with article.
  • The report class is very similar, the main difference with the article being that you can insert chapters with \chapter, while in the article class the highest element in the hierarchy of titles is the \section command.

LaTeX book class

In typographical standards, books differ from reports mainly in their front and back matter. The front matter of a book usually includes:

  • a half-title page,
  • a main title page,
  • a copyright page,
  • a preface or foreword, and a table of contents.

It may also contain:

  • acknowledgments,
  • a dedication,
  • a list of figures,
  • a list of tables,
  • a list of other books in the same series, and other editorial or promotional content.

The back matter usually includes an index and may contain an afterword, also acknowledgments, a bibliography, a colophon, and so on.

The book document class provides some commands to produce the logical structures previously discussed, that the report class isn’t able to deal with by default. However, it does not try to yield tools to all of them. Individual publishers usually have their own packages with additional commands to typeset the structures according to their manual of style.

Front matter, main matter and back matter commands

The front matter, main matter (which contains the main body of the book, starting at the first chapter or part and ending at the appendices), and back matter are begun with the three commands \frontmatter, \mainmatter, and
\backmatter, respectively.

(Video) LaTex Tutorial for Beginners Full Course

In the standard book class, front matter pages are numbered with roman numerals; main and back matter pages are numbered with arabic numerals.

In the front and back matter, the \chapter command does not produce a chapter number, but it does make a table of contents entry; this can be used, for example, to produce a preface or acknowledgments section. Inside these kind of chapters, only the starred versions of other sectioning commands (mainly \section* and \subsection*) should be used.

Illustrative example of Book class

For example, this could be a standard book structure:

% Book document class\documentclass{book}\title{My first book}\author{Me}\date{\today}\begin{document}\maketitle\frontmatter\chapter{Dedication}\chapter{Copyright}\chapter{Acknowledgements}\tableofcontents\listoffigures\listoftables\mainmatter\part{The first part}\chapter{Chapter one}\chapter{Chapter two}\part{Last part}\chapter{Chapter three}\appendix\chapter{First and only appendix}\backmatter\chapter{Bibliography}\chapter{Other titles in this collection}\end{document}

You can see the table of contents produced by the previous book in Figure 1. Observe how the numbering of the pages and the sectioning commands change according to the part of the book we are in.

Your Guide to documentclass LaTeX: Types and options | (4)

Odd and even pages in Book class

When printing books, odd and even pages are not structured in the same way. Margins, and usually also headers and footers, change to provide better readability when the book is bound. This is taken into account in the book document class, where you will see that:

  • left pages have a larger left margin, the page number at the top left of the page, and the title of the current chapter at the right, while
  • right pages have a larger right margin and only the page number at the top right of the page. Also, new chapters start always at the right page and the page head is emptied, leaving only the page numb er at the center on the foot of the page.

No built-in abstract

There is one more difference between the book class and the article and report classes: it doesn’t have a built-in abstract environment.

This environment is used in academic articles, and also reports, to give a brief description of the contents that will be treated along with the document. It is customary for this introduction to have special typesetting, with “Abstract” written in bold over it, and also it is common to find it printed just after the title and before the table of contents. As said, this environment is not implemented in the book document class.

Memoir class

It is worth mentioning here that there is a popular extension of the book document class, called memoir, written by Peter Wilson.

(Video) (UPDATED) LaTeX Tutorial 1 - Creating a LaTeX Document

This package aims to integrate multiple design-related packages with the LaTeX book class. It provides:

  • a larger range of permissible font sizes,
  • a large number of page styles, and well
  • over a dozen chapter styles to choose from, as well as
  • methods for specifying your own layouts and designs.
  • It also integrates the functionality of over thirty popular packages.

So it is an extensive and complex document class, whose capabilities are incomparable to those of the book class. In case all of this made you curious, you can look at their official documentationYour Guide to documentclass LaTeX: Types and options | (5) to learn much more.

LaTeX letter class

As with the slide document class, the letter is slightly old-fashioned. This class is used to make traditional letters, the ones that are put in an envelope and mailed, a somewhat obsolete way of communication (since the email was invented and generalized) but still used in certain official matters. Although the class was designed for traditional letters, still today there are certain documents that have the structure of a letter such as:

  • a letter of recommendation, or
  • a letter of presentation

and for which this document class may be useful. So let’s briefly discuss the details that characterize this particular document class!

With it, you can make any number of letters with a single input file:

  • Your name and address, which are likely to be the same for all letters, are specified by special declarations.
  • The return address is declared by an \address command, with multiple output lines separated by \\ commands (which is the common line-breaking command in LaTeX).
  • The \signature command declares your name, as it appears at the end of the letter, with the usual \\ separating multiple lines.

These declarations are usually put in the preamble because they are common to all letters, but they are normal declarations with the customary scoping rules and can appear anywhere in the document. In particular, this means that you can change the return address and signature at any point.

Each letter is produced by a separate letter environment, having the name and address of the recipient as its mandatory argument.

  • The letter itself begins with an \opening command that is used to generate the salutation.
  • The main body of the lecture is ordinary LaTeX input.
  • The letter closes with a \closing command that is passed the closing sentence and automatically generates the signature.

These may seem a lot of commands, but they are all very easy to use, and also very powerful since LaTeX automatically will take care of the formatting of the letter, without you having to worry about it at all.

In case you are not convinced yet, let me show you a clarifying example where all the commands are put into practice so that you can use it as a template for your letters:

(Video) LaTeX Tutorial 1 - Creating a LaTeX Document

% Example of a letter document class\documentclass{letter}\address{1234 Fake Avenue\\ Wonderland, 12555}\signature{Dr.~Something\\ Head of Department}\begin{document}\begin{letter}{Dr.~Anything \\ University of Nowhere\\ 66 Sesame Street\\ Wonderland, 45888}\opening{Appreciated Anything,}I write you a letter, and this is the body of theletter.\closing{I look forward to your reply,}\end{letter}\end{document}

You can see the letter generated in Figure 2. Note how LaTeX automatically formates everything, and even inserts the current date without you asking for it. I find generating letters with LaTeX easier than doing it by hand!

Your Guide to documentclass LaTeX: Types and options | (6)

We said that the date on the letters is automatically inserted by LaTeX and that it uses today’s date. We can, however, change this behavior by redefining the \today command, which is where LaTeX saves the name of the day. For example:

\renewcommand{\today}{12th of October of 1492}

will make \today print the content “12th of October of 1492”. This declaration can either be used on the preamble, to affect all letters or inside a certain letter environment, to only affect that letter.

documentclass latex options

As was stated in the introduction, there are some optional arguments that can be passed to the \documentclass command. Here we are going to explain these options:

Font size:

The options 10pt, 11pt, and 12pt choose the normal type size of the document. The default value is 10pt. This option is not recognized by the slides class.

Paper size

The paper size can be selected between the following options:

  • letterpaper (8.5in × 11in)
  • legalpaper (8.5in × 14in)
  • executivepaper (7.25in × 10.5in)
  • A4 (210mm × 297mm)
  • A5 (148mm × 210mm)
  • B5 (176mm × 250mm)

By default, the paper size is letterpaper.

(Video) LaTeX Tutorial


The landscape option causes the output to be formatted for landscape printing on the selected paper size. Effectively, this option interchanges the width and the height dimensions of the paper size.


If TeX has trouble finding good places to break lines, it can produce lines that extend past the right margin (which produce the output warnings called “overfull hboxes”). The draft option causes such lines to be marked by black boxes in the output. The final option, which does not mark these lines, is the default.

Two sides printing

The oneside and twoside options format the output to be printed on one side or both sides of a page, respectively. The default is oneside, except for the book class, for which it is twoside. However, the twoside option is not available with the slides document class.

Opening page of chapters

If the openright option is used, then all chapters will begin on a right-hand page. Instead, with the openany option
you can make them start on any page. These options apply only to the report class (whose default is openany) and the book class (whose default is openright).

Two column pages

The option twocolumn specifies two-column pages. The default is onecolumn, for one-column pages. The twocolumn option cannot be used with the letter or slides classes.

Page for the title

The titlepage option causes the \maketitle command to make a separate title page and the abstract environment to put the abstract on a separate page. The default is titlepage for all classes except article, for which it is notitlepage. hese options, however, are not recognized by the letter class.

Open bibliography style

openbib causes the bibliography to be formatted in an open style. This option is not recognized by the letter and slides classes.

Numbered formulas

The option leqno puts formula numbers on the left side, instead of the right, which is the default.

Formulas alignment

The option fleqn left-aligns formulas, which by default are centered.

(Video) LaTeX Tutorial 4 - Class Files


What are the types of Documentclass in LaTeX? ›

Classes in LaTeX
  • article - for articles in scientific journals, presentations, short reports, program documentation, etc...
  • IEEEtran - for articles with the IEEE Transactions format.
  • report - for longer reports containing several chapters, small books, thesis, etc...
  • book - for real books.
  • slides - for slides.
Oct 22, 2022

How to write documentclass in LaTeX? ›

To write a document class, all you need (really) is to create a file, say, myclass. cls , and put it in the same place as your document; then it can be loaded with \documentclass{myclass} and any macros defined in it will be available to the document.

What does Documentclass do in LaTeX? ›

documentclass. The documentclass sets up what type of document you are working with, loads many default styles and sets the overall look and feel of your document. There are also class specific commands which have are only valid in certain document classes.

How to learn LaTeX step by step? ›

Learn LaTeX — A Beginner's Step-By-Step Guide
  1. Installing LaTeX.
  2. Installing the TeX Live through Net Installer Wizard for Windows.
  3. Installing LaTeX for Mac OS, Linux, and other OS.
  4. Installing Extra-Packages or Add-On features.
  5. Automatic Installation of Packages.
  6. Manual Installation of Packages.
  7. Extracting the Files.
Sep 16, 2021

How long does it take to learn LaTeX? ›

However, it takes about 200 hours of serious use to get the student to the point where LaTeX is as efficient as either handwriting or using a word processor. At some point after 200 hours LaTeX is more efficient for them.

How many different classes are available in LaTeX? ›

Base LaTeX offers four classes for general documents: book , report , article and letter , plus some more specialist classes such as slides and ltnews . For each class, LaTeX provides a class file; the user arranges to use it via a \documentclass command at the top of the document.

How do I start writing in LaTeX? ›

Writing text in a LaTeX document is easy. Once you are inside the body of the document, as described in the Document Structure section of this page, all you have to do is start typing. When you compile the code LaTeX will take care of all the text formatting based on any commands and packages used.

Where do I put CLS files in LaTeX? ›

cls files must be in some subdirectory of tex\latex which can be in any directory of any drive.

How to create a document in LaTeX? ›

How to Create a LaTeX Document in 6 Easy Steps
  1. Step 1: Specify the Document Class. Start by specifying the documentclass in the preamble as \documentclass{}
  2. Step 2: Specify the Packages to Use. ...
  3. Step 3: Specify Title, Author, and Date. ...
  4. Step 4: Add Your Document Body. ...
  5. Step 5: Save the Document. ...
  6. Step 6: Compile Your Document.
Jul 13, 2022

Which documentclass should we use to write research papers? ›

( minimal , letter and slides are different enough to need their own answers.) The article class is, as the name suggests, intended for writing articles.

How to compile a LaTeX input file? ›

The following commands can then be used:
  1. latex [filename]. tex will compile [filename]. tex and output the file [filename]. dvi.
  2. pdflatex [filename]. tex will compile [filename]. tex and output the file [filename]. pdf.
Nov 23, 2021

Is LaTeX easier than word? ›

Ultimately, it depends on your needs. If you want to write a complex document like a book, the advantages of LaTeX outweigh those of Word. If you want to quickly write a few pages, Word is superior. For longer and more complex books, LaTeX takes less effort.

How hard is it to work with LaTeX? ›

It is difficult.

LaTeX has a much steeper learning curve when compared with MS Word that is true. However, getting a basic LaTeX (text, figures, titles, tables) document is not so difficult. There are a million examples out there.

Is LaTeX harder than HTML? ›

Writing HTML is much more complicated than writing LaTeX if you take a broad view of all that is required to do it well: learning about accessibility and internationalization, keeping track of browser capabilities and market shares, adapting to evolving standards, etc.

Does LaTeX count as coding? ›

LaTeX is a form of “program code”, but one which specializes in document typesetting; consequently, as with code written in any other programming language, it can be very useful to include comments within your document.

Do people still use LaTeX? ›

LaTeX is used most of the time in math, physics, or computer science fields but it is not limited to them. Your collaborators and peers probably will use it and they will appreciate you for using it too since it is common to submit scientific papers and articles to journals in LaTeX.

Does LaTeX need coding? ›

LaTeX is a programming language in a fashion similar to C. In particular, LaTeX code must be compiled to produce a document. This is often done using pdflatex , a program which produces a PDF file from a LaTeX document.

How many packages are there in LaTeX? ›

The Comprehensive TeX Archive Network (CTAN) is the central place for all kinds of material around TeX and LaTeX. CTAN has currently over 4,000 packages.

What is the difference between TeX and LaTeX? ›

TeX is a typesetting system. Syntax can be as simple as Hello, world! \bye . LaTeX is a very common document markup language written in TeX.

How many parts are there in LaTeX document? ›

Each LaTeX program has these three general parts: Preamble. Document Environment. [Optional] Special Pages.

How can I train myself to write? ›

Training to Be a Good Writer
  • Write every day. I write pretty much every single day. ...
  • Learn to overcome the resistance. ...
  • See writing as a mindfulness practice. ...
  • Do timed writing sessions. ...
  • Learn to deal with the fears. ...
  • Care about the craft. ...
  • But get over perfectionism. ...
  • Learn to type.

What should a beginner writer write? ›

Short stories: A short story or novella gives new fiction writers a good format to use as a starting point. Short stories have a lower word count than traditional novels and are a great place to start learning the principles of fiction writing.

Why is starting to write so hard? ›

It's hard because doing it well matters, because stories matter, and the details matter, and there are often a lot of details. Sometimes they take years to organize. The feelings and ideas and memories that we put into the writing also matter, and are layered, and we can't force an understanding of them.

What are .CLS files in LaTeX? ›

cls and . sty files are supplementary files that increase the func- tionality of LATEX. They are the files loaded with the \documentclass{...} and \usepackage{...} commands, respectively.

How do I read a CLS file? ›

If the file doesn't open when you double-click it, you may not have one of these programs on your computer. Try installing the most common programs associated with CLS files, like C++ Class Definition, Visual Basic Class Module, or ArcView Geocoding Classification File.

How do I open a CLS file in overleaf? ›

  1. The muthesis class is already present in overleaf installation. ...
  2. Anyway, in general: to use a custom "private" class, you can add the cls file (e.g. myname.cls ) to the project folder, and then start your document with \documentclass{myname}
Jun 16, 2022

How do I write in LaTeX in word? ›

To insert an equation using the keyboard, press ALT+ =, and then type the equation. You can insert equation symbols outside a math region by using Math AutoCorrect. For more information, see Use Math AutoCorrect rules outside of math regions check box.

Can you include PDF in LaTeX? ›

pdf files in LaTeX documents. We can include . pdf figures using the graphicx package and the \includegraphics command. However, sometimes, we need to include a range of pages from an existing PDF in a new LaTeX document.

How do I make a PDF in LaTeX? ›

  1. create your LaTeX document, filename.tex, with any text editor (word processors should be avoided as they put in stray characters)
  2. At the terminal/command prompt, issue the command pdflatex filename.tex to generate filename.pdf.

What paper do PhD students write? ›

During a PhD, it's likely you'll be expected to write a research paper. Publishing work can be a great way to improve an academic CV and promote yourself as an early career researcher. You might also present your findings at a conference, where you can further network and promote your area of expertise.

How do I get LaTeX code from PDF? ›

How to convert PDF to LaTeX on the web
  1. Drag or upload your PDF into Snip web app.
  2. Your PDF gets digitized instantly into editable and exportable Mathpix Markdown.
  3. Export the file to LaTeX (as a . zip) or export to Overleaf.
Jul 20, 2022

What are the 5 steps to writing a paper? ›

  1. Step 1: Prewriting. Before you start writing, you need to decide exactly what you'll write about and do the necessary research. ...
  2. Step 2: Planning and outlining. ...
  3. Step 3: Writing a first draft. ...
  4. Step 4: Redrafting and revising. ...
  5. Step 5: Editing and proofreading.
Apr 24, 2020

What are the 10 steps to writing a paper? ›

Following these ten steps will help you write a good research paper.
  1. Choose Your Topic. ...
  2. Locate Information. ...
  3. Prepare Bibliography Cards. ...
  4. Prepare Note Cards. ...
  5. Prepare an Outline. ...
  6. Write A Rough Draft. ...
  7. Revise Your Rough Draft. ...
  8. Prepare Your Bibliography.

Is LaTeX faster than writing? ›

LaTeX snippets. Using snippets, writing LaTeX is a lot faster than writing it by hand. Especially some of the more complex snippets can save you a lot of time and frustration.

What is the best compiler for LaTeX? ›

💻 What are the best LaTeX editors?
  • TeXmaker.
  • Overleaf.
  • LaTeX Base.
  • TeXStudio.
  • Authorea.
  • Emacs.
  • Miktex.
  • LaTeX Workshop.
Jan 7, 2023

What are the basic requirements to install and compile a LaTeX file? ›

LaTeX Installation Guide: System Requirements

LaTeX is compatible with Windows, Mac OS, and Linux operating systems. The system requirements needed to run LaTeX on Windows devices are as follows: 333 MHz processor. 64 MB of RAM.

What compiler does LaTeX use? ›

the compiler - MiKTeX

The Windows LaTeX compiler is called MiKTeX and it will give your computer the power to compile . tex files. It also manages LaTeX packages, which work very similarly to R packages.

What is a document class? ›

Document classes help you to organize and classify the documents that belong to a case. You can provide additional information about the documents by assigning properties to the document class. You define document classes to group similar documents and the information about the documents that are related to the case.

Which of the following is a Documentclass in LaTeX? ›

The three most commonly used standard document-classes in LaTeX include: article , report and book . A number of global options allows customization of certain elements of the document by the author. Different document-classes might have different default settings.

What is document structure in LaTeX? ›

Document Structure

Each LaTeX program has these three general parts: Preamble. Document Environment. [Optional] Special Pages.

How does one break a line within a paragraph in LaTeX? ›

Line breaks
  1. \\ (two backslashes)
  2. \newline.
  3. \hfill \break.


1. LaTeX Tutorial 2: Docuemnt Class Options
(Dr.ShivakumarBR Talks)
2. Learn Latex in 5 minutes
(Sourav Singhal)
3. Learn LaTeX Tutorial - Structure of a Document
(TM Quest)
4. How to Use LaTeX! The LaTeX Tutorial for Preparing Amazing Documents with Mohammad Nauman
5. Document Class (.cls) in LaTeX
6. Getting Started with LaTeX
(Christopher Lum)
Top Articles
Latest Posts
Article information

Author: Amb. Frankie Simonis

Last Updated: 10/06/2022

Views: 6272

Rating: 4.6 / 5 (76 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Amb. Frankie Simonis

Birthday: 1998-02-19

Address: 64841 Delmar Isle, North Wiley, OR 74073

Phone: +17844167847676

Job: Forward IT Agent

Hobby: LARPing, Kitesurfing, Sewing, Digital arts, Sand art, Gardening, Dance

Introduction: My name is Amb. Frankie Simonis, I am a hilarious, enchanting, energetic, cooperative, innocent, cute, joyous person who loves writing and wants to share my knowledge and understanding with you.