0

I'm writing two books. Assume one is Thanking in Java (the J book), and the other is Thanking in C# (the C book). Each book has its own index. The MWE is the following.

java.tex

\documentclass[]{article}

\usepackage{imakeidx}
\makeindex

\title{Thanking in Java}

\begin{document}

\maketitle

Java is an object-oriented language\index{object-oriented}, released in GNU General Public License\index{GNU GPL}.

... A lot of indexes


\printindex

\end{document}

cs.tex

\documentclass[]{article}

\usepackage{imakeidx}
\makeindex

\title{Thanking in C\#}

\begin{document}

\maketitle

C\# is an object-oriented language\index{object-oriented}, released in MIT License\index{MIT License}.

... A lot of indexes

\printindex
\end{document}

Is there an easy way to include index of the other book? For example in the J book, can I say that the C book also have index(es) on the entry "object-oriented", like the figure illustrated?

enter image description here

Similarly, in the C book, can I say the J book has indexes on "object-oriented"?

Moreover, can I show how many times the other book talks about an entry? For example in the J book,

object-oriented, 1, C3

would mean the C book has 3 occurrences of object-oriented.

Or if it's too hard, can I add page number instead?

object-oriented, 1, C1, C2, C7

would mean page 1, 2, 7 of the C book has the word object-oriented.

My goal is that my readers of one book can see the index and realize my another book also talks about the same concept (and the number of times). In this way they may be more likely to buy the other book.

2
  • Personally I feel it requires certain programming.. but just see how far can I go..
    – Gqqnbig
    Jan 27 at 17:00
  • 1
    You should fairly easily be able to join the idx files before running makeindex (so making object-oriented, 1, C1, C2, C7) counting would take a bit more work, Jan 27 at 17:19

1 Answer 1

0

I figure the best way is to manually edit the index part.

To start with, add option noautomatic to the package, i.e.,

\usepackage[noautomatic]{imakeidx}

so it disables the automatic index processing.

After running pdflatex cs.tex, the command line has

Package imakeidx Warning: Remember to run (pdf)latex again after calling (imakeidx) `makeindex cs.idx'.

Then I write a oneliner to look up another idx file (java.idx) and add a line to cs.idx.

With the modified cs.idx, I then run makeindex cs.idx and get cs.ind which is what \printindex is going to read. Also, have to revise the page number sort rule.

Finally compile the tex file again, i.e., pdflatex cs.tex.

Nevertheless, I think the oneliner gonna cost me one day to code.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .