我怎样才能将索引标题移至中心?

我怎样才能将索引标题移至中心?
\documentclass[12pt]{book}
\usepackage{index}
\usepackage{parskip}
\makeindex
\begin{document}
To record the full absorption spectrum\index{Absorption spectrum}, the colour of
the incident light is changed systematically, and the intensity
that manages to survive passage through the sample is monitored.
Because molecules have characteristic energy levels, their
absorption spectra are unique, and can give a good indication of
their identity.

Acetic acid\index{Acetic acid}, the acid in vinegar, is one such compound;
others include hydrochloric acid (HCl) and sulfuric acid.

If you ever see H written fi rst in a formula, that is an indication
that it can release its proton and act as an acid\index{Acid}.
Chemists have identified the existence of a barrier to instant
reaction. By making measurements on the effect of temperature
on the rates of reactions, they have identifi ed the need for molecules
to acquire at least a minimum energy, called the \emph{activation energy}\index{Activation energy} , before the atoms of the reactants are able to rearrange into products.

Some activation barriers\index{Activation barriers} are very high, and hardly any collisions are sufficiently
energetic to result in reaction at normal temperatures.

Phosphorus (P) is abundant too, being the remains of prehistoric
animals. Their bones of calcium phosphate and their special
internal power source, the molecules of ATP (adenosine triphosphate)\index{Adenosine triphosphate}
that power every one of our and their cells, lie in great
compressed heaps below the oceans of the world as phosphate
rock. Here chemists help to mine the dead to feed the living, for
they fi nd ways to extract the phosphorus from these buried
sources and use it again in the great cycle of sustainability.

\printindex
\end{document}

到目前为止这是我的代码,其输出是(不包括段落,因为它与问题无关):

指数

我怎样才能将索引标题移至中心?

答案1

由于\indexname用于页眉和标题,因此您必须更改为\chapter*

\documentclass[12pt]{book}
\usepackage{index}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\theindex}{\@makeschapterhead{\indexname}}{\@makeschapterhead{\centerline\indexname}}{}{Failed}
\makeatother

\makeindex

\parindent=0pt
\parskip=8pt

\begin{document}
To record the full absorption spectrum \index{Absorption spectrum}, the colour of
the incident light is changed systematically, and the intensity
that manages to survive passage through the sample is monitored.
Because molecules have characteristic energy levels, their
absorption spectra are unique, and can give a good indication of
their identity.

Acetic acid \index{Acetic acid}, the acid in vinegar, is one such compound;
others include hydrochloric acid (HCl) and sulfuric acid.

If you ever see H written fi rst in a formula, that is an indication
that it can release its proton and act as an acid \index{Acid}.

Chemists have identified the existence of a barrier to instant
reaction. By making measurements on the effect of temperature
on the rates of reactions, they have identifi ed the need for molecules
to acquire at least a minimum energy, called the \emph{activation energy}
\index{Activation energy} , before the atoms of the reactants are able to rearrange
into products.

Some activation barriers \index{Activation barriers} are very high, and hardly any collisions are sufficiently
energetic to result in reaction at normal temperatures.

Phosphorus (P) is abundant too, being the remains of prehistoric
animals. Their bones of calcium phosphate and their special
internal power source, the molecules of ATP (adenosine triphosphate) \index{Adenosine triphosphate}
that power every one of our and their cells, lie in great
compressed heaps below the oceans of the world as phosphate
rock. Here chemists help to mine the dead to feed the living, for
they fi nd ways to extract the phosphorus from these buried
sources and use it again in the great cycle of sustainability.

\printindex
\end{document}

相关内容