6

I am typing the following table in 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}

I get the following output:

eoutput

  1. Note the overlap on the left. How can I remove them?
  2. How do I adjust the fonts to be centered in the middle of the columns other than on the bottom?
12

Add half the spacing through \extrarowheight and half when you break the row.

Also, you can use tabular instead of tabular*.

To fix the overlap on the left note that you have a spurious space in

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

Output

enter image description here

  • also i want the overlap on the left hand side to be shifted to the right – user1965914 Feb 8 '14 at 8:55
  • @user1965914 See if now it is OK. – karlkoeller Feb 8 '14 at 9:04
4

use a simple tabular or 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} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.