I use LaTeX listings
package with \lstinputlisting
to display text from an external file. The file contains a data format description with a blank line at the end. The package ignores the blank line. How can I show the blank line in a listing?
What it displays:
1 lorem ipsum...
2 more lorem ipsum
3 lorem lorem ipsum
What I want:
1 lorem ipsum
2 more lorem ipsum
3 lorem lorem ipsum
4
See the documentation, section 4.4
`showlines=(true|false) or showlines (default = false)
If true, the package prints empty lines at the end of listings. Otherwise these lines are dropped (but they count for line numbering).
Try adding this before your listing:
\lstset{
showlines=true
}
You can escape to LaTeX from within listings by assigning an escape character like so:
\lstset{numbers=left, stepnumber=1, frame=none,basicstyle = \ttfamily}
\begin{lstlisting}[escapechar=\%]
codeline1
codeline2
%
\end{lstlisting}
Comes out as:
1 codeline1
2 codeline2
3
I know it's not \lstinputlisting
but hopefully it'll help you anyway.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With