如何隐藏章节第一页的页码

如何隐藏章节第一页的页码

我需要隐藏章节第一页的页码。我读到并采纳了他们的建议。它完成了工作。但是 fancyhdr 在“内容”页面中插入了页眉和页脚行。

如果我删除推荐行 \fancypagestyle{plain}{\fancyhf{}},则\usepackage{fancyhdr}页眉和页脚行在内容页上消失,但页码出现在章节页上。我不明白为什么。MWE:

\documentclass[10pt]{book}%

\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage[english]{babel}
\usepackage[OT1]{fontenc}
\usepackage{euler,beton}


\usepackage[paperwidth=145mm, paperheight=215mm,inner=1.6cm,top=2.4cm,bottom=4cm,textwidth=7.4cm,marginparwidth=40mm]{geometry}

\usepackage{fancyhdr}
%\fancypagestyle{plain}{\fancyhf{}}
\pagestyle{fancy}

\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{1pt}

\fancypagestyle{style1}{
\fancyhf{}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
}
\fancypagestyle{style2}{
\fancyhf{}
\addtolength{\headwidth}{\marginparwidth}
\addtolength{\headwidth}{\marginparsep}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
}
\fancypagestyle{style3}{
\fancyhf{}
\setlength{\headwidth}{\textwidth}
\addtolength{\headwidth}{\marginparwidth}
\addtolength{\headwidth}{\marginparsep}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
}

\author{A. Uthor}
\title{What is the Title of This Book?}
\date{today}


\begin{document}

\newgeometry{top=24mm,bottom=40mm,inner=16mm,outer=3.2cm}
\pagestyle{style1}
\maketitle


\thispagestyle{empty}
{This page is intentionally left blank}

\newgeometry{top=24mm,bottom=40mm,inner=16mm,outer=3.2cm,marginparwidth=20mm}
\pagestyle{style2}
%\thispagestyle{empty}
\tableofcontents
\clearpage{\pagestyle{empty}\cleardoublepage}


\section*{Intro}
\addcontentsline{toc}{section}{\textbf{Intro}}

\lipsum

\clearpage{\pagestyle{empty}\cleardoublepage}



\newgeometry{inner=1.6cm,top=2.4cm,bottom=4cm,textwidth=7.4cm,marginparwidth=40mm}

\pagestyle{style3}
\chapter{The First Chapter}
\section{Section about everything}
\lipsum[1-2]\marginpar{\lipsum[1]}\lipsum[1-5]

\end{document}

输出: 在此处输入图片描述

我的目标是让介绍部分和主要部分(涂鸦的更宽边缘)采用不同的风格。

内容最好带有页码(就像现在这样),但绝对没有标尺。

介绍:标尺

章节:第一页完全空白。文本较窄,没有标尺。后面几页有标尺,文本宽度相同(较窄)。

感谢帮助。

答案1

我将这两行添加到样式 3 中,我认为它起了作用:

\renewcommand{\headrulewidth}{0pt} %<- ADDED
\renewcommand{\footrulewidth}{0pt} %<- ADDED

完整代码:

\documentclass[10pt]{book}%

\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage[english]{babel}
\usepackage[OT1]{fontenc}
\usepackage{euler,beton}


\usepackage[paperwidth=145mm, paperheight=215mm,inner=1.6cm,top=2.4cm,bottom=4cm,textwidth=7.4cm,marginparwidth=40mm]{geometry}

\usepackage{fancyhdr}
\fancypagestyle{plain}{\fancyhf{}}
\pagestyle{fancy}

\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{1pt}

\fancypagestyle{style1}{
\fancyhf{}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
}
\fancypagestyle{style2}{
\fancyhf{}
\addtolength{\headwidth}{\marginparwidth}
\addtolength{\headwidth}{\marginparsep}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
}
\fancypagestyle{style3}{
\fancyhf{}
\setlength{\headwidth}{\textwidth}
\addtolength{\headwidth}{\marginparwidth}
\addtolength{\headwidth}{\marginparsep}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\renewcommand{\headrulewidth}{0pt} %<- ADDED
\renewcommand{\footrulewidth}{0pt} %<- ADDED
}

\author{A. Uthor}
\title{What is the Title of This Book?}
\date{today}


\begin{document}

\pagestyle{style1}
\maketitle

\newgeometry{top=24mm,bottom=40mm,inner=16mm,outer=3.2cm}
\thispagestyle{empty}
{This page is intentionally left blank}


\thispagestyle{empty}
\tableofcontents
\clearpage{\pagestyle{empty}\cleardoublepage}

\newgeometry{top=24mm,bottom=40mm,inner=16mm,outer=3.2cm,marginparwidth=20mm}
\pagestyle{style2}
\section*{Intro}
\addcontentsline{toc}{section}{\textbf{Intro}}

\lipsum

\clearpage{\pagestyle{empty}\cleardoublepage}



\newgeometry{inner=1.6cm,top=2.4cm,bottom=4cm,textwidth=7.4cm,marginparwidth=40mm}

\pagestyle{style3}
\chapter{The First Chapter}
\section{Section about anything}
\lipsum[1-2]\marginpar{\lipsum[1]}\lipsum[1-5]

\end{document}

输出: 在此处输入图片描述

编辑::

如果您想要清空章节第一页的样式,您可以添加

\thispagestyle{empty} 

正好在本章之后。

以下是新的输出:

在此处输入图片描述

新守则:

    \documentclass[10pt]{book}%

    \usepackage[utf8]{inputenc}
    \usepackage{lipsum}
    \usepackage[english]{babel}
    \usepackage[OT1]{fontenc}
    \usepackage{euler,beton}


    \usepackage[paperwidth=145mm, paperheight=215mm,inner=1.6cm,top=2.4cm,bottom=4cm,textwidth=7.4cm,marginparwidth=40mm]{geometry}

    \usepackage{fancyhdr}
    \fancypagestyle{plain}{\fancyhf{}}
    \pagestyle{fancy}

    \renewcommand{\headrulewidth}{1pt}
    \renewcommand{\footrulewidth}{1pt}

    \fancypagestyle{style1}{
        \fancyhf{}
        \fancyhead[LE,RO]{\bfseries\thepage}
        \fancyhead[LO]{\bfseries\rightmark}
        \fancyhead[RE]{\bfseries\leftmark}
    }
    \fancypagestyle{style2}{
        \fancyhf{}
        \addtolength{\headwidth}{\marginparwidth}
        \addtolength{\headwidth}{\marginparsep}
        \fancyhead[LE,RO]{\bfseries\thepage}
        \fancyhead[LO]{\bfseries\rightmark}
        \fancyhead[RE]{\bfseries\leftmark}
    }
    \fancypagestyle{style3}{
        \fancyhf{}
        \setlength{\headwidth}{\textwidth}
        \addtolength{\headwidth}{\marginparwidth}
        \addtolength{\headwidth}{\marginparsep}
        \fancyhead[LE,RO]{\bfseries\thepage}
        \fancyhead[LO]{\bfseries\rightmark}
        \fancyhead[RE]{\bfseries\leftmark}
    %   \renewcommand{\headrulewidth}{0pt} %<- ADDED
    %   \renewcommand{\footrulewidth}{0pt} %<- ADDED
    }

    \author{A. Uthor}
    \title{What is the Title of This Book?}
    \date{today}


    \begin{document}

        \pagestyle{style1}
        \maketitle

        \newgeometry{top=24mm,bottom=40mm,inner=16mm,outer=3.2cm}
        \thispagestyle{empty}
        {This page is intentionally left blank}


        \thispagestyle{empty}
        \tableofcontents
        \clearpage{\pagestyle{empty}\cleardoublepage}

        \newgeometry{top=24mm,bottom=40mm,inner=16mm,outer=3.2cm,marginparwidth=20mm}
        \pagestyle{style2}
        \section*{Intro}
        \addcontentsline{toc}{section}{\textbf{Intro}}

        \lipsum

        \clearpage{\pagestyle{empty}\cleardoublepage}



        \newgeometry{inner=1.6cm,top=2.4cm,bottom=4cm,textwidth=7.4cm,marginparwidth=40mm}

        \pagestyle{style3}
        \chapter{The First Chapter}
            \thispagestyle{empty} %<-- ADDED
        \section{Section about anything}
        \lipsum[1-2]\marginpar{\lipsum[1]}\lipsum[1-5]

    \end{document}

