How to automatically suppress page number or change to plain pagestyle whenever there is a landscape page? Fancyhdr and fancy header looks really ugly in landscaped tables that has \begin{landscape} \begin{table}. I understand thispagestyle works, but it is very complicated to do it manually. Is there is an automatic solution that affects all tables with \begin{landscape}?
1 Answer
You can always define your own page, and then when you want that page to appear for just a single page in your document, you can define just that page as your own page style by using the \thispagestyle{mypage}
command.
Example code for defining your own page style, or for setting the chapter page style, is shown below.
% SET CHAPTER PAGE STYLE TO THE 'PLAIN' FORMAT
\copypagestyle{chapter}{plain}% Copy plain page syle to chapter page style
\makeoddhead{chapter}% Adjust odd header for chapter page style
{\leftmark}% Left odd header
{\thepage}% Center odd header
{\rightmark}% Right odd header
\makeevenhead{chapter}% Adjust odd header for chapter page style
{\leftmark}% Left odd header
{\thepage}% Center odd header
{\rightmark}% Right odd header
% CREATE MY OWN PAGE STYLE
\makepagestyle{mypage}% Create 'mypage' page style
\makeevenfoot{mypage}% Adjust even footer for mypage page style
{LEF}% Left even footer
{CEF}% Center even footer
{REF}% Right even footer
\makeevenhead{mypage}% Adjust even header for mypage page style
{\rightmark}% Left even header
{\thepage}% Center even header
{\leftmark}% Right even header
\makeoddfoot{mypage}% Adjust odd footer for mypage page style
{LOF}% Left odd footer
{COF}% Center odd footer
{ROF}% Right odd footer
\makeoddhead{mypage}% Adjust odd header for mypage page style
{\rightmark}% Left odd header
{\thepage}% Center odd header
{\leftmark}% Right odd header
\makeheadrule{mypage}{\textwidth}{.4pt}% Header rule width/thickness for mypage page style
\makefootrule{mypage}{\textwidth}{.4pt}{\footruleskip}% Footer rule width/thickness/skip for mypage page style
\pagestyle{mypage}% Set page style to mypage
As always, you can comment out any lines of this template that you are not needing to use, and if you are not using the page number, or the headings, you can replace them with your preferred text, or leave nothing between the brackets if that space should remain blank.
NOTE: This code goes in the preamble of the .TeX document, before the begin{document}
line.
-
Thank you, if you don't mind please take a look at my other question tex.stackexchange.com/questions/600515/…– he weiJun 9, 2021 at 2:36