Relationship between strut and baselineskip

The height of the whole \strut is \baselineskip, however it is lowered by 0.3\baselineskip form the baseline. Its depth plus its height totals \baselineskip:

\documentclass{article}
\begin{document}
\newlength{\strutheight}
\newlength{\strutdepth}
\settoheight{\strutheight}{\strut}
\settodepth{\strutdepth}{\strut}
$\the\strutheight+\the\strutdepth=\the\baselineskip$
\end{document}

this prints 8.39996pt + 3.60004pt = 12.0pt.

In TeX, the “height” of a box is not its total height, but the height above the baseline, and the “depth” is the amount that box goes below that baseline. And when you do \settoheight you get only the height of the box, not the total height.

You can draw the \strut and its height and depth to see:

enter image description here

\documentclass{article}
\begin{document}
\fboxsep0pt
\fboxrule0.1pt

\fbox{\strut}
\fbox{\rule{0pt}{0.7\baselineskip}}
\fbox{\rule[-0.3\baselineskip]{0pt}{0.3\baselineskip}}
\end{document}

Well, the definition of \strut is

% latex.ltx, line 594:
\def\strut{\relax\ifmmode\copy\strutbox\else\unhcopy\strutbox\fi}

The code \rule[-0.3\baselineskip]{0pt}{\baselineskip} is a less efficient way to say \unhcopy\strutbox, but amounts to essentially the same. Part of the strut is below the baseline, to cope with characters with descenders like p or y.

The \strutbox is updated whenever a \fontsize command is processed:

% latex.ltx, line 2808:
\def\set@fontsize#1#2#3{%
    \@defaultunits\@tempdimb#2pt\relax\@nnil
    \edef\f@size{\strip@pt\@tempdimb}%
    \@defaultunits\@tempskipa#3pt\relax\@nnil
    \edef\f@baselineskip{\the\@tempskipa}%
    \edef\f@linespread{#1}%
    \let\baselinestretch\f@linespread
      \def\size@update{%
        \baselineskip\f@baselineskip\relax
        \baselineskip\f@linespread\baselineskip
        \normalbaselineskip\baselineskip
        \setbox\strutbox\hbox{%
          \vrule\@height.7\baselineskip
                \@depth.3\baselineskip
                \@width\z@}%
        \let\size@update\relax}%
  }

So the \strutbox is a box containing a zero width rule, with height 70% of the baseline skip and depth 30% of the baseline skip.

You can access the current dimensions as \ht\strutbox and \dp\strutbox:

\documentclass{article}
\begin{document}

\the\ht\strutbox\ (height)

\the\dp\strutbox\ (depth)

\the\dimexpr\ht\strutbox+\dp\strutbox\ (total)

\the\baselineskip\ (baselineskip)

\end{document}

enter image description here