To display page numbers in a LaTeX document, you can use the \pagestyle and \pagenumbering commands along with the \thepage command to insert the page number where you want it to appear. Here are the basic steps:
- Add
\pagestyle{plain} or \pagestyle{headings} to your document’s preamble:
\pagestyle{plain}
\pagestyle{headings}
For example:
\documentclass{article}
\pagestyle{plain} % or \pagestyle{headings}
-
Use
\pagenumbering{arabic} to specify the page numbering style. You can use other styles like Roman numerals or alphabetic characters as well. Place this command just before the page where you want to start numbering.
For example, to start numbering with Arabic numerals (1, 2, 3…), use \pagenumbering{arabic}. -
To insert the page number in your document, use the
\thepage command where you want it to appear. This will automatically insert the current page number.
Here’s an example of how to set up page numbering in a LaTeX document:
latexCopy code\documentclass{article}
\pagestyle{plain} % or \pagestyle{headings}
\begin{document}
This is page \thepage.
\newpage % Start a new page
This is page \thepage.
\end{document}