Skip to main content
v2026.11,858 entries · CC-BY 4.0
LAC HealthMedical Supply Distributor100,000+ medical supplies. 48-hour critical dispatch.Ships from 8 regional U.S. hubs. Net-30 terms for verified institutional accounts.Shop lac.us CodeCASRAIlac.us

LaTeX Document: Structure, Classes, Packages

How to write a LaTeX document: class, packages, title block, sections, and splitting a manuscript with input, include and includeonly.

Written and maintained by CASRAI Editorial Board

Last updated

Reader task: a researcher who needs to set up a LaTeX document for a manuscript and understand what each part of the file does. A LaTeX document is a plain-text .tex file with a preamble (class, packages, title data) followed by a body between begin{document} and end{document}, which you compile to produce the typeset output.

How do I write a document in LaTeX?

Write a .tex file that declares a document class, optionally loads packages, then places your text between begin{document} and end{document}. The LaTeX Project describes LaTeX as a document preparation system for high-quality typesetting; Overleaf’s documentation gives the same minimal structure (sources below, read 2026-11-07). Compiling the file, for example with the Recompile button in Overleaf, produces the output.

The minimal file

documentclass{article}
begin{document}
Hello, world.
end{document}

documentclass declares the class; the text of the document sits between the begin and end lines.

Structure of a LaTeX manuscript file

  1. Class. documentclass[12pt, letterpaper]{article}. Options go in square brackets. Overleaf’s documentation names the classes article, book, report and letter.
  2. Packages. usepackage{graphicx}, usepackage{amsmath}, usepackage{geometry} and so on, one line per package, with optional settings in square brackets. Everything before begin{document} is the preamble.
  3. Title data. title, author and date in the preamble. thanks adds a footnote to the author line and date{today} inserts the compile date.
  4. Body. After begin{document}, call maketitle to print the title block, add an abstract environment if the class and journal expect one, then the sections.
  5. Sections. section, subsection, subsubsection, paragraph and subparagraph; part and chapter exist only in book and report. A star (for example section*{...}) removes numbering. tableofcontents prints a contents list.
  6. Bibliography. See our guide to the thebibliography environment in LaTeX and the walk-through for adding citations and a bibliography in Overleaf.

An annotated manuscript skeleton

documentclass[12pt, letterpaper]{article}  % class + options
usepackage{graphicx}                       % figures
usepackage{amsmath}                        % equations
usepackage{geometry}                       % page margins

title{Working title}
author{First Author thanks{Funded by ...}}
date{today}

begin{document}
maketitle
begin{abstract}
...
end{abstract}

section{Introduction}
input{sections/methods}      % pulled in without a page break
include{sections/results}    % starts on a new page
end{document}

The file names after input and include are illustrative. For figures, see including graphics in LaTeX and LaTeX figures.

Splitting a manuscript across files: input, include and includeonly

Overleaf’s guide to managing large projects (read 2026-11-07) describes three commands.

Command Behaviour
input{file} Inserts the file as if typed in place. The file must not contain a preamble; no page break is added; calls can be nested.
include{file} Starts a new page before the material. Cannot be nested. Give the name without the .tex extension. Each included file gets its own .aux file.
includeonly{file1,file2} Placed in the preamble; only the listed files are processed. The list is comma-separated with no spaces. Page numbers and cross-references still work through the .aux files of omitted files.

Common mistakes

  • Loading a package that is not installed. A missing package file makes LaTeX stop with an error (Overleaf documentation).
  • Using chapter or part in the article class. They are available only in book and report.
  • Adding .tex inside include{...}. Omit the extension.
  • Nesting include. It cannot be nested; use input for nested files.
  • Putting a preamble in a file pulled in by input. The file must not contain one.
  • Spaces in the includeonly list. Use a comma-separated list with no spaces.

Checklist

  • Class and options match the journal or template you are submitting to.
  • Every package in usepackage is available in your installation or project.
  • title, author, date set; maketitle called after begin{document}.
  • Section commands suit the class you chose.
  • Included files named without extension; no preamble in input files.
  • Compiles cleanly from a fresh build before you submit.

For collaborative editing options see LaTeX and Overleaf collaborative writing, and what Overleaf is.

FAQ

How do you pronounce LaTeX software?

The LaTeX Project’s about page gives “Lah-tech” or “Lay-tech”, to rhyme with “blech” or “Bertolt Brecht” (read 2026-11-07).

Is LaTeX difficult to learn?

Editorial view, not a measured claim: the minimal file above is short, and most difficulty comes from errors such as missing packages or misplaced commands, listed in the common mistakes section. Learning is incremental, since you can start from the minimal file and add commands as needed.

Does anyone still use LaTeX?

The tools and documentation cited here, including the LaTeX Project and Overleaf’s current guides, are actively maintained. We do not cite a usage statistic. For how it compares with word processors for manuscripts, see the comparison Google Docs vs Overleaf vs Word for manuscripts.

Sources

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about LaTeX Document: Structure, Classes, Packages

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →