
次の表を 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
行全体にわたってスペースの半分を追加し\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
単純な tabular または 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}