删除附录的页码

删除附录的页码

我正在尝试从附录部分删除所有页码。建议采用以下修复方法:创建一个“间奏环境”,以隐藏其内容的页码。(来源:中间的页面没有添加到页数中?

这适用于附录部分中的大多数页面,但是,在包含附录标题、章节标题或参考书目标题的所有页面上,数字仍然存在。据推测,这是内置在命令中的,以确保它们包含在目录中,但这不是我介意的事情。

\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}

查尔斯斯图尔特 (Charles Stewart) 在此建议了一种修复方法,即从“分隔页”中删除数字(他编辑了 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要优于。\bibliographybiblatex

在此处输入图片描述

相关内容