Graphics, Figures & Tables!Undefined control sequence

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
biswa263
Posts: 2
Joined: Sun Oct 09, 2016 10:55 am

!Undefined control sequence

Post by biswa263 »

Why do I keep getting the error "Undefined control sequence" on running the MWE given below ???

Code: Select all

\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}
It seems I might have missed out a package but not being able to identify it. Please help.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

!Undefined control sequence

Post by Stefan Kottwitz »

Welcome to the forum!

Yes, you need to load the graphicx package:

\usepackage{graphicx}

Stefan
LaTeX.org admin
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

!Undefined control sequence

Post by Johannes_B »

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.

Code: Select all

\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}
Crosspost
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
biswa263
Posts: 2
Joined: Sun Oct 09, 2016 10:55 am

Re: !Undefined control sequence

Post by biswa263 »

Thank You Stefan. Your idea worked really well.

Johannes, my apologies for the crosspost. I wouldn't mind if you take it down anyway.
Post Reply