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

単純な 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} 

ここに画像の説明を入力してください

関連情報