LaTeX 表格調整

LaTeX 表格調整

我正在 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}

我得到以下輸出:

電子輸出

  1. 注意左側的重疊。我怎麼才能刪除它們?
  2. 如何將字體調整為在列中間而不是底部居中?

答案1

行間距加一半\extrarowheight,斷行時加一半。

另外,您可以使用tabular代替tabular*.

要修復左側的重疊,請注意其中有一個虛假空間

@{\extracolsep{\fill} }

微量元素

\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} 

輸出

在此輸入影像描述

答案2

使用簡單的表格或 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} 

在此輸入影像描述

相關內容