從附錄中刪除頁碼

從附錄中刪除頁碼

我正在嘗試從附錄部分中刪除所有頁碼。建議進行以下修復:創建一個“插曲環境”,抑制其內容的頁碼。 (來源:不增加頁數的中間頁?

這適用於附錄部分的大多數頁面,但是,在包含附錄標題、章節標題或參考書目標題的所有頁面上,數字仍然存在。據推測,這是內建在命令中的,以確保它們包含在目錄中,但這不是我介意的。

\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, is 優於, 。\bibliographybiblatex

在此輸入影像描述

相關內容