使用Legrand 橙皮书模板,我想将附录从 A 重新编号。
\documentclass[11pt,fleqn]{book}
\usepackage[top=3cm,bottom=3cm,left=3.2cm,right=3.2cm,headsep=10pt,a4paper]{geometry}
\usepackage{lipsum, fancyhdr}
\usepackage[svgnames]{xcolor}
\definecolor{ocre}{RGB}{243,102,25}
\definecolor{mygray}{RGB}{243,243,244}
\usepackage{avant}
\usepackage{mathptmx}
\usepackage{microtype}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{calc}
\usepackage{textcomp}
\usepackage[refsection=chapter,defernumbers=true,sorting=none,sortcites=true,autopunct=true,babel=hyphen,abbreviate=false,backref=true,backend=biber]{biblatex}
\defbibheading{bibempty}{}
\usepackage{empheq}
\usepackage[font={color=ocre,bf},figurename=Fig.,labelfont={it}]{caption}
\usepackage[framemethod=default]{mdframed}
\usepackage{mathtools}
\usepackage[most]{tcolorbox}
\tcbset{myformula/.style={
arc=0pt,
outer arc=0pt,
%colback=ocre!10,
colback=mygray,
colframe=ocre,
boxrule=0.8pt,
left=2pt,
right=2pt,
highlight math style={
arc=0pt,
outer arc=0pt,
colback=mygray,
colframe=red.
}
}
}
\newenvironment{spread}[1]{%
\advance\jot#1% indeed
}{%
\ignorespacesafterend
}
\usepackage[T1]{fontenc}
\usepackage[numbered,framed]{matlab-prettifier}
\newcommand\ph\mlplaceholder
\makeatletter
\renewcommand\phOpDelim@mlpr{$\langle$}
\renewcommand\phClDelim@mlpr{$\rangle$}
\makeatother
\usepackage{caption}
\usepackage[font={color=ocre,bf,it},figurename=Fig.,labelfont={it}]{caption}
\newcommand{\figref}[2][]{% \figref[<sub-figref>]{<figref>}
\textcolor{ocre}{\bfseries\emph{\figurename\,\ref{#2}#1}}}
\usepackage{calc}
\usepackage{makeidx}
\makeindex
\input{structure_nofrtmatter}
\newcommand*{\refname}{Bibliography}
\begin{document}
\setcounter{secnumdepth}{3}
\frontmatter
\begingroup
\thispagestyle{empty}
\centering
\vspace*{9cm}
\par\normalfont\fontsize{35}{35}\sffamily\selectfont
Test Book\par
\vspace*{1cm}
{\Huge Author}\par
\endgroup
\chapterimage{chapter_head_1}
\pagestyle{empty}
\tableofcontents
\mainmatter
\chapter{One}
\section{One}
\lipsum[1]
\chapter{Two}
\section{One}
\lipsum
\backmatter
\chapter{Appendix 1}
\section{One}
\lipsum
\chapter{Appendix 2}
\section{One}
\lipsum
\cleardoublepage
\setlength{\columnsep}{0.75cm}
\addcontentsline{toc}{chapter}{\textcolor{ocre}{Index}}
\printindex
\end{document}
目前,各\backmatter
章的编号都保留了上一章的编号\mainmatter
。如何使用 Alpha Chapter 标识符重新编号附录章节。第一个附录章节应显示 A. 附录 1,章节编号应从 A.1 开始,等等。
答案1
编辑:请参阅本答案末尾的更好的版本。
\renewcommand{\thechapter}{\Alph{chapter}}
之后使用即可\backmatter
。但在我看来,\backmatter
在这里没有用。
\documentclass[11pt,fleqn]{book}
\usepackage[top=3cm,bottom=3cm,left=3.2cm,right=3.2cm,headsep=10pt,a4paper]{geometry}
\usepackage{lipsum, fancyhdr}
\usepackage[svgnames]{xcolor}
\definecolor{ocre}{RGB}{243,102,25}
\definecolor{mygray}{RGB}{243,243,244}
\usepackage{avant}
\usepackage{mathptmx}
\usepackage{microtype}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{calc}
\usepackage{textcomp}
\usepackage[refsection=chapter,defernumbers=true,sorting=none,sortcites=true,autopunct=true,babel=hyphen,abbreviate=false,backref=true,backend=biber]{biblatex}
\defbibheading{bibempty}{}
\usepackage{empheq}
\usepackage[font={color=ocre,bf},figurename=Fig.,labelfont={it}]{caption}
\usepackage[framemethod=default]{mdframed}
\usepackage{mathtools}
\usepackage[most]{tcolorbox}
\tcbset{myformula/.style={
arc=0pt,
outer arc=0pt,
%colback=ocre!10,
colback=mygray,
colframe=ocre,
boxrule=0.8pt,
left=2pt,
right=2pt,
highlight math style={
arc=0pt,
outer arc=0pt,
colback=mygray,
colframe=red.
}
}
}
\newenvironment{spread}[1]{%
\advance\jot#1% indeed
}{%
\ignorespacesafterend
}
\usepackage[T1]{fontenc}
\usepackage[numbered,framed]{matlab-prettifier}
\newcommand\ph\mlplaceholder
\makeatletter
\renewcommand\phOpDelim@mlpr{$\langle$}
\renewcommand\phClDelim@mlpr{$\rangle$}
\makeatother
\usepackage{caption}
\usepackage[font={color=ocre,bf,it},figurename=Fig.,labelfont={it}]{caption}
\newcommand{\figref}[2][]{% \figref[<sub-figref>]{<figref>}
\textcolor{ocre}{\bfseries\emph{\figurename\,\ref{#2}#1}}}
\usepackage{calc}
\usepackage{makeidx}
\makeindex
%\input{structure_nofrtmatter}
\newcommand*{\refname}{Bibliography}
\begin{document}
\setcounter{secnumdepth}{3}
\frontmatter
\begingroup
\thispagestyle{empty}
\centering
\vspace*{9cm}
\par\normalfont\fontsize{35}{35}\sffamily\selectfont
Test Book\par
\vspace*{1cm}
{\Huge Author}\par
\endgroup
%\chapterimage{chapter_head_1}
\pagestyle{empty}
\tableofcontents
\mainmatter
\chapter{One}
\section{One}
\lipsum[1]
\chapter{Two}
\section{One}
\lipsum
\backmatter
\renewcommand{\thechapter}{\Alph{chapter}}
\chapter{Appendix 1}
\section{One}
\lipsum
\chapter{Appendix 2}
\section{One}
\lipsum
\cleardoublepage
\setlength{\columnsep}{0.75cm}
\addcontentsline{toc}{chapter}{\textcolor{ocre}{Index}}
\printindex
\end{document}
更新进行了一些改进,\backmatter
用一个\appendix
略微改变章节标题设置的命令来代替。
\appendix
通过宏设计切换到 alpha 计数。
\documentclass[11pt,fleqn]{book}
\usepackage[top=3cm,bottom=3cm,left=3.2cm,right=3.2cm,headsep=10pt,a4paper]{geometry}
\usepackage{lipsum}
\usepackage{fancyhdr}
\usepackage[svgnames]{xcolor}
\definecolor{ocre}{RGB}{243,102,25}
\definecolor{mygray}{RGB}{243,243,244}
\usepackage{avant}
\usepackage{mathptmx}
\usepackage{microtype}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[refsection=chapter,defernumbers=true,sorting=none,sortcites=true,autopunct=true,babel=hyphen,abbreviate=false,backref=true,backend=biber]{biblatex}
\defbibheading{bibempty}{}
\usepackage{empheq}
\usepackage[font={color=ocre,bf},figurename=Fig.,labelfont={it}]{caption}
\usepackage[framemethod=default]{mdframed}
\usepackage{mathtools}
\usepackage[most]{tcolorbox}
\tcbset{myformula/.style={
arc=0pt,
outer arc=0pt,
%colback=ocre!10,
colback=mygray,
colframe=ocre,
boxrule=0.8pt,
left=2pt,
right=2pt,
highlight math style={
arc=0pt,
outer arc=0pt,
colback=mygray,
colframe=red.
}
}
}
\newenvironment{spread}[1]{%
\advance\jot#1% indeed
}{%
\ignorespacesafterend
}
\usepackage[numbered,framed]{matlab-prettifier}
\newcommand\ph\mlplaceholder
\makeatletter
\renewcommand\phOpDelim@mlpr{$\langle$}
\renewcommand\phClDelim@mlpr{$\rangle$}
\makeatother
\usepackage{caption}
\newcommand{\figref}[2][]{% \figref[<sub-figref>]{<figref>}
\textcolor{ocre}{\bfseries\emph{\figurename\,\ref{#2}#1}}}
\usepackage{calc}
\usepackage{makeidx}
\usepackage[nottoc]{tocbibind}
\makeindex
%\input{structure_nofrtmatter}
\newcommand*{\refname}{Bibliography}
\usepackage{xpatch}
\usepackage{chngcntr}
\makeatletter
\xapptocmd{\appendix}{%
\@mainmattertrue
\xpatchcmd{\@makechapterhead}{%
\Huge \bfseries #1\par\nobreak
}{%
}{\typeout{success}}{}%
\xpatchcmd{\@makechapterhead}{%
\huge\bfseries \@chapapp\space \thechapter
\par\nobreak
\vskip 20\p@
}{%
\huge\bfseries \thechapter. #1
\par\nobreak
\vskip 20\p@ % can be reduced!
}{\typeout{success}}{}%
}{}{}
\makeatother
\begin{document}
\setcounter{secnumdepth}{3}
\frontmatter
\begingroup
\thispagestyle{empty}
\centering
\vspace*{9cm}
\par\normalfont\fontsize{35}{35}\sffamily\selectfont
Test Book\par
\vspace*{1cm}
{\Huge Author}\par
\endgroup
%\chapterimage{chapter_head_1}
\pagestyle{empty}
\tableofcontents
\mainmatter
\chapter{One}
\index{sometest}
\section{One}
\lipsum[1]
\chapter{Two}
\section{One}
\lipsum
\appendix
\chapter{Appendix 1}
\section{One}
\lipsum
\chapter{Appendix 2}
\section{One}
\index{sometextfromappendix2}
\lipsum
\cleardoublepage
\setlength{\columnsep}{0.75cm}
\setindexname{\textcolor{ocre}{Index}}
\printindex
\end{document}