在......之外这,我设法使用该包在词汇表和首字母缩略词的描述中添加脚注(首次使用的词汇表)glossaries
。
现在,我在一个缩写词中引用了另一个缩写词。如果文本中未使用该缩写词,则脚注会正确显示在缩写词列表中。但是,当在文本中使用缩写词时,引用的缩写词的脚注会丢失。
如何解决脚注缺失的问题?
以下是 MWE:
\documentclass{scrreprt}
\usepackage{xstring}
\usepackage[backref=page,plainpages=false,pdfpagelabels,colorlinks]{hyperref}
\usepackage[footnote,acronym,hyperfirst,style=long,nomain]{glossaries}
% acronym style
\newacronymstyle{ex-footnote}%
{%
\GlsUseAcrEntryDispStyle{footnote}%
}%
{%
\GlsUseAcrStyleDefs{hyperfirst, footnote}%
\renewcommand*{\genacrfullformat}[2]{%
\firstacronymfont{\glsentryshort{##1}}##2%
\expandafter\footnote\expandafter{\expandafter\glsentrylong\expandafter{##1}}%
}%
\renewcommand*{\Genacrfullformat}[2]{%
\firstacronymfont{\Glsentryshort{##1}}##2%
\expandafter\footnote\expandafter{\expandafter\glsentrylong\expandafter{##1}}%
}%
\renewcommand*{\genplacrfullformat}[2]{%
\firstacronymfont{\glsentryshortpl{##1}}##2%
\expandafter\footnote\expandafter{\expandafter\glsentrylongpl\expandafter{##1}}%
}%
\renewcommand*{\Genplacrfullformat}[2]{%
\firstacronymfont{\Glsentryshortpl{##1}}##2%
\expandafter\footnote\expandafter{\expandafter\glsentrylongpl\expandafter{##1}}%
}%
}
\setacronymstyle{ex-footnote}
\makeglossaries
% arconyms
\newacronym{RAM}{RAM}{Random Access Memory}
\newacronym{SRAM}{SRAM}{Static \gls{RAM}}
\newacronym{VHSIC}{VHSIC}{Very High Speed Integrated Circuit}
\newacronym{VHDL}{VHDL}{\gls{VHSIC} Hardware Description Language}
\newacronym{PLD}{PLD}{Programmable Logic Device}
\newacronym{SPLD}{SPLD}{Simple \gls{PLD}}
\begin{document}
\gls{SRAM}\\
foo\footnote{bar}
\printglossary[type=\acronymtype, title=Abbreviations]
\glsaddallunused
\end{document}
答案1
这是嵌套脚注的问题。从下面这个简单的例子也可以看出同样的情况:
\documentclass{article}
\begin{document}
SRAM\footnote{Static RAM\footnote{Random Access Memory}}
foo\footnote{bar}
\end{document}
与您的示例一样,第二个脚注标记出现,但相应的脚注文本没有出现。典型的解决方法是执行以下操作:
\documentclass{article}
\begin{document}
SRAM\footnote{Static RAM\footnotemark}\footnotetext{Random Access Memory}
foo\footnote{bar}
\end{document}
然而,对于词汇表条目来说,这并不容易。相反,我建议使用类似这样的方法:
\documentclass{scrreprt}
\usepackage{xstring}
\usepackage[backref=page,plainpages=false,pdfpagelabels,colorlinks]{hyperref}
\usepackage[footnote,acronym,hyperfirst,style=long,nomain]{glossaries}
% acronym style
\newacronymstyle{ex-footnote}%
{%
\GlsUseAcrEntryDispStyle{footnote}%
}%
{%
\GlsUseAcrStyleDefs{hyperfirst, footnote}%
\renewcommand*{\genacrfullformat}[2]{%
\firstacronymfont{\glsentryshort{##1}}##2%
\expandafter\footnote\expandafter{\expandafter\glsentrylong\expandafter{##1}}%
}%
\renewcommand*{\Genacrfullformat}[2]{%
\firstacronymfont{\Glsentryshort{##1}}##2%
\expandafter\footnote\expandafter{\expandafter\glsentrylong\expandafter{##1}}%
}%
\renewcommand*{\genplacrfullformat}[2]{%
\firstacronymfont{\glsentryshortpl{##1}}##2%
\expandafter\footnote\expandafter{\expandafter\glsentrylongpl\expandafter{##1}}%
}%
\renewcommand*{\Genplacrfullformat}[2]{%
\firstacronymfont{\Glsentryshortpl{##1}}##2%
\expandafter\footnote\expandafter{\expandafter\glsentrylongpl\expandafter{##1}}%
}%
}
\setacronymstyle{ex-footnote}
\makeglossaries
% arconyms
\newacronym{RAM}{RAM}{Random Access Memory}
\newacronym[description={Static \acrshort{RAM}}]{SRAM}{SRAM}{Static \glsentrylong{RAM}}
\newacronym{VHSIC}{VHSIC}{Very High Speed Integrated Circuit}
\newacronym[description={\acrshort{VHSIC} Hardware Description
Language}]{VHDL}{VHDL}{\glsentrylong{VHSIC} Hardware Description Language}
\newacronym{PLD}{PLD}{Programmable Logic Device}
\newacronym[description={Simple \acrshort{PLD}}]{SPLD}{SPLD}{Simple
\glsentrylong{PLD}}
\begin{document}
\gls{SRAM}\\
foo\footnote{bar}
\printglossary[type=\acronymtype, title=Abbreviations]
\glsaddallunused
\end{document}
其他可能的选择包括:
\newacronym{RAM}{RAM}{Random Access Memory}
\newacronym{SRAM}{SRAM}{Static \glsentrylong{RAM}}
\newacronym{VHSIC}{VHSIC}{Very High Speed Integrated Circuit}
\newacronym{VHDL}{VHDL}{\glsentrylong{VHSIC} Hardware Description Language}
\newacronym{PLD}{PLD}{Programmable Logic Device}
\newacronym{SPLD}{SPLD}{Simple \glsentrylong{PLD}}
或者:
\newacronym{RAM}{RAM}{Random Access Memory}
\newacronym[description={Static \gls{RAM}}]{SRAM}{SRAM}{Static \glsentrylong{RAM}}
\newacronym{VHSIC}{VHSIC}{Very High Speed Integrated Circuit}
\newacronym[description={\gls{VHSIC} Hardware Description
Language}]{VHDL}{VHDL}{\glsentrylong{VHSIC} Hardware Description Language}
\newacronym{PLD}{PLD}{Programmable Logic Device}
\newacronym[description={Simple \gls{PLD}}]{SPLD}{SPLD}{Simple
\glsentrylong{PLD}}