%\iffalse -*- doctex -*- \fi % %% \RCS$Id: pmn-idx.sty,v 1.11 2004/07/30 05:22:11 turtle Exp $ %% \RCS$Revision: 1.11 $ %% \RCS$Date: 2004/07/30 05:22:11 $ % %\iffalse metacomment %% (C) 2003 Peter Møller Neergaard %% %% This program may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.2 %% of this license or (at your option) any later version. %% The latest version of this license is in %% http://www.latex-project.org/lppl.txt %% and version 1.2 or later is part of all distributions of LaTeX %% version 1999/12/01 or later. % % This program consists of the file pmn-idx.sty. % % To print the documentation (which for the moment is uninteresting) % remove you will have to uncomment all the lines starting with %D%. % %\fi % % \CheckSum{0} ^^A 18 % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z % Digits \0\1\2\3\4\5\6\7\8\9 % Exclamation \! Double quote \" Hash (number) \# % Dollar \$ Percent \% Ampersand \& % Acute accent \' Left paren \( Right paren \) % Asterisk \* Plus \+ Comma \, % Minus \- Point \. Solidus \/ % Colon \: Semicolon \; Less than \< % Equals \= Greater than \> Question mark \? % Commercial at \@ Left bracket \[ Backslash \\ % Right bracket \] Circumflex \^ Underscore \_ % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % % % \MakeShortVerb{\"} % % \title{The \package{pmn-idx} package\thanks % {This file is CVS revision \RCSRevision, dated \RCSDate.}} % \author{Peter Møller Neergaard} % \maketitle % % \begin{abstract} % This package provides commands to generate indexes. % \end{abstract} % % It has the following options: % \begin{description} % \item[\texttt{no-index}:] do not generate an index % \item[\texttt{pmn-drft}:] let proofmode indexes follow pmn-drft. % \end{description} % %D% % \section{Stub For the User's Guide And Documentation} %D% % %D% % Slightly embarrasing, the very first part of the \LaTeX\ code is a %D% % hack on \LaTeX\ to make it believe that it is loading the package %D% % "pmn-fmpg.sty" when printing the documentation. %D% % \begin{macrocode} %D% %<*documentation> %D% \makeatletter %D% \def\@currname{pmn-fmpg} %D% \def\@currext{sty} %D% % %D% % \end{macrocode} %D% % \cmd{\@currname} and \cmd{\@currext} are the internal \LaTeX-macros containg %D% % the name and extension of the package currently being loaded; %D% % setting these prevents an error from \cmd{\ProvidesPackage}. % % \section{Package identification} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{pmn-idx}[2004/07/01 v0.12 PMN index commands] % \end{macrocode} % % \begin{macro}{\pi@if@load@idx} % We define flags for the options used % \begin{macrocode} \makeatletter \let\pi@if@load@idx\@iden % \end{macrocode} % \end{macro} ^^A \pi@if@load@idx % and define the options % \begin{macrocode} \DeclareOption{no-index}{\let\pi@loadidx\@gobble} \DeclareOption{pmn-drft}{ \AtBeginDocument{% \@ifundefined{proofmodetrue}{}{% \@ifundefined{ifDraft}{}{% \ifDraft \proofmodetrue \else \proofmodefalse \fi}}}}% \ProcessOptions % \end{macrocode} % % To avoid more tedious debugging, we issue an error message if we are % loaded after \package{hyperref}. % \begin{macrocode} \@ifpackageloaded{hyperref}% {\PackageError{pmn-idx}% {This package should be loaded before the `hyperref'}% {While `hyperref' is gentle on me, I ruthlessly overwrite stuff needed^^Jfor `hyperref'. You therefore need to put^^J% \@backslashchar usepackage[...]{pmn-idx} before \@backslashchar usepackage[...]{hyperref} or^^J\@backslashchar usepackage[...]{pmn-hypr}.}}{} % \end{macrocode} % \changes{0.11}{2004/07/01}{Testing for conflift with \package{hyperref}} % % \begin{macro}{\Index} % First we define the command \cmd{\Index} which is used to add an entry to % the index as while as typesetting the entry emphasized in the % running text. % \begin{macrocode} \def\Index{\@ifnextchar[{\x@Index}{\@Index}} \def\@Index#1{\x@Index[#1]{#1}} \def\x@Index[#1]#2{\emph{#2}\index{#1}} % \end{macrocode} % \end{macro} % % \begin{macro}{\nindex} % We define the command \mcmd{\nindex}\oarg{full name}\marg{last name} % which typesets \meta{name in text} and make an index entry under % \meta{full name}. % \begin{macrocode} \newcommand{\nindex}{\@ifnextchar[{\x@nindex}{\@nindex}} \newcommand{\@nindex}[1]{\x@nindex[#1]{#1}} \def\x@nindex[#1]#2{#2\index{#2@\nameentry{#1}}} % \end{macrocode} % \changes{v0.12}{2004/07/29}{Added} % \end{macro} % % \begin{macro}{\nameentry} % \mcmd{\nameentry}\marg{name} formats a name in the index. % \begin{macrocode} \let\nameentry\emph % \end{macrocode} % \changes{v0.12}{2004/07/29}{Added} % \end{macro} % % We load the \package{index} package since it has a mode for % proofreading the indexes. In draft mode we turn on proof mode. % \begin{macrocode} \pi@if@load@idx{% \RequirePackage{index} \AtBeginDocument{\newindex{default}{idx}{ind}{Index}} % The \newindex opens the file to write the index commands % into. \indexproofstyle{\footnotesize\sffamily}} % \end{macrocode} % The proofs should be written in sans serif for ease of reading. % % \StopEventually{} % %D% % And the commands to typeset the documentation. All enclosed in %D% % "<*documentation>"$\ldots$"" so we exclude it if we %D% % ever make a docstrip file. For now it is just commented out. %D% % \begin{macrocode} %D% %<*documentation> %D% % \end{macrocode} %D% % First we need to disable the \cmd{\part} command %D% % \begin{macrocode} %D% %\endinput %D% \makeatletter %D% \let\theindex\@undefined %D% \let\indexname\@undefined %D% \makeatother %D% \documentclass{pmn-ldoc} %D% \newcommand{\docdate}{2003/11/02} %D% \usepackage[latin1]{inputenc} %D% % \OnlyDescription %D% % \DisableCrossrefs %D% \begin{document} %D% \DocInput{pmn-idx.sty} %D% \end{document} %D% % %D% % \end{macrocode} %D% % \Finale \sloppy \PrintChanges