LaTeX forum ⇒ MakeIndex, Nomenclature, Glossaries and AcronymsLinked Index for Presentation Topic is solved

Information and discussion about MakeIndex - the tool to generate subject indices for LaTeX documents.
mafis103
Posts: 7
Joined: Sat Feb 23, 2013 9:29 am

Linked Index for Presentation

Postby mafis103 » Sat Feb 23, 2013 9:36 am

Hi everyone,

I am supposed to do a linked index for some lecture slides. There is no problem with the indexing itself, but with the linking - I can see the page numbers, but there are no links, although hyperref is loaded (and I think it is loaded by the beamer class anyway).

I have no clue, what I am doing wrong. Here is an example that can show my problem:
  1. \documentclass[16pt,pdftex]{beamer}
  2. \usepackage{multicol}
  3. \usepackage{makeidx}
  4. \usepackage{hyperref}
  5.  
  6. \makeindex
  7. \newenvironment{theindex}{
  8. \let\item\par
  9. \let\subitem\par
  10. }{}
  11. \newcommand\indexspace{}
  12. \newcommand{\myindex}[1]{#1\index{#1}}
  13.  
  14. \newcommand{\mypart}[1]{\section{#1}}
  15. \newcommand{\mysection}[1]{\subsection{#1}}
  16. \newcommand{\mydef}[1]{\alert{#1}\index{#1}}
  17.  
  18. %\newcommand{\bb}[1]{\hyperpage{\textbf{#1}}}
  19.  
  20. \begin{document}
  21.  
  22. \begin{frame}
  23. \frametitle{TableOfContents}
  24. \tableofcontents
  25. \end{frame}
  26.  
  27. \begin{frame}
  28. \frametitle{Part1SecA}
  29. test \myindex{taindex} \myindex{waindex!ssubaz} \myindex{zbzindex!isubbu}
  30. \end{frame}
  31.  
  32. \begin{frame}
  33. \frametitle{Part1SecA}
  34. test \myindex{taindex} \myindex{ezzz!ezsubaz} \myindex{ezzbindex!uzsubbu}
  35. \end{frame}
  36.  
  37. \mypart{Part2}
  38. \mysection{SecB}
  39.  
  40. \begin{frame}
  41. \frametitle{Part2SecB}
  42. test \myindex{binden}\myindex{aindex!suba2} \myindex{bindex!subb2}
  43. \end{frame}
  44.  
  45. \begin{frame}[allowframebreaks]
  46. \frametitle{Index}
  47. \printindex
  48. \end{frame}
  49. \end{document}

The commented line you can see is one of my tries to make it work and one of the rare things I found on the internet concerning that topic. (When activated, I put of course a |bb behind the index terms). But that try didn't even compile.

Can you tell me where the problem is and maybe what the solution is? I haven't found much about that topic in forums etc. so I am wondering if I am the only one with this problem? :oops:

Best regards and thanks in advance

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
nlct
Posts: 263
Joined: Thu Nov 06, 2008 11:15 am
Contact:

Postby nlct » Sun Feb 24, 2013 12:49 am

mafis103 wrote:
  1. \newcommand{\bb}[1]{\hyperpage{\textbf{#1}}}


\hyperpage requires just the page number as its argument, so this would need to be
  1. \newcommand{\bb}[1]{\textbf{\hyperpage{#1}}}

However beamer disables \hyperpage so you can't use it. Here's a possible alternative that uses the datagidx package (part of the datatool bundle):
  1. \documentclass[16pt,pdftex]{beamer}
  2.  
  3. \makeatletter
  4. % beamer doesn't define \@idxitem, but it's used by the
  5. % \printterms "index" style, so define it:
  6. \newcommand\@idxitem{\par\hangindent40pt}
  7. \makeatother
  8.  
  9. \usepackage{datagidx}
  10.  
  11. \newgidx{index}{Index}
  12. \DTLgidxSetDefaultDB{index}
  13.  
  14. \newterm{taindex}
  15. \newterm{waindex}
  16. \newterm[parent=waindex]{ssubaz}
  17. \newterm{zbzindex}
  18. \newterm[parent=zbzindex]{isubbu}
  19. \newterm{ezzz}
  20. \newterm[parent=ezzz]{ezsubaz}
  21. \newterm{ezzbindex}
  22. \newterm[parent=ezzbindex]{uzsubbu}
  23. \newterm{binden}
  24. \newterm{aindex}
  25. \newterm[parent=aindex]{suba2}
  26. \newterm{bindex}
  27. \newterm[parent=bindex]{subb2}
  28.  
  29. \begin{document}
  30.  
  31. \begin{frame}
  32. \frametitle{TableOfContents}
  33. \tableofcontents
  34. \end{frame}
  35.  
  36. \begin{frame}
  37. \frametitle{Part1SecA}
  38. test \gls{taindex} \gls{ssubaz}
  39. \gls{isubbu}
  40. \end{frame}
  41.  
  42. \begin{frame}
  43. \frametitle{Part1SecA}
  44. % Make the next term have a bold page number in the index:
  45. test \gls{[textbf]taindex}
  46. \gls{ezsubaz}
  47. \gls{uzsubbu}
  48. \end{frame}
  49.  
  50. \begin{frame}
  51. \frametitle{Part2SecB}
  52. test \gls{binden}\gls{suba2}
  53. \gls{subb2}
  54. \end{frame}
  55.  
  56. \begin{frame}[allowframebreaks]
  57. \frametitle{Index}
  58. \printterms[style=index]
  59. \end{frame}
  60. \end{document}


You don't need makeindex, just two LaTeX runs. On the second run, the page numbers in the index will be hyperlinks.

Regards
Nicola Talbot

Link:
BBcode:
HTML:
Hide post links
Show post links

mafis103
Posts: 7
Joined: Sat Feb 23, 2013 9:29 am

Postby mafis103 » Sun Feb 24, 2013 9:04 am

Hi nicola,

thank you very much for your help. Is there any way to avoid always naming the index-terms twice?
(One time in the text and the other time by
  1. \newterm{INDEXNAME}
)

EDIT: And another question,

I redefined the "myindex" command like this:
  1. \newcommand{\myindex}[1]{\gls{#1}}

But now I have the problem that I want to refer to indexes, that have the same name, but a different Parent-concept. How can I differentiate them (with makeindex it was possible to do this {concept!sub} thing to differentiate, with \gls that doesn't work anymore of course)
Is it possible to make them sort automatically by alphabet?

Thanks in advance

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
nlct
Posts: 263
Joined: Thu Nov 06, 2008 11:15 am
Contact:

Postby nlct » Sun Feb 24, 2013 10:48 pm

mafis103 wrote:Is there any way to avoid always naming the index-terms twice? (One time in the text and the other time by
  1. \newterm{INDEXNAME}

)

No, I'm sorry. With datagidx you have to define the terms in the preamble.

I redefined the "myindex" command like this:
  1. \newcommand{\myindex}[1]{\gls{#1}}

But now I have the problem that I want to refer to indexes, that have the same name, but a different Parent-concept. How can I differentiate them (with makeindex it was possible to do this {concept!sub} thing to differentiate, with \gls that doesn't work anymore of course)

You can override the default label using the label key in the optional argument of \newterm:
  1. \newterm[label=foobar,parent=foo]{bar}

Now you can reference it using
  1. \gls{foobar}

You can also override how the text appears when using \gls (as opposed to how it will appear in the index):
  1. \newterm[label=foobar,text={bar (foo)},parent=foo]{bar}

or
  1. \newterm[label=foobar,text={foo bar},parent=foo]{bar}

etc.
Is it possible to make them sort automatically by alphabet?

The entries should automatically be sorted alphabetically (according to the entry level, as with makeindex). If this isn't happening, can you provide a minimal example illustrating the problem.

Regards
Nicola Talbot

Link:
BBcode: Topic is solved[/url]" title="Click to select post's link in BBcode format" onclick="this.focus();this.select();" />
HTML: Topic is solved</a>" title="Click to select post's link in HTML format" onclick="this.focus();this.select();" />
Hide post links
Show post links

mafis103
Posts: 7
Joined: Sat Feb 23, 2013 9:29 am

Postby mafis103 » Wed Feb 27, 2013 7:29 am

Hi Nicola,

please excuse my late response and thank you very much for your helpful answers. I will try your hints as soon as possible and maybe come back again with other question

But until that: Just Thank you, I wouldn't have found out about that solution by myself.

Link:
BBcode:
HTML:
Hide post links
Show post links

mafis103
Posts: 7
Joined: Sat Feb 23, 2013 9:29 am

Postby mafis103 » Mon Mar 11, 2013 9:43 pm

Hi there again.

Everything is working fine so far, but I have got a problem:
When I add a lot of indexes, the pages don't break and the indexes flow over the frame.... (see example).
Is there any solution for that?

  1. \documentclass[16pt,pdftex]{beamer}
  2.  
  3. \makeatletter
  4. % beamer doesn't define \@idxitem, but it's used by the
  5. % \printterms "index" style, so define it:
  6. \newcommand\@idxitem{\par\hangindent40pt}
  7. \makeatother
  8.  
  9. \usepackage{datagidx}
  10.  
  11. \newgidx{index}{Index}
  12. \DTLgidxSetDefaultDB{index}
  13.  
  14. \newterm{taindex}
  15. \newterm{waindex}
  16. \newterm[parent=waindex]{ssubaz}
  17. \newterm{zbzindex}
  18. \newterm[parent=zbzindex]{isubbu}
  19. \newterm{ezzz}
  20. \newterm[parent=ezzz]{ezsubaz}
  21. \newterm{ezzbindex}
  22. \newterm[parent=ezzbindex]{uzsubbu}
  23. \newterm{binden}
  24. \newterm{aindex}
  25. \newterm[parent=aindex]{suba2}
  26. \newterm{bindex}
  27. \newterm[parent=bindex]{subb2}
  28. \newterm{cindex}
  29. \newterm{dindex}
  30. \newterm{eindex}
  31. \newterm{findex}
  32. \newterm{gindex}
  33. \newterm{hindex}
  34. \newterm{iindex}
  35. \newterm{jindex}
  36. \newterm{kindex}
  37. \newterm{dindex2}
  38. \newterm{eindex2}
  39. \newterm{findex2}
  40. \newterm{gindex2}
  41. \newterm{hindex2}
  42. \newterm{iindex2}
  43. \newterm{jindex2}
  44. \newterm{kindex2}
  45. \newterm{dindex3}
  46. \newterm{eindex3}
  47. \newterm{findex3}
  48. \newterm{gindex3}
  49. \newterm{hindex3}
  50. \newterm{iindex3}
  51. \newterm{jindex3}
  52. \newterm{kindex3}
  53.  
  54. \begin{document}
  55.  
  56. \begin{frame}
  57. \frametitle{TableOfContents}
  58. \tableofcontents
  59. \end{frame}
  60.  
  61. \begin{frame}
  62. \frametitle{Part1SecA}
  63. test \gls{taindex} \gls{ssubaz}
  64. \gls{isubbu}
  65. \end{frame}
  66.  
  67. \begin{frame}
  68. \frametitle{Part1SecA}
  69. % Make the next term have a bold page number in the index:
  70. test \gls{[textbf]taindex}
  71. \gls{ezsubaz}
  72. \gls{dindex}
  73. \gls{eindex}
  74. \gls{findex}
  75. \gls{gindex}
  76. \gls{hindex}
  77. \gls{iindex}
  78. \gls{jindex}
  79. \gls{kindex}
  80. \gls{uzsubbu}
  81. \gls{dindex2}
  82. \gls{eindex2}
  83. \gls{findex2}
  84. \gls{gindex2}
  85. \gls{hindex2}
  86. \gls{iindex2}
  87. \gls{jindex2}
  88. \gls{kindex2}
  89. \gls{dindex3}
  90. \gls{eindex3}
  91. \gls{findex3}
  92. \gls{gindex3}
  93. \gls{hindex3}
  94. \gls{iindex3}
  95. \gls{jindex3}
  96. \gls{kindex3}
  97. \end{frame}
  98.  
  99. \begin{frame}
  100. \frametitle{Part2SecB}
  101. test \gls{binden}\gls{suba2}
  102. \gls{subb2}
  103. \end{frame}
  104.  
  105. \begin{frame}[allowframebreaks]
  106. \frametitle{Index}
  107. \printterms[style=index]
  108. \end{frame}
  109. \end{document}

Link:
BBcode:
HTML:
Hide post links
Show post links

mafis103
Posts: 7
Joined: Sat Feb 23, 2013 9:29 am

Postby mafis103 » Sat Mar 16, 2013 7:21 pm

- just pushing that thread up, because the last posted question still remains -

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
Stefan Kottwitz
Site Admin
Posts: 7801
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Sat Mar 16, 2013 7:36 pm

This thread was originally about hyperlinking the index, and the original question has been solved. Probably that's why your follow-up question at the end wasn't seen by many readers. It's usually the best to open a new topic for a new problem. You can always provide a link back to a related topic.

Stefan
Site admin

Link:
BBcode:
HTML:
Hide post links
Show post links


Return to “MakeIndex, Nomenclature, Glossaries and Acronyms”

Who is online

Users browsing this forum: No registered users and 1 guest