Given a file master.tex:
\documentclass{article}
\usepackage{standalone}
\begin{document}
\input{sub}
\end{document}
and a file sub.tex:
\documentclass{standalone}
\begin{document}
\[
0
\]
\end{document}
the command pdflatex master.tex runs as expected, but the command pdflatex sub.tex gives the error
Bad math environment delimiter.
Can anyone explain what is going on and/or how to solve this?