In this article, I'll introduce the environment, a core LaTeX construct comprised of \begin and \end. I've organized frequently used environments by category and included examples you can try yourself, so follow along step by step!
LaTeX Environment Commands That Cover Everything from Reports to Math to Presentations
In LaTeX, documents are structured around block-level environments.
Simply put, an environment tells LaTeX, "Display this part of the content in this specific format!"
Environments are defined using pairs of commands: \begin{environment name} and \end{environment name}. The content placed between these two commands is displayed according to the style of the specified environment.
\begin{ํ๊ฒฝ ์ด๋ฆ}
...
\end{ํ๊ฒฝ ์ด๋ฆ}
The Essential Framework of a Document
Do you remember the document type and package declarations we covered earlier in the preamble?
Right below that section, youโll find the document environment, which contains the main body of the document.
\begin{document} ... \end{document} is the essential environment for writing your document.
Any text, images, equations, tables, etc. written inside this environment will appear in the actual output (such as a PDF).
If the document environment is missing, LaTeX wonโt know where the main content begins and ends, which can cause warnings or errorsโso please be careful!
Nested Environments
Within the main document environment, you can freely declare other environments.
For example, adding a list or writing equations within the main content are cases where environments can be nested like this.
In other words, the document environment plays a major role as the essential declaration for writing a LaTeX document, and you can stack other environments inside it like building blocks to complete your document.
Have you understood how environment definitions work in LaTeX now? Next, we'll walk through some commonly used LaTeX environments with examples, based on their specific purposes!
๐
The example code below is written in Korean to help you understand it more easily.
If you're new to writing LaTeX documents in Korean with Murfy, we recommend checking out Chapter 0. Basic Concepts to Understand Before Writing LaTeX first. It will help you better understand the structure and purpose of what follows.
1. Basic Document Elements
When writing a document with LaTeX, you need to include not only the main content but also the elements that represent the face of the document โ such as title, author, date, and abstract.
Environment Name
Description
document
The most basic and essential environment that contains the main content of a LaTeX document (must be used)
titlepage
Creates a title page independently on a separate page (includes title, author, date, etc.)
abstract
Used to write the abstract section of a thesis, report, etc.
The titlepage environment allows you to design your title page freely. Itโs useful when you want to customize the cover page of a research report or assignment.
If you just want to display the title simply, you can also use the \maketitle command inside the document environment.
If you're writing a thesis or report, using the abstract environment to summarize the key points of your writing is also a great idea.
๐ก
Try writing by referring to the code examples for each environment.
There are also environments in LaTeX designed for writing quotations or printing content exactly as typed.
Environment Name
Description
Package
quote
For writing short quotations made up of a single paragraph
-
quotation
For writing long quotations made up of multiple paragraphs
-
verbatim
Displays special characters or text exactly as typed, without interpreting them as commands (monospaced font)
verbatim
thebibliography
Standard environment for manually writing a list of references
-
In LaTeX, special characters (like \, {}, %, etc.) are interpreted as commands by default. If you want to display them as they are, use the verbatim environment, which prints the code or text exactly as written, without interpretation.
โ ๏ธ Note: When using the verbatim environment with Korean (xeCJK), errors can occur. If you need to display code or CJK characters, consider using the listings or minted packages instead.
If you donโt use BibTeX and prefer to manually list your references, you can use the thebibliography environment to directly create your reference list.
However, using BibTeX is a much more efficient method. You can gather your references into a separate file and simply cite them using the \cite command, which is much more convenient.
Weโll introduce BibTeX in a dedicated upcoming postโso stay tuned!
๐ก
Try writing by referring to the code examples for each environment.
\begin{quote}
The important thing isnotto stop questioning.\\
Curiosity has its own reason for existence.
\end{quote}
\begin{quotation}
Many people saythat motivation doesn't last. Well, neither does bathing.\\
That's why we recommend it daily.
The greatest glory in living lies notin never falling,\\
butin rising everytime we fall.
\end{quotation}
\begin{verbatim}
This is a \LaTeX\ command.
\textbf{Bold text}
This is math:
E = mc^2\end{verbatim}
\begin{thebibliography}{99}
\bibitem{einstein1905}
A. Einstein, ``Zur Elektrodynamik bewegter Kรถrper,'' *Annalen der Physik*, vol. 17, 1905.
\end{thebibliography}
3. Lists
When writing a document, have you ever thought, "I want to organize this neatly into a list!"?
LaTeX provides several environments you can use depending on the situation:
Environment Name
Description
Package
itemize
For creating unordered (bullet point) lists
-
enumerate
For creating ordered (numbered) lists
-
description
For creating labeled lists with custom labels per item
-
list
For creating fully customized lists (using list customization options)
-
In particular, the list environment is an advanced option that allows you to customize the appearance of your lists. It shines in cases where you might think: "Can I move the bullet or number position?"
You can find more detailed options for creating custom lists at the bottom of the document.
๐ก
Try writing by referring to the code examples for each environment.
In mathematical or scientific documents, presenting complex key content in a single line as an equation improves readability and makes the document look more organized and polished. LaTeX is especially known for its ability to present equations cleanly and professionally, so it supports a variety of math environments like the ones shown below.
Environment Name
Description
Package
align, align*
Aligns multiple lines of equations based on specific alignment points
amsmath
aligned
Aligns multiple lines of equations inside another math environment
amsmath
equation, equation*
Writes a single equation and assigns a number to it
โ
gather, gather*
Centers multiple lines of equations without alignment
amsmath
multline, multline*
Splits a long equation into multiple lines
amsmath
subequations
Groups multiple equations under a shared number prefix
amsmath
math
Used for inline equations
โ
displaymath
Used for ce
Especially in environments like align, align*, aligned, split, and cases, you can use the & symbol to specify alignment points in your equations. When working with multi-line equations, you can use the \\ command to break lines.
Note: The asterisk versions (*) of environments determine whether equation numbers are shown or hidden. Choose the version that fits your document style and needs.
Wait a moment!
There are also other commands you can use to create math environments:
Command
Description
Package
\[ ... \]
Defines a block-level math environment
โ
\( ... \)
Defines an inline math environment
โ
$ ... $
Defines an inline math environment
โ
Math written using these commands is simpler than using full environments, and it has the advantage of not requiring any package declarations. However, keep in mind that you canโt use line numbering or alignment features with these commands.
๐ก
Try writing by referring to the code examples for each environment.
\begin{align}
a + b &=c \\
d + e &= f
\end{align}
\begin{align*}
a + b &=c \\
d + e &= f
\end{align*}
\begin{equation}
\begin{aligned}
x &= y + z \\
&= u + v
\end{aligned}
\end{equation}
\begin{equation}
E = mc^2
\end{equation}
\begin{equation*}
E = mc^2
\end{equation*}
\begin{gather}
a = b + c \\
d = e + f
\end{gather}
\begin{gather*}
a = b + c \\
d = e + f
\end{gather*}
When you need to write algorithms in LaTeX, you can use the following environments:
Environment Name
Description
Package
algorithm
Creates a floating box for the entire algorithm block including captions and labels (wonโt display content if used alone)
algorithm
algorithmic
Used to write the actual content (steps) of the algorithm
algorithmic
The algorithm environment treats the algorithm block as an independent floating object. It allows you to add captions and labels, making it easy to reference (e.g., โSee Algorithm 1โ) in reports or theses.
You can also control the placement of the algorithm in the document using options like [h], [t], [b], etc. (More on placement options will be explained below.)
The algorithmic environment is where you write the actual steps of the algorithm. It displays the content in a clear pseudocode format, making it easier for readers to understand.
In summary, to write an algorithm in your LaTeX document, you need to use both the algorithm and algorithmic environments together. Make sure you include the necessary packages to enable these environments.
Frequently Used Commands for Writing Algorithms
Here are some commonly used commands for writing algorithms in LaTeX. If youโre familiar with at least one programming language, youโll understand them easily.
\STATE : Writes a single step (line) of the algorithm
Sometimes, you may need to organize data systematically within a document. In such cases, using tables or matrices makes the task much easier.
You can create structured tables using the tabular environment or by combining it with the table environment. For matrices, you can choose from a variety of styles depending on the desired brackets.
Table Environments
Environment Name
Description
Package
tabular
Basic environment for creating tables (uses column alignment options)
โ
table
Wraps the entire table as a floatable object (uses placement options)
โ
array
Used within math mode to create tables using rows and columns (uses column alignment options)
amsmath
Matrix Environments
Environment Name
Description
Package
matrix
Creates a matrix without any surrounding brackets
amsmath
bmatrix
Creates a matrix with square brackets [ ]
amsmath
Bmatrix
Creates a matrix with curly brackets { }
amsmath
pmatrix
Creates a matrix with parentheses ( )
amsmath
Vmatrix
Creates a matrix with double vertical bars โ โ
amsmath
vmatrix
Creates a matrix with single vertical bars `
center
Aligns text or equations to the center of the page
โ
๐ก
Try writing by referring to the code examples for each environment.
\begin{tabular}{|l|c|r|}\hline
์ผ์ชฝ & ๊ฐ์ด๋ฐ & ์ค๋ฅธ์ชฝ \\\hline
apple & banana & cherry \\
dog & cat & bird \\\hline\end{tabular}
Lastly, including visual materials in your document can help convey information more effectively in research reports or technical documents. The figure environment is commonly used for this purpose.
You can insert image files, and position titles and captions appropriately within your document.
Environment Name
Description
Package
figure
Inserts an image into the document and automatically adds numbering and a caption (uses placement options)
graphicx
subfigure
Allows multiple images to be placed side by side, each with its own caption (used within figure environment)
subcaption
frame
Creates a slide-like frame (used in presentations)
beamer class
framed
Wraps a block of text or math inside a box
framed
minipage
Creates an independently controlled layout area, useful for arranging content side by side
โ
picture
Used to draw vector elements (lines, text, shapes) manually
โ
tikzpicture
Draws complex elements like nodes, arrows, diagrams, charts, and flows using the TikZ graphics environment (uses drawing options)
tikz
๐ก
Try writing by referring to the code examples for each environment.
LaTeX allows you to use a variety of options along with environment declarations or commands.
1. List Customization Options
The options below can be used when creating lists in LaTeX, with commands like \setlength and \addtolength. You can freely design lists without requiring additional packages.
Options for customizing bullet or label spacing are also included here:
Option
Description
\leftmargin
Sets the left margin for the entire list
\rightmargin
Sets the right margin for the entire list
\itemsep
Sets the spacing between each list item
\topsep
Sets the spacing before and after the list begins
\labelwidth
Sets the width of the label (e.g., bullet or number)
\labelsep
Sets the spacing between the label and the list item text
\parsep
Sets the spacing between paragraphs within a single list item
\partopsep
Sets additional spacing when a list follows a paragraph break
\itemindent
Sets the indent size of the first line in a list item
Option
Description
\textbullet
Bullet in the shape of a standard black dot (โข)
\textendash
Bullet in the shape of a short dash (โ)
\textasteriskcentered
Bullet in the shape of an asterisk (*)
$\star$
Bullet in the shape of a star (โ )
$\bullet$
Bullet in the shape of a standard black dot (โข)
$\circ$
Bullet in the shape of an open circle (โ)
$\triangleright$
Bullet in the shape of a right-pointing triangle (โท)
If the method feels too complicated or cumbersome, we recommend using the enumitem package. Itโs short and straightforward, which is why it's the most commonly used format in modern LaTeX documents.
Placement specifiers can be freely combined and used in any order. Try mixing and testing the options as needed (e.g., [htbp]).
Specifier
Description
Package
h
Place the float here, at the current location
โ
H
Place the float exactly here (requires precision)
float
t
Place at the top of the page
โ
b
Place at the bottom of the page
โ
p
Place on a separate page of floats
โ
โ ๏ธ Be cautious when overusing [H] โ it may interfere with the layout!
3. Column Alignment Options
When using the tabular environment to create tables, if you're wondering how to align each column, you can use the options below to arrange your data as needed.
Option
Description
l
Align left
r
Align right
c
Align center
`
`
4. Drawing Options
In advanced graphic environments like TikZ, various drawing options are available. Just remember: you need to include the tikz package when using these features!
Option
Description
\draw
Draw lines, shapes, and paths
\node
Insert labels or text nodes
\fill
Draw filled shapes
\path
Define paths
\coordinate
Set coordinates
So far, weโve explored how to structure LaTeX documents using basic environment settings and the \begin ~ \end format.
At first, LaTeX might feel a bit clunky or difficult to use, but once you try writing with it, youโll find that the results are far more precise and polished.
Now, youโve learned how to freely use various environments in your document, such as title, abstract, equations, tables, and figures. ๐
However, when writing full documents, youโll often face situations where you need to manage multiple files or import external resources. In the next post, weโll cover how to structure a document using multiple files and improve writing efficiency.
Until then, try writing different environment declarations in Murfy โ youโll be one step closer to mastering LaTeX! ๐ช