关注@Zarko 在这个问题上的回答如何绘制此表
我仍然不满意,我想在一列中旋转长文本,但这可能会给我带来麻烦,因为它处于多行环境中,其垂直大小等于跨行高度的总和。这意味着,我可能需要在下一列上留出额外的(空)垂直空间。因此,我想知道是否有办法解决这个问题
我尝试了@Zarko 的这个代码,但解决方案正如他所说,我需要在下一列上增加(空)垂直空间。那么有没有办法通过添加任何额外的(空)垂直空间来解决这个问题。
Zarko 通过添加额外(空白垂直空间)的解决方案不符合我的需求,我正在寻找与此不同的解决方案
\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{8cm} |}
\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 very long text up here right here}}
& \multirow{10}{*}{\rothead[c]{very long vertical text very long text up here right here}}
& \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 very long text up here right here}}
& \multirow{10}{*}{\rothead[c]{very long vertical text very long text up here right here}}
& \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 very long text up here right here}}
& \multirow{10}{*}{\rothead[c]{very long vertical text very long text up here right here}}
& \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}
产生
答案1
我不确定这有什么用。无论如何,这就是答案:像往常一样,\multirow
这不是解决方案。
\documentclass{article}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage[table]{xcolor}
\usepackage{array}
\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}
}%
}
\newcommand{\rotcell}[1]{%
\rotatebox[origin=c]{90}{ #1 }%
}
\begin{document}
\begin{center}
\begin{tabular}{ | c | c | m{8cm} |}
\hline
\rowcolor{blue!30}
\rotcell{Cell 1} & \rotcell{Cell 2} & Summary \\
\hline
\rotcell{very long vertical text very long text up here right here} &
\rotcell{very long vertical text very long text up here right here} &
\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
\rotcell{very long vertical text very long text up here right here} &
\rotcell{very long vertical text very long text up here right here} &
\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
\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}
如果要控制旋转部分的换行符:
\documentclass{article}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage[table]{xcolor}
\usepackage{array}
\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}
}%
}
\newcommand{\rotcell}[1]{%
\rotatebox[origin=c]{90}{\begin{tabular}{c}#1\end{tabular}}%
}
\begin{document}
\begin{center}
\begin{tabular}{ | c | c | m{8cm} |}
\hline
\rowcolor{blue!30}
\rotcell{Cell 1} & \rotcell{Cell 2} & Summary \\
\hline
\rotcell{very long vertical text very long text up here right here} &
\rotcell{very long vertical text very long text up here right here} &
\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
\rotcell{very long vertical text \\ very long text up here right here} &
\rotcell{very long vertical text \\ very long text up here right here} &
\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
\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}