I want to have easier ways to index large texts such as thesis, reports, books. I found lots of posts here asking for some magic tool to do that automatically. And as far as I could realize from the comments no one believe a machine can do such an important TASK for us.
So, I think the best solution to facilitate our indexing work is to create proper personal commands (which I am not good at so far...). I want to do at least the following:
Have a way to print the indexed word in the text, i.e. to avoid typing things twice
(some text) word \index{word} ...
with the definition of command
\self
in the way below I get what I want.\DeclareRobustCommand{\self}[1]{{#1}\index{#1}} %solves 1
Define command for entries inside a indexed word repeated multiple times. ex.: avoid repeating "word"
\index{word! entry1}, \index{word! entry1}, \index{word! entry1}...
The command \sub
below makes it.
\DeclareRobustCommand{\sub}[1]{\texttt{#1}\index{Set subordinate!#1}} %solves2
Same of 2 but now the command must use a variable define in parts of text (to replace the fixed "word" in the previous). Is that possible? see attempt on section "Especial" inside the example below
Command to split index (
\splex
) entries (n
variable) in multiples\index{}
? To avoidmakeindex
to print all entries in the same line when I use\index{Cramer, determinant, matrices}
for example. I have no idea how to start to write the command, especialy because I am assuming a general case where the number of entries varies. My idea is to use\splex{Cramer, determinant, matrices}
in order to produce\index{Cramer} \index{determinant} \index{matrices}
in the text..
I found some similar commands on other examples on internet and I am adjusting for my interest but some I still can't figure it out. Are the commands inside the example below ok, or could they be improved/replaced? And how to solve point 3 and 4?
\documentclass{article}
\usepackage{makeidx}
\makeindex
%\DeclareRobustCommand{\self}[1]{\texttt{#1}\index{#1}} %solves 1 but changes text style
\DeclareRobustCommand{\self}[1]{{#1}\index{#1}} %solves 1
\DeclareRobustCommand{\sub}[1]{\texttt{#1}\index{Set subordinate!#1}} %solves2
\newcommand{\subdef}[2]{\index{\subd!#1}} %attempt to 3
\begin{document}
Usefull \self{commands}.
(some text) \sub{entry1}.
(some text) \sub{entry2}.
\newpage
\section{Especial *NOT WORKING*}
\def\subd{especial}
Something1 \subdef{entry1}.
Something2 \subdef{entry2}.
\printindex
\end{document}
Addendum
If you have a good tutorial to indicate for learning to create personal commands (from basic to complex commands) please post the link on the comments.