1

I tried to insert some data using listings package labels(lstset) into pdf which was successful but if the same data is put into a text file ans lstinput it as follows is not successful .Can some one please make the following non-working example work.

\documentclass{report}
\usepackage{listings}

\lstset{basicstyle=\footnotesize\ttfamily,breaklines=true}
\lstset{framextopmargin=50pt,frame=bottomline}


\begin{document}

\begin{lstlisting}

\lstinputlisting{C:/Temp/test.txt}


\end{lstlisting}


\end{document}

OUTPUT:

\lstinputlisting{C:/Temp/test.txt}


Also the contents in test.txt IS AS FOLLOWS

include

main() {

print "HELLO"; }

  • You should make the example be an example of the problem not an example that works. If you are getting \lstinputlisting{C:/Temp/test.txt} in the output you must have put that command in the wrong place, where it is being read as text not as a command, such as inside a listings or verbatim. But you leave us to guess... – David Carlisle Aug 28 '15 at 9:50
  • \lstinputlisting{C:/Temp/test.txt} should not be inside a lstlisting environment: it replace the whole thing. – egreg Aug 28 '15 at 9:52
  • I have now edited the post and put the non-working code in it – user80596 Aug 28 '15 at 9:57
1

The \lstinputlisting instruction replaces a lstlisting environment. With your input, you are asking not to interpret \lstinputlisting.

\documentclass{report}
\usepackage{listings}

\lstset{basicstyle=\footnotesize\ttfamily,breaklines=true}
\lstset{framextopmargin=50pt,frame=bottomline}


\begin{document}

\lstinputlisting{C:/Temp/test.txt}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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