Graphics, Figures & Tablesproblem in tables

Information and discussion about graphics, figures & tables in LaTeX documents.
rajini
Posts: 64
Joined: Mon Mar 22, 2010 2:27 pm

problem in tables

Post by rajini »

Hello all,
I want to make a table, which contains 6 columns. Now i want to make last 3 rows of that table to have only 4 columns with the text in 4th column common for the last 3 rows.

Code: Select all

\begin{table}[!t]
\caption{Assignments of DFT calculated wavenumbers.}\label{tab:1stas}
\vspace{3mm}
\centering
\begin{tabular}[width=1\linewidth]{lccccl}
\hline\hline
Experimental & FC from     & $e_j^2$ & DFT calculated & FC from      & Mode description\\[0ex]
wavenumber   & NIS         &         & wavenumber     & DFT          & \\[0ex]
[cm$^{-1}$]  &[N~m$^{-1}$] &         & [cm$^{-1}$]    & [N~m$^{-1}$] & \\[0ex]
\hline
\multirow{3}{*}{390.9} & \multirow{3}{*}{79.08}& \multirow{3}{*}{0.45} & 394.5 & 68.97 & Breathing mode, $A_1^{\prime}$\\ 
& &                                                                    & 400.1 & 82.27 & Breathing mode, $A_1^{\prime}$\\
& &                                                                    & 410.6 & 90.86 & $A_2^{\prime\prime}$\\
\hline
446.8 & 27.27 & 0.10 &&&\\
538.4 & 3.29  & 0.01 &&&\\
595.7 & 43.99 & 0.13 &&&\\
\hline\hline
\end{tabular}
\end{table}
For e.g., in the above code, I want to write some text after 0.10 (3rd from last row) so that the text is valid the last 3 rows.
Also i dont know how to use parbox here..I need only 4 columns in last 3 rows and the 4th column should be common for the last 3 rows.
thanks for your reply, rajini

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

problem in tables

Post by gmedina »

Hi,

you could use a \parbox inside a \multirow inside a \multicolumn; a little example:

Code: Select all

\documentclass{book}
\usepackage{multirow}

\begin{document}

\begin{table}[!t]
\caption{Assignments of DFT calculated wavenumbers.}\label{tab:1stas}
\vspace{3mm}
\centering
\begin{tabular}[width=1\linewidth]{lccccl}
\hline\hline
Experimental & FC from     & $e_j^2$ & DFT calculated & FC from      & Mode description\\[0ex]
wavenumber   & NIS         &         & wavenumber     & DFT          & \\[0ex]
[cm$^{-1}$]  &[N~m$^{-1}$] &         & [cm$^{-1}$]    & [N~m$^{-1}$] & \\[0ex]
\hline
\multirow{3}{*}{390.9} & \multirow{3}{*}{79.08}& \multirow{3}{*}{0.45} & 394.5 & 68.97 & Breathing mode, $A_1^{\prime}$\\ 
& &                                                                    & 400.1 & 82.27 & Breathing mode, $A_1^{\prime}$\\
& &                                                                    & 410.6 & 90.86 & $A_2^{\prime\prime}$\\
\hline
446.8 & 27.27 & 0.10 & \multicolumn{3}{c}{\multirow{3}{*}{\parbox{5cm}{text text text text text text text text text text text text}}}\\
538.4 & 3.29  & 0.01 &&&\\
595.7 & 43.99 & 0.13 &&&\\
\hline\hline
\end{tabular}
\end{table}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
rajini
Posts: 64
Joined: Mon Mar 22, 2010 2:27 pm

Re: problem in tables

Post by rajini »

He gmedina,
thanks it solved my problem. I can live with what you gave..
Just to improve a bit i am asking one more.
How to make this parbox such that the test inside it would start exactly from the 4th column of 1st row. I.e. 1st row's 4th column and last 3 rows's column are exactly in a same line ?
Rajini
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

problem in tables

Post by gmedina »

rajini wrote:He gmedina,
...How to make this parbox such that the test inside it would start exactly from the 4th column of 1st row. I.e. 1st row's 4th column and last 3 rows's column are exactly in a same line ?..
Change the first mandatory argument of the \parbox command from 5cm (the value that I used in my example) to the appropriate value.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
rajini
Posts: 64
Joined: Mon Mar 22, 2010 2:27 pm

Re: problem in tables

Post by rajini »

All right, Now it is fine.
But Those text is more! So when i include more text, then the last line is going out of the table. How can i correct it?
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

problem in tables

Post by gmedina »

Add more rows:

Code: Select all

\documentclass{book}
\usepackage{multirow}

\begin{document}

\begin{table}[!t]
\caption{Assignments of DFT calculated wavenumbers.}\label{tab:1stas}
\vspace{3mm}
\centering
\begin{tabular}[width=1\linewidth]{lccccl}
\hline\hline
Experimental & FC from     & $e_j^2$ & DFT calculated & FC from      & Mode description\\[0ex]
wavenumber   & NIS         &         & wavenumber     & DFT          & \\[0ex]
[cm$^{-1}$]  &[N~m$^{-1}$] &         & [cm$^{-1}$]    & [N~m$^{-1}$] & \\[0ex]
\hline
\multirow{3}{*}{390.9} & \multirow{3}{*}{79.08}& \multirow{3}{*}{0.45} & 394.5 & 68.97 & Breathing mode, $A_1^{\prime}$\\ 
& &                                                                    & 400.1 & 82.27 & Breathing mode, $A_1^{\prime}$\\
& &                                                                    & 410.6 & 90.86 & $A_2^{\prime\prime}$\\
\hline
&&& \multicolumn{3}{c}{\multirow{5}{*}{\parbox{7.6cm}{text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text}}}\\
446.8 & 27.27 & 0.10 & \\
538.4 & 3.29  & 0.01 &&&\\
595.7 & 43.99 & 0.13 &&&\\
&&&&\\
\hline\hline
\end{tabular}
\end{table}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
rajini
Posts: 64
Joined: Mon Mar 22, 2010 2:27 pm

Re: problem in tables

Post by rajini »

Hi I did already. But it is not nice. Since one row is more for the text, the last line appears separately. The row is empty for the last line. Is it possible to center them?
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

problem in tables

Post by gmedina »

rajini wrote:Hi I did already. But it is not nice. Since one row is more for the text, the last line appears separately. The row is empty for the last line. Is it possible to center them?
Please tell us exactly how many lines of text are there going to be.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
rajini
Posts: 64
Joined: Mon Mar 22, 2010 2:27 pm

Re: problem in tables

Post by rajini »

3 rows of data. And the text will be 4 rows.
thanks
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

problem in tables

Post by gmedina »

You can do manual adjustments using the optional argument of the command for change of line (//). Try this:

Code: Select all

\documentclass{book}
\usepackage{multirow}

\begin{document}

\begin{table}[!t]
\caption{Assignments of DFT calculated wavenumbers.}\label{tab:1stas}
\vspace{3mm}
\centering
\begin{tabular}[width=1\linewidth]{lccccl}
\hline\hline
Experimental & FC from     & $e_j^2$ & DFT calculated & FC from      & Mode description\\[0ex]
wavenumber   & NIS         &         & wavenumber     & DFT          & \\[0ex]
[cm$^{-1}$]  &[N~m$^{-1}$] &         & [cm$^{-1}$]    & [N~m$^{-1}$] & \\[0ex]
\hline
\multirow{3}{*}{390.9} & \multirow{3}{*}{79.08}& \multirow{3}{*}{0.45} & 394.5 & 68.97 & Breathing mode, $A_1^{\prime}$\\ 
& &                                                                    & 400.1 & 82.27 & Breathing mode, $A_1^{\prime}$\\
& &                                                                    & 410.6 & 90.86 & $A_2^{\prime\prime}$\\
\hline\\[-15pt]
&&& \multicolumn{3}{c}{\multirow{5}{*}{\parbox{7.6cm}{text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text}}}\\
446.8 & 27.27 & 0.10 & \\
538.4 & 3.29  & 0.01 &&&\\
595.7 & 43.99 & 0.13 &&&\\[9pt]
\hline\hline
\end{tabular}
\end{table}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply