如何绘制此表

如何绘制此表

我想绘制下表 在此处输入图片描述 这是我的代码:

\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

这和你想要的够接近吗?

在此处输入图片描述

\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 1Cell 2\rotateboxgraphicx\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}

在此处输入图片描述

相关内容