# siunitx redefines macros in pdf bookmarks

I want to use the macro \as for abbreviations in my document. However, siunitx interferes with its use in pdf bookmarks. The following MWE produces a document with a section named "foo" in the document, but "as" in the pdf bookmarks.

\documentclass{article}

\usepackage{hyperref}
\usepackage{siunitx}

\begin{document}

\def\as{foo}
\section{\as}

\end{document}


This seems to be due to the fact that siunitx defines \as as a unit shorthand (attosecond) and seems to want to help me use it in pdf bookmarks. However, it fails to detect that I am not using \as inside a unit macro.

• Is this a bug or just an unfortunate feature?
• Is there a workaround to avoid this behavior? I did not find anything about removing units in the siunitx documentation.

\documentclass{article}

\usepackage{hyperref}
\usepackage{siunitx}
\AtBeginDocument
{\pdfstringdefDisableCommands{\def\as{foo}}}
\begin{document}

\def\as{foo}
\section{\as}

\end{document}