LaTeX forum ⇒ Graphics, Figures & TablesText vertical-align broken

Information and discussion about graphics, figures & tables in LaTeX documents.
Molibdeno
Posts: 12
Joined: Fri Apr 07, 2017 12:15 pm

Text vertical-align broken

Postby Molibdeno » Wed May 11, 2022 12:48 pm

My MWE:

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[full]{textcomp}
\usepackage[greek,italian]{babel}
\usepackage[margin=2cm,top=1cm,headheight=16pt,headsep=0.1in,heightrounded]{geometry}

\usepackage{siunitx}
\sisetup{inter-unit-product = \ensuremath{{}\cdot{}}}


\usepackage{array}
    \newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
    \newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}

\usepackage{caption}
\captionsetup[figure]{justification=centering,labelformat=empty}
    \newcommand{\desc}[1]{\caption{\hspace{0.5cm}#1}}

\begin{document}

\begin{table}[htbp]
  \centering
  \caption{Aggiunte ($\mu$L) della base titolante \textit{n}-butilammina (0.102 M) per i catalizzatori HY e $\text{Al}_2\text{O}_3$.}
  \begin{tabular}{|P{5cm}|P{1.5cm}|P{1.5cm}|P{5cm}|P{1.5cm}|P{1.5cm}|}
    \hline
    \multicolumn{3}{|c|}{\textbf{HY (0.1016 g)}} & \multicolumn{3}{c|}{\textbf{$\text{Al}_2\text{O}_3$ (0.1008 g)}} \\ \hline

    Tempo di attesa (min) & $V$ ($\mu$L) & Viraggio & Tempo di attesa (min) & $V$ ($\mu$L) & Viraggio \\ \hline
    10                    & 250          & no       & 10                    & 20           & no       \\ \hline
    5                     & 200          & no       & 5                     & 20           & no       \\ \hline
    5                     & 150          & no       & 5                     & 10           & no       \\ \hline
    5                     & 150          & no       & 5                     & 5            & si       \\ \hline
    5                     & 100          & no       & 5                     & 5            & -        \\ \hline
    5                     & 50           & si       & 5                     & 5            & -        \\ \hline
    5                     & 25           & -        & -                     & -            & -        \\ \hline
    5                     & 10           & -        & -                     & -            & -        \\ \hline
    \multicolumn{3}{|c|}{Volume titolante totale: 900 $\mu$L} & \multicolumn{3}{c|}{Volume titolante totale: 55 $\mu$L} \\ \hline
    \multicolumn{3}{|c|}{Moli titolante utilizzate: 0.918 \unit{\milli\mol}} & \multicolumn{3}{c|}{Moli titolante utilizzate: 0.0561 \unit{\milli\mol}} \\ \hline
  \end{tabular}
\end{table}

\end{document}


As you can seen, vertical-align text works in some cells and doesn't work in others.

Where is the problem?

Recommended reading 2021:

LaTeXguide.org • LaTeX-Cookbook.net
LaTeX Beginner's Guide LaTeX Cookbook
User avatar
Stefan Kottwitz
Site Admin
Posts: 9882
Joined: Mon Mar 10, 2008 9:44 pm

Text vertical-align broken

Postby Stefan Kottwitz » Sun May 15, 2022 9:44 pm

Hi,

where is it broken? Perhaps it's hard to see.

It also may be a bit misleading, that vertical centering also includes the descender length, so if may look a bit off when a cell doesn't have a letter with a descender, but its baseline has to be aligned with another cell in the same row that has a descender.

Stefan
LaTeX.org admin


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 13 guests