TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

\caption{IDSaaS initialization Script} 
share|improve this question
up vote 3 down vote accepted

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.:

share|improve this answer
That works, Thank you, – Turki Sep 18 '12 at 16:59

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

\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
\lstinputlisting[language=C,caption={Selection Sort in C},label=selection-sort]{selection_sort.c}

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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