\documentclass[12pt]{amsart}
\usepackage{amssymb}
\usepackage{latexsym}
\usepackage{array}
\usepackage{caption}

\title{The trap for \LaTeX\ convertors}
\author{Sergej V. Znamenskij}
\begin {document}
\maketitle

This file contains absolutely legal and ordinary
mathematical constructions in \LaTeX\ text to facilitate visual
detection of image alignment algorithm flaws in \LaTeX\ to HTML conversion.

\section {Line alignment problem}
The problem comes with the large height and (or) depth formulae. 
Usually such a formula as $x_s^{\int\limits_a^{N^1}\, dx}$ for example has
larger height than depth. As a corollary, the convertor may add improper large gap (vskip) before the next
line. The case of equal height and width $\left(x_s^{\int\limits_a^{N^1}\, dx}\right)$ is more controlable, 
as far as we do not try to get images scaled together with text changing.
The most rare and difficult situation is a formula with a large depth, but a very small height: 
$y=1-\dfrac{\alpha}{1-\dfrac{2}{3-\dfrac{4}{5-x}}}$.

\section {Inline alignment problems}All dots in the line are to be exactly aligned for any browser and selected text size.

.$.\sum\limits^n1.$.$.\prod\limits_n2.$.$.\dfrac{\alpha\otimes\mu}{\gamma}.$.$.1.$.$.\dfrac {\rightharpoonup}{A\otimes B}.$.

The simple conversion algorithm can fail due to the following reasons:
\begin {itemize} 
\item HTML lacks opportunity to reproduce \LaTeX\ layout directly;
\item Some kind of HTML markup has different visual representation in different browser versions;  
\item Usable image conversion libraries and tools do not care reference point position in the image while cropping;
\item \LaTeX\ box dimensions (width, height and depth) \textbf{usually differs} from its visual width, height, or depth. 
\end {itemize}

Test of Figure environment:
\begin{figure}
\[ a = \int \exp{x} \,\mathrm{d}x \]
\end{figure}

Test using eqnarray:
\begin{eqnarray}
a_1 &=& -2 r \cos( 2 \pi f_c T_s ) \\
a_2 &=& r^2,
\end{eqnarray}

Test using eqnarray*:
\begin{eqnarray*}
b_0 &=& (1 - r^2) / 2 \\
b_1 &=& 0 \\
b_2 &=& -b_0,
\end{eqnarray*}

test of lefteqn with eqnarray :
\begin{eqnarray}
  \lefteqn{%
    123456789|123456789|123456789|123456789|123456789|123456789|123456789|
  }
  \\&=&
  123456789|123456789|
\end{eqnarray}
test of lefteqn eqnarray* :
\begin{eqnarray*}
  \lefteqn{%
    123456789|123456789|123456789|123456789|123456789|123456789|123456789|
  }
  \\&=&
  123456789|123456789|
\end{eqnarray*}

First as an equation:
\begin{equation}
\tilde{y}(x,t) = C^{+} e^{j (\omega t - k x)} + C^{-} e^{j (\omega t + k x)},
\label{eq:yxt}
\end{equation}
Then using displaymath:
\begin{displaymath}
  \tilde{y}(x,t) = C^{+} e^{j (\omega t - k x)} + C^{-} e^{j (\omega t + k x)},
\end{displaymath}
followed by more text.

% Then compare the PDF and HTML results with the attention on:
%
% 1) spaces between footnote marks and the text following them
%
% 2) clickability of the reference from Section 1 to Table in Section 2
%
% 3) some illegal HTML tags generated inside Table (near DIV class="CENTER").

\section{Footnote quirks}

Usually there is a space between the footnote mark and the subsequent text.
But if the text just after a footnote mark starts from the next line,
the space can be lost.

Here we should have a space after footnote
mark.\footnote{This is note1} This text follows footnote 1.

Here we intentionally should have no space between the footnote
mark and the dot\footnote{This is note2}. This text follows footnote 2.

Here we should have a space after footnote
mark.\footnote{This is note3}
But the stock latex2html-2022 removes it.

{Here we should not have a space after the
switch to large text with a newline.\large
Large text.}

{Here we should not have a space after the
switch to large text with a space.\large Large text.}

{Here we should have a new paragraph after the
switch to large text with two newlines.\large

Large text.}

{Here we should not have a space after the
switch to large text with a newlines and a space.\large
 Large text.}

Now see Table \ref{tablecap} in the next section. Try to press this hyperlink.
This can fail because stock latex2html-2022 sometimes loses labels
defined inside floating table environments.

\newpage

\section{Table quirks}

Here the stock latex2html-2022 can put an illegal HTML tag
into the generated table near DIV class=CENTER.

\begin{table}
\begin{centering}
\begin{tabular}{|>{\centering}m{6em}|c|>{\centering}m{4em}|c|}
  \hline 
  heading 1 & heading 2 & heading 3 & heading 4\\
  \hline 
  cell 1 & cell 2 & cell 3 & cell 4\\
  \hline 
\end{tabular}
\par\end{centering}
\caption{\label{tablecap}This was our test table}
\end{table}




\end {document}
