垂直对齐表格中的多行单元格

垂直对齐表格中的多行单元格

以下代码(pastebin - 大块难以阅读的文本,在适当的文本编辑器中打开并禁用自动换行以使其正确显示)产生以下图像:

结果表

我的问题看似简单,但是我在网上找到的解决方案似乎不起作用:如何使前两列的文本垂直对齐到中间?

答案1

您不会希望“可扩展性”悬在空白处的某个地方。在所有表格中,空白单元格意味着重复上述值。

您还应该避免使用垂直规则,因为这会妨碍而不是简化可读性。

这是以旋转方式实现的表格(但这并不是真正必要的,您可以决定是否以减小中间列的大小为代价将其置于边距中心)。

\documentclass[]{article}

\usepackage{booktabs,array,rotating}

\newcommand{\splitcell}[1]{%
  \begin{tabular}{@{}l@{}}#1\end{tabular}%
}

\begin{document}

\begin{sidewaystable}
\caption{The ATAM Attribute Utility Tree}

\medskip

\begin{tabular}{ @{} l l >{\raggedright\arraybackslash}p{9.5cm} @{} }
\toprule
\bfseries\splitcell{Quality \\ Attribute}
  & \bfseries\splitcell{Attribute \\ Refinement}
  & \bfseries Scenarios \\
\midrule
Reliability
  & Fatal error recovery
  & Mechanisms must be in place to ensure any error that occurs is handled without
    causing the application to crash.
\\\addlinespace
  & Reliable Simulation
  & Calculate physics simulation results in a reliable manner.
\\
\midrule
Scalability
  & Scale with world size and complexity
  & Physical world size and complexity will have an impact on graphics hardware performance. 
    The resource requirements must scale linearly with the complexity of the graphical assets 
    on screen.
\\\addlinespace
  & Scale with vehicle complexity
  & System performance will be affected by the increase in vehicle complexity. The resources 
    requirements must scale in proportion to the complexity size.
\\\addlinespace
  & Scale with multiplayer size
  & On the multiplayer server side, the amount of concurrent connections into the 
    server is going to impact performance. Servers must have a known budget and resources 
    requirements must be known for concurrent connection sizes.
\\
\midrule
Performance
  & Consistent performance
  & Maintain framerate as simulation complexity grows.
\\
\midrule
Maintainability
  & Core isolation
  & Update core physics engine without affecting other parts
\\\addlinespace
  & Pluggable rendering engine
  & Different rendering engines (Direct3D, OpenGL, Mantle etc.)\ should be used 
    depending on architecture and user requirements.
\\
\midrule
Flexibility
  & Simulation Flexibility
  & Simulate various types of vehicles such as cars, boats and aircraft with same
    simulation engine.
\\\addlinespace
  & Scriptable Interface to Simulation
  & Read vehicle configurations and simulation parameters in from human readable files.
\\
\midrule
Configurability
  & System Settings
  & Capacity for various translations (and possible future translations) must be
    available in the architecture.
\\\addlinespace
  & Scenario Settings
  & Adjustable scenario parameters such as weather conditions, time of day, terrain
    conditions and various triggerable events must be accessible from the interface.
\\
\midrule
Internationalisation
  & Local Translation
  & System settings such as audio, graphics and interface must be settable from the
    interface and changes must be persistent.
\\\addlinespace
  & Unit Translations
  & Units must be displayable in various formats such as imperial and ISO.
\\
\bottomrule
\end{tabular}
\end{sidewaystable}

\end{document}

注意,各个块之间用 分隔\midrule,同一块内的不同项目用 分隔\addlinespace

在此处输入图片描述

相关内容