〜は(対比)・〜には・〜では
As for…, … (contrast); compound particles には・ではmachine translation
FormationNoun + は (contrast); particles に・で・へ・から・まで + は (が・を are replaced by は)
Beyond the topic-marking role you learned at N5, は also has a CONTRASTIVE function: placing two clauses side by side to compare them. The classic sentence has two は: 肉は食べますが、魚は食べません (meat I eat, but fish I don't). Each は plants a "contrast flag" on the noun before it. That's why in negative sentences, Japanese speakers very often add は to imply "not this one (though others might be fine)."
When the noun being contrasted normally takes another particle, は STACKS on top of that particle: に+は→には, で+は→では, へ+は→へは, から+は→からは. The original particle keeps its meaning, and は adds the topic/contrast nuance: 東京には行きましたが、大阪には行きませんでした. Only が and を don't stack — は replaces them outright (魚を食べません → 魚は食べません).
The two combinations には・では appear so densely that they're worth memorizing: この町には大きい公園があります (making the location the topic of an existence sentence), 図書館では食べてはいけません (making the place where the action happens the topic of a rule). When you meet a sentence with には・では, just split it into two layers — the original particle for meaning, は for structure — and you can read it right away.
Examples
肉は食べますが、魚は食べません。
Meat I eat, but fish I don't.
東京には行きましたが、大阪には行きませんでした。
I've been to Tokyo, but not to Osaka.
図書館では食べ物を食べてはいけません。
In the library, you must not eat food.