I am using the lineno package to add linenumbers on my twosided document. However, I have a restriction to leave a margin of 2.5cm inner and 4cm outer margin. This has to be completely free space.
But the line numbers of the lineno package are being added into both those margins.
- Can I somehow specify that the linenumbers are added to the document body instead of the margin?
- If not, how do I set the margin of the document so that the correct amount of space is free of content?
I thought about just adding the line number width to the margin, but because the line numbers are always on the left margin on even and odd pages, I would have to alternate this additional margin for my twosided document.
Here is a minimal example:
\documentclass[12pt,twoside,ngerman]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,
tmargin=2.5cm,
bmargin=2.5cm,
lmargin=4cm,
rmargin=2.5cm,
nomarginpar,
showframe}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{lineno}
\usepackage{lipsum}
\renewcommand{\linenumberfont}{\footnotesize}
\begin{document}
\linenumbers
\lipsum
\end{document}
This screenshot illustrates my problem:
The orange line shows how far the 4cm / 2.5cm go, the blue line shows how they should actually be. The line numbers should be further to the right.
Best Answer
Redefine
\makeLineNumber
and give more room to the left margin:The two rules are just 1mm short so that we can see the measurement is accurate. I added a setting for
headheight
and alsoheightrounded
; the first is required byfancyhdr
, the second makes the text height contain an integer number of lines.Top of page 1
Top of page 2