Centralizando uma tabela dentro de outra

Centralizando uma tabela dentro de outra

Eu tenho a seguinte tabela. Gostaria de centralizar a tabela no topo para evitar espaços em branco após a coluna 6. Agradecemos antecipadamente pela sua ajuda.

Este é o meu código:

\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}

insira a descrição da imagem aqui

Responder1

Como já foi apontado nos comentários, você precisa fornecer dois tabularambientes separados se quiser centralizá-los horizontalmente um em relação ao outro. E, por suposto, livre-se das diretivas \resizeboxe \makebox.

insira a descrição da imagem aqui

\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}

Responder2

A abordagem Mi também consiste em duas tabelas separadas, mas fazendo com que pareçam uma só, com 1-6 e 7-13 colunas da mesma largura, que parecem mais próximas do que você tentou. Como a pergunta está marcada tabularxpor algum motivo, esta abordagem a utiliza, mas com menos linhas horizontais.

eu

\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}

informação relacionada