Here's a starting point. On the first run, this produces an .idx
file but, obviously, your script would do that. The file is just for the MWE.
So your script should produce a file \jobname.idx
where \jobname
will be the name of the .tex
file without the extension e.g. if the file is greatindex.tex
then your script will produce \greatindex.idx
. (Best make a copy of this under another name, too.)
You then run makeindex \jobname
e.g. makeindex greatindex
. This produces \jobname.ind
.
Then you can compile the .tex
document which will input the file \jobname.ind
and produce the index.
Do not under any circumstances include \makeindex
in your .tex
file as it will overwrite your hand-written (effectively) .idx
.
\begin{filecontents}{\jobname.idx}
\indexentry{reviewer1, aardvarks, I}{1}
\indexentry{reviewer2, jelly fish, II}{2}
\end{filecontents}
\documentclass{article}
\usepackage{makeidx}
\begin{document}
\printindex
\end{document}
The formatting of the index will depend on the document class you load and any packages you use to customise the formatting of section or chapter headings (as applicable) or, obviously, any customisation you enable for the index itself. (Default is a two-column index, I think. But I don't have enough entries to show this.)
If you want help with the formatting, create a proper Minimal Working Example and post a question explaining exactly how you want to modify the output.
.idx
file (and transform it to.ind
and include it in a.tex
file. Or have it be.ind
and include it in a.tex
file. Then you can format it as you would a regular index. For example, as.idx
:\indexentry{<reviewer>, <item name>, <volume>}{<page>}
. This is more flexible as you can generate the.ind
with an.ist
of your choice.