Como mover a tabela TabularX para o topo da página?

Como mover a tabela TabularX para o topo da página?

Criei uma tabela de largura de coluna no TabularX e quero posicioná-la no topo da página, mas não encontrei uma resposta sobre como fazer isso – existe uma maneira?

\begin{center}
\footnotesize
   \begin{tabularx} {\columnwidth} {
   | >{\centering\arraybackslash}X
   | >{\centering\arraybackslash}X
   | >{\centering\arraybackslash}X
  | >{\centering\arraybackslash}X |}
 \hline
 \makecell{Planet\\} & \makecell{Mass\\(M\textsubscript{s})} & \makecell{SMA\\(AU)} & \makecell{TA\\(\textdegree)} \\
 \hline
 b  & 0.003  & 70 & 153  \\
 \hline
 c  & 0.004  & 38.9 & 48  \\
 \hline
 d  & 0.005  & 25.6 & 292  \\
\hline
e  & 0.008  & 14.4 & 327  \\
\hline
\end{tabularx}
\captionof{table}{Parameters calculated using figs 2 and 3.}
    \label{Table 1}
\end{center}

Responder1

Para forçar o LaTeX a compor o tabularxmaterial no topo de uma coluna, coloque o material em um tableambiente, não em um centerambiente. Observe que como a largura do tabularxambiente está definida como , nenhuma instrução \columnwidthexplícita é necessária.\centering

Considere também a sugestão de @David Carlisle de alinhar os números nas três colunas de dados em seus marcadores decimais (explícitos ou implícitos). E tente dar à mesa uma "aparência" mais aberta e convidativa, livrando-se de todas as regras verticais e usando menos regras horizontais, mas bem espaçadas. As aplicações de ambas as sugestões são exibidas na imagem a seguir.

insira a descrição da imagem aqui

\documentclass[twocolumn]{article}
\usepackage{tabularx,makecell,dcolumn,booktabs,lipsum}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{d}[1]{D..{#1}}
% handy shortcut macros:
\newcommand\mC[1]{\multicolumn{1}{C}{#1}}  % without vertical rules
\newcommand\mD[1]{\multicolumn{1}{C|}{#1}} % with vertical rules
\begin{document}

\lipsum[1] % filler text

\begin{table}[t]
%\footnotesize  % not needed

\begin{tabularx}{\columnwidth}{
 | *{4}{C|} }
 \hline
 \makecell{Planet\\} & 
 \makecell{Mass\\(M\textsubscript{s})} & 
 \makecell{SMA\\(AU)} & 
 \makecell{TA\\(\textdegree)} \\
 \hline
 b  & 0.003  & 70   & 153  \\
 \hline
 c  & 0.004  & 38.9 &  48  \\
 \hline
 d  & 0.005  & 25.6 & 292  \\
 \hline
 e  & 0.008  & 14.4 & 327  \\
 \hline
\end{tabularx}
\caption{OP's original version}
\label{table:parameters1}

\bigskip
\begin{tabularx}{\columnwidth}{
 | >{\centering}X | d{1.3} | d{2.1} | d{3.0} |}
 \hline
 Planet & 
 \mD{\makecell{Mass\\(M\textsubscript{s})}} & 
 \mD{\makecell{SMA\\(AU)}} & 
 \mD{\makecell{TA\\(\textdegree)}} \\
 \hline
 b  & 0.003  & 70   & 153  \\
 \hline
 c  & 0.004  & 38.9 &  48  \\
 \hline
 d  & 0.005  & 25.6 & 292  \\
 \hline
 e  & 0.008  & 14.4 & 327  \\
 \hline
\end{tabularx}
\caption{Numbers aligned on decimal markers}
\label{table:parameters2}

\bigskip
\begin{tabularx}{\columnwidth}{
 @{} >{\centering}X d{1.3} d{2.1} d{3.0} @{}}
 \toprule
 Planet & 
 \mC{\makecell{Mass\\(M\textsubscript{s})}} & 
 \mC{\makecell{SMA\\(AU)}} & 
 \mC{\makecell{TA\\(\textdegree)}} \\
 \midrule
 b  & 0.003  & 70   & 153  \\
 c  & 0.004  & 38.9 &  48  \\
 d  & 0.005  & 25.6 & 292  \\
 e  & 0.008  & 14.4 & 327  \\
 \bottomrule
\end{tabularx}
\caption{Numbers aligned on decimal markers, no vertical rules, fewer but well-spaced horizontal rules}
\label{table:parameters3}

\end{table}

\lipsum[2-4] % more filler text
\end{document}

informação relacionada