The \documentclass is the first and most important command in any LaTeX file because it decides the document style, layout, and overall structure.
Many beginners are confused about which class to choose or how different options affect formatting.
Before understanding basic usage, it is important to know the two main syntaxes used in LaTeX for setting the document class.
\documentclass{class}
\documentclass[options]{class}
The first syntax is the simplest form where you only select the class name such as article, report, or book. It is used when you are writing simple documents without needing extra layout control.
The second syntax adds options inside square brackets, allowing you to change font size, paper size, orientation, or other formatting settings.
Basic documentclass usage
The \documentclass command selects the document type. Beginners usually start with the article class because it is perfect for short writing, assignments, reports, and simple documents.
It gives a clean structure without too many advanced features.
\documentclass{article}
\begin{document}
Hello LaTeX!
\end{document}
LaTeX provides several built-in classes, each made for a specific purpose. This small table helps you quickly understand which class is right for your document.
| Class | Use Case |
|---|---|
article |
Short reports, notes, assignments, and basic academic writing. |
report |
Long documents with chapters such as theses and dissertations. |
book |
Books, manuals, and long academic work with parts and chapters. |
letter |
Formal letters and official communication. |
beamer |
Slide presentations and talk material. |
memoir |
Flexible alternative to article, report, and book with extra features. |
KOMA Script |
Modern, professional typography for advanced documents. |
documentclass with options
Options help you control font size, paper size, orientation, and other layout settings. They make your document more readable and better suited for printing or academic submission.
\documentclass[fontsize, papersize, orientation]{class}
-
fontsizeSets the base text size of the document. Common values are
10pt,11pt, and12pt. Larger text improves readability for printed documents. -
papersizeDefines the page format such as
a4paperorletterpaper. Matching the correct size is important for regional printing standards. -
orientationSets the page direction as
portraitorlandscape. Landscape is useful for wide tables or large images. -
classSpecifies the document structure such as
article,report, orbook. Each class has its own layout rules.
\documentclass[12pt, a4paper, landscape]{article}
\begin{document}
A4 landscape article
\end{document}
Advanced classes
Advanced classes offer more modern layout and better control. KOMA-Script and memoir are popular choices for professional typesetting.
\documentclass[options]{scrartcl}
-
KOMA ScriptModern replacement for standard classes with improved spacing, headings, and overall layout. Suitable for serious academic documents.
-
memoirA powerful class that replaces article, report, and book. Includes built-in tools for chapters, headers, page layout, and more.
\documentclass[12pt]{scrartcl}
\begin{document}
KOMA Script example
\end{document}
Publisher provided classes
Some publishers and universities give their own class files that contain all required formatting rules. Using these ensures your submission matches the official style.
\documentclass[options]{ieeetran}
-
ieeetranOfficial IEEE class with two-column layout and predefined citation formatting for conferences and journals.
-
acmartUsed for ACM conference and journal papers with built-in formatting modes.
\documentclass[conference]{ieeetran}
\begin{document}
IEEE paper
\end{document}
Combining multiple options
You can mix several options such as draft mode, two-column layout, or font size in a single \documentclass. This is helpful for fast editing or fine-tuning long documents.
\documentclass[12pt, a4paper, draft, twocolumn]{article}
Best Practice
For short writing, article is the simplest and best choice. Use report or book for chapter-based documents.
Choose KOMA-Script or memoir for modern, professional formatting.
Always use only the options you truly need, too many unnecessary settings may slow down compilation.