# Importing separate file into my LaTeX file

I'm curious as to whether it's possible to insert an entire separate file into a LaTeX document as an inline command. For example, I have the following LaTeX code:

\begin{Verbatim}[frame=single]
%Want to insert all the text from another file here
\end{Verbatim}


So where it says %Want to insert... I'd like to insert all of the text from another file (in the same directory) into the .tex document so that the text in the other file appears in a box in the .tex document.

I hope that's clear, if not I'll clarify in the comments.

-
Welcome to TeX.sx! No need to add thanks, simply upvote any good answers you may receive. – Peter Jansson Feb 25 '13 at 15:31
You can use package listings for including a file or parts of a file. What exactly do you mean with "inline command"? Should the content of file, for example "to be included", be included inline ( ... Text to be inline included ...) or should only the macro be inline, like \lstinputlisting{filename}? If you want the latter one just use \lstinputlisting ... – Kurt Feb 25 '13 at 16:17
@Decave see my answer to "how to include data from a .txt". For example, to include text from file doc.tex, use \VerbatimInput{doc.tex}. Also, you may want to comment out (use %) the commandchars and commentchar keys until you understand what they do. – nnunes Feb 25 '13 at 16:23
Sorry everyone, I had to leave work early today. I will test the code on Wednesday when I'm back in the office and have access to my LaTeX file. – user26359 Feb 25 '13 at 23:54
@Kurt Though I will say that my boss suggested \lstlisting ... so you are probably correct. In any case I'll try the code early Wednesday morning and let you guys know how it works out. – user26359 Feb 25 '13 at 23:55

This question is answered in the following link:

http://www.tex.ac.uk/cgi-bin/texfaq2html?label=verbfile

-

You can try the \input command:

\begin{Verbatim}[frame=single]
\input ANOTHER_FILE.tex
\end{Verbatim}

-
Have you tested your code? Witch package defines environment Verbatim? I suppose you will read only \input ANOTHER_FILE.tex instead of reading the content of the file ... – Kurt Feb 25 '13 at 19:13