![两个连续 hhline 之间的空格](https://linux22.com/image/323613/%E4%B8%A4%E4%B8%AA%E8%BF%9E%E7%BB%AD%20hhline%20%E4%B9%8B%E9%97%B4%E7%9A%84%E7%A9%BA%E6%A0%BC.png)
在使用 longtable 和 hhline 包时,我需要在两个连续的 hhline 之间留出空格,如下面的 MWE 所示
\documentclass[10pt]{article}
\usepackage{longtable}
\usepackage{hhline}
\usepackage{multirow}
\usepackage{rotating}
\begin{document}
\begin{center}
\small
\begin{longtable}{|c||p{0.45\textwidth}||p{0.45\textwidth}|}
\hhline{~|-||-}
\multicolumn{1}{c|}{}
& \multicolumn{1}{c||}{\textbf{Positive}} & \multicolumn{1}{c|}{\textbf{Negative}} \\\hhline{~||-||-}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} \\[-9pt]\hhline{-||-||-}
\multirow{6}{*}{\rotatebox[origin=c]{90}{\textbf{Internal}}}
& \multicolumn{1}{c||}{\textbf{Strengths}} & \multicolumn{1}{c|}{\textbf{Weaknesses}} \\\hhline{|~||-||-}
& We are strong! & We are weak! \\
& We are strong! & We are weak! \\
& We are strong! & We are weak! \\
& We are strong! & We are weak! \\
& We are strong! & We are weak! \\\hhline{-||-||-}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{} \\[-9pt]\hhline{-||-||-}
\multirow{5}{*}{\rotatebox[origin=c]{90}{\textbf{External}}}
& \multicolumn{1}{c||}{\textbf{Opportunities}} & \multicolumn{1}{c|}{\textbf{Threats}} \\\hhline{|~||-||-}
& One opportunity & One threat \\
& One opportunity & One threat \\
& One opportunity& One threat\\
& One opportunity & One threat\\\hhline{-||-||-}
\end{longtable}
\end{center}
\end{document}
在上面的例子中,我必须使用以 结尾的空行才能\\[-9pt]
产生预期的效果。有没有更好的方法可以在不添加此空行的情况下产生此效果?
答案1
如果你想要一个空白行,你可以使用
\\[...]
没必要\multicolumn
。
\hhline
您可以通过以下方式添加空格
\hhline{===}
\noalign{\vspace{3pt}}
\hhline{===}
但这里似乎你只是想要一条双线,所以:
\documentclass[10pt]{article}
\usepackage{longtable}
\usepackage{hhline}
\usepackage{multirow}
\usepackage{rotating}
\begin{document}
{%\begin{center}
\small
\begin{longtable}{|c||p{0.45\textwidth}||p{0.45\textwidth}|}
\hhline{~|-||-}
\multicolumn{1}{c|}{}
& \multicolumn{1}{c||}{\textbf{Positive}} & \multicolumn{1}{c|}{\textbf{Negative}} \\
\hhline{-:=::=}
\multirow{6}{*}{\rotatebox[origin=c]{90}{\textbf{Internal}}}
& \multicolumn{1}{c||}{\textbf{Strengths}} & \multicolumn{1}{c|}{\textbf{Weaknesses}} \\\hhline{|~||-||-}
& We are strong! & We are weak! \\
& We are strong! & We are weak! \\
& We are strong! & We are weak! \\
& We are strong! & We are weak! \\
& We are strong! & We are weak! \\
\hhline{=::=::=}
\multirow{5}{*}{\rotatebox[origin=c]{90}{\textbf{External}}}
& \multicolumn{1}{c||}{\textbf{Opportunities}} & \multicolumn{1}{c|}{\textbf{Threats}} \\\hhline{|~||-||-}
& One opportunity & One threat \\
& One opportunity & One threat \\
& One opportunity& One threat\\
& One opportunity & One threat\\
\hhline{-||-||-}
\end{longtable}
}%\end{center}
\end{document}
(不要放在longtable
中心环境中,它不会使其居中,只会增加虚假的垂直空间)