使用非数字列表和词汇表时,See-option 会被删除

使用非数字列表和词汇表时,See-option 会被删除

如以下 MWE 所示,打印时,引用正常词汇表条目的 -acronymsee的 -option会被删除。删除 -package的 -option可以得到所需的结果。有什么方法可以解决这个问题吗?newglossaryentrynonumberlistglossaries

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[acronym,nonumberlist]{glossaries}
\makeglossaries

%%% The glossary entry the acronym links to   
\newglossaryentry{apig}{name={API},
    description={An Application Programming Interface (API) is a particular set
of rules and specifications that a software program can follow to access and
make use of the services and resources provided by another particular software
program that implements that API}}

%%% define the acronym and use the see= option
\newglossaryentry{api}{type=\acronymtype, name={API}, description={Application
Programming Interface}, first={Application
Programming Interface (API)\glsadd{apig}}, see=[Glossary:]{apig}}

\begin{document}

\begin{frame}{First Frame}
    First use \gls{api}

    subsequent \gls{api}
\end{frame}

\begin{frame}
    \printglossary[type=\acronymtype]
\end{frame}
\begin{frame}
    \printglossary[type=main]
\end{frame}

\end{document}

答案1

词汇表外观选项

参见自动编号列表 如果您使用 隐藏数字列表nonumberlist(如上所述),这也会隐藏由或see中的键提供的任何交叉引用信息。如果您使用 ,键将自动为该条目实现 。(请注意,这不会影响。)有关更多详细信息,请参阅§8 交叉引用条目。\newglossaryentry\glsseeseeautonumberlistseenonumberlist=false\glssee

因此您只需添加seeautonumberlist

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[acronym,nonumberlist,seeautonumberlist]{glossaries}
\makeglossaries

%%% The glossary entry the acronym links to   
\newglossaryentry{apig}{name={API},
    description={An Application Programming Interface (API) is a
particular set
of rules and specifications that a software program can follow to
access and
make use of the services and resources provided by another
particular software
program that implements that API}}

%%% define the acronym and use the see= option
\newglossaryentry{api}{type=\acronymtype, name={API},
description={Application
Programming Interface}, first={Application
Programming Interface (API)\glsadd{apig}}, see=[Glossary:]{apig}}

\begin{document}

\begin{frame}{First Frame}
    First use \gls{api}

    subsequent \gls{api}
\end{frame}

\begin{frame}
    \printglossary[type=\acronymtype]
\end{frame}
\begin{frame}
    \printglossary[type=main]
\end{frame}

但是,您将获得该条目的位置以及交叉引用:

API 应用程序编程接口。1、名词解释:API

有两种可能的选择:

  1. 添加交叉引用到描述中:

    \documentclass{beamer}
    \usepackage[utf8]{inputenc}
    \usepackage[acronym,nonumberlist]{glossaries}
    \makeglossaries
    
    %%% The glossary entry the acronym links to   
    \newglossaryentry{apig}{name={API},
        description={An Application Programming Interface (API) is a
    particular set
    of rules and specifications that a software program can follow to
    access and
    make use of the services and resources provided by another
    particular software
    program that implements that API}}
    
    %%% define the acronym a
    \newglossaryentry{api}{type=\acronymtype, name={API},
    description={Application
    Programming Interface, \glsseeformat[Glossary:]{apig}{}}, first={Application
    Programming Interface (API)\glsadd{apig}}}
    
    \begin{document}
    
    \begin{frame}{First Frame}
        First use \gls{api}
    
        subsequent \gls{api}
    \end{frame}
    
    \begin{frame}
        \printglossary[type=\acronymtype]
    \end{frame}
    \begin{frame}
        \printglossary[type=main]
    \end{frame}
    
    \end{document}
    
  2. 使用扩展包glossaries-extraglossaries. (这需要和的相当最新版本glossaries-extra。)

    \documentclass{beamer}
    \usepackage[utf8]{inputenc}
    \usepackage[acronym,nonumberlist]{glossaries-extra}
    \makeglossaries
    
    %%% The glossary entry the acronym links to   
    \newglossaryentry{apig}{name={API},
        description={An Application Programming Interface (API) is a
    particular set
    of rules and specifications that a software program can follow to
    access and
    make use of the services and resources provided by another
    particular software
    program that implements that API}}
    
    %%% define the acronym and use the see= option
    
    \setabbreviationstyle[acronym]{long-short}
    
    \newacronym[see={[Glossary:]{apig}}]{api}{API}{Application
    Programming Interface}
    
    \renewcommand{\glsxtrpostdescacronym}{%
     \ifglshasfield{see}{\glscurrententrylabel}%
     {%
       \glsfieldfetch{\glscurrententrylabel}{see}{\thisxr}%
       , \expandafter\glsseeformat\thisxr{}%
     }% 
     {}%
    }
    
    \begin{document}
    
    \begin{frame}{First Frame}
        First use \gls{api}
    
        subsequent \gls{api}
    \end{frame}
    
    \begin{frame}
        \printglossary[type=\acronymtype]
    \end{frame}
    \begin{frame}
        \printglossary[type=main]
    \end{frame}
    \end{document}
    

相关内容