I have a listing as follows:
\begin{lstlisting}[basicstyle=\scriptsize]
...
\end{lstlisting}
The listing is quite long (71 lines + caption), and I want it to fit on a single page. However, I currently get 70 lines on one page and the last line and caption appear on the next page. Is it possible to slightly change the font size in order to make the listing fit on one page? So I need some custom size that is slightly smaller than scriptsize. Tiny is too small. Or is there another way to make the listing fit on a single page?
\fontsize{<size>}{<baselineskip>}\selectfontto use another size. See thefntguidefor more information. But do you really think that anyone would like to read a listing with such a small font size? Personally I'm usually not able to do so without headache and runny eyes. – cabohah Jun 17 '23 at 18:51\baselineskipa bit, or\enlargethispage{2.5\baselineskip}, which would avoid changing the actual font size. But how this is done does depend on the document class. A small compilable example, beginning with\documentclassand ending with\end{document}would give potential helpers something to experiment with. – barbara beeton Jun 17 '23 at 18:55enlargethispageactually solved the problem already. Thanks! – bys1 Jun 17 '23 at 18:58