Quando utilizo o pacote tabularx para gerar uma tabela, isso acontece:
\documentclass [12pt]{book}
\usepackage{tabularx} % for stretching tables to page width
\usepackage{multirow} % for multiple rows in tables
\newcolumntype{Y}{>{\centering\arraybackslash}X} % for centering tables in tabularx
\def\tabularxcolumn#1{m{#1}}
\begin{document}
\begin{table}[H]
\centering
\begin{tabularx}{\textwidth}{|X|>{\hsize=.7\hsize}Y|>{\hsize=.7\hsize}Y|>{\hsize=.7\hsize}Y|>{\hsize=.7\hsize}Y|}
\hline
\multirow{3}{*}{\textbf{Components}} & \multirow{3}{*}{\textbf{Number}} & \multirow{3}{*}{\textbf{Algebra}} & \multirow{2}{*}{\textbf{Space and}} & \textbf{Statistics}\\
& & & \multirow{2}{*}{\textbf{shape}} & \textbf{and}\\
& & & & \textbf{probability}\\\hline
Core (Papers 1 \& 3) & 30--35\% & 20--25\% & 30--35\% &10--15\%\\\hline
\end{tabularx}
\end{table}
\end{document}
Como faço para me livrar das linhas horizontais extras no lado direito da mesa?
Responder1
Não ajuste a largura das X
colunas. Em vez disso, ajuste a coluna que realmente deseja ser diferente e deixe as X
colunas se espalharem uniformemente para preencher o restante:
\documentclass{article}
\usepackage{tabularx,array,booktabs}
\newcolumntype{Y}{>{\centering\arraybackslash}X} % for centering tables in tabularx
\def\tabularxcolumn#1{m{#1}}
\newcommand{\heading}[1]{\bfseries\begin{tabular}{@{}c@{}} #1 \end{tabular}}
\begin{document}
\noindent
\begin{tabularx}{\textwidth}{
>{\centering}m{.185\linewidth}
*{4}{Y} }
\toprule
\heading{Components} & \heading{Number} & \heading{Algebra} & \heading{Space and \\shape} & \heading{Statistics \\ and \\ probability} \\
\midrule
Core (Papers 1 \& 3) & 30--35\% & 20--25\% & 30--35\% & 10--15\% \\
\bottomrule
\end{tabularx}
\end{document}