我正在排版一本有章节的书。使用 TeXShop。使用 imakeidx。我希望目录中的索引不带章节编号。现在一切都很好,只是我得到的不是索引顶部的标题“索引”,而是
第四部分
指数
在打印索引时,标题是指数在偶数页上,并且指数奇数。
这是我的主要文件(我省略了我认为不相关的内容。这应该运行并显示第一个问题)
\documentclass[12pt]{book}
\renewcommand{\thechapter}{\Roman{chapter}}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancypagestyle{MyStyle}{%
\fancyhead{} %Clean headers
\fancyhead[RO]{\slshape\nouppercase{\rightmark}}
\fancyhead[LE]{\leftmark}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter. {\slshape{##1}}}{}}
}
\usepackage[explicit]{titlesec}
\let\subsection\section
\let\section\chapter
\usepackage{graphicx}
\usepackage{caption}\usepackage{endnotes}
\usepackage{subcaption}
\usepackage{imakeidx}
\usepackage{url}
\usepackage{booktabs}
\usepackage{hyperref}
\usepackage[table]{xcolor}
%...
\newcommand{\vs}{\vspace{.1in}}
\newcommand{\ds}{\displaystyle}
\newcommand\mychap{%
\titleformat{\chapter}[display]
{\normalfont \Huge \bfseries}{}{0pt}
{ Section \thechapter\\ ##1}%
}
\newcommand{\figc}[1]{Fig. I.~\ref{#1}}
\newcommand{\figca}[1]{I.~\ref{#1}}
\newcommand{\figcb}[1]{II.~\ref{#1}}
\newcommand{\figcc}[1]{III.~\ref{#1}}
\newcommand{\figcd}[1]{IV.~\ref{#1}}
%...
\addcontentsline{toc}{chapter}{\protect\numberline{Introduction}}
%...
\makeatother
\makeindex[columns=2, title=Index, intoc]
\begin{document}
\pagestyle{plain}
\frontmatter
\mainmatter
\newpage
$~$
\pagestyle{MyStyle}
\mychap
\renewcommand{\figc}[1]{Fig.\ IV.~\ref{#1}}
\renewcommand{\figurename}{Fig.\ IV.}
\renewcommand\thefigure{\arabic{figure}}
\setcounter{figure}{0}
\input{Stack-Part-IV}
\printindex
\end{document}
下面是Stack-Part-IV.tex
:
\fontfamily{ppl}\selectfont{
\mychap
\section{Verrocchio's non-figural sculptures}
Sample text with endnote\endnote{This would be an endnote} and an index entry\index{Entry, index}.
}
\newpage
\subsection{Picture credits for Section IV}
\fontfamily{cmr}\selectfont{
Stand-in for picture credit.
}
\theendnotes
答案1
为了解决第一个问题,您可以像之前所做的那样再添加一个\titleformat
,\printindex
例如\mychap
:
\titleformat{\chapter}[display]{\normalfont\Huge\bfseries}{0}{0pt}{##1}
第二个问题是由于\nouppercase
您对页面样式的定义MyStyle
。因此恕我直言,您也需要更改它,例如,对于INDEX
奇数页和偶数页:
\fancypagestyle{MyBackStyle}{%
\fancyhead{} %Clean headers
\fancyhead[RO]{\slshape\rightmark}%
\fancyhead[LE]{\leftmark}%
\renewcommand{\chaptermark}%[1]{\markboth{\thechapter. {\slshape{##1}}}{}}
}
全部一起:
\begin{filecontents*}{Stack-Part-IV.tex}
\fontfamily{ppl}\selectfont{
\mychap
\section{Verrocchio's non-figural sculptures}
Sample text with endnote\endnote{This would be an endnote} and an index entry\index{Entry, index}.
}
\newpage
\subsection{Picture credits for Section IV}
\fontfamily{cmr}\selectfont{
Stand-in for picture credit.
}
\theendnotes
\end{filecontents*}
\documentclass[12pt]{book}
\renewcommand{\thechapter}{\Roman{chapter}}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancypagestyle{MyStyle}{%
\fancyhead{} %Clean headers
\fancyhead[RO]{\slshape\nouppercase{\rightmark}}%
\fancyhead[LE]{\leftmark}%
\renewcommand{\chaptermark}[1]{\markboth{\thechapter. {\slshape{##1}}}{}}%
}
\fancypagestyle{MyBackStyle}{%
\fancyhead{} %Clean headers
\fancyhead[RO]{\slshape\rightmark}%
\fancyhead[LE]{\leftmark}%
\renewcommand{\chaptermark}[1]{\markboth{\thechapter. {\slshape{##1}}}{}}%
}
\usepackage[explicit]{titlesec}
\let\subsection\section
\let\section\chapter
\usepackage{graphicx}
\usepackage{caption}\usepackage{endnotes}
\usepackage{subcaption}
\usepackage{imakeidx}
\usepackage{url}
\usepackage{booktabs}
\usepackage{hyperref}
\usepackage[table]{xcolor}
%...
\newcommand{\vs}{\vspace{.1in}}
\newcommand{\ds}{\displaystyle}
\newcommand\mychap{%
\titleformat{\chapter}[display]
{\normalfont \Huge \bfseries}{}{0pt}
{ Section \thechapter\\ ##1}%
}
\newcommand\backchap{%
\titleformat{\chapter}[display]{\normalfont\Huge\bfseries}{0}{0pt}{##1}}
\newcommand{\figc}[1]{Fig. I.~\ref{#1}}
\newcommand{\figca}[1]{I.~\ref{#1}}
\newcommand{\figcb}[1]{II.~\ref{#1}}
\newcommand{\figcc}[1]{III.~\ref{#1}}
\newcommand{\figcd}[1]{IV.~\ref{#1}}
%...
\addcontentsline{toc}{chapter}{\protect\numberline{Introduction}}
%...
\makeatother
\makeindex[columns=2, title=Index, intoc]
\begin{document}
\pagestyle{plain}
\frontmatter
\mainmatter
\newpage
$~$
\pagestyle{MyStyle}
\mychap
\renewcommand{\figc}[1]{Fig.\ IV.~\ref{#1}}
\renewcommand{\figurename}{Fig.\ IV.}
\renewcommand\thefigure{\arabic{figure}}
\setcounter{figure}{0}
\input{Stack-Part-IV}
\clearpage
\backchap
\pagestyle{MyBackStyle}
\printindex
\clearpage
one more index fake page
\clearpage
one more index fake page
\end{document}