Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Some of my index entries are being rejected for some reason. How do I determine which index entries were rejected?

For instance if I uncomment the \def at the top of the MWE below I see the message in the console. All this does is switch from suing \tiny to \small. Not sure why one would be ok but the other.

Scanning input file TestIndex.idx...done (0 entries accepted, 10 rejected)

I searched for the word rejected in imakeidx.sty but that word is not in that file, so not sure where this message is coming from.

The above is just one cause of the entries being rejected. I need to know what are some of the other causes as I have some rejected without using \small.

References:

Code:

%\def\UseSmallInIndex{}%

\documentclass{article}
\usepackage{datatool}% database
\usepackage{imakeidx}% indexing
\usepackage{hyperref}% For cross references
\usepackage{xcolor}%
\makeindex

% ---------- Process Each Word:
%
% http://tex.stackexchange.com/questions/12810/how-do-i-split-a-string
\makeatletter
\def\ProcessEachWord#1{%
    \begingroup%
    \edef\@tempa{#1\space}%
    \gdef\@tempb{#1}%
    \expandafter\endgroup%
    \expandafter\ReadWords\@tempa\relax%
}%
\def\ReadWords#1 #2\relax{%
      \ProcessWord[\@tempb]{#1}%  #1 = substr, #2 = rest of string
      \begingroup%
      \ifx\relax#2\relax% is #2 empty?
         \def\next{\endgroup\EndProcessWords}% your own end-macro if required
      \else%
         \def\next{\endgroup\ReadWords#2\relax}%
      \fi%
      \next%
}%
\makeatother
% ---------- 


\newcommand{\ProcessWord}[2][]{%
    \ifdefined\UseSmallInIndex%
        \index{#2!#1\href{run:#1.pdf}{\small\textcolor{red}{pdf}}}%
    \else%
        \index{#2!#1\href{run:#1.pdf}{\tiny\textcolor{red}{pdf}}}%
    \fi%
}%
\newcommand{\EndProcessWords}{}

\begin{document}
\DTLnewdb{DB}%
\DTLnewrow{DB}% 
\DTLnewdbentry{DB}{FileName}{Now good enough}% 
\DTLnewrow{DB}% 
\DTLnewdbentry{DB}{FileName}{Now good enough for you and me}% 

\DTLforeach{DB}{\FileName=FileName}{%
    \section{\FileName}%
    \par\noindent\href{run:\FileName.pdf}{\FileName}%
    \ProcessEachWord{\FileName}%
}%

\printindex
\end{document}
share|improve this question

1 Answer 1

up vote 9 down vote accepted

You find the rejected entries in the .ilg file, which is the log of Makeindex's activities.

Where's the problem? If you look at the entries generated when \UseSmallInIndex is undefined, you find them of the form

\indexentry{Now!Now good enough\href  {run:Now good enough.pdf}{\relax \fontsize  {5}{6}\selectfont  \leavevmode {\color  {red}pdf}}|hyperpage}{1}

and you see that \tiny has been substituted by its expansion. The expansion of \small gives instead

\indexentry{Now!Now good enough\href  {run:Now good enough.pdf}{\relax \fontsize  {9}{11}\selectfont  \abovedisplayskip 8.5\p@ plus3\p@ minus4\p@ \abovedisplayshortskip \z@ plus2\p@ \belowdisplayshortskip 4\p@ plus2\p@ minus2\p@ \def \leftmargin \leftmargini \parsep 4\p@ plus2\p@ minus\p@ \topsep 8\p@ plus2\p@ minus4\p@ \itemsep 4\p@ plus2\p@ minus\p@ {\leftmargin \leftmargini \topsep 4\p@ plus2\p@ minus2\p@ \parsep 2\p@ plus\p@ minus\p@ \itemsep \parsep }\belowdisplayskip \abovedisplayskip \leavevmode {\color  {red}pdf}}|hyperpage}{1}

which is where Makindex chokes.

Solution:

\newcommand{\ProcessWord}[2][]{%
  \ifdefined\UseSmallInIndex
    \index{#2!#1\href{run:#1.pdf}{\protect\small\protect\textcolor{red}{pdf}}}%
  \else
    \index{#2!#1\href{run:#1.pdf}{\protect\tiny\protect\textcolor{red}{pdf}}}%
  \fi 
}

I'd also use \protected@edef in the definition of \ProcessEachWord for similar reasons.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.