How to properly define NOx

\texorpdfstring requires two arguments: the first is what's typeset by TeX, the second what's passed on to hyperref for bookmarks and the like. So you should do

\newcommand\nox{\texorpdfstring{NO\textsubscript{x}}{NOx}\xspace}

Example:

\documentclass{article}
\usepackage{xspace}
\usepackage{hyperref}

\makeatletter
\DeclareRobustCommand{\textsubscript}[1]{\@textsubscript{\selectfont#1}}
\newcommand{\@textsubscript}[1]{%
  {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}%
}
\makeatother
\newcommand\nox{\texorpdfstring{NO\textsubscript{x}}{NOx}\xspace}

\begin{document}
\section{Here's \nox and something else}

\nox is very dangerous.
\end{document}

enter image description here

Alternatively, you can do

\newcommand\nox{NO\textsubscript{x}\xspace}
\pdfstringdefDisableCommands{%
  \def\nox{NOx\xspace}%
}

so defining a proper replacement for hyperref's needs.


With fixltx2 an issue with \textsubstring is corrected. So please try the following MWE:

\documentclass{report} 

\usepackage{xspace}
\usepackage{fixltx2e}% for \textsubscript
\usepackage{hyperref}

\newcommand{\nox}{\texorpdfstring{NO\textsubscript{x}}{NOx}}
\newcommand{\noxa}{\texorpdfstring{NO\textsubscript{x}}{NOx}\xspace}

\begin{document}

\nox Blafasel \noxa Blafasel 

\end{document}

The macro \texorpdfstring{first}{second}needs two arguments. The first is for the document (with subscruiption for example), the second if special things are not allowed (without: NOx).