![如何绘制此表](https://linux22.com/image/375121/%E5%A6%82%E4%BD%95%E7%BB%98%E5%88%B6%E6%AD%A4%E8%A1%A8.png)
\documentclass{article}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage[table]{xcolor}
\usepackage{tabularx, multirow, makecell, rotating} %
\usepackage{enumitem}
\begin{document}
\begin{center}
\begin{tabular}{ | l | l | p{5cm} |}
\hline
\rowcolor{blue!30} \rothead{Cell 1} & \rowcolor{blue!30} \rothead{Cell 2} & \rowcolor{blue!30} Summary \\ \hline
\rothead{very long vertical text } & \rothead{very long vertical text } & \begin{itemize} \item very long text up here right here \item very long text up here right here \item very long text up here right here \end{itemize}\\ \hline
\rothead{very long vertical text } & \rothead{very long vertical text } & \begin{itemize} \item very long text up here right here \item very long text up here right here \item very long text up here right here \end{itemize}\\ \hline
\rothead{very long vertical text } & \rothead{very long vertical text } & \begin{itemize} \item very long text up here right here \item very long text up here right here \item very long text up here right here \end{itemize}\\ \hline
\end{tabular}
\end{center}
\end{document}
生成:
答案1
这和你想要的够接近吗?
- 它基于您先前问题的答案的组合怎么画简单的表格和逐项列出项目内的项目和灰色标题部分周围的一些边框是错误的
Cell 1
使用和旋转单元格Cell 2
会产生丑陋的结果,因为与调用的makecell
不能很好地配合使用。如果此文本足够短(如表格示例中所示),则旋转它们是没有意义的colortbl
[table]{xcolor}
\documentclass{article}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage[table]{xcolor}
\usepackage{tabularx, multirow, makecell, rotating} %
\usepackage{enumitem}
\usepackage{etoolbox}
\AtBeginEnvironment{tabular}{%
\setlist[itemize]{nosep,
topsep = 0pt,
partopsep = 0pt,
leftmargin = *,
label = $\bullet$,
before = \vspace{-0.6\baselineskip},
after = \vspace{-\baselineskip}
} }
\makeatletter
\def\@rothead[#1]#2{\thead{\\[-.65\normalbaselineskip] % for centering vertical text
\turn{\cellrotangle}\thead[#1]{#2}\endturn}}
\makeatother
\begin{document}
\begin{center}
\begin{tabular}{ | l | l | p{5cm} |}
\hline
\rowcolor{blue!30}
Cell 1
& Cell 2
& Summary \\ \hline
\multirow{6}{*}{\rothead[c]{very long\\ vertical text}}% text had to be manually
% broken into two lines
& \multirow{6}{*}{\rothead[c]{very long\\ vertical text}}
& \begin{itemize}
\item very long text up here right here
\item very long text up here right here
\item very long text up here right here
\end{itemize} \\ \hline
\multirow{6}{*}{\rothead[c]{very long\\ vertical text}}
& \multirow{6}{*}{\rothead[c]{very long\\ vertical text}}
& \begin{itemize}
\item very long text up here right here
\item very long text up here right here
\item very long text up here right here
\end{itemize} \\ \hline
\multirow{6}{*}{\rothead[c]{very long\\ vertical text}}
& \multirow{6}{*}{\rothead[c]{very long\\ vertical text}}
& \begin{itemize}
\item very long text up here right here
\item very long text up here right here
\item very long text up here right here
\end{itemize} \\ \hline
\end{tabular}
\end{center}
\end{document}
附录(1):
由于\rothead
不能很好地与用于旋转单元colortbl
格的调用配合使用,因此最好从包中使用:[table]{xcolor}
Cell 1
Cell 2
\rotatebox
graphicx
\rothead
\documentclass{article}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage[table]{xcolor}
\usepackage{tabularx, multirow, makecell, rotating} %
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{etoolbox}
\AtBeginEnvironment{tabular}{%
\setlist[itemize]{nosep,
topsep = 0pt,
partopsep = 0pt,
leftmargin = *,
label = $\bullet$,
before = \vspace{-0.6\baselineskip},
after = \vspace{-\baselineskip}
} }
\makeatletter
\def\@rothead[#1]#2{\thead{\\[-.65\normalbaselineskip]
\turn{\cellrotangle}\thead[#1]{#2}\endturn}}
\makeatother
\begin{document}
\begin{center}
\begin{tabular}{ | l | l | p{5cm} |}
\hline
\rowcolor{blue!30}
\multicolumn{1}{|c|}{\rotatebox[origin=c]{90}{ Cell 1 }}% observe added spaces before and after text in cell
& \multicolumn{1}{c|}{\rotatebox[origin=c]{90}{ Cell 2 }}
& Summary \\ \hline
\multirow{6}{*}{\rothead[c]{very long\\ vertical text}}
& \multirow{6}{*}{\rothead[c]{very long\\ vertical text}}
& \begin{itemize}
\item very long text up here right here
\item very long text up here right here
\item very long text up here right here
\end{itemize} \\ \hline
\multirow{6}{*}{\rothead[c]{very long\\ vertical text}}
& \multirow{6}{*}{\rothead[c]{very long\\ vertical text}}
& \begin{itemize}
\item very long text up here right here
\item very long text up here right here
\item very long text up here right here
\end{itemize} \\ \hline
\multirow{6}{*}{\rothead[c]{very long\\ vertical text}}
& \multirow{6}{*}{\rothead[c]{very long\\ vertical text}}
& \begin{itemize}
\item very long text up here right here
\item very long text up here right here
\item very long text up here right here
\end{itemize} \\ \hline
\end{tabular}
\end{center}
\end{document}
这给了
附录(2):
关于您在评论中提出的额外要求:在一列中旋转长文本会给您带来麻烦。这是在multirow
垂直尺寸等于跨度线高度总和的环境中。这意味着,您可能需要在下一列上留出额外的(空)垂直空间。结果可能会(非常)丑陋......
无论如何,以下示例在一行中有垂直线:
\documentclass{article}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage[table]{xcolor}
\usepackage{tabularx, multirow, makecell, rotating} %
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{etoolbox}
\AtBeginEnvironment{tabular}{%
\setlist[itemize]{nosep,
topsep = 0pt,
partopsep = 0pt,
leftmargin = *,
label = $\bullet$,
before = \vspace{-0.6\baselineskip},
after = \vspace{-\baselineskip}
} }
\makeatletter
\def\@rothead[#1]#2{\thead{\\[-.65\normalbaselineskip]
\turn{\cellrotangle}\thead[#1]{#2}\endturn}}
\makeatother
\begin{document}
\begin{center}
\begin{tabular}{ | l | l | p{5cm} |}
\hline
\rowcolor{blue!30}
\multicolumn{1}{|c|}{\rotatebox[origin=c]{90}{ Cell 1 }}% observe added spaces before and after text in cell
& \multicolumn{1}{c|}{\rotatebox[origin=c]{90}{ Cell 2 }}
& Summary \\ \hline
\multirow{10}{*}{\rothead[c]{very long vertical text}}
& \multirow{10}{*}{\rothead[c]{very long vertical text}}
& \begin{itemize}
\item very long text up here right here
\item very long text up here right here
\item very long text up here right here
\item very long text up here right here
\item very long text up here right here
\end{itemize} \\ \hline
\multirow{10}{*}{\rothead[c]{very long vertical text}}
& \multirow{10}{*}{\rothead[c]{very long vertical text}}
& \begin{itemize}
\item very long text up here right here
\item very long text up here right here
\item very long text up here right here
\item very long text up here right here
\item very long text up here right here
\end{itemize} \\ \hline
\multirow{10}{*}{\rothead[c]{very long vertical text}}
& \multirow{10}{*}{\rothead[c]{very long vertical text}}
& \begin{itemize}
\item very long text up here right here
\item very long text up here right here
\item very long text up here right here
\item very long text up here right here
\item very long text up here right here
\end{itemize} \\ \hline
\end{tabular}
\end{center}
\end{document}