我目前正在写一份包含词汇表的大型文档(\usepackage[toc,nomain,nonumberlist]{glossaries}
)
有没有一种简单的方法可以自动为条目创建工具提示?这样,如果你将鼠标悬停在它上面,它就会显示解释。当你点击它时,它仍然会将你链接到词汇表?
也许是类似fancytooltips
或pdfcomment
?
答案1
我使用了这个解决方法:由于我只需要在缩写形式中使用工具提示,因此我用工具提示替换了超链接。
\usepackage[acronym,shortcuts,nopostdot,style=super,nonumberlist,toc,nogroupskip]{glossaries}
我包含了快捷方式选项以避免递归替换\renewcommand
。
\renewcommand{\acs}[1]{\pdftooltip{\acrshort*{#1}}{\glsentrylong{#1}}}
\renewcommand{\acsp}[1]{\pdftooltip{\acrshortpl*{#1}}{\glsentrylongpl{#1}}}
答案2
虽然经过一番折腾,但最终我还是得到了满意的东西。我们正在使用令人惊叹的词汇表包(这是多么令人难以置信的爱的劳动)在 overleaf 中制作成 PDF。
我们包括我们的首字母缩略词.tex. 以下是简单的例子
\documentclass[10pt, journal]{IEEEtran}
\include{acronyms}
\begin{document}
Testing \tip{of} is hard. You need a big dataset because \tip{of} papers are judged critically.
However, \tip{dvs} cameras make using \tip{bmof} methods easy. \tip{dvs} cameras are cool.
\end{document}
以下是(精简版)首字母缩略词.tex
% our abbreviations, acronyms, etc
\usepackage[draft]{pdfcomment} % https://ctan.org/pkg/pdfcomment?lang=en
\usepackage[hyperfirst=false,acronym,sort=none,shortcuts,nopostdot,style=super,nonumberlist,toc,nogroupskip]{glossaries}
\usepackage[dvipsnames]{xcolor} % used for colored acronyms
\glsdisablehyper % to disable hyperlinks on all acronyms
\newcommand{\accolor}[1]{\textcolor{Sepia}{#1}}
\newcommand*{\glossfirstformat}[1]{\accolor{#1}} % use to make first definition special format
%https://tex.stackexchange.com/questions/232707/modify-appearance-of-first-acronym
\newcommand*{\acfirstformat}[1]{\textcolor{Bittersweet}{\textbf{#1}}}
\newcommand*{\acplfirstformat}[1]{\textcolor{Bittersweet}{\textbf{#1}}}
\newacronymstyle{myacro}
{%
\GlsUseAcrEntryDispStyle{long-short}%
}%
{%
\GlsUseAcrStyleDefs{long-short}%
\renewcommand*{\genacrfullformat}[1]{%
\glossfirstformat{\glsentrylong{##1}}\space
(\acfirstformat{\glsentryshort{##1}})%
}%
\renewcommand*{\Genacrfullformat}[2]{%
\glossfirstformat{\Glsentrylong{##1}}\space
(\glsentryshort{##1})%
}%
\renewcommand*{\genplacrfullformat}[2]{%
\glossfirstformat{\glsentrylongpl{##1}}\space
(\acplfirstformat{\glsentryshort{##1}})%
}%
\renewcommand*{\Genplacrfullformat}[2]{%
\glossfirstformat{\Glsentrylongpl{##1}}\space
(\glsentryshortpl{##1})%
}%
}
\setacronymstyle{myacro}
% use for normal acronyms, gives them a PDF tooltip popup
\newcommand*{\tip}[1]{% define our acronym command, make it short since we use it a lot, use * for so that it is only a 'short' command
\ifglsused{#1}{% if we used it already, then put pdftooltip
{\pdftooltip{\accolor{\glsentryshort{#1}}}{\glsentrydesc{#1}}}%
}{%
\gls{#1}% otherwise put the normal gls
}%
}%
% use for plural acronyms
\newcommand*{\tips}[1]{% define our acronym command, make it short since we use it a lot, use * for so that it is only a 'short' command
\ifglsused{#1}{% if we used it already, then put pdftooltip
{\pdftooltip{\accolor{\glsentryshortpl{#1}}}{\glsentrydescpl{#1}}}%
}{%
\gls{#1}% otherwise put the normal gls
}%
}%
% sorted list of acronyms
\newacronym{dvs}{DVS}{Dynamic Vision Sensor}
\newacronym[longplural={First In First Out memories}]{fifo}{FIFO}{First In First Out memory}
\newacronym{of}{OF}{Optical Flow}
至少在 Adobe Acrobat Reader 和 DC 中(但出于某种原因,至少在这台 Windows 计算机上的 SumatraPDF 中没有),它显示工具提示弹出窗口:
如果词汇表创作者会加入进来,这将会很棒。如果不使用 \tip{} 命令的开关,我无法让它工作,该开关可以启用词汇表输出或pdf评论。