📅  最后修改于: 2023-12-03 15:04:54.043000             🧑  作者: Mango
When we work with LaTeX, we often need to remove page numbers from some of the pages. For example, we may not want the first page or the pages containing the table of contents to have numbers. In this article, we will discuss different ways of removing page numbers from LaTeX pages.
The easiest way to remove page numbers from a single page in LaTeX is to use the \thispagestyle{empty}
command. This command removes the page number and any headers and footers from the current page. Here's an example:
\documentclass{article}
\begin{document}
This page has a page number (1).
\thispagestyle{empty}
This page does not have a page number.
\end{document}
In this example, the \thispagestyle{empty}
command is used after the first paragraph to remove the page number from the second paragraph. The output will be a two-page PDF, but the second page will not have a page number.
If we want to remove page numbers from several pages or from certain pages, we can use the \pagestyle{empty}
command. This command removes page numbers, headers, and footers from all the pages that follow it until the next \pagestyle
command is used.
\documentclass{article}
\begin{document}
\pagestyle{empty}
This page does not have a page number.
\newpage
This page also does not have a page number.
\end{document}
In this example, the \pagestyle{empty}
commmand is used before the first paragraph to remove page numbers from all the subsequent pages. The output will be a two-page PDF, but both pages will not have any page numbers.
Sometimes we may need a custom page style in which there are no page numbers. In such cases, we can create a new page style that removes the page numbers. Here's an example:
\documentclass{article}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[C]{\thepage}
\newpagestyle{noNumber}{%
\setfoot{}{}{}
}
\begin{document}
\pagestyle{noNumber}
This page does not have a page number.
\newpage
This page also does not have a page number.
\end{document}
In this example, we first set a default page style using the fancyhdr
package. The fancy
page style includes a page number with centered alignment in the footer.
We then create a new page style called noNumber
using the \newpagestyle
command provided by the titleps
package. The noNumber
page style sets the footer to empty, and thus there will be no page number on any page using this style.
We then change the page style to noNumber
before the first paragraph to remove the page numbers from all the subsequent pages. The output will be a two-page PDF, but both pages will not have any page numbers.
Overall, we have discussed different ways of removing page numbers from LaTeX pages, starting from a single page to multiple pages and even creating custom page styles. With these methods, we can easily customize the page layout according to our requirements.
# Remove Number from LaTeX Page
## Method 1: Removing Page Numbers from a Single Page
We can remove page number from a single page using '\thispagestyle{empty}' command.
## Method 2: Removing Page Numbers from Multiple Pages
To remove page numbers from several pages, we can use the '\pagestyle{empty}' command which will remove page numbers, headers, and footers from all the pages that follow it.
## Method 3: Using Custom Page Styles
For custom page styles, we can create a new page style that removes the page numbers.