LyXcode list exceeds page dimension

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
asterix45
Posts: 2
Joined: Fri Apr 29, 2011 5:13 pm

code list exceeds page dimension

Post by asterix45 »

Hi all,

I'm using lyx for my documents and I have to insert some code.

So I've used the floating Algorithm object, added the code list inside, and wrote my code on the code list.

Generating the pdf document I can see the code that exceeds the dimension of the page but, instead of going on a new page it's cut at the page end.

I've used formatting tools like page break, page end, new page and so on but without any changes.

Can anyone help me?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Re: code list exceeds page dimension

Post by kaiserkarl13 »

Floats cannot break across a page, so you'll have to include it in a non-floating environment. This is similar to the problem with tables---the supertabular package defines a non-floating environment so the table can break across pages.

I recommend the verbatim package, which includes the \verbatiminput command. This includes an entire file, as if within \begin{verbatim}...\end{verbatim}, and allows the resulting text to break across pages.

If you really want it to float, you have three options: (1) make the font smaller so more lines fit on one page, (2) remove blank lines and/or concatenate several lines together, sacrificing vertical space for horizontal space, and (3) write shorter code. ;-)
asterix45
Posts: 2
Joined: Fri Apr 29, 2011 5:13 pm

Re: code list exceeds page dimension

Post by asterix45 »

Hi kaiserkarl13, thank you for your reply!

I've searched in te web without success. I'll try with verbatim and i'll make you know if it works!

(I can't use a smaller code because my thesis is all about this :D )
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

code list exceeds page dimension

Post by kaiserkarl13 »

Here's how I included code in my dissertation:

Code: Select all

\usepackage{verbatim}
.
.
.
\let\verbinput\verbatiminput
\newenvironment{verbquote}{
  \list{}{
    \listparindent 0pt%
    \leftmargin    \parindent%
    \itemindent    \listparindent%
    \rightmargin   \leftmargin
  }%
  \small
  \item[]%
}
{\endlist}

\renewcommand{\verbatiminput}[1]{%
  \begin{verbquote}
    \verbinput{#1}
  \end{verbquote}
}
.
.
.
\section{scriptname}
This script does everything blah blah blah.
\verbatiminput{$HOME/bin/scriptname}
Post Reply