答案2

我没有找到问题的答案,但考虑到读者还想知道章节从哪页开始(为了搜索和导航),所以我得到了以下内容。

\documentclass[10pt]{book}%

\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage[english]{babel}
\usepackage[OT1]{fontenc}
\usepackage{euler,beton}


\usepackage[paperwidth=145mm, paperheight=215mm,inner=1.6cm,top=2.4cm,bottom=4cm,textwidth=7.4cm,marginparwidth=40mm]{geometry}

\usepackage{fancyhdr}
%\fancypagestyle{plain}{\fancyhf{}}
\pagestyle{fancy}

\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{1pt}

\fancypagestyle{style1}{
\fancyhf{}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
}
\fancypagestyle{style2}{
\fancyhf{}
\addtolength{\headwidth}{\marginparwidth}
\addtolength{\headwidth}{\marginparsep}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
}
\fancypagestyle{style3}{
\fancyhf{}
\setlength{\headwidth}{\textwidth}
\addtolength{\headwidth}{\marginparwidth}
\addtolength{\headwidth}{\marginparsep}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
}

% Redefine the PLAIN style
\fancypagestyle{plain}{%
    \fancyhead{} %Clean headers
    \fancyfoot{} %Clean footers
    \renewcommand{\headrulewidth}{1pt} % Header rule's width
    \fancyhead[LE,RO]{\bfseries\thepage}
    \fancyhead[LO]{\bfseries\rightmark}
    \fancyhead[RE]{\bfseries\leftmark}
}
% Define the DEFAULT style
\fancypagestyle{MyStyle}{%
    \fancyhead{} %Clean headers
    \fancyfoot{} %Clean footers
    \renewcommand{\headrulewidth}{1pt} % Header rule's width
        \setlength{\headwidth}{\textwidth}
        \addtolength{\headwidth}{\marginparwidth}
        \addtolength{\headwidth}{\marginparsep}
    \fancyhead[LE,RO]{\bfseries\thepage}
    \fancyhead[LO]{\bfseries\rightmark}
    \fancyhead[RE]{\bfseries\leftmark}
}

\author{A. Uthor}
\title{What is the Title of This Book?}
\date{today}


\begin{document}

\newgeometry{top=24mm,bottom=40mm,inner=16mm,outer=3.2cm}
\pagestyle{style1}
\maketitle


\thispagestyle{empty}
{This page is intentionally left blank}

\newgeometry{top=24mm,bottom=40mm,inner=16mm,outer=3.2cm,marginparwidth=20mm}
\pagestyle{style2}
%\thispagestyle{empty}
\tableofcontents
\clearpage{\pagestyle{empty}\cleardoublepage}


\section*{Intro}
\addcontentsline{toc}{section}{\textbf{Intro}}

\lipsum

\clearpage{\pagestyle{empty}\cleardoublepage}



\newgeometry{inner=1.6cm,top=2.4cm,bottom=4cm,textwidth=7.4cm,marginparwidth=40mm}

\pagestyle{MyStyle}
\chapter{The First Chapter}
\section{Section about everything}
\lipsum[1-2]\marginpar{\lipsum[1]}\lipsum[1-5]

\end{document}

此链接帮助。这个 MWE 已经另一个后续问题

相关内容