# using grid to set lines at the same baseline on opposing pages

There is this question about fixing headings in KOMA to the line grid and this one going for (as far as I understand) something similar for the whole document in XeTeX.

Is there a possibility to force TeX to add the vertical glue in portions to yield lines at opposite pages sitting on the same baseline -- as proposed for example by Bringhurst? In my documents the problem is that I usually have a lot of floats and equations which (themself + cpation) have a variable height and thus yield an unsymmetric page layout at the bottom (see MWE). Using \flushbottom will maybe give the desired bahvior at the page bottom but not in its center and may lead to increadibly large vertical spaces in some occasions.

As a side question: Is the requested behavior even desired in TeX?

What I have done so far:

There is this contribution where it seems possible using the grid package (or actually not using the grid package but I started with that ). I tried using grid and was quite successful in a document with only text and equations. Things became complicated when I added fancy stuff like images and headings. I then tried to get things "in line" adapting the before/after spacings and the corresponding allowed amounts of glue of headings and other elements. For the headings, the new length based on the normalsize baselineskip improved the results. But so far there is always at least one combination where lines do not fit on the same baseline. Furthermore, I had to allow larger float fractions. Otherwise, the large figure just sits at its own page. Before adding the grid package this did not happen. IN the current configuration, quite a large amount of white space is usually added below the figure caption.

\documentclass[a4paper,twoside]{scrbook}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[american]{babel}        % US english language and hyphenation settings
\usepackage{amsmath, amsthm, amsfonts, amssymb}
\usepackage{blindtext}

\usepackage[fontsize=11pt,baseline=13pt,lines=48]{grid}

\usepackage{graphicx}
\usepackage{color}

\renewcommand{\topfraction}{.85} % maximum space a top-placed figure can occupy
\renewcommand{\bottomfraction}{.7} % maximum space a bottom-placed figure can occupy
\renewcommand{\textfraction}{.15} % minimum amount of text needed on a page with figures
\renewcommand{\floatpagefraction}{.75} % minimum amount of space a figures need to occupy to be put onto a separate page

% ********************************************************************
% Font Stuff
% ********************************************************************
% rm: Palatino
\usepackage[osf,sc]{mathpazo}

% font for chapter numbers
\DeclareFixedFont{\chapterNumber}{U}{eur}{b}{n}{60} % euler, proper call

% micro-typography stuff
\usepackage[tracking=true]{microtype}

% only one space behind full stops
\frenchspacing

% ********************************************************************
% commands for title formatting, etc.
% ********************************************************************
\usepackage{textcase} % for \MakeTextUppercase

\microtypesetup{expansion=false}%
\DeclareRobustCommand{\spacedallcaps}[1]{\textls[160]{\MakeTextUppercase{#1}}}%
\DeclareRobustCommand{\spacedlowsmallcaps}[1]{\textls[80]{\scshape\MakeTextLowercase{#1}}}%

% ********************************************************************
% ********************************************************************
\usepackage{scrlayer-scrpage}
\renewcommand{\chapterpagestyle}{empty}
\renewcommand{\chaptermark}[1]{\markboth{\spacedlowsmallcaps{#1}}{\spacedlowsmallcaps{#1}}}
\renewcommand{\sectionmark}[1]{\markright{\upshape\thesection\enspace\spacedlowsmallcaps{#1}}}

% ********************************************************************
% format of chapter-, section-, etc headings
% ********************************************************************
\definecolor{halfgray}{gray}{0.55} % chapter numbers will be semi transparent .5 .55 .6 .0

\newcommand\titlerule[1][1pt]{\rule{\textwidth}{#1}}
% Bringhurst style chapter number
% setting the line
\makeatletter
\renewcommand\chapterlinesformat[3]{%
%   \titlerule\par\nobreak%
\@hangfrom{#2}{#3}%
\color{halfgray}\par\nobreak\titlerule%
}
\makeatother
% setting the number
\renewcommand*{\chapterformat}{%
\rlap{\makebox[\linewidth][r]{} % makes the 'empty' box for the title, this pushes the number into the margin
}

\newlength{\nsbls}
\setlength{\nsbls}{\baselineskip}
\RedeclareSectionCommand[
beforeskip=3\nsbls plus 0.5\nsbls minus 0.5\nsbls,
afterskip=1.9\nsbls plus 0.5\nsbls minus 0.5\nsbls,
font=\mdseries\scshape\lsstyle\LARGE]{chapter}
\RedeclareSectionCommand[
beforeskip=2\nsbls plus 0.5\nsbls minus 0.5\nsbls,
afterskip=1\nsbls plus 0.1\nsbls,
font=\mdseries\scshape\lsstyle\Large]{section}
\RedeclareSectionCommand[
beforeskip=1\nsbls plus 0.5\nsbls minus 0.5\nsbls,
afterskip=1\nsbls plus 0.1\nsbls,
font=\mdseries\itshape\large]{subsection}

% ********************************************************************
% captions
% ********************************************************************
\usepackage[font=small]{caption}

% ********************************************************************
% skip tweaks
% ********************************************************************
% equation skips before and after
\AtBeginDocument{%
\abovedisplayskip     =1.5\baselineskip plus 0.5\baselineskip minus 0.5\baselineskip
\belowdisplayskip     =1.5\baselineskip plus 0.5\baselineskip minus 0.5\baselineskip
\abovedisplayshortskip=1.0\baselineskip plus 0.5\baselineskip minus 0.5\baselineskip
\belowdisplayshortskip=1.0\baselineskip plus 0.5\baselineskip minus 0.5\baselineskip
}
% float skip lengths
\setlength{\textfloatsep}{3\nsbls plus 1\nsbls minus 1\nsbls}
\setlength{\floatsep}{2\nsbls plus 1\nsbls minus 1\nsbls}

% ********************************************************************
% document
% ********************************************************************
\begin{document}

\chapter{chapter}
\blindtext[1]
\section{section}
\blindtext[1]
\begin{gridenv}
$$\phi = \int_\Omega f d\Omega$$
\end{gridenv}
\blindtext[3]
\begin{gridenv}
$$\phi = \frac{\pi}{2}\int\limits_{-\infty}^\infty f d\xi$$
\end{gridenv}
\blindtext[1]
%
\begin{figure}
\includegraphics[width=1\textwidth]{example-image}
\caption{\blindtext[1]}
\end{figure}
%

\section{section}
\subsection{subsection}
\blindtext[3]
\begin{gridenv}
$$\phi = \int_\Omega f d\Omega$$
\end{gridenv}
\blindtext[1]

\section{section}
\blindtext[1]
\begin{gridenv}
$$\phi = \frac{3}{2}a^2$$
\end{gridenv}
\blindtext[3]
\blindtext[3]
\end{document}