# \ifstandalone command is not recognised

I have several subfiles and a main file as follows:

%subfile1

\documentclass[alpha-refs]{wiley-article}
\usepackage{standalone}
....
\begin{document}
some text
\bibliographystyle{plain}
\bibliography{mybib}
\end{document}


%subfile2

\documentclass[alpha-refs]{wiley-article}
\usepackage{standalone}
....
\begin{document}
some text
\bibliographystyle{plain}
\bibliography{mybib}
\end{document}


%main

\documentclass[alpha-refs]{wiley-article}
\usepackage[subpreambles=false]{standalone}
\usepackage{import}
....
\begin{document}
some text
\section{1}
\subimport{sections/}{subfile1}
\section{2}
\subimport{sections/}{subfile2}
\bibliographystyle{plain}
\bibliography{mybib}
\end{document}


when I compile the subfiles I get the references since I included the bibliography in subfiles, and when I compile the main file, I get the references for each sections as well. I want to see the references in the subfiles, but I ignore them in each section in the main file, and only show the references at the end of the main file. using \ifstandalone ... \fi around the bibliography{} in subfiles does not work since it does not recognize the command \ifstandalone, and gives the following error:

This is BibTeX, Version 0.99d (TeX Live 2015)
The top-level auxiliary file: example.aux
The style file: rss.bst
I found no \bibdata command---while reading file subfile1.aux
Warning--I didn't find a database entry for "cite1"
Warning--I didn't find a database entry for "cite2"
Warning--I didn't find a database entry for "cite3"
(There was 1 error message)


Does anyone know what is the problem?

\ifstandalone is set to true by the standalone class (used in subfiles) but to false by the standalone package (used in the main document). Your use case uses the standalone package in the subfiles as well. Try changing \documentclass[alpha-refs]{wiley-article} \usepackage{standalone} to \documentclass[alpha-refs,class=wiley-article]{standalone} in the subfiles.