Graphics, Figures & TablesHelp in table formatting

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

Help in table formatting

Post by rajini »

Hello all,
i am new here.
Is there a way in latex to create a table...
for e.g., if you compile the following code

Code: Select all

\begin{table}[b!]
\caption{Numbering scheme.}\label{tab:sam}
\vspace{3mm}
\centering
\begin{tabular}[width=1\textwidth]{l|p{59mm}|p{65mm}}
\hline\hline
Sample & Compounds & Remarks \\
No.\ & &\\
\hline
1   & some thing  & solid/powder      \\
2   & sample~1    & prepared in open  \\
3   & sample~2    & prepared in frozen\\
\hline
7   & 1~min       &                   \\
8   & 5~min       &                   \\
9   & 30~min      &                   \\
\hline\hline
\end{tabular}
\end{table}
you will get the a table...but for the no. 7, 8 and 9 i need only one column. I.e., after the command \hline (after 3), i need 3 columns. And 3 rows for the for 7, 8 and 9. But for 3rd column i need only one row. Which means i need to write some thing there which belong to 7, 8 and 9.
I hope some one can help..
thanks
Rajini

Recommended reading 2024:

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

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

php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

Re: Help in table formatting

Post by php1ic »

rajini
Posts: 64
Joined: Mon Mar 22, 2010 2:27 pm

Re: Help in table formatting

Post by rajini »

Yes i already noticed it..
All deals with multirow, each row is same for all columns..
but my case is different..
or is it possible with latex??
if you know please help me..other wise just leave (i am here for free help)..may be some one will help
thanks..
php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

Help in table formatting

Post by php1ic »

The row is not the same for all columns, there is only one row that expands over all of the columns.

I don't understand what you want could you make a basic example something like this

Code: Select all

------------------
|  A  |  B  |  C  |
------------------
|  1  |  2  |     |
-------------    
|  3  |  4  |  7  |
-------------     
|  5  |  6  |     |
------------------
rajini
Posts: 64
Joined: Mon Mar 22, 2010 2:27 pm

Re: Help in table formatting

Post by rajini »

Exactly that is what i need!
How can i do it???

thanks
PS: without horizontal dashes!
php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

Help in table formatting

Post by php1ic »

Code: Select all

\documentclass[a4paper]{article}

\usepackage{multirow}

\begin{document}

\begin{tabular}{|c|c|c|}
\hline
A&B&C\\
\hline
1&2&\multirow{3}{*}{7}\\
3&4&\\
5&6&\\
\hline
\end{tabular}

\end{document}
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Help in table formatting

Post by gmedina »

php1ic wrote:

Code: Select all

\documentclass[a4paper]{article}

\usepackage{multirow}

\begin{document}

\begin{tabular}{|c|c|c|}
\hline
A&B&C\\
\hline
1&2&\multirow{3}{*}{7}\\
3&4&\\
5&6&\\
\hline
\end{tabular}

\end{document}
I just wanted to mention than the above layout doesn't require the multirow package:

Code: Select all

\documentclass{article}

\begin{document}

\begin{tabular}{|c|c|c|}
  \hline
  A&B&C\\
  \hline
  1&2&\\
  3&4&7\\
  5&6&\\
  \hline
\end{tabular}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

Re: Help in table formatting

Post by php1ic »

:oops: Can't believe I missed that!

Sometimes you just can't see the wood for the trees :)
rajini
Posts: 64
Joined: Mon Mar 22, 2010 2:27 pm

Re: Help in table formatting

Post by rajini »

Hi both of you,
sorry i cannot succeed in making the table...!
I need similar like table shown by php1ic,..but that '7' in my case is a sentence..And i want that sentence to occupy and spread in that whole cell, which is allocated for '7'..But when i use your code..that sentence only belongs to the middle row!!!
thanks for your effort and help
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Help in table formatting

Post by gmedina »

THen you could try something like the following:

Code: Select all

\documentclass[a4paper]{article}
\usepackage{multirow}

\begin{document}

\begin{tabular}{|c|c|c|}
  \hline
  A&B&C\\
  \hline
  1&2&\multirow{3}{*}{\parbox{6cm}{text text text text text text text text text text text 
    text text text text text text text text}}\\
  3&4&\\
  5&6&\\
\hline
\end{tabular}

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