summaryrefslogtreecommitdiff
path: root/indexing
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-07-07 03:00:56 +0000
committerNorbert Preining <norbert@preining.info>2023-07-07 03:00:56 +0000
commit2178d699db60492a15e11c107f17da33543af865 (patch)
tree157f2907e3778e17df8a7e891bc276b83b444f48 /indexing
parent97f4d34e17013b3239a49484afcb3d805ab09f38 (diff)
CTAN sync 202307070300
Diffstat (limited to 'indexing')
-rw-r--r--indexing/xindex/README.md3
-rw-r--r--indexing/xindex/doc/Makefile6
-rw-r--r--indexing/xindex/doc/xindex-doc.pdfbin517402 -> 565339 bytes
-rw-r--r--indexing/xindex/doc/xindex-doc.tex197
-rw-r--r--indexing/xindex/latex/xindex.sty8
-rw-r--r--indexing/xindex/lualatex/xindex-AU.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-HAdW-eKO.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-RU.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-base.lua27
-rw-r--r--indexing/xindex/lualatex/xindex-baselib.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-cfg-common.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-cfg-uca.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-cfg.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-danteedition.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-dtk.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-lib.lua51
-rw-r--r--indexing/xindex/lualatex/xindex-norsk.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-pretty.lua2
-rw-r--r--indexing/xindex/lualatex/xindex-yannis.lua2
-rwxr-xr-xindexing/xindex/scripts/xindex.lua5
20 files changed, 220 insertions, 101 deletions
diff --git a/indexing/xindex/README.md b/indexing/xindex/README.md
index 38dae0bdd0..3d4dbd0198 100644
--- a/indexing/xindex/README.md
+++ b/indexing/xindex/README.md
@@ -1,6 +1,6 @@
# xindex
-Copyright 2019-2022 Herbert Voß
+Copyright 2019-2023 Herbert Voß
Unicode compatible index programm for LaTeX. It needs Lua 5.3 which
will be included in at least LuaTeX 1.09 (TeXLive 2019)
@@ -38,6 +38,7 @@ possible options are (short,long):
-l,--language (default en)
-p,--prefix (default L)
-u,--use_UCA
+ -g,--no_pagenumber
-s,--use_stdin
-V,--version
<files...> (default stdin) .idx file(s)
diff --git a/indexing/xindex/doc/Makefile b/indexing/xindex/doc/Makefile
index e5bddf07a9..725576594d 100644
--- a/indexing/xindex/doc/Makefile
+++ b/indexing/xindex/doc/Makefile
@@ -16,14 +16,14 @@ ARCHFILES = $(PACKAGE).sty $(PACKAGE).tex $(PACKAGE).pro $(MAIN).tex README Chan
all : doc clean
# clean
doc:
- $(LATEX) --shell-escape $(MAIN)
+ $(LATEX) --shell-escape --interaction=nonstopmode $(MAIN)
# if ! test -f $(MAIN).glo ; then touch $(MAIN).glo; fi
if ! test -f $(MAIN).idx ; then touch $(MAIN).idx; fi
# makeindex -s gglo.ist -t $(MAIN).glg -o $(MAIN).gls $(MAIN).glo
xindex -a $(MAIN).idx
# bibtex $(MAIN)
- $(LATEX) --shell-escape $(MAIN)
- $(LATEX) --shell-escape $(MAIN)
+ $(LATEX) --shell-escape --interaction=nonstopmode $(MAIN)
+ $(LATEX) --shell-escape --interaction=nonstopmode $(MAIN)
clean :
$(RM) *.dvi *.aux *.log *.xml xindex-?.tex xindex-??.tex *.ind *.idx *.toc *.out *.ilg
diff --git a/indexing/xindex/doc/xindex-doc.pdf b/indexing/xindex/doc/xindex-doc.pdf
index a501b957a4..b34251bf04 100644
--- a/indexing/xindex/doc/xindex-doc.pdf
+++ b/indexing/xindex/doc/xindex-doc.pdf
Binary files differ
diff --git a/indexing/xindex/doc/xindex-doc.tex b/indexing/xindex/doc/xindex-doc.tex
index 25058bc065..bf2dd746da 100644
--- a/indexing/xindex/doc/xindex-doc.tex
+++ b/indexing/xindex/doc/xindex-doc.tex
@@ -81,9 +81,8 @@
\def\setVersion#1{\setVVersion#1!!}
\def\setVVersion#1=#2!!{\def\xIndexVersion{#2}}
-\setVersion{version = 0.48}% can be automatically changed by perl
+\setVersion{version = 0.49}% can be automatically changed by perl
-\setkeys{hv}{cleanup=true,force=false,ExampleDir=Examples,moveToExampleDir}
\title{Program and package \texttt{xindex} \\--\\ \normalsize \xIndexVersion\ (\today)}
@@ -138,11 +137,11 @@ data = { Entry = <text>, -- like the input line without command \indexentry
special = <macro> }
},
sortChar = <unicode codepoint>, -- of the first character of Entry
- Macro = <TeX macro> -- only useful with LaTeX package \Lpack{xindex}
+ Macro = <TeX macro> -- only useful with LaTeX package xindex
}
\end{verbatim}
-After reading the input file the table \texttt{pages} has only one element for the number\index{page number}
+After reading the input file the Lua table \texttt{pages} has only one element for the number\index{page number}
and the so-called special command. When the pages are compressed the table will collect all pages which
refer to the same \Index{entry name}.
@@ -249,6 +248,9 @@ are alphabetized.
\fi
+\setkeys{hv}{moveToExampleDir=true,ExampleDir=Examples,cleanup={},verbose,force=false,shellesc}
+
+
\begin{externalDocument}[
% grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule},
pages={1,2},
@@ -256,12 +258,13 @@ are alphabetized.
compiler=lualatex,
crop,
xindex,
+ xindexOptions=-u, % use unicode
runs=2,code,docType=latex,
showFilename,
align=\centering,
lstOptions={columns=fixed}]{xindex}
%! lualatex
-%! xindex
+%! xindex -u (use unicode)
\documentclass{scrartcl}
\makeatletter
\def\theindex{% only for demonstration
@@ -269,27 +272,83 @@ are alphabetized.
\parskip\z@ \@plus .3\p@\relax \parindent\z@
\let\item\@idxitem}
\makeatother
+%StartVisiblePreamble
+\usepackage{makeidx}\makeindex
+\usepackage{xindex}% for \left|\rightParen
+%StopVisiblePreamble
+\pagestyle{empty}
+\begin{document}
+\section{Escaping characters}
+\begin{itemize}
+\item Exclamation mark ! \index{Exclamation ("!)}\index{"!}
+\item Vertical bar | \index{Vertical bar ("|)}\index{"|}
+\item Doublequote \verb|"| \index{""}
+\item Double doublequote \verb|""| \index{""""}
+\item At character @ \index{At ("@)}\index{"@}
+\item Left paranthesis \{ \index{\parenLeft}
+\item Right paranthesis \} \index{\parenRight}
+\end{itemize}
+run \texttt{xindex -u <file.idx>}\index{file.idx@\texttt{<file.idx>}|textit}\index{123}
+\index{Etage} \index{Ètagé}
+\newpage
+\printindex
+\end{document}
+\end{externalDocument}
+
+It is by design that the parentheses \{ and \} cannot be used as index entry. The \emph{package}
+xindex defines the two commands \Lcs{parenLeft} and \Lcs{parenRight} which can be used instead
+(see examples above and and below).
+The same example without using unicode sorting (no option \Loption{-u}):
+
+
+\begin{externalDocument}[
+% grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule},
+ pages={1,2},
+ frame,
+ compiler=lualatex,
+ crop,
+ xindex,
+% xindexOptions=-u, % use unicode
+ runs=2,code,docType=latex,
+ showFilename,
+ align=\centering,
+ lstOptions={columns=fixed}]{xindex}
+%! lualatex
+%! xindex (no unicode sort -- simple ascii)
+\documentclass{scrartcl}
+\makeatletter
+\def\theindex{% only for demonstration
+ \section*{\indexname}
+ \parskip\z@ \@plus .3\p@\relax \parindent\z@
+ \let\item\@idxitem}
+\makeatother
%StartVisiblePreamble
\usepackage{makeidx}\makeindex
+\usepackage{xindex}% for \left|\rightParen
%StopVisiblePreamble
\pagestyle{empty}
\begin{document}
\section{Escaping characters}
\begin{itemize}
-\item Exclamation mark ! \index{exclaim ("!)}
-\item Vertical bar| \index{Vertical bar ("|)}
+\item Exclamation mark ! \index{Exclamation ("!)}\index{"!}
+\item Vertical bar | \index{Vertical bar ("|)}\index{"|}
\item Doublequote \verb|"| \index{""}
\item Double doublequote \verb|""| \index{""""}
-\item At character @ \index{At ("@)}
+\item At character @ \index{At ("@)}\index{"@}
+\item Left paranthesis \{ \index{\parenLeft}
+\item Right paranthesis \} \index{\parenRight}
\end{itemize}
-run \texttt{xindex <file.idx>}\index{<file.idx>}\index{123}
+run \texttt{xindex -u <file.idx>}\index{file.idx@\texttt{<file.idx>}|textit}\index{123}
+\index{Etage} \index{Ètagé}
\newpage
\printindex
\end{document}
\end{externalDocument}
+
+
For the German language the double quote is an active character and it makes life easier
if one chooses another character.
The escape character can be changed easily by the optional argument \verb|-e "<char>"| or
@@ -308,7 +367,15 @@ escape_chars = { -- by default " is the escape char
which is, of course, not of interest for the user. With the beginning the escaped chars
are converted into the internal strings and later back to the origin meaning.
+The two characters \verb|{}| cannot be used as \verb|\{\}| inside the argument of \Lcs{index}.
+The package \Lpack{xindex} defines the two helper macros
+\begin{verbatim}
+\providecommand\parenLeft{\{}
+\providecommand\parenRight{\}}
+\end{verbatim}
+
+The following example shows how to use it:
\begin{externalDocument}[
% grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule},
@@ -331,6 +398,7 @@ are converted into the internal strings and later back to the origin meaning.
\let\item\@idxitem}
\makeatother
%StartVisiblePreamble
+\usepackage{xindex}
\usepackage{makeidx}\makeindex
%StopVisiblePreamble
\pagestyle{empty}
@@ -342,6 +410,8 @@ are converted into the internal strings and later back to the origin meaning.
\item Doublequote \verb|"| \index{>"}
\item Double doublequote \verb|""| \index{>">"}
\item At character @ \index{At (>@)}
+\item Group start \{ \index{\parenLeft}
+\item Group end \{ \index{\parenRight}
\end{itemize}
Run \texttt{xindex} with \texttt{xindex -e ">"}\index{<file.idx>}\index{123}
\newpage
@@ -728,23 +798,24 @@ The following runs with \verb|xindex -l jp <file>|:
% {\perCent StopVisiblePreamble}% #5
\noindent
-\begin{minipage}[t]{0.45\linewidth}
-\vspace{0pt}
+%\begin{minipage}[t]{0.45\linewidth}
+%\vspace{0pt}
\setsansfont{SourceHanSans}\sffamily
\edef\FancyVerbStartString{\perCent StartVisiblePreamble}
\edef\FancyVerbStopString{\perCent StopVisiblePreamble}
\colorbox{black!20}{\parbox{\linewidth}{%
-\VerbatimInput[fontfamily=helvetica]{Examples/xindex-6.tex}
+\VerbatimInput[fontfamily=helvetica]{Examples/xindex-9.tex}
}}
\edef\FancyVerbStartString{\string\begin\string{document\string}}
\edef\FancyVerbStopString{\string\end\string{document\string}}
\colorbox{black!10}{\parbox{\linewidth}{%
-\VerbatimInput[fontfamily=helvetica]{Examples/xindex-6.tex}
+\VerbatimInput[fontfamily=helvetica]{Examples/xindex-9.tex}
}}
-\end{minipage}\hfill
-\begin{minipage}[t]{0.54\linewidth}
-\vspace{0pt}
+
+%\end{minipage}\hfill
+%\begin{minipage}[t]{0.54\linewidth}
+%\vspace{0pt}
\begin{externalDocument}[
% grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule},
% mpwidth=0.5\linewidth,
@@ -785,18 +856,14 @@ The following runs with \verb|xindex -l jp <file>|:
\pagestyle{empty}
\begin{document}
\Index{車} \Index{車道}
-日本\index{日本|fbox}
-\Index{病院} \Index{コンピュータ}
-\Index{プリンタ} \Index{印刷}
-\Index{スイミングプール} \Index{天王}
-\Index{広島} \Index{ドイツ}
-\Index{日本} \Index{ワープロ}
-\Index{foo} und \Index{bar}
-\Index{//} \Index{4711}
+日本\index{日本|fbox} \Index{病院} \Index{コンピュータ}
+\Index{プリンタ} \Index{印刷} \Index{スイミングプール} \Index{天王}
+\Index{広島} \Index{ドイツ} \Index{日本} \Index{ワープロ}
+\Index{foo} und \Index{bar} \Index{//} \Index{4711}
\newpage\printindex
\end{document}
\end{externalDocument}
-\end{minipage}
+%\end{minipage}
\subsection{Sorting by using UCA (Unicode Collation Algorithm)}
With the optional argument \verb|-u| or alternatively \verb|--use_UCA| the sorting will be done
@@ -815,12 +882,15 @@ by \Lprog{xindex}.
frame=false,
compiler=lualatex,
crop,
+ force=true,
xindex,
xindexOptions=-u -l cs,
runs=2,code,docType=latex,
showFilename,
align=\centering,
- lstOptions={columns=fixed}]{xindex}
+ usefancyvrb,
+% lstOptions={columns=fixed}
+]{xindex}
%! lualatex
\documentclass[paper=a6]{scrartcl}
\makeatletter
@@ -840,7 +910,7 @@ Sorted with \verb|-u -l cs|
\Index{ahoj} \Index{crha}, \Index{čaj}, \Index{chachar},
\Index{rak}, \Index{řeka}, \Index{srp}, \Index{šutr},
\Index{hudba}, \Index{linux}, \Index{zebra},
-\Index{žába}, \Index{7 dubů}
+\Index{žába}, \Index{7 dubů}
\begin{multicols}{2} \printindex \end{multicols}
\end{document}
\end{externalDocument}
@@ -858,7 +928,7 @@ the \verb|xindex-???| series because uppercase letters are sorted before lowerca
mpwidth=0.55\linewidth,
pages={2},
frame=false,
- compiler=lualatex --shell-escape,
+ compiler=lualatex,
crop,
xindex,
% xindexOptions=,
@@ -903,6 +973,7 @@ foo\newpage
\end{externalDocument}
+\clearpage
The same example sorted with the \verb|-a| or \verb|--no_casesensitive| has another output: now
\verb|xindex-cfg-common.lua| is the first one of the \verb|xindex-???| series.
@@ -913,7 +984,7 @@ The same example sorted with the \verb|-a| or \verb|--no_casesensitive| has anot
mpwidth=0.55\linewidth,
pages={2},
frame=false,
- compiler=lualatex --shell-escape,
+ compiler=lualatex,
crop,
xindex,
xindexOptions=-a,
@@ -963,14 +1034,14 @@ foo\newpage
\subsection{Ignore space for sorting}
-By default \textsf{alpha sort} will be sorted \emph{before} \textsf{alphaA}:
+By default »\textsf{alpha sort}« will be sorted \emph{before} »\textsf{alphaA}«:
\begin{externalDocument}[
% grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule},
mpwidth=0.55\linewidth,
pages={2},
frame=false,
- compiler=lualatex --shell-escape,
+ compiler=lualatex,
crop,
xindex,
% xindexOptions=,
@@ -1008,7 +1079,7 @@ This can be changed with the optional argument \verb|-i| or \verb|--ignoreSpace|
mpwidth=0.55\linewidth,
pages={2},
frame=false,
- compiler=lualatex --shell-escape,
+ compiler=lualatex,
crop,
xindex,
xindexOptions=-i,
@@ -1191,11 +1262,15 @@ envStop = "\\end{description}"
pages={2,3},
frame=true,
compiler=lualatex,
- %crop,
- force=true,
+ verbose,
% xindex,
% xindexOptions=-c description -g,
- runs=2,code,docType=latex,
+ runs=2,
+ code,docType=latex,
+ force=true,
+ %xindex -c description -n -g xindex-17.idx
+ %xindex -c description -n --no_pagenumber gls.idx
+ runsequence={lualatex,{xindex -c description -n -g},lualatex,lualatex}
showFilename,
align=\centering,
grfOptions={width=0.45\linewidth},
@@ -1233,10 +1308,11 @@ envStop = "\\end{description}"
alphabet_lower = { { 'е', 'ё' } }
alphabet_upper = { { 'Е', 'Ё' } }
\end{filecontents}
+%xindex -c description -n --no_pagenumber gls.idx
%StartVisiblePreamble
\usepackage[english]{babel}
\usepackage[imakeidx]{xindex}% run xindex internally
-\makeindex[options= -c description -n -g ] % -g same as --no_pagenumber
+\makeindex
\makeindex[name=gls, options= -c description -n --no_pagenumber]
%StopVisiblePreamble
\pagestyle{empty}
@@ -1495,6 +1571,7 @@ The following example runs \verb|xindex -c dtk -l de -n <input>|
xindex,
xindexOptions=-c dtk -n -l de,
runs=2,code,docType=latex,
+ runsAfter=2,
showFilename,
align=\centering,
lstOptions={columns=fixed}]{xindex}
@@ -1689,7 +1766,7 @@ such commands are ignored. In the following example we put an horizontal line af
mpwidth=0.55\linewidth,
pages={2},
frame=false,
- compiler=lualatex --shell-escape,
+ compiler=lualatex,
crop,
xindex,
xindexOptions=-l de,
@@ -1932,11 +2009,17 @@ and adds the program \Lprog{xindex} as the default program to \Lpack{imakeidx}.
mpwidth=0.55\linewidth,
pages={6},
frame=false,
- compiler=lualatex --shell-escape,
+ force=true,
+ compiler=lualatex,
crop,
- xindex,
- xindexOptions=-l de,
+ force=true,
+% xindex,
+% xindexOptions=-l de,
runs=2,code,docType=latex,
+% runsAfter=2,
+% cleanup={},
+% moveToExampleDir=false,
+ shellesc,
showFilename,
align=\centering,
lstOptions={columns=fixed}]{xindex}
@@ -1949,7 +2032,7 @@ and adds the program \Lprog{xindex} as the default program to \Lpack{imakeidx}.
%StartVisiblePreamble
\usepackage[imakeidx]{xindex}
\makeindex[name=persons,title=Index of names,
- columns=1,options=--noheadings]
+ columns=1,options= --noheadings]
\def\ThanhVN{Hàn Thê\protect\llap{%
\raise 0.5ex\hbox{\'{}}}}
%StopVisiblePreamble
@@ -2033,10 +2116,10 @@ in the argument of \Lcs{indexentry}.
mpwidth=0.55\linewidth,
pages={2},
frame=false,
- compiler=lualatex --shell-escape,
+ compiler=lualatex,
crop,
- xindex,
- xindexOptions=-l de,
+% xindex,
+% xindexOptions=-l de,
runs=2,code,docType=latex,
showFilename,
align=\centering,
@@ -2082,10 +2165,10 @@ Duplicate alpha beta gamma.\index{alpha!beta!gamma}
mpwidth=0.55\linewidth,
pages={2},
frame=false,
- compiler=lualatex --shell-escape,
+ compiler=lualatex,
crop,
- xindex,
- xindexOptions=-l de,
+% xindex,
+% xindexOptions=-l de,
runs=2,code,docType=latex,
showFilename,
align=\centering,
@@ -2100,7 +2183,7 @@ Duplicate alpha beta gamma.\index{alpha!beta!gamma}
\makeatother
%StartVisiblePreamble
\usepackage[imakeidx]{xindex}
-\makeindex
+\makeindex[options=-l de]
% Martin Sievers
%StopVisiblePreamble
\begin{document}
@@ -2119,7 +2202,7 @@ Test \index{A!Test} oder auch \index{B!Test}
mpwidth=0.55\linewidth,
pages={2},
frame=false,
- compiler=lualatex --shell-escape,
+ compiler=lualatex,
crop,
xindex,
% xindexOptions=-l de,
@@ -2148,22 +2231,6 @@ Foo\index{foo!bar2!baz2}
\end{document}
\end{externalDocument}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\printindex
\end{document}
diff --git a/indexing/xindex/latex/xindex.sty b/indexing/xindex/latex/xindex.sty
index a2b229b74f..4832bdf75d 100644
--- a/indexing/xindex/latex/xindex.sty
+++ b/indexing/xindex/latex/xindex.sty
@@ -1,6 +1,6 @@
%% This is file `xindex.sty',
%%
-%% Copyright (C) 2018-2022
+%% Copyright (C) 2018-2023
%% Herbert Voss
%%
%% It may be distributed and/or modified under the
@@ -11,10 +11,9 @@
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%
-% $Id: xindex.sty 836 2018-11-11 20:22:56Z herbert $
%
% -------------------------------------
-\ProvidesPackage{xindex}[2018/11/11 v. 0.02 write into an idx file (hv)]
+\ProvidesPackage{xindex}[2023/07/01 v. 0.03 write into an idx file (hv)]
%
\RequirePackage{xkeyval}
@@ -72,5 +71,8 @@
\def\writeidx#1{\write\@indexfile{\noexpand#1}}
\fi
+\providecommand\parenLeft{\{}
+\providecommand\parenRight{\}}
+
\endinput
diff --git a/indexing/xindex/lualatex/xindex-AU.lua b/indexing/xindex/lualatex/xindex-AU.lua
index a544692b48..5fa7dbfd3d 100644
--- a/indexing/xindex/lualatex/xindex-AU.lua
+++ b/indexing/xindex/lualatex/xindex-AU.lua
@@ -9,7 +9,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-AU'] = {
- version = 0.48,
+ version = 0.49,
comment = "configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-HAdW-eKO.lua b/indexing/xindex/lualatex/xindex-HAdW-eKO.lua
index c82b153e82..d08942fb9a 100644
--- a/indexing/xindex/lualatex/xindex-HAdW-eKO.lua
+++ b/indexing/xindex/lualatex/xindex-HAdW-eKO.lua
@@ -11,7 +11,7 @@
-- configuration for index files of the Heidelberger Akademie der Wissenschaften
if not modules then modules = { } end modules ['xindex-HAdW-eKO'] = {
- version = 0.48,
+ version = 0.49,
comment = "configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-RU.lua b/indexing/xindex/lualatex/xindex-RU.lua
index 465a7bdb22..e9adda1935 100644
--- a/indexing/xindex/lualatex/xindex-RU.lua
+++ b/indexing/xindex/lualatex/xindex-RU.lua
@@ -9,7 +9,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-RU'] = {
- version = 0.48,
+ version = 0.49,
comment = "configuration to xindex.lua",
author = "Alexey Kuznetzov",
copyright = "Herbert Voß",
diff --git a/indexing/xindex/lualatex/xindex-base.lua b/indexing/xindex/lualatex/xindex-base.lua
index 37a6783812..336142e30c 100644
--- a/indexing/xindex/lualatex/xindex-base.lua
+++ b/indexing/xindex/lualatex/xindex-base.lua
@@ -8,7 +8,7 @@
-- $Id: xindex-base.lua 22 2022-02-07 12:18:15Z hvoss $
-----------------------------------------------------------------------
-local info = { version = 0.48 }
+local info = { version = 0.49 }
-- check config
if pageNoPrefixDel ~= "" then
@@ -31,7 +31,7 @@ else
writeLog(2,#lines.." lines of data read\n",0)
end
end
-print("Anzahl Zeilen: "..#lines)
+--print("Anzahl Zeilen: "..#lines)
if #lines == 0 then
print("=========================================")
print("Input file(s) is/are empty!")
@@ -48,9 +48,10 @@ if #lines == 0 then
end
print("Presort of \\indexentry lines")
+for _,l in pairs(lines) do print (l) end
table.sort(lines)
if vlevel > 1 then
- print("Pres-Sorted index list:")
+ print("Pre-Sorted index list:")
for _,l in pairs(lines) do print (l) end
end
@@ -174,6 +175,17 @@ if use_UCA then
end
end
writeLog(2,"done\n",0)
+else
+ for i=1, #NewIndex do
+ v = NewIndex[i]
+ if findStr(v["SortKey"],"\\parenLeft") < 2 then v["SortKey"] = '{' v["sortChar"] = '{'end
+ if findStr(v["SortKey"],"\\parenRight") < 2 then v["SortKey"] = '}' end
+ if findStr(v["SortKey"],"//escapedexcl//") < 2 then v["SortKey"] = '!' end
+ if findStr(v["SortKey"],"//escapedquote//") < 2 then v["SortKey"] = '"' end
+ if findStr(v["SortKey"],"//escapedat//") < 2 then v["SortKey"] = '@' end
+ if findStr(v["SortKey"],"//escapedvert//") < 2 then v["SortKey"] = '|' end
+ NewIndex[i] = v
+ end
end
if SORTendhook then
@@ -217,27 +229,34 @@ for k=1,#NewIndex do
writeLog(1," NewIndex[k]: "..v["Entry"].."\n",2)
writeLog(1,require 'xindex-pretty'.dump(v),3) -- only for internal dump
entry = v["Entry"]
+-- print("SortKey:"..v["SortKey"].." sortChar:"..v["sortChar"])
writeLog(1,"\nBase start: "..entry.."\n",2)
-- local c = utf.sub(v["sortChar"],1,1)
-- if utf8.codepoint(c) < 12288 then -- Japanese starts at hex 3000
-- firstChar = v["sortChar"]
-- else
+-- print(v["SortKey"],v["sortChar"],v["Entry"])
if language == "cs" then -- Czech language has special char ch
if utf.sub(v["sortChar"],1,2) == "CH" then
- firstChar = "Ch"
+ firstChar = "Ch"
else
+-- firstChar = utf.sub(v["SortKey"],1,1)
firstChar = utf.sub(v["sortChar"],1,1)
end
else
+-- firstChar = utf.sub(v["SortKey"],1,1)
firstChar = utf.sub(v["sortChar"],1,1) -- catch a translatet Ö->OE
end
-- end
currentChar = firstChar
+ local SortKey = tostring(v["SortKey"])
+ writeLog(1,"SortKey="..SortKey.."; firstChar="..currentChar.."\n",2)
if string.len(firstChar) > 1 then
charType = getCharType(utf.sub(firstChar,1,1))
else
charType = getCharType(firstChar)
end
+-- print(">>"..v["sortChar"].." "..firstChar.." "..tostring(charType))
if charType == 0 then
numbers = false
symbols = true
diff --git a/indexing/xindex/lualatex/xindex-baselib.lua b/indexing/xindex/lualatex/xindex-baselib.lua
index 5e563aec47..9d7c9188eb 100644
--- a/indexing/xindex/lualatex/xindex-baselib.lua
+++ b/indexing/xindex/lualatex/xindex-baselib.lua
@@ -9,7 +9,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-baselib'] = {
- version = 0.48,
+ version = 0.49,
comment = "base library to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-cfg-common.lua b/indexing/xindex/lualatex/xindex-cfg-common.lua
index 33f4b2cbb4..4793d1758d 100644
--- a/indexing/xindex/lualatex/xindex-cfg-common.lua
+++ b/indexing/xindex/lualatex/xindex-cfg-common.lua
@@ -9,7 +9,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-cfg-common'] = {
- version = 0.48,
+ version = 0.49,
comment = "configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-cfg-uca.lua b/indexing/xindex/lualatex/xindex-cfg-uca.lua
index 2a87366dad..014d3719d2 100644
--- a/indexing/xindex/lualatex/xindex-cfg-uca.lua
+++ b/indexing/xindex/lualatex/xindex-cfg-uca.lua
@@ -9,7 +9,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-cfg-lua'] = {
- version = 0.48,
+ version = 0.49,
comment = "configuration to xindex-cfg-uca.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-cfg.lua b/indexing/xindex/lualatex/xindex-cfg.lua
index b475a2eb7f..24098c5272 100644
--- a/indexing/xindex/lualatex/xindex-cfg.lua
+++ b/indexing/xindex/lualatex/xindex-cfg.lua
@@ -9,7 +9,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-cfg'] = {
- version = 0.48,
+ version = 0.49,
comment = "main configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-danteedition.lua b/indexing/xindex/lualatex/xindex-danteedition.lua
index 80d7426381..f7d2d09b5f 100644
--- a/indexing/xindex/lualatex/xindex-danteedition.lua
+++ b/indexing/xindex/lualatex/xindex-danteedition.lua
@@ -9,7 +9,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-cfg'] = {
- version = 0.48,
+ version = 0.49,
comment = "configuration file for the DANTE Edition",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-dtk.lua b/indexing/xindex/lualatex/xindex-dtk.lua
index 0082be4dc9..74de071b0a 100644
--- a/indexing/xindex/lualatex/xindex-dtk.lua
+++ b/indexing/xindex/lualatex/xindex-dtk.lua
@@ -9,7 +9,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-cfg'] = {
- version = 0.48,
+ version = 0.49,
comment = "DTK configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-lib.lua b/indexing/xindex/lualatex/xindex-lib.lua
index 97ede6b8fc..f321765c64 100644
--- a/indexing/xindex/lualatex/xindex-lib.lua
+++ b/indexing/xindex/lualatex/xindex-lib.lua
@@ -9,7 +9,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-lib'] = {
- version = 0.48,
+ version = 0.49,
comment = "main library to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
@@ -125,7 +125,8 @@ function read_lines_from(infile)
str = line:gsub('^\\%a+%s*{','{') -- remove "\\indexentry "
writeLog(1,"read_lines: str="..str.." ("..utf.sub(str,2,2)..")\n",2)
if getCharType(utf.sub(str,2,2)) == 0 then -- we have a symbol
- lines[#lines + 1] = str:gsub('^{*','{ ') -- add a space before the symbol
+ lines[#lines + 1] = str:gsub('^{*','{') -- add a space ... why????
+-- lines[#lines + 1] = str:gsub('^{*','{ ') -- add a space before the symbol
else
lines[#lines + 1] = str
end
@@ -275,6 +276,7 @@ function getEntryAndPage(w, nextW, EntryList)
sortChar= NormalizedUpper(utf.sub(IndexString,1,1)), -- :byte(), -- Initial for later output
Macro = macro
}
+ --print("Entry:"..EntryList[#EntryList]["sortChar"])
if args_v then
if Special == "" then Special = "-" end
writeLog(1,"getEntryAndPage: "..tostring(IndexString,pageNo,Special,utf.sub(IndexString,1,1),macro).."\n",2)
@@ -318,7 +320,7 @@ end
--[[ example entry
EntryList[2] = {
- Entry = "Johann", -- the index item foo@bar
+ Entry = 'Johann//escapedexcl//', -- the index item foo@bar
pages = { -- the page number(s) and the part after |
{ number = 111,
special = '\\emph' },
@@ -502,6 +504,19 @@ function getCharType(c)
end
end
+function findStr(s,f)
+ if s == nil then return 99999 end
+ str = s:match'^%s*(.*)' -- strip left spaces
+-- s:gsub("%s+", "")-- strip spaces
+-- print(s,f)
+ local i,j = str:find(f)
+-- print(tostring(i),tostring(j))
+ if i == nil
+ then return 99999 -- makes it easier to compare with <
+ else return i
+ end
+end
+
--print(get_category(utf8.codepoint('ö')))
--print(category_to_number(get_category(utf8.codepoint('ö'))))
@@ -532,22 +547,36 @@ function GenerateSortKey(a)
if ignoreSpace then
a["SortKey"] = A:gsub("%s+", "") -- remove spaces
else
- a["SortKey"] = A
+ a["SortKey"] = A:match'^%s*(.*)' -- strip only left spaces
end
else
A = NormalizedChars(getSortString(a["Entry"].." "..Apage..a["pages"][1]["special"]):gsub('!',' ')) -- replace! by empty
if ignoreSpace then
a["SortKey"] = A:gsub("%s+", "")-- remove spaces
else
- a["SortKey"] = A
+ a["SortKey"] = A:match'^%s*(.*)' -- strip only left spaces
end
end
- -- print(a["SortKey"])
- -- return A
+-- s:gsub("%s+", "") strip spaces
+ if findStr(a["SortKey"],"\\parenLeft") < 2 then a["SortKey"] = '{ '..Apage end
+ if findStr(a["SortKey"],"\\parenRight") < 2 then a["SortKey"] = '} '..Apage end
+ if findStr(a["SortKey"],"//escapedexcl//") < 2 then a["SortKey"] = '! '..Apage end
+ if findStr(a["SortKey"],"//escapedquote//") < 2 then a["SortKey"] = '" '..Apage end
+ if findStr(a["SortKey"],"//escapedat//") < 2 then a["SortKey"] = '@ '..Apage end
+ if findStr(a["SortKey"],"//escapedvert//") < 2 then a["SortKey"] = '| '..Apage end
+ -- a["SortKey"] = a["SortKey"]:gsub("%s+", "")
+ -- print("Sortkey: " .. a["SortKey"])
+ if not use_UCA then -- test if it is a symbol after 9 and before A or after Z
+ if (a["SortKey"]:byte() > 57 and a["SortKey"]:byte() < 65) or
+ (a["SortKey"]:byte() > 122 and a["SortKey"]:byte() < 128) then -- symbol above digits
+ a["SortKey"] = "/"..a["SortKey"] -- sort it after /
+ end
+ end
end
function GenerateSortKeys(Index)
for _, entry in ipairs(Index) do
+-- print("<<".._..entry["Entry"])
GenerateSortKey(entry)
end
end
@@ -555,12 +584,13 @@ end
function UTFCompare(a,b)
local A = a["SortKey"]
local B = b["SortKey"]
- writeLog(1,"UTFCompare: A--B "..A.."--"..B.."\n",2)
if use_UCA then
- return collator_obj:compare_strings(A,B)
+ compare = collator_obj:compare_strings(A,B)
else
- return A<B
+ compare = A<B
end
+ writeLog(1,"UTFCompare: A--B "..A.."--"..B.."A<B:"..tostring(compare).."\n",2)
+ return compare
end
@@ -923,6 +953,7 @@ function getSortChar(codepoints)
return getSortChar(codepoints)
end
local sort_char = utf8.char(table.unpack(codes))
+ --print("SortChar:"..sort_char)
-- print unicode category of the first char
return upper(sort_char) -- use unicode.utf8.upper to make the char uppercase
end
diff --git a/indexing/xindex/lualatex/xindex-norsk.lua b/indexing/xindex/lualatex/xindex-norsk.lua
index 7fc34e24a3..19289ee086 100644
--- a/indexing/xindex/lualatex/xindex-norsk.lua
+++ b/indexing/xindex/lualatex/xindex-norsk.lua
@@ -10,7 +10,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-no'] = {
- version = 0.48,
+ version = 0.49,
comment = "configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/lualatex/xindex-pretty.lua b/indexing/xindex/lualatex/xindex-pretty.lua
index 92d3aa92d8..ec6139e324 100644
--- a/indexing/xindex/lualatex/xindex-pretty.lua
+++ b/indexing/xindex/lualatex/xindex-pretty.lua
@@ -7,7 +7,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-pretty'] = {
- version = 0.48,
+ version = 0.49,
comment = "dump a Lua table for debugging",
author = "Steve Donovan",
copyright = "Steve Donovan",
diff --git a/indexing/xindex/lualatex/xindex-yannis.lua b/indexing/xindex/lualatex/xindex-yannis.lua
index 1ab0b12f6b..dbf6c60e77 100644
--- a/indexing/xindex/lualatex/xindex-yannis.lua
+++ b/indexing/xindex/lualatex/xindex-yannis.lua
@@ -9,7 +9,7 @@
-----------------------------------------------------------------------
if not modules then modules = { } end modules ['xindex-yannis'] = {
- version = 0.48,
+ version = 0.49,
comment = "main configuration to xindex.lua",
author = "Herbert Voss",
copyright = "Herbert Voss",
diff --git a/indexing/xindex/scripts/xindex.lua b/indexing/xindex/scripts/xindex.lua
index 22e07116cd..ba35187763 100755
--- a/indexing/xindex/scripts/xindex.lua
+++ b/indexing/xindex/scripts/xindex.lua
@@ -6,11 +6,10 @@
-- AUTHOR: Herbert Voß
-- LICENSE: LPPL 1.3
--
--- $Id: xindex.lua 22 2023-01-18 12:18:15Z hvoss $
-----------------------------------------------------------------------
xindex = xindex or { }
- local version = 0.48
+ local version = 0.49
xindex.version = version
--xindex.self = "xindex"
@@ -55,7 +54,7 @@ local args = require ('xindex-lapp') [[
-l,--language (default en)
-g,--no_pagenumber
-p,--prefix (default L)
- -u,--use_UCA
+ -u,--use_UCA
-s,--use_stdin
-V,--version
<files...> (default stdin) .idx file(s)