Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikibooksThe Free Textbook Project
Search

Talk:LaTeX/Indexing

Page contents not supported in other languages.
Add topic
From Wikibooks, open books for an open world
<Talk:LaTeX
Latest comment:1 year ago by Hops Splurt
This is thediscussion page for discussing improvements to theLaTeX/Indexing page.

makeidx is obsolete

[edit source]

`makeidx` is woefully obsolete. It's one of the few pieces of software left that can't handle Unicode, and this has been unacceptable for ages now. It should not be recommended or even explained here. A modern alternative, like `texindy` should be provided and explained instead.


Texindy, hyperref and textbf, textit modifiers

[edit source]

To allow texindy to process.idx files and to have hyperlinks in index you have to pre- and post-process files used by texindy.

First, the pre-processor,texindy-pre.pl:

#!/usr/bin/perlunless ($ARGV[0] =~ /\.idx$/){     print "\nUsage:\n";     print "texindy-post.pl file.idx\n\n";     print "This script will work only for unprocessed LaTeX .idx files.\n";     print "It is the first script in series, to pre process files so they can\n";     print "be processed by TeXindy.\n";     print "\nTogether with texindy-post.pl it works around the \"\\hyperindexformat{}\"\n";     print "deficiency in TeXindy, making it possible to use \"textbf\" and \"texit\"\n";     print "modifiers in \"\\index{}\" command together with \'hyperref\' package\n";}open(DATA, "< $ARGV[0]") or die "\nCan't open file for reading: $!\n";#All lines must be read by Perl so that no scratch files need to be used@lines = <DATA>;close(DATA);print "\nFile $ARGV[0] read\.\n\n";open(DATA, "> $ARGV[0]") or die "\nCan't open file $ARGV[0] for writing: $!\n";$f1=0;$f2=0;foreach $line (@lines) {# change "|)" to "|)hyperpage"      if ($line =~ s/\|\)/|)hyperpage/){  $f1 += 1;     }# remove hyperindexformat     if ($line =~ s/hyperindexformat\{\\([^\}]*)\}/$1/){  $f2 += 1;     }print DATA $line;}close(DATA);print "Fixed $f1 page ranges.\nFixed $f2 hyperindexformat occurences.\n\n";exit();

Second, the post-processor,texindy-post.pl:

#!/usr/bin/perlunless ($ARGV[0] =~ /\.ind$/){     print "\nUsage:\n";     print "texindy-post.pl file.ind\n\n";     print "This script will work only for processed LaTeX .ind files.\n";     print "It is the second script in series, to post process files after they have\n";     print "been processed by TeXindy.\n";     print "\nTogether with texindy-pre.pl it works around the \"\\hyperindexformat{}\"\n";     print "deficiency in TeXindy, making it possible to use \"textbf\" and \"texit\"\n";     print "modifiers in \"\\index{}\" command together with \'hyperref\' package\n";}open(DATA, "< $ARGV[0]") or die "\nCan't open file for reading: $!\n";#All lines must be read by Perl so that no scratch files need to be used@lines = <DATA>;close(DATA);print "\nFile $ARGV[0] read\.\n\n";open(DATA, "> $ARGV[0]") or die "\nCan't open file $ARGV[0] for writing: $!\n";$f1=0;$f2=0;foreach $line (@lines) {#change textbf modifiers to hyperlinks     if ($line =~ s/ \\textbf{([0-9ivxl]+)}/ \\hyperindexformat{\\textbf}{\1}/){  $f1 += 1;     }#change textit modifiers to hyperlinks     if ($line =~ s/ \\textit{([0-9ivxl]+)}/ \\hyperindexformat{\\textit}{\1}/){  $f2 += 1;     }print DATA $line;}close(DATA);print "Changed $f1 textbf occurences.\nChanged $f2 textit occurences.\n\n";exit();

If you have those two files in the same directory as your LaTeX project, your LaTeX file ismain.tex and the project is written in polish, use this commands to generate dvi file with correct index:

latex main./texindy-pre.pl main.idxtexindy -M lang/polish/utf8 -I latex 'main.idx'./texindy-post.pl main.indlatex main

---

It would be very helpful if the lines about multiple indices would add thatmakeindex filename has to be run twice (or even more often) as well.

Index in TOC

[edit source]

I don't know why, but the sectionhttp://en.wikibooks.org/wiki/LaTeX/Indexing#Adding_index_to_table_of_contents is not necessary, at least I don't know when that lines are needed. I've tried 'standard' index as well as `multind' and I get indices in my TOC automatically. --79.154.142.115 (discuss)17:19, 8 January 2014 (UTC)Reply

Multiple indices with: imakeidx

[edit source]

An alternative to multind is imakeidx. Seehttp://mirrors.ctan.org/macros/latex/contrib/imakeidx/imakeidx.pdf

An entry was added to describeimakeidx. See the "Latest Draft" tab. --Hops Splurt (discusscontribs)05:11, 5 May 2019 (UTC)Reply

multind vs. something newer

[edit source]

Note to self: Replace themultind stuff with a more recent package.--Johannes Bo (discusscontribs)15:20, 27 September 2017 (UTC)Reply

makeidx: Package or option to \documentstyle?

[edit source]

On this page (in the section "Using makeidx")makeidx is described as a package, and must be invoked with the\usepackage{makeidx} command.But the manual formakeindex, which describes the same commands as thepage text (\makeindex,\index,\printindex) states that to use ityou must addmakeidx to the list of options of the\documentstyle command.On the other hand, that manual is from 1987, and speaks of the "\documentstyle" command, which has presumablybeen superseeded by the\documentclass command.Thereis apackage calledmakeidx, but this is a LaTeX2epackage which only providesthe\see and\printindex commands.

Can anyone find out if the way to invokemakeindex is correctly described on the page?--Hops Splurt (discusscontribs)06:48, 5 May 2019 (UTC)Reply

As you know, LaTeX2e is the current LaTeX for over 25 years. Using\documentstyle is obsolete just as long. Usemakeidx by loading it withusepackage, it just provides few extra commands. The rest is provided by basic LaTeX. Be sure to run the proper external tool to get the index sorted out. --Johannes Bo (discusscontribs)05:32, 12 May 2019 (UTC)Reply
Oddly enough, I didnot know (then, 2019) LaTeX2e is the current version of LaTeX. This wikibook has been my main resource to learn how to use LaTeX. It does not mention LaTeX2e on the main page or the introduction. A search in the LaTeX wikibook shows only incidental references, mostly exceptions to "regular" LaTeX use. The best pointer is on theLinks page, where Tobias Oetiker's "Not So Short Introduction to LaTex2e" is mentioned, but there is no hint that this is an essential read. And the title did not inspire me to read it, but rather to leave it aside, as I did not want to be sidetracked by information on some, for me irrelevant, branch of LaTeX. In summary: "everybody knows", but if you don't know, then this wikibook will not tell you. --Hops Splurt (discusscontribs)17:55, 20 October 2024 (UTC)Reply
Retrieved from "https://en.wikibooks.org/w/index.php?title=Talk:LaTeX/Indexing&oldid=4441909"

[8]ページ先頭

©2009-2025 Movatter.jp