我有以下文档。我想将索引页的标题居中。问题是,在目录中,这个标题居中了,这是不理想的(见下图)。有办法解决这个问题吗?
\documentclass[10pt]{book}
\usepackage{makeidx}
\makeindex
\renewcommand*{\indexname}{\makebox[1.0\linewidth]{my index name}}
\begin{document}
\tableofcontents
\chapter{First chapter}
\section{First section}
\index{hello}
\chapter*{\makebox[1.0\linewidth]{List of notations}}
\addcontentsline{toc}{chapter}{List of notations}
\cleardoublepage
\addcontentsline{toc}{chapter}{\indexname}
\printindex
\end{document}
答案1
\indexname
仅用于保存索引标题,而不包含任何格式。将 定义为您的特殊索引标题,并使用包单独\indexname
修改标题的格式。切换到居中章节标题;您可以通过 切换回来。\chapter
sectsty
\chapterfont{\centering}
\chapterfont{\raggedright}
\documentclass[10pt]{book}
\usepackage{makeidx}
\makeindex
\renewcommand*{\indexname}{my index name}
\usepackage{sectsty}
\begin{document}
\tableofcontents
\chapter{First chapter}
\section{First section}
\index{hello}
\chapterfont{\centering}%
\chapter*{List of notations}
\addcontentsline{toc}{chapter}{List of notations}
\cleardoublepage
\addcontentsline{toc}{chapter}{\indexname}
\printindex
\end{document}