John Culleton wrote:
> 
> Kate Evans-Jones wrote:
> >
> > Hi all,
> >
> > I want to include program code into my document as a program float.
> > However, the code is more than 1 page long and does not break across the
> > pages. I am using the code below to include them into a program float:
> >
> > \usepackage{float, times, verbatim, moreverb}
> >
> > \floatstyle{ruled}
> > \newfloat{Program} {htp}{lop}[chapter]
> > \newcommand{\Code}[3] {\begin{Program} %
> > \small \verbatiminputinput[1]{1}{#1} %
> > \caption{#2} \normalsize \label{#3} %
> >  \end{Program}}
> > 
> Simplest solution: Complete the document in Lyx and export LaTeX code.
> Insert these few statements in the output using a simple text editor
> (VI, Notepad, whatever.) Then process as a regular LaTeX file. (latex
> foo.tex; dvips foo.dvi; print or view foo.ps.) If you can deal with your
> document completely within Lyx that is of course desirable, but when
> that proves difficult there are other paths that combine Lyx and other
> facilities already on your system.

a better way is using new package listing. you are able to write
program-code over more than 1 page, captions, frames, line-numbering,
and so on.

it's available at ctan.

as an example for my java-listings:
in latex preamble:

\usepackage[breaklines]{listings}% the package listings
\renewcommand\lstlistingname{Algorithmus}% caption-title
%\renewcommand\lstlistingname{\textbf{Algorithmus}}
\renewcommand\lstlistlistingname{Algorithmenverzeichnis}% list of
listings title
\renewcommand\thelstlisting{\thesection .\arabic{lstlisting}}%
numbering-format
%\renewcommand\thelstlisting{\textbf{\thechapter .\arabic{lstlisting}}}
\newcommand{\lst}[2]{%
    \noindent\rule[-1ex]{\columnwidth}{0.3mm}\vspace{-1ex}
   
\lstinputlisting[caption={#2},label={#1},stringspaces=false,frame={tb},lineskip=-1pt,extendedchars=true,%
   
basicstyle=\tt\footnotesize,labelstep=1,labelstyle=\tiny,indent=2em,language=Java,breaklines]{#1}
    \vspace{1ex}%
}

in text:

\lst{hello.java}{My first Javaprogram}% filename and caption-title

with \ref{hello.java} a cross-reference is possible, because every
listing has a label. \lstlistoflistings gives a table of the
listings.

Herbert

-- 
[EMAIL PROTECTED]
http://perce.de/voss/lyx/

Reply via email to