On Thu, Feb 21, 2019 at 03:08:30AM -0700, [email protected] wrote: > I have a feature request, please. It relates to indexing in texinfo.tex. > Packages like LaTeX and professional publishing packages provide for > multiple levels of index entries, usually up to three keys. For example > > coffee makers ..... 15, 21 > electric ........... 32 > pink ............ 45 > > I would very much like to see this available in texinfo.tex. In > the gawk manual I have up to three items, separated by commas; if > more are needed for what I want to say, I use @comma{}. > > I took a look a texinfo.tex to see what's there for this kind of thing. > I'm not at all a TeX hacker, but it looks like there's some half-completed > support for two levels of items (not three). Sort of like someone > thought about it, but it doesn't seem to have been carried through.
If my understanding is correct, this code used to be used for some of the commands for indexing methods in object-oriented languages, like @defop, but these were changed long ago. Possibly in the change on 2001-02-02 in the ChangeLog. 2001-02-02 <[email protected]> * texinfo.tex (\secondary): handle pdf case. (\dosubind): secondary index entry not written as separate arg for texindex. From: Trevin Beattie <[email protected]> Date: Tue, 21 Mar 2000 13:04:06 -0700 I've attached the mail for historical interest, which Karl provided to me. The C implementation of texindex did actually sort \primary and \secondary correctly last time I checked (some years ago). > For backwards compatibility, this would probably have to be done as > a new command, something like > > @cindex2 {coffee makers}{electic}{pink} > > or more likely: > > @cindex2{coffee makers, electic, pink} > > (Yes, that's a bad name, it's just an example for discussion.) I think @cindextwo (no digits in TeX macro names) could be called as @cindextwo coffee makers, electic, pink This would be consistent with the arguments to @node, which are also separated by commas. But let's make sure that the interface is as consistent as possible with other Texinfo commands. > I would be willing to update texindex to support multiple sort > keys if this would help. Unfortunately, I don't think I can help > with the TeX part or the makeinfo part. I think it should work with \primary and \secondary the same as C texindex did. I don't think implementing it would be too much of a barrier. The more important thing is to get the interface right. > Does all this make sense? Is it something that can be added to > the TODO list? Yes, I don't see why not.
>From [email protected] Tue Mar 21 15:10:25 2000 Status: RO X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil] [nil nil nil nil nil nil nil "Trevin Beattie" "[email protected]" nil nil nil "^Date:" nil nil nil "2000032120:04:06" nil nil nil nil] nil) X-VM-Summary-Format: "%n %*%a %-17.17F %-3.3m %2d %4l/%-5c %I\"%s\"\n" X-VM-Labels: nil X-VM-VHeader: ("Date:" "From:" "Apparently-To:" "To:" "Cc:" "Subject:") nil X-VM-Last-Modified: (14552 53581 78344) X-VM-IMAP-Retrieved: nil X-VM-POP-Retrieved: nil X-VM-Bookmark: 2 Return-Path: <[email protected]> Received: from cs.umb.edu ([email protected] [158.121.104.2]) by freefriends.org (8.9.3/8.9.3) with ESMTP id PAA29764 for <[email protected]>; Tue, 21 Mar 2000 15:10:24 -0500 Received: from mescaline.gnu.org ([email protected] [158.121.106.21]) by cs.umb.edu (8.8.8/8.8.8) with ESMTP id PAA08091 for <[email protected]>; Tue, 21 Mar 2000 15:10:33 -0500 (EST) Received: (from slist@localhost) by mescaline.gnu.org (8.9.1a/8.9.1) id PAA05759 for texinfo-maintainers; Tue, 21 Mar 2000 15:10:28 -0500 Resent-Date: Tue, 21 Mar 2000 15:10:28 -0500 Received: from nanook.eyring.com (nanook.eyring.com [192.77.10.202]) by mescaline.gnu.org (8.9.1a/8.9.1) with ESMTP id PAA05469 for <[email protected]>; Tue, 21 Mar 2000 15:04:21 -0500 Received: from trevin (trevin.eyring.com [192.77.10.241]) by nanook.eyring.com (8.9.3/8.9.3) with SMTP id NAA09024 for <[email protected]>; Tue, 21 Mar 2000 13:04:13 -0700 (MST) Message-Id: <[email protected]> X-Sender: [email protected] X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.5 (32) Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Resent-Message-ID: <"p_AJR3.0.rL1.DNzru"@mescaline.gnu.org> Resent-From: [email protected] X-Mailing-List: <[email protected]> archive/latest/778 X-Loop: [email protected] Precedence: list Resent-Sender: [email protected] Date: Tue, 21 Mar 2000 13:04:06 -0700 From: Trevin Beattie <[email protected]> To: [email protected] Subject: PDF destinations are in the wrong place I prefer to use Acrobat Reader for viewing online documentation (it looks prettier), so I have used pdftex to format all of our Gnu documentation into PDF files. One thing that I find very annoying in all of them is that all of the hyperlinks (both cross-references and bookmarks) send you to the *bottom* of the page, rather than the start of the target material. (This is most evident when the Reader's zoom factor shows less than half of the page, or when in continuous page mode.) I have found one fix for this problem which is so surprisingly simple, I wonder why it was ever written incorrectly in the first place. In the main output routine, call \pdfmkdest *before* writing out the rest of the page instead of after! *** /home/trevin/Gnu/texinfo-4.0/doc/texinfo.tex Sat Sep 25 08:31:21 1999 --- texinfo.tex Tue Mar 21 10:17:25 2000 *************** *** 214,219 **** --- 214,222 ---- \normalturnoffactive % \ in index entries must not stay \, e.g., if % the page break happens to be in the middle of an example. \shipout\vbox{% + % Moved from the bottom of the page + \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi + % \ifcropmarks \vbox to \outervsize\bgroup \hsize = \outerhsize \vskip-\topandbottommargin *************** *** 242,249 **** \vskip 2\baselineskip \unvbox\footlinebox \fi ! % ! \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi % \ifcropmarks \egroup % end of \vbox\bgroup --- 245,252 ---- \vskip 2\baselineskip \unvbox\footlinebox \fi ! % Moved to the top of the page ! %\ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi % \ifcropmarks \egroup % end of \vbox\bgroup Now the hyperlinks will take you to the top of the target page (well, almost; it skips past the page headline.) It would still be better if the link could take you to the start of the target text in the middle of a page, but that looks like it would take a bit more effort to implement (or even a change to pdftex). I have one other annoyance: the link color. Cyan is simply too light to read against a white background. Why not blue? *************** *** 891,897 **** \fi} \def\pdfmkdest#1{\pdfdest name{#1@} xyz} \def\pdfmkpgn#1{#1@} ! \let\linkcolor = \Cyan \def\endlink{\Black\pdfendlink} % Adding outlines to PDF; macros for calculating structure of outlines % come from Petr Olsak --- 894,900 ---- \fi} \def\pdfmkdest#1{\pdfdest name{#1@} xyz} \def\pdfmkpgn#1{#1@} ! \let\linkcolor = \Blue \def\endlink{\Black\pdfendlink} % Adding outlines to PDF; macros for calculating structure of outlines % come from Petr Olsak There is also a bug in the PDF outline: Any outline item containing an underscore shows up as a bunch of texinfo codes ("@unhbox @kern.06em @vbox{..."). This bug was remedied by the following addition to \pdfmakeoutlines: *************** *** 905,911 **** --- 908,915 ---- \ifeof 1\else\bgroup \closein 1 \indexnofonts \def\tt{} + \def\_{\normalunderscore} % thanh's hack / proper braces in bookmarks \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace One last item: It looks like texinfo has some capabilities for making a two-level index defined internally, but has no external macros for authors to make use of them. In attempting to use @dosubind{index}{topic}{subtopic} directly, I discovered that texinfo was *not* writing "\entry{sort}{page}{topic}{subtopic}" to the index file as it should; instead, it was writing "\entry{sort}{page}{topic subtopic}", thus creating a one-level index with extra-long names. I made a whole bunch of changes in order to get this part to work as it seemed to be documented. This may not be the best way to do it, but it works for me. *************** *** 2857,2873 **** % If third (subentry) arg is present, add it to the index % string. And include a space. \ifx\thirdarg\emptymacro \else ! \toks0 = \expandafter{\the\toks0 \space #3}% \fi % % Set up the complete index entry, with both the sort key % and the original text, including any font commands. We write % three arguments to \entry to the .?? file, texindex reduces to % two when writing the .??s sorted result. ! \edef\temp{% ! \write\csname#1indfile\endcsname{% ! \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}% ! }% % % If a skip is the last thing on the list now, preserve it % by backing up by \lastskip, doing the \write, then inserting --- 2861,2885 ---- % If third (subentry) arg is present, add it to the index % string. And include a space. \ifx\thirdarg\emptymacro \else ! %\toks0 = \expandafter{\the\toks0 \space #3}% ! \toks1 = {#3}% \fi % % Set up the complete index entry, with both the sort key % and the original text, including any font commands. We write % three arguments to \entry to the .?? file, texindex reduces to % two when writing the .??s sorted result. ! \ifx\thirdarg\emptymacro ! \edef\temp{% ! \write\csname#1indfile\endcsname{% ! \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}% ! }% ! \else ! \edef\temp{% ! \write\csname#1indfile\endcsname{% ! \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}{\the\tok s1}}% ! }% ! \fi % % If a skip is the last thing on the list now, preserve it % by backing up by \lastskip, doing the \write, then inserting The above change revealed a problem in \secondary: it did not output a PDF link. *************** *** 3089,3095 **** \def\secondary #1#2{ {\parfillskip=0in \parskip=0in \hangindent =1in \hangafter=1 ! \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par }} % Define two-column mode, which we use to typeset indexes. --- 3101,3113 ---- \def\secondary #1#2{ {\parfillskip=0in \parskip=0in \hangindent =1in \hangafter=1 ! \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill ! \ifpdf ! \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. ! \else ! #2% The page number ends the paragraph. ! \fi ! \par }} % Define two-column mode, which we use to typeset indexes.
