2

I am a beginner. I have been attempting to make a table for the last two days but I am not getting it. I need help with this table. table

Some of my attempts

\begin{tabular}{|c|c|c|c|c|}
\hline
$t$ & $y$ & $y$ \text{in terms of} $y_0[=(-\frac 12) 

g\tau^2]$ &\text{Distance traversed in successive intervals}& \text{Ratio of distances traversed} \
\hline
 $0$ & $0$ & $0$ & $:$ & $:$  \
$ \tau$  & $-(\frac 12) g \tau^2$ & $y_0$ & $y_0$ & $1$\
 $2 \tau$ & $-4(\frac 12) g \tau^2$ & $4y_0$ & $3y_0$ & $3$ \
 $3 \tau$ & $-9(\frac 12) g \tau^2$ & $9y_0$ & $5y_0$ & $5$  \
 $4\tau$ & $-16(\frac 12) g \tau^2$ & $16y_0$ &$7y_0$ & $7$  \
 $5 \tau$ & $-25(\frac 12) g \tau^2$ & $25y_0$ & $9y_0$ & $9$ \
 $6 \tau$ & $-36(\frac 12) g \tau^2$& $36y_0$ & $11y_0$ & $11$
\end{tabular}

.

\begin{tabular}{|c|c|c|c|c|}
\hline
$t$ & $y$ & $y$ \text{in terms of} $y_0[=\left(-\frac 12\right) g\tau^2]$ &\text{Distance traversed in successive intervals}& \text{Ratio of distances traversed} \
\hline
 $0$ & $0$ & $0$ & $:$ & $:$  \
$ \tau$  & $-\left(\frac 12\right) g \tau^2$ & $y_0$ & $y_0$ & $1$\
 $2 \tau$ & $-4\left(\frac 12\right) g \tau^2$ & $4y_0$ & $3y_0$ & $3$ \
 $3 \tau$ & $-9\left(\frac 12\right) g \tau^2$ & $9y_0$ & $5y_0$ & $5$  \
 $4\tau$ & $-16\left(\frac 12\right) g \tau^2$ & $16y_0$ &$7y_0$ & $7$  \
 $5 \tau$ & $-25\left(\frac 12\right) g \tau^2$ & $25y_0$ & $9y_0$ & $9$ \
 $6 \tau$ & $-36\left(\frac 12\right) g \tau^2$& $36y_0$ & $11y_0$ & $11$ \
\hline
\end{tabular}

.

\begin{tabular}{|c|c|c|c|c|}
\hline
$t$ & $y$ & $y$ \text{in terms of} $y_0[=\left(-\frac 12\right) g\tau^2]$ &\text{Distance traversed in successive intervals}& \text{Ratio of distances traversed} \\
\hline
 $0$ & $0$ & $0$ & $\:$ & $\:$  \\
$ \tau$  & $-\left(\frac 12\right) g \tau^2$ & $y_0$ & $y_0$ & $1$\\
 $2 \tau$ & $-4\left(\frac 12\right) g \tau^2$ & $4y_0$ & $3y_0$ & $3$ \\
 $3 \tau$ & $-9\left(\frac 12\right) g \tau^2$ & $9y_0$ & $5y_0$ & $5$  \\
 $4\tau$ & $-16\left(\frac 12\right) g \tau^2$ & $16y_0$ &$7y_0$ & $7$  \\
 $5 \tau$ & $-25\left(\frac 12\right) g \tau^2$ & $25y_0$ & $9y_0$ & $9$ \\
 $6 \tau$ & $-36\left(\frac 12\right) g \tau^2$& $36y_0$ & $11y_0$ & $11$ \\
\hline
\end{tabular}
4

Here is one way to do it:

\documentclass[12pt]{article}
%\usepackage{amsmath}   % in case you need it
\begin{document}
    \begin{tabular}{|l|l|p{2cm}|p{2.5cm}|p{3cm}|} % p: col-width
        \hline
        $t$ & 
        $y$ & 
        {$y$ in terms of $y_0=-\frac{1}{2} g \tau^2$} &
        {Distance traversed in successive intervals} & % {} for readability
        {Ratio of distances traversed}\\% \\ ends the row
        
        \hline  % just two lines as an example
        $0$ &$0$ &$0$ &$0$ &$0$\\    % digits in math-font
        $6 \tau$ & 
        $-3 (\frac{1}{2})g \tau^2$ & % watch braces ;-)
        {$36 y_0$} & {$11 y_0$} &
        {$11$}\\
        \hline
    \end{tabular}
