Exact line spacing is the key
If you practice in a jurisdiction that requires court filings with line numbers, you’ve faced the vexing problem of keeping the line numbers vertically aligned with the text. Looking at court opinions, even judges are often defeated by this formatting task.
For example, California state courts require filings to use double line spacing (which works out to 28 lines per page), 12-point type, and line numbers in the left margin. I’ll use this as a basic model and you can adapt it to the rules in your jurisdiction.