I am attempting to place tooltips over acronyms to show the long-form. My command \ac
works for acronyms with plain text descriptions. The problem I run into is that if the acronyms contain other acronyms, eg. \gls{other}
in the long-form, that part does not get expanded.
EDIT:
Another concern that I ran into is that if the description has some sort of formatting, eg. \bfseries
, the tooltip contains unwanted text, I believe from the character expansion (?) of \bfseries
. This makes me want to ask the question: is there a way to expand some command and keep only the plain text characters? Perhaps expand a command, and delete all cat codes except for 11 and 12? I may take a dive into explicit syntax or LuaTeX to see what this would look like.
MWE below:
\documentclass[11pt]{scrartcl}
\usepackage[xindy,style=super,nogroupskip,section=paragraph,savewrites=true,acronym]{glossaries-extra}
\makeglossaries
\usepackage{pdfcomment}
\newcommand{\SomeWords}{Hello World}
\newacronym{abc}{ABC}{Acronym just BeCause}
\newacronym{sabc}{SABC}{Special \gls{abc}. \SomeWords}
\newcommand{\ac}[1]{\pdftooltip{\gls*{#1}}{\glsentrylong{#1}}}
\begin{document}
\ac{abc} % tooltip is "Acronym just BeCause. Hello World"
\ac{sabc} % tooltip is "Special abc. Hello World", I want "Special Acronym just BeCause. Hello World"
% does not expand (?) the \gls{abc} to its long form? I am surprised that \SomeWords gets expanded however.
\end{document}