Can a cannon's screen be sitting right next to it, or does it need to be further along the line?
These answers restate the rules implemented by our open-source engine, which follows the WXF laws and is regression-tested against the official 110-diagram repetition casebook. Where an answer refers to a specific position, that position lives on the linked reference page, where the build verifies it against the engine before publishing.
Direct answer
Yes, distance does not matter. The screen only has to be the first piece encountered along the cannon's line, whether that is one point away or eight. A cannon with a piece sitting directly beside it can capture the first enemy piece beyond that neighbour exactly as validly as a cannon whose screen sits in the middle of an otherwise empty file.
What actually matters
Only two things decide a cannon's capture: exactly one piece between it and the target, and nothing else in the way beyond that. Where along the line the screen happens to sit, close to the cannon, close to the target, or somewhere in between, changes nothing about whether the capture is legal.
Where this comes up in practice
Cannons placed right behind their own soldier or advisor, using the piece immediately in front of them as an instant screen, are a normal and strong setup precisely because the adjacency causes no penalty. It is one of the simplest ways to get a cannon threatening something on the very first move it is needed.
Related questions
Does the target also need to be a fixed distance from the screen?
No, the target is simply the first enemy piece beyond the screen, wherever that happens to be along the line.
Is a cannon weaker when its screen is close rather than far away?
No, its capturing power is identical either way; only the number of screens, exactly one, decides whether it can capture at all.