Skip to content

lstlisting behaviour at new page #44

@isoAdvector

Description

@isoAdvector

lstlisting's can span across several pages in very ugly ways:
Image

One solution could be to enclose lstlistings in a minipage:

\noindent\begin{minipage}{\linewidth}
\begin{lstlisting}[numbers=none, language=C++, caption=my caption, label=code:Eqn]
solve
(
  fvm::ddt(rho,Phi)
  + fvm::div(phi, Phi)
  - fvm::laplacian(Gamma, Phi)
 ==
  Sphi
);
\end{lstlisting}
\end{minipage}

Result:

Image

I suggest adding minipage around the lstlisting in the tex templates here.

Note the \noindent which is needed to ensure alignement with the text margins.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions