[Tex/LaTex] Beamer template shading background

backgroundsbeamer

I have a problem with the background of my beamer slides. When I compile it on my PC (Windows 7, TeXLive 2015) I get the following background:
enter image description here

But when I compile it on my MacBook (Mojave, TeXLive 2018) I get the following background:
enter image description here

How can I fix it to get the first one?

\documentclass[red]{beamer}
\beamertemplateshadingbackground{red!70}{yellow!85}
\usepackage{verbatim}
\mode<article> 
{
  \usepackage{fullpage}
  \usepackage[bookmarks=false]{hyperref}
  }

\mode<presentation>
{
  \setbeamertemplate{background canvas}[vertical shading][bottom=red!10,top=blue!10]

  \usetheme
  {Darmstadt}
   \useoutertheme[height=0pt,width=2cm,left,]{sidebar}
\setbeamerfont{section in sidebar}{size=\fontsize{8.7}{8.6}\selectfont}
\setbeamerfont{subsection in sidebar}{size=\fontsize{5.7}{6.7}\selectfont}

\useinnertheme{circles}
}
\usefonttheme{serif}

\usepackage{fontspec}
\usepackage{calligra}
\newfontfamily\unicodefont{Remachine Script Personal Use}
\input Starburst.fd
\newcommand*\initfamily{\usefont{U}{Starburst}{xl}{n}}
\newcommand*{\myfont}{\fontfamily{lmr}\selectfont}




\usepackage[
                    final
                    ]{pdfcomment}
\usepackage[mathscr]{euscript}
\usepackage{multirow} 
\usepackage{xcolor}
\usepackage{ragged2e}
\DeclareMathAlphabet{\mathpzc}{OT1}{pzc}{m}{it}
\newcommand*{\Scale}[2][4]{\scalebox{#1}{$#2$}}
\usepackage{pdfpages}


\usepackage{url}
\newfontface\Edwardian{Edwardian Script ITC}
\newfontface\Kunstler{Kunstler Script}

\hypersetup{pdfpagemode=FullScreen} 

\definecolor{Red}{rgb}{1,0,0}
\definecolor{Blue}{rgb}{0,0,1}
\definecolor{Green}{rgb}{0,1,0}
\definecolor{magenta}{rgb}{1,0,.6}
\definecolor{lightblue}{rgb}{0,.5,1}
\definecolor{lightpurple}{rgb}{.6,.4,1}
\definecolor{gold}{rgb}{.6,.5,0}
\definecolor{orange}{rgb}{1,0.4,0}
\definecolor{hotpink}{rgb}{1,0,0.5}
\definecolor{newcolor2}{rgb}{.5,.3,.5}
\definecolor{newcolor}{rgb}{0,.3,1}
\definecolor{newcolor3}{rgb}{1,0,.35}
\definecolor{darkgreen1}{rgb}{0, .35, 0}
\definecolor{darkgreen}{rgb}{0, .6, 0}
\definecolor{darkred}{rgb}{.75,0,0}

\xdefinecolor{olive}{cmyk}{0.64,0,0.95,0.4}
\xdefinecolor{purpleish}{cmyk}{0.75,0.75,0,0}


\setbeamertemplate{footline}[text line]{
  \hbox{%
    \begin{beamercolorbox}[wd=3.7\paperwidth,ht=2.25ex,dp=1ex,left]{date in head/foot}%
      \usebeamerfont{date in head/foot}
      \hspace*{1ex} \insertframenumber{} / \inserttotalframenumber
      \hspace*{5ex} \insertshortdate
    \end{beamercolorbox}%
    }
} % makes the footer EMPTY

    % include packages
\usepackage{subfigure}
\usepackage{multicol}
\usepackage{amsmath,booktabs}
\usepackage{epsfig}
\usepackage{graphicx}
\usepackage[all,knot]{xy}
\xyoption{arc}
\usepackage{url}
\usepackage{amsthm, amssymb, amsmath, amsfonts}
\usepackage{times}
\usepackage{tikz}
\usepackage{verbatim}
\usetikzlibrary{arrows,shapes}
\input{commands}

\usepackage{pgf,pgfarrows,pgfnodes,pgfautomata,pgfheaps,pgfshade}


\setbeamercovered{transparent=10}
\newcommand{\warp}{\mathbf{W}(\mathbf{x};\mathbf{p})}


\newfontfamily\farsifont[Script=Arabic]{XB Niloofar}






\makeatletter
\TeXXeTstate=1
\def\farsitext#1{\begingroup\beginR\farsifont#1\endR\endgroup}
\setbeamertemplate{frametitle}{
    \ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
    \@tempdima=\textwidth%
    \advance\@tempdima by\beamer@leftmargin%
    \advance\@tempdima by\beamer@rightmargin%
    \vspace*{0.055cm}
    \begin{beamercolorbox}[sep=0.3cm,center,wd=\the\@tempdima]{frametitle}
        \usebeamerfont{frametitle}%
        \vbox{}\vskip-1ex%
        \if@tempswa\else\csname beamer@ftecenter\endcsname\fi%
        \strut\insertframetitle\strut\par%
        {%
            \ifx\insertframesubtitle\@empty%
            \else%
            {\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\insertframesubtitle\strut\par}%
            \fi
        }%
        \vskip-1ex%
        \if@tempswa\else\vskip-.3cm\fi% set inside beamercolorbox... evil here...
    \end{beamercolorbox}%
}
\def\th@mystyle{%
    \normalfont % body font
    \setbeamercolor{block title example}{bg=orange,fg=white}
    \setbeamercolor{block body example}{bg=orange!20,fg=black}
    \def\inserttheoremblockenv{exampleblock}
  }
 %%% %%%%%%%
  \setbeamertemplate{section in sidebar}{\vbox{%
    \beamer@sidebarformat{4pt}{section in sidebar}{\insertsectionhead}}}
\setbeamertemplate{section in sidebar shaded}{\vbox{%
    \beamer@sidebarformat{3pt}{section in sidebar shaded}{\insertsectionhead}}}
\makeatother




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


\newenvironment{varblock}[4][.9\textwidth]{
  \setlength{\textwidth}{#1}
  \setbeamercolor{block body}{#3}
  \setbeamercolor{block title}{#4}
  \begin{block}{#2}}
 {\end{block}}



\usepackage{colortbl}
\usepackage{times}
\usepackage[english]{babel}

\usepackage[utf8]{inputenc}
\usepackage{pstricks,pst-node,pst-text,pst-3d}
\usepackage[T1]{fontenc}
\usepackage{xunicode}% provides unicode character macros
\usepackage{xltxtra} 
\usepackage{multicol}


\AtBeginSubsection[]
{
  \begin{frame}<beamer>
    \frametitle{\initfamily Outline}
    \tableofcontents[currentsection,currentsubsection]
  \end{frame}
}



\def\XePersian{\leavevmode$\smash{\hbox{X\lower.5ex
  \hbox{\kern-.125em{E}}Persian}}$}%\reflect{E}


\title[\textcolor{yellow}{Analysis of Non-Gaussian Spatial Models with Covariates Measurement Error}]
{\Large  Analysis of Non-Gaussian Spatial Models with Covariates Measurement Error}
%\subtitle{The Beamer Class}
\author[\unicodefont{\scriptsize \textcolor{yellow}{Tadayon, V.}}]{\vspace{-.2cm}\Large\textcolor{blue}{\unicodefont{Vahid Tadayon}}}
\institute[SCU]{\normalsize \unicodefont Department of Statistics, \\Shahid Chamran University \\ Supervisor: Prof. A. Rasekh}
\date[{Ph.D. Thesis in Statistics} \hspace{5.3cm}December 4, 2018]\\% \tiny November 2011

\begin{document}

\tikzstyle{every picture}+=[remember picture]
\tikzstyle{na} = [baseline=-.5ex]

\everymath{\displaystyle}



\frame{
\vspace{-.6cm}
\begin{center}%\\[.2cm]
\calligra
%\Kunstler
\vspace{0.3cm}
{%\textcolor{black}
}% \\[.25cm]
\end{center}
\vspace{-.4cm}
\titlepage 
}



\begin{frame}
  \frametitle{\initfamily Outline}
  \tableofcontents[pausesections]
\end{frame}





\end{document}

Best Answer

You first set your yellow-red background, but later you overwrite it with \setbeamertemplate{background canvas}[vertical shading][bottom=red!10,top=blue!10]

If you remove this line, you get the yellow-red shading.

Some other comments about your code:

  • The incorrect shading of the shadow in your first image indicates that your beamer version is seriously outdated. You should update your tex distribution

  • the beamer option red is obsolete. Use \usecolortheme[rgb={0.7,0.2,0.2}]{structure} instead

  • You don't need xcolor, graphicx or url with beamer

  • don't load packages multiple times

  • It makes little sense to load multicol with beamer, because beamer has it's own column mechanism

  • you should not use epsfig in any document written in this millennium

  • times is obsolete, there are much better packages for times font

  • instead of colortbl better pass xcolor={table} as documentclass option to beamer

  • The new line after the optional argument of \date makes no sense and the mandatory argument is missing


% !TeX TS-program = xelatex
\documentclass{beamer}

\usecolortheme[rgb={0.7,0.2,0.2}]{structure}
\beamertemplateshadingbackground{red!70}{yellow!85}

\mode<article>{
    \usepackage{fullpage}
  \usepackage[bookmarks=false]{hyperref}
}

\mode<presentation>{
    %\setbeamertemplate{background canvas}[vertical shading][bottom=red!10,top=blue!10]
    \usetheme{Darmstadt}
}

%\usepackage{xcolor}
%\usepackage{url}
%\usepackage{multicol}
%\usepackage{amsmath}
%\usepackage{epsfig}
%\usepackage{graphicx}
%\usepackage{url}
%\usepackage{times}
%\usepackage{colortbl}
%\usepackage{times}
%\usepackage{multicol}


\title[\textcolor{yellow}{Analysis of Non-Gaussian Spatial Models with Covariates Measurement Error}]
{\Large  Analysis of Non-Gaussian Spatial Models with Covariates Measurement Error}
\date[{Ph.D. Thesis in Statistics} \hspace{5.3cm}December 4, 2018]{}%\\% \tiny November 2011

\begin{document}

\begin{frame}
\titlepage 
\end{frame}

\end{document}

enter image description here