(N.B., the original name for this program was makeindex but CMS limits program names (and any filename) to 8 characters so...)

Similar documents
NAME mendex Japanese index processor

MAKEINDEX(1) TeX Live MAKEINDEX(1)

Theformatsoftheinputandoutputfilesarespecifiedinastylefile;bydefault,inputisassumed

Index Preparation and Processing

Automating Index Preparation*

Programming for Engineers Introduction to C

Full file at

Fundamentals of Programming Session 4

Lecture 2 Tao Wang 1

Chapter 2, Part I Introduction to C Programming

CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York

Intro to Computer Programming (ICP) Rab Nawaz Jadoon

1 Lexical Considerations

Lexical Considerations

MakeIndex: An Index Processor For LaT E X

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

LESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are:

Lexical Considerations

Cindex 3.0 for Windows. Release Notes

Should you know scanf and printf?

CSCI 2010 Principles of Computer Science. Data and Expressions 08/09/2013 CSCI

Language Basics. /* The NUMBER GAME - User tries to guess a number between 1 and 10 */ /* Generate a random number between 1 and 10 */

Basics of Java Programming

Data Types and Variables in C language

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath

Fundamental of Programming (C)

The authorindex Package

C How to Program, 6/e by Pearson Education, Inc. All Rights Reserved.

Chapter 2 Basic Elements of C++

Introduction Variables Helper commands Control Flow Constructs Basic Plumbing. Bash Scripting. Alessandro Barenghi

ARG! Language Reference Manual

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG

IT 374 C# and Applications/ IT695 C# Data Structures

9/5/2018. Overview. The C Programming Language. Transitioning to C from Python. Why C? Hello, world! Programming in C

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.

Note for the LaT E X version of this Document

The C Programming Language. (with material from Dr. Bin Ren, William & Mary Computer Science)

CSc Introduction to Computing

Data and Expressions. Outline. Data and Expressions 12/18/2010. Let's explore some other fundamental programming concepts. Chapter 2 focuses on:

CROSSREF Manual. Tools and Utilities Library

Visual C# Instructor s Manual Table of Contents

C Language, Token, Keywords, Constant, variable

The xparse package Document command parser

Handout 7, Lex (5/30/2001)

2 nd Week Lecture Notes

The New C Standard (Excerpted material)

Fundamentals of Programming. Lecture 3: Introduction to C Programming

Decaf Language Reference Manual

Full file at C How to Program, 6/e Multiple Choice Test Bank

Module 8 Pipes, Redirection and REGEX

Overview of C. Basic Data Types Constants Variables Identifiers Keywords Basic I/O

Designing BIBTEX Styles

Introduction To Java. Chapter 1. Origins of the Java Language. Origins of the Java Language. Objects and Methods. Origins of the Java Language

RSL Reference Manual

Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual

Chapter 2. Lexical Elements & Operators

Rule 1-3: Use white space to break a function into paragraphs. Rule 1-5: Avoid very long statements. Use multiple shorter statements instead.

>B<82. 2Soft ware. C Language manual. Copyright COSMIC Software 1999, 2001 All rights reserved.

Microprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming)

Table of Contents Date(s) Title/Topic Page #s. Abstraction

UNIT- 3 Introduction to C++

A variable is a name for a location in memory A variable must be declared

Introduction to TURING

B.V. Patel Institute of BMC & IT, UTU 2014

The newcommand.py utility

Stream Model of I/O. Basic I/O in C

3. Except for strings, double quotes, identifiers, and keywords, C++ ignores all white space.

The PCAT Programming Language Reference Manual

Petros: A Multi-purpose Text File Manipulation Language

Programming in C++ 4. The lexical basis of C++

Section 2: Introduction to Java. Historical note

Expr Language Reference

printf( Please enter another number: ); scanf( %d, &num2);

C Fundamentals & Formatted Input/Output. adopted from KNK C Programming : A Modern Approach

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.

Detailed Format Instructions for Authors of the SPB Encyclopedia

Standard 11. Lesson 9. Introduction to C++( Up to Operators) 2. List any two benefits of learning C++?(Any two points)

Variables and Literals

C++ Basic Elements of COMPUTER PROGRAMMING. Special symbols include: Word symbols. Objectives. Programming. Symbols. Symbols.

