![테이블 테두리 문제 - 일부가 불완전함](https://rvso.com/image/286969/%ED%85%8C%EC%9D%B4%EB%B8%94%20%ED%85%8C%EB%91%90%EB%A6%AC%20%EB%AC%B8%EC%A0%9C%20-%20%EC%9D%BC%EB%B6%80%EA%B0%80%20%EB%B6%88%EC%99%84%EC%A0%84%ED%95%A8.png)
테이블 테두리에 또 문제가 생겼습니다. 나는 다음과 같은 것을 생산하고 싶습니다 :
또는 다음과 같습니다:
하지만 나는 계속 이런 말을 듣습니다.
내 명령은 다음과 같습니다.
\begin{table}[ht!]
\renewcommand{\arraystretch}{1}
\small
\doublespacing
\begin{center}
\caption{The Estimated Effect of Cultural Distance on Protectionism, Treatment Received}
\begin{tabular}{c|c|c|}
\cline{2-3}
& \multicolumn{2}{c}{\textbf{Treatment Received}}\\ \cline{2-3}
& All Respondents & Prejudiced Respondents\\ \cline{1-3}
Culturally Foreign & 25.6 & 44.4\\
Culturally Familiar & 20.0 & 19.0\\
Difference & 5.6 & 25.4*\\
(95\% Confidence Interval) & (-1.1 to 12.4) & (6.6 to 44.1)\\
p-value & 0.101 & 0.009\\ \hline
\end{tabular}
\end{center}
\end{table}
답변1
이 시도:
\begin{table}[ht!]
\renewcommand{\arraystretch}{1}
\small
\doublespacing
\begin{center}
\caption{The Estimated Effect of Cultural Distance on Protectionism, Treatment Received}
\begin{tabular}{c|c|c|}
\cline{2-3}
& \multicolumn{2}{c|}{\textbf{Treatment Received}}\\ \cline{2-3}
& All Respondents & Prejudiced Respondents\\ \cline{1-3}
\multicolumn{1}{|c|}{Culturally Foreign} & 25.6 & 44.4\\
\multicolumn{1}{|c|}{Culturally Familiar} & 20.0 & 19.0\\
\multicolumn{1}{|c|}{Difference} & 5.6 & 25.4*\\
\multicolumn{1}{|c|}{(95\% Confidence Interval)} & (-1.1 to 12.4) & (6.6 to 44.1)\\
\multicolumn{1}{|c|}{p-value} & 0.101 & 0.009\\ \hline
\end{tabular}
\end{center}
\end{table}
답변2
또 다른 솔루션과 다른 모양이 흥미로울 수 있습니다. 마지막 두 열의 너비는 동일하고(최소) 데이터가 중앙에 배치됩니다.
\documentclass{scrartcl}%
\usepackage[utf8]{inputenc}
\usepackage{setspace}
\usepackage{array}
\usepackage{makecell}
\newlength{\colwidth}
\usepackage[svgnames]{xcolor}
\usepackage{colortbl}
\begin{document}
\begin{table}[ht!]
\doublespacing\centering
\small\arrayrulecolor{SteelBlue}\arrayrulewidth = 1.2pt
\settowidth{\colwidth}{Prejudiced Respondents}
\caption{The Estimated Effect of Cultural Distance on Protectionism, Treatment Received}
\begin{tabular}{r@{\color{SteelBlue}\enspace\vrule width 2pt\enspace}c @{\color{SteelBlue}\vrule width 1.2pt\ }c @{\color{SteelBlue}\vrule width 1.2pt}c}
\multicolumn{1}{c}{}& \multicolumn{2}{c}{\textbf{Treatment Received}} & \\
\multicolumn{1}{c@{\color{SteelBlue}\enspace\vrule width 2pt\enspace}}{} & \multicolumn{1}{c}{\makebox[\colwidth][c]{All Respondents}} & \multicolumn{1}{c}{Prejudiced Respondents}\\
\cline{2-4}\\[-12pt]%{1.2pt}
Culturally Foreign & 25.6 & 44.4\\
Culturally Familiar & 20.0 & 19.0\\
Difference & 5.6 & 25.4*\\
(95\% Confidence Interval) & (-1.1 to 12.4) & (6.6 to 44.1)\\
p-value & 0.101 & 0.009\\[6pt]% \cline{2-3}
\end{tabular}
\end{table}
\begin{table}[ht!]
\doublespacing\centering
\small\arrayrulecolor{SteelBlue}\arrayrulewidth = 2pt
\settowidth{\colwidth}{Prejudiced Respondents}
\caption{The Estimated Effect of Cultural Distance on Protectionism, Treatment Received}
\begin{tabular}{@{}r@{\color{SteelBlue}\enspace\vrule width 2pt\enspace}c @{\color{SteelBlue}\vrule width 1.2pt\ }c @{\color{SteelBlue}\vrule width 1.2pt}c}
& \multicolumn{2}{c}{\textbf{Treatment Received}} &\\
\multicolumn{1}{c@{\color{SteelBlue}\enspace\vrule width 2pt\enspace}}{} & \multicolumn{1}{c}{\makebox[\colwidth][c]{All Respondents}} & \multicolumn{1}{c}{Prejudiced Respondents}\\
\hline\\[-12pt]%{1.2pt}{2-4}
Culturally Foreign & 25.6 & 44.4\\
Culturally Familiar & 20.0 & 19.0\\
Difference & 5.6 & 25.4*\\
(95\% Confidence Interval) & (-1.1 to 12.4) & (6.6 to 44.1)\\
p-value & 0.101 & 0.009\\[6pt]% \cline{2-3}
\end{tabular}
\end{table}
\end{document}
답변3
{NiceTabular}
자세한 내용은 of를 사용하여 테이블 형식을 만드는 방법을 참조하세요 nicematrix
.
\documentclass{article}
\usepackage{caption}
\usepackage{nicematrix}
\begin{document}
\begin{table}[ht!]
\small
\centering
\renewcommand{\arraystretch}{1.4}
\begin{NiceTabular}{ccc}%
[
hvlines,
corners,
caption = {The Estimated Effect of Cultural Distance on Protectionism, Treatment Received}
]
& \Block{1-2}{\textbf{Treatment Received}}\\
& All Respondents & Prejudiced Respondents\\
Culturally Foreign & $25.6$ & $44.4$ \\
Culturally Familiar & $20.0$ & $19.0$ \\
Difference & $5.6$ & $25.4$* \\
(95\% Confidence Interval) & ($-1.1$ to $12.4$) & ($6.6$ to $44.1$)\\
p-value & 0.101 & 0.009
\end{NiceTabular}
\end{table}
\end{document}
여러 가지 편집이 필요합니다.