HertieDataScience / SyllabusAndLectures

Hertie School of Governance Introduction to Collaborative Social Science Data Analysis
MIT License
37 stars 60 forks source link

Latex Listings package #56

Closed mcallaghan closed 8 years ago

mcallaghan commented 8 years ago

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.

Thanks!

mcallaghan commented 8 years ago

I got it, sorry.

In case anyone has a similar problem one day, the answer is here

arbritrary linerange markers