michal-h21 / make4ht

Build system for tex4ht
131 stars 15 forks source link

tabular environment broken when used with b option. Table with is not respected and vertical centering in cells #114

Open cjohn001 opened 1 year ago

cjohn001 commented 1 year ago

I try to create an html from the following table. I am currently trying to get vertical alignment of text in table cells working and set a fixed table width of 100% or some other fixed value. However, I seem to be not able to get a single table package working for that. If I am using >{\centering\arraybackslash}p{0.19\linewidth} -> hence p attribute rather than b, than the total table width is correct. Even so the relative column widths seem to be igrnored. However, for the b attribute (which I need for my setup) even the total table width is not working.

\begin{table}[H]
    \small\centering
    \begin{tabular}{|>{\centering\arraybackslash}b{0.19\linewidth}|>{\raggedright\arraybackslash}b{0.36\linewidth}|>{\raggedright\arraybackslash}b{0.36\linewidth}|}
        \hline
        \multicolumn{1}{|c|}{\textbf{Nutrient}} & \multicolumn{1}{c|}{\textbf{Function}}                 & \multicolumn{1}{c|}{\textbf{Nutrient Source}}                                                                                           \\ \hline
        Vitamin B1                              & precursor for enzymes that help break down blood sugar & yeast, pork, cereal grains, sunflower seeds, brown rice, whole grain rye, asparagus, kale, cauliflower, potatoes, oranges, liver,  eggs \\ \hline
        Vitamin B2                              & supports body cell development and food metabolization & asparagus, bananas, persimmons, okra, chard, cottage cheese, milk, yogurt, meat, eggs, fish, green beans                                \\ \hline
    \end{tabular}
\end{table}

In pdf this results in the following table:

Bildschirm­foto 2023-03-09 um 18 14 36
michal-h21 commented 8 months ago

I know this question is old. You should get the correct vertical alignment for b columns now:

image

cjohn001 commented 8 months ago

Great!, thanks a lot!