한 테이블을 다른 테이블 중앙에 배치

한 테이블을 다른 테이블 중앙에 배치

다음 테이블이 있습니다. 6열 이후에 공백이 생기지 않도록 테이블을 상단 중앙에 배치하고 싶습니다. 도움을 주셔서 미리 감사드립니다.

이것은 내 코드입니다.

\documentclass[12pt]{article}
\usepackage{graphicx,subfigure}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[justification=centering]{caption}
\usepackage{booktabs}

\begin{document}
\begin{table}[t]\caption{Titre} \centering
\makebox[\textwidth]{%
\resizebox{17cm}{!} {
\begin{tabular}{lccccccc}
\toprule
\cmidrule(r){2-2}   \cmidrule(r){3-7}              
&     (1)     &    (2)    &     (3)      &   (4)    &   (5)    &   (6)          \\
& A & B & C & D  &  E &  F     \\
\cmidrule(r){2-2}   \cmidrule(r){3-7} 
Variable  &  1 & 1 & 1 & 1 & 1 & 1   \\
\cmidrule(r){2-2}   \cmidrule(r){3-7}   
& \\                    
&     (7)     &    (8)    &     (9)      &   (10)    &   (11)    &   (12)      & (13)    \\
& E & F&  G & K  & L &  M & N  \\ 
\cmidrule(r){2-2}  \cmidrule(r){3-3} \cmidrule(r){4-6} \cmidrule(r){7-8}
Variable & 2 & 2 & 2 & 2 & 2 & 2 & 2\\
\cmidrule(r){2-2}  \cmidrule(r){3-3} \cmidrule(r){4-6} \cmidrule(r){7-8}  \bottomrule
\end{tabular}
}
}
\end{table}
\end{document}

여기에 이미지 설명을 입력하세요

답변1

주석에서 이미 지적했듯이 tabular서로 수평으로 중앙에 배치하려면 두 개의 별도 환경을 제공해야 합니다. 그리고 반드시 \resizeboxand \makebox지시어를 제거하세요.

여기에 이미지 설명을 입력하세요

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[skip=0.333\baselineskip]{caption}
\usepackage{booktabs}

\begin{document}
\begin{table}[t]\caption{Titre} 
\centering

\begin{tabular}{@{} l*{6}{c} @{}}
\toprule             
& (1) & (2) & (3) & (4) & (5) & (6) \\
& A & B & C & D & E & F     \\
\cmidrule(lr){2-2}   \cmidrule(l){3-7} 
Variable  &  1 & 1 & 1 & 1 & 1 & 1   \\ 
\bottomrule
\end{tabular}

\medskip % or: \bigskip, ...
\begin{tabular}{@{} l*{7}{c} @{}}  
\toprule  
& (07) & (08) & (09) & (10) & (11) & (12) & (13) \\
& E & F & G & K & L & M & N  \\ 
\cmidrule(lr){2-2}  \cmidrule(lr){3-3} \cmidrule(lr){4-6} \cmidrule(l){7-8}
Variable & 2 & 2 & 2 & 2 & 2 & 2 & 2\\
\bottomrule
\end{tabular}

\end{table}
\end{document}

답변2

Mi 접근 방식은 두 개의 별도 표 형식이지만 동일한 너비의 1-6 및 7-13 열을 사용하여 마치 하나처럼 보이게 만들어 시도한 것보다 더 가깝게 보입니다. 어떤 이유로 질문에 태그가 지정되었으므로 tabularx이 접근 방식에서는 이를 사용하지만 수평선이 더 적습니다.

음

\documentclass[12pt]{article}
\usepackage{graphicx,subfigure,tabularx}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[justification=centering]{caption}
\usepackage{booktabs}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\begin{document}
\begin{table}[t]\caption{Titre} 
\centering
\begin{tabularx}{.8\linewidth}{m{4em}YYYYYY}\toprule 
 & (1) & (2) & (3) & (4) & (5) & (6) \\
 & A & B & C & D & E & F \\
\cmidrule(rl){2-2} \cmidrule(rl){3-7} 
Variable & 1 & 1 & 1 & 1 & 1 & 1 \\
\\%\midrule
\end{tabularx}
\begin{tabularx}{.8\linewidth}{m{4em}YYYYYYY} 
& (7) & (8) & (9) & (10) & (11) & (12) & (13) \\
& E & F& G & K & L & M & N \\ 
\cmidrule(rl){2-2} \cmidrule(rl){3-3} \cmidrule(rl){4-6} \cmidrule(rl){7-8}
Variable & 2 & 2 & 2 & 2 & 2 & 2 & 2\\\bottomrule
\end{tabularx} 
\end{table}
\end{document}

관련 정보