Basically I am trying to index, or make a glossary out of what is inside a picture. Let's say the pictures have apples and bananas, I am trying to add those to a glossary at the end where I should show each of the items with an individual picture.
The glossary should reference each picture/section rather than the page number, but I can comprimise to page numbers.
I have tried using ocg-p package which defines nodes in tikzpicture environment as visible or invisible, but it seems like it is not possible to add an item to glossary from inside that environment, or I couldn't do it somehow.

Here is my code:


% Packages -----------------------------------

\usepackage{graphicx, xcolor}%resim eklemek ve üstünde oynayabilmek için
\usepackage[style=Ruled,valign=t, capposition=bottom]{floatrow}
\usepackage[strict=true]{csquotes}%fransız tipi tırnak işareti
\usepackage{todonotes} %Yapılacak Notları eklemek için
\usepackage{placeins}%Eklenen resim ve figürlerin bulundukları bölümde sabit kalmaları için
\usepackage[bibstyle=verbose, backend=biber, citepages=suppress, citestyle=verbose-trad1, firstinits=true, isbn=false,dashed=false]{biblatex} %Kaynakça için-------
\usepackage[hidelinks]{hyperref}%Metin-Dipnot bağlantısı için
\usepackage[acronym,nomain,xindy]{glossaries}%sözlük yapımı için

% ------------------------------------------------

% The glossary ---------------------------------------------

\newglossary[glg]{İşaretListesi}{gls}{glo}{İşaret Listesi}



% Some glossary elements that refers to the elements in the pictures -----------------------------------

\newglossaryentry{G1}{name={G 1}, description={image}, type=İşaretListesi}
\newglossaryentry{T14}{name={T 14}, description={image}, type=İşaretListesi}
\newglossaryentry{A1}{name={A 1}, description={image}, type=İşaretListesi}
\newglossaryentry{B1}{name={B 1}, description={image}, type=İşaretListesi}
\newglossaryentry{Hiero3}{name={3}, description={image}, type=İşaretListesi}
\newglossaryentry{N25}{name={N 25}, description={image}, type=İşaretListesi}
\newglossaryentry{R2}{name={R 2}, description={image}, type=İşaretListesi}
\newglossaryentry{M23}{name={M 23}, description={image}, type=İşaretListesi}
\newglossaryentry{N35}{name={N 35}, description={image}, type=İşaretListesi}
\newglossaryentry{Aa1}{name={A a1}, description={image}, type=İşaretListesi}
    % ---------------------------------------------------------------------


    % Some Picture---------------------------------------------------



    % The image of the picture which should be visible ---------------------------------

    \begin{ocg}[printocg=always]{Hiyeroglif P1-3}{hierop1x3}{1}

% Use any image you like in \includegraphics instead

    \node[inner sep=0pt] (hierop1x3) at (2,0) {\includegraphics[scale=1]{./Paragraf_1_3.eps}
    \caption[P 1: r1-r2]{ Hiyeroglif Çevirisi § 1-3}};


    \begin{ocg}[printocg=never,listintoolbar=always]{MdC P1-3}{MdCp1x3}{0}

        % The elements inside the picture which should overlay the picture and should      
% always be invisible, while retaining the ability to show up in glossaries        
% and indexes ------------------------------------------

    \node[overlay] (MdCp1x3) at (2,0)
    \gls{G1} \gls{T14} \gls{M23}






I am not obliged to use ocg-p in anyway. I am looking for a solution where the elements of picture and the image is overlayed though, to avoid the excessive white space and it is crucial to reference those elements in a glossary at the end.

I also found that deleting:

\ifglsentryexists{.\spacefactor \sfcode `\char "0307\relax }{}%
\gls@defglossaryentry{.\spacefactor \sfcode `\char "0307\relax }%

in the .glosdef auxilary file made the glossary elements visible without having the need to define a newcommand in latex. I don't know if it could be marked as a general soluion though.

  • Welcome to TeX.SX! Please transform your example into something compilable -- at the moment it is disrupted and incomplete. – user31729 Aug 5 '16 at 10:54
  • @ChristianHupfer it should be compilable now, besides the includegraphics which points to a file in my hard-drive. Also I am not sure which packages are of absolute necessity, so I am giving all them instead. Sorry for the blunder, i didn't notice the differences between the entry list and the uses of \gls{X} – K.E. Aug 5 '16 at 12:28
  • For the graphics file: \usepackage[demo]{graphicx} will disregard any image and display a black rectangle instead -- this is useful for testing purposes (or providing an MWE) – user31729 Aug 5 '16 at 13:18

Here is a solution. If we have

\newglossaryentry{A1}{name={Aa 1}, description={image for example}}

The trick is to use

\newglossaryentry{A1}{name={}, sort={Aa 1}, description={\hspace{-.8em} image for example}}

One can define a new command that does this job

\newglossaryentry{#1}{name={}, sort={#2}, description={\hspace{-.8em} #3}}}

To be used \mtnewglossaryentry{A1}{Aa 1}{image for example}

For other entries (standard) one can do as usual

\newglossaryentry{Bla}{name={Bla 1}, description={Bla bla bla}}

To reference the section use \gls[counter=section]{A1}



\newglossaryentry{#1}{name={}, sort={#2}, description={\hspace{-.8em} #3}}}

\mtnewglossaryentry{G1}{G 1}{image}
\newglossaryentry{Bla}{name={Bla 1}, description={Bla bla bla}} % standard
\mtnewglossaryentry{A1}{Aa 1}{image}
% ---------------------------------------------------------------------

X \gls{Bla} \gls{G1}\gls[counter=section]{A1}foo \gls{B1}bla bla\gls{A1}.

X \gls{G1}\gls[counter=section]{A1}foo \gls{B1}bla bla\gls{A1}.

  • This works for listing the glossary items that are in the ocg-p environment, so I am marking it as an answer, however I can't see the names of the glossary items which was to be expected I assume, though I can add the names to the descriptions before adding the individual picture. Would you mind explaining how and why this works? – K.E. Aug 5 '16 at 20:46
  • Answer edited again. Sorry, the first edit was confusing. – touhami Aug 6 '16 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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