# Make several pages of source code into 1 column within a twocolumn book format

I have a

\documentclass[11pt, 12pt, oneside, twocolumn, fleqn, leqno]{book}


which was given to us by our professor. My problem is, he want us to put the LaTex Code inside the pdf document that will be passed to him as the output. So I have tried:

\begin{landscape}
\begin{widetext}
\begin{lstlisting}[label=Preface,caption=Latex Code]
Latex code goes here
\end{lstlisting}
\end{widetext}
\end{landscape}


Now I have two problems in this scenario. 1.) I cannot seem to put the excess words of the latex code into a new landscape page and then the other one is 2.) the widetext function doesn't seem to work here.

-

somewhat to my surprise, the \verbatiminput command works inside a figure.

so, provided you can divide up your source code into chunks each of which will fit on one page (portrait mode), you can do something like this, using the full-width figure* environment:

in the preamble: \usepackage{verbatim}

in the main file:

\begin{document

\input{file1}
\input{file2}

\begin{figure*}
\small
\verbatiminput{jobname.tex}
\end{figure*}
\begin{figure*}
\small
\verbatiminput{file1.tex}
\end{figure*}
\begin{figure*}
\small
\verbatiminput{file2.tex}
\end{figure*}

\end{document}


it's something of a hack, but portrait presentation of code looks better to me than landscape. to shorten the main file, you could even pack all the figure* commands into a separate "appendix" file with a short introductory text, and \verbatiminput the appendix file as the last thing.

-

use

\onecolumn
\begin{landscape}
\begin{lstlisting}[label=Preface,caption=Latex Code,
xrightmargin=-...,xleftmargin=-...  %%%% only if needed for more space
]

Latex code goes here

\end{lstlisting}
\end{landscape}

\twocolumn


or do you mean the landscape format into only one column of a two column page?

-