
Estou digitando a seguinte tabela em LaTeX:
\begin{center}
\setlength\extrarowheight{5pt}
%\renewcommand{\arraystretch}{1.2}
\begin{tabular*}{3.4in}{@{\extracolsep{\fill} } | c | c | c | c | c | c | c | }
\hline
\small\textit{g(t+0)} & \small\textit{g(t+1)} & \small\textit{g(t+2)} & \small\textit{f(t+3)} & \small\textit{f(t+4)} & \small\textit{g(t+5)} & \small{...} \\
\hline
\end{tabular*}
\end{center}
Eu recebo a seguinte saída:
- Observe a sobreposição à esquerda. Como eu posso removê-los?
- Como ajusto as fontes para serem centralizadas no meio das colunas, exceto na parte inferior?
Responder1
Adicione metade do espaçamento \extrarowheight
e metade ao quebrar a linha.
Além disso, você pode usar tabular
em vez de tabular*
.
Para corrigir a sobreposição à esquerda, observe que você tem um espaço espúrio em
@{\extracolsep{\fill} }
MWE
\documentclass{article}
\usepackage{array}
\begin{document}
\begin{center}
\setlength\extrarowheight{2.5pt}
%\renewcommand{\arraystretch}{1.2}
\begin{tabular}{@{\extracolsep{\fill}} | c | c | c | c | c | c | c | }
\hline
\small\textit{g(t+0)} & \small\textit{g(t+1)} & \small\textit{g(t+2)} & \small\textit{f(t+3)} & \small\textit{f(t+4)} & \small\textit{g(t+5)} & \small{...}\\[2.5pt]
\hline
\end{tabular}
\end{center}
\end{document}
Saída
Responder2
use um tabular simples ou tabularx:
\documentclass{article}
\usepackage{tabularx}
\begin{document}
foo
{\small\itshape
\begin{tabular}{|*7{c|}} \hline
\rule[-2ex]{0pt}{6ex} g(t+0) & g(t+1) & g(t+2) & f(t+3) & f(t+4) & g(t+5) & \ldots\\\hline
\end{tabular}}
{\small\itshape
\begin{tabularx}{3.8in}{|*6{X |}c|} \hline
\rule[-2ex]{0pt}{6ex} g(t+0) & g(t+1) & g(t+2) & f(t+3) & f(t+4) & g(t+5) & \ldots\\\hline
\end{tabularx}}
bar
\end{document}