2

I am getting the error "undefined control sequence" on running the MWE given below. Please help me sort it out....

     \documentclass[journal,12pt,draftclsnofoot,onecolumn]{IEEEtran}
    \usepackage{amsmath}
    \usepackage{cite}
    \usepackage{multirow}      
    \usepackage{multicol}   
    \begin{document}
    \begin{table}[h!]
    \centering
    \caption{Optimized Parameter Values}
    \renewcommand{\arraystretch}{1}
    \scalebox{1}
    {
     \begin{tabular}  
         {|p{2.5cm}|p{1.5cm}|p{1cm}|p{1cm}|p{2cm}|p{1.5cm}|p{1.5cm}|}
          \multicolumn{7}{}{} \\ \hline
        Type of Controller & Parameter & Xmax & Xmin & Iter. reqd. for  
                convergence & Optimized value & $Wmin$ \\ \hline
        \multirow{6}{*}{PSO-SOSMC} & $c_1$ & 5 & 0.1 & 37 & 4.75& 68.43 \\   
        \cline{2-7}
         & $c_2$ & 5 & 0.1 & 10 & 4.273& 20.45 \\ \cline{2-7}
         & $\lambda_1 $& 5 & 0.1 & 37 & 2.75 & 68.43\\ \cline{2-7}
         & $\lambda_2 $& 5 & 0.1 & 10 & 3.59 & 20.45\\ \cline{2-7}
         & $W_1 $& 1 & 0.05 & 37 & 0.43 & 68.45\\ \cline{2-7}
         & $W_2 $& 1 & 0.05 & 10 & 0.218 & 20.43\\ \hline
          \multirow{4}{*}{PSO-BELBIC} & $W_1$ & 5 & 0.1 & 36 & 4.5 &   
           27.34 \\ \cline{2-7}
         & $W_2$ & 5 & 0.1 & 14 & 4.5 & 61.63 \\ \cline{2-7}
         & $G_1$ & 5 & 0.1 & 36 & 1.4 & 27.34 \\ \cline{2-7}
         & $G_2$ & 5 & 0.1 & 14 & 1.4 & 61.63\\ \hline
         \end{tabular}
      }
     \label{optimized_values}
     \end{table}
\end{document}
  • 1
    Welcome to TeX.SX! \usepackage{graphicx} is missing (apart from the final \end{document}). – gernot Oct 9 '16 at 10:57
  • 1
    you need graphicx for \scalebox but what is the point of \scalebox{1} ? It just makes tex do a lot of work to multiply the size of everything by 1 ??? also if you do use scalebox do not have space after the { and before the } as you have it or you get unwanted white space in the output. – David Carlisle Oct 9 '16 at 11:00
  • 1
    I bet your paper is due within the next tenty minutes. I don't see another reason for crossposting – Johannes_B Oct 9 '16 at 11:01
5

scalebox is defined by package graphicx, but you don't even need it. I would suppose a different approach to tables, though. Keep it simple.

biswaIeeeUndefinedSequence

\documentclass[journal,12pt,draftclsnofoot,onecolumn]{IEEEtran}
\usepackage{amsmath}
\usepackage{cite}
%\usepackage{graphicx}  %unneeded
\usepackage{multirow}  %unneeded    
%\usepackage{multicol}  %unneeded
\usepackage{showframe}  
\usepackage{booktabs}  
\begin{document}
\begin{table}%[h!]
    \centering
    \caption{Optimized Parameter Values}
    \begin{tabular}{llllp{7em}p{7em}l}
        \toprule
        Type of Controller & Parameter    & Xmax & Xmin & \raggedright Iter. reqd. for convergence & Optimized value & $W_\mathrm{min}$ \\ \midrule
            PSO-SOSMC        & $c_1$        & 5    & 0.1  & 37                                       & 4.75            & 68.43 \\
                             & $c_2$        & 5    & 0.1  & 10                                       & 4.273           & 20.45 \\
                             & $\lambda_1 $ & 5    & 0.1  & 37                                       & 2.75            & 68.43\\
                             & $\lambda_2 $ & 5    & 0.1  & 10                                       & 3.59            & 20.45\\
                             & $W_1 $       & 1    & 0.05 & 37                                       & 0.43            & 68.45\\
                             & $W_2 $       & 1    & 0.05 & 10                                       & 0.218           & 20.43\\ \cmidrule(lr){2-7}
            PSO-BELBIC       & $W_1$        & 5    & 0.1  & 36                                       & 4.5             & 27.34 \\
                             & $W_2$        & 5    & 0.1  & 14                                       & 4.5             & 61.63 \\
                             & $G_1$        & 5    & 0.1  & 36                                       & 1.4             & 27.34 \\
                             & $G_2$        & 5    & 0.1  & 14                                       & 1.4             & 61.63\\ \bottomrule
        \end{tabular}

        \vspace{2cm}
