表格中的文本对齐问题

表格中的文本对齐问题

我已经使用 Tables Generator 创建了一个表,并设法编辑生成的代码以获得我想要的内容,但在阅读了此处发布的几个问题后,我仍然遇到一些似乎无法解决的问题。这是一个示例代码。

\documentclass{article}
\usepackage{multirow}
\begin{document}


\begin{table}
    \caption{\textbf{CAPTION}}
    \centering
    %\includegraphics[width = \textwidth]{tables_main/Table3.png}
\begin{tabular}{p{0.3\linewidth}  p{0.1\linewidth}  p{0.1\linewidth}  p{0.1\linewidth} p{0.1\linewidth} | p{0.1\linewidth} p{0.1\linewidth}}
 \hline
\textbf{\begin{tabular}{p{1\linewidth}@{}l@{}}Should be aligned left,then a blank line\\      \\       should be aligned left (\%)\end{tabular}} &
\begin{tabular}{p{1\linewidth}@{}l@{}} should be aligned on top   \end{tabular} &
\begin{tabular}{p{1\linewidth}@{}l@{}} should be aligned on top    \end{tabular} &
\begin{tabular}{p{1\linewidth}@{}l@{}} should be aligned on top    \end{tabular} &
\begin{tabular}{p{1\linewidth}@{}l@{}} should be aligned on top   \end{tabular} &
\begin{tabular}{p{1\linewidth}@{}l@{}}Also top \end{tabular} &
\begin{tabular}{p{1\linewidth}@{}l@{}}Also top  \end{tabular}   \\

All good here &
  {\begin{tabular}[c]{@{}c@{}}0.07 \\      (0.3\%)\end{tabular}} &
  {\begin{tabular}[c]{@{}c@{}}0.11\\      (0.5\%)\end{tabular}} &
  {\begin{tabular}[c]{@{}c@{}}0.19\\     center align\end{tabular}} &
  {\begin{tabular}[c]{@{}c@{}}0.37\\      (1.8\%)\end{tabular}} &
  {\begin{tabular}[c]{@{}c@{}}0.9\\      (0.4-1.5)\end{tabular}} &
  {\begin{tabular}[c]{@{}c@{}}0.3 \\      (0.04-0.6)\end{tabular}} \\

All good here &
  {\begin{tabular}[c]{@{}c@{}}0.95 \\      (29.8\%)\end{tabular}} &
  {\begin{tabular}[c]{@{}c@{}}1.2\\      (27.1\%)\end{tabular}} &
  {\begin{tabular}[c]{@{}c@{}}1.9\\      (25.9\%)\end{tabular}} &
  {\begin{tabular}[c]{@{}c@{}}2.6\\      (21.7\%)\end{tabular}} &
  {} &
  {} \\

All good here &
  {\begin{tabular}[c]{@{}c@{}}1.4\\      (35.4\%)\end{tabular}} &
  {\begin{tabular}[c]{@{}c@{}}1.9\\      (32.8\%)\end{tabular}} &
  {\begin{tabular}[c]{@{}c@{}}2.7\\      (30.4\%)\end{tabular}} &
  {\begin{tabular}[c]{@{}c@{}}4.3\\      (27.8\%)\end{tabular}} &
  {\multirow{-2}{*}{\begin{tabular}[c]{@{}c@{}}3.8\\      (2.5-7.1)\end{tabular}}} &
  {\multirow{-2}{*}{\begin{tabular}[c]{@{}c@{}}2.4\\      (1.6-3.9)\end{tabular}}} \\ \hline
    \label{tab:t4}
\end{tabular}

\end{table}

\end{document}

我想解决的三个问题如下:

  1. 左上角单元格中的文本应左对齐 - 与其下方的单元格相同
  2. 整个顶行的文本应对齐顶部 - 与左上角单元格相同
  3. 这些数字似乎没有居中对齐。

相关内容