From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/repeatindex/README | 41 +++++++ macros/latex/contrib/repeatindex/repeatindex.ist | 2 + macros/latex/contrib/repeatindex/repeatindex.sty | 134 +++++++++++++++++++++ .../latex/contrib/repeatindex/testrepeatindex.tex | 64 ++++++++++ 4 files changed, 241 insertions(+) create mode 100644 macros/latex/contrib/repeatindex/README create mode 100644 macros/latex/contrib/repeatindex/repeatindex.ist create mode 100644 macros/latex/contrib/repeatindex/repeatindex.sty create mode 100644 macros/latex/contrib/repeatindex/testrepeatindex.tex (limited to 'macros/latex/contrib/repeatindex') diff --git a/macros/latex/contrib/repeatindex/README b/macros/latex/contrib/repeatindex/README new file mode 100644 index 0000000000..fe99d99316 --- /dev/null +++ b/macros/latex/contrib/repeatindex/README @@ -0,0 +1,41 @@ +repeatindex.sty + +Copyright 2001 Harald Harders (h.harders@tu-bs.de) +License is LPPL. + + +This Package repeats item of an index if a page or column +break occurs within a list of subitems. +This helps to find out to which main item a subitem belongs. + +Example: + + Main Item A, 1, 3, 6 Main Item A... + Subitem a, 1 Subitem g, 1 + Subitem b, 1 Subitem h, 1 + Subitem c, 2 Subitem i, 1 + Subitem d, 3 Subitem j, 1 + Subitem d, 1 Main Item B, 3, 6 + Subitem e, 4 Subitem a, 3 + Subitem f, 2 Subitem b, 4 + +To get that behaviour you have to include the package into your +document using \usepackage{repeatindex}, and you have to produce +the .ind file in a special format in which the entries of the \item +are enclosed in [...] (example: \item [Main Item A], 1, 3, 6 ). +This can be achieved using repeatindex.ist: + makeindex -s repeatindex file + +Problems: +- When an item is repeated a small vertical space is included two + items later +- If the last item is a subitem and the only entry on the last page + of the index the repeation is omitted + +This package has not been tested much, yet. Please help me to find +more problems and if possible solutions to my problems. +I have had much trouble in solving the problem that the code +defined in afterpage is executed with a delay. + +Harald Harders, 2001/10/13 +h.harders@tu-bs.de diff --git a/macros/latex/contrib/repeatindex/repeatindex.ist b/macros/latex/contrib/repeatindex/repeatindex.ist new file mode 100644 index 0000000000..1810cf3363 --- /dev/null +++ b/macros/latex/contrib/repeatindex/repeatindex.ist @@ -0,0 +1,2 @@ +item_0 "\n \\item [" +delim_0 "], " diff --git a/macros/latex/contrib/repeatindex/repeatindex.sty b/macros/latex/contrib/repeatindex/repeatindex.sty new file mode 100644 index 0000000000..62ab240c4f --- /dev/null +++ b/macros/latex/contrib/repeatindex/repeatindex.sty @@ -0,0 +1,134 @@ +%% +%% repeatindex.sty +%% +%% Copyright 2001 Harald Harders (h.harders@tu-bs.de) +%% License is LPPL. +%% +%% +%% This Package repeats item of an index if a page or column +%% break occurs within a list of subitems. +%% This helps to find out to which main item a subitem belongs. +%% +%% Example: +%% +%% Main Item A, 1, 3, 6 Main Item A... +%% Subitem a, 1 Subitem g, 1 +%% Subitem b, 1 Subitem h, 1 +%% Subitem c, 2 Subitem i, 1 +%% Subitem d, 3 Subitem j, 1 +%% Subitem d, 1 Main Item B, 3, 6 +%% Subitem e, 4 Subitem a, 3 +%% Subitem f, 2 Subitem b, 4 +%% +%% To get that behaviour you have to include the package into your +%% document using \usepackage{repeatindex}, and you have to produce +%% the .ind file in a special format in which the entries of the \item +%% are enclosed in [...] (example: \item [Main Item A], 1, 3, 6 ). +%% This can be achieved using repeatindex.ist: +%% makeindex -s repeatindex file +%% +%% Problems: +%% - When an item is repeated a small vertical space is included two +%% items later +%% - If the last item is a subitem and the only entry on the last page +%% of the index the repeation is omitted +%% +%% This package has not been tested much, yet. Please help me to find +%% more problems and if possible solutions to my problems. +%% I have had much trouble in solving the problem that the code +%% defined in afterpage is executed with a delay. +%% +%% Harald Harders, 2001/10/13 +%% h.harders@tu-bs.de +%% +\ProvidesPackage{repeatindex}[2001/10/13 v0.01 Repeats index entries] +% Write text at page and column breaks +\RequirePackage{afterpage} +% Include Index stuff +\RequirePackage{makeidx} + +% Command that replaces all contents of afterpage +\long\def\hhafterpage#1{% + \gdef\AP@{{#1\par}}% + \global\output{% + \the\AP@output + \ifnum\outputpenalty>-\@Mi + \global\output\expandafter{\the\AP@output}% + \aftergroup\AP@@ + \fi}% +} + +% Entry to be repeated +% temporary variable +\def\@entry{}% +% final variable +\def\@@entry{}% + +\def\@hhempty{\@empty} + +\def\entryprefix{\itshape} +\def\entrypostfix{\dots} + +\AtBeginDocument{% + % Save original item commands + \let\orig@idxitem\@idxitem + \let\orig@subitem\subitem + \let\orig@subsubitem\subsubitem + % + % New \item command, has to be used "\item [entry], pages" + \renewcommand{\@idxitem}[1][\@empty]{% + % call original command + \orig@idxitem #1% + % save entry in \@arg + \def\@arg{#1}% + \ifx\@arg\@hhempty + \else + % if entry not empty (which is the case if called by \subitem or + % \subsubitem) copy entry to \@entry + \xdef\@entry{#1}% + % Delete the contents to be repeated + \hhafterpage{}% + \fi + }% + % + % New \subitem command, to be used as usual + \renewcommand{\subitem}{% + % call original command + \orig@subitem + % set the contents to be repeated on the next page + \expandafter\hhafterpage\expandafter{\expandafter\par\expandafter{% + \expandafter\expandafter\entryprefix\@@entry\entrypostfix}}% + % copy \@entry to \@@entry. This is done to delay the entry to be + % put onto the page, due to a strange behaviour of afterpage (some + % text of the next page is executed before the afterpage text is + % put onto the page). + \xdef\@@entry{\@entry}% + }% + % + % New \subsubitem command, to be used as usual + \renewcommand{\subsubitem}{% + % call original command + \orig@subsubitem + % set the contents to be repeated on the next page + \expandafter\hhafterpage\expandafter{\expandafter\par\expandafter{% + \expandafter\expandafter\itshape\@@entry\dots}}% + % copy \@entry to \@@entry. This is done to delay the entry to be + % put onto the page, due to a strange behaviour of afterpage (some + % text of the next page is executed before the afterpage text is + % put onto the page). + \xdef\@@entry{\@entry}% + }% + % + % Copy original end of the theindex environment + \let\orig@endtheindex\endtheindex + % Redefine end of the theindex environment + \renewcommand{\endtheindex}{% + % switch off repeation + \hhafterpage{}% + % call original command + \orig@endtheindex + }% +% +} + +\endinput diff --git a/macros/latex/contrib/repeatindex/testrepeatindex.tex b/macros/latex/contrib/repeatindex/testrepeatindex.tex new file mode 100644 index 0000000000..e9b0258388 --- /dev/null +++ b/macros/latex/contrib/repeatindex/testrepeatindex.tex @@ -0,0 +1,64 @@ +\documentclass{article} +\usepackage[latin1]{inputenc} +\usepackage{afterpage} +\usepackage{makeidx} +\usepackage{repeatindex} + +\makeindex + +\textheight6cm% + +\begin{document} + +Hallo +\index{P01}% +\index{P01!U01}% +\index{P01!U02}% +\index{P01!U03}% +\index{P01!U04}% +\index{P01!U05}% +\index{P01!U06}% +\index{P01!U07}% +\index{P01!U08}% +\index{P01!U09}% +\index{P01a}% +\index{P01a!U10}% +\index{P01b}% +\index{P01b!U11}% +\index{P01b!U12}% +\index{P01b!U13}% +\index{P01b!U14}% +\index{P01b!U15}% +\index{P01b!U16}% +\index{P01b!U17}% +\index{P01b!U18}% +\index{P01b!U19}% +\index{P01b!U20}% +\index{P01b!U21}% +\index{P01b!U22}% +\index{P01b!U23}% +\index{P01b!U24}% +\index{P01b!U25}% +\index{P01b!U26}% +\index{P01b!U27}% +\index{P01b!U28}% +\index{P01b!U29}% +\index{P02}% +\index{P02!U01}% +\index{P02!U02}% +\index{P02!U03}% +\index{P02!U04}% +\index{P02!U05}% +\index{P02!U06}% +\index{P02!U07}% +\index{P02!U08}% +\index{P02!U09}% +\index{P02!U10}% +\index{P02!U11}% +\index{P02!U12}% +\index{P02!U13}% +\index{P02!U14}% +\index{P02!U15}% + +\printindex +\end{document} -- cgit v1.2.3