%   \scalebox{1}
%   {
        \begin{tabular}{|p{2.5cm}|p{1.5cm}|p{1cm}|p{1cm}|p{2cm}|p{1.5cm}|p{1.5cm}|}
            \multicolumn{7}{}{} \\ \hline
            Type of Controller & Parameter & Xmax & Xmin & Iter. reqd. for convergence & Optimized value & $Wmin$ \\ \hline
            \multirow{6}{*}{PSO-SOSMC} & $c_1$ & 5 & 0.1 & 37 & 4.75& 68.43 \\ \cline{2-7}
            & $c_2$ & 5 & 0.1 & 10 & 4.273& 20.45 \\ \cline{2-7}
            & $\lambda_1 $& 5 & 0.1 & 37 & 2.75 & 68.43\\ \cline{2-7}
            & $\lambda_2 $& 5 & 0.1 & 10 & 3.59 & 20.45\\ \cline{2-7}
            & $W_1 $& 1 & 0.05 & 37 & 0.43 & 68.45\\ \cline{2-7}
            & $W_2 $& 1 & 0.05 & 10 & 0.218 & 20.43\\ \hline
            \multirow{4}{*}{PSO-BELBIC} & $W_1$ & 5 & 0.1 & 36 & 4.5 & 27.34 \\ \cline{2-7}
            & $W_2$ & 5 & 0.1 & 14 & 4.5 & 61.63 \\ \cline{2-7}
            & $G_1$ & 5 & 0.1 & 36 & 1.4 & 27.34 \\ \cline{2-7}
            & $G_2$ & 5 & 0.1 & 14 & 1.4 & 61.63\\ \hline
        \end{tabular}
%   }
    \label{optimized_values}
\end{table}
\end{document}
  • Thank You, David , Gernot and Johannes :). It worked out well. Sorry for the crossposting in the latex community, I thought the two communities are decoupled and I hadn't expected such prompt response. – biswajit Oct 9 '16 at 11:13
  • Johannes, your tabular representation is very elegant....Thank you once again :) – biswajit Oct 9 '16 at 11:27
0

Johannes, I have failed to mention earlier that I need the scalebox and arraystretch commands to resize my table according to the need of the paper. I have tweaked your code to include those two commands and it looks just fine. The code is shown below

    \documentclass[journal,12pt,draftclsnofoot,onecolumn]{IEEEtran}
\usepackage{amsmath}
\usepackage{cite}
\usepackage{graphicx}  %unneeded 
\usepackage{booktabs}  
\begin{document}
\begin{table}%[h!]
    \centering
    \renewcommand{\arraystretch}{1.3}
    \caption{Optimized Parameter Values}
    \scalebox{0.8}
    {
    \begin{tabular}{llllp{7em}p{7em}l}
        \toprule
        Type of Controller & Parameter    & Xmax & Xmin & \raggedright Iter. reqd. for convergence & Optimized value & $W_\mathrm{min}$ \\ \midrule
            PSO-SOSMC        & $c_1$        & 5    & 0.1  & 37                                       & 4.75            & 68.43 \\
                             & $c_2$        & 5    & 0.1  & 10                                       & 4.273           & 20.45 \\
                             & $\lambda_1 $ & 5    & 0.1  & 37                                       & 2.75            & 68.43\\
                             & $\lambda_2 $ & 5    & 0.1  & 10                                       & 3.59            & 20.45\\
                             & $W_1 $       & 1    & 0.05 & 37                                       & 0.43            & 68.45\\
                             & $W_2 $       & 1    & 0.05 & 10                                       & 0.218           & 20.43\\ \cmidrule(lr){2-7}
            PSO-BELBIC       & $W_1$        & 5    & 0.1  & 36                                       & 4.5             & 27.34 \\
                             & $W_2$        & 5    & 0.1  & 14                                       & 4.5             & 61.63 \\
                             & $G_1$        & 5    & 0.1  & 36                                       & 1.4             & 27.34 \\
                             & $G_2$        & 5    & 0.1  & 14                                       & 1.4             & 61.63\\ \bottomrule
        \end{tabular}
}
    \label{optimized_values}
\end{table}
\end{document}
  • Maybe you should remove the wrong %unneded now. ;-) And the space that David talked about before. – Johannes_B Oct 9 '16 at 12:09

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.