
Às vezes, quando faço tabelas em látex com símbolos matemáticos, o espaçamento fica muito feio, com símbolos matemáticos conflitantes com hlines.
Por exemplo:
\begin{table}[h]
\centering
\resizebox{0.5\textwidth}{!}{%
\begin{tabular}{|c|c|c|}
\hline
l & $\hat{Y}_{t+l|t}$ & $\hat{\sigma}_{\epsilon_{t+l|t}}^2$ \\ \hline
1 & $2097 \pm 398.6$ & 39508 \\ \hline
2 & $2159 \pm 548.2$ & 78230 \\ \hline
\end{tabular}%
}
\end{table}
Nesta tabela, o chapéu em \hat{Y} toca a linha h acima. É claro que eu provavelmente poderia fazer algo com o vspace, mas existe uma solução mais generalizada para esse tipo de problema? Alguma configuração de espaçamento no ambiente da tabela, talvez?
Responder1
Eu recomendo evitar mesas em gaiolas.
\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx,booktabs}
\sisetup{separate-uncertainty}
\begin{document}
\begin{table}[htp]
\centering
\begin{tabular}{
@{}
c
S[table-format=4.1(4)]
S[table-format=5.0]
@{}
}
\toprule
l & {$\hat{Y}_{t+l|t}$} & {$\hat{\sigma}_{\epsilon_{t+l|t}}^2$} \\
\midrule
1 & 2097 \pm 398.6 & 39508 \\
2 & 2159 \pm 548.2 & 78230 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
Responder2
Você pode usar o cellspace
pacote, que garante um espaçamento vertical mínimo de células em colunas com especificador prefixado com a letra S
(ou C
se você carregar siunitx
):
\documentclass{article} %
\usepackage{array}
\usepackage{graphicx}
\usepackage{cellspace}
\setlength{\cellspacetoplimit}{4pt}
\setlength{\cellspacebottomlimit}{3pt}
\begin{document}
\begin{table}[h]
\centering\setlength{\extrarowheight}{2pt}
\resizebox{0.5\textwidth}{!}{%
\begin{tabular}{|c|Sc|c|}
\hline
l & $\hat{Y}_{t+l|t}$ & $\hat{\sigma}_{\epsilon_{t+l|t}}^2$ \\ \hline
1 & $2097 \pm 398.6$ & 39508 \\ \hline
2 & $2159 \pm 548.2$ & 78230 \\ \hline
\end{tabular}%
}
\end{table}
\end{document}