[Tugindia] Doubts on tables

E. Krishnan ekmath at md5.vsnl.net.in
Mon Apr 14 08:29:52 CEST 2003


On Sun, 13 Apr 2003, Vimal Joseph wrote:

> I have some doubts regarding
> creation of tables. I'll try to draw the table here.

In all your tables you have entries spanning multiple rows for which you 
have to use the "multirow" package. With this package loaded, the first 
two rows of Fig1. can be drawn as follows:

	\renewcommand{\multirowsetup}{\centering}
	\renewcommand{\arraystretch}{1.2}

	\newlength{\flen}
        \settowidth{\flen}{F3}


	\begin{tabular}{|c|*{3}{lr|}c|}
  	\hline
  	& \multicolumn{2}{c|}{D1} 
  	& \multicolumn{2}{c|}{D2} 
  	& \multicolumn{2}{c|}{D3}  
  	& Inv\\
  	\hline
  	\multirow{2}{\flen}{F1} 
  	& & 
  	& \multicolumn{1}{l|}{1} & & & 
  	& \multirow{2}{\flen}{10}\\
  	\cline{4-4}
  	& & 1 & & 5 & & 10 & \\
  	\hline
	\end{tabular}

The remaining rows are similar to the last row above. The second table is 
similar to the first.

To cretae  vertically running text you can use the package "rotating". 
With this loaded in the preamble, the first few rows of Fig3. can be done 
by

	\newlength{\vlen}
	\settowidth{\vlen}{V}

	\begin{tabular}{*{4}{|c}|}
  	\cline{3-4}
  	\multicolumn{2}{c}{}
  	& \multicolumn{2}{|c|}{Horiz}\\
  	\cline{3-4}
  	\multicolumn{2}{c|}{} & a & b\\
 	 \hline
  	\multirow{2}{\vlen}{\begin{sideways}Ver\end{sideways}} 
  	& c & d & e\\
  	\cline{2-4}
  	& f & g & h\\
  	\hline
	\end{tabular} 

The fourth table is similar to this. 

Please read the fifth chapter of LaTeX Comapanion thoroughly, if you want 
to create complex tables.


-- 
Krishnan




More information about the Tugindia mailing list