General ⇒ help with table (multirow)
-
- Posts: 22
- Joined: Fri May 18, 2007 6:48 pm
help with table (multirow)
Can someone please help me?
I'm having some difficulties to build up a table, it should look like this:
__________
|_|___|__|
|_|___|__|
It's a regular column, then a 2 row column, and then another regular column.
Hope I've been clear enough, if not, please tell me.
Thank you
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Re: help with table (multirow)
If that is the case, either choose the widths (e.g. p(15mm) and p(30mm) but the content will appear as a paragraph. Or you choose the total width of your table, and use the tabularx environment; every column of X type will have a width equal to total width:number of columns; and you still can have columns of width equal to a fixed fraction of the X width (with certain limitations, see the doc of tabularx).
Hope I've been reasonably clear. If not, you should be more precise as for your requirements.
Regards,
B.A.
-
- Posts: 22
- Joined: Fri May 18, 2007 6:48 pm
help with table (multirow)
Sorry if I haven't been clear. What I mean is a table like this:

How can I do that?
Thank you
Re: help with table (multirow)
Here's a sample based on your example:
\newcolumntype{C}{>{\centering}p{12mm}@{}}
\begin{tabular}{|C|c|C|C|}
\hline%
1A &\multirow{2}{12mm}{\centering W} & 1 & 2 \tabularnewline
\cline{1-1} \cline{3-4}%
2A & & 2 & 6 \tabularnewline
\hline%
1B& \multirow{2}{12mm}{X} & 3 & 7 \tabularnewline
\cline{1-1} \cline{3-4}%
2B && 4& 8 \tabularnewline
\hline%
\end{tabular}
I had to inser \tabularnewline rather than \\ at the end of the rows because of an error message in the latter case (a conflict with multirow?).
You also should look at a new package called makecell, whch "eases the use of multirow", according to its author, and extends the possibilities.
Regards,
B.A.
- countbela666
- Posts: 64
- Joined: Thu Apr 26, 2007 2:44 pm
help with table (multirow)
This is a side effect of the array package, as it redefines the \\ command. When trying to use an own column type that uses the >{...} or <{...} constructions as last column of a tabular environment you will get an error. You can avoid this either by using \tabularnewline to enter a line break or by including \arraybackslash into your column type definition:balfonsi wrote: I had to inser \tabularnewline rather than \\ at the end of the rows because of an error message in the latter case (a conflict with multirow?).
Code: Select all
\newcolumntype{C}{>{\centering\arraybackslash}p{12mm}}
Regards
Marcel
a thousand worlds for you to see here, take my hand and follow me...
Re: help with table (multirow)
B.A.
- countbela666
- Posts: 64
- Joined: Thu Apr 26, 2007 2:44 pm
Re: help with table (multirow)
Regards
Marcel
a thousand worlds for you to see here, take my hand and follow me...
Re: help with table (multirow)
B.A.