Graphics, Figures & TablesMultirow with sideways text in table

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
dmuthu_cse
Posts: 97
Joined: Fri Sep 04, 2009 4:56 pm

Multirow with sideways text in table

Post by dmuthu_cse »

Hello friends,

I am trying to create a table, where it includes sideways text, multirow and multicolumn. But it seems that multirow is not working with sideways text.

I have tried MWE, please go through and tell me know your suggestions. The required table is available in PDF.

Code: Select all

\documentclass[10.5pt,english]{book}
\usepackage{fancybox,array,amsmath,amssymb,babel}
\usepackage[centering,
  headheight=14pt,
  headsep=10pt,
  includehead,
  papersize={18cm,24cm},
  text={15.25cm,19.2cm},
  dvips=false,
  pdftex=false,
  vtex=false]{geometry}
\usepackage[cam,a4,center,dvips]{crop}
\usepackage{graphicx,colortbl,textcomp,wrapfig}
\usepackage{fancyhdr,setspace,rotating}
\usepackage{ltxtable,tabularx,booktabs,multirow,dcolumn}

\begin{document}


\begin{table}[!ht]
\begin{tabular}{|l|l|l|l|l|l|l|l|l|c|c|c|c|c|c|}
\hline 
\multicolumn{15}{|c|}{\textbf{Pay Roll}}\tabularnewline
\multicolumn{15}{|l|}{Department: xxx\hfill Period Ending: xxx }\tabularnewline
\hline 
\begin{sideways}
\multirow{2}*{\textbf{Name }}%
\end{sideways} & \begin{sideways}
\multirow{2}*{\textbf{Worker Number}}%
\end{sideways} & \begin{sideways}
\multirow{2}*{\textbf{Wage rate}}%
\end{sideways} & \begin{sideways}
\multirow{2}*{\textbf{Total Hours}}%
\end{sideways} & \begin{sideways}
\multirow{2}*{\textbf{Overtime Hours}}%
\end{sideways} & \begin{sideways}
\multirow{2}*{\textbf{Wage}}%
\end{sideways} & \begin{sideways}
\multirow{2}*{\textbf{D.A.}}%
\end{sideways} & \begin{sideways}
\multirow{2}*{\textbf{Other allowances}}%
\end{sideways} & \begin{sideways}
\multirow{2}*{\textbf{Gross wages}}%
\end{sideways} & \multicolumn{5}{c|}{\textbf{Deductions}} & \multirow{2}*{\textbf{Net Wages}}\tabularnewline
\cline{10-14} 

 &  &  &  &  &  &  &  &  & \begin{sideways}
\textbf{ESI}%
\end{sideways} & \begin{sideways}
\textbf{PF}%
\end{sideways} & \begin{sideways}
\textbf{IT}%
\end{sideways} & \begin{sideways}
\textbf{Others}%
\end{sideways} & \begin{sideways}
\textbf{Total Deductions}%
\end{sideways} & \tabularnewline \hline 

 &  &  &  &  &  &  &  &  &  &  &  &  &  & \tabularnewline
\hline 
\textbf{Total} &  &  &  &  &  &  &  &  &  &  &  &  &  & \tabularnewline
\hline 
\multicolumn{15}{|l|}{Prepared by : xxx\hfill{}Checked by : xxx}\tabularnewline
\hline
\end{tabular}
\end{table}

\end{document}
Regards,
Muthu
Attachments
m.pdf
(15.02 KiB) Downloaded 614 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Multirow with sideways text in table

Post by gmedina »

Hi, Muthu

instead of the sideways environment I'd rather use a \rotatebox command (from graphicx). I did some other changes to the table (and you can still make some final adjustments):

Code: Select all

\documentclass[english]{book}
\usepackage{fancybox,array,amsmath,amssymb,babel}
\usepackage[centering,
  headheight=14pt,
  headsep=10pt,
  includehead,
  papersize={18cm,24cm},
  text={15.25cm,19.2cm},
  dvips=false,
  pdftex=false,
  vtex=false]{geometry}
\usepackage[cam,a4,center,dvips]{crop}
\usepackage{graphicx,colortbl,textcomp,wrapfig}
\usepackage{fancyhdr,setspace,rotating}
\usepackage{ltxtable,tabularx,booktabs,multirow,dcolumn}

\begin{document}

\begin{table}[!ht]
  \renewcommand\tabcolsep{7pt}
  \renewcommand\arraystretch{1.3}
  \begin{tabular}{|l|l|l|l|l|l|l|l|l|c|c|c|c|c|c|}
  \hline 
  \multicolumn{15}{|c|}{\textbf{Pay Roll}}\tabularnewline
  \multicolumn{15}{|l|}{Department: xxx\hfill Period Ending: xxx }
  \tabularnewline\hline
  &&&&&&&&& \multicolumn{5}{c|}{\textbf{Deductions}} &
  \tabularnewline\cline{10-14} 
  \rotatebox{90}{\multirow{3}{*}{\textbf{Name }}}%
  & \rotatebox{90}{\textbf{Worker Number}}%
  & \rotatebox{90}{\textbf{Wage rate}}%
  & \rotatebox{90}{\textbf{Total Hours}}%
  & \rotatebox{90}{\textbf{Overtime Hours}}%
  & \rotatebox{90}{\textbf{Wage}}%
  & \rotatebox{90}{\textbf{D.A.}}%
  & \rotatebox{90}{\textbf{Other allowances}}%
  & \rotatebox{90}{\textbf{Gross wages}}%
  & \rotatebox{90}{\textbf{ESI}}%
  & \rotatebox{90}{\textbf{PF}}%
  & \rotatebox{90}{\textbf{IT}}%
  & \rotatebox{90}{\textbf{Others}}%
  & \rotatebox{90}{\textbf{Total Deductions\phantom{a}}}%
  & \multirow{-8}{*}{\textbf{Net Wages}}
  \tabularnewline\hline 
  \textbf{Total} &  &  &  &  &  &  &  &  &  &  &  &  &  & 
  \tabularnewline\hline 
  \multicolumn{15}{|l|}{Prepared by : xxx\hfill{}Checked by : xxx}
  \tabularnewline\hline
  \end{tabular}
\end{table}

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