# Redefine \equation for grid typesetting

Please look at the following MWE:

\documentclass[17pt, twocolumn, landscape]{extbook}% \baselineskip=22pt

\newdimen\mathheight
\newdimen\mathdepth

% Redefine \equation for grid typesetting
\makeatletter

\def\equation{$$\refstepcounter{equation}\setbox0\hbox\bgroup\displaystyle\bgroup} \def\endequation{\egroup\egroup% Calculate the value for \vrule \mathheight\ht0 \advance\mathheight.3\baselineskip \divide\mathheight\baselineskip \multiply\mathheight\baselineskip \advance\mathheight.7\baselineskip \mathdepth\dp0 \advance\mathdepth.7\baselineskip \divide\mathdepth\baselineskip \multiply\mathdepth\baselineskip \advance\mathdepth.3\baselineskip \vrule\@height\mathheight\@depth\mathdepth\@width3pt \box0\eqno\strut\hbox\@eqnnum$$\@ignoretrue}

\makeatother

\usepackage{hyperref}

\lineskip=0pt
\topskip=37.4pt% for split equations

\begin{document}

\abovedisplayskip=22pt
\belowdisplayskip=22pt
\abovedisplayshortskip=22pt
\belowdisplayshortskip=22pt
\parskip=\baselineskip
\jot=22pt

Let's look at a high equation. We must add a \string\strut\ at the end of the line.\strut
$$\label{first} \int \frac1{\sqrt{1-x^2}} dx = \arcsin x + c$$
\strut Here we must place a \string\strut\ again.
If we don't set the \string\strut's the grid typesetting is lost.
Look here:
$$\label{second} \int \frac1{\sqrt{1-x^2}} dx = \arcsin x + c$$
Really ugly...

\newpage\bfseries

Let's look at the second column to verify if the typesetting is grid-oriented.
No problem for equation (\ref{first}).
The \string\strut's and the \string\vrule work together perfectly.
Even the equation number is sitting on the baseline.

Around equation (\ref{second}) we can see that the typesetting
is not grid-oriented. It only works when we insert the \string\strut's\ manually.

The result is really ugly!!

\end{document}


I try to find a solution for grid typesetting for huge equations. My idea is based on boxing the equation and then calculating values for a '\vrule'. But my solution only works when I isert '\strut's around the equations.

Is there a way to do this automaticly?

you did almost all the work with your MWE! Just finalize it inserting the \struts in your redefinition:

\documentclass[17pt, twocolumn, landscape]{extbook}% \baselineskip=22pt

\newdimen\mathheight
\newdimen\mathdepth

% Redefine \equation for grid typesetting
\makeatletter

\def\equation{\strut$$\refstepcounter{equation}\setbox0\hbox\bgroup\displaystyle\bgroup} \def\endequation{\egroup\egroup% Calculate the value for \vrule \mathheight\ht0 \advance\mathheight.3\baselineskip \divide\mathheight\baselineskip \multiply\mathheight\baselineskip \advance\mathheight.7\baselineskip \mathdepth\dp0 \advance\mathdepth.7\baselineskip \divide\mathdepth\baselineskip \multiply\mathdepth\baselineskip \advance\mathdepth.3\baselineskip \vrule\@height\mathheight\@depth\mathdepth\@width3pt \box0\eqno\strut\hbox\@eqnnum$$\@ignoretrue\strut}

\makeatother

\usepackage{hyperref}

\lineskip=0pt
\topskip=37.4pt% for split equations

\begin{document}

\abovedisplayskip=22pt
\belowdisplayskip=22pt
\abovedisplayshortskip=22pt
\belowdisplayshortskip=22pt
\parskip=\baselineskip
\jot=22pt

Let's look at a high equation. We must add a \string\strut\ at the end of the line.%\strut
$$\label{first} \int \frac1{\sqrt{1-x^2}} dx = \arcsin x + c$$
%\strut
Here we must place a \string\strut\ again.
If we don't set the \string\strut's the grid typesetting is lost.
Look here:
$$\label{second} \int \frac1{\sqrt{1-x^2}} dx = \arcsin x + c$$
Really ugly...? No more!

\newpage\bfseries

Let's look at the second column to verify if the typesetting is grid-oriented.
No problem for equation (\ref{first}).
The \string\strut's and the \string\vrule work together perfectly.
Even the equation number is sitting on the baseline.

Around equation (\ref{second}) we can see that the typesetting
is not grid-oriented. It only works when we insert the \string\strut's\ manually.

The result is really ugly!! Oh what? Maybe not so ugly anymore. Now as the struts are inserted automatically. And we need one more line.

\end{document}