I'm trying to determine the vertical distance between boxes and a line of text in the immediately following paragraph. Depending on the content of the top box I'm getting a discrepancy of \lineskip.
Here's my not so minimal MWE. I put a lot of colored lines in to help illustrate baselines (blue), struts (orange), depths (purple), and distances between lines (black).
\documentclass{article}
\usepackage{xcolor}
%% set `\parskip` to non-trivial value
\setlength{\parskip}{2ex}
%% --- CREATING A STRUT ---
%% strut to equalize line heights of the two boxes designed to be variable
%% if `\aestrutht` is set to `0.7\baselineskip` there's a `\lineskip` discrepency
%% if `\aestrutht` is set to `0.8\baselineskip` there's no apparent discrpency
\newlength{\aestrutht}
\setlength{\aestrutht}{0.7\baselineskip}
\newlength{\aestrutdp}
\setlength{\aestrutdp}{0.3\baselineskip}
%% first rule is to prevent `\color` from screwing things up!
\newcommand{\aestrut}{%%'
\rule{0pt}{0pt}%%'
{%%'
\color{orange}%%'
\rule[-\aestrutdp]{2pt}{\dimexpr\aestrutdp+\aestrutht\relax}%%'
}}
%% --- MAKING THE BASELINES VISIBLE ---
\newcommand{\aeshowbaseline}
{%%'
\bgroup
\color{blue}%%'
\raisebox{0pt}[0pt][0pt]{%%'
\makebox[0pt][l]{%%'
\rule{0.1pt}{\aestrutht}%%'
\rule{2in}{0.1pt}%%'
}%%'
}%%'
\egroup
}
%% --- CREATING BOX FOR TOP MATTER ---
%% placed in a box so I can measure its height and depth
\newsavebox{\aebox}
\newcommand{\aeTopMatter}[1]{%%'
\begin{lrbox}{\aebox}
\begin{minipage}[t]{1in}
\raggedright
\aestrut
\aeshowbaseline #1
%%\par\rule{0pt}{0pt}
\end{minipage}
\end{lrbox}\usebox{\aebox}}%%'
%%---------------------------------------------------------------------------------
%% --- CREATING BOTTOM MATTER ---
\newcommand{\aeBottomMatter}{%%'
\hspace*{0.95in}%%'
\aestrut
\aeshowbaseline
\hspace*{1em}%%'
More text}
%% --- MACRO TO SHOW DEPTH OF TOP BOX ---
\newcommand{\aeShowDepthOfTopMatter}{%%'
\llap{\color{purple}%%'
\rule[-\dp\aebox]{1in}{0.1pt}%%'
\rule[-\dp\aebox]{0.1pt}{\dp\aebox}}}
%% --- MACRO TO SHOW DISTANCE BETWEEN TWO LINES ---
\newcommand{\aeShowDistanceBetweenLines}{%%'
\raisebox{0pt}[0pt][0pt]{%%'
\rule{2pt}{\dimexpr\parskip+\dp\aebox+\lineskip+\aestrutht}}}
\begin{document}
\aeTopMatter{Hello World}\aeShowDepthOfTopMatter
\aeBottomMatter\aeShowDistanceBetweenLines
\vspace{0.25cm}
\aeTopMatter{Hello My World}\aeShowDepthOfTopMatter
\aeBottomMatter\aeShowDistanceBetweenLines
\vspace{0.25cm}
\aeTopMatter{Hello World to this hardy world}\aeShowDepthOfTopMatter
\aeBottomMatter\aeShowDistanceBetweenLines
\end{document}

I know two possible ways of fixing thing:
- I could set the height of
\aestruthta bit bigger - I could uncomment the line
\par\rule{0pt}{0pt}
I don't understand why either of these work. In the case of the first, my difficulty revolves around the fact that, given how the height of my strut is already set, it is well above the height of any content on the line. So it seems to me I shouldn't need any more boost.
What I would appreciate knowing is why these two fixes work and why there's only a \lineskip in the third case but not the first two.
For a while I thought this might be related to measuring \prevdepth such as using
\par\xdef\tpd{\theprevdepth}
But that gets convoluted with the depth of the top box and generally doesn't seem useful.

minipages have thetspecifier, the depth for the box in the third case makes\lineskipto be inserted; in the first two cases this glue isn't inserted since the depth of theminipages is too little. – Gonzalo Medina Aug 04 '13 at 02:22\lineskipalready be part of the calculation for the depth of the box? – A.Ellett Aug 04 '13 at 02:24\lineskipinserted? What are the rules governing when\lineskipis inserted? I thought it always was inserted. – A.Ellett Aug 04 '13 at 02:29\lineskip? – A.Ellett Aug 04 '13 at 02:31tis used for theminipages, only the first line contributes to the height, and all other lines contribute to the depth. – Gonzalo Medina Aug 04 '13 at 02:34