0

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 Gaborit Jun 27 '17 at 13:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Welcome to TeX.SX! Please be aware that if you put that into section the toc entry may be problematic. – TeXnician Jun 27 '17 at 13:03
  • Thanks. For my current purpose that s fine since i have no toc. But good to know. – Giulioo Jun 27 '17 at 15:43
2

Did you ask this before? (someone did recently).

\input is a fragile command so you need

\section{\protect\input{toBeIncluded.tex}}
  • Thanks a lot! No - that s odd, since i googled quite a bit before asking. Where was it asked? – Giulioo Jun 27 '17 at 15:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.