1

enter image description here

Here is my table and I want to change rows column i.e., all heading which is written in the column and same division of columns into rows. Kindly help me out.

\begin{table*}
\centering
\setlength\extrarowheight{2pt}
\begin{tabular}{|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|}
\hline
t&\multicolumn{3}{c}{SH}&\multicolumn{3}{|c|}{SH}&\multicolumn{3}{|c|}{MH }&\multicolumn{3}{|c|}{MH}\\ \cline{2-13}
           &&&Difference&&Difference&&&Difference&&&Differences\\ \cline{2-13}
Unschedule     &5.01  & ---    &---& 5.01&--- &---&22.46&---&---& 24.54  &--- &\\
            &4.31  &13.97\%&0.7&4.68&6.58\%&0.33&12.78 &43.09\%&11.78 &13.92&43.27\%&10.62\\
            &3.24  &35.32\%&1.77&3.48&30.53\%&1.53&14.70&34.55\%&9.84&12.98&47.10\%&11.56\\
             &3.73  &25.54\%&1.28&3.64 &27.34\%&1.37&12.70&43.45\%&11.48&14.01&42.66\%&10.53\\
           &3.09  &38.32\%&1.92&3.13 &37.52\%& 1.88&11.73&47.77\%&12.78&12.01&50.08\%&12.53\\ \hline
\end{tabular}
\end{table*}
9
  • 2
    Welcome to TeX SX! Do you mean you want to swap rows and columns? – Bernard Jul 8 '17 at 12:29
  • 1
    yes! and instead of partitions in columns as shown in 2nd, 3rd, 4th and 5th columns it should be in rows in 2nd, 3rd, 4th and 5th columns. – Smith Jul 8 '17 at 13:22
  • Could you post a complete code? – Bernard Jul 8 '17 at 13:29
  • I have posted bernard! – Smith Jul 8 '17 at 13:47
  • That's not a full compilable code. Are you in two-column mode? – Bernard Jul 8 '17 at 13:51
1

Here's a way to do it. I replaced most of the p{1cm} columns with S columns, from siunitx to ensure column alignments on the decimal dot:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe, a4paper]{geometry}
\usepackage{array, booktabs, multirow, siunitx}

\begin{document}

\begin{table*}
\centering\sisetup{table-format=2.2, table-space-text-post = {\,\%}}
\setlength\extrarowheight{2pt}
\begin{tabular}{|c|c|*{5}{S|}}
 \multicolumn{1}{c}{t} & \multicolumn{6}{c}{Unschedule}\\[2pt]
 \hline
\multirow{3}{*}{SH} & & 5.01 &4.31 & 3.24 & 3.73 &3.09 \\
 & & {—} &13.97 \,\% &35.32 \,\% &25.54 \,\% &38.32 \,\% \\
& Difference & {—} & 0.7 & 1.77 &1.28 &1.92 \\
 \hline
\multirow{3}{*}{SH} & & 5.01 &4.68 & 3.48 &3.64 &3.13 \\
 & & {—} & 6.58 \,\% & 30.53 \,\% &27.34 \,\% &37.52 \,\% \\
  & Difference & {—} &0.33 &1.53 &1.37 & 1.88 \\
 \hline
\multirow{3}{*}{MH} & &22.46 &12.78 &14.70 & 12.70 &11.73 \\
  & & {—} & 43.09 \,\% & 34.55 \,\% & 43.45 \,\% & 47.77 \,\% \\
 & Difference & {—} & 11.78 & 9.84 &11.48 &12.78 \\
 \hline
\multirow{3}{*}{MH} & & 24.54 & 13.92 & 12.98 & 14.01 & 12.01 \\
 & & {—} & 43.27 \,\% & 47.10 \,\% & 42.66\, \% & 50.08 \,\% \\
 & Difference & & 10.62 & 11.56 & 10.53 & 12.53 \\ \hline
\end{tabular}
\end{table*}

\end{document} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.