当有许多 \multicolumn 和 \multirow 部分时,表格组织

当有许多 \multicolumn 和 \multirow 部分时,表格组织

我正在重新创建一个使用许多合并单元格 (excel) 的表格,但实际上,这是一个令人反感的创作,违反了大多数(如果不是全部)表格格式规则。有人能建议这种分组单元格方法的替代布局吗?

在此处输入图片描述

\begin{table}[htbp]\footnotesize
  \centering
  \caption{Add caption}
    \begin{tabular}{cccrrr}
    \toprule
    \multirow{6}[1]{*}{\begin{sideways}40\% of index\end{sideways}} & \multirow{6}[1]{*}{\begin{sideways}\textbf{Exposure Index}\end{sideways}} 
          &       30\%  & \multicolumn{3}{l}{Surface temperature} \\
          &       & 10\%  & \multicolumn{3}{l}{Access to Green Space} \\
          &       & 10\%  & \multicolumn{3}{l}{Tree Canopy Shading} \\
          &       & 18\%  & \multicolumn{3}{l}{Dwellings in high rises (>5 storeys)} \\
          &       & 18\%  & \multicolumn{3}{l}{Rented dwellings in older high-rises (after 1986)} \\
          &       & 15\%  & \multicolumn{3}{l}{Population density} \\
    \cmidrule{1-6}
    \multirow{24}[3]{*}{\begin{sideways}60\% of index\end{sideways}} & \multirow{24}[3]{*}{\begin{sideways}\textbf{Sensitivity Index}\end{sideways}} & 25\%  & \multicolumn{3}{l}{Low income persons (2005, after tax LICO)} \\
          &       & 5\%   & \multicolumn{3}{l}{Low income persons among children (aged 0-5)} \\
          &       & 5\%   & \multicolumn{3}{l}{Renter Household Spending >=50\% of income on housing} \\
          &       & 5\%   & \multicolumn{3}{l}{Low-income renters spending >=50\% of income on housing} \\
          &       & 10\%  & \multicolumn{3}{l}{Persons not speaking English} \\
          &       & 5\%   & \multicolumn{3}{l}{Recent immigrants (2001-2006)} \\
          &       & 5\%   & \multicolumn{3}{l}{No high school certificate among adults (aged 25+)} \\
          &       & 5\%   & \multicolumn{3}{l}{Racialized groups} \\
          &       & 10\%  & \multicolumn{3}{l}{Disability among persons age 25-64} \\
          &       & 5\%   & \multicolumn{3}{l}{Emergency visits 2004-2008 for circulatory disease (age standardized rate)} \\
          &       & 5\%   & \multicolumn{3}{l}{Emergency visits 2004-2008 for respiratory disease (age standardized rate)} \\
    \cmidrule{3-6}
          &       & \multirow{13}[1]{*}{15\%} & \multicolumn{1}{c}{\multirow{13}[1]{*}{\begin{sideways}\textbf{Senior Sensitivity Index}\end{sideways}}} & \multicolumn{1}{c}{10\%} & Frail seniors (age 75+ with a disability) among total population in private households \\
          &       &       & \multicolumn{1}{c}{} & \multicolumn{1}{c}{10\%} & Low income (2005, after tax LICO) and living alone among seniors (age 65+) \\
          &       &       & \multicolumn{1}{c}{} & \multicolumn{1}{c}{20\%} & Low income among seniors \\
          &       &       & \multicolumn{1}{c}{} & \multicolumn{1}{c}{10\%} & Low income among seniors living alone \\
          &       &       & \multicolumn{1}{c}{} & \multicolumn{1}{c}{5\%} & Senior families paying >= 30\% on housing \\
          &       &       & \multicolumn{1}{c}{} & \multicolumn{1}{c}{5\%} & Unattached seniors paying >= 30\% on housing \\
          &       &       & \multicolumn{1}{c}{} & \multicolumn{1}{c}{10\%} & Seniors not speaking English \\
          &       &       & \multicolumn{1}{c}{} & \multicolumn{1}{c}{5\%} & Recent immigrants (1996-2006) among seniors \\
          &       &       & \multicolumn{1}{c}{} & \multicolumn{1}{c}{5\%} & No high school certificate among seniors \\
          &       &       & \multicolumn{1}{c}{} & \multicolumn{1}{c}{5\%} & Seniors in racialized groups \\
          &       &       & \multicolumn{1}{c}{} & \multicolumn{1}{c}{5\%} & Unattached seniors with disability \\
          &       &       & \multicolumn{1}{c}{} & \multicolumn{1}{c}{5\%} & Disability among persons age 65-74 \\
          &       &       & \multicolumn{1}{c}{} & \multicolumn{1}{c}{5\%} & Emergency visits 2004/05 among persons age 65-74 \\
    \bottomrule
    \end{tabular}%
  \label{tab:addlabel}%
\end{table}%

答案1

笔记:

  • 行距和
  • 规则的选择可以更加美观。
  • \,在百分比和百分号之间添加了 。
  • >= 00被转换为$ \le 00 $(和类似)
  • 您可能想要用于$ \le 00 $您所写的情况00+

我会朝这个方向进一步努力。

代码

\documentclass{article}
\usepackage{array,booktabs,tabularx}
\begin{document}\noindent%
\footnotesize%
    \begin{tabularx}{\linewidth}{r@{ }r@{ }r@{ }X}
                40\,\% &        &        & Exposure Index                                                              \\ \midrule
                       & 30\,\% &        & Surface temperature                                                         \\
                       & 10\,\% &        & Access to Green Space                                                       \\
                       & 10\,\% &        & Tree Canopy Shading                                                         \\
                       & 18\,\% &        & Dwellings in high rises ($ > 5$ storeys)                                    \\
                       & 18\,\% &        & Rented dwellings in older high-rises (after 1986)                           \\
                       & 15\,\% &        & Population density                                                          \\ \addlinespace
                60\,\% &        &        & Sensitivity Index                                                           \\ \midrule
                       &  5\,\% &        & Low income persons among children (aged 0--5)                               \\
                       &  5\,\% &        & Renter Household Spending $\ge 50\,\%$ of income on housing                 \\
                       &  5\,\% &        & Low-income renters spending $\ge 50\,\%$ of income on housing               \\
                       & 10\,\% &        & Persons not speaking English                                                \\
                       &  5\,\% &        & Recent immigrants (2001--2006)                                              \\
                       &  5\,\% &        & No high school certificate among adults (aged 25+)                          \\
                       &  5\,\% &        & Racialized groups                                                           \\
                       & 10\,\% &        & Disability among persons age 25--64                                         \\
                       &  5\,\% &        & Emergency visits 2004--2008 for circulatory disease (age standardized rate) \\
                       &  5\,\% &        & Emergency visits 2004--2008 for respiratory disease (age standardized rate) \\
                       & 15\,\% &        & Senior Sensitivity Index                                                    \\
        \cmidrule{2-4} &        & 10\,\% & Low income (2005, after tax LICO) and living alone among seniors ($ > 65$)  \\
                       &        & 20\,\% & Low income among seniors                                                    \\
                       &        & 10\,\% & Low income among seniors living alone                                       \\
                       &        &  5\,\% & Senior families paying $\ge 30\,\%$ on housing                              \\
                       &        &  5\,\% & Unattached seniors paying $\ge 30\,\%$ on housing                           \\
                       &        & 10\,\% & Seniors not speaking English                                                \\
                       &        &  5\,\% & Recent immigrants (1996--2006) among seniors                                \\
                       &        &  5\,\% & No high school certificate among seniors                                    \\
                       &        &  5\,\% & Seniors in racialized groups                                                \\
                       &        &  5\,\% & Unattached seniors with disability                                          \\
                       &        &  5\,\% & Disability among persons age 65--74                                         \\
                       &        &  5\,\% & Emergency visits 2004/05 among persons age 65--74                           \\
    \end{tabularx}%
\end{document}

输出

在此处输入图片描述


或者更微妙。另请参阅修订版 2

代码

\documentclass{article}
\usepackage{array,booktabs,tabularx,collcell}
\def\s{\hspace*{.75em}}
\begin{document}\noindent%
\footnotesize%
    \begin{tabularx}{\linewidth}{r*2{@{\s}>{\collectcell\llap}r<{\endcollectcell}}X}
        \toprule
        40\,\% &        &        & Exposure Index                                                              \\ \midrule
               & 30\,\% &        & Surface temperature                                                         \\
               & 10\,\% &        & Access to Green Space                                                       \\
               & 10\,\% &        & Tree Canopy Shading                                                         \\
               & 18\,\% &        & Dwellings in high rises ($ > 5$ storeys)                                    \\
               & 18\,\% &        & Rented dwellings in older high-rises (after 1986)                           \\
               & 15\,\% &        & Population density                                                          \\ \toprule
        60\,\% &        &        & Sensitivity Index                                                           \\ \midrule
               &  5\,\% &        & Low income persons among children (aged 0--5)                               \\
               &  5\,\% &        & Renter Household Spending $\ge 50\,\%$ of income on housing                 \\
               &  5\,\% &        & Low-income renters spending $\ge 50\,\%$ of income on housing               \\
               & 10\,\% &        & Persons not speaking English                                                \\
               &  5\,\% &        & Recent immigrants (2001--2006)                                              \\
               &  5\,\% &        & No high school certificate among adults ($ \ge 25$)                         \\
               &  5\,\% &        & Racialized groups                                                           \\
               & 10\,\% &        & Disability among persons age 25--64                                         \\
               &  5\,\% &        & Emergency visits 2004--2008 for circulatory disease (age standardized rate) \\
               &  5\,\% &        & Emergency visits 2004--2008 for respiratory disease (age standardized rate) \\
               & 15\,\% &        & Senior Sensitivity Index                                                    \\ \midrule
               &        & 10\,\% & Low income (2005, after tax LICO) and living alone among seniors ($ > 65$)  \\
               &        & 20\,\% & Low income among seniors                                                    \\
               &        & 10\,\% & Low income among seniors living alone                                       \\
               &        &  5\,\% & Senior families paying $\ge 30\,\%$ on housing                              \\
               &        &  5\,\% & Unattached seniors paying $\ge 30\,\%$ on housing                           \\
               &        & 10\,\% & Seniors not speaking English                                                \\
               &        &  5\,\% & Recent immigrants (1996--2006) among seniors                                \\
               &        &  5\,\% & No high school certificate among seniors                                    \\
               &        &  5\,\% & Seniors in racialized groups                                                \\
               &        &  5\,\% & Unattached seniors with disability                                          \\
               &        &  5\,\% & Disability among persons age 65--74                                         \\
               &        &  5\,\% & Emergency visits 2004/05 among persons age 65--74                           \\ \bottomrule
    \end{tabularx}%
\end{document}

输出

在此处输入图片描述

相关内容