Graphics, Figures & TablesProblem with multirow

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
margor
Posts: 2
Joined: Sat May 01, 2010 12:33 pm

Problem with multirow

Post by margor »

Hello,
I'm LaTeX newbie and it would be nice to make use of this interesting tool. I try to prepare a table and wrote the fallowing code:

Code: Select all

\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|} \hline
 Nr rdzenia & & & & & & & & R [$k\Omega$] & V $[cm^3]$\\ \hline
 \multirow{5}{*}{1} & f & Hz & 30 & 50 & 100 & 200  & & \multirow{5}{*}{4,3} & \multirow{5}{*}{5,654}\\
		    & $S_x$ & V/dz. & 200 & 2 & 2 & 2 & \\
		    & $S_y$ & V/dz. & 50 & 50 & 50 & 50 & \\
		    & $A$ & $dz.^2$ & 8,21 & 8,94 & 10,09 & 11,50 \\
		    & W & $Ws/cm^3$ &      &      &       & \\ \hline
 \multirow{5}{*}{2} & f & Hz & 30 & 50 & 100 & 200 & 500 & \multirow{5}{*}{6,8} & \multirow{5}{*}{6,927}\\
		    & $S_x$ & V/dz. & 100 & 100 & 100 & 100 & 199 \\
		    & $S_y$ & V/dz. & 10 & 10 & 10 & 10 &  10\\
		    & $A$ & $dz.^2$ & 5,13 & 7,49 & 13,58 & 30,30 & 47,38 \\
		    & W & $Ws/cm^3$ &      &      &       & \\ \hline
 \multirow{5}{*}{7} & f & Hz & 50 & 200 & 500 & 1000 & 2000 &\multirow{5}{*}{2,2} & \multirow{5}{*}{4,709}\\
		    & $S_x$ & V/dz. & 200 & 200 & 200 & 200 & 200 \\
		    & $S_y$ & V/dz. & 20 & 20 & 50 & 20 & 20 \\
		    & $A$ & $dz.^2$ & 8,81 & 9,15 & 170 & 12,87 & 14,89 \\
		    & W & $Ws/cm^3$ &      &      &       & \\ \hline
\end{tabular}
As you can see the lines (last 3 columns) are not driven properly. I don't understand why. I included \usepackage{multirow}.

Thanks for your replies,
Attachments
attach.pdf
(72.37 KiB) Downloaded 209 times

Recommended reading 2024:

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

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

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

Problem with multirow

Post by php1ic »

If you look at the very first column of your example, which works as you want, you have left blank cells in the lines used by the \multirow command. At the end of the lines however you have not left enough empty cells so the table isn't drawn properly.

\multirow doesn't create the cells needed, it simply expands a single cell that is the required number of rows high. The code below does what you want.

Code: Select all

\documentclass[a4paper]{article}

\usepackage{multirow}

\begin{document}

\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|}
\hline
Nr rdzenia         &       &           &      &      &       &       & 	   & R [$k\Omega$]        & V $[cm^3]$\\
\hline
\multirow{5}{*}{1} & f     & Hz        & 30   & 50   & 100   & 200   & 	   & \multirow{5}{*}{4,3} & \multirow{5}{*}{5,654}\\
          	      & $S_x$ & V/dz.     & 200  & 2    & 2     & 2     & 	   &                      &                       \\
          	      & $S_y$ & V/dz.     & 50   & 50   & 50    & 50    & 	   &                      &                       \\
          	      & $A$   & $dz.^2$   & 8,21 & 8,94 & 10,09 & 11,50 & 	   &                      &                       \\
          	      & W     & $Ws/cm^3$ &      &      &       &       & 	   &                      &                       \\
\hline
\multirow{5}{*}{2} & f     & Hz        & 30   & 50   & 100   & 200   & 500   & \multirow{5}{*}{6,8} & \multirow{5}{*}{6,927}\\
          	      & $S_x$ & V/dz.     & 100  & 100  & 100   & 100   & 199   &                      &                       \\
          	      & $S_y$ & V/dz.     & 10   & 10   & 10    & 10    & 10    &               	    &                       \\
          	      & $A$   & $dz.^2$   & 5,13 & 7,49 & 13,58 & 30,30 & 47,38 &               	    &                       \\
          	      & W     & $Ws/cm^3$ &      &      &       &       &       &               	    &                       \\
\hline
\multirow{5}{*}{7} & f     & Hz        & 50   & 200  & 500   & 1000  & 2000  &\multirow{5}{*}{2,2}  & \multirow{5}{*}{4,709}\\
          	      & $S_x$ & V/dz.     & 200  & 200  & 200   & 200   & 200   &              	     &                       \\
          	      & $S_y$ & V/dz.     & 20   & 20   & 50    & 20    & 20    &              	     &                       \\
          	      & $A$   & $dz.^2$   & 8,81 & 9,15 & 170   & 12,87 & 14,89 &              	     &                       \\
          	      & W     & $Ws/cm^3$ &      &      &       &       &       &              	     &                       \\
\hline
\end{tabular}
\end{document}
margor
Posts: 2
Joined: Sat May 01, 2010 12:33 pm

Re: Problem with multirow

Post by margor »

Thanks.
Post Reply