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.

I will be working with a professional indexer of the old school — meaning that she prefers making her index on cards using a pencil while looking at a finished book whose pagination will not change — and am searching for tools that will lessen the stress involved for both of us. Neither index cards nor static pagination are a viable option in the present case.

Are there any tools that would enable me to show exactly what words have been indexed in a given line in some unobtrusive way — say by underlining or shading them in the text?

I am aware of the \showidx package, which is useful. Its weakness in my situation is that it takes the whole page as its domain of operation, which it not easy for the indexer to follow; I'm looking for something that actually marks the indexed text, or at least makes \showidx-like margin notations on the same line as the indexed text.

share|improve this question
    
I usually mark important and thus indexed terms with \emph. I'd suggest also putting a little symbol into the margin. So you could end up with \newcommand[1]{\index{#1}\emph{#1}\marginpar{\small IDX}}. –  canaaerus Jul 22 '12 at 8:37
    
Have a look at tex.stackexchange.com/questions/32234/… –  egreg Jul 22 '12 at 22:32
add comment

1 Answer

up vote 6 down vote accepted

I'm just throwing this idea out there; not sure whether it might be of help. It is somewhat inspired by David's showkeys package:

enter image description here

\documentclass{article}
\makeindex
\makeatletter
\newcommand{\@theindexentry}[1]{%
  \smash{%
    \rlap{\rule{.4pt}{.8\baselineskip}}% Vertical rule
    \begin{lrbox}{\@tempboxa}\tiny\ttfamily#1\end{lrbox}% Box index entry
    \rlap{\raisebox{.6\baselineskip}{\usebox{\@tempboxa}}}% key
  }%
}
\def\@wrindex#1{%
  \protected@write\@indexfile{}%
    {\string\indexentry{#1}{\thepage}}%
  \endgroup
  \@esphack%
  \@theindexentry{#1}%
}
\def\@index#1{\endgroup\@esphack\@theindexentry{#1}}
\makeatother
\begin{document}
Lorem\index{Alpha} ipsum dolor sit amet, consectetur\index{alpha} adipiscing elit. 
Proin ullamcorper\index{gnat} quam magna, quis convallis\index{gnus!good} sapien. Donec 
at ligula vel dolor varius\index{bites!vegetable} lobortis id ut orci\index{gnat!size of}. Maecenas 
commodo fringilla elit\index{Alphabet}, et pellentesque purus ornare vitae. 
Aenean non metus ipsum. Lorem\index{gnat!anatomy} ipsum dolor sit amet, consectetur 
adipiscing\index{alphas} elit. Ut mauris lorem, accumsan a sagittis ut, 
rutrum fringilla arcu. Cras ullamcorper faucibus\index{alpha bet} quam id molestie.

Nunc et\index{alphabet} sem et turpis semper adipiscing et id nibh. In nibh 
mauris, placerat sed consequat placerat, dignissim ut\index{at!bat|see {bat, at}} arcu. 
Aenean eleifend justo volutpat lectus\index{gnus!bad} interdum pellentesque. 
Etiam cursus varius\index{twenty@xx} tellus, non pretium nibh tempus sit amet. 
Suspendisse sed mauris nisl. Cum sociis natoque penatibus et 
magnis dis parturient montes, nascetur\index{alpha@$\alpha$} ridiculus mus. Nullam 
at feugiat nisi\index{bites!animal!gnats}.
\end{document}

It prints, for every \index, a vertical rule showing the point of reference, as well as the key used (minus { or }, for simplicity) in \tiny\ttfamily. Using xcolor one could make the appearance less intrusive by printing in black!30 (say):

enter image description here

\@theindexentry prints the index-related content. \smash takes care of any vertical adjustment, while the entire index entry is set inside a zero-width \rlap to remove any horizontal adjustment.

The definition of \@wrindex (in the presence of \makeindex) and \@index was taken directly from latex.ltx.

share|improve this answer
    
Wow, very nice! –  percusse Jul 23 '12 at 7:53
    
More than exactly what I had in mind! –  brannerchinese Jul 24 '12 at 0:39
add comment

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.