![Удаление номеров страниц из приложений](https://rvso.com/image/330745/%D0%A3%D0%B4%D0%B0%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5%20%D0%BD%D0%BE%D0%BC%D0%B5%D1%80%D0%BE%D0%B2%20%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%20%D0%B8%D0%B7%20%D0%BF%D1%80%D0%B8%D0%BB%D0%BE%D0%B6%D0%B5%D0%BD%D0%B8%D0%B9.png)
Я пытаюсь удалить все номера страниц из раздела «Приложения». Было предложено следующее исправление: создать «среду интерлюдии», которая подавляет номера страниц для своего содержимого. (источник:Промежуточные страницы, которые не увеличивают общее количество страниц?)
Это работает на большинстве страниц в разделе приложений, однако на всех страницах, содержащих заголовок «Приложение», заголовок главы или заголовок библиографии, цифры все еще присутствуют. Предположительно, это встроено в команды, чтобы гарантировать, что они включены в TOC, но это не то, что меня беспокоит.
\documentclass[11pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[
backend=biber,
style=numeric,
sortlocale=de_DE,
natbib=true,
url=false,
doi=true,
eprint=false
]{biblatex}
\bibliography{references}
\usepackage[toc,page]{appendix}
%create interlude environment:
\newcounter{mypagecount}% create a new counter
\setcounter{mypagecount}{0}% set it to something just in case
\newenvironment{interlude}{% create a new environment for the unnumbered section(s)
\clearpage
\setcounter{mypagecount}{\value{page}}% use the new counter we created to hold the page count at the start of the unnumbered section
\thispagestyle{empty}% we want this page to be empty (adjust to use a modified page style)
\pagestyle{empty}% use the same style for subsequent pages in the unnumbered section
}{%
\clearpage
\setcounter{page}{\value{mypagecount}}% restore the incremented value to the official tally of pages so the page numbering continues correctly
}
\begin{document}
body of document
\begin{interlude}
\begin{appendices}
\chapter{Code Name}
\label{codename}
code
\chapter{Name of more code}
more code
\end{appendices}
\pagebreak
\printbibliography
\end{interlude}
\end{document}
Чарльз Стюарт предлагает исправление для удаления номеров со «страниц-разделителей» (он редактирует исходный код appendix.sty) — действительно, использование этого метода отменяет нумерацию страницы-разделителя приложения, но я не знаю, как изменить это также для страниц заголовков глав. https://stackoverflow.com/questions/2631973/no-page-number-for-divider-pages-in-latex
решение1
Предложение, использовать \thepage
опустошение и правильный стиль страницы. Я также, я suspended
счетчик page
, но это не очень необходимо, с моей точки зрения.
\documentclass[11pt]{report}
\usepackage{appendix}
\usepackage[
backend=biber,
style=numeric,
sortlocale=de_DE,
natbib=true,
url=false,
doi=true,
eprint=false
]{biblatex}
\usepackage{xassoccnt}
\usepackage{fancyhdr}
\bibliography{references}
\usepackage{blindtext}
\pagestyle{fancy}%
\begin{document}
\tableofcontents
\chapter{Regular chapter}
\blindtext[20]
\nocite{*}
\SuspendCounters{page}
\renewcommand{\thepage}{}
\begin{appendices}
\chapter{Code Name}
\label{codename}
\blindtext[5]
\chapter{Name of more code}
\blindtext[10]
\end{appendices}
\pagebreak
\printbibliography
\end{document}
Я использовал этот маленькийreferences.bib
@book{knuth1986texbook,
keywords = {book},
title={The texbook},
author={Knuth, D.E. and Bibby, D.},
volume={1993},
year={1986},
publisher={Addison-Wesley}
}
@article{knuth1977fast,
keywords = {article},
title={Fast pattern matching in strings},
author={Knuth, D.E. and Morris Jr, J.H. and Pratt, V.R.},
journal={SIAM journal on computing},
volume={6},
number={2},
pages={323--350},
year={1977},
publisher={SIAM}
}
решение2
Я думаю, вам не нужен appendix
ни пакет, ни interlude
среда: если вы отключите нумерацию страниц в какой-то момент (в начале приложений), вы не сможете возобновить ее позже.
\documentclass[11pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[
backend=biber,
style=numeric,
sortlocale=de_DE,
natbib=true,
url=false,
doi=true,
eprint=false
]{biblatex}
\addbibresource{biblatex-examples.bib}
% no need to load etoolbox
\makeatletter
\preto{\appendix}{%
\cleardoublepage
\pagestyle{empty}%
\let\ps@plain\ps@empty
\let\thepage\@empty
\addcontentsline{toc}{chapter}{Appendices}%
\part*{Appendices}%
}
\makeatother
\begin{document}
\tableofcontents
\chapter{Main}
body of document
\cite{weinberg}
\cite{yoon}
\appendix
\chapter{Code Name}
\label{codename}
code
\clearpage
code
\chapter{Name of more code}
more code
\clearpage
more code
\printbibliography
\end{document}
Хитрость заключается в том, чтобы сделать plain
стиль страницы, используемый на начальных страницах глав, таким же, как empty
.
В качестве отступления отметим, что \addbibresource
предпочтительнее, чем \bibliography
, когда biblatex
используется .