2

I am required to change the default value of \baselineskip for a document I am writing, and I have been given a specific value (13pt). To do so, I have tried the following code based on the documentation at Overleaf:

\documentclass[a4paper,10pt]{article}
\usepackage{lipsum}

\setlength{\baselineskip}{13pt}
\begin{document}
\lipsum[1-3]
\end{document}

However I do not have the impression this is having any impact. I have tried setting higher values such as 30pt or 50pt but to no avail as nothing changes in the compiled PDF. I understand this parameter sets the default interline spacing so changing its value should be having an effect straight away.

What is wrong with my code, and how can I set the value of \baselineskip?

1
  • 3
    The docu is wrong. \begin{document} executes \normalsize (other places do that too) and that resets \baselineskip again. For a proper solution you must redefine \normalsize. Commented Apr 1 at 18:02

2 Answers 2

6

What is wrong with my code?

You need to issue the instruction

\setlength{\baselineskip}{13pt}

after, not before, \begin{document}.

6
  • Thank you. Would there be a "neat" way to set this outside the document scope? I find it cleaner to keep all my settings in a separate settings.tex file, having one-off settings in the main source code increases the changes you forget some setting after some time... But I guess I am asking for magic, e.g. I could define a command and execute it inside document - but I would still have that command in the document scope. At least I would define it in my settings file and be aware I might be changing the default baselineskip when I review settings.tex I guess... Commented Apr 1 at 18:09
  • 2
    @DaneelOlivaw - How about issuing the instruction \AtBeginDocument{\setlength{\baselineskip}{13pt}} inside your file settings.tex -- which, you say, will called via \input settings in the preamble of your document, right? (Alternatively, feel free to modify the command \normalsize.)
    – Mico
    Commented Apr 1 at 18:10
  • 1
    Yes that is a most elegant solution - I now recall that AtBeginDocument{} command, seen it in some answers around but never really wondered what it does. Cheers! Commented Apr 1 at 18:13
  • @DaneelOlivaw Maybe elegant, but not fully correct, unfortunately.
    – egreg
    Commented Apr 1 at 20:14
  • 1
    @Mico a priori I am not using minipage environments in my document, if I do it would be as a “hack” for something else. I might use captions as well as theorem and proof environments from amsthm though. Commented Apr 2 at 6:38
4

Changing \baselineskip at begin document is not enough, because every \normalsize declaration would change it back, for instance in a minipage.

\documentclass{article}

\begin{document}

\setlength{\baselineskip}{13pt}

The baseline skip is \texttt{\the\baselineskip}

\bigskip

\begin{minipage}{5cm}
The baseline skip is \texttt{\the\baselineskip}
\end{minipage}

\end{document}

enter image description here

Here's how you can achieve your goal instead.

\documentclass{article}

\linespread{1.08333} % approximatively 13/12

\begin{document}

The baseline skip is \texttt{\the\baselineskip}

\bigskip

\begin{minipage}{5cm}
The baseline skip is \texttt{\the\baselineskip}
\end{minipage}

\end{document}

enter image description here

It's not exactly 13pt, but the difference is 4 scaled points, that is, about 0.00002145 millimeters (or 21.45 nanometers). The wavelength of violet light is about 380 nanometers.

The alternative is redefining all font size changing commands to reflect the choice of the standard baseline skip.

2
  • Thank you, this is good to know. A priori I am not using minipage environments in my document, if I do it would be as a “hack” for something else. I might use captions as well as theorem and proof environments from amsthm though. Commented Apr 2 at 6:38
  • @DaneelOlivaw Captions would suffer the same problem
    – egreg
    Commented Apr 2 at 8:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .