如何应用仅附录的页码:A1(第一页,第一个附录),B6(第六页,附录 B)?

如何应用仅附录的页码:A1(第一页,第一个附录),B6(第六页,附录 B)?

我试图让我的附录按其章节字母编号,然后根据特定附录的页码编号。例如,第一个附录的第三页编号为 A3,附录 B 的第一页编号为 B1,附录 Q 的第十一页编号为 Q11。

\documentclass{book}

\usepackage[top=2cm, bottom=3cm, left=3.5cm, right=3.5cm, a4paper]{geometry} %margins
\usepackage{setspace}
\onehalfspacing % 1.15 line distance
\setlength{\parskip}{8pt} % 8pt paragraph distance
\setlength{\parindent}{0pt} % Remove the indentation from the beginning of the paragraphs

\usepackage{fontspec} % compile w/XeLaTeX
\setmainfont{Perpetua}

\usepackage[style=apa, backend=biber, useprefix=false]{biblatex}
\AtEveryCitekey{\toggletrue{blx@useprefix}}
\setlength\bibitemsep{\baselineskip}
\bibliography{main.bib}
\addbibresource{main.bib}

\usepackage{titlesec} % for customising chapter titles
\newfontfamily\verdana{Verdana}

\usepackage{xcolor} 
\usepackage[xindy,toc,nopostdot]{glossaries} %numberedsection=nameref,
\makeglossaries % Make LaTeX produce the files required to compile the glossary

\makeatletter % https://tex.stackexchange.com/questions/18604/chapter-formatting
\def\@makechapterhead#1{%
  {\parindent \z@ \raggedright \verdana\fontsize{14pt}{0pt}\bfseries
    \ifnum \c@secnumdepth >\m@ne
        \thechapter.\ % <-- Chapter # (without "Chapter")
    \fi
    \interlinepenalty\@M
    #1\par\nobreak% <------------------ Chapter title
    \vskip 12pt% <------------------ Space between chapter title and first paragraph
  }}
\makeatother

\titleformat{\section} % specifies the format for the section headings
{\fontsize{12pt}{14.4pt}\selectfont\verdana\bfseries} % font size and family to Verdana 12pt
{\thesection}{1em}{} % {spacing between the section number and the title, which is set to 1em}{format for the section title, left blank}
\titlespacing{\section}{0pt}{18pt}{6pt}

\titleformat{\subsection}
{\fontsize{13pt}{15.6pt}\selectfont\bfseries\fontspec{Perpetua}}{\thesubsection}{1em}{}
\titlespacing{\section}{0pt}{12pt}{6pt}

\titleformat{\subsubsection}
{\fontsize{12pt}{14.4pt}\selectfont\fontspec{Perpetua}}{\thesubsubsection}{1em}{\underline}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} % clear all header and footer fields
\renewcommand{\headrule}{} % Remove the horizontal line from the header
\fancyfoot[C]{\fontfamily{ppl}\fontsize{11}{13}\selectfont\thepage} % set the footer centred and using Perpetua 11 font

\usepackage{etoolbox} % for patching \appendix
\makeatletter
\patchcmd{\appendix}{\@mainsect}{\@appendixsect}{}{}
\patchcmd{\@chapter}{\global\@topnum}{\global\@topnum\m@ne}{}{}
\makeatother

\newcommand{\specialpage}{%
  \newpage%
  \begingroup%
  \pagenumbering{gobble}% change to gobble page numbering style
  %\renewcommand{\headrulewidth}{0pt}%
  \vspace*{-2cm}%
  \centerline{\textcolor[HTML]{676767}{\fontsize{11pt}{13.2pt}\selectfont \textit{This page is special}}}%
  \vspace*{\fill}%
  \thispagestyle{empty}% remove page number
  \endgroup%
  \clearpage%
  \pagenumbering{roman}% switch back to a normal page numbering style
}

\begin{document}
\fontsize{13pt}{15.6pt}\selectfont

\frontmatter
    \pagenumbering{roman} % Change page numbering to lowercase Roman numerals
    \specialpage
    \newpage % Continue with your main document
    \input{chapters/preface.tex}
    \input{chapters/abstract.tex}
    % There needs to be an empty page here.
    \tableofcontents
    \listoffigures
    \listoftables
    \lstlistoflistings
    \input{glossary.tex} % Include the glossary definitions
\mainmatter
    \pagenumbering{arabic}
    \setcounter{page}{1} % Reset page counter to 1
    \input{chapters/1. introduction.tex}
    \newpage
    \printbibliography
\appendix
    % Redefine the header and footer for the appendix
    %\fancyhead{} % clear all header fields
    %\fancyfoot[C]{\fontfamily{ppl}\fontsize{11}{13}\selectfont\thepage} % set the footer centred and using Perpetua 11 font
    \renewcommand{\thechapter}{\Alph{chapter}}
    \setcounter{chapter}{0}
    \input{chapters/app - people.tex}
    \input{chapters/app - design.tex}

\end{document}

有什么想法吗?

答案1

我将删除所有不必要的部分,集中精力解决实际问题。

但是,请删除\pagenumbering{roman}之后\frontmatter\pagenumbering{arabic}\setcounter{page}{1}之后\mainmatter,因为相应的说明是已经执行。

\documentclass{book}

\usepackage[a5paper]{geometry} % just for smaller pages
\usepackage{kantlipsum} % for filler text

\newcommand{\appendixchapter}{%
  \cleardoublepage
  \setcounter{page}{1}%
  \renewcommand{\thepage}{\thechapter\arabic{page}}%
  \chapter
}

\begin{document}

\frontmatter

\tableofcontents

\mainmatter

\chapter{First}

\kant

\appendix

\appendixchapter{First appendix}

\kant

\appendixchapter{Second appendix}

\kant

\appendixchapter{Third appendix}

\kant

\end{document}

在此处输入图片描述

\fontsize如果你确实想要 13pt 大小,则无需声明,只需执行

\usepackage[fontsize=13pt]{fontsize}

稍微不同的方法,不需要附录的特殊命令。

\documentclass{book}

\usepackage[a5paper]{geometry} % just for smaller pages
\usepackage{kantlipsum} % for filler text

\newcommand{\doappendixchapter}{%
  \cleardoublepage
  \setcounter{page}{1}%
  \renewcommand{\thepage}{\thechapter\arabic{page}}%
}
\AddToHook{cmd/appendix/after}{%
  \AddToHook{cmd/chapter/before}{\doappendixchapter}%
}

\begin{document}

\frontmatter

\tableofcontents

\mainmatter

\chapter{First}

\kant

\appendix

\chapter{First appendix}

\kant

\chapter{Second appendix}

\kant

\chapter{Third appendix}

\kant

\end{document}

相关内容