Wed Nov 22 08:45:13 2023, original submission:
reference and screen shot at
https://tex.stackexchange.com/questions/701975/downarrow-is-not-centered-in-table-when-using-tex4ht-with-column-type-centered
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$ 7258\\
$\int \frac{e^{x+e^x}}{x+e^x}d\left(x+e^x\right)$\\
$\Big\downarrow$ 2609\\
$\operatorname{ExpIntegralEi}\left(x+e^x\right)$
\end{tabular}
\end{table}
\end{document}
-----------------------
Compiling with lualatex and with tex4ht using
make4ht -ulm default -a debug foo.tex "mathjax,htm,nostyle"
Output is similar. good. arrows are centered as well as table and math.
enter image description here
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$ 7258\\
$\displaystyle \int \frac{e^{x+e^x}}{x+e^x}d\left(x+e^x\right)$\\
$\Big\downarrow$ 2609\\
$\displaystyle \operatorname{ExpIntegralEi}\left(x+e^x\right)$
\end{tabular}
\end{table}
\end{document}
---------------------------
Now lualatex gives
enter image description here
But tex4ht gives using same command as above this:
enter image description here
The arrows for some reason no longer are centered like in PDF.
Is there an easy workaround for this?
TL 2023 updated about 2 months ago.
|