![\multicolumn 사용에 관한 질문](https://rvso.com/image/330739/%5Cmulticolumn%20%EC%82%AC%EC%9A%A9%EC%97%90%20%EA%B4%80%ED%95%9C%20%EC%A7%88%EB%AC%B8.png)
내 질문은 아마도 매우 간단하지만 해결 방법을 모르겠습니다. 병합하려고 하는 두 개의 stata 테이블이 있습니다(라텍스에 stata 옵션을 사용합니다). 새 테이블에 제목을 추가하고 싶습니다. 따라서 나는 \multicolumn을 사용해야 한다는 것을 이해했지만 다른 것을 시도했지만 아무것도 작동하지 않는 것 같습니다.
{
\def\onepc{$^{\ast\ast}$} \def\fivepc{$^{\ast}$}
\def\tenpc{$^{\dag}$}
\def\legend{\multicolumn{4}{l}{\footnotesize{Significance levels
:\hspace{1em} $\dag$ : 10\% \hspace{1em}
$\ast$ : 5\% \hspace{1em} $\ast\ast$ : 1\% \normalsize}}}
\begin{table}[H]\centering
\caption{Estimation results : regress
\label{tabresult regress}}
\begin{tabular}{l r @{} l c ||c c}\hline\hline
\multicolumn{4}{c}{\textbf{OLS regression}} & {\textbf{Probit regression}}\\
\hline
\multicolumn{1}{c}
{\textbf{Variable}}
& \multicolumn{2}{c}{\textbf{Coefficient}} & \textbf{(Std. Err.)} & {\textbf{Coefficient}} & \textbf{(Std. Err.)} \\ \hline
\hline
\end{tabular}
\end{table}
}
현재의 모습입니다. 우리는 그것이 아주 이상하고 조화롭지 않다는 것을 압니다.
나는 "OLS 회귀"가 두 번째 줄(변수, 계수, 표준 오류)의 3개 열로 구성된 블록의 중간에 있고, 그 다음 별도의 줄, 그리고 "프로빗 회귀"가 중앙에 있기를 원합니다. 두 번째 줄의 2개 열(계수, std err)로 구성된 블록입니다. 누군가 나에게 이것에 대해 손을 줄 수 있습니까? 미리 감사드립니다!
답변1
귀하의 MWE에서는 귀하가 달성하고자 하는 것이 무엇인지 확신할 수 없습니다. 내 추측에 따라 다음 표의 형식을 지정합니다.
그것을 얻는 것은 매우 간단합니다. 코드가 이해하기 쉽기를 바랍니다.
\documentclass{article}
\usepackage{makecell}
\renewcommand\theadfont{\bfseries}
\begin{document}
My question is probably quite simple but I do not know how to solve it. I have two stata table that I am trying to merge (I use stata options for latex). I want to add a title on my new table. I thus understood that I needed to use \verb+\multicolumn+ but I try different things and nothing seems to work.
\begin{table}[htb]\centering
\caption{Estimation results: regress}
\label{tabresult regress}
\begin{tabular}{l c c ||c c}\hline\hline
\multicolumn{3}{c||}{\textbf{OLS regression}}
& \multicolumn{2}{c}{\textbf{Probit regression}}\\
\hline
\thead{Variable}
& \thead{Coefficient}
& \thead{(Std. Err.)}
& \thead{Coefficient}
& \thead{(Std. Err.)} \\
\hline
1 & 2 & 3 & 4 & 5 \\
\hline
\end{tabular}
\end{table}
\end{document}
MWE와 비교하여 하나의 가짜 열을 지웁니다. (소수점에서 숫자 형식을 지정하고 싶은 조합이 있습니까 rl
? 이 경우 패키지 S
등에서 숫자 조정을 더 잘 관리할 수 있는 다른 유형의 열이 필요합니다 siunitx
.) makecell
컬럼 헤드를 더 간단하게 설정하려면 패키지를 추가하세요 . 이제 "프로비트 회귀"가 자체적으로 수행됩니다.\multicolumn{2}{c}{...}
나는 테이블 디자인에 신경을 쓰지 않았지만 "전문적인" 테이블 설정을 가능하게 하는 ˙booktabs` 패키지를 찾아보시길 권합니다. 예를 제공하려면 테이블 콘텐츠 행을 하나 이상 추가해야 합니다.