2

I want to have a table which contains many tables. I want its caption also. MTab1 and 2 are single col and row matrix. length of Mtab1 and 2 should be equal to T1 and T2.It means Row of MTab1 = 7 rows of T1

enter image description here

\documentclass[pdftex,12pt,a4paper]{report}
\usepackage{lscape}    
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}    
\documentclass[pdftex,12pt,a4paper]{report}
\usepackage{lscape}
 \newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
  \begin{document}
   \begin{landscape} 
    \begin{tabular}{l l l} 
     MTab1 & \input{./Mat1_out.tex} & \input{./Mat2_out.tex}\\ MTab2 & \input{./Mat1_out.tex} & \input{./Mat2_out.tex}\\ 

   \caption{This table shows some data}
    \end{tabular}
     \end{landscape}
      \end{document}

% Content Mat1_out.text

\begin{tiny}\begin{tabular}{|l|c|c|c|c|}
\hline
&\textbf{col 1}&\textbf{col 2}&\textbf{col 3}&\textbf{col 4}\\\hline
\textbf{row 1}&0.55&0.24&0.35&0.75\\\hline
\textbf{row 2}&0.14&0.93&0.83&0.38\\\hline
\textbf{row 3}&0.15&0.35&0.59&0.57\\\hline
\textbf{row 4}&0.26&0.20&0.55&0.08\\\hline
\textbf{row 5}&0.84&0.25&0.92&0.05\\\hline
\textbf{row 6}&0.25&0.62&0.29&0.53\\\hline
\textbf{row 7}&0.81&0.47&0.76&0.78\\\hline
\end{tabular}
\end{tiny}

% Mat2_out.tex

\begin{tiny}\begin{tabular}{|l|c|c|c|c|}
\hline
&\textbf{col 1}&\textbf{col 2}&\textbf{col 3}&\textbf{col 4}\\\hline
\textbf{row 1}&0.93&0.79&0.69&0.83\\\hline
\textbf{row 2}&0.13&0.31&0.75&0.54\\\hline
\textbf{row 3}&0.57&0.53&0.45&1.00\\\hline
\textbf{row 4}&0.47&0.17&0.08&0.08\\\hline
\textbf{row 5}&0.01&0.60&0.23&0.44\\\hline
\textbf{row 6}&0.34&0.26&0.91&0.11\\\hline
\textbf{row 7}&0.16&0.65&0.15&0.96\\\hline
\end{tabular}
\end{tiny}

% latextable2.tex

\begin{table}
    \begin{tabular}{|l|}
        \hline
        MTab1\\ \hline
        Matb2 \\
        \hline
    \end{tabular}
\end{table}
2
  • I am not sure exactly what you want, but does this output what you desire: \begin{tabular}{l l l} MTab1 & \input{./Mat1_out.tex} & \input{./Mat2_out.tex}\MTab2 & \input{./Mat1_out.tex} & \input{./Mat2_out.tex}\\end{tabular}? Commented Dec 22, 2012 at 20:06
  • @ Peter Grill thanx very much. I adopted your code. You can see edited version. Now only thing left is to make caption center and get main table (rectangle/frame)around all tables and there should no gap between colume 2&3.
    – user31177
    Commented Dec 22, 2012 at 20:19

1 Answer 1

4

Here is a version discussed in the comments with a frame and caption added. Not sure I really like it but think it is what was asked for:

enter image description here

To eliminate the gap between columns 2 and 3, the @{} column specification was added to remove the \tabcolsep that gets added in between columns. This also necessitated the addition of a trailing % in the sub tables to eliminate the spurious space that would otherwise be introduced.

Code:

\documentclass[pdftex,12pt,a4paper]{report}
\usepackage{lscape}

\usepackage{filecontents}
\begin{filecontents*}{latextable2.tex}
\begin{table}
    \begin{tabular}{|l|}
        \hline
        MTab1\\ \hline
        Matb2 \\
        \hline
    \end{tabular}
\end{table}
\end{filecontents*}

\begin{filecontents*}{Mat1_out.tex}
\begin{tiny}\begin{tabular}{|l|c|c|c|c|}
\hline
&\textbf{col 1}&\textbf{col 2}&\textbf{col 3}&\textbf{col 4}\\\hline
\textbf{row 1}&0.55&0.24&0.35&0.75\\\hline
\textbf{row 2}&0.14&0.93&0.83&0.38\\\hline
\textbf{row 3}&0.15&0.35&0.59&0.57\\\hline
\textbf{row 4}&0.26&0.20&0.55&0.08\\\hline
\textbf{row 5}&0.84&0.25&0.92&0.05\\\hline
\textbf{row 6}&0.25&0.62&0.29&0.53\\\hline
\textbf{row 7}&0.81&0.47&0.76&0.78\\\hline
\end{tabular}%
\end{tiny}%
\end{filecontents*}

\begin{filecontents*}{Mat2_out.tex}
\begin{tiny}\begin{tabular}{|l|c|c|c|c|}
\hline
&\textbf{col 1}&\textbf{col 2}&\textbf{col 3}&\textbf{col 4}\\\hline
\textbf{row 1}&0.93&0.79&0.69&0.83\\\hline
\textbf{row 2}&0.13&0.31&0.75&0.54\\\hline
\textbf{row 3}&0.57&0.53&0.45&1.00\\\hline
\textbf{row 4}&0.47&0.17&0.08&0.08\\\hline
\textbf{row 5}&0.01&0.60&0.23&0.44\\\hline
\textbf{row 6}&0.34&0.26&0.91&0.11\\\hline
\textbf{row 7}&0.16&0.65&0.15&0.96\\\hline
\end{tabular}%
\end{tiny}%
\end{filecontents*}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

\begin{document}
\begin{landscape}

\begin{table}
\centering\renewcommand{\arraystretch}{1.2}%
\begin{tabular}{| l@{} l@{} l@{}|}\hline
MTab1 & \input{./Mat1_out.tex} & \input{./Mat2_out.tex}\\
MTab2 & \input{./Mat1_out.tex} & \input{./Mat2_out.tex}\\\hline
\end{tabular}
\caption{Caption for main table}
\end{table}

\end{landscape}
\end{document}
1
  • +1 although I'd put the caption above the tabular :)
    – cmhughes
    Commented Dec 22, 2012 at 23:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .