创建可以索引并添加到​​词汇表中的不可见部分

创建可以索引并添加到​​词汇表中的不可见部分

基本上,我试图根据图片中的内容编制索引或词汇表。假设图片中有苹果和香蕉,我试图将它们添加到词汇表中,最后我应该用一张单独的图片来显示每个项目。
词汇表应该引用每个图片/部分,而不是页码,但我可以妥协到页码。
我试过使用ocg-p包将 tikzpicture 环境中的节点定义为可见或不可见,但似乎无法从该环境内部向词汇表添加项目,或者我无法以某种方式做到这一点。

这是我的代码:

\documentclass[twoside,letter,11pt]{book}

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

\usepackage[T1]{fontenc}
\usepackage{fontspec}%genel
\usepackage[splitindex,texindy]{indextools}
\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

\usepackage{tikz}
\usepackage{ocg-p}
% ------------------------------------------------

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

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

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

\makeglossaries

% 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}
    % ---------------------------------------------------------------------

    \begin{document}

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

    \begin{figure*}[h]

    \begin{tikzpicture}[baseline=0]

    % 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}};

    \end{ocg}

    \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}

    };

    \end{ocg}

    \end{tikzpicture}

    \end{figure*}

\end{document}

我无论如何都不必使用ocg-p。我正在寻找一种解决方案,其中图片和图像的元素是重叠的,以避免过多的空白,并且在最后的词汇表中引用这些元素至关重要。

更新
我还发现删除:

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

在 .glosdef 辅助文件中,无需在 latex 中定义新命令即可使词汇表元素可见。但我不知道它是否可以被标记为通用解决方案。

答案1

这是一个解决方案。如果我们有

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

诀窍是使用

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

可以定义一个新命令来执行此工作

\newcommand{\mtnewglossaryentry}[3]{%
\newglossaryentry{#1}{name={}, sort={#2}, description={\hspace{-.8em} #3}}}

要使用的\mtnewglossaryentry{A1}{Aa 1}{image for example}

对于其他条目(标准),可以照常进行

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

要引用该部分,请使用\gls[counter=section]{A1}

\documentclass[twoside,letter,11pt]{book}

\usepackage{glossaries}
\makeglossaries

\newcommand{\mtnewglossaryentry}[3]{%
\newglossaryentry{#1}{name={}, sort={#2}, description={\hspace{-.8em} #3}}}

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

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

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

\end{document}

相关内容