68000 Assembler by Paul McKee. User's Manual

APPENDIX E SOLUTION TO CHAPTER SELF-TEST CHAPTER 1 TRUE-FALSE FILL-IN-THE-BLANKS

GNU Emacs as a Front End to L A TEX

LESSON 4. The DATA TYPE char

\n is used in a string to indicate the newline character. An expression produces data. The simplest expression

Meeting One. Aaron Ecay. February 2, 2011

2.2 Syntax Definition

This is a list of questions and answers about Unicode in Perl, intended to be read after perlunitut.

Formatted Output Pearson Education, Inc. All rights reserved.

A lexical analyzer generator for Standard ML. Version 1.6.0, October 1994

use Pod::Man; my $parser = Pod::Man->new (release => $VERSION, section => 8);

5/20/2007. Touring Essential Programs

SFU CMPT 379 Compilers Spring 2018 Milestone 1. Milestone due Friday, January 26, by 11:59 pm.

(Refer Slide Time: 01:12)

COMP 2718: Shell Scripts: Part 1. By: Dr. Andrew Vardy

PracticeMaster Report Writer Guide

CS 541 Spring Programming Assignment 2 CSX Scanner

UNIT-2 Introduction to C++

2/29/2016. Definition: Computer Program. A simple model of the computer. Example: Computer Program. Data types, variables, constants

corgi Language Reference Manual COMS W4115

9. Elementary Algebraic and Transcendental Scalar Functions

Transcription:

Using the makeindx TeX/LaTeX Tool A5332017 02/17/92 1. makeindx: Introduction and Warning makeindx is a general purpose index processor. It takes one or more raw index files (normally generated by a formatter), sorts the entries, and produces the actual index file. It is not dependent on any particular format of raw index file, although the.idx file (that is, the file with filetype IDX) generated by LaTeX is default. Up to three levels (0, 1, and 2) of subitem nesting within the same entry is supported. The input format may be redefined in a style file so that raw index or glossary output from other formatters may be processed. The style file also defines the style of output index file. See the file TEST TEX on the TEX disk for information on how to use makeindx with LaTeX. makeindx was originally written in a Unix environment and then ported to CMS...in the following discussion I have tried to keep separate information about makeindx itself and information specifically about the CMS implementation of makeindx by putting the latter in parentheses. The current port of makeindx for CMS is a preliminary one...use at your own risk! Comments, criticisms or complaints about the implementation should be directed to Chris Carruthers (CJC@UOTTAWA.BITNET). See also the AUTHOR section at the end of this document. (N.B., the original name for this program was makeindex but CMS limits program names (and any filename) to 8 characters so...) 2.1. Format: 2. The Format and Parameters of the MAKEINDX Command makeindx [-ilqrc] [-s sty] [-o ind] [-t log] [-p no] [idx0 idx1 idx2...] 2.2. Parameters: N.B., in the following discussion the words stdin, stdout and stderr reflect makeindx's C and Unix origins. In CMS with Waterloo C these all refer to the same device by default: the interactive terminal. The use of these devices allows for 'redirection' of input and output, that is, input (or output) can be requested from (or to) a file. Not sure why this is useful in the context of makeindx since these features are already part of makeindx but makeindx makes use of these devices so it makes sense to allow for redirection in the CMS implementation. As implemented redirection is requested with the use of the characters '<' and '>': one puts '<fileidi>fileido' at the end of the commandline where fileidi is the CMS fileid requested for input and fileido is the CMS fileid requested for output. Either input or output redirection can be requested. A redirection request is meaningful only if stdin for input (or stdout for output) is being used by the program. If the program is using stdin and redirection is not requested then input is from the terminal and to end input you push PF3. -i Use stdin as the input file. When this option is specified and the -o is not, output is written to stdout. -l Use letter ordering. Default is word ordering (explained in the ORDERING section). -q Quiet mode, send no messages to stderr. By default progress and error messages are sent to stderr as well as the transcript file. The -q option disables the stderr messages. (N.B., stderr in the CMS implementation of makeindx means the terminal.)

