# setting beamer background with rounded corner rectangle

I am trying to set my background for my beamer theme. I want a white rectangle with a rounded north east corner. I used a provided code. My outer theme looks like this:

    \mode<presentation>

\definecolor{mygray}{RGB}{240,240,240}

\tikzset{
rectangle with rounded corners north west/.initial=4pt,
rectangle with rounded corners south west/.initial=4pt,
rectangle with rounded corners north east/.initial=4pt,
rectangle with rounded corners south east/.initial=4pt,
}

\makeatletter
\pgfdeclareshape{rectangle with rounded corners}{
\inheritanchorborder[from=rectangle]
\savedmacro{\neoffset}{
\pgfkeysgetvalue{/tikz/rectangle with rounded corners north east}{\pgf@rectc}
\let\neoffset\pgf@rectc
}
\savedmacro{\nwoffset}{
\pgfkeysgetvalue{/tikz/rectangle with rounded corners north west}{\pgf@rectc}
\let\nwoffset\pgf@rectc
}
\savedmacro{\seoffset}{
\pgfkeysgetvalue{/tikz/rectangle with rounded corners south east}{\pgf@rectc}
\let\seoffset\pgf@rectc
}
\savedmacro{\swoffset}{
\pgfkeysgetvalue{/tikz/rectangle with rounded corners south west}{\pgf@rectc}
\let\swoffset\pgf@rectc
}
\savedanchor{\north}{
\pgf@y=.5\ht\pgfnodeparttextbox
\pgf@x=0pt
\setlength{\pgf@ya}{\pgfshapeminheight}
\ifdim\pgf@y<.5\pgf@ya
\pgf@y=.5\pgf@ya
\fi
}
\savedanchor{\south}{
\pgf@y=-.5\ht\pgfnodeparttextbox
\pgf@x=0pt
\setlength{\pgf@ya}{\pgfshapeminheight}
\ifdim\pgf@y>-.5\pgf@ya
\pgf@y=-.5\pgf@ya
\fi
}
\savedanchor{\east}{
\pgf@y=0pt
\pgf@x=.5\wd\pgfnodeparttextbox
\setlength{\pgf@xa}{\pgfshapeminwidth}
\ifdim\pgf@x<.5\pgf@xa
\pgf@x=.5\pgf@xa
\fi
}
\savedanchor{\west}{
\pgf@y=0pt
\pgf@x=-.5\wd\pgfnodeparttextbox
\setlength{\pgf@xa}{\pgfshapeminwidth}
\ifdim\pgf@x>-.5\pgf@xa
\pgf@x=-.5\pgf@xa
\fi
}
\savedanchor{\northeast}{
\pgf@y=.5\ht\pgfnodeparttextbox % height of the box
\pgf@x=.5\wd\pgfnodeparttextbox % width of the box
\setlength{\pgf@xa}{\pgfshapeminwidth}
\ifdim\pgf@x<.5\pgf@xa
\pgf@x=.5\pgf@xa
\fi
\setlength{\pgf@ya}{\pgfshapeminheight}
\ifdim\pgf@y<.5\pgf@ya
\pgf@y=.5\pgf@ya
\fi
}
\savedanchor{\southwest}{
\pgf@y=-.5\ht\pgfnodeparttextbox
\pgf@x=-.5\wd\pgfnodeparttextbox
%     \pgf@x=0pt
\setlength{\pgf@xa}{\pgfshapeminwidth}
\ifdim\pgf@x>-.5\pgf@xa
\pgf@x=-.5\pgf@xa
\fi
\setlength{\pgf@ya}{\pgfshapeminheight}
\ifdim\pgf@y>-.5\pgf@ya
\pgf@y=-.5\pgf@ya
\fi
}
\anchor{text}{%
\northeast%
\pgf@x=-.5\wd\pgfnodeparttextbox%
\pgfmathsetlength{\pgf@y}{-.5ex}
}
\anchor{north east}{
\northeast
\pgfmathsetmacro{\nw}{(1-sin(45))*\neoffset}
}
\anchor{center}{
\pgf@x=0pt
\pgf@y=0pt
}
\anchor{south west}{
\southwest
\pgfmathsetmacro{\nw}{(1-sin(45))*\swoffset}
}
\anchor{north west}{
\northeast
\pgfmathsetmacro{\temp@x}{\pgf@x}
\southwest
\pgfmathsetmacro{\temp@xtwo}{\pgf@x}
\northeast
\pgfmathsetmacro{\xdiff}{\temp@x-\temp@xtwo}
\def\pgf@xa{\pgf@x-\xdiff}
\
\pgfmathsetmacro{\nw}{(1-sin(45))*\nwoffset}
\def\pgf@xaa{\pgf@xa+\nw}
\def\pgf@yaa{\pgf@y-\nw}
\pgfpoint{\pgf@xaa}{\pgf@yaa}
}
\anchor{south east}{
\southwest
\pgfmathsetmacro{\temp@x}{\pgf@x}
\northeast
\pgfmathsetmacro{\temp@xtwo}{\pgf@x}
\southwest
\pgfmathsetmacro{\xdiff}{\temp@x-\temp@xtwo}
\def\pgf@xa{\pgf@x-\xdiff}
\pgfmathsetmacro{\nw}{(1-sin(45))*\seoffset}
\def\pgf@xaa{\pgf@xa-\nw}
\def\pgf@yaa{\pgf@y+\nw}
\pgfpoint{\pgf@xaa}{\pgf@yaa}
}
\anchor{south}{\south}
\anchor{north}{\north}
\anchor{east}{\east}
\anchor{west}{\west}
\backgroundpath{% this is new
% store lower right in xa/ya and upper right in xb/yb
\southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
\northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
% construct main path
\pgfkeysgetvalue{/tikz/rectangle with rounded corners north west}{\pgf@rectc}
\pgfsetcornersarced{\pgfpoint{\pgf@rectc}{\pgf@rectc}}
\pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}}
\pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb}}
\pgfkeysgetvalue{/tikz/rectangle with rounded corners north east}{\pgf@rectc}
\pgfsetcornersarced{\pgfpoint{\pgf@rectc}{\pgf@rectc}}
\pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yb}}
\pgfkeysgetvalue{/tikz/rectangle with rounded corners south east}{\pgf@rectc}
\pgfsetcornersarced{\pgfpoint{\pgf@rectc}{\pgf@rectc}}
\pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}}
\pgfkeysgetvalue{/tikz/rectangle with rounded corners south west}{\pgf@rectc}
\pgfsetcornersarced{\pgfpoint{\pgf@rectc}{\pgf@rectc}}
\pgfpathclose
}
}
\makeatother

