I'm not sure what this would be useful for: it makes little sense to check for emptiness of the argument, in that case just don't use \FakeFrame{}
.
Anyway, \equal
tries to expand its argument and with \input
this fails. Use xifthen
and \isempty
.
\begin{filecontents*}{\jobname-quest}
\begin{quest}
Just a problem.
\end{quest}
\end{filecontents*}
\documentclass{beamer}
\usepackage{xifthen}
\newtheorem{quest}{Question}
\newcommand{\FakeFrame}[1]{\ifthenelse{\isempty{#1}}{}{%
\begin{frame}[t]
#1
\end{frame}
}}
\begin{document}
\FakeFrame{\input{\jobname-quest.tex}}
\end{document}
If you want to load the file only if it's not empty, then use a different strategy.
\begin{filecontents*}{\jobname-quest}
\begin{quest}
Just a problem.
\end{quest}
\end{filecontents*}
\begin{filecontents*}{\jobname-empty}
\end{filecontents*}
\documentclass{beamer}
\newtheorem{quest}{Question}
\ExplSyntaxOn
\NewDocumentCommand{\FakeFrameInput}{m}
{% #1 = filename
\file_get:nnN { #1 } { } \l_tmpa_tl
\tl_remove_all:Nn \l_tmpa_tl { \par }
\tl_if_blank:VF \l_tmpa_tl
{
\begin{frame}[t] \input{#1} \end{frame}
}
}
\ExplSyntaxOff
\begin{document}
\FakeFrameInput{\jobname-quest.tex}
\FakeFrameInput{\jobname-empty.tex}
\end{document}
This will only produce one frame. The file is read into a token list variable in which we remove all \par
tokens (generated by empty lines). If nothing remains (or just spaces), the file is considered empty.
\Fakeframe
macro?\input{thequest.tex}
is not fully expandable while\ifthenelse
's argument require it to be fully expandable. But do you want to check if#1
itself is empty, or the file content is empty?beamerarticle
package would be easier than making fake frames?