So imagine I get asked this question, perhaps when calling someone: 図書館...何をしている。 Perhaps I am reading a book, so: ［僕は］としょかん...本を読んでいる。 Here is the problem. For "...", I am conflicted on whether to use で or に in each instance and in general. I know that being at a location is に, and doing an action at a location is で, but what of this sentence pattern? Are there specific cases for whether to use one or the other?
You are talking about some action that is taking place in the 図書館, so you have to use で.
There is a subsidiary verb いる used to express progressive "-ing", but it doesn't interfere with this rule.