I am making a table, with one column. The table is centered. The column type is centered paragraph.
I am using \downarrow
for annotation between each row to indicate transformation made.
In pdf, everything is centered. But in HTML, the math is centered, but the arrows are not. This happens only when I use column type as centered paragraph. If I use just c
, then the arrows are centered.
But I have to use centered paragraph and not c
for column type, because I am using displayed math in table, which needs paragraph. I am using displayed math because the math is little larger and easier to read.
Here is an example that works same way in PDF and HTML, which using c
. Then below that I show an example which does not work in HTML when I change the column type to centered paragraph
\documentclass[12pt,oneside]{book}
%added nov 23, 2023 to enlarge vertical arrow.
%https://tex.stackexchange.com/questions/213811/how-to-elongate-down-arrow
\newcommand{\xdownarrow}[1]{%
{\left\downarrow\vbox to #1{}\right.\kern-\nulldelimiterspace}
}
\usepackage{amsmath}
\begin{document}
\begin{table}
\centering
\begin{tabular}{c}
$\int \frac{e^{x+e^x} \left(e^x+1\right)}{x+e^x} \, dx$\\
$\Big\downarrow$ \rlap{7258}\\
$\int \frac{e^{x+e^x}}{x+e^x}d\left(x+e^x\right)$\\
$\Big\downarrow$ \rlap{2609}\\
$\operatorname{ExpIntegralEi}\left(x+e^x\right)$
\end{tabular}
\end{table}
\end{document}
Compiling with lualatex gives
Compiling with tex4ht using
make4ht -ulm default -a debug foo.tex "mathjax,htm,nostyle"
Gives
Output is similar. arrows are centered
Now I modified the MWE to using column type centered paragraph so I can use display math
\documentclass[12pt,oneside]{book}
%added nov 23, 2023 to enlarge vertical arrow.
%https://tex.stackexchange.com/questions/213811/how-to-elongate-down-arrow
\newcommand{\xdownarrow}[1]{%
{\left\downarrow\vbox to #1{}\right.\kern-\nulldelimiterspace}
}
\usepackage{array}
%see https://tex.stackexchange.com/questions/12703/how-to-create-fixed-width-table-columns-with-text-raggedright-centered-raggedlef
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\usepackage{amsmath}
\begin{document}
\begin{table}
\centering
\begin{tabular}{C{\textwidth}}
$\displaystyle \int \frac{e^{x+e^x} \left(e^x+1\right)}{x+e^x} \, dx$\\
$\Big\downarrow$ \rlap{7258}\\
$\displaystyle \int \frac{e^{x+e^x}}{x+e^x}d\left(x+e^x\right)$\\
$\Big\downarrow$ \rlap{2609}\\
$\displaystyle \operatorname{ExpIntegralEi}\left(x+e^x\right)$
\end{tabular}
\end{table}
\end{document}
Now lualatex gives
But tex4ht gives using same command as above this:
The arrows for some reason no longer centered as in PDF.
Is there an easy workaround for this?
TL 2023 updated about 2 months ago.
tikz-cd
package? But I don't know how well the output can be converted withtex4ht
.\rlap{7258}
. Since\rlap
is a quite basic command (but not for use in math mode), I would guess that the conversion works well. But I did not test it.