Take the 2-minute tour ×
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.

I saw that several documentation packages use the environment to show macrocode long codes with page break, the example implementation of the package geometry. How do I do this? I wanted to show a code along with page break.

share|improve this question

1 Answer 1

The listings package provides this by default if you don't allow the code to float. Here's a little example:

enter image description here

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{listings}% http://ctan.org/pkg/listings
\begin{document}
\lipsum[2]\lipsum[2]\lipsum[2]\lipsum[2]\lipsum[2]\lipsum[2]
\begin{lstlisting}
for i:=maxint to 0 do
begin
{ do nothing }
end;
Write(’Case insensitive ’);
WritE(’Pascal keywords.’);
\end{lstlisting}
\end{document}
share|improve this answer
    
\usepackage{minted} \begin[linenos]{minted} bla bla bla \end{minted} –  Regis da Silva Oct 2 '12 at 5:51

Your Answer

 
discard

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.