\setbeamertemplate{background}{
\begin{tikzpicture}
\useasboundingbox (0,0) rectangle(\the\paperwidth,\the\paperheight);
\fill[color=mygray] (0,0) rectangle (\the\paperwidth,\the\paperheight);
\node[
fill = white,
shape = rectangle with rounded corners,
minimum height=  9.4 cm,
minimum width =  12.6 cm,
rectangle with rounded corners north west = 0pt,
rectangle with rounded corners south west = 0pt,
rectangle with rounded corners north east = 5pt,
rectangle with rounded corners south east = 0pt,
](0,0) {};

\end{tikzpicture}
}
\mode<all>


So instead of getting a background like this:

The tex doc looks like:

    \documentclass{beamer}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\title{There Is No Largest Prime Number}
\date[ISPN ’80]{27th International Symposium of Prime Numbers}
\author[Euclid]{Euclid of Alexandria \texttt{euclid@alexandria.edu}}

\usetheme{mytheme}

\begin{document}

\begin{frame}

\end{frame}

\end{document}


and the beamerthememytheme.sty :

    \mode<presentation>

% Required packages
\RequirePackage{tikz}
\RequirePackage{graphicx}

% Settings
\useinnertheme{mytheme}
\useoutertheme{mytheme}
\usecolortheme{mytheme}

% Presentation

\mode<all>

• There is already a rounded corner option for rectangle shape. So you don't need this. Just overwrite the corner you don't want to round. – percusse Feb 1 '16 at 14:42
• @percusse Can you expand please – Oussama Ennafii Feb 1 '16 at 15:14
• Can you please provide a complete MWE, e.g. complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document} – user36296 Feb 1 '16 at 15:19
• @OussamaEnnafii Did my answer solve your question or are you looking for something else? – user36296 Feb 18 '16 at 16:29

I think the problem lies in the definition of northeast, especially in pgf@x=.5\pgf@xa and \pgf@y=.5\pgf@ya as this takes only half the page. So try without the .5

\savedanchor{\northeast}{
\pgf@y=.5\ht\pgfnodeparttextbox % height of the box
\pgf@x=.5\wd\pgfnodeparttextbox % width of the box