[Tex/LaTex] Include TEXT from another file before generating PDF

includepdftext manipulation

I have a tex file which compiles fine and generates PDF without any problem. I need to include text (contents of a text file) from another .txt file at the end of tex file so that generated PDF would have this text in it.

In other words, How can I call another file (text file) to include its contents in a tex file before generating PDF?

Please advise, Thanks a lot!!

Best Answer

It is not obvious if you want to merge your text file or reproduce it as it is. Hence there are both solutions:

\documentclass{article}

\begin{document}

A beginning.

\input{aaa.txt} % your text file


\textbf{But if you want to reproduce your text as it is:}
{\obeylines\obeyspaces
\texttt{
\input{aaa.txt}
}}

\end{document}

enter image description here