\pagestyle{plain} между главами без номера страницы после титульного листа?

\pagestyle{plain} между главами без номера страницы после титульного листа?

Я нашел множество сообщений об удалении верхнего/нижнего колонтитула на пустых страницах между главами, и они работают нормально, за одним большим исключением... Мне нужен \pagestyle{plain}(т.е. единый центрированный номер страницы) на всех пустых страницах перед началом главы в документе.кромеМне нужно \pagestyle{empty}для страницысразу послеВсе методы \titlepage, которые я видел и пробовал, либо оставляли у меня совершенно пустые страницы во всем документе, либо \pagestyle{plain}вообще во всех.

Я использую bookкласс документа [twosided,openright], fancyhdrи включил код для переопределения \cleardoublepageследующим образом:

\makeatletter
\def
\cleardoublepage{%
\clearpage
  \ifodd\c@page
  \else
    \hbox{}
    \thispagestyle{plain}
    \newpage      
  \fi
  }%
\makeatother

...как рекомендовано в различных постах. К сожалению, это оставляет меня с пустой страницей после titlepageс номером страницы (что сводит клиента с ума). Код, похоже, переопределяет любые встроенные попытки получить эту страницу в {empty}.

Есть ли какая-то форма \if@titlepageусловного выражения, которая параллельна тому, что \if@mainmatterя мог бы использовать, чтобы очистить только этот раздел и оставить остальное ( \frontmatter, \mainmatter, \appendix, \backmatter) как \pagestyle{plain}для тех пустых страниц между ними? Есть ли какой-то способ зафиксировать это как условное выражение?

(Очень) грубое приближение MWE:

\documentclass[12pt,letterpaper,final,openright]{book}

\usepackage{fancyhdr}
\usepackage{natbib}

\pagestyle{fancy}
  \setlength{\headheight}{15.2pt}
  \renewcommand{\headrulewidth}{0.4pt}
  \renewcommand{\footrulewidth}{0.2pt}

  \makeatletter
    \renewcommand{\chaptermark}[1]{%
      \if@mainmatter
        \markboth{\MakeUppercase{\chaptername\ \thechapter.\ #1}}{}
      \else
        \markboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}
      \fi
      }%
  \makeatother  

  \fancyhf{} 
  \fancyhead[LE,RO]{\small \thepage}
  \fancyhead[LO]{\small \leftmark}
  \fancyhead[RE]{\small \rightmark}

% Redefine \pagestyle{plain}
\fancypagestyle{plain}{%
  \fancyhf{} % clear all header and footer fields
  \fancyfoot[C]{\small \thepage} % except the center
  \renewcommand{\headrulewidth}{0pt}
  \renewcommand{\footrulewidth}{0pt}
  }%

% Code for creating plain on empty pages before new chapter
\makeatletter
\def
  \cleardoublepage{%
    \clearpage
      \ifodd\c@page
      \else
        \hbox{}
        \thispagestyle{plain}
        \newpage      
      \fi
    }%
\makeatother

\begin{document}
% TITLE PAGE
\pagestyle{empty}  %Clear hdr/ftr 
\titlepage
  \input{./Chapter_txt/titlepageV1} %Custom title page text/layout

\frontmatter
\pagestyle{fancy} % Resume hdr/ftr
%MANAGEMENT SUMMARY 
\include{Preface} %Intro/Preface chapter

%ToC and Lists  
\tableofcontents
\listoftables   
\listoffigures

\mainmatter
\part{PartI}
  \include{Chapter1}
  \include{Chapter2}
\part{PartII}
  \include{Chapter3}
  \include{Chapter4}

\appendix
  \include{app}

\backmatter  
    \bibliographystyle{humannat}
    \bibliography{mybib}\footnotesize
    \addcontentsline{toc}{chapter}{Bibliography}

\end{document}

Вся эта работа представляет собой многотомный труд, в котором каждый раздел нарисован \include{file}... не лучший способ сделать большую часть MWE (не знаю, как сделать то, в котором есть \inputили \include).

решение1

Вот решениеРедактировать: больше объяснений

стиль страницы - необычный, страницы между главами устанавливаются plainпутем переопределения \cleardoublepage(эта последняя команда используется \partи \chapter)

страница после части страницы устанавливается plainпутем переопределения\@endpart

страница после титульного листа устанавливается emptyс помощью этого pagestyle{empty} сразу после titlepageокружения

\documentclass{book}
\usepackage{lipsum}
\usepackage{fancyhdr}
\fancyhf{}  
\fancyhead[R]{\leftmark} 
\fancyfoot[R]{test} 
\fancyfoot[C]{\thepage}
\pagestyle{fancy}
\let\mtcleardoublepage\cleardoublepage
\renewcommand{\cleardoublepage}{\clearpage{\pagestyle{plain}\mtcleardoublepage}}
\makeatletter
\def\@endpart{\vfil\newpage
              \if@twoside
               \if@openright
                \null
                \thispagestyle{plain}%
                \newpage
               \fi
              \fi
              \if@tempswa
                \twocolumn
              \fi}
\makeatother
\title{Test}
\author{Me}
\begin{document}
\begin{titlepage}
\maketitle
\end{titlepage}
\thispagestyle{empty}
\lipsum[1-20]
\part{Deux}
\chapter{trois}
\lipsum[1-50]
\end{document}

Редактировать: код для этого конкретного

\documentclass[12pt]{book}

\usepackage{fancyhdr}
\usepackage{natbib}

\pagestyle{fancy}
  \setlength{\headheight}{15.2pt}
  \renewcommand{\headrulewidth}{0.4pt}
  \renewcommand{\footrulewidth}{0.2pt}

  \makeatletter
    \renewcommand{\chaptermark}[1]{%
      \if@mainmatter
        \markboth{\MakeUppercase{\chaptername\ \thechapter.\ #1}}{}
      \else
        \markboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}
      \fi
      }%
  \makeatother  

  \fancyhf{} 
  \fancyhead[LE,RO]{\small \thepage}
  \fancyhead[LO]{\small \leftmark}
  \fancyhead[RE]{\small \rightmark}

% Redefine \pagestyle{plain}
\fancypagestyle{plain}{%
  \fancyhf{} % clear all header and footer fields
  \fancyfoot[C]{\small \thepage} % except the center
  \renewcommand{\headrulewidth}{0pt}
  \renewcommand{\footrulewidth}{0pt}
  }%

\let\mtcleardoublepage\cleardoublepage
\renewcommand{\cleardoublepage}{\clearpage{\pagestyle{plain}\mtcleardoublepage}}
\makeatletter
\def\@endpart{\vfil\newpage
              \if@twoside
               \if@openright
                \null
                \thispagestyle{plain}%
                \newpage
               \fi
              \fi
              \if@tempswa
                \twocolumn
              \fi}
\makeatother

\begin{document}

\begin{titlepage}
test
\end{titlepage}
\thispagestyle{empty}
\frontmatter

\include{Preface} %Intro/Preface chapter

%ToC and Lists  
\tableofcontents
\listoftables   
\listoffigures

\mainmatter
\part{PartI}
  \include{Chapter1}
  \include{Chapter2}
\part{PartII}
  \include{Chapter3}
  \include{Chapter4}

\appendix
  \include{app}

\backmatter 
\footnotesize 
    \bibliographystyle{humannat}
    \bibliography{mybib}
    \addcontentsline{toc}{chapter}{Bibliography}

\end{document}

решение2

Вероятно, вам нужно переопределить свою titlepageсреду. У меня она такая, и первая страница после титульного листа пустая, а последующие пронумерованы правильно.

\newenvironment{titlepage}
{%
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi%
  \newpage
  \thispagestyle{empty}%
  \setcounter{page}\@ne
}%
{\newpage
  \thispagestyle{empty}
}%%

Более того, если вы используете \maketitleкоманду, вам следует добавить a \clearpageв конце определения команды:

\if@titlepage
\newcommand\maketitle{%
  \begin{titlepage}
...
  \end{titlepage}%
  \clearpage%
  \setcounter{footnote}{0}%
...
}%
\fi

Я надеюсь, что это помогает.

решение3

Вы можете загрузить пакетscrextendс опцией cleardoublepage=plain. Чтобы получить пустую страницу сразу после титульного листа, используйте \cleardoubleoddemptypageпосле titlepageсреды или как последнюю команду внутри этой среды.

\documentclass{book}
\usepackage[cleardoublepage=plain]{scrextend}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{blindtext}% dummy text
\begin{document}
\begin{titlepage}
\Huge My Titlepage
\end{titlepage}
\cleardoubleoddemptypage
\frontmatter
\tableofcontents
\mainmatter
\blinddocument
\Blindtext
\blinddocument
\end{document}

Другая возможность — это дополнительное использованиеetoolbox:

\documentclass{book}
%
\usepackage[cleardoublepage=plain]{scrextend}
\usepackage{etoolbox}
\AfterEndEnvironment{titlepage}{\cleardoubleoddemptypage}
%
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{blindtext}% dummy text
\begin{document}
\begin{titlepage}
\Huge My Titlepage
\end{titlepage}
\frontmatter
\tableofcontents
\mainmatter
\blinddocument
\Blindtext
\blinddocument
\end{document}

Связанный контент