From 7f4ecfdff380f2b64b752cb85c365a47b119f8e2 Mon Sep 17 00:00:00 2001
From: emakarov
Date: Wed, 4 Apr 2007 10:51:33 +0000
Subject: Corrected a typo in doc/refman/Setoid.tex.

Redefined the \index command in doc/refman/headers.tex only for Hevea.
Now all sectioning commands (from \part to \subparagraph) store the
value of their counter in the command \@indexlabel. It is this command
that is used inside the new \index. Thus, the index shows only the
the most recent sectioning command, but not \index, \theorem, etc.


git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@9745 85f007b7-540e-0410-9357-904b9bb8a0f7
---
 doc/refman/headers.tex | 89 +++++++++++++++++++++++++++++++++-----------------
 1 file changed, 59 insertions(+), 30 deletions(-)

(limited to 'doc/refman/headers.tex')

diff --git a/doc/refman/headers.tex b/doc/refman/headers.tex
index 21b3b6e851..bb84fb4796 100644
--- a/doc/refman/headers.tex
+++ b/doc/refman/headers.tex
@@ -28,6 +28,65 @@
 \protect\addcontentsline{toc}{chapter}{Bibliography}Bibliography}
 %END LATEX
 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Commands for indexes
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\usepackage{index}
+\makeindex
+\newindex{tactic}{tacidx}{tacind}{%
+\protect\setheaders{Tactics Index}%
+\protect\addcontentsline{toc}{chapter}{Tactics Index}Tactics Index}
+
+\newindex{command}{comidx}{comind}{%
+\protect\setheaders{Vernacular Commands Index}%
+\protect\addcontentsline{toc}{chapter}{Vernacular Commands Index}%
+Vernacular Commands Index}
+
+\newindex{error}{erridx}{errind}{%
+\protect\setheaders{Index of Error Messages}%
+\protect\addcontentsline{toc}{chapter}{Index of Error Messages}Index of Error Messages}
+
+\renewindex{default}{idx}{ind}{%
+\protect\addcontentsline{toc}{chapter}{Global Index}%
+\protect\setheaders{Global Index}Global Index}
+
+\newcommand{\tacindex}[1]{%
+\index{#1@\texttt{#1}}\index[tactic]{#1@\texttt{#1}}}
+\newcommand{\comindex}[1]{%
+\index{#1@\texttt{#1}}\index[command]{#1@\texttt{#1}}}
+\newcommand{\errindex}[1]{\texttt{#1}\index[error]{#1}}
+\newcommand{\errindexbis}[2]{\texttt{#1}\index[error]{#2}}
+\newcommand{\ttindex}[1]{\index{#1@\texttt{#1}}}
+\makeatother
+
+% The following code creates another command \@indexlabel, which,
+% along with Hevea's \@currentlabel serves to store the current values
+% of counters. However, \@currentlabel keeps the value of counters
+% incremented by \refstepcounter (see the definition of
+% \refstepcounter in latexcommon.hva), which includes chapter and
+% section counters, as well as theorems, \items, etc. On the other
+% hand, \@indexlabel keeps only the values of sectioning counters.
+% This is done by redefining the sectioning commands.
+%HEVEA \newcommand{\@indexlabel}{}
+%HEVEA \let\oldchapter=\chapter
+%HEVEA \let\oldsection=\section
+%HEVEA \let\oldsubsection=\subsection
+%HEVEA \let\oldsubsubsection=\subsubsection
+%HEVEA \let\oldparagraph=\paragraph
+%HEVEA \let\oldsubparagraph=\subparagraph
+%HEVEA \renewcommand{\chapter}[1]{\oldchapter{#1}\let\@indexlabel=\@currentlabel}
+%HEVEA \renewcommand{\section}[1]{\oldsection{#1}\let\@indexlabel=\@currentlabel}
+%HEVEA \renewcommand{\subsection}[1]{\oldsubsection{#1}\let\@indexlabel=\@currentlabel}
+%HEVEA \renewcommand{\subsubsection}[1]{\oldsubsubsection{#1}\let\@indexlabel=\@currentlabel}
+%HEVEA \renewcommand{\paragraph}[1]{\oldparagraph{#1}\let\@indexlabel=\@currentlabel}
+%HEVEA \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\let\@indexlabel=\@currentlabel}
+% The only difference of the following command with the original one
+% defined in index.hva is that the latter uses \@currentlabel instead
+% of \@indexlabel
+% Also, for some reason, the following command produces an error if
+% not given on one line. Need to submit to Hevea developers.
+%HEVEA \renewcommand{\index}[2][default]{\if@refs\sbox{\@indexbox}{\@indexwrite[#1]{#2}{\@indexlabel}}\@locname{\usebox{\@indexbox}}{}\fi}
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % For the Addendum table of contents
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -63,36 +122,6 @@
 \immediate\closeout\RefManCut@out}
 %END LATEX
 
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Commands for indexes
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\usepackage{index}
-\makeindex
-\newindex{tactic}{tacidx}{tacind}{%
-\protect\setheaders{Tactics Index}%
-\protect\addcontentsline{toc}{chapter}{Tactics Index}Tactics Index}
-
-\newindex{command}{comidx}{comind}{%
-\protect\setheaders{Vernacular Commands Index}%
-\protect\addcontentsline{toc}{chapter}{Vernacular Commands Index}%
-Vernacular Commands Index}
-
-\newindex{error}{erridx}{errind}{%
-\protect\setheaders{Index of Error Messages}%
-\protect\addcontentsline{toc}{chapter}{Index of Error Messages}Index of Error Messages}
-
-\renewindex{default}{idx}{ind}{%
-\protect\addcontentsline{toc}{chapter}{Global Index}%
-\protect\setheaders{Global Index}Global Index}
-
-\newcommand{\tacindex}[1]{%
-\index{#1@\texttt{#1}}\index[tactic]{#1@\texttt{#1}}}
-\newcommand{\comindex}[1]{%
-\index{#1@\texttt{#1}}\index[command]{#1@\texttt{#1}}}
-\newcommand{\errindex}[1]{\texttt{#1}\index[error]{#1}}
-\newcommand{\errindexbis}[2]{\texttt{#1}\index[error]{#2}}
-\newcommand{\ttindex}[1]{\index{#1@\texttt{#1}}}
-\makeatother
 
 
 
-- 
cgit v1.2.3

