对于我的博士论文,我想使用章节缩略图。我发现一些代码提供了此功能,并且我已经能够进行一些更改(标记的大小和颜色、文本的颜色)。但是,我不知道如何进行我想要的所有更改。我该如何:
- 仅显示拇指标记中的章节编号?
- 将第 1 章的标记放低一点(在当前第 2 章标记的位置)?
。
\documentclass[10pt,twoside,openright]{book}
\usepackage{geometry}
\geometry{
vmarginratio=7:5,
hmarginratio=1:1,
papersize={170mm,240mm},
total={130mm,190mm}
}
\usepackage[T1]{fontenc}
% package voor de laatste versie van het standaard lettertype
\usepackage{lmodern}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{lipsum}
\pagestyle{plain}
% auxiliary counter
\newcounter{chapshift}
\addtocounter{chapshift}{-1}
% the list of colors to be used (add more if needed)
\newcommand\BoxColor{%
\ifcase\thechapshift gray!30\else gray!30\fi}
% redefinition of \chaptermark to contain only the title
\renewcommand\chaptermark[1]{\markboth{\thechapter.~#1}{}}
%======================================================================================
% PAGE HEADERS
%======================================================================================
\usepackage{etoolbox,fancyhdr} % Required for header and footer configuration
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\sffamily\normalsize\bfseries \ #1}{}} % Chapter text font settings
\renewcommand{\sectionmark}[1]{\markright{\sffamily\normalsize\thesection\hspace{5pt}#1}{}} % Section text font settings
\fancyhf{} \fancyhead[LE,RO]{\sffamily\normalsize\thepage} % Font setting for the page number in the header
\fancyhead[LO]{\rightmark%
\begin{tikzpicture}[overlay,remember picture]
\node[fill=\BoxColor,inner sep=0pt,rectangle,text width=1cm,
text height=2cm,align=center,anchor=north east]
at ($ (current page.north east) + (-0cm,-2*\thechapshift cm) $)
{\rotatebox{90}{\parbox{2cm}{%
\centering\textcolor{white}{\scshape\leftmark}}}};
\end{tikzpicture}} % Print the nearest section name on the left side of odd pages
\fancyhead[RE]{\leftmark%
\begin{tikzpicture}[overlay,remember picture]
\node[fill=\BoxColor,inner sep=0pt,rectangle,text width=1cm,
text height=2cm,align=center,anchor=north west]
at ($ (current page.north west) + (-0cm,-2*\thechapshift cm) $)
{\rotatebox{90}{\parbox{2cm}{%
\centering\textcolor{white}{\scshape\leftmark}}}};
\end{tikzpicture}} % Print the current chapter name on the right side of even pages
\renewcommand{\headrulewidth}{0pt} % Width of the rule under the header
\addtolength{\headheight}{2.5pt} % Increase the spacing around the header slightly
% \newcommand{\headrulecolor}[1]{\patchcmd{\headrule}{\hrule}{\color{#1}\hrule}{}{}}
% \headrulecolor{blue!70}% Set header rule colour to 70% red.
\newcommand{\footrulecolor}[1]{\patchcmd{\footrule}{\hrule}{\color{#1}\hrule}{}{}}
\renewcommand{\footrulewidth}{0pt} % Removes the rule in the footer
\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}} % Style for when a plain pagestyle is specified
% Removes the header from odd empty pages at the end of chapters
\makeatletter
\renewcommand{\cleardoublepage}{
\clearpage\ifodd\c@page\else
\hbox{}
\vspace*{\fill}
\thispagestyle{empty}
\newpage
\fi}
\patchcmd{\@makechapterhead}
{\vskip 40\p@}
{\vskip 40\p@\stepcounter{chapshift}}{}{}
\makeatother
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter{Introduction}
\lipsum[1-7]
\section{This is how we do it}
\lipsum[1-7]
\chapter{Results}
\lipsum[1-7]
\appendix
\renewcommand{\thesection}{Appendix \Alph{chapter}.\arabic{section}}
\renewcommand\chaptermark[1]{\markboth{\sffamily\normalsize\bfseries \appendixname~\thechapter}{}}
\chapter{Appendices for Chapter 1}
Here we present two subappendices.
\cleardoublepage
\section{Training delivery methods}
\thispagestyle{plain}
\lipsum[1-8]
\cleardoublepage
\section{This is how we do it too}
\thispagestyle{plain}
\lipsum[1-8]
\end{document}
答案1
经过一番努力,我找到了问题的答案。
如何在拇指标记中仅显示章节编号?
这是通过查找代码(两次)来完成的
\centering\textcolor{white}{\scshape\leftmark}}}};
并替换\leftmark
为\thechapter
。
我如何将第 1 章的标记放得稍微低一些(在当前第 2 章标记的位置)?
这是通过玩弄的价值来实现的chapshift
。
% auxiliary counter
\newcounter{chapshift}
\addtocounter{chapshift}{-1}
将 -1 更改为 0 或更大的数字会使标记向下移动。
要使标记更小,以便页面上能容纳更多标记,请使用text height=2cm
和\parbox{2cm}
。您应该保持这些值相同。