# \includeonlylecture does not account for earlier section structures

torsten_wagner created an issue

`\includeonlylecture{` effectively truncates the section mechanism at the start of a new document (lecture) and makes it fail. It does not take care that a higher level section might be placed in an earlier, but not included lecture. In my opinion this is a bug, as otherwise it renders `\includeonlylecture` rather useless.

E.g. take a two different lectures

```lecture1: contains \section{FOO}
lecture2: contains \subection{FOO over BAR}
```
```Compiling the entire document: -> ok
using \includeonlylecture{lecture1}: ->  ok
using \includeonlylecture{lecture2}: -> fails
```

in the last case, the section number is wrong, since the final document never saw the definition of `\section{FOO}`. As I understood it, we would need to parse all possible lectures first and extract section headers and number them (first run?), after that, we would need to check which lectures are requested and add all necessary higher sections just in front of the first starting lecture as well as set the section counter to the correct values to get numbering and sections finally right. Thus for the first example the final tex document would need to look like

```\section{FOO}
\include{lecture2}
```

In my case several lectures can share a single section and subsections, sometimes a single lecture is only a subsection of a much larger parent section. A section number to lecture relation might look like this

```    lecture 1
1.1. lecture 2
1.2. lecture 3
1.3-1.5 lecture 4
1.6 lecture 5
1.7-1.8 and 2 lecture 6
....
```

Would be glad if this could be fixed in some way, since it really troubles me. Thanks a lot for looking into it