我正在尝试生成一份报告文档,我想在其中添加一个单独的章节标题页,如 CFR 所示https://tex.stackexchange.com/a/183613/45116。
她的代码对我来说是可行的,但我遇到了一些麻烦,因为我有 chapterthumbs。问题是在章节标题页上,我得到的 chapterthumb 的章节号是错误的。例如,在第 1 章的标题页上,chapterthumb 显示的是第 0 章。
我会接受以下任何一种情况:1. 从(仅)章节标题页中删除 chapterthumb 或 2. 在章节标题页上有正确的 chapterthumb
下面是我的代码:
\documentclass[11pt,a4paper,openright,twoside]{report}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
%\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[document]{ragged2e}
\usepackage{pdfpages}
\usepackage[paperheight=24cm,paperwidth=17cm,left=2.5cm,right=2cm,top=2cm,bottom=2cm, footskip=1cm]{geometry}
\usepackage{blindtext}
\usepackage{lipsum}
\usepackage{indentfirst}
\setlength\parindent{1cm}
\usepackage{CormorantGaramond}
\usepackage[T1]{fontenc}
% Adding box to the chapter
\usepackage{rotating}
\usepackage{eso-pic,xcolor}
\definecolor{chapterthumbbg}{HTML}{6F7170}
\AddToShipoutPictureFG{%
\AtPageLowerLeft{%
\ifshowchapterthumb\ifodd\value{page}
\makebox[\paperwidth][r]{%
\raisebox{\dimexpr.5\paperheight-.5\height}{%
\setlength{\fboxsep}{\baselineskip}%
\colorbox{chapterthumbbg}{\textcolor{white}{\begin{turn}{0}\textbf{{\LARGE \thechapter}}\end{turn}}}%
}%
}%
\else\fi\fi
}
}
\newif\ifshowchapterthumb
\renewcommand{\baselinestretch}{1.1}
\newcommand*\chem[1]{\ensuremath{\mathrm{#1}}}
\renewcommand{\theequation}{Eq. \arabic{equation}}
%%
\usepackage{xparse, adforn}
\let\origchapter\chapter
\DeclareDocumentCommand\chapter{s o m}{%
\IfNoValueTF{#2}{\def\myshortchtitle{#3}}{\def\myshortchtitle{#2}}%
\clearpage
\thispagestyle{empty}%
\vspace*{.25\textheight}%
{\centering
\stepcounter{chapter}%
\LARGE\bfseries
\IfBooleanTF{#1}{%
\phantom{\chaptername\ \thechapter}}{%
\chaptername\ \thechapter}\par
\vskip .025\textheight
\Huge #3\par
\adforn{22}\adforn{50}\par}
\addtocounter{chapter}{-1}%
\clearpage
\IfBooleanTF{#1}{%
\origchapter*{#3}}{%
\origchapter[\myshortchtitle]{#3}}}
%%
\begin{document}
%\showchapterthumbfalse
%
%\input{Frontmatter/Title}
%\pagebreak
%\input{Frontmatter/committe}
%\pagebreak
%\input{Frontmatter/official_title}
%\pagebreak
%\input{Frontmatter/approvedby}
%\newpage
%\thispagestyle{empty}
%\mbox{}
\let\oldchapter\chapter% if you don't want the ToC to have a page before it
\let\chapter\origchapter% if you don't want the ToC to have a page before it
\tableofcontents
\let\chapter\oldchapter% if you don't want the ToC to have a page before it
%\newpage
%\thispagestyle{empty}
%\mbox{}
\part{Name 1}
\showchapterthumbtrue
\chapter{First chapter}\lipsum[1-5]
\section{First section}\lipsum[6-10]
\section{Second section}\lipsum[11-15]
\section{Third section}\lipsum[16-20]
\section{Last section}\lipsum[21-27]
\newpage
\thispagestyle{empty}
\mbox{}
\showchapterthumbfalse
\showchapterthumbtrue
\chapter{Second chapter}\lipsum[1-5]
\section{First section}\lipsum[6-10]
\section{Second section}\lipsum[11-15]
\section{Third section}\lipsum[16-20]
\section{Last section}\lipsum[21-25]
\showchapterthumbfalse
\part{Name 2}
\showchapterthumbtrue
\chapter{Third chapter}\lipsum[1-5]
\section{First section}\lipsum[6-10]
\section{Second section}\lipsum[11-15]
\section{Third section}\lipsum[16-20]
\section{Last section}\lipsum[21-25]
\chapter{Last chapter}\lipsum[1-5]
\section{First section}\lipsum[6-10]
\section{Second section}\lipsum[11-15]
\section{Third section}\lipsum[16-20]
\section{Last section}\lipsum[21-25]
\showchapterthumbfalse
%\include{Mainmatter/Chapter_1}
%%\newpage
%%\thispagestyle{empty}
%%\mbox{}
%\include{Mainmatter/Chapter_2}
%%\newpage
%%\thispagestyle{empty}
%%\mbox{}
%
%\part{Name}
%\include{Mainmatter/Chapter_3}
\end{document}
如能就此问题提供一些帮助,我们将不胜感激。:) 提前致谢。