Is anybody familiar with the latex listings package?
For another project I run code in stata and put bits of it into separate log files.
I then use these to automatically include stata code and output using tex in a pdf file like this
\lstinputlisting{file.log}
The problem is, the log file includes some stuff at the beginning and the end which I don't want to include. I can use the linerange option to miss out the first 7 lines which describe the log file. I'd like to also remove the last line which is usually
cap log close
I can do this if I know how many lines the file has with [linerange=8-26]. It'd be nice, though, if I could somehow say [linerange=8-penultimate line], so that the option works for all of my log files, without me having to look it up manually and introduce the risk of losing something if the files change.
Anybody have any ideas how to do this? Would be super helpful.
Is anybody familiar with the latex listings package?
For another project I run code in stata and put bits of it into separate log files.
I then use these to automatically include stata code and output using tex in a pdf file like this
The problem is, the log file includes some stuff at the beginning and the end which I don't want to include. I can use the linerange option to miss out the first 7 lines which describe the log file. I'd like to also remove the last line which is usually
I can do this if I know how many lines the file has with [linerange=8-26]. It'd be nice, though, if I could somehow say [linerange=8-penultimate line], so that the option works for all of my log files, without me having to look it up manually and introduce the risk of losing something if the files change.
Anybody have any ideas how to do this? Would be super helpful.
Thanks!