\end{document}

See https://en.wikibooks.org/wiki/LaTeX/Tables#The_tabular_environment for more details on the tabular environment.

Result:

enter image description here

Unless you know it already, this one is worth spending some hours reading and scanning: https://en.wikibooks.org/wiki/LaTeX .

Find more alternatives for table-design here: https://ctan.org/topic/table?lang=en . May be you enjoy nicematrix https://ctan.org/pkg/nicematrix ?

Have a good journey with Latex :)

7

It is not clear why your code fragment has three consecutive identical tables. Anyway, in suggested solution is consider just one:

enter image description here

In code for above table is consider tblr table environment defined in the package tabularray which is nested in math environment. By this are eliminated all $ in table body:

Edit: In MWE is now considered tabularray version 2021N.

\documentclass{article}
\usepackage{tabularray}

\begin{document}
\[
\begin{tblr}{colspec = { l l  X[l] X[1.1,l] X[l] },
             vlines,
             hline{1,2,Z} = {1pt},  % <---
             colsep=4pt,
             }
t   & y &   y $ in terms of $ y_0\ [=(-\frac{1}{2})g\tau^2] 
            &   $in terms of successive intervals$~
                &   $Ratio of distances traversed$~   \\
0   & 0 & 0 &   &                           \\
\tau  & -(\frac{1}{2}) g \tau^2 
        & y_0   & y_0 & 1                   \\
2\tau & -4(\frac{1}{2}) g \tau^2
        & 4y_0 & 3y_0 & 3     \\
3\tau & -9(\frac{1}{2}) g \tau^2
        & 9y_0 & 5y_0 & 5     \\
4\tau & -16(\frac{1}{2}) g \tau^2
        & 16y_0 &7y_0 & 7     \\
5\tau & -25(\frac{1}{2}) g \tau^2
        & 25y_0 & 9y_0 & 9    \\
6\tau & -36(\frac{1}{2}) g \tau^2
        & 36y_0 & 11y_0 & 11  \\
\end{tblr}
\]
\end{document}
2
  • 1
    Nice solution. // There are 3 tables, because the OP wanted to show some of his or her attempts, which got edited into one big source-code later.
    – MS-SPO
    Jul 19 at 7:06
  • @MS-SPO, thank you for compliment. About three tables: it is still not clear to me. But OP have two possibilities: repeat table body three times (in one big table) or repeat the same table three times.
    – Zarko
    Jul 19 at 7:36
2

To create multiple lines in the column header, the \thead command from the makecell package can be used.

\documentclass{article}

\usepackage{makecell}
\usepackage{amsmath}

\renewcommand\theadalign{tl} %for top left alignment

\begin{document}
\begin{tabular}{|l|l|l|l|l|}
\hline
\thead{$t$} & \thead{$y$} 
& \thead{$y$ in terms of\\ $y_0[=\left(-\frac 12\right) g\tau^2]$} 
& \thead{Distance \\traversed in \\successive \\intervals} 
& \thead{Ratio of \\distances \\traversed} \\
\hline
$0$ & $0$ & $0$ & $\:$ & $\:$  \\
$ \tau$  & $-\left(\frac 12\right) g \tau^2$ & $y_0$ & $y_0$ & $1$ \\
$2 \tau$ & $-4\left(\frac 12\right) g \tau^2$ & $4y_0$ & $3y_0$ & $3$ \\
$3 \tau$ & $-9\left(\frac 12\right) g \tau^2$ & $9y_0$ & $5y_0$ & $5$  \\
$4\tau$ & $-16\left(\frac 12\right) g \tau^2$ & $16y_0$ &$7y_0$ & $7$  \\
$5 \tau$ & $-25\left(\frac 12\right) g \tau^2$ & $25y_0$ & $9y_0$ & $9$ \\
$6 \tau$ & $-36\left(\frac 12\right) g \tau^2$& $36y_0$ & $11y_0$ & $11$ \\
\hline
\end{tabular}
\end{document}

output

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.