I don't know of a package that does this and having all commands in the abstract expand to plain text is probably not possible because latex is not designed to turn commands into plain text.
Here is a solution that writes your abstract to a file, expanding "what it can". It uses the environ package to define a new Abstract
environment and the newfile package to write the abstract to a file and "expand" the abstract in some sense. Using the the Abstract
envinment the abstract appears as it normally does in the PDF file and a partially expanded version of the abstract is written to \jobname.abs
(that is, the name of the LaTeX file with an abs
extension. For the abstract in the original file, this produces the following abs
file:
This is an abstract TEST\nobreakspace {}with interesting abbreviations like \gls {BLSTM} and other macros like $\SI {15}{\second }$.
So, some expansion has occurred but there is a cost with primitives like \nobreakspace
appearing in the output together with \gls
and \SI
commands. I do not know how to do better than this.
Here is the full code:
\documentclass{article}
\usepackage{siunitx}
\usepackage{environ}
\usepackage{newfile}
\usepackage[acronym, toc, nonumberlist]{glossaries}
\title{Title of Document}
\author{Name of Author}
\newoutputstream{abstract}% define a new output file stream
\NewEnviron{Abstract}{
\openoutputfile{\jobname.abs}{abstract}% open the abs file
\addtostream{abstract}{\BODY}% write the abstract=\BODY to the file
\closeoutputstream{abstract}% close the file
\abstract\BODY\endabstract% add the abstract to the PDF file
}
\newcommand{\texttest}{TEST}
\newacronym{BLSTM}{BLSTM}{bidirectional long short term memory network}
\begin{document}
\maketitle
\begin{Abstract}
This is an abstract \texttest~with interesting abbreviations like \gls{BLSTM} and other macros like $\SI{15}{\second}$.
\end{Abstract}
\end{document}