Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I notice that the second argument to \fontsize and the first argument to \linespread both seem to change the spacing between lines of text. What is the difference between these? Is there one I should favor using?

share|improve this question
    
Just as a general remark: The setspace package is usually considered the best way to influence line spacing. Iirc, some of the reasons are that it doesn't mess up lists (which are in more places than you would expect!) and it leaves the footnotes untouched, which is usually desired. –  doncherry Oct 12 '12 at 4:01
    
There is also the leading package –  cgnieder Dec 18 '12 at 14:03

1 Answer 1

up vote 10 down vote accepted

The argument to \linespread is a real number (not a length), while both arguments to \fontsize are lengths.

\fontsize{<size>}{<baselineskip>} sets the font <size> and <baselineskip>, while \linespread{<factor>} is used as a multiple for the \baselineskip. In fact, the latter is virtually equivalent to

\renewcommand{\baselinestretch}{<factor>}

It's your choice which to use. However, both require a font selection on order to be activated. Read more on this peculiarity in the UK TeX FAQ entry Why doesn’t \linespread work?

In the LaTeX kernel, \fontsize and \linespread is defined as

\DeclareRobustCommand\linespread[1]
   {\set@fontsize{#1}\f@size\f@baselineskip}
\DeclareRobustCommand\fontsize[2]
   {\set@fontsize\baselinestretch{#1}{#2}}

Note that both utilize \set@fontsize{<factor>}{<size>}{<baselineskip>}. The reason for separating the two allows you to use a fix the one while manipulating the other. Once \set@fontsize is called, it creates \size@update that sets \baselineskip as a \baselinestretch multiple of itself and stores this result in \normalbaselineskip for other uses (amongst other things). A call to \selectfont "uses" these settings. For the wild at heart, here's the nitty gritty (with some comments):

\def\set@fontsize#1#2#3{%
    \@defaultunits\@tempdimb#2pt\relax\@nnil
    \edef\f@size{\strip@pt\@tempdimb}% <-- extracts font size
    \@defaultunits\@tempskipa#3pt\relax\@nnil
    \edef\f@baselineskip{\the\@tempskipa}% <-- extracts baseline skip
    \edef\f@linespread{#1}% <-- extracts baseline stretch
    \let\baselinestretch\f@linespread% <-- stores baseline stretch
      \def\size@update{%
        \baselineskip\f@baselineskip\relax% <-- stores baseline skip in \baselineskip
        \baselineskip\f@linespread\baselineskip% <-- multiplies \baselineskip by \baselinestretch
        \normalbaselineskip\baselineskip% <-- stores \normalbaselineskip
        \setbox\strutbox\hbox{%
          \vrule\@height.7\baselineskip
                \@depth.3\baselineskip
                \@width\z@}%
        \let\size@update\relax}%
  }

All these intricacies are meant to be simplified through setspace for consistency.

share|improve this answer
    
It seems that using both of them has a compounding effect; is one used in calculation of the other or something? –  jtbandes Oct 12 '12 at 3:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.