
Estou tentando construir uma tabela simples de três colunas usando tabularx, mas devo estar entendendo mal algum aspecto do código porque minha tabela visivelmente não está funcionando.
Meu objetivo é ter três larguras de coluna iguais, mas não importa o que eu tente, as linhas não parecem corresponder. (Também precisarei trabalhar para centralizar o texto e manter “informação” como uma única palavra, mas esses problemas são comparativamente menores!)
Meu código para criar a tabela está abaixo.
\caption{Common Curriculum}
\centering
\begin{tabularx}{0.9\linewidth}[ht]{||p{0.3\linewidth} | p{0.3\linewidth} | p{0.3\linewidth}||}
\hline
Physical Concepts & Mathematical Skills and Notation & Application in Quantum Information \\
\hline\hline
1 & 6 & 87837 \\
\hline
2 & 7 & 78 \\
\hline
3 & 545 & 778 \\
\hline
4 & 545 & 18744 \\
\hline
5 & 88 & 788 \\
\hline
\end{tabularx}
\label{tab:CommonCurr}.
\end{table}
Eu tentei usar {\textwidth}
em vez de {0.9\linewidth}
. Também tentei usar terços da largura do texto, mas presumi que o problema com essa ideia se devia ao arredondamento, pois minhas linhas horizontais se estendiam além da mesa, dando-me um problema oposto.
Qualquer ajuda seria apreciada!
Responder1
Gostaria de saber se você gostou do seguinte formato de tabela:
Na escrita da tabela de "aparência profissional" acima são usados o tabularray
pacote com bibliotecas (que carregam pacotes com os mesmos nomes) e uma tabela um pouco mais estreita:
\documentclass{article}
\usepackage[skip=0.33\baselineskip]{caption}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\begin{document}
\begin{table}[ht]
\caption{Common Curriculum}
\label{tab:CommonCurr}
\centering
\begin{tblr}{width=0.75\linewidth,
colspec = {X[c]
X[c, si={table-format=3.0}]
X[c, si={table-format=5.0}]},
row{even} = {belowsep=-2pt},
row{1} = {guard, c}
}
\toprule
{Physical\\ Concepts}
& Mathematical Skills and Notation
& Application in Quantum Information \\
\midrule
1 & 6 & 87837 \\
2 & 7 & 78 \\
3 & 545 & 778 \\
4 & 545 & 18744 \\
5 & 88 & 788 \\
\bottomrule
\end{tblr}
\end{table}
\end{document}
No entanto, se você preferir cada célula na "prisão" de linhas horizontais e verticais, como mostra sua pergunta, o MWE é:
\documentclass{article}
\usepackage[skip=0.33\baselineskip]{caption}
\usepackage{tabularray}
\UseTblrLibrary{siunitx}
\begin{document}
\begin{table}[ht]
\caption{Common Curriculum}
\label{tab:CommonCurr}
\centering
\begin{tblr}{width=0.75\linewidth,
hlines, vlines,
colspec = {X[c]
X[c, si={table-format=3.0}]
X[c, si={table-format=5.0}]},
row{1} = {guard, c}
}
{Physical\\ Concepts}
& Mathematical Skills and Notation
& Application in Quantum Information \\
1 & 6 & 87837 \\
2 & 7 & 78 \\
3 & 545 & 778 \\
4 & 545 & 18744 \\
5 & 88 & 788 \\
\end{tblr}
\end{table}
\end{document}
e tabela é que: