6

I am trying to insert a script (bash shell code) to the appendix of my document. I am trying to import the script from separate file. The script file name is Event_Db_BckUp_Script.als. The problem is that the code is very long and it requires to be split into multiple pages. When I use the following code, it is only shown in single page and cut the rest of the code. How can I display the whole script in multiple pages?

Here is what I am doing right now:

\begin{Listing}[H] 
\filein{Event_Db_BckUp_Script.als} 
\caption{IDSaaS initialization Script} 
\label{list:Idsaas_Script} 
\end{Listing}
0

2 Answers 2

6

I would prefer the listings package. I've made several documents, also with very long listings with it and it worked fine. You can also include files without copying them to your TeX-Code.

A minimal example would look like this, for more options please consult the documentation of the package.:

\documentclass{article}
\usepackage{listings}
\begin{document}
\lstinputlisting[language=bash]{script.als}
\end{document}
0
3

When using listings, the default is to allow breaking of code across page boundaries (source code taken from Selection Sort in C):

enter image description here

\documentclass{article}
\usepackage{listings}% http://ctan.org/pkg/listings
% Just for this example, reduce the page height...
\usepackage[paperheight=10\baselineskip]{geometry}% http://ctan.org/pkg/geometry
\begin{document}
\lstinputlisting[language=C,caption={Selection Sort in C},label=selection-sort]{selection_sort.c}
\end{document}​

However, boxing occurs when adding the float key since a float requires collecting the contents to float, which imposes a single-page restriction. This does not seem to be needed in your case, since it seems like you're using a newly defined environment Listing with the [H] float specifier (provided by float).

Referencing is done by use the label key-value, which would allow referencing the listing number. If the label is not required nor the number, you can use the title key-value.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .