1

I am getting an error "Undefined control sequence. \end{frame}" when I tried to insert an algorithm in beamer.

\documentclass{beamer}
\usepackage{etex}
\usetheme{Warsaw}
\setbeamercolor {alerted text} {fg=blue}
\logo{\includegraphics[height=.8cm]{NITlogo}}
\usepackage{beamerthemeshadow}
\usepackage{textcomp}
\usecolortheme[RGB={0,153,0}]{structure}
\usecolortheme{crane}
\useinnertheme{rounded}
\usepackage{graphicx,amsmath}
\usepackage{verbatim,longtable}
\hypersetup{pdfpagemode=FullScreen}
\usepackage{verbatim}
\usepackage{pdflscape}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{array,colortbl,xcolor}

\usepackage{ragged2e}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{subfig}
\newcommand\Fontvi{\fontsize{6}{7.2}\selectfont}
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{frametitle continuation}{}
\usepackage{adjustbox}
\definecolor{deepblue}{RGB}{0,0,128}
\begin{document}
\begin{frame}{}
 \begin{algorithm}[H]
    \caption{Algorithm }\label{alg:alg1}
    \begin{algorithmic}[1]
        \STATE Sink node  
        \STATE Store the value 
        \subitem a\textunderscore value .
        \subitem c\textunderscore value .
        \subitem SINR\textunderscore = .
        \subitem kappa\textunderscore = .
        \STATE Sink node broadcasts 
        \STATE Each .
        \STATE .


    \end{algorithmic}
 \end{algorithm}
\end{frame}
  • 1
    \end{document}is missing – dexteritas Jul 16 '17 at 15:07
1

After adding \end{document} and [fragile] the error message in your MWE tells that \subitem is undefined. To solve this problem, define it to do whatever the output should look like - in the following I used

\newcommand{\subitem}{\par\qquad}

but you can change this according to your needs.


There are some superfluous packages in your example: you don't need graphicx or xcolor with beamer, as beamer already provides this functionality.

\documentclass{beamer}
\usepackage{etex}
\usetheme{Warsaw}
\setbeamercolor {alerted text} {fg=blue}
\logo{\includegraphics[height=.8cm]{example-image}}
\usepackage{beamerthemeshadow}
\usepackage{textcomp}
\usecolortheme[RGB={0,153,0}]{structure}
\usecolortheme{crane}
\useinnertheme{rounded}
%\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{verbatim,longtable}
\hypersetup{pdfpagemode=FullScreen}
\usepackage{verbatim}
\usepackage{pdflscape}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{array,colortbl}
%\usepackage{xcolor}

\usepackage{ragged2e}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{subfig}
\newcommand\Fontvi{\fontsize{6}{7.2}\selectfont}
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{frametitle continuation}{}
\usepackage{adjustbox}
\definecolor{deepblue}{RGB}{0,0,128}

\newcommand{\subitem}{\par\qquad}

\begin{document}
\begin{frame}[fragile]
 \begin{algorithm}[H]
    \caption{Algorithm }\label{alg:alg1}
    \begin{algorithmic}[1]
        \STATE Sink node  
        \STATE Store the value 
        \subitem a\textunderscore value .
        \subitem c\textunderscore value .
        \subitem SINR\textunderscore = .
        \subitem kappa\textunderscore = .
        \STATE Sink node broadcasts 
        \STATE Each .
        \STATE .
    \end{algorithmic}
 \end{algorithm}
\end{frame}
\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.