0

I have been in a problem with making a table in LaTeX as attached in the figure below. Please help me out.

Table

I am trying like:

\begin{document}
\begin{tabular}{|p{1cm}|p{1cm}|p{5cm}|}
\hline
\multicolumn{2}{l|}{Input Values} & \multicolumn{1}{l|}{Output Values} \\
\hline
1&2&The values  \\
\hline
3&5&\begin{tabular}{|c|c|c|c|c|}
      \hline
      % after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
      1 & 2 &  &  &  \\
      \hline
       & &  &  &  \\
      &  &  &  &  \\
       &  &  &  &  \\
       &  &  &  &  \\
       &  &  &  &  \\
       &  &  &  &  \\
      \hline
    \end{tabular}
 \end{tabular}
\end{document}

But not coming.

I am new to the latex so please help me.

12
  • 2
    And what exactly is your problem with it? – user37684 Dec 28 '13 at 10:46
  • 1
    Where do you have problems? Can you show us you tries in form of a minimal working example? Btw: you should have a look at package booktabs. – Johannes_B Dec 28 '13 at 10:47
  • @str i am unable to make tha latex code for the table of the type as shown in the figure, – Curious Dec 28 '13 at 10:48
  • @str I am unable to divide the column in middle. I am using multirow code but it is not working – Curious Dec 28 '13 at 10:50
  • 3
    Take a look at the question I linked to in my previous comment, that has a similar table to the one you want. – Torbjørn T. Dec 28 '13 at 11:10
4

Approach 1

Your table with p{...} columns of fixed width.

\documentclass{article}
\pagestyle{empty}
\begin{document}
\begin{tabular}{|p{3cm}|p{3cm}|p{3cm}|p{3cm}|}
    \hline
    \multicolumn{2}{|c|}{Date with place} & \multicolumn{2}{c|}{Output Values}              \\
    \hline
    21/01 & x                             & \multicolumn{2}{c|}{The data for different day} \\
    \hline
    22/01 & y                             & sunday & 233                                    \\
    \hline
    23/01 & z                             & Mon    & 233                                    \\
    \hline
    24/01 & p                             & tues   & 134                                    \\
    \hline
    25/01 & q                             & wed    & 76                                     \\
    \hline
    26/01 & r                             & thurs  & 35                                     \\
    \hline
    27/01 & s                             & fi     & 87                                     \\
    \hline
    28/01 & t                             & sat    & 7                                      \\
    \hline
\end{tabular}
\end{document}

enter image description here


Approach 2

Using booktabs without the "sudoku grid" and p{...} columns of fixed width.

\documentclass{article}
\pagestyle{empty}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{p{3cm}p{3cm}p{3cm}p{3cm}}
    \toprule
    \multicolumn{2}{c}{Date with place} & \multicolumn{2}{c}{Output Values}              \\
    \midrule
    21/01 & x                           & \multicolumn{2}{c}{The data for different day} \\
    \cmidrule{3-4}
    22/01 & y                           & sunday & 233                                   \\
    23/01 & z                           & Mon    & 233                                   \\
    24/01 & p                           & tues   & 134                                   \\
    25/01 & q                           & wed    & 76                                    \\
    26/01 & r                           & thurs  & 35                                    \\
    27/01 & s                           & fi     & 87                                    \\
    28/01 & t                           & sat    & 7                                     \\
    \bottomrule
\end{tabular}
\end{document}

enter image description here


Approach 3

Using booktabs and scalable columns as in l.

\documentclass{article}
\pagestyle{empty}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{llll}
    \toprule
    \multicolumn{2}{c}{Date with place} & \multicolumn{2}{c}{Output Values}              \\
    \midrule
    21/01 & x                           & \multicolumn{2}{c}{The data for different day} \\
    \cmidrule{3-4}
    22/01 & y                           & sunday & 233                                   \\
    23/01 & z                           & Mon    & 233                                   \\
    24/01 & p                           & tues   & 134                                   \\
    25/01 & q                           & wed    & 76                                    \\
    26/01 & r                           & thurs  & 35                                    \\
    27/01 & s                           & fi     & 87                                    \\
    28/01 & t                           & sat    & 7                                     \\
    \bottomrule
\end{tabular}
\end{document}

enter image description here


Approach 4

Inception tables, a table inside a table!

\documentclass{article}
\pagestyle{empty}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{cc}
    \toprule
    Date with place & Output Values \\
    \midrule
    \begin{tabular}{ll}
        21/01 & x \\
        22/01 & y \\
        23/01 & z \\
        24/01 & p \\
        25/01 & q \\
        26/01 & r \\
        27/01 & s \\
        28/01 & t \\
    \end{tabular}
    &
    \begin{tabular}{ll}
        \multicolumn{2}{c}{The data for different day} \\
        \midrule
        sunday & 233                                   \\
        Mon    & 233                                   \\
        tues   & 134                                   \\
        wed    & 76                                    \\
        thurs  & 35                                    \\
        fi     & 87                                    \\
        sat    & 7                                     \\
    \end{tabular}
    \\
    \bottomrule
\end{tabular}
\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.