Using the makeindx TeX/LaTeX Tool Page 2 -r Disable implicit page range formation. By default three or more successive pages will be automatically abbreviated as a range (e.g. 1--5). The -r option disables it, making the explicit range operators the only way to create page ranges (see the SPECIAL EFFECTS section below). -c Enable blank compression. By default every blank counts in the index key. The -c option ignores leading and trailing blanks and tabs and compresses intermediate ones to a single space. -s sty Take sty as the style file. There is no default for the style file name. The environment variable INDEXSTYLE defines the path where the style file should be found. -o ind Take ind as the output index file. By default the file name base of the first input file idx0 concatenated with the extension.ind is used as the output file name. -t log Take log as the transcript file. By default the file name base (in CMS this means the filename) of the first input file idx0 concatenated with the extension.ilg is used as the transcript file name. -p no Set the starting page number of the output index file to be no. This is useful when the index file is to be formatted separately. Other than pure numbers, three special cases are allowed for no: any, odd, and even. In these special cases, the starting page number is determined by retrieving the last page number from the source log file. The source log file name is determined by concatenating the file name base of the first raw index file (idx0) with the extension.texlog. The last source page is obtained by searching backward in the log file for the first instance of a number included in [...]. If a page number is missing or the log file is not found, no attempt will be made to set the starting page number. (N.B., in the CMS implementation this does not seem to be to useful since the texlog created by the CMS version of TeX does not have this number in the expected place.) The meaning of each of these cases follows. any The starting page is the last source page number plus 1. odd even The starting page is the first odd page following the last source page number. The starting page is the first even page following the last source page number. idx0... This is the name of the raw input file that makeindx should use to generate the index. It can be specified in the CMS implementation as fn, fn.ft or fn.ft.fm where fn is the filename, ft is the filetype and fm is the filemode of the file in question. Unless specified otherwise, the file name base of the first input file (idx0) is used to determine other related input/output files. For each input file name specified, the name itself is first used. If not found and the name has no extension part, it is concatenated with the.idx extension (N.B., in the CMS implementation 'extension' means filemode). If this again fails, the program aborts. 3. Notes: STYLE FILE The style file format is very simple. It is a list of <specifier,&attribute> pairs. There are two types of specifiers (input and output). The pairs don't have to obey any particular order in the file. A line lead by '%' is a comment. The following is a list of all the specifiers and their respective arguments where <string> is an arbitrary string delimited by double quotes ("..."), <char> is a single letter embraced by single quotes ('...'), and <number> is a nonnegative integer. The maximum length of a <string> is 144. Notice that a backslash must be escaped (by an extra backslash) in the string quotation. Anything not specified in the style file will be assigned a default value, which is shown at the rightmost column. This file can reside anywhere in the

Using the makeindx TeX/LaTeX Tool Page 3 path defined by the environment variable INDEXSTYLE. (In the CMS implementation this 'path' is specified by using GLOBALV (see the GLOBALV help file for more information) and should be a valid filemode or '*' as follows: GLOBALV SELECT MAKEINDX SET INDEXSTYLE fm where "fm" is the filemode required. If a filemode is specified explicitly on the command line any path which is specified has no effect.) N.B., in the style file there are some characters that cannot be specified directly ('\' is specified as '\\') or that are more conveniently expressed symbolically (to get a blank line in the output file use '\n', to get a tab use '\t'). The reason for this is that makeindx was written in C and the above correspond to the conventions used for these characters in C. Most any C manual or reference should have a complete list of these so called escape characters. 3.1. Input Style Specifiers keyword <string> "\\indexentry" This is the command which tells makeindx that its argument is an index entry. arg_open <char> '{' This is the opening delimiter for the index entry argument. arg_close <char> '}' This is the closing delimiter for the index entry argument. range_open <char> '(' The opening delimiter indicating the beginning of an explicit page range. range_close <char> ')' The closing delimiter indicating the end of an explicit page range. level <char> '!' The delimiter which denotes a new level of subitem. actual <char> '@' The symbol which indicates that the next entry is to appear in the actual index file. encap <char> ' ' The symbol which indicates that the rest of the argument list is to be used as the encapsulating command for the page number. quote <char> '"' escape <char> '\\' The symbol which escapes the next letter, unless its preceding letter is escape. In other words, quote is used to escape the letter which immediately follows it. But if it is preceded by escape, it does not escape anything. Notice that the two symbols must be distinct. 3.2. Output Style Specifiers preamble <string> "\\begin{theindex}\n" The preamble of actual index file.

Using the makeindx TeX/LaTeX Tool Page 4 postamble <string> "\n\n\\end{theindex}\n" The postamble of actual index file. setpage_prefix <string> "\n \\setcounter{page}{" The prefix of the command which sets the starting page number. setpage_suffix <string> "}\n" The suffix of the command which sets the starting page number. \ group_skip\% <string> "\n\n \\indexspace\n" The vertical space to be inserted before a new group begins. lethead_prefix <string> "" The header prefix to be inserted before a new letter begins. lethead_suffix <string> "" The header suffix to be inserted before a new letter begins. lethead_flag <string> 0 The flag indicating the condition of inserting new letter header. Default is 0, which means no header. Positive means insert an uppercase letter between prefix and suffix. Negative means insert an lowercase letter. item_0 <string> "\n \\item " The command to be inserted between two primary (level 0) items. item_1 <string> "\n \\subitem " The command to be inserted between two secondary (level 1) items. item_2 <string> "\n \\subsubitem " The command to be inserted between two level 2 items. item_01 <string> "\n \\subitem " The command to be inserted between a level 0 item and a level 1 item. item_x1 <string> "\n \\subitem " The command to be inserted between a level 0 item and a level 1 item. The difference between this and previous is that in this case the level 0 item doesn't have any page numbers. item_12 <string> "\n \\subsubitem " The command to be inserted between a level 1 item and a level 2 item. item_x2 <string> "\n \\subsubitem " The command to be inserted between a level 1 item and a level 2 item. The difference between this and previous is that in this case the level 1 item doesn't have any page number. delim_0 <string> ", " The delimiter to be inserted between a level 0 key and its first page number. Default is a comma followed by a blank. delim_1 <string> ", " The delimiter to be inserted between a level 1 key and its first page number. Default is a comma followed by a blank.

Using the makeindx TeX/LaTeX Tool Page 5 delim_2 <string> ", " The delimiter to be inserted between a level 2 key and its first page number. Default is a comma followed by a blank. delim_n <string> ", " The delimiter to be inserted between two page numbers for the same key in any level. Default is a comma followed by a blank. delim_r <string> "--" The delimiter to be inserted between the starting and ending page numbers of a range. encap_prefix <string> "\\" The prefix for the command which encapsulates the page number. encap_infix <string> "{" The prefix for the command which encapsulates the page number. encap_suffix <string> "}". The prefix for the command which encapsulates the page number. line_max <number> 72 The maximum length of a line in the output beyond which a line wraps around. indent_space <string> "\t\t" The space to be inserted in front of a wrapped line. Default is two tabs. indent_length <number> 16 The length of indent_space. In the default case this is 16 (for 2 tabs). 4. EXAMPLE The following example shows a style file called book.isty; which defines a stand-alone index for a book. By stand-alone, we mean it can be formatted independent of the main source. preamble "\\documentstyle[12pt]{book} \\begin{document} \\begin{theindex} {\\small\n" postamble "\n\n} \\end{theindex} \\end{document}\n" Suppose a particular book style requires the index (as well as any chapters) to start from an odd page number. Given foo.idx as the raw index file, the following command line produces an index in file foo-.ind. makeindx -s book.isty -o foo-.ind -p odd foo The reason to use a non-default output file name is to avoid clobbering the source output (presumably foo.dvi) because if the index is in file foo.ind, its output will also be in foo.dvi as a result of separate formatting using LaTeX. In the example the index is in foo-.ind, its output will be in foo-.dvi and thus introduces no

Using the makeindx TeX/LaTeX Tool Page 6 confusion. 5. ORDERING By default makeindx assumes word ordering. The -l option turns it into letter ordering. The only difference is whether a blank is treated as an effective letter or not. In word ordering, a blank precedes any letter in the alphabet, whereas in letter ordering, it doesn't count at all. This is best illustrated by the following example: word order sea lion seal letter order seal sea lion Numbers are sorted in numeric order. For instance, 9 (nine), 123 10 (ten), see Derek, Bo Letters are first sorted with uppercase and lowercase considered identical; then, within identical words the uppercase letter precedes its lowercase counterpart. Patterns lead by a special symbol precede numbers, which precede patterns lead by a letter. The symbol here refers to anything not in the union of digits and English alphabet. This includes those which follow 'z' in the ASCII (or EBCDIC, as in the CMS implementation) chart. As a special case, anything started with a digit but mixed with non-digits is considered a symbol-leading pattern instead of a number. In the normal case entries such as \indexentry{alpha}{1} \indexentry{alpha!beta}{3} \indexentry{alpha!beta!gamma}{10} in the raw index file will be converted to \item alpha, 1 \subitem beta, 3 \subsubitem gamma, 10 6. SPECIAL EFFECTS in the output index file by makeindx. Notice that the level symbol ('!') is used to delimit levels of nesting. It is possible to make an item appear in a designated form by using the actual ('@') operator. For instance, will become \indexentry{alpha@{\it alpha\/}}{1} \item {\it alpha\/} 1 after the conversion. The idea is that the pattern preceding '@' is used as sort key, whereas the one following it is put in the actual result. However, the same key with and without the actual part are regarded as distinct entries.

Using the makeindx TeX/LaTeX Tool Page 7 It is also possible to encapsulate a page number with a designated command using the encap (' ') operator. For example, in the default case, \indexentry{alpha bold}{1} will be converted to \item alpha \bold{1} where \bold{n} will expand to {\bf n}. This allows the encap operator to be used to set pages in different fonts, thereby conveying more information about whatever being indexed. For instance, given the same key the page where its definition appears can be in one font while where its primary example is given can be in another, with other ordinary appearances in a third. Notice that in this example, the three output attributes associated with page encapsulation encap_prefix, encap_infix, and encap_suffix correspond respectively to backslash, left brace, and right brace. If this is to be formatted by languages other than LaTeX, they would be defined differently. By the same token, the encap operator can be used to make cross references in the index. For instance, will become \indexentry{alpha see{beta}}{1} \item alpha \see{beta}{1} in the output index file after the conversion, where \see{beta}{1} will expand to {\it see\/} beta Notice that in a cross reference like this the page number disappears. Therefore, where to insert such a command in the source is immaterial. A pair of encap concatenated with range_open (' (') and with range_close (' ),mono) creates an explicit page range. That is, will become \indexentry{alpha (}{1} \indexentry{alpha )}{5} \item alpha, 1--5 Intermediate pages indexed by the same key will be merged into the range implicitly. This is especially useful when an entire section about a particular subject is to be indexed, in which case only the range opening and closing operators need to be inserted at the beginning and end of the section, respectively. This explicit page range formation can also include an extra command to set the page range in a designated font. Thus

Using the makeindx TeX/LaTeX Tool Page 8 will become \indexentry{alpha (bold}{1} \indexentry{alpha )}{5} \item alpha, \bold{1--5} A couple of special cases are worth mentioning here. First, entries like \indexentry{alpha (}{1} \indexentry{alpha bold}{3} \indexentry{alpha )}{5} will be interpreted as \item alpha, \bold{3}, 1--5 but with a warning message in the transcript about the encounter of an inconsistent page encapsulator. Secondly, an explicit range beginning in a Roman page number and ending in Arabic is considered an error. In a case like this the range is broken into two subranges, if possible, one in Roman, the other in Arabic. For instance, \indexentry{alpha (}{i} \indexentry{alpha}{iv} \indexentry{alpha}{3} \indexentry{alpha )}{7} will be turned into \item alpha, 1--iv, 3--7 with a warning message in the transcript complaining about the illegal range formation. Finally, every special symbol mentioned in this section may be escaped by the quote operator ('"'). Thus \indexentry{alpha"@beta}{1} will actually become \item alpha@beta, 1 as a result of executing makeindx. However, if quote is preceded by escape ('\'), its following letter is not escaped. That is, means \indexentry{f\"ur}{1} \item f\"ur, 1 which represents umlaut accented 'u' to the TeX family of processors.

Using the makeindx TeX/LaTeX Tool Page 9 7.1. SEE ALSO tex(l), latex(l), qsort(3) 7.2. AUTHOR Pehong Chen Computer Science Division University of California, Berkeley phc@berkeley.edu 7.3. THANKS 7. Final Notes Leslie Lamport contributed significantly to the design. Michael Harrison provided valuable comments and suggestions.