diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /indexing/forindex |
Initial commit
Diffstat (limited to 'indexing/forindex')
-rw-r--r-- | indexing/forindex/README | 29 | ||||
-rw-r--r-- | indexing/forindex/bin/windows/test.tex | 20 | ||||
-rw-r--r-- | indexing/forindex/bin/windows/test.wls | 8 | ||||
-rw-r--r-- | indexing/forindex/docs/forindex.html | 457 | ||||
-rw-r--r-- | indexing/forindex/docs/forindex.lyx | 922 | ||||
-rw-r--r-- | indexing/forindex/docs/forindex.pdf | bin | 0 -> 351370 bytes | |||
-rw-r--r-- | indexing/forindex/docs/forindex.tex | 250 | ||||
-rw-r--r-- | indexing/forindex/source/acc.inc | 75 | ||||
-rw-r--r-- | indexing/forindex/source/cleanind.bat | 2 | ||||
-rw-r--r-- | indexing/forindex/source/cleanindex | 3 | ||||
-rw-r--r-- | indexing/forindex/source/cleanindex.sno | 83 | ||||
-rw-r--r-- | indexing/forindex/source/doindex | 3 | ||||
-rw-r--r-- | indexing/forindex/source/doindex.bat | 2 | ||||
-rw-r--r-- | indexing/forindex/source/doindex.sno | 318 | ||||
-rw-r--r-- | indexing/forindex/source/extrepl.inc | 14 | ||||
-rw-r--r-- | indexing/forindex/source/ioerror.inc | 24 | ||||
-rw-r--r-- | indexing/forindex/source/test.tex | 20 | ||||
-rw-r--r-- | indexing/forindex/source/test.wls | 8 |
18 files changed, 2238 insertions, 0 deletions
diff --git a/indexing/forindex/README b/indexing/forindex/README new file mode 100644 index 0000000000..20d0fb6911 --- /dev/null +++ b/indexing/forindex/README @@ -0,0 +1,29 @@ +forindex +Version 0.1 +Guido Milanese <guido.milanese@unicatt.it> + +Contents of this package: +source Snobol source files, bash scripts and bat files for Windows, test files +bin/windows Executable files for Windows, with test files in Dos-Windows format +doc Documentation files in LaTeX, LyX, PDF and HTML formats. + Please notice that the LaTeX and LyX files use A4 paper. + +To install and use this package, please read the documentation file. + +Copyright (C) 2005 Guido Milanese guido.milanese@unicatt.it +under the terms of the GNU General Public License + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. + +If you do not have a copy of the GNU General Public License write to the Free +Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +If the author of this software was too lazy to include the full GPL text along +with the code, you can find it at: http://www.gnu.org/copyleft/gpl.html diff --git a/indexing/forindex/bin/windows/test.tex b/indexing/forindex/bin/windows/test.tex new file mode 100644 index 0000000000..5a1827374a --- /dev/null +++ b/indexing/forindex/bin/windows/test.tex @@ -0,0 +1,20 @@ +% File: test.tex
+% Guido Milanese <guido.milanese@unicatt.it>
+% Test file to use with the 4index programs
+
+\documentclass[a4paper]{article}
+\usepackage[latin1]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{makeidx}
+\makeindex
+
+\begin{document}
+
+
+The\index{articles!the} cats are sleeping. The dogs are barking. Both cats, and
+dogs, are animals. They live\index{verbs!english!live} in my house (accents)
+évita drücken ça.
+
+\printindex
+\end{document}
+
diff --git a/indexing/forindex/bin/windows/test.wls b/indexing/forindex/bin/windows/test.wls new file mode 100644 index 0000000000..ed2f148562 --- /dev/null +++ b/indexing/forindex/bin/windows/test.wls @@ -0,0 +1,8 @@ +animals
+dogs/animals
+cats
+house/nouns/english/languages
+sleeping@sleep
+évita/Italian/foreign words
+ça/French/foreign words
+drücken/German/foreign words
diff --git a/indexing/forindex/docs/forindex.html b/indexing/forindex/docs/forindex.html new file mode 100644 index 0000000000..900796d4bb --- /dev/null +++ b/indexing/forindex/docs/forindex.html @@ -0,0 +1,457 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> + +<!--Converted with LaTeX2HTML 2002-2-1 (1.70) +original version by: Nikos Drakos, CBLU, University of Leeds +* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan +* with significant contributions from: + Jens Lippmann, Marek Rouchal, Martin Wilck and others --> +<HTML> +<HEAD> +<TITLE>The forindex utilities Version 0.1</TITLE> +<META NAME="description" CONTENT="The forindex utilities Version 0.1"> +<META NAME="keywords" CONTENT="forindex"> +<META NAME="resource-type" CONTENT="document"> +<META NAME="distribution" CONTENT="global"> + +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> +<META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1"> +<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> + +<LINK REL="STYLESHEET" HREF="forindex.css"> + +</HEAD> + +<BODY > +<P> + +<P> + +<P> +<H1 ALIGN="CENTER">The forindex utilities +<BR> +Version 0.1</H1> +<DIV> + +<P ALIGN="CENTER"><STRONG>Guido Milanese</STRONG></P> +<P ALIGN="CENTER"><I> <TT><A NAME="tex2html1" + HREF="guido.milanese@unicatt.it">guido.milanese@unicatt.it</A></TT></I></P> +</DIV> + +<P> + +<P> + +<H3>Abstract:</H3> +<DIV> +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 <I>doindex</I>, that prepares +a file to be processed by <I>makeindex</I>. Another useful feature +is to remove all the <TT>\index</TT> entries in a L<SUP><SMALL>A</SMALL></SUP>T<SMALL>E</SMALL>X +file, obtaining a clean file with no indexing (program <I>cleanindex</I>). +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. +</DIV> +<P> +<BR> + +<H2><A NAME="SECTION00010000000000000000"> +Contents</A> +</H2> +<!--Table of Contents--> + +<UL> +<LI><A NAME="tex2html29" + HREF="forindex.html#SECTION00020000000000000000">1 The programs</A> +<UL> +<LI><A NAME="tex2html30" + HREF="forindex.html#SECTION00021000000000000000">1.1 The program doindex</A> +<LI><A NAME="tex2html31" + HREF="forindex.html#SECTION00022000000000000000">1.2 The program cleanindex</A> +</UL> +<BR> +<LI><A NAME="tex2html32" + HREF="forindex.html#SECTION00030000000000000000">2 Installation</A> +<UL> +<LI><A NAME="tex2html33" + HREF="forindex.html#SECTION00031000000000000000">2.1 GNU/Linux and other *nix systems</A> +<LI><A NAME="tex2html34" + HREF="forindex.html#SECTION00032000000000000000">2.2 Windows</A> +<LI><A NAME="tex2html35" + HREF="forindex.html#SECTION00033000000000000000">2.3 Windows from source</A> +<LI><A NAME="tex2html36" + HREF="forindex.html#SECTION00034000000000000000">2.4 Cygwin</A> +<LI><A NAME="tex2html37" + HREF="forindex.html#SECTION00035000000000000000">2.5 Macintosh</A> +</UL> +<BR> +<LI><A NAME="tex2html38" + HREF="forindex.html#SECTION00040000000000000000">3 Test files</A> +<LI><A NAME="tex2html39" + HREF="forindex.html#SECTION00050000000000000000">4 Bugs and TODO</A> +<LI><A NAME="tex2html40" + HREF="forindex.html#SECTION00060000000000000000">5 Acknowledgements</A> +<LI><A NAME="tex2html41" + HREF="forindex.html#SECTION00070000000000000000">6 Author, copyright, license, disclaimer</A> +</UL> +<!--End of Table of Contents--> + +<P> + +<H1><A NAME="SECTION00020000000000000000"> +1 The programs</A> +</H1> + +<P> + +<H2><A NAME="SECTION00021000000000000000"> +1.1 The program <I>doindex</I></A> +</H2> + +<P> +The programs <I>doindex</I> reads a L<SUP><SMALL>A</SMALL></SUP>T<SMALL>E</SMALL>X 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. + +<P> +The input L<SUP><SMALL>A</SMALL></SUP>T<SMALL>E</SMALL>X file may have extension <TT>tex</TT> or <TT>latex</TT>, +both uppercase and lowercase (not mixed as in <TT>Tex</TT>). + +<P> +The list file is meant to contain all the words to be indexed. It +must have exactly the extension <TT>wls</TT>. Sub-entries are identified +with the separator character '/'. See <I>test.wls</I> as example: + +<P><PRE> + animals + dogs/animals + cats + house/nouns/english/languages + sleeping@sleep + évita/Italian/foreign words + ça/French/foreign words + drücken/German/foreign words +</PRE> +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 <TT>sleeping@sleep</TT> +use the standard <I>makeindex</I> syntax and are left unchanged. +The ``logic'' of this syntax is opposite to the internal logic +of <I>makeindex</I>, that is - I think - very clever at the stage +of typesetting an index, but not at the stage of designing an index. +``A dog is an animal'' (<TT>dog/animal</TT> in my syntax) seems +to me to be more natural than ``Among animals there are dogs'' +(<TT>animals!dogs</TT> in the <I>makeindex</I> syntax). The L<SUP><SMALL>A</SMALL></SUP>T<SMALL>E</SMALL>X +file produced by <I>doindex</I> follows, of course, the <I>makeindex</I> +conventions. + +<P> +The original L<SUP><SMALL>A</SMALL></SUP>T<SMALL>E</SMALL>X file is left unchanged. A new file will be written, +identified by <I>-ind</I>. For example, from <I>file.tex</I> you +will get <I>file-ind.tex</I>. Of course, you'll have to run <I>makeindex</I> +as usual. + +<P> +The purpose of the program is similar to what is provided by the program +<I>ixgen</I> (<TT><A NAME="tex2html2" + HREF="http://www.iit.upco.es/~oscar/ixgen/">http://www.iit.upco.es/~oscar/ixgen/</A></TT>) +written by O<SMALL>SCAR </SMALL>L<SMALL>OPEZ</SMALL> (<TT><A NAME="tex2html3" + HREF="oscar@iit.upco.es">oscar@iit.upco.es</A></TT>), but <I>forindex</I> +was designed to be a bit more flexible. + +<P> + +<H2><A NAME="SECTION00022000000000000000"> +1.2 The program <I>cleanindex</I></A> +</H2> + +<P> +The program <I>cleanindex</I> removes <I>\index</I> +sequences from a L<SUP><SMALL>A</SMALL></SUP>T<SMALL>E</SMALL>X 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. + +<P> +The input file may have extension <TT>tex</TT> or <TT>latex</TT>, +both uppercase and lowercase. + +<P> +The original file is left unchanged. A new file will be written, identified +by <I>-noind</I>. For example, from <I>file.tex</I> you will get +<I>file-noind.tex</I>. In this file, lines concerning <I>makeindex</I> +will be left but commented, in order to avoid an empty <I>Contents</I> +section in the output. You can uncomment the lines as soon as you +want to reindex the file again. + +<P> + +<H1><A NAME="SECTION00030000000000000000"> +2 Installation</A> +</H1> + +<P> + +<H2><A NAME="SECTION00031000000000000000"> +2.1 GNU/Linux and other *nix systems</A> +</H2> + +<P> + +<OL> +<LI>Install <I>snobol4</I> from <TT><A NAME="tex2html4" + HREF="http://www.snobol4.org">http://www.snobol4.org</A></TT>. This +is Philip Budne's CSNOBOL implementation. You need a <TT>c</TT> compiler +to compile the interpreter; it's normally a very quick and easy process. +</LI> +<LI>Make sure <I>snobol4</I> is in your PATH or make a symbolic link. +</LI> +<LI>Copy all the files from the source directory in a suitable directory +(you do not need the <TT>bat</TT> files, provided for Windows, and +can safely remove them). +</LI> +<LI>Make executables the scripts (<I>doindex</I> and <I>cleanindex</I> +with no extensions), e.g. <TT>chmod +x doindex</TT> +</LI> +<LI>Run the scripts as follows: + +<P> + +<OL> +<LI>- to index a text: <TT>./doindex file.tex</TT> +</LI> +<LI>If you want to exclude words with accents: <TT>./doindex file.tex +-noacc</TT> +</LI> +<LI>- to remove <I>\index</I> sequences: <TT>./cleanindex +file.tex</TT> +</LI> +<LI>If the current directory is in your PATH, you do not need <TT>./</TT> +before the script name. +<BR> +<P> +</LI> +</OL> +</LI> +</OL> + +<P> + +<H2><A NAME="SECTION00032000000000000000"> +2.2 Windows</A> +</H2> + +<P> +The package offers exe files compiled with Spitbol (see (<TT><A NAME="tex2html5" + HREF="http://www.snobol4.com">http://www.snobol4.com</A></TT>). +Make a directory and copy all the file in the bin/windows directory. +There must be two <TT>*.exe</TT> files and the two <TT>test.*</TT> +files. + +<P> +Run the programs as follows: + +<P> +- to index a text: <TT>doindex file.tex</TT> + +<P> +If you want to exclude words with accents: <TT>doindex file.tex +-noacc</TT>. Accents must be encoded using the <I>latin1</I> encoding +(see the list of Todo). + +<P> +- to remove <TT>\index</TT> sequences: <TT>cleanindex +file.tex</TT> + +<P> + +<H2><A NAME="SECTION00033000000000000000"> +2.3 Windows from source</A> +</H2> + +<P> +Basically, follow the same directions given about GNU/Linux, but make +sure to use the <TT>bat</TT> 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 <I>edit</I> program, with <I>vim</I> 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 <I>acc.inc</I> +to <I>ISO-8859-1</I> or <I>8859-15</I>, not to plain DOS or Unicode. + +<P> + +<H2><A NAME="SECTION00034000000000000000"> +2.4 Cygwin</A> +</H2> + +<P> +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. + +<P> + +<H2><A NAME="SECTION00035000000000000000"> +2.5 Macintosh</A> +</H2> + +<P> +Not yet tested (I do not have a Mac right now). It's in the TODO list. + +<P> + +<H1><A NAME="SECTION00040000000000000000"> +3 Test files</A> +</H1> + +<P> +Please test the program on <I>test.tex</I> and <I>test.wls</I>. +The produced file will be called <I>test-ind.tex</I> if you use +<I>doindex</I>, <I>test-noind.tex</I> if you use <I>cleanindex</I>. + +<P> + +<H1><A NAME="SECTION00050000000000000000"> +4 Bugs and TODO</A> +</H1> + +<P> +The program does not support Unicode files. At this moment, most L<SUP><SMALL>A</SMALL></SUP>T<SMALL>E</SMALL>X +users are still using latin1, but the situation is rapidly changing. + +<P> +List of features that I would like to add: + +<P> + +<OL> +<LI>Index also included files. +</LI> +<LI>Add typographical styles, such as italics for the most important locations +of a word. +</LI> +<LI>Add support for several indexes (particularly with class <I>memoir</I>) +</LI> +<LI>Add an option to generate a rough index for all the words. +</LI> +<LI>Add a support to index words listed with regular expressions. E.g. +<TT>read*</TT> should index <I>read</I>, <I>reads</I>, <I>reading</I>, +<I>readings</I>, all under the same heading <I>read</I>. +</LI> +<LI>Make possible to use another separator for the list file, e.g. a simple +blank or other char preferred by user. +</LI> +<LI>Test the programs on a Mac. +</LI> +<LI>Add Unicode support. +</LI> +</OL> + +<P> + +<H1><A NAME="SECTION00060000000000000000"> +5 Acknowledgements</A> +</H1> + +<P> +The program <I>ixgen</I> gave me the idea of <I>forindex</I>. +Many thanks to O<SMALL>SCAR </SMALL>L<SMALL>OPEZ</SMALL> for this very good program. + +<P> +Some questions sent by C<SMALL>ARLO </SMALL>P<SMALL>ELLEGRINO</SMALL> (Modena University, +Italy) gave me the idea of transforming a very rudimentary script +into a general purpose utility. M<SMALL>AURIZIO </SMALL>L<SMALL>ORETI</SMALL> (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. + +<P> +My warmest thanks to P<SMALL>HIL </SMALL>B<SMALL>UDNE</SMALL> (<TT><A NAME="tex2html6" + HREF="phil@ultimate.com">phil@ultimate.com</A></TT>) +for making his excellent CSNOBOL available. Many thanks to the community +of Snobol users, particularly to the members of the list <TT><A NAME="tex2html7" + HREF="snobol4@mercury.dsu.edu">snobol4@mercury.dsu.edu</A></TT>, +and, among them, to G<SMALL>ORDON </SMALL>P<SMALL>ETERSON</SMALL> (<TT><A NAME="tex2html8" + HREF="http://personal.terabites.com/">http://personal.terabites.com/</A></TT>), +M<SMALL>ICHAEL </SMALL>R<SMALL>ADOW</SMALL> (<TT><A NAME="tex2html9" + HREF="mikeradow@yahoo.com">mikeradow@yahoo.com</A></TT>), G<SMALL>REGORY +</SMALL>L. W<SMALL>HITE</SMALL> (<TT><A NAME="tex2html10" + HREF="glwhite@netconnect.com.au">glwhite@netconnect.com.au</A></TT>) and to R<SMALL>AFAL +</SMALL>M. S<SMALL>ULEJMAN</SMALL> (<TT><A NAME="tex2html11" + HREF="rafal@engelsinfo.de">rafal@engelsinfo.de</A></TT>) whose <I>vim</I> syntax +files are a daily blessing. + +<P> +Thanks to Jim Hefferon <<TT><A NAME="tex2html12" + HREF="ftpmaint@alan.smcvt.edu">ftpmaint@alan.smcvt.edu</A></TT>> who pointed +out that the original name of the package, <I>4index</I>, was not +acceptable due to XML syntax rules. + +<P> + +<H1><A NAME="SECTION00070000000000000000"> +6 Author, copyright, license, disclaimer</A> +</H1> + +<P> +This program is Copyright © 2005 +<BR> +Guido Milanese <<TT><A NAME="tex2html13" + HREF="guido.milanese@unicatt.it">guido.milanese@unicatt.it</A></TT>> +<BR> +under the terms of the GNU General Public License. +<BR> +<P> +<PRE> +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. + +If you do not have a copy of the GNU General Public License write to the Free +Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +If the author of this software was too lazy to include the full GPL text along +with the code, you can find it at: http://www.gnu.org/copyleft/gpl.html. +</PRE> + +<H1><A NAME="SECTION00080000000000000000"> +About this document ...</A> +</H1> + <STRONG>The forindex utilities +<BR> +Version 0.1</STRONG><P> +This document was generated using the +<A HREF="http://www.latex2html.org/"><STRONG>LaTeX</STRONG>2<tt>HTML</tt></A> translator Version 2002-2-1 (1.70) +<P> +Copyright © 1993, 1994, 1995, 1996, +<A HREF="http://cbl.leeds.ac.uk/nikos/personal.html">Nikos Drakos</A>, +Computer Based Learning Unit, University of Leeds. +<BR> +Copyright © 1997, 1998, 1999, +<A HREF="http://www.maths.mq.edu.au/~ross/">Ross Moore</A>, +Mathematics Department, Macquarie University, Sydney. +<P> +The command line arguments were: <BR> + <STRONG>latex2html</STRONG> <TT>-no_subdir -split 0 -show_section_numbers /tmp/lyx_tmpdir3312NEVskb/lyx_tmpbuf0/forindex.tex</TT> +<P> +The translation was initiated by guido on 2005-01-29<HR> +<ADDRESS> +<A HREF="http://www.arsantiqua.org">Guido Milanese</A>, +2005-01-29 +</ADDRESS> +</BODY> +</HTML> diff --git a/indexing/forindex/docs/forindex.lyx b/indexing/forindex/docs/forindex.lyx new file mode 100644 index 0000000000..1b4146aa0d --- /dev/null +++ b/indexing/forindex/docs/forindex.lyx @@ -0,0 +1,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 diff --git a/indexing/forindex/docs/forindex.pdf b/indexing/forindex/docs/forindex.pdf Binary files differnew file mode 100644 index 0000000000..a481edd84b --- /dev/null +++ b/indexing/forindex/docs/forindex.pdf diff --git a/indexing/forindex/docs/forindex.tex b/indexing/forindex/docs/forindex.tex new file mode 100644 index 0000000000..9ccb59ab94 --- /dev/null +++ b/indexing/forindex/docs/forindex.tex @@ -0,0 +1,250 @@ +% Forindex documentation +% Version 0.1 +% January 2005 +% Guido Milanese - guido.milanese@unicatt.it + +\documentclass[a4paper,english]{article} +\usepackage[T1]{fontenc} +\usepackage[latin1]{inputenc} +\IfFileExists{url.sty}{\usepackage{url}} + {\newcommand{\url}{\texttt}} +\usepackage{babel} + +\begin{document} + +\title{The forindex utilities\\ +Version 0.1} + + +\author{Guido Milanese\\ +\url{guido.milanese@unicatt.it}} + + +\thispagestyle{empty} +\date{January 2005} +\maketitle +\begin{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 \textsf{doindex}, that prepares a file to be processed by +\textsf{makeindex}. Another useful feature is to remove all the +\texttt{\textbackslash{}index} entries in a \LaTeX{} file, obtaining a +clean file with no indexing (program \textsf{cleanindex}). 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. +\end{abstract} + +\tableofcontents + +\section{The programs} +\subsection{The program \textsf{doindex}} +The programs \textsf{doindex} 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. + +The input \LaTeX{} file may have extension \texttt{tex} or \texttt{latex}, +both uppercase and lowercase (not mixed as in \texttt{Tex}). + +The list file is meant to contain all the words to be indexed. It must have +exactly the extension \texttt{wls}. Sub-entries are identified with the separator +character '/'. See \textsf{test.wls} as example: + + +\begin{quote} + \begin{verbatim} + animals + dogs/animals + cats + house/nouns/english/languages + sleeping@sleep + évita/Italian/foreign words + ça/French/foreign words + drücken/German/foreign words + \end{verbatim} +\end{quote} + +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 \texttt{sleeping@sleep} use the +standard \textsf{makeindex} syntax and are left unchanged. The ``logic'' of this +syntax is opposite to the internal logic of \textsf{makeindex}, that is -- I think -- +very clever at the stage of typesetting an index, but not at the stage of +designing an index. ``A dog is an animal'' (\texttt{dog/animal} in my syntax) +seems to me to be more natural than ``Among animals there are dogs'' +(\texttt{animals!dogs} in the \textsf{makeindex} syntax). The \LaTeX{} file produced +by \textsf{doindex} follows, of course, the \textsf{makeindex} conventions. + +The original \LaTeX{} file is left unchanged. A new file will be written, +identified by \textsf{-ind}. For example, from \textsf{file.tex} you will get +\textsf{file-ind.tex}. Of course, you'll have to run \textsf{makeindex} as usual. + +The purpose of the program is similar to what is provided by the program +\mbox{\textsf{ixgen}} (\url{http://www.iit.upco.es/~oscar/ixgen/}) +written by \textsc{Oscar Lopez} (\url{oscar@iit.upco.es}), but \textsf{forindex} was +designed to be a bit more flexible. + +\subsection{The program \textsf{cleanindex}} + +The program \textsf{cleanindex} removes \textsf{\textbackslash{}index} +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. + +The input file may have extension \texttt{tex} or \texttt{latex}, +both uppercase and lowercase. + +The original file is left unchanged. A new file will be written, identified +by \textsf{-noind}. For example, from \textsf{file.tex} you will get +\textsf{file-noind.tex}. In this file, lines concerning \textsf{makeindex} will +be left but commented, in order to avoid an empty \emph{Contents} section in the +output. You can uncomment the lines as soon as you want to reindex the file +again. + +\section{Installation} + +\subsection{GNU/Linux and other {*}nix systems} + +\begin{enumerate} + \item Install \textsf{snobol4} from \url{http://www.snobol4.org}. This is Philip Budne's + CSNOBOL implementation. You need a \texttt{c} compiler to compile the + interpreter; it's normally a very quick and easy process. +\item Make sure \textsf{snobol4} is in your PATH or make a symbolic link. +\item Copy all the files from the source directory in a suitable directory (you + do not need the \texttt{bat} files, provided for Windows, and can safely remove + them). +\item Make executables the scripts (\textsf{doindex} and \textsf{cleanindex} +with no extensions), e.g. \texttt{chmod +x doindex} +\item Run the scripts as follows: + +\begin{enumerate} +\item -- to index a text: \texttt{./doindex file.tex} +\item If you want to exclude words with accents: \texttt{./doindex file.tex +-{}-noacc} +\item -- to remove \textsf{\textbackslash{}index }sequences: \texttt{./cleanindex +file.tex} +\item If the current directory is in your PATH, you do not need \texttt{./} +before the script name.\\ + +\end{enumerate} +\end{enumerate} + +\subsection{Windows} + +The package offers exe files compiled with Spitbol (see +(\url{http://www.snobol4.com}). Make a directory and copy all the file in the +bin/windows directory. There must be two \texttt{{*}.exe} files and the two +\texttt{test.{*}} files. + +Run the programs as follows: + +-- to index a text: \texttt{doindex file.tex} + +If you want to exclude words with accents: \texttt{doindex file.tex -noacc}. +Accents must be encoded using the \textsf{latin1} encoding (see the list of +Todo). + +-- to remove \texttt{\textbackslash{}index} sequences: \texttt{cleanindex +file.tex} + +\subsection{Windows from source} + +Basically, follow the same directions given about GNU/Linux, but make sure to +use the \texttt{bat} 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 \textsf{edit} program, with +\textsf{vim} 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 \textsf{acc.inc} to \textsf{ISO-8859-1} or +\textsf{8859-15}, not to plain DOS or Unicode. + +\subsection{Cygwin} + +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. + +\subsection{Macintosh} +Not yet tested (I do not have a Mac right now). It's in the TODO list. + +\section{Test files} +Please test the program on \textsf{test.tex} and \textsf{test.wls}. +The produced file will be called \textsf{test-ind.tex} if you use +\textsf{doindex}, \textsf{test-noind.tex} if you use \textsf{cleanindex}. + +\section{Bugs and TODO} +The program does not support Unicode files. At this moment, most +\LaTeX{} users are still using latin1, but the situation is rapidly changing. + +List of features that I would like to add: + +\begin{enumerate} +\item Index also included files. +\item Add typographical styles, such as italics for the most important +locations of a word. +\item Add support for several indexes (particularly with class \textsf{memoir}) +\item Add an option to generate a rough index for all the words. +\item Add a support to index words listed with regular expressions. +E.g. \texttt{read{*}} should index \emph{read}, \emph{reads}, +\emph{reading}, \emph{readings}, +all under the same heading \emph{read}. +\item Make possible to use another separator for the list file, e.g. a simple +blank or other char preferred by user. +\item Test the programs on a Mac. +\item Add Unicode support. +\end{enumerate} + +\section{Acknowledgements} +The program \textsf{ixgen} gave me the idea of \textsf{forindex}. Many thanks to +\textsc{Oscar Lopez} for this very good program. + +Some questions sent by \textsc{Carlo Pellegrino} (Modena University, Italy) gave +me the idea of transforming a very rudimentary script into a general purpose +utility. \textsc{Maurizio Loreti} (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. + +My warmest thanks to \textsc{Phil Budne} (\url{phil@ultimate.com}) for making +his excellent CSNOBOL available. Many thanks to the community of Snobol users, +particularly to the members of the list \url{snobol4@mercury.dsu.edu}, and, +among them, to \textsc{Gordon Peterson} (\url{http://personal.terabites.com/}), +\textsc{Michael Radow} (\url{mikeradow@yahoo.com}), \textsc{Gregory L. White} +(\url{glwhite@netconnect.com.au}) and to \textsc{Rafal M. Sulejman} +(\url{rafal@engelsinfo.de}) whose \textsf{vim} syntax files are a daily +blessing. + +Thanks to Jim Hefferon <\url{ftpmaint@alan.smcvt.edu}> who pointed out that the +original name of the package,\textsf{ 4index}, was not acceptable due to XML syntax +rules. + +\section{Author, copyright, license, disclaimer} + +This program is Copyright \copyright{} 2005\\ +Guido Milanese <\url{guido.milanese@unicatt.it}>\\ +under the terms of the GNU General Public License.\\ + +\footnotesize{} + \begin{verbatim} +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. + +If you do not have a copy of the GNU General Public License write to the Free +Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +If the author of this software was too lazy to include the full GPL text along +with the code, you can find it at: http://www.gnu.org/copyleft/gpl.html. +\end{verbatim} +\normalsize{} +\end{document} + diff --git a/indexing/forindex/source/acc.inc b/indexing/forindex/source/acc.inc new file mode 100644 index 0000000000..42431758ac --- /dev/null +++ b/indexing/forindex/source/acc.inc @@ -0,0 +1,75 @@ +* ACC.INC +* GM 2003 +* <guido.milanese@mclink.it> +* Accents etc. according to different languages +* The returned string must be parsed by the calling program +* Up to '-' : lowercase accents +* After '-' : uppercase accents +* Options: +* es = Spanish +* de = German +* fr = French +* it = Italian +* XX = all accents of table 8859-XX (e.g. 8859-15) +* en = no accents (English) + + DEFINE("acc(option)") + digits = '1234567890' +* German + acc_de1 = "äëïöüß" ; acc_de2 = "ÄËÏÖÜß" ; acc_de = acc_de1 '-' acc_de2 +* Spanish + acc_es1 = "áéíóúñ" ; acc_es2 = "ÁÉÍÓÚÑ" ; acc_es = acc_es1 '-' acc_es2 +* French + acc_fr1 = "áàèéíìóòúùâêîôûäëïöüç" + acc_fr2 = "ÁÀÈÉÍÌÓÒÚÙÂÊÎÔÛÄËÏÖÜÇ" + acc_fr = acc_fr1 '-' acc_fr2 +* Italian + acc_it1 = "áàèéíìóòúùâêîôû" + acc_it2 = "ÁÀÈÉÍÌÓÒÚÙÂÊÎÔÛ" + acc_it = acc_it1 '-' acc_it2 +* All + acc_001 = acc_de1 acc_es1 acc_fr1 acc_it1 + acc_002 = acc_de2 acc_es2 acc_fr2 acc_it2 + acc_00 = acc_001 '-' acc_002 + +* Complete table (e.g. 8859-15): builds string of chars + k = 127 + chars8859 = '' +ACC_DO ( ++ (lt(k,255)) ++ (k = k + 1) ++ (chars8859 = chars8859 char(k)) ++ ) :s(ACC_DO) + + :(ACC_END) + +ACC +* Trims spaces at begin and end of option +ACC_N option ? ' ' = :s(ACC_N) +* If no option given, sets to all accents (option '00') +** ( ~(option ? any(&lcase digits)) (option = '00') ) +* If a number is passed as option, means a complete table (e.g. 8859-1) +** ( (option ? any(digits)) (option = 'TA') ) + ( ++ (~(option ? any(&lcase digits)) (option = '00')), ++ ( (option ? any(digits)) (option = 'TA') ), ++ (option = option) ++ ) + +* Checks option + ( ++ ~(option ? ("en" | "es" | "de" | "fr" | "it" | "TA" | "00")) ++ (terminal = 'Please supply a valid language identifier') ++ ) :s(freturn) + :($('ACC_' option)) + +ACC_ES acc = acc_es :(return) +ACC_DE acc = acc_de :(return) +ACC_FR acc = acc_fr :(return) +ACC_IT acc = acc_it :(return) +ACC_EN acc = '' '-' '' :(return) +ACC_TA acc = chars8859 '-' ' ' :(return) +ACC_00 acc = acc_00 :(return) +ACC_ terminal = "Please supply a valid language identifier" :(freturn) +ACC_END + diff --git a/indexing/forindex/source/cleanind.bat b/indexing/forindex/source/cleanind.bat new file mode 100644 index 0000000000..ea374a474e --- /dev/null +++ b/indexing/forindex/source/cleanind.bat @@ -0,0 +1,2 @@ + snobol4 -b -d10M cleanindex.sno %1 + diff --git a/indexing/forindex/source/cleanindex b/indexing/forindex/source/cleanindex new file mode 100644 index 0000000000..8dbbc7c5e5 --- /dev/null +++ b/indexing/forindex/source/cleanindex @@ -0,0 +1,3 @@ +#!/bin/bash + snobol4 -b -d10M cleanindex.sno $1 + diff --git a/indexing/forindex/source/cleanindex.sno b/indexing/forindex/source/cleanindex.sno new file mode 100644 index 0000000000..eb61babcb9 --- /dev/null +++ b/indexing/forindex/source/cleanindex.sno @@ -0,0 +1,83 @@ +*-- cleanindex.sno +*-- Guido Milanese 2005 +*-- guido.milanese@unicatt.it +*-- Requires: ioerror.inc +*-- extrepl.inc + + + &MAXLNGTH = 2000000 +* If no arguments are given + ( ++ (~(gt((size(host(2,4))),0))) ++ (terminal = "No file entered. Usage: cleanindex file.tex") ++ (terminal = "Help: cleanindex -help") ++ ) :s(end) + +* If help is required + ( ++ ((host(2,4)) ? "-h") ++ (terminal = "Usage: cleanindex file.tex") ++ (terminal = "Further options: please read the README file or the other documentation files") ++ ) :s(end) + + +* Input-output +-include "ioerror.inc" +* Extended Replace +-include "extrepl.inc" + +* Pattern + PIndex = "\index" bal + +* Read LaTeX file + LATEXEXT = (".tex" | ".latex" | ".TEX" | ".LATEX") + lfile = host(2,4) ;* LaTeX file input + lfile ? '' (arb . file) LATEXEXT + ofile = file "-noind.tex" ;* output +*-- Input files. Using ERRORS + ( (~(input("l_f",1, "B " &MAXLNGTH,lfile))) (ioerror("in",lfile)) ) :s(end) +*-- Output file + output("w_f",2, "B " &MAXLNGTH,ofile) :f(end) + +************************************ +* MAIN PROGRAM +************************************ + +* Text + ((Text = l_f) (Terminal = "Read file " lfile ' [' size(Text) ' chars]')) :f(end) + Text ? "\usepackage{makeidx}" = "%\usepackage{makeidx}" + Text ? "\makeindex" = "%\makeindex" + Text ? "\printindex" = "%\printindex" + + + Text = extrepl(Text,'(', "&0028;") + Text = extrepl(Text,')', "&0029;") + Text = replace(Text,'{}','()') + +L Text ? PIndex . VIndex = :s(L) + + Text = replace(Text,"()","{}") + Text = extrepl(Text,"&0028;",'(') + Text = extrepl(Text,"&0029;",')') + ((w_f = Text) (Terminal = "Written file " ofile ' [' size(Text) ' chars]')) :f(end) + +end + +************************************* +COMMENT +The program is run as such: + snobol4 -b -d10M cleanindex.sno file.tex +and produces "file-noind.tex" as output + +For very large files it is advisable to increas the memory (e.g. "-d20M"). +However, MAXLNGTH is set to 2 Megs which should be more than enough for LaTeX +files. + +The program relies on this pattern: + PIndex = "\index" bal +which implies that the {} pairs must be changed to () pairs /BAL works only with +standard parenthesis). +The program simply identifies "\index{...}" entries and removes them. + + + diff --git a/indexing/forindex/source/doindex b/indexing/forindex/source/doindex new file mode 100644 index 0000000000..5f06bb9f2d --- /dev/null +++ b/indexing/forindex/source/doindex @@ -0,0 +1,3 @@ +#!/bin/bash +snobol4 -b -d10M doindex.sno $1 $2 + diff --git a/indexing/forindex/source/doindex.bat b/indexing/forindex/source/doindex.bat new file mode 100644 index 0000000000..f631d2357a --- /dev/null +++ b/indexing/forindex/source/doindex.bat @@ -0,0 +1,2 @@ + snobol4 -b -d10M doindex.sno %1 %2
+
diff --git a/indexing/forindex/source/doindex.sno b/indexing/forindex/source/doindex.sno new file mode 100644 index 0000000000..2a93225bf2 --- /dev/null +++ b/indexing/forindex/source/doindex.sno @@ -0,0 +1,318 @@ +*-- doindex.sno 0.1 +*-- Guido Milanese 2005 +*-- guido.milanese@unicatt.it +*-- Requires: +* acc.inc +* extrepl.inc +* ioerror.inc +* Please set tabstop=3 to read + +* Initializations + &MAXLNGTH = 2000000 + +* If no arguments are given + ( ++ (~(gt((size(host(2,4))),0))) ++ (terminal = "No file entered. Usage: doindex file.tex") ++ (terminal = "Help: doindex -help") ++ ) :s(end) + +* If help is required + ( ++ ((host(2,4)) ? "-h") ++ (terminal = "Usage: doindex file.tex") ++ (terminal = "To exclude words containing non-English characters:" ++ " doindex file.tex -noacc") ++ (terminal = "Further options: please read the README file or the other documentation files") ++ ) :s(end) + +******************************************** +** External functions +******************************************** + +* Accents + ( ++ (((Accopt = host(2,5)) (Accopt ? "-noacc")) (Accopt = "en")), ++ (Accopt = "XX") ++ ) + +* all or english +-include "acc.inc" + (acc(Accopt) ? break('-') . accmi len(1) rem . accma ) + acc = accmi accma + +* Extended replace +-include "extrepl.inc" + +* Input-output +-include "ioerror.inc" + + +*********************************** +* Internal functions +*********************************** + +* Index adapt. + define("iadapt(Datum)IL,ILK,A,I,Newdatum") + Sep = '/' :(iadapt_end) +iadapt + Datum ? Sep :f(iadapt_rt) + IL = Table() + ILK = 0 +ILK ILK = ILK + 1 + ( ++ (Datum ? break(Sep) . IL[ILK] len(1) rem . Datum) ++ ) :s(ILK) + + A = rsort(IL) + + I = 0 +iadapt_p I = I + 1 + Newdatum = Newdatum '!' A[I,2] :S(iadapt_p)F(iadapt_nof) +iadapt_nof + Datum = Datum Newdatum +iadapt_rt iadapt = Datum :(return) +iadapt_end +*************************** + +* Index Member +* Modified version of Member.inc (gm) +* Uses iadapt + define("imember(Datum,List)I,Check,First") + Sep = '/' :(imember_end) +imember + I = 0 +imember_bg I = I + 1 + First = &lcase &ucase ;* gives a faked value + Check = List[I,2] :f(freturn) +* With '@' or Sep + ( ++ (List[I,2] ? break('@' Sep) . First) ++ (ident(First,Datum)) ++ ) :s(imember_rt) + +* Simple + ident(List[I,2],Datum) :s(imember_rt)f(imember_bg) + +imember_rt imember = iadapt(List[I,2]) :(return) +imember_end + +********************************** +*-- Redoin +*-- Remove double index entries + define("redoin(Pass)dindex1,dindex2") :(redoin_end) +redoin +redoin_lp ((Pass ? Dindex . VDindex) (ident(dindex1,dindex2)) ++ (Pass ? VDindex = dindex1)) :s(redoin_lp) + +redoin_rt redoin = Pass :(return) +redoin_end + + +****************************************** +* Patterns +****************************************** + PNWord = span(&ucase &lcase acc) + PIWord = ("\index" bal) + PWord = PIWOrd | PNWord + Dindex = (("\index{" break('}') len(1)) . dindex1) ++ (("\index{" break('}') len(1)) . dindex2) + +*********************************** + +* Read LaTeX file + LATEXEXT = (".tex" | ".latex" | ".TEX" | ".LATEX") + lfile = host(2,4) ;* LaTeX file input + lfile ? '' (arb . file) LATEXEXT + ifile = file ".wls" + ofile = file "-ind.tex" ;* output + +*-- Input files. Using ERRORS + ( (~(input("l_f",1, "B " &MAXLNGTH,lfile))) (ioerror("in",lfile)) ) :s(end) + ( (~(input("i_f",2, &MAXLNGTH,ifile))) (ioerror("in",ifile)) ) :s(end) + +*-- File di output + output("w_f",3, "B " &MAXLNGTH,ofile) :f(end) + + + +************************************ +* MAIN PROGRAM +************************************ + +* Text + ((Text = l_f) (Terminal = "Read file " lfile ' [' size(Text) ' chars]')) :f(end) + +* List + L = TABLE() + LK = 0 +LK LK = LK + 1 + L[LK] = i_f :s(LK) +* Converts to Array + A = convert(L,"ARRAY") + +* Masks () and {} + Text = extrepl(Text,'(', "&0028;") + Text = extrepl(Text,')', "&0029;") + Text = replace(Text,'{}','()') + +alfa + Text2 = Text2 Previous Item + Text ? ('' (arb . Previous) (PWord . Item)) rem . Text :f(omega) + + ( ++ ((Item ? PIWord) ( )), ++ ((Item ? PNWord) ( (Indexitem = imember(Item,A)) (Item = Item "\index(" Indexitem ")"))) ++ ) :(alfa) + +omega + Text2 = Text2 Text +* Replaces original () and {} + Text2 = replace(Text2,"()","{}") + Text2 = extrepl(Text2,"&0028;",'(') + Text2 = extrepl(Text2,"&0029;",')') + Text2 = redoin(Text2) + + ((w_f = Text2) (Terminal = "Written file " ofile ' [' size(Text2) ' chars]')) :f(end) + + +end + +****************************************** + +COMMENT + +(Please set tabstop=3 to read) + +** Initializationa and external include files +&MAXLNGTH = 2000000 + should be enough for any normal LaTeX file +-include "acc.inc" + to use with non English texts. To exclude it, use the option "-noacc" (only + words with no accented letters will be indexed) +-include "extrepl.inc" + makes possibile to change single chars with a string or vice-versa. +-include "ioerror.inc" + checks if input-output is correct + +** Internal functions +* "Index Member" checks if a word is included in the list of pre-indexed words. + There are 3 possible situations in the list: + (1) the item has '@' as in "cats@cat" + (2) the item has a Sep as in "cats/animals" + (3) the item is a simple word + In the first or second case, the word being checked must be identical to the first part + of the list item. + E.g., "cats" must be identical, in "cats@cat" to "cats". + "cats" must be identical, in "cats/animals" to "cats" + In the final case, the list item must be identical to the checked word. + +* "Index adapt" changes a sequence like + "cats/mammals/animals" + to this form + "animals!mammals!cats" + If there is no TAB in the sequence, nothing happens. + The trick is done so: + (1) a table IL is initialized + (2) Datum up to TAB is saved in IL[ILK] (loop) + (3) The table is sorted reversed --> array. + This array contains therefore the words from the last to the first + (4) This array is scanned and the new form is produced. + +* "Redoin" removes double index entries from a file + +*** Patterns: + A word can be part of an index sequence or not (this is important, because + the files may contain already some indexed words): + PNWord = span(&ucase &lcase acc) : Normal word + PIWord = ("\index" bal) : Indexed word sequence + PWord = PIWOrd | PNWord : Both + DIndex is defined using break. + +*** Input-output + Quite obvious. Extensions accepted are 'tex' and 'latex', both uppercase and + lowercase. + Calling the function IOERROR makes it possible to check if a file is + really available. + The LIST file must have the same name, with extension wls. + +*** Reading the List + The List file must have this form: + + animals + dogs/animals + cats + house/nouns/english/languages + sleeping@sleep + évita/Italian/foreign words + ça/French/foreign words + drücken/German/foreign words + + where each word is listed as such or as part of a structured index. This + syntax seems more natural than the opposite one used by makeindex: + for example a DOG is part of the class ANIMALS. This way it is easy to change + indexes and adapt them to changing needs. The output of + dogs animals + will be + \index{animals!dogs} + +** Temporary protection of {} and () + Unfortunately, the very solid Snobol BAL function supports only () pairs. So it is + necessary: (1) to protect all the existing () -- they are changed into a + XML-Unicode-like string ; (2) to chane all the {} pairs into () pairs. At the + end of work, the reverse process is performed. + +** Core of the program +We must build a new text, called Text2, that is done adding: + * the previous condition of Text2 (null string at the first loop) + * the new portion of text being extracted at each loop, devided into: + * Previous = what is before the word found + * Item = the word + For example, in "<<This": '<<' is Previous, 'This' is Item. + Previous is not analyzed any more, Item is sent to the following analysis + process. +Code: +******* +alfa + Text2 = Text2 Previous Item +******* + +Now the procedure to extract single words: + In Text, what is found before a Word, and call it Previous. a Word is found + if corresponds to the pattern PWord, and saved as Item. What remains is + called again Text, in order to make the loop possible. If the pattern + matching fails, it means that Text is exausted, and we leave the loop. +Code: + Text ? ('' (arb . Previous) (PWord . Item)) rem . Text :f(omega) + +Now the scanning of Item. The code says: + if Item is an indexed sequence (as "\index{rose}"), do not do anything + if Item is a word, check if it is a member of the list of words to be + indexed passed to the program. If so, all the procedures of IMEMBER and + IADAPT will be called. If it is not a member of the list, IMEMBER fails an + nothing happens. +Code: +********* + ( ++ ((Item ? PIWord) ( )), ++ ((Item ? PNWord) ( (Indexitem = imember(Item,A)) (Item = Item "\index(" Indexitem ")"))) ++ ) :(alfa) +********* + +At the end, Text2 receives the final portion of Text (if any). For example, if a + text end with the string "animals." the string "animal" will be recognized as a + Word, but the remaining protion, i.e. the final full stop, will be not + analyzed any further. Therefore, this portion of thext must be added. +Code: +******** +omega + Text2 = Text2 Text +******** + +Possible double index entries are removed. + +Finally, the replacement od () and {} pairs is performed, and Text2 written in +the output file, with some additional info to the user. + +Genoa, Italy, 26th of January 2005 + diff --git a/indexing/forindex/source/extrepl.inc b/indexing/forindex/source/extrepl.inc new file mode 100644 index 0000000000..b785076dec --- /dev/null +++ b/indexing/forindex/source/extrepl.inc @@ -0,0 +1,14 @@ +*-- Function EXTREPL +*-- Extended REPLACE +* Guido Milanese 2005 +* guido.milanese@unicatt.it +* The function fails if the two strings par1 and par2 are subsets + + define("extrepl(pass,par1,par2)") :(extrepl_end) +extrepl +extrepl_bg ((Par1 ? Par2) (Terminal = Par1 " included in " Par2)) :s(freturn) + ((Par2 ? Par1) (Terminal = Par2 " included in " Par1)) :s(freturn) +extrepl_lp Pass ? Par1 = Par2 :s(extrepl_lp) + +extrepl_rt extrepl = pass :(return) +extrepl_end diff --git a/indexing/forindex/source/ioerror.inc b/indexing/forindex/source/ioerror.inc new file mode 100644 index 0000000000..182df46d1e --- /dev/null +++ b/indexing/forindex/source/ioerror.inc @@ -0,0 +1,24 @@ +* -- Guido Milanese, 2003 +* -- Error messages +* -- msg is passed by the calling program and specifies which error +* -- filename is the filename name passed by the calling program + + DEFINE('ioerror(msg,filename)') :(IOERROR_END) + +IOERROR + :($('ioerror_' msg)) + +*-- Error: input file +ioerror_in + terminal = "***ERROR***" + terminal = "You entered '" filename "' as input file," + terminal = "but I could not find it!" :(return) + +*-- Error: output file +ioerror_out + terminal = "***ERROR***" + terminal = "You entered '" filename "' as output file." + terminal = "There is a problem: I cannot write on this file." :(return) + +IOERROR_END + diff --git a/indexing/forindex/source/test.tex b/indexing/forindex/source/test.tex new file mode 100644 index 0000000000..9cf5c8208a --- /dev/null +++ b/indexing/forindex/source/test.tex @@ -0,0 +1,20 @@ +% File: test.tex +% Guido Milanese <guido.milanese@unicatt.it> +% Test file to use with the 4index programs + +\documentclass[a4paper]{article} +\usepackage[latin1]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{makeidx} +\makeindex + +\begin{document} + + +The\index{articles!the} cats are sleeping. The dogs are barking. Both cats, and +dogs, are animals. They live\index{verbs!english!live} in my house (accents) +évita drücken ça. + +\printindex +\end{document} + diff --git a/indexing/forindex/source/test.wls b/indexing/forindex/source/test.wls new file mode 100644 index 0000000000..bf689a83bd --- /dev/null +++ b/indexing/forindex/source/test.wls @@ -0,0 +1,8 @@ +animals +dogs/animals +cats +house/nouns/english/languages +sleeping@sleep +évita/Italian/foreign words +ça/French/foreign words +drücken/German/foreign words |