在下面给出的代码中,我希望能够删除附录章节名称(图中的“A”)。我希望参考文献章节像“目录”章节一样显示,即标题中只显示带有图形的名称“参考文献”。
以下是代码:
\documentclass[11pt,a4paper]{book}
\usepackage{calc}
\usepackage[left=1.5cm, right=1.5cm, bindingoffset=1.5cm, headheight=120pt, top={120pt+10mm}]{geometry}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{fourier}
\usepackage{etoolbox}
\patchcmd{\chapter}{\thispagestyle{plain}}{\thispagestyle{fancy}}{}{}
\definecolor{gmitblue}{RGB}{93,138,168}
\definecolor{line}{RGB}{70,160,216}
\usetikzlibrary{calc}
\renewcommand{\headrulewidth}{0pt}
\newcommand\hdheight{1in}
\newcommand\ftheight{.5in}
\newsavebox\headimageodd
\newsavebox\headimageeven
\newcommand*{\headimages}[3][]{%
% #1 - optional argument added to the optional argument of both \includegraphics
% #2 - name of even/left side page head image
% #3 - name of odd/right side page head image
\savebox{\headimageeven}{%
\includegraphics[height=120pt,#1]{#2}%
}%
\savebox{\headimageodd}{%
\includegraphics[height=120pt,#1]{#3}%
}%
}
\headimages{example-image-b}{example-image-a}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[O]{%
\begin{tikzpicture}[overlay, remember picture]%
\fill[gmitblue] (current page.north west) rectangle ($(current page.north east)+(0,-\hdheight)$);
\draw[line] ([yshift=-\hdheight]current page.north west) -- ([yshift=-\hdheight]current page.north east);
\ifnum\value{chapter}=0
\node[anchor=south west, text width=11.5cm, text=white, font=\fontsize{.7cm}{1.5cm}\selectfont\bfseries] at ($(current page.north west)+(.5\hdheight,-\hdheight)$) {\raggedleft\rightmark};
\else
\node[anchor=south west, text width=2cm, text=white, font=\fontsize{2cm}{1.5cm}\selectfont\bfseries] (oddpagenum) at ($(current page.north west)+(.5\hdheight,-\hdheight)$) {\thechapter};
\node[anchor=south west, text width=11.5cm, text=white, font=\fontsize{.5cm}{1.5cm}\selectfont\bfseries] (chapter) at (oddpagenum.south east) {\quad TOPIC TO BE DISCUSSED};
\fi
\node[anchor=north east, inner xsep=5mm] at (current page.north east) {\usebox\headimageodd};
\end{tikzpicture}%
}
\fancyhead[E]{%
\begin{tikzpicture}[overlay, remember picture]%
\fill[gmitblue] (current page.north west) rectangle ($(current page.north east)+(0,-\hdheight)$);
\draw[line] ([yshift=-\hdheight]current page.north west) -- ([yshift=-\hdheight]current page.north east);
\node[anchor=south east, text width=7cm, text=white, font=\fontsize{.7cm}{1.5cm}\selectfont\bfseries] (evenpagenum) at ($(current page.north east)+(-.5\hdheight,-\hdheight)$) {\raggedleft\rightmark};
\node[anchor=north west, inner xsep=5mm] at (current page.north west) {\usebox\headimageeven};
\end{tikzpicture}%
}
\fancyfoot[CE]{
\begin{tikzpicture}[overlay, remember picture]%
\fill[gmitblue] (current page.south west) rectangle ($(current page.south east)+(0,.5in)$);
\node[anchor=south west, text=white, font=\Large\bfseries, minimum size=.5in] at (current page.south west) {\thepage};
\node[anchor=south, text=white, font=\large, minimum size=.5in] at (current page.south) {\leftmark};
\node[anchor=south east, text=white, font=\large, minimum size=.5in, inner xsep=5mm] at (current page.south east) {\today};
\end{tikzpicture}%
}
\fancyfoot[CO]{
\begin{tikzpicture}[overlay, remember picture]%
\fill[gmitblue] (current page.south west) rectangle ($(current page.south east)+(0,.5in)$);
\node[anchor=south west, text=white, font=\large, minimum size=.5in, inner xsep=5mm] at (current page.south west) {\today};
\node[anchor=south, text=white, font=\large, minimum size=.5in] at (current page.south) {\leftmark};
\node[anchor=south east, text=white, font=\Large\bfseries, minimum size=.5in] at (current page.south east) {\thepage};
\end{tikzpicture}%
}
\title{A reasonably long title}
\date{\today}
\author{The author}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{}{0pt}{\Huge}
\titlespacing*{\chapter} {0pt}{20pt}{40pt}
%======================================================================================
% BIBLIOGRAPHY
%======================================================================================
\usepackage[sorting=none,sortcites=true,autopunct=true,babel=hyphen,hyperref=true,abbreviate=false,backref=true,backend=biber]{biblatex}
\addbibresource{../References/chapter1.bib}% BibTeX
\defbibheading{bibempty}{}
\newcommand*{\refname}{Bibliography}
\begin{document}
\maketitle
\tableofcontents
\listoffigures
\chapter{Problem 1}
\headimages{example-image-c}{example-image}
\section{Problem 1}
\lipsum[1]
\section{Solution 1}
\lipsum
\lipsum
\chapter{Problem 2}
\headimages{example-image-a}{example-image-b}
\section{Problem 2}
\lipsum[1]
\appendix
\chapter{Answer 1}
\lipsum[1]
\cleardoublepage
\chapter*{References}
\addcontentsline{toc}{chapter}{\textcolor{blue}{\bibname}}
\printbibliography[heading=bibempty]
\end{document}
答案1
在您的代码中,章节编号是硬编码的。我建议使用自己的命令来处理章节的星号版本:在这种情况下,您可以使用命令\printchapternumber
步骤1:
\newif\ifchapterwidthstar
\newcommand\printchapternumber{\ifchapterwidthstar\else\thechapter\fi}
\makeatletter
\patchcmd\@chapter{\@afterheading}{\chapterwidthstarfalse\@afterheading}{}{}
\patchcmd\@schapter{\@afterheading}{\chapterwidthstartrue\@afterheading}{}{}
\makeatother
第2步:
\node[anchor=south east, text width=7cm, text=white, font=\fontsize{.7cm}{1.5cm}\selectfont\bfseries] (evenpagenum) at ($(current page.north east)+(-.5\hdheight,-\hdheight)$) {\raggedleft\printchapternumber};
这是你的完整示例
\documentclass[11pt,a4paper]{book}
\usepackage{calc}
\usepackage[left=1.5cm, right=1.5cm, bindingoffset=1.5cm, headheight=120pt, top={120pt+10mm}]{geometry}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{fourier}
\usepackage{etoolbox}
\patchcmd{\chapter}{\thispagestyle{plain}}{\thispagestyle{fancy}}{}{}
\newif\ifchapterwidthstar
\newcommand\printchapternumber{\ifchapterwidthstar\else\thechapter\fi}
\makeatletter
\patchcmd\@chapter{\@afterheading}{\chapterwidthstarfalse\@afterheading}{}{}
\patchcmd\@schapter{\@afterheading}{\chapterwidthstartrue\@afterheading}{}{}
\makeatother
\definecolor{gmitblue}{RGB}{93,138,168}
\definecolor{line}{RGB}{70,160,216}
\usetikzlibrary{calc}
\renewcommand{\headrulewidth}{0pt}
\newcommand\hdheight{1in}
\newcommand\ftheight{.5in}
\newsavebox\headimageodd
\newsavebox\headimageeven
\newcommand*{\headimages}[3][]{%
% #1 - optional argument added to the optional argument of both \includegraphics
% #2 - name of even/left side page head image
% #3 - name of odd/right side page head image
\savebox{\headimageeven}{%
\includegraphics[height=120pt,#1]{#2}%
}%
\savebox{\headimageodd}{%
\includegraphics[height=120pt,#1]{#3}%
}%
}
\headimages{example-image-b}{example-image-a}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[O]{%
\begin{tikzpicture}[overlay, remember picture]%
\fill[gmitblue] (current page.north west) rectangle ($(current page.north east)+(0,-\hdheight)$);
\draw[line] ([yshift=-\hdheight]current page.north west) -- ([yshift=-\hdheight]current page.north east);
\ifnum\value{chapter}=0
\node[anchor=south west, text width=11.5cm, text=white, font=\fontsize{.7cm}{1.5cm}\selectfont\bfseries] at ($(current page.north west)+(.5\hdheight,-\hdheight)$) {\raggedleft\rightmark};
\else
\node[anchor=south west, text width=2cm, text=white, font=\fontsize{2cm}{1.5cm}\selectfont\bfseries] (oddpagenum) at ($(current page.north west)+(.5\hdheight,-\hdheight)$) {\printchapternumber};
\node[anchor=south west, text width=11.5cm, text=white, font=\fontsize{.5cm}{1.5cm}\selectfont\bfseries] (chapter) at (oddpagenum.south east) {\quad TOPIC TO BE DISCUSSED};
\fi
\node[anchor=north east, inner xsep=5mm] at (current page.north east) {\usebox\headimageodd};
\end{tikzpicture}%
}
\fancyhead[E]{%
\begin{tikzpicture}[overlay, remember picture]%
\fill[gmitblue] (current page.north west) rectangle ($(current page.north east)+(0,-\hdheight)$);
\draw[line] ([yshift=-\hdheight]current page.north west) -- ([yshift=-\hdheight]current page.north east);
\node[anchor=south east, text width=7cm, text=white, font=\fontsize{.7cm}{1.5cm}\selectfont\bfseries] (evenpagenum) at ($(current page.north east)+(-.5\hdheight,-\hdheight)$) {\raggedleft\rightmark};
\node[anchor=north west, inner xsep=5mm] at (current page.north west) {\usebox\headimageeven};
\end{tikzpicture}%
}
\fancyfoot[CE]{
\begin{tikzpicture}[overlay, remember picture]%
\fill[gmitblue] (current page.south west) rectangle ($(current page.south east)+(0,.5in)$);
\node[anchor=south west, text=white, font=\Large\bfseries, minimum size=.5in] at (current page.south west) {\thepage};
\node[anchor=south, text=white, font=\large, minimum size=.5in] at (current page.south) {\leftmark};
\node[anchor=south east, text=white, font=\large, minimum size=.5in, inner xsep=5mm] at (current page.south east) {\today};
\end{tikzpicture}%
}
\fancyfoot[CO]{
\begin{tikzpicture}[overlay, remember picture]%
\fill[gmitblue] (current page.south west) rectangle ($(current page.south east)+(0,.5in)$);
\node[anchor=south west, text=white, font=\large, minimum size=.5in, inner xsep=5mm] at (current page.south west) {\today};
\node[anchor=south, text=white, font=\large, minimum size=.5in] at (current page.south) {\leftmark};
\node[anchor=south east, text=white, font=\Large\bfseries, minimum size=.5in] at (current page.south east) {\thepage};
\end{tikzpicture}%
}
\title{A reasonably long title}
\date{\today}
\author{The author}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{}{0pt}{\Huge}
\titlespacing*{\chapter} {0pt}{20pt}{40pt}
%======================================================================================
% BIBLIOGRAPHY
%======================================================================================
\usepackage[sorting=none,sortcites=true,autopunct=true,babel=hyphen,hyperref=true,abbreviate=false,backref=true,backend=biber]{biblatex}
\addbibresource{../References/chapter1.bib}% BibTeX
\defbibheading{bibempty}{}
\newcommand*{\refname}{Bibliography}
\begin{document}
\maketitle
\tableofcontents
\listoffigures
\chapter{Problem 1}
\headimages{example-image-c}{example-image}
\section{Problem 1}
\lipsum[1]
\section{Solution 1}
\lipsum
\lipsum
\chapter{Problem 2}
\headimages{example-image-a}{example-image-b}
\section{Problem 2}
\lipsum[1]
\appendix
\chapter{Answer 1}
\lipsum[1]
\cleardoublepage
\chapter*{References}
\markboth{}{}
\addcontentsline{toc}{chapter}{\textcolor{blue}{\bibname}}
\printbibliography[heading=bibempty]
\chapter{Answer 1}
\lipsum[1]
\end{document}