1
  1. I need to help readers locate where new terms are located. The definitions are not formal and the first time a term is used and, hopefully, explained, it is boldfaced.
  2. I am of course using makeindex and hyperref and showindex because the readers for whom I write are easily discouraged and even find it difficult to locate a boldfaced word on a given page.
  3. The reason for this question is that my question How to display index entries on the same line as the text being indexed? seems to have no answer, and so I thought this might be another way to achieve the same thing.

The idea would be that, just like clicking on an index entry gets one to the page where the indexed item is, clicking on the showindex entry would highlight the boldfaced word in the pdf, just like clicking on a word in the source highlights the line in the pdf where the word is. So, it would seem that the mechanisms already exist and so that this should be doable.

Here is the MWE I used in my earlier question.

% !TEX TS-program = pdflatexmk  
\documentclass{book}

    \usepackage{makeidx}
    \usepackage[hyperfootnotes=false]{hyperref}%[pdfborder={0 0 0}]

%Begin the ``quick and dirty hack'' due to Heiko Oberdiek which loads showidx 
\makeatletter
\ifHy@hyperindex
  \def\HyInd@ParenLeft{(}%
% Hook in \HyInd@@wrindex
  \let\HyInd@showidx\@empty
% Hook in \HyInd@@wrindex for package showidx
  \def\HyInd@showidx#1{%
    \@showidx{#1}%
    \if@nobreak
      \ifvmode
        \nobrak
      \fi
    \fi
  }%
% Load package showidx
  \let\siOrg@makeindex\makeindex
  \let\siOrg@@index\@index
  \let\siOrg@@wrindex\@wrindex
  \let\siOrg@index\index
  \RequirePackage{showidx}
  \let\makeindex\siOrg@makeindex
  \let\@index\siOrg@@index
  \let\@wrindex\siOrg@@wrindex
  \let\index\siOrg@index
    % rest of hyperref part
  \@ifpackageloaded{multind}{%
    \let\HyInd@org@wrindex\@wrindex
    \def\@wrindex#1#2{\HyInd@@wrindex{#1}#2||\\}%
    \def\HyInd@@wrindex#1#2|#3|#4\\{%
      \ifx\\#3\\%
        \HyInd@org@wrindex{#1}{#2|hyperpage}%
      \else
        \def\Hy@temp@A{#3}%
        \ifx\Hy@temp@A\HyInd@ParenLeft
          HyInd@org@wrindex{#1}{#2|#3hyperpage}%
        \else
          \HyInd@org@wrindex{#1}{#2|#3}%
        \fi
      \fi
    }%
  }{%
    \def\@wrindex#1{\@@wrindex#1||\\}
    \def\@@wrindex#1|#2|#3\\{%
      \ifx\\#2\\%
        \protected@write\@indexfile{}{%
          \string\indexentry{#1|hyperpage}{\thepage}%
        }%
      \else
        \def\Hy@temp@A{#2}%
        \ifx\Hy@temp@A\HyInd@ParenLeft
          \protected@write\@indexfile{}{%
             \string\indexentry{#1|#2hyperpage}{\thepage}%
          }%
        \else
          \protected@write\@indexfile{}{%
            \string\indexentry{#1|#2}{\thepage}%
          }%
        \fi
      \fi
      \endgroup
      \HyInd@showidx{#1}%
      \@esphack
    }%
  }%
\fi
\makeatother
%End the ``quick and dirty hack'' due to Heiko Oberdiek which loads showidx 

    \usepackage{cleveref}

        \newcounter{proc}
    \usepackage{tcolorbox}

%Begin the Sharpe (2013-01-18) code as modified by Schulz (2016-02-1) to have math in Showindex     
\let\oldopenparen\(
\let\oldcloseparen\)
\def\({\protect\oldopenparen}
\def\){\protect\oldcloseparen}
\newcommand{\INDEX}[1]{\index{#1}}
%End the Sharpe (2013-01-18) code as modified by Schulz (2016-02-1) to have math in Showindex               

\makeindex
\begin{document}    

Some text necessary to drown the words to be indexed. Some text necessary to drown the words to be indexed. \textbf{Oberdieck}\INDEX{Oberdieck}
Some text necessary to drown the words to be indexed. Some text necessary to drown the words to be indexed. 

\newpage

Some text necessary to drown the words to be indexed. Some text necessary to drown the words to be indexed.
\textbf{$\cup$}\INDEX{$\cup$}
Some text necessary to drown the words to be indexed. Some text necessary to drown the words to be indexed. 

\printindex
\end{document}
schremmer
  • 2,107
  • Perhaps something with pdfcomment.... –  Jan 03 '17 at 18:21
  • @Christian Hupfer Looks likes it should be able to do it but: 1. It doesn't seem to work on the mac. 2. It seems to require luatex85. – schremmer Jan 03 '17 at 19:06
  • I think the main problem is pdfcomment has a lot of features that are supported in Adobe Reader only. luatex85 should be available for Mac too... –  Jan 03 '17 at 21:38
  • Perhaps you should provide a starter file (The example from above?) and we'll see what we can do there. –  Jan 03 '17 at 21:45
  • @ Christian Hupfer 1. Re luatex, I think you are right but I am the one who is too old to leave LaTeX and TeXShop. 2. Re starter file, thanks but I can't do it tonight. It's just a matter of adjusting an already MWE and I will do it the day after tomorrow. In any case, I really mostly thought of it as an interesting question. Still, if it worked ... And, by the way, could, say, the color then fade away? ;-) – schremmer Jan 04 '17 at 00:47
  • You can compile normal LaTeX files with LuaLaTeX too, as long there is no \usepackage{inputenc} statement, so you don't need to know anything about Lua actually... and no, the colours would not fade. That's something more for ocg layers –  Jan 04 '17 at 00:49

0 Answers0