多行多列表

发布于 2024-11-11 17:24:06 字数 691 浏览 4 评论 0原文

我需要在 LaTeX 中创建下表,但我似乎无法正确完成它。

Image

单元格内的文本未正确居中,“眼睛运动”单元格也是如此。你们有人能看出我做错了什么吗?

\begin{tabular}{ccc|c}
& & \multicolumn{2}{c}{\textbf{Response}} \\ 
& & unnatural & natural \\ \cline{3-4}
\multicolumn{1}{c}{\multirow{2}{*}{\begin{sideways}\textbf{Eye movement}\end{sideways}}} &
\multicolumn{1}{c|}{\begin{sideways}unnatural\end{sideways}} & 1 & \multicolumn{1}{c|}{2} \\ \cline{2-4}
\multicolumn{1}{c}{}                        &
\multicolumn{1}{c|}{\begin{sideways}natural\end{sideways}} & 3 & \multicolumn{1}{c|}{4}   \\ \cline{3-4}
\end{tabular}

I need to create the following table in LaTeX and I just cannot seem to get it right.

Image

The text inside the cells is not centered correctly and the same goes for the "Eye movements" cell. Could any of you see what I doing wrong?

\begin{tabular}{ccc|c}
& & \multicolumn{2}{c}{\textbf{Response}} \\ 
& & unnatural & natural \\ \cline{3-4}
\multicolumn{1}{c}{\multirow{2}{*}{\begin{sideways}\textbf{Eye movement}\end{sideways}}} &
\multicolumn{1}{c|}{\begin{sideways}unnatural\end{sideways}} & 1 & \multicolumn{1}{c|}{2} \\ \cline{2-4}
\multicolumn{1}{c}{}                        &
\multicolumn{1}{c|}{\begin{sideways}natural\end{sideways}} & 3 & \multicolumn{1}{c|}{4}   \\ \cline{3-4}
\end{tabular}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

笔落惊风雨 2024-11-18 17:24:06

谢谢指点。我终于用下面的代码让它工作了:

\begin{table}[h]\centering
\def \BoxWidth {3.5cm}
\def \BoxHeight {2cm}
\def \SWidth {0.2cm}
\newcolumntype{M}{>{\centering\arraybackslash}m{\BoxWidth}}
\newcolumntype{S}{>{\centering\arraybackslash}m{\SWidth}}
\newcolumntype{R}{>{\raggedright\arraybackslash}m{\BoxWidth}}
\begin{tabular}{SSM|M}
~ & ~ & \multicolumn{2}{c}{\textbf{Response}} \\ 
~ & ~ & unnatural & natural  \\  \cline{3-4}
\multirow{2}{*}{\begin{sideways}{\textbf{Eye Movements}}\end{sideways}} 
~ & \begin{sideways}\parbox{\BoxHeight}{\centering unnatural}\end{sideways} 
&  \multicolumn{1}{|R|}{Command-based interfaces} &  \multicolumn{1}{R|}{Not Possible} \\ \cline{2-4}
~ & \begin{sideways}\parbox{\BoxHeight}{\centering natural}\end{sideways} 
& \multicolumn{1}{|R|}{Non-command interfaces} &  \multicolumn{1}{R|}{Virtual environments} \\  \cline{3-4}
\end{tabular}
\end{table}

Thanks for the pointer. I finally made it work with the following code:

\begin{table}[h]\centering
\def \BoxWidth {3.5cm}
\def \BoxHeight {2cm}
\def \SWidth {0.2cm}
\newcolumntype{M}{>{\centering\arraybackslash}m{\BoxWidth}}
\newcolumntype{S}{>{\centering\arraybackslash}m{\SWidth}}
\newcolumntype{R}{>{\raggedright\arraybackslash}m{\BoxWidth}}
\begin{tabular}{SSM|M}
~ & ~ & \multicolumn{2}{c}{\textbf{Response}} \\ 
~ & ~ & unnatural & natural  \\  \cline{3-4}
\multirow{2}{*}{\begin{sideways}{\textbf{Eye Movements}}\end{sideways}} 
~ & \begin{sideways}\parbox{\BoxHeight}{\centering unnatural}\end{sideways} 
&  \multicolumn{1}{|R|}{Command-based interfaces} &  \multicolumn{1}{R|}{Not Possible} \\ \cline{2-4}
~ & \begin{sideways}\parbox{\BoxHeight}{\centering natural}\end{sideways} 
& \multicolumn{1}{|R|}{Non-command interfaces} &  \multicolumn{1}{R|}{Virtual environments} \\  \cline{3-4}
\end{tabular}
\end{table}
一影成城 2024-11-18 17:24:06

关于 LaTeX 的 Wikibooks 文档非常好,您应该仔细阅读 不同表格格式的众多示例中的一些。其中一些只需要稍微修改即可重现您的图像。

The Wikibooks documentation on LaTeX is very good, and you should take a look through some of the numerous examples for different table formats. Some of them only need to be modified slightly to reproduce your image.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文