9

My university's masters thesis template which I have to follow, limits the maximum number lines per page to 25 lines.

I used setspace package which is available in the revision of my question but it didn't help me. Also, I used the lines option of the geometry package as proposed in the answers but it does not set the line spacing. Instead it omits the content after the specified line number and consequently, the rest of the page will be remained. Here is the second code I used with geometry option.

\documentclass[a4paper,11pt,twoside,openany]{book} 
\usepackage{lipsum}
\RequirePackage[top=35mm, outer=35mm, inner=25mm, lines=22]{geometry}
\begin{document}
\lipsum[1-10]
\end{document}
enthu
  • 3,795

3 Answers3

7

Use lines option in geometry package. The following is taken from its documentation on page 16.

enter image description here

If you don't know how to display the documentation, type texdoc geometry on your terminal (Linux) or DOS prompt (MS Windows).

  • It doesn't work when I define margins? \RequirePackage[top=35mm, bottom=25mm, outer=35mm, inner=25mm, lines=22]{geometry} – enthu Oct 11 '14 at 17:36
  • I am using bidi xelatex package. – enthu Oct 11 '14 at 17:37
  • 5
    @EnthusiasticStudent - Note that the excerpted examples in this answer specify the options top (or tmargin) and lines but not the bottom margin as well. (If top and bottom are both specified, lines is calculated directly, and any lines option is irrelevant.) – Mico Oct 11 '14 at 17:57
  • I tried this. The lines code does not change the vertical space between the lines. Instead it omits the lines after #22 and the remaining space is white. For instance, half of the page will be white! – enthu Oct 11 '14 at 20:08
  • @EnthusiasticStudent: It is better if you add your current code to the bottom of your question so anybody here can use it to reproduce your problem. – kiss my armpit Oct 11 '14 at 20:23
  • @InPSTrickswetrust I edited my question. – enthu Oct 11 '14 at 20:30
  • @EnthusiasticStudent When using @InPSTricksWeTrust's answer, keep the \usepackage{setspace} and \doublespacing commands in the preamble, and then put the \usepackage[top=35mm, bottom=25mm, outer=35mm, inner=25mm, lines=22]{geometry} afterward. – Trold Oct 11 '14 at 21:16
  • @Trold it still does not fill the page. There should be a way to fill the page automatically. – enthu Oct 11 '14 at 21:18
  • @Trold The problem with your advice is that, the space of 22 lines is allocated by tex, when you adjust the line spacing by your advice to for example \linespread{5}, only five lines appear on the page and the remaining space is still empty. I mean, it fills the 22 lines space (half of the page) with only 4 or five lines regarding that spacing code. – enthu Oct 11 '14 at 21:23
  • But \doublespacing uses \setstretch, which cooperates with the geometry package alright, rather than \linespread, which doesn't? I know the problem you're describing, but I don't see it when I compile the document PSTRicks, I and CFR have suggested. – Trold Oct 11 '14 at 22:19
5

First, let us see how to show the edges of the margins (showframe option), the numbers of lines (with lineno package and \linenumbers command) and \the\textheightof the MWE:

\documentclass[11pt,a4paper,twoside,openany]{book}
\usepackage[lmargin=25mm,rmargin=35mm,tmargin=35mm, bmargin=35mm,showframe]{geometry}
\usepackage{lineno}
\usepackage{lipsum}
\begin{document}
\linenumbers
THE TEXT HEIGHT: \the\textheight\\

\lipsum[1-10]
\end{document}

MWE

There are 47 lines in roughly 646pt with the desired margins. The goal is obtain 22 lines without change the text height. Right?

Solution 1. Use the \setstretch{2.2} (need the setspace package)

\documentclass[11pt,a4paper,twoside,openany]{book}
\usepackage[lmargin=25mm,rmargin=35mm,tmargin=35mm, bmargin=35mm,showframe]{geometry}

\usepackage{setspace}
\setstretch{2.2}

\usepackage{lineno}
\usepackage{lipsum}
\begin{document}
\linenumbers
THE TEXT HEIGHT: \the\textheight\\ 

\lipsum[1-10]
\end{document}

Solution 2: set \baselineskip at 29pt in the body of the document

\documentclass[11pt,a4paper,twoside,openany]{book}
\usepackage[lmargin=25mm,rmargin=35mm,tmargin=35mm, bmargin=35mm,showframe]{geometry}

\usepackage{lineno}
\usepackage{lipsum}

\begin{document}

\baselineskip=29pt % not in the preamble

\linenumbers
THE TEXT HEIGHT: \the\textheight\\ %646pt

\lipsum[1-10]
\end{document}

Solution 3: fix \linespread to 2.2 in the preamble

\documentclass[11pt,a4paper,twoside,openany]{book}
\usepackage[lmargin=25mm,rmargin=35mm,tmargin=35mm, bmargin=35mm,showframe]{geometry}
\linespread{2.2}

\usepackage{lineno}
\usepackage{lipsum}
\begin{document}
\linenumbers
THE TEXT HEIGHT: \the\textheight\\ 

\lipsum[1-10]
\end{document}

In solution 1,2 and 3: the ouput is the same:

MWE1

Solution 4. Use the grid package with the options lines and baseline. Only useful if you are a fan of the grid format and the package limitations are not a problem in your document.

\documentclass[11pt,a4paper,twoside,openany]{book}
\usepackage[lmargin=25mm,rmargin=35mm,tmargin=35mm, bmargin=35mm,showframe]{geometry}
\usepackage[baseline=29.35pt,lines=22]{grid}

\usepackage{lineno}
\usepackage{lipsum}
\begin{document}
\linenumbers
THE TEXT HEIGHT: \the\textheight\\ 

\lipsum[1-10]
\end{document}

MWE2

Fran
  • 80,769
4

You can do this with setspace and geometry but you must use the spacing command before loading geometry. This still has a rather large margin at the bottom so it is probably best to allow geometry to figure the top and bottom margin and just specify a ratio if you do it this way:

\documentclass[a4paper,11pt,twoside,openany]{book}
\usepackage{setspace}
  \doublespacing
\RequirePackage[vmarginratio=1:2, outer=35mm, inner=25mm, lines=22]{geometry}
\usepackage{lipsum}
\begin{document}
  \lipsum[1-10]
\end{document}

22 lines

stdpage apparently lets you specify a standard number of lines per page and will space them out. However, unless you want your thesis to look as if typed on a typewriter, this is probably not a good option.

cfr
  • 198,882