7
votes
2answers
80 views

Bottom frame of listing appears on top of the next page

As the title says. I use, among other things, the following in my lstset: framerule=1pt, frame=tblr Some places a page break happens in the middle of my \lstlisting. Fine. But sometimes the whole ...
2
votes
0answers
37 views

penalize page breaks in \lstlistings

I have a document with some rather lengthy \lstlisting's (source code snippets). It looks really bad if there is a page break within a listing/snippet. Thus I tried to avoid page breaks in listings by ...
0
votes
0answers
15 views

How to prevent page breaking for lstinputlistings? [duplicate]

In my pdf created from latex sources I can see that sometimes \lstinputlisting will have a page break in the middle just because it happened to be in the end of the page. I would like to prevent it. ...
5
votes
1answer
59 views

Preventing a code listing of multiple pages to be split to several parts

I have a lstlisting that doesn't fit on one page. It continues correctly on another page but instead of putting the last lines in the beginning of the next page it actually splits into three parts on ...
0
votes
0answers
66 views

How to undo the feasible breakpoints of `lstlisting`?

Is there a way to prohibit pagebreaking at the beginning/end of an lstlisting environment? I'm trying to keep together the following two pairs of lines: the first line of lstlisting and the line ...
3
votes
0answers
149 views

Avoid page break after last line in lstlisting [duplicate]

I have a listing as follows: \lstdefinestyle{yamlCode} { numbers=left, language=Yaml, backgroundcolor={\color{lightgray!40}}, breaklines=true, frame=single, columns=fixed } ...
6
votes
2answers
117 views

Widow Orphan lstlisting

I have a listing of 6 lines. The listing box does not seem to fit on one page (it is on the bottom of the page) so the rest of the box is printed on the next page. There is nothing actually in the box ...
4
votes
1answer
184 views

Captioning an mdframed box without making unbreakable

I would like to a have a caption below my mdframed box (outside the border if possible) which sometimes span across multiple pages. I managed to create a caption several ways but the pagebreaks are ...
1
vote
1answer
172 views

Using lstlistings in two columns

My goal is to display source code (awk, Python, R and SAS) and text (their output) side-by-side. Both are loaded from external files, and can be pretty long sometimes (pagebreaking is inevitable), the ...
9
votes
1answer
168 views

Problems at page boundaries trying to highlight `\lstinline`

I was trying the code given in Colored background in inline listings, which is actually the same than in How to redefine \lstinline to automatically highlight or draw frames around all inline code ...
0
votes
1answer
132 views

Long codes using listing or mcode which do not break into 2 pages

I'm using the mcode package for including my codes into my documents, but the problem is that when my codes are too long, and they need more than one page the program tries to keep them in one page, ...
2
votes
2answers
255 views

Code listing spanning multiple pages with captions at top

Is it possible to span a lstlisting environment or lstlistinginput on multiple pages, such that the caption is repeated on each page (the listing counter stays the same), as well as being able to ...
0
votes
0answers
31 views

How to pagebreak within listings? [duplicate]

I have a quite big txt file, and the problem is, if I include it with listings, latex tries to put it on one page, but it is too big for one page. So a part is missing. I am wondering, if Latex could ...
2
votes
1answer
312 views

Horizontal dashed line on page break in listings environment

Well, the title says it all. I have code scripts that span over multiple pages. Is it possible to display a dashed line at the bottom and/or top of the page in which the listings environment ...
2
votes
2answers
100 views

How to prevent a listing from straddling two pages

If I have a small listing that happens to be at the end of a page, how can I force LaTeX to place it on a new page so that it does not straddle two pages, which looks ugly for a small listing.
0
votes
1answer
109 views

Avoid page break in listing [duplicate]

Possible Duplicate: How can I ensure that a listing is not going to be split? My listing goes at the bottom of a page and fits good. But the header is separated and moved to another page. ...
4
votes
1answer
168 views

place symbol or some command on page break within lstlisting [duplicate]

Whenever I have a page break splitting my lstlisting on different pages, I would like to have a symbol or generally spoken some command inserted automatically. I can accomplish that manually by using ...
5
votes
1answer
273 views

Stop listings going over page breaks

I am using Pandoc to generate Tex from Markdown. It automatically generates listings when it comes across the appropriate Markdown (code indented four spaces). It then uses the listings package to ...
2
votes
1answer
205 views

empty page afterpage listings

I get an emptypage on multi page listings if I use listings with afterpage. \documentclass{scrartcl} \usepackage{listings} \usepackage{afterpage} \begin{document} \afterpage{% %some fancy stuff } ...
8
votes
2answers
216 views

How to show a hint when lstlisting is breaking page?

I use inline lstlisting-blocks with caption. I have several listings that are running over more than one page or starting at the end of a page. Now I want to place a hint for the readers, that the ...
2
votes
1answer
175 views

How can I create a lstlisting environment that spans more than one page?

I am using listings package to show some algorithms in a LaTeX document. One of the algorithms I want to include is longer than one page. So, my question is: How can I create a lstlisting ...
4
votes
1answer
2k views

Avoid page breaks in \lstlistings

I'm trying to avoid page breaks in my lstlisting (seen in section 0.0.2) I know I can remedy this by floating my lstlisting, but it adds some unwanted white space (seen in section 0.0.1). Is ...
4
votes
2answers
1k views

Inserting Code in multiple pages as an appendix

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 ...
2
votes
0answers
215 views

Page break before caption in lstlisting [closed]

I have the following settings for a lstlisting: \lstset{ language=XML, numbers=left, numberstyle=\tiny\color{gray}, stepnumber=1, numbersep=5pt, ...
3
votes
1answer
266 views

keep listing's caption together with listing

I'm using the tips found in here to show a code listing with a caption. Sometimes the caption is put at the end of the page and the listing on the next page. How can I keep them together?
5
votes
1answer
133 views

How to keep last n lines together in listing?

I have a large listing defined with lstlisting (listins-package). Now the listing reaches over three pages. On the last page there is only one line (the last line) of the listing. I looks not very ...
3
votes
1answer
191 views

Headers and footers for listing environment?

What I need to be able to do is apply a header and footer when I use the listings environment. I have a few requirements: The header and footer should be outside the listing itself, i.e. they are ...
0
votes
1answer
219 views

\afterpage issue with \lstlisting

I have issue with \afterpage command and \lstlisting, it's add one blank page after beginning code listing, and after blank page is two of my command. \appendix \section*{APPENDIX A} ...
7
votes
1answer
327 views

How can I prevent lstlisting with shadowbox-style to be split?

I have my listings styled with frame=shadowbox. In some cases the lower or upper border of a listing appears on the previous or next page (see screenshot). I do not wrap the listing in a minipage ...
2
votes
1answer
937 views

Frame on lstlisting opened on the bottom when code longer than one page [duplicate]

In my \lstset I have: \lstset{ language=Java, % the language of the code basicstyle=\sffamily\large, % the size of the fonts that are used for the code %numbers=left, ...
4
votes
2answers
3k views

\lstinputlisting will not continue to next page

So I have this LaTeX snippet: \section{Appendix} \listoffigures ... \begin{center} \begin{figure} \caption{MacroCell with 8 AND Gate Arrays} ...
4
votes
2answers
2k views

How to prevent a \lstinputlisting being split across pages?

This question shows how to prevent a long listing from being split across several pages when the code is written directly into the tex file. I want to achieve the same effect when including code in ...
1
vote
1answer
378 views

Enlarge list of listings

I'm using \cleardoublepage \renewcommand{\lstlistlistingname}{Quellcodeverzeichnis} \enlargethispage{\baselineskip} %EITHER \lstlistoflistings \enlargethispage{\baselineskip} %OR THIS ...
7
votes
1answer
1k views

Get List of Listings in an Appendix [closed]

I am using LyX with the listings package. I want to have Appendix A be titled "Code Listings" and then have the List of Listings. Right now I have \lstlistoflistings in an ERT. By using ...
4
votes
1answer
725 views

How do I prevent LaTeX from putting \sections at the very end of the page?

Please take a look at the screenshot below. I am having a problem where LaTeX would put the \section at the very end of the page. So far I fixed it by using \newpage but I just learned that it was ...
7
votes
2answers
2k views

How can I ensure that a listing is not going to be split?

How can I ensure that a listing is not going to be split? If it is going to be split I want that the entire listing to move to the following page, effectively moving everything at pass. I mean any ...
2
votes
1answer
1k views

LyX: listings over multiple pages [closed]

I am trying to use LyX to insert child document-listing-program. The program imports OK but it is too long to fit on a single page. At the bottom of the page it outputs over the margin, sometimes ...
2
votes
1answer
442 views

Multipages side by side listings

Could you tell me what should I do to be able to insert multipages, side by side listings in Latex document? I have already tried with \begin{minipage}, but it doesn't work with multipages. EDIT: ...
30
votes
4answers
15k views

How to prevent lstlisting from splitting code between pages?

Is it possible to prevent lstlisting from splitting a code between pages if it does not fit on one page? Instead splitting I would like to have the code on the next page. I tried to put all ...
5
votes
2answers
2k views

Listing over two columns - how to page break?

I have a two column article: \documentclass[a4paper, twocolumn]{article} Inside this is a bigger lstlisting which has a float=* to merge the two columns. However this listing needs a page break. ...
10
votes
2answers
2k views

Splitting a float with code listings

Using the floats and listings packages, I have defined a float for code listings and a shortcut for using it as follows: \usepackage{floats} \usepackage{listings} ...