[Tex/LaTex] `’not found .`\end{frame}`

beamercompilingerrorsxetex

\documentclass[hyperref={pdfpagelabels=false},xcolor=dvipsnames]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{color}
\usepackage{lmodern}
\usefonttheme[onlymath]{serif}
\usepackage{pdfpages} 
\usepackage{amsmath}
\usepackage[absolute,overlay]{textpos}
\usepackage{graphicx}
\usetheme{Boadilla}
%\usepackage{subfigure}
\usepackage{caption}
\usepackage{tikz}
\captionsetup{labelformat=empty,labelsep=none}
\usepackage{xecolor}
\usepackage{makeidx}
\usepackage{verbatim}
%%%%%%%%%%%% table
%\usepackage[latin1]{inputenc}
\usepackage{caption} 
\captionsetup{labelformat=empty,labelsep=none}
\usepackage{colortbl} 
\usepackage{multirow}
\usepackage{hyperref}
\usepackage{booktabs}
%\usepackage[colorlinks,linkcolor=blue,citecolor=blue]{hyperref}
\usepackage{ifthen}
\usepackage{hhline}
\usepackage{pstricks-add}
\psset{xunit=1.0cm,yunit=1.0cm,algebraic=true,dotstyle=o,dotsize=3pt 0,linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25}
%%%%%%%%%%%%%%%                  Color of ‌Bullet
\newcommand*\MyPitem{%
    \item[\color{fg=brown!35!red}\scalebox{1.1}{\textbullet}]}
\newcommand*\MyCitem{%
    \item[\color{pink}\scalebox{1.1}{\textbullet}]}
%%%%%%%%%%%%%%%%%5            Color of b‌lock
\newenvironment{variableblock}[3]{%
    \setbeamercolor{block body}{#2}
    \setbeamercolor{block title}{#3}
    \begin{block}{#1}}{\end{block}}
%%%%%%%%%%%%%%%%%%%%5
\addtobeamertemplate{frametitle}{\vskip1.5ex}{}
%\usepackage{subfig}
\usepackage{epstopdf}
\usepackage{hyperref}
\usepackage[labelformat=empty]{caption}
\usepackage{setspace}
\usepackage[T1]{fontenc}
\usepackage[super,numbers,sort & compress]{natbib}
\usepackage[labelformat=empty]{caption}
\usepackage{xcolor}
\setbeamercolor{structure}{fg=green!55!blue}
\usepackage{lipsum}
\setbeamercolor{subsection in toc}{fg=green!70!blue}
%%%%%%%%%%%%%%55
\makeatletter
\setbeamertemplate{footline}
{
    \leavevmode%
    \hbox{%
        \begin{beamercolorbox}[wd=.143333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
            \usebeamerfont{author in head/foot}\insertshortauthor
        \end{beamercolorbox}%
        \begin{beamercolorbox}[wd=.593333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
            \usebeamerfont{title in head/foot}\insertshorttitle
        \end{beamercolorbox}%
        \begin{beamercolorbox}[wd=.263333\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
            \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
            \insertframenumber{} / \inserttotalframenumber\hspace*{2ex} 
        \end{beamercolorbox}}%
        \vskip0pt%
    }
    \makeatother
\begin{document}
\begin{frame}
\hspace{3cm}
 \vspace{2.3cm}
  \titlepage
\end{frame}
%%%%%%%%%%%%%%%%%%55
\setbeamertemplate{headline} {
    \begin{beamercolorbox}[ht=2ex]{section in head/foot}
        \insertsectionnavigationhorizontal{\paperwidth}{\hskip0pt plus1fill}{\hskip0pt plus1fill}
    \end{beamercolorbox}
}
%%%%%%%%%%%%%%%%%%%%%
    %
 \usebackgroundtemplate{%
    \includegraphics[width=\paperwidth,height=2.5cm]{}}
    %$ $  $ $
    \logo{%
        \includegraphics[width=1cm,height=1cm,keepaspectratio]{logo}%
    }

\begin{frame}
 \frametitle{Outline}
\tableofcontents[subsubsectionstyle=hide].
\end{frame}
\logo{%
    \includegraphics[width=1cm,height=1cm,keepaspectratio]{}% 
    }
    \logo{%
        \includegraphics[width=1cm,height=1cm,keepaspectratio]{logo}%
    }

When I compile, it displays the error:

though it generates the PDF file correctly. I'd like to get it working correctly since it is a little annoying to get that error every time I compile.
I removed \usepackage{subfig} to solve one error about Undefined control sequence \begin{ducument}
and this command have this error::
'not found .\end{frame}`

Best Answer

I think the immediate cause of this error message were the empty brackets in \includegraphics{}, as this will look for an image with an empty file name which will most likely not be found.

But to avoid further errors, much of the superfluous code should be removed.

  • beamer itself provides many packages, so there is no need use graphicx, hyperref, color or xcolor. On the contrary, if you call them yourself a second time, you risk to get in trouble with contradictory package options.
  • Do not load packages multiple times. For example caption is at least loaded three times.
  • Try not to use obsolete packages, for a (incomplete) list see How to keep up with packages and know which ones are obsolete?
  • As @DavidCarlisle wrote in his comment inputenc, fontenc and epstopdf should not be used with xetex.

The attempt to clean up a bit:

\documentclass[hyperref={pdfpagelabels=false},xcolor=dvipsnames]{beamer}

\usetheme{Boadilla}

\newcommand*\MyPitem{%
    \item[\color{fg=brown!35!red}\scalebox{1.1}{\textbullet}]}
\newcommand*\MyCitem{%
    \item[\color{pink}\scalebox{1.1}{\textbullet}]}

\newenvironment{variableblock}[3]{%
    \setbeamercolor{block body}{#2}
    \setbeamercolor{block title}{#3}
    \begin{block}{#1}}{\end{block}}

\addtobeamertemplate{frametitle}{\vskip1.5ex}{}
\setbeamercolor{structure}{fg=green!55!blue}
\setbeamercolor{subsection in toc}{fg=green!70!blue}

\setbeamertemplate{footline}{
    \leavevmode%
    \hbox{%
        \begin{beamercolorbox}[wd=.143333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
            \usebeamerfont{author in head/foot}\insertshortauthor
        \end{beamercolorbox}%
        \begin{beamercolorbox}[wd=.593333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
            \usebeamerfont{title in head/foot}\insertshorttitle
        \end{beamercolorbox}%
        \begin{beamercolorbox}[wd=.263333\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
            \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
            \insertframenumber{} / \inserttotalframenumber\hspace*{2ex} 
        \end{beamercolorbox}}%
        \vskip0pt%
}

\begin{document}

    \begin{frame}
        \hspace{3cm}
        \vspace{2.3cm}
      \titlepage
    \end{frame}

    \setbeamertemplate{headline}{%
        \begin{beamercolorbox}[ht=2ex]{section in head/foot}%
        \insertsectionnavigationhorizontal{\paperwidth}{\hskip0pt plus1fill}{\hskip0pt plus1fill}%
    \end{beamercolorbox}%
    }

    \setbeamertemplate{background}{%
    \includegraphics[width=\paperwidth,height=2.5cm]{example-grid-100x100bp}%
  }

  \logo{%
       \includegraphics[width=1cm]{example-grid-100x100bp}%
    }

    \begin{frame}
        \frametitle{Outline}
        \tableofcontents[subsubsectionstyle=hide]
    \end{frame}

  \logo{%
    \includegraphics[width=1cm]{example-image-a}%
  }

    \begin{frame}
        another logo
    \end{frame}

\end{document}

enter image description here