# \input inside \section [duplicate]

This question already has an answer here:

Would you help me understand and possibly fix the problem below?

If I do

\title{\input{toBeIncluded.tex}}

\begin{document}

\maketitle

\section{Test Section 1}

\section{Test Section 2}

\end{document}


I get exactly what I d expect (with no errors), whereas if I do

\title{Test Title}

\begin{document}

\maketitle

\section{\input{toBeIncluded.tex}}

\section{Test Section 2}

\end{document}


I get two errors, even though the pdf is still produced and looks perfect.

toBeIncluded.tex is a file with just one word ("Hello") in it.

Thanks a lot

## marked as duplicate by David Carlisle, Troy, Torbjørn T., Schweinebacke, Paul GaboritJun 27 '17 at 13:53

\input is a fragile command so you need
\section{\protect\input{toBeIncluded.tex}}