[Tex/LaTex] Using multicolumn and multirow together with spreadtab

calculationsmulticolumnmultirowtables

I tried this piece down

\documentclass[a4paper,12pt]{article}
\usepackage[inner=0.75in,outer=0.65in,top=0.75in,bottom=0.65in]{geometry}
\usepackage{multirow}
\usepackage{spreadtab}
\usepackage[sc]{mathpazo}
\usepackage[onehalfspacing]{setspace}
\begin{document}
\begin{table}[!htb]
\centering
\caption{Sample} \vspace{3pt}
\begin{spreadtab}{{tabular}{|c|l|l|c|c|c|c|c|c|}}
\hline
@\multirow{2}{*}{Sl No.} & 
@\multicolumn{2}{|c}{\multirow{2}{*}{\textbf{something}}} & 
@\multicolumn{4}{|c}{\textbf{s}} & 
@\textbf{a~/~b} & 
@\multirow{2}{*}{\textbf{Total}} \\ \cline{3-6}
&  &  & @\textbf{x} & @\textbf{y} & @\textbf{z} & @\textbf{m} & 
@\textbf{/~c} & \\ \hline
@\multirow{2}{*}{1} & @1 \& & @x & & & & 1 & & 
\STcopy{v}{d3+e4+f4+g4+h4}\\ \cline{1-1} \cline{3-9}
& @Safety & @\textbf{Sub Total} & {\fontseries{b}\selectfont}\Stcopy{>}{d3}    &
\textbf{:={}} & \textbf{:={}} & \textbf{:={}} & \textbf{: ={}} & \textbf{:={}} 
\\ \hline

\end{spreadtab}
\label{tab:tofisa}
\end{table}
\end{document}

Is there any alternate method to do the same?

Can \multicolumn and \multirow be used as above with spreadtab???

Best Answer

\multicolumn and \multirow can certainly be used in such a table. I am not sure what your table is trying to achieve/display but here is a slightly cut-down version:

Sample output

\documentclass[a4paper,12pt]{article}

\usepackage[inner=0.75in,outer=0.65in,top=0.75in,bottom=0.65in]{geometry}
\usepackage{multirow}
\usepackage{spreadtab}
\usepackage[sc]{mathpazo}
\usepackage[onehalfspacing]{setspace}

\begin{document}

\begin{table}[htp]
  \centering
  \caption{Sample} \vspace{3pt}
  \begin{spreadtab}{{tabular}{|c|l|l|c|c|c|c|c|c|}}
    \hline
    @\multirow{2}{*}{Sl No.} &
    @\multicolumn{2}{c}{\multirow{2}{*}{\textbf{something}}} &
    @\multicolumn{4}{|c|}{\textbf{s}} & @\textbf{a~/~b} &
    @\multirow{2}{*}{\textbf{Total}} \\
    \cline{4-7}
    & @\multicolumn{2}{|c|}{} & @\textbf{x} & @\textbf{y} & @\textbf{z}
    & @\textbf{m} & @\textbf{/~c} & \\ 
    \hline
    @\multirow{2}{*}{1} & @1 \& & @x &2 &3 &2 & 1 & 3&
    \STcopy{v}{d3+e3+f3+g3}
    \\
    \cline{3-9}
    & @Safety & @\textbf{Sub Total} & 3 & 3 & 9 & 7 &3 & \\ \hline
    @\multirow{2}{*}{2} & @2 \& & @x &6 &3 &5 & 1 & 3&
    \\
    \cline{3-9}
    & @Safety & @\textbf{Sub Total} & 2 & 10 & 1 & 7 &3 & \\ \hline
  \end{spreadtab}
  \label{tab:tofisa}
\end{table}

\end{document}

When using \multirow make sure that there are corresponding empty cells in the rows below.

Your original code contains at least one syntax error \Stcopy should be \STcopy. Also beware of := and its special syntax etc. I think these entries were causing the main problems.