summaryrefslogtreecommitdiff
path: root/indexing/forindex/docs/forindex.lyx
blob: 1b4146aa0d8e5b88d45b6c6f9916c411a1f121a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
#LyX 1.3 created this file. For more info see http://www.lyx.org/
\lyxformat 221
\textclass article
\begin_preamble
\usepackage{url}
\end_preamble
\language english
\inputencoding latin1
\fontscheme default
\graphics default
\paperfontsize default
\spacing single 
\papersize a4paper
\paperpackage a4
\use_geometry 0
\use_amsmath 0
\use_natbib 0
\use_numerical_citations 0
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle default

\layout Title

The forindex utilities
\newline 
 Version 0.1
\layout Author

Guido Milanese
\newline 

\begin_inset ERT
status Collapsed

\layout Standard
 
\backslash 
url{guido.milanese@unicatt.it}
\end_inset 


\layout Standard


\begin_inset ERT
status Collapsed

\layout Standard

\backslash 
thispagestyle{empty}
\end_inset 


\layout Date

January 2005
\layout Abstract
\noindent 
Making a good index is a very important part in the process of writing a
 document, particularly books and manuals.
 Entering data manually can be a very long process; although a certain amount
 of data must be entered manually, some tasks can be performed automatically,
 e.g.
 an index of geographical names or other trivial tasks.
 This task can be achieved using the program 
\family sans 
doindex
\family default 
, that prepares a file to be processed by 
\family sans 
makeindex
\family default 
.
 Another useful feature is to remove all the 
\family typewriter 

\backslash 
index
\family default 
 entries in a LaTeX file, obtaining a clean file with no indexing (program
 
\family sans 
cleanindex
\family default 
).
 The programs are written in Snobol4; the only requirement is to install
 the interpreter.
 For Windows, a standalone file compiled with Spitbol is also provided,
 and the programs can be run without the need of an external interpreter.
 
\layout Standard


\begin_inset LatexCommand \tableofcontents{}

\end_inset 


\layout Section

The programs
\layout Subsection

The program 
\family sans 
doindex
\layout Standard

The programs 
\family sans 
doindex
\family default 
 reads a LaTeX file, using a list file, and enters index entries in the
 file according to this list.
 Previously entered index entries are left unchanged, making it possible
 to add further indexing to an already indexed file.
\layout Standard

The input LaTeX file may have extension 
\family typewriter 
tex
\family default 
 or 
\family typewriter 
latex
\family default 
, both uppercase and lowercase (not mixed as in 
\family typewriter 
Tex
\family default 
).
\layout Standard

The list file is meant to contain all the words to be indexed.
 It must have exactly the extension 
\family typewriter 
wls
\family default 
.
 Sub-entries are identified with the separator character '/'.
 See 
\family sans 
test.wls
\family default 
 as example:
\layout Quote


\begin_inset ERT
status Collapsed

\layout Standard

\backslash 
begin{verbatim}
\newline 
  animals
\newline 
  dogs/animals
\newline 
  cats
\newline 
  house/nouns/english/languages
\newline 
  sleeping@sleep
\newline 
  évita/Italian/foreign words
\newline 
  ça/French/foreign words
\newline 
  drücken/German/foreign words
\newline 
  
\backslash 
end{verbatim}
\end_inset 


\layout Standard

No particular order in this file is required.
 Some users will prefer alphabetical order, others different orders, so
 the programs has no requirements concerning order/sort in this file.
 Entries as 
\family typewriter 
sleeping@sleep
\family default 
 use the standard 
\family sans 
makeindex
\family default 
 syntax and are left unchanged.
 The 
\begin_inset Quotes eld
\end_inset 

logic
\begin_inset Quotes erd
\end_inset 

 of this syntax is opposite to the internal logic of 
\family sans 
makeindex
\family default 
, that is -- I think -- very clever at the stage of typesetting an index,
 but not at the stage of designing an index.
 
\begin_inset Quotes eld
\end_inset 

A dog is an animal
\begin_inset Quotes erd
\end_inset 

 (
\family typewriter 
dog/animal
\family default 
 in my syntax) seems to me to be more natural than 
\begin_inset Quotes eld
\end_inset 

Among animals there are dogs
\begin_inset Quotes erd
\end_inset 

 (
\family typewriter 
animals!dogs
\family default 
 in the 
\family sans 
makeindex
\family default 
 syntax).
 The LaTeX file produced by 
\family sans 
doindex
\family default 
 follows, of course, the 
\family sans 
makeindex
\family default 
 conventions.
\layout Standard

The original LaTeX file is left unchanged.
 A new file will be written, identified by 
\family sans 
-ind
\family default 
.
 For example, from 
\family sans 
file.tex
\family default 
 you will get 
\family sans 
file-ind.tex
\family default 
.
 Of course, you'll have to run 
\family sans 
makeindex
\family default 
 as usual.
\layout Standard

The purpose of the program is similar to what is provided by the program
 
\begin_inset ERT
status Collapsed

\layout Standard

\backslash 
mbox{
\end_inset 


\family sans 
ixgen
\family default 

\begin_inset ERT
status Collapsed

\layout Standard
}
\end_inset 

 (
\begin_inset ERT
status Collapsed

\layout Standard

\backslash 
url{http://www.iit.upco.es/~oscar/ixgen/}
\end_inset 

) written by 
\shape smallcaps 
Oscar Lopez
\shape default 
 (
\begin_inset ERT
status Collapsed

\layout Standard

\backslash 
url{oscar@iit.upco.es}
\end_inset 

), but 
\family sans 
forindex
\family default 
 was designed to be a bit more flexible.
\layout Subsection

The program 
\family sans 
cleanindex
\layout Standard

The program 
\family sans 
cleanindex
\family default 
 removes 
\family sans 

\backslash 
index
\family default 
 sequences from a LaTeX file.
 The program can be used e.g.
 if a user is not happy with the indexing of a file and wants to start it
 over again.
\layout Standard

The input file may have extension 
\family typewriter 
tex
\family default 
 or 
\family typewriter 
latex
\family default 
, both uppercase and lowercase.
\layout Standard

The original file is left unchanged.
 A new file will be written, identified by 
\family sans 
-noind
\family default 
.
 For example, from 
\family sans 
file.tex
\family default 
 you will get 
\family sans 
file-noind.tex
\family default 
.
 In this file, lines concerning 
\family sans 
makeindex
\family default 
 will be left but commented, in order to avoid an empty 
\emph on 
Contents
\emph default 
 section in the output.
 You can uncomment the lines as soon as you want to reindex the file again.
\layout Section

Installation
\layout Subsection

GNU/Linux and other *nix systems
\layout Enumerate

Install 
\family sans 
snobol4
\family default 
 from 
\begin_inset ERT
status Collapsed

\layout Standard

\backslash 
url{http://www.snobol4.org}
\end_inset 

.
 This is Philip Budne's CSNOBOL implementation.
 You need a 
\family typewriter 
c
\family default 
 compiler to compile the interpreter; it's normally a very quick and easy
 process.
 
\layout Enumerate

Make sure 
\family sans 
snobol4
\family default 
 is in your PATH or make a symbolic link.
 
\layout Enumerate

Copy all the files from the source directory in a suitable directory (you
 do not need the 
\family typewriter 
bat
\family default 
 files, provided for Windows, and can safely remove them).
 
\layout Enumerate

Make executables the scripts (
\family sans 
doindex
\family default 
 and 
\family sans 
cleanindex
\family default 
 with no extensions), e.g.
 
\family typewriter 
chmod +x doindex
\layout Enumerate

Run the scripts as follows:
\begin_deeper 
\layout Enumerate

-- to index a text: 
\family typewriter 
./doindex file.tex
\layout Enumerate

If you want to exclude words with accents: 
\family typewriter 
./doindex file.tex --noacc
\layout Enumerate

-- to remove 
\family sans 

\backslash 
index 
\family default 
sequences: 
\family typewriter 
./cleanindex file.tex
\layout Enumerate

If the current directory is in your PATH, you do not need 
\family typewriter 
./
\family default 
 before the script name.
\newline 

\end_deeper 
\layout Subsection

Windows
\layout Standard

The package offers exe files compiled with Spitbol (see (
\begin_inset ERT
status Collapsed

\layout Standard

\backslash 
url{http://www.snobol4.com}
\end_inset 

).
 Make a directory and copy all the file in the bin/windows directory.
 There must be two 
\family typewriter 
*.exe
\family default 
 files and the two 
\family typewriter 
test.*
\family default 
 files.
\layout Standard

Run the programs as follows:
\layout Standard

-- to index a text: 
\family typewriter 
doindex file.tex
\layout Standard

If you want to exclude words with accents: 
\family typewriter 
doindex file.tex -noacc
\family default 
.
 Accents must be encoded using the 
\family sans 
latin1
\family default 
 encoding (see the list of Todo).
\layout Standard

-- to remove 
\family typewriter 

\backslash 
index
\family default 
 sequences: 
\family typewriter 
cleanindex file.tex
\layout Subsection

Windows from source
\layout Standard

Basically, follow the same directions given about GNU/Linux, but make sure
 to use the 
\family typewriter 
bat
\family default 
 files and to install the Windows version of the interpreter.
 Before using the sources, that are in Unix format, use a script to translate
 from Unix to Dos-Windows format.
 If you do not have such a script, open the files with a text editor and
 save the sources in Windows-Dos format.
 This can be done reading and saving each file with the DOS 
\family sans 
edit
\family default 
 program, with 
\family sans 
vim
\family default 
 or any other editor able to deal with different file formats.
 Do not alter the files if you are not sure of what you are doing.
 Please (1) do not use a word processor (as Word or similar) but a simple
 text editor and (2) make sure to leave the encoding of file 
\family sans 
acc.inc
\family default 
 to 
\family sans 
ISO-8859-1
\family default 
 or 
\family sans 
8859-15
\family default 
, not to plain DOS or Unicode.
\layout Subsection

Cygwin
\layout Standard

I suggest to follow the same directions given for GNU/Linux, but the EXE
 files provided for native Windows can be used anyway if preferred.
\layout Subsection

Macintosh
\layout Standard

Not yet tested (I do not have a Mac right now).
 It's in the TODO list.
\layout Section

Test files
\layout Standard

Please test the program on 
\family sans 
test.tex
\family default 
 and 
\family sans 
test.wls
\family default 
.
 The produced file will be called 
\family sans 
test-ind.tex
\family default 
 if you use 
\family sans 
doindex
\family default 
, 
\family sans 
test-noind.tex
\family default 
 if you use 
\family sans 
cleanindex
\family default 
.
\layout Section

Bugs and TODO
\layout Standard

The program does not support Unicode files.
 At this moment, most LaTeX users are still using latin1, but the situation
 is rapidly changing.
\layout Standard

List of features that I would like to add:
\layout Enumerate

Index also included files.
 
\layout Enumerate

Add typographical styles, such as italics for the most important locations
 of a word.
 
\layout Enumerate

Add support for several indexes (particularly with class 
\family sans 
memoir
\family default 
) 
\layout Enumerate

Add an option to generate a rough index for all the words.
 
\layout Enumerate

Add a support to index words listed with regular expressions.
 E.g.
 
\family typewriter 
read*
\family default 
 should index 
\emph on 
read
\emph default 
, 
\emph on 
reads
\emph default 
, 
\emph on 
reading
\emph default 
, 
\emph on 
readings
\emph default 
, all under the same heading 
\emph on 
read
\emph default 
.
 
\layout Enumerate

Make possible to use another separator for the list file, e.g.
 a simple blank or other char preferred by user.
 
\layout Enumerate

Test the programs on a Mac.
 
\layout Enumerate

Add Unicode support.
 
\layout Section

Acknowledgements
\layout Standard

The program 
\family sans 
ixgen
\family default 
 gave me the idea of 
\family sans 
forindex
\family default 
.
 Many thanks to 
\shape smallcaps 
Oscar Lopez
\shape default 
 for this very good program.
\layout Standard

Some questions sent by 
\shape smallcaps 
Carlo Pellegrino
\shape default 
 (Modena University, Italy) gave me the idea of transforming a very rudimentary
 script into a general purpose utility.
 
\shape smallcaps 
Maurizio Loreti
\shape default 
 (Padua University, Italy) sent me very useful remarks on the problems of
 automatical generations of indexes, which I made use of in the introduction
 to this text.
\layout Standard

My warmest thanks to 
\shape smallcaps 
Phil Budne
\shape default 
 (
\begin_inset ERT
status Collapsed

\layout Standard

\backslash 
url{phil@ultimate.com}
\end_inset 

) for making his excellent CSNOBOL available.
 Many thanks to the community of Snobol users, particularly to the members
 of the list 
\begin_inset ERT
status Collapsed

\layout Standard

\backslash 
url{snobol4@mercury.dsu.edu}
\end_inset 

, and, among them, to 
\shape smallcaps 
Gordon Peterson
\shape default 
 (
\begin_inset ERT
status Collapsed

\layout Standard

\backslash 
url{http://personal.terabites.com/}
\end_inset 

), 
\shape smallcaps 
Michael Radow
\shape default 
 (
\begin_inset ERT
status Collapsed

\layout Standard

\backslash 
url{mikeradow@yahoo.com}
\end_inset 

), 
\shape smallcaps 
Gregory L.
 White
\shape default 
 (
\begin_inset ERT
status Collapsed

\layout Standard

\backslash 
url{glwhite@netconnect.com.au}
\end_inset 

) and to 
\shape smallcaps 
Rafal M.
 Sulejman
\shape default 
 (
\begin_inset ERT
status Collapsed

\layout Standard

\backslash 
url{rafal@engelsinfo.de}
\end_inset 

) whose 
\family sans 
vim
\family default 
 syntax files are a daily blessing.
\layout Standard

Thanks to Jim Hefferon <
\begin_inset ERT
status Collapsed

\layout Standard

\backslash 
url{ftpmaint@alan.smcvt.edu}
\end_inset 

> who pointed out that the original name of the package,
\family sans 
 4index
\family default 
, was not acceptable due to XML syntax rules.
\layout Section

Author, copyright, license, disclaimer
\layout Standard

This program is Copyright 
\begin_inset ERT
status Collapsed

\layout Standard

\backslash 
copyright{}
\end_inset 

 2005
\newline 
 Guido Milanese <
\begin_inset ERT
status Collapsed

\layout Standard

\backslash 
url{guido.milanese@unicatt.it}
\end_inset 

>
\newline 
 under the terms of the GNU General Public License.
\newline 

\layout Standard


\size footnotesize 

\begin_inset ERT
status Collapsed

\layout Standard

\backslash 
begin{verbatim}
\newline 
This program is free software; you can redistribute it and/or modify it under
\newline 
the terms of the GNU General Public License as published by the Free Software
\newline 
Foundation; either version 2 of the License, or (at your option) any later
\newline 
version.
\newline 

\newline 
This program is distributed in the hope that it will be useful, but WITHOUT ANY
\newline 
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
\newline 
PARTICULAR PURPOSE. See the GNU General Public License for more details.
\newline 

\newline 
If you do not have a copy of the GNU General Public License write to the Free
\newline 
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
\newline 

\newline 
If the author of this software was too lazy to include the full GPL text along
\newline 
with the code, you can find it at: http://www.gnu.org/copyleft/gpl.html.
\newline 

\backslash 
end{verbatim}
\end_inset 

 
\the_end