texlive[48511] Master/texmf-dist: beamerswitch (30aug18)

commits+karl at tug.org commits+karl at tug.org
Thu Aug 30 21:34:51 CEST 2018


Revision: 48511
          http://tug.org/svn/texlive?view=revision&revision=48511
Author:   karl
Date:     2018-08-30 21:34:51 +0200 (Thu, 30 Aug 2018)
Log Message:
-----------
beamerswitch (30aug18)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/beamerswitch/beamerswitch-example-article.pdf
    trunk/Master/texmf-dist/doc/latex/beamerswitch/beamerswitch-example-handout.pdf
    trunk/Master/texmf-dist/doc/latex/beamerswitch/beamerswitch-example-trans.pdf
    trunk/Master/texmf-dist/doc/latex/beamerswitch/beamerswitch-example.pdf
    trunk/Master/texmf-dist/doc/latex/beamerswitch/beamerswitch.pdf
    trunk/Master/texmf-dist/source/latex/beamerswitch/beamerswitch.dtx
    trunk/Master/texmf-dist/tex/latex/beamerswitch/beamerswitch.cls

Modified: trunk/Master/texmf-dist/doc/latex/beamerswitch/beamerswitch-example-article.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/beamerswitch/beamerswitch-example-handout.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/beamerswitch/beamerswitch-example-trans.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/beamerswitch/beamerswitch-example.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/beamerswitch/beamerswitch.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/beamerswitch/beamerswitch.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/beamerswitch/beamerswitch.dtx	2018-08-30 19:33:53 UTC (rev 48510)
+++ trunk/Master/texmf-dist/source/latex/beamerswitch/beamerswitch.dtx	2018-08-30 19:34:51 UTC (rev 48511)
@@ -228,7 +228,7 @@
 %<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
 %<class>\ProvidesClass{beamerswitch}
 %<*class>
-    [2017/12/10 v1.3 Convenient mode selection in Beamer documents]
+    [2018/08/29 v1.4 Convenient mode selection in Beamer documents]
 %</class>
 %<*driver>
 \documentclass[12pt]{article}
@@ -520,7 +520,8 @@
 \item
   Have you specified class options other than \key{ignorenonframetext}?
   If so, start by rewriting your \cs{documentclass} line in terms of
-  \cs{PassOptionsToClass}:
+  \cs{PassOptionsToClass} -- note that the optional argument (in square
+  brackets) becomes mandatory (in curly braces):
 
   \begin{multicols}{2}
 \begin{dispListing*}{title=Before,coltitle=black,fonttitle=\sffamily}
@@ -548,7 +549,6 @@
   or something more specific, as required.
 \end{enumerate}
 
-\pagebreak
 In summary, here is an example:
 
 \begin{multicols}{2}
@@ -556,16 +556,12 @@
 \documentclass[10pt]{beamer}
 
 
-
 \usetheme{metropolis}
 
 \title{Test presentation}
-
 \begin{document}
 
-
   \maketitle
-
 \end{document}
 \end{dispListing*}
   \columnbreak
@@ -572,17 +568,13 @@
 \begin{dispListing*}{title=After,coltitle=black,fonttitle=\sffamily}
 \PassOptionsToClass{10pt}{beamer}
 \documentclass{beamerswitch}
-
 \mode<presentation>{%
   \usetheme{metropolis}
 }
 \title{Test presentation}
-
 \begin{document}
 \mode<all>
-
   \maketitle
-
 \end{document}
 \end{dispListing*}
 \end{multicols}
@@ -1081,6 +1073,12 @@
   \label{fig:layouts}
 \end{figure}
 
+\begin{docKey}{pnos}{}{no value, initially unset}
+  Adds page numbers to the bottom of each page. The number appears at a distance
+  of \cs{handoutpnobaseline} (initially 5mm) from the bottom edge of the page.
+  You change this with \cs{setlength}.
+\end{docKey}
+
 \begin{docKey}{border}{=\meta{length}}{default 0.4pt, initially 0pt}
   Puts a rectangular border of thickness \meta{length} around each slide. Note
   that the borders are drawn regardless of whether a slide is actually printed,
@@ -1087,10 +1085,21 @@
   so you may end up with empty boxes on the last page.
 \end{docKey}
 
-\begin{docKey}{pnos}{}{no value, initially unset}
-  Adds page numbers to the bottom of each page.
+\begin{docKey}{margin}{=\meta{length}}{default 0pt, initially 5mm}
+  Sets how much extra space to leave around each slide on the page. To achieve
+  this it uses the \key{border shrink} option from \pkg{pgfpages}. If you add
+  page numbers, this value will increase if necessary to prevent the number
+  colliding with the slides.
 \end{docKey}
 
+\begin{docKey}{align}{}{no value, initially unset}
+  When \key{margin} is non-zero, the effective page margins are approximately
+  half the size of the gaps between slides (some additional white space comes
+  from preserving the aspect ratio of the slides). When set, this option tweaks
+  the positions of the slides so that the page margins are approximately the
+  same as the interior gaps.
+\end{docKey}
+
 \section{Changing the look of article mode}
 
 Some additional options can be set by using the following command in the
@@ -1515,15 +1524,204 @@
 %
 % \subsection{Handout layout}
 %
+% \begin{optionkey}{paper}
+% \begin{macro}{beamerswitch at handoutpaper}
+% In theory it would be nice to anticipate the paper size that the article mode
+% would use, and pass that as an option to \cs{pgfpagesuselayout} but as that's
+% unlikely to be clean code, we settle here for setting it with an option.
+%
+%    \begin{macrocode}
+\def\beamerswitch at handoutpaper{a4paper}
+\define at key[HL]{beamerswitch}{paper}{%
+  \def\beamerswitch at handoutpaper{#1}%
+}
+%    \end{macrocode}
+% \end{macro}
+% \end{optionkey}
+%
+% \begin{optionkey}{nup}
+% \begin{optionvalue}{2}
+% \begin{optionvalue}{3}
+% \begin{optionvalue}{3plus}
+% \begin{optionvalue}{4}
+% \begin{optionvalue}{4plus}
+% \begin{optionvalue}{6}
+% \begin{optionvalue}{8}
+% The \key{nup} option specifies how many slides to include per page.
+% The `plus' keyword indicates a layout with additional gaps for writing.
+%
+%    \begin{macrocode}
+\newcounter{beamerswitch at nupcase}
+\setcounter{beamerswitch at nupcase}{5}
+\define at choicekey+[HL]{beamerswitch}{nup}[\val\nr]{2, 3, 3plus, 4, 4plus, 6, 8}{%
+  \setcounter{beamerswitch at nupcase}{\nr}
+}{%
+  \ClassWarning{beamerswitch}{Value of `nup' not recognized.
+    Allowed values are 2, 3, 3plus, 4, 4plus, 6, and 8.}%
+}
+%    \end{macrocode}
+% \end{optionvalue}
+% \end{optionvalue}
+% \end{optionvalue}
+% \end{optionvalue}
+% \end{optionvalue}
+% \end{optionvalue}
+% \end{optionvalue}
+% \end{optionkey}
+%
+% \begin{optionkey}{border}
 % \begin{macro}{beamerswitch at Border}
-% We set up a command for drawing borders around the slides in handout mode.
-% This is initially set up to do nothing.
+% The \key{borders} option switches on borders around the slides on handout
+% pages (and gaps where slides would appear if there were enough). The value
+% is used to set the width of the border.
 %
+% This is implemented as a PGF drawing command, which is initially set up to do
+% nothing but gets filled out if the option is selected.
+%
 %    \begin{macrocode}
 \newcommand*{\beamerswitch at Border}{\relax}
+\define at key[HL]{beamerswitch}{border}[0.4pt]{%
+  \RequirePackage{pgf}%
+  \ifdimcomp{#1}{>}{0pt}{%
+    \renewcommand*{\beamerswitch at Border}{\pgfsetlinewidth{#1}\pgfstroke}%
+  }{%
+    \renewcommand*{\beamerswitch at Border}{\relax}%
+  }%
+}
 %    \end{macrocode}
 % \end{macro}
+% \end{optionkey}
 %
+% \changes{v1.4}{2018/08/29}{Make margins around slides a configurable size}
+% \begin{optionkey}{margin}
+% \begin{macro}{beamerswitch at margin}
+% The \key{margin} option controls how much white space is added around each
+% slide on handout pages. It corresponds to the \texttt{border shrink} option
+% of \cs{pgfpagesuselayout}.
+%
+%    \begin{macrocode}
+\newlength{\beamerswitch at margin}
+\setlength{\beamerswitch at margin}{5mm}
+\define at key[HL]{beamerswitch}{margin}[0pt]{%
+  \setlength{\beamerswitch at margin}{#1}%
+}
+%    \end{macrocode}
+% \end{macro}
+% \end{optionkey}
+%
+% \begin{optionkey}{align}
+% The \key{align} option chooses whether to rejig the positions of the slides
+% on the page so that the effective page margin is the same as, rather than
+% half, the space between adjacent slides.
+%
+%    \begin{macrocode}
+\define at boolkey[HL]{beamerswitch}{align}[true]{}
+%    \end{macrocode}
+% \end{optionkey}
+%
+% \begin{optionkey}{pnos}
+% \begin{macro}{handoutpnobaseline}
+% The \key{pnos} option switches on page numbers for handout pages. The height
+% at which the baseline of the number sits, relative to the bottom edge of the
+% paper, is given by the length \cs{handoutpnobaseline}.
+%
+%    \begin{macrocode}
+\newlength{\handoutpnobaseline}
+\setlength{\handoutpnobaseline}{5mm}
+\define at boolkey[HL]{beamerswitch}{pnos}[true]{}
+%    \end{macrocode}
+% \end{macro}
+% \end{optionkey}
+%
+% \begin{macro}{handoutlayout}
+% \begin{macro}{beamerswitch at nup}
+% We set up the \cs{handoutlayout} command for applying these options.
+%
+%    \begin{macrocode}
+\newlength{\beamerswitch at pnoadjust}
+\newcommand*{\handoutlayout}[1]{%
+  \only<handout>{%
+    \setlength{\beamerswitch at pnoadjust}{1em}%
+    \setkeys[HL]{beamerswitch}{#1}%
+    \ifbool{HL at beamerswitch@pnos}{%
+      \def\pgfsys at endpicture{%
+        \raisebox{\the\handoutpnobaseline}[0pt][0pt]{%
+          \makebox[\pgfphysicalwidth]{%
+            \the\numexpr(\value{page} - 2 + (\beamerswitch at nup / 2))%
+              / \beamerswitch at nup\relax
+          }%
+        }\par
+      }%
+      \ifbool{HL at beamerswitch@align}{%
+        \ifcase\value{beamerswitch at nupcase}\relax
+          \addtolength{\beamerswitch at pnoadjust}{-0.333\beamerswitch at margin}%
+        \or
+          \addtolength{\beamerswitch at pnoadjust}{-0.5\beamerswitch at margin}%
+        \or
+          \addtolength{\beamerswitch at pnoadjust}{-0.5\beamerswitch at margin}%
+        \or
+          \addtolength{\beamerswitch at pnoadjust}{-0.333\beamerswitch at margin}%
+        \or
+          \addtolength{\beamerswitch at pnoadjust}{-0.6\beamerswitch at margin}%
+        \or
+          \addtolength{\beamerswitch at pnoadjust}{-0.5\beamerswitch at margin}%
+        \or
+          \addtolength{\beamerswitch at pnoadjust}{-0.6\beamerswitch at margin}%
+        \fi
+      }{}%
+      \ifdimcomp{\beamerswitch at margin}{<}%
+          {\handoutpnobaseline + \beamerswitch at pnoadjust}{%
+        \setlength{\beamerswitch at margin}%
+          {\the\dimexpr\handoutpnobaseline + \beamerswitch at pnoadjust\relax}%
+      }{}%
+    }{%
+      \def\pgfsys at endpicture{}%
+    }%
+    \ifcase\value{beamerswitch at nupcase}\relax
+      \def\beamerswitch at nup{2}%
+      \pgfpagesuselayout{1 by 2}[\beamerswitch at handoutpaper,%
+        border shrink=\the\beamerswitch at margin]%
+    \or
+      \def\beamerswitch at nup{3}%
+      \pgfpagesuselayout{1 by 3}[\beamerswitch at handoutpaper,%
+        border shrink=\the\beamerswitch at margin]%
+    \or
+      \def\beamerswitch at nup{3}%
+      \pgfpagesuselayout{1 by 3 narrow}[\beamerswitch at handoutpaper,%
+        border shrink=\the\beamerswitch at margin]%
+    \or
+      \def\beamerswitch at nup{4}%
+      \pgfpagesuselayout{2 by 2}[\beamerswitch at handoutpaper,%
+        landscape,border shrink=\the\beamerswitch at margin]%
+    \or
+      \def\beamerswitch at nup{4}%
+      \pgfpagesuselayout{1 by 4 narrow}[\beamerswitch at handoutpaper,%
+        border shrink=\the\beamerswitch at margin]%
+    \or
+      \def\beamerswitch at nup{6}%
+      \pgfpagesuselayout{2 by 3}[\beamerswitch at handoutpaper,%
+        border shrink=\the\beamerswitch at margin]%
+    \or
+      \def\beamerswitch at nup{8}%
+      \pgfpagesuselayout{2 by 4}[\beamerswitch at handoutpaper,%
+        border shrink=\the\beamerswitch at margin]%
+    \fi
+  }%
+}
+%    \end{macrocode}
+%\end{macro}
+%\end{macro}
+%
+% We initialize the class with the defaults set above.
+%
+%    \begin{macrocode}
+\AtEndPreamble{%
+  \ifdef{\beamerswitch at nup}{}{%
+    \handoutlayout{}%
+  }%
+}
+%    \end{macrocode}
+%
 % Though \pkg{pgfpages} defines some perfectly fine layouts, we need to add
 % configurability to the existing ones and provide some new ones.
 %
@@ -1554,7 +1752,11 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}{.5\pgfphysicalheight}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -1562,7 +1764,11 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=\pgfphysicalheight,%
-      center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.75\pgfphysicalwidth - 0.333\beamerswitch at margin}{.5\pgfphysicalheight}%
+      }{%
+        \pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      }%
     }%
     \else
     % stack on top of one another
@@ -1572,7 +1778,11 @@
       border code=\beamerswitch at Border,%
       resized width=\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -1580,7 +1790,11 @@
       border code=\beamerswitch at Border,%
       resized width=\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight + 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      }%
     }%
     \fi
   }
@@ -1612,7 +1826,11 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=\pgfphysicalheight,%
-      center=\pgfpoint{.167\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.167\pgfphysicalwidth + 0.5\beamerswitch at margin}{.5\pgfphysicalheight}%
+      }{%
+        \pgfpoint{.167\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -1628,7 +1846,11 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=\pgfphysicalheight,%
-      center=\pgfpoint{.833\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.833\pgfphysicalwidth - 0.5\beamerswitch at margin}{.5\pgfphysicalheight}%
+      }{%
+        \pgfpoint{.833\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      }%
     }%
     \else
     % stack on top of one another
@@ -1638,7 +1860,11 @@
       border code=\beamerswitch at Border,%
       resized width=\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.5\pgfphysicalwidth}{.833\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.5\pgfphysicalwidth}{.833\pgfphysicalheight - 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.5\pgfphysicalwidth}{.833\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -1654,7 +1880,11 @@
       border code=\beamerswitch at Border,%
       resized width=\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.5\pgfphysicalwidth}{.167\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.5\pgfphysicalwidth}{.167\pgfphysicalheight + 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.5\pgfphysicalwidth}{.167\pgfphysicalheight}%
+      }%
     }%
     \fi
   }
@@ -1687,7 +1917,12 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.167\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.167\pgfphysicalwidth + 0.5\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.167\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -1695,7 +1930,11 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight - 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{3}
     {%
@@ -1703,7 +1942,12 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.833\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.833\pgfphysicalwidth - 0.5\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.833\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \else
     % stack on top of one another
@@ -1713,7 +1957,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.833\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.5\beamerswitch at margin}%
+          {.833\pgfphysicalheight - 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.833\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -1721,7 +1970,11 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.5\beamerswitch at margin}{.5\pgfphysicalheight}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{3}
     {%
@@ -1729,7 +1982,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.167\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.5\beamerswitch at margin}%
+          {.167\pgfphysicalheight + 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.167\pgfphysicalheight}%
+      }%
     }%
     \fi
   }
@@ -1740,7 +1998,7 @@
 %    \begin{macrocode}
   \pgfpagesdeclarelayout{2 by 2}
   {
-    \edef\pgfpageoptionheight{\the\paperheight} 
+    \edef\pgfpageoptionheight{\the\paperheight}
     \edef\pgfpageoptionwidth{\the\paperwidth}
     \edef\pgfpageoptionborder{0pt}
   }
@@ -1757,7 +2015,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -1765,7 +2028,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.75\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.75\pgfphysicalwidth - 0.333\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.75\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{3}
     {%
@@ -1773,7 +2041,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.25\pgfphysicalheight + 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{4}
     {%
@@ -1781,7 +2054,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.75\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.75\pgfphysicalwidth - 0.333\beamerswitch at margin}%
+          {.25\pgfphysicalheight + 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.75\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      }%
     }%
   }
 %    \end{macrocode}
@@ -1813,7 +2091,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.125\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.125\pgfphysicalwidth + 0.6\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.125\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -1821,7 +2104,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.375\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.375\pgfphysicalwidth + 0.2\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.375\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{3}
     {%
@@ -1829,7 +2117,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.625\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.625\pgfphysicalwidth - 0.2\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.625\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{4}
     {%
@@ -1837,7 +2130,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.875\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.875\pgfphysicalwidth - 0.6\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.875\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \else
     % stack on top of one another
@@ -1847,7 +2145,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.875\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.875\pgfphysicalheight - 0.6\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.875\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -1855,7 +2158,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.625\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.625\pgfphysicalheight - 0.2\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.625\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{3}
     {%
@@ -1863,7 +2171,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25 \pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.375\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.375\pgfphysicalheight + 0.2\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.375\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{4}
     {%
@@ -1871,7 +2184,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25 \pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.125\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.125\pgfphysicalheight + 0.6\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.125\pgfphysicalheight}%
+      }%
     }%
     \fi
   }
@@ -1903,7 +2221,12 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.167\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.167\pgfphysicalwidth + 0.5\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.167\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -1911,7 +2234,11 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheigh - 0.333\beamerswitch at margint}%
+      }{%
+        \pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{3}
     {%
@@ -1919,7 +2246,12 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.833\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.833\pgfphysicalwidth - 0.5\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.833\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{4}
     {%
@@ -1927,7 +2259,12 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.167\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.167\pgfphysicalwidth + 0.5\beamerswitch at margin}%
+          {.25\pgfphysicalheight + 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.167\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{5}
     {%
@@ -1935,7 +2272,11 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight + 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{6}
     {%
@@ -1943,7 +2284,12 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.833\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.833\pgfphysicalwidth - 0.5\beamerswitch at margin}%
+          {.25\pgfphysicalheight + 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.833\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      }%
     }%
     \else
     % stack on top of one another
@@ -1952,7 +2298,12 @@
       border shrink=\pgfpageoptionborder,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.833\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.833\pgfphysicalheight - 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.833\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -1960,7 +2311,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.75\pgfphysicalwidth}{.833\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.75\pgfphysicalwidth - 0.333\beamerswitch at margin}%
+          {.833\pgfphysicalheight - 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.75\pgfphysicalwidth}{.833\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{3}
     {%
@@ -1968,7 +2324,11 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}{.5\pgfphysicalheight}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{4}
     {%
@@ -1976,7 +2336,11 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.75\pgfphysicalwidth - 0.333\beamerswitch at margin}{.5\pgfphysicalheight}%
+      }{%
+        \pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{5}
     {%
@@ -1984,7 +2348,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.167\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.167\pgfphysicalheight + 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.167\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{6}
     {%
@@ -1992,7 +2361,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.75\pgfphysicalwidth}{.167\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.75\pgfphysicalwidth - 0.333\beamerswitch at margin}%
+          {.167\pgfphysicalheight + 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.75\pgfphysicalwidth}{.167\pgfphysicalheight}%
+      }%
     }%
     \fi
   }
@@ -2024,7 +2398,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.125\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.125\pgfphysicalwidth + 0.6\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.125\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -2032,7 +2411,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.375\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.375\pgfphysicalwidth + 0.2\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.375\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{3}
     {%
@@ -2040,7 +2424,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.625\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.625\pgfphysicalwidth - 0.2\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.625\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{4}
     {%
@@ -2048,7 +2437,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.875\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.875\pgfphysicalwidth - 0.6\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.875\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{5}
     {%
@@ -2056,7 +2450,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.125\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.125\pgfphysicalwidth + 0.6\beamerswitch at margin}%
+          {.25\pgfphysicalheight + 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.125\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{6}
     {%
@@ -2064,7 +2463,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.375\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.375\pgfphysicalwidth + 0.2\beamerswitch at margin}%
+          {.25\pgfphysicalheight + 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.375\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{7}
     {%
@@ -2072,7 +2476,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.625\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.625\pgfphysicalwidth - 0.2\beamerswitch at margin}%
+          {.25\pgfphysicalheight + 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.625\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{8}
     {%
@@ -2080,7 +2489,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.875\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.875\pgfphysicalwidth - 0.6\beamerswitch at margin}%
+          {.25\pgfphysicalheight + 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.875\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      }%
     }%
     \else
     % stack on top of one another
@@ -2090,7 +2504,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.875\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.875\pgfphysicalheight - 0.6\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.875\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -2098,7 +2517,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25\pgfphysicalheight,%
-      center=\pgfpoint{.75\pgfphysicalwidth}{.875\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.75\pgfphysicalwidth - 0.333\beamerswitch at margin}%
+          {.875\pgfphysicalheight - 0.6\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.75\pgfphysicalwidth}{.875\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{3}
     {%
@@ -2106,7 +2530,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.625\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.625\pgfphysicalheight - 0.2\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.625\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{4}
     {%
@@ -2114,7 +2543,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25\pgfphysicalheight,%
-      center=\pgfpoint{.75\pgfphysicalwidth}{.625\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.75\pgfphysicalwidth - 0.333\beamerswitch at margin}%
+          {.625\pgfphysicalheight - 0.2\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.75\pgfphysicalwidth}{.625\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{5}
     {%
@@ -2122,7 +2556,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25 \pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.375\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.375\pgfphysicalheight + 0.2\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.375\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{6}
     {%
@@ -2130,7 +2569,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25 \pgfphysicalheight,%
-      center=\pgfpoint{.75\pgfphysicalwidth}{.375\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.75\pgfphysicalwidth - 0.333\beamerswitch at margin}%
+          {.375\pgfphysicalheight + 0.2\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.75\pgfphysicalwidth}{.375\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{7}
     {%
@@ -2138,7 +2582,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25 \pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.125\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.125\pgfphysicalheight + 0.6\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.125\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{8}
     {%
@@ -2146,7 +2595,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25 \pgfphysicalheight,%
-      center=\pgfpoint{.75\pgfphysicalwidth}{.125\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.75\pgfphysicalwidth - 0.333\beamerswitch at margin}%
+          {.125\pgfphysicalheight + 0.6\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.75\pgfphysicalwidth}{.125\pgfphysicalheight}%
+      }%
     }%
     \fi
   }
@@ -2153,121 +2607,6 @@
 }
 %    \end{macrocode}
 %
-% \begin{optionkey}{paper}
-% \begin{macro}{beamerswitch at handoutpaper}
-% In theory it would be nice to anticipate the paper size that the article mode
-% would use, and pass that as an option to \cs{pgfpagesuselayout} but as that's
-% unlikely to be clean code, we settle here for setting it with an option.
-%
-%    \begin{macrocode}
-\define at key[HL]{beamerswitch}{paper}{%
-  \def\beamerswitch at handoutpaper{#1}%
-}
-%    \end{macrocode}
-% \end{macro}
-% \end{optionkey}
-%
-% \begin{optionkey}{nup}
-% \begin{optionvalue}{2}
-% \begin{optionvalue}{3}
-% \begin{optionvalue}{3plus}
-% \begin{optionvalue}{4}
-% \begin{optionvalue}{4plus}
-% \begin{optionvalue}{6}
-% \begin{optionvalue}{8}
-% The \key{nup} option specifies how many slides to include per page.
-% The `plus' keyword indicates a layout with additional gaps for writing.
-%
-%    \begin{macrocode}
-\newcounter{beamerswitch at nupcase}
-\define at choicekey+[HL]{beamerswitch}{nup}[\val\nr]{2, 3, 3plus, 4, 4plus, 6, 8}{%
-  \setcounter{beamerswitch at nupcase}{\nr}
-}{%
-  \ClassWarning{beamerswitch}{Value of `nup' not recognized.
-    Allowed values are 2, 3, 3plus, 4, 4plus, 6, and 8.}%
-}
-%    \end{macrocode}
-% \end{optionvalue}
-% \end{optionvalue}
-% \end{optionvalue}
-% \end{optionvalue}
-% \end{optionvalue}
-% \end{optionvalue}
-% \end{optionvalue}
-% \end{optionkey}
-%
-% \begin{optionkey}{border}
-% The \key{borders} option switches on borders around the slides on handout
-% pages (and gaps where slides would appear if there were enough). The value
-% is used to set the width of the border.
-%
-%    \begin{macrocode}
-\define at key[HL]{beamerswitch}{border}[0.4pt]{%
-  \RequirePackage{pgf}%
-  \renewcommand*{\beamerswitch at Border}{\pgfsetlinewidth{#1}\pgfstroke}%
-}
-%    \end{macrocode}
-% \end{optionkey}
-%
-% \begin{optionkey}{pnos}
-% The \key{pnos} option switches on page numbers for handout pages.
-%
-%    \begin{macrocode}
-\define at boolkey[HL]{beamerswitch}{pnos}[true]{}
-%    \end{macrocode}
-% \end{optionkey}
-%
-% \begin{macro}{handoutlayout}
-% \begin{macro}{beamerswitch at nup}
-% We set up the \cs{handoutlayout} command for applying these options.
-%
-%    \begin{macrocode}
-\newcommand*{\handoutlayout}[1]{%
-  \only<handout>{%
-    \setkeys[HL]{beamerswitch}{#1}%
-    \ifcase\value{beamerswitch at nupcase}\relax
-      \def\beamerswitch at nup{2}
-      \pgfpagesuselayout{1 by 2}[\beamerswitch at handoutpaper,border shrink=5mm]%
-    \or
-      \def\beamerswitch at nup{3}
-      \pgfpagesuselayout{1 by 3}[\beamerswitch at handoutpaper,border shrink=5mm]%
-    \or
-      \def\beamerswitch at nup{3}
-      \pgfpagesuselayout{1 by 3 narrow}[\beamerswitch at handoutpaper,border shrink=5mm]%
-    \or
-      \def\beamerswitch at nup{4}
-      \pgfpagesuselayout{2 by 2}[\beamerswitch at handoutpaper,landscape,border shrink=5mm]%
-    \or
-      \def\beamerswitch at nup{4}
-      \pgfpagesuselayout{1 by 4 narrow}[\beamerswitch at handoutpaper,border shrink=5mm]%
-    \or
-      \def\beamerswitch at nup{6}
-      \pgfpagesuselayout{2 by 3}[\beamerswitch at handoutpaper,border shrink=5mm]%
-    \or
-      \def\beamerswitch at nup{8}
-      \pgfpagesuselayout{2 by 4}[\beamerswitch at handoutpaper,border shrink=5mm]%
-    \fi
-    \ifbool{HL at beamerswitch@pnos}{%
-      \def\pgfsys at endpicture{%
-        \raisebox{5mm}[0pt][0pt]{%
-          \makebox[\pgfphysicalwidth]{%
-            \the\numexpr\value{page}/\beamerswitch at nup\relax
-          }%
-        }%
-      }%
-    }{}%
-  }%
-}
-%    \end{macrocode}
-%\end{macro}
-%\end{macro}
-%
-% We initialize the class with a layout of six slides on A4 paper.
-%
-%    \begin{macrocode}
-\handoutlayout{paper=a4paper,nup=6}
-%    \end{macrocode}
-%
 % \subsection{Article layout}
 %
 % We provide some options for configuring the appearance of article mode.

Modified: trunk/Master/texmf-dist/tex/latex/beamerswitch/beamerswitch.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/beamerswitch/beamerswitch.cls	2018-08-30 19:33:53 UTC (rev 48510)
+++ trunk/Master/texmf-dist/tex/latex/beamerswitch/beamerswitch.cls	2018-08-30 19:34:51 UTC (rev 48511)
@@ -15,7 +15,7 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
 \ProvidesClass{beamerswitch}
-    [2017/12/10 v1.3 Convenient mode selection in Beamer documents]
+    [2018/08/29 v1.4 Convenient mode selection in Beamer documents]
 \RequirePackage{xkeyval,xkvltxp,etoolbox,xstring,shellesc,iftex}
 \define at boolkey[DC]{beamerswitch}{beamer}[true]{%
   \ifbool{DC at beamerswitch@beamer}{%
@@ -154,7 +154,111 @@
   \def\beamer at insttitle#1{\textsuperscript{#1}}
   \def\beamer at instinst#1{\textsuperscript{#1}\ignorespaces}
 }{}
+\def\beamerswitch at handoutpaper{a4paper}
+\define at key[HL]{beamerswitch}{paper}{%
+  \def\beamerswitch at handoutpaper{#1}%
+}
+\newcounter{beamerswitch at nupcase}
+\setcounter{beamerswitch at nupcase}{5}
+\define at choicekey+[HL]{beamerswitch}{nup}[\val\nr]{2, 3, 3plus, 4, 4plus, 6, 8}{%
+  \setcounter{beamerswitch at nupcase}{\nr}
+}{%
+  \ClassWarning{beamerswitch}{Value of `nup' not recognized.
+    Allowed values are 2, 3, 3plus, 4, 4plus, 6, and 8.}%
+}
 \newcommand*{\beamerswitch at Border}{\relax}
+\define at key[HL]{beamerswitch}{border}[0.4pt]{%
+  \RequirePackage{pgf}%
+  \ifdimcomp{#1}{>}{0pt}{%
+    \renewcommand*{\beamerswitch at Border}{\pgfsetlinewidth{#1}\pgfstroke}%
+  }{%
+    \renewcommand*{\beamerswitch at Border}{\relax}%
+  }%
+}
+\newlength{\beamerswitch at margin}
+\setlength{\beamerswitch at margin}{5mm}
+\define at key[HL]{beamerswitch}{margin}[0pt]{%
+  \setlength{\beamerswitch at margin}{#1}%
+}
+\define at boolkey[HL]{beamerswitch}{align}[true]{}
+\newlength{\handoutpnobaseline}
+\setlength{\handoutpnobaseline}{5mm}
+\define at boolkey[HL]{beamerswitch}{pnos}[true]{}
+\newlength{\beamerswitch at pnoadjust}
+\newcommand*{\handoutlayout}[1]{%
+  \only<handout>{%
+    \setlength{\beamerswitch at pnoadjust}{1em}%
+    \setkeys[HL]{beamerswitch}{#1}%
+    \ifbool{HL at beamerswitch@pnos}{%
+      \def\pgfsys at endpicture{%
+        \raisebox{\the\handoutpnobaseline}[0pt][0pt]{%
+          \makebox[\pgfphysicalwidth]{%
+            \the\numexpr(\value{page} - 2 + (\beamerswitch at nup / 2))%
+              / \beamerswitch at nup\relax
+          }%
+        }\par
+      }%
+      \ifbool{HL at beamerswitch@align}{%
+        \ifcase\value{beamerswitch at nupcase}\relax
+          \addtolength{\beamerswitch at pnoadjust}{-0.333\beamerswitch at margin}%
+        \or
+          \addtolength{\beamerswitch at pnoadjust}{-0.5\beamerswitch at margin}%
+        \or
+          \addtolength{\beamerswitch at pnoadjust}{-0.5\beamerswitch at margin}%
+        \or
+          \addtolength{\beamerswitch at pnoadjust}{-0.333\beamerswitch at margin}%
+        \or
+          \addtolength{\beamerswitch at pnoadjust}{-0.6\beamerswitch at margin}%
+        \or
+          \addtolength{\beamerswitch at pnoadjust}{-0.5\beamerswitch at margin}%
+        \or
+          \addtolength{\beamerswitch at pnoadjust}{-0.6\beamerswitch at margin}%
+        \fi
+      }{}%
+      \ifdimcomp{\beamerswitch at margin}{<}%
+          {\handoutpnobaseline + \beamerswitch at pnoadjust}{%
+        \setlength{\beamerswitch at margin}%
+          {\the\dimexpr\handoutpnobaseline + \beamerswitch at pnoadjust\relax}%
+      }{}%
+    }{%
+      \def\pgfsys at endpicture{}%
+    }%
+    \ifcase\value{beamerswitch at nupcase}\relax
+      \def\beamerswitch at nup{2}%
+      \pgfpagesuselayout{1 by 2}[\beamerswitch at handoutpaper,%
+        border shrink=\the\beamerswitch at margin]%
+    \or
+      \def\beamerswitch at nup{3}%
+      \pgfpagesuselayout{1 by 3}[\beamerswitch at handoutpaper,%
+        border shrink=\the\beamerswitch at margin]%
+    \or
+      \def\beamerswitch at nup{3}%
+      \pgfpagesuselayout{1 by 3 narrow}[\beamerswitch at handoutpaper,%
+        border shrink=\the\beamerswitch at margin]%
+    \or
+      \def\beamerswitch at nup{4}%
+      \pgfpagesuselayout{2 by 2}[\beamerswitch at handoutpaper,%
+        landscape,border shrink=\the\beamerswitch at margin]%
+    \or
+      \def\beamerswitch at nup{4}%
+      \pgfpagesuselayout{1 by 4 narrow}[\beamerswitch at handoutpaper,%
+        border shrink=\the\beamerswitch at margin]%
+    \or
+      \def\beamerswitch at nup{6}%
+      \pgfpagesuselayout{2 by 3}[\beamerswitch at handoutpaper,%
+        border shrink=\the\beamerswitch at margin]%
+    \or
+      \def\beamerswitch at nup{8}%
+      \pgfpagesuselayout{2 by 4}[\beamerswitch at handoutpaper,%
+        border shrink=\the\beamerswitch at margin]%
+    \fi
+  }%
+}
+\AtEndPreamble{%
+  \ifdef{\beamerswitch at nup}{}{%
+    \handoutlayout{}%
+  }%
+}
 \mode<handout>{%
   \pgfpagesdeclarelayout{1 by 2}
   {
@@ -179,7 +283,11 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}{.5\pgfphysicalheight}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -187,7 +295,11 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=\pgfphysicalheight,%
-      center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.75\pgfphysicalwidth - 0.333\beamerswitch at margin}{.5\pgfphysicalheight}%
+      }{%
+        \pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      }%
     }%
     \else
     % stack on top of one another
@@ -197,7 +309,11 @@
       border code=\beamerswitch at Border,%
       resized width=\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -205,7 +321,11 @@
       border code=\beamerswitch at Border,%
       resized width=\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight + 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      }%
     }%
     \fi
   }
@@ -232,7 +352,11 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=\pgfphysicalheight,%
-      center=\pgfpoint{.167\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.167\pgfphysicalwidth + 0.5\beamerswitch at margin}{.5\pgfphysicalheight}%
+      }{%
+        \pgfpoint{.167\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -248,7 +372,11 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=\pgfphysicalheight,%
-      center=\pgfpoint{.833\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.833\pgfphysicalwidth - 0.5\beamerswitch at margin}{.5\pgfphysicalheight}%
+      }{%
+        \pgfpoint{.833\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      }%
     }%
     \else
     % stack on top of one another
@@ -258,7 +386,11 @@
       border code=\beamerswitch at Border,%
       resized width=\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.5\pgfphysicalwidth}{.833\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.5\pgfphysicalwidth}{.833\pgfphysicalheight - 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.5\pgfphysicalwidth}{.833\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -274,7 +406,11 @@
       border code=\beamerswitch at Border,%
       resized width=\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.5\pgfphysicalwidth}{.167\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.5\pgfphysicalwidth}{.167\pgfphysicalheight + 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.5\pgfphysicalwidth}{.167\pgfphysicalheight}%
+      }%
     }%
     \fi
   }
@@ -301,7 +437,12 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.167\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.167\pgfphysicalwidth + 0.5\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.167\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -309,7 +450,11 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight - 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{3}
     {%
@@ -317,7 +462,12 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.833\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.833\pgfphysicalwidth - 0.5\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.833\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \else
     % stack on top of one another
@@ -327,7 +477,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.833\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.5\beamerswitch at margin}%
+          {.833\pgfphysicalheight - 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.833\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -335,7 +490,11 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.5\beamerswitch at margin}{.5\pgfphysicalheight}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{3}
     {%
@@ -343,7 +502,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.167\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.5\beamerswitch at margin}%
+          {.167\pgfphysicalheight + 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.167\pgfphysicalheight}%
+      }%
     }%
     \fi
   }
@@ -366,7 +530,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -374,7 +543,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.75\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.75\pgfphysicalwidth - 0.333\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.75\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{3}
     {%
@@ -382,7 +556,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.25\pgfphysicalheight + 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{4}
     {%
@@ -390,7 +569,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.75\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.75\pgfphysicalwidth - 0.333\beamerswitch at margin}%
+          {.25\pgfphysicalheight + 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.75\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      }%
     }%
   }
   \pgfpagesdeclarelayout{1 by 4 narrow}
@@ -416,7 +600,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.125\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.125\pgfphysicalwidth + 0.6\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.125\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -424,7 +613,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.375\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.375\pgfphysicalwidth + 0.2\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.375\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{3}
     {%
@@ -432,7 +626,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.625\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.625\pgfphysicalwidth - 0.2\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.625\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{4}
     {%
@@ -440,7 +639,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.875\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.875\pgfphysicalwidth - 0.6\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.875\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \else
     % stack on top of one another
@@ -450,7 +654,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.875\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.875\pgfphysicalheight - 0.6\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.875\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -458,7 +667,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.625\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.625\pgfphysicalheight - 0.2\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.625\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{3}
     {%
@@ -466,7 +680,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25 \pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.375\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.375\pgfphysicalheight + 0.2\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.375\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{4}
     {%
@@ -474,7 +693,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25 \pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.125\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.125\pgfphysicalheight + 0.6\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.125\pgfphysicalheight}%
+      }%
     }%
     \fi
   }
@@ -501,7 +725,12 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.167\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.167\pgfphysicalwidth + 0.5\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.167\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -509,7 +738,11 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheigh - 0.333\beamerswitch at margint}%
+      }{%
+        \pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{3}
     {%
@@ -517,7 +750,12 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.833\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.833\pgfphysicalwidth - 0.5\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.833\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{4}
     {%
@@ -525,7 +763,12 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.167\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.167\pgfphysicalwidth + 0.5\beamerswitch at margin}%
+          {.25\pgfphysicalheight + 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.167\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{5}
     {%
@@ -533,7 +776,11 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight + 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{6}
     {%
@@ -541,7 +788,12 @@
       border code=\beamerswitch at Border,%
       resized width=.333\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.833\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.833\pgfphysicalwidth - 0.5\beamerswitch at margin}%
+          {.25\pgfphysicalheight + 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.833\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      }%
     }%
     \else
     % stack on top of one another
@@ -550,7 +802,12 @@
       border shrink=\pgfpageoptionborder,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.833\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.833\pgfphysicalheight - 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.833\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -558,7 +815,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.75\pgfphysicalwidth}{.833\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.75\pgfphysicalwidth - 0.333\beamerswitch at margin}%
+          {.833\pgfphysicalheight - 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.75\pgfphysicalwidth}{.833\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{3}
     {%
@@ -566,7 +828,11 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}{.5\pgfphysicalheight}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{4}
     {%
@@ -574,7 +840,11 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.75\pgfphysicalwidth - 0.333\beamerswitch at margin}{.5\pgfphysicalheight}%
+      }{%
+        \pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{5}
     {%
@@ -582,7 +852,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.167\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.167\pgfphysicalheight + 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.167\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{6}
     {%
@@ -590,7 +865,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.333\pgfphysicalheight,%
-      center=\pgfpoint{.75\pgfphysicalwidth}{.167\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.75\pgfphysicalwidth - 0.333\beamerswitch at margin}%
+          {.167\pgfphysicalheight + 0.5\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.75\pgfphysicalwidth}{.167\pgfphysicalheight}%
+      }%
     }%
     \fi
   }
@@ -617,7 +897,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.125\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.125\pgfphysicalwidth + 0.6\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.125\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -625,7 +910,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.375\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.375\pgfphysicalwidth + 0.2\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.375\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{3}
     {%
@@ -633,7 +923,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.625\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.625\pgfphysicalwidth - 0.2\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.625\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{4}
     {%
@@ -641,7 +936,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.875\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.875\pgfphysicalwidth - 0.6\beamerswitch at margin}%
+          {.75\pgfphysicalheight - 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.875\pgfphysicalwidth}{.75\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{5}
     {%
@@ -649,7 +949,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.125\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.125\pgfphysicalwidth + 0.6\beamerswitch at margin}%
+          {.25\pgfphysicalheight + 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.125\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{6}
     {%
@@ -657,7 +962,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.375\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.375\pgfphysicalwidth + 0.2\beamerswitch at margin}%
+          {.25\pgfphysicalheight + 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.375\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{7}
     {%
@@ -665,7 +975,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.625\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.625\pgfphysicalwidth - 0.2\beamerswitch at margin}%
+          {.25\pgfphysicalheight + 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.625\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{8}
     {%
@@ -673,7 +988,12 @@
       border code=\beamerswitch at Border,%
       resized width=.25\pgfphysicalwidth,%
       resized height=.5\pgfphysicalheight,%
-      center=\pgfpoint{.875\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.875\pgfphysicalwidth - 0.6\beamerswitch at margin}%
+          {.25\pgfphysicalheight + 0.333\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.875\pgfphysicalwidth}{.25\pgfphysicalheight}%
+      }%
     }%
     \else
     % stack on top of one another
@@ -683,7 +1003,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.875\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.875\pgfphysicalheight - 0.6\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.875\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{2}
     {%
@@ -691,7 +1016,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25\pgfphysicalheight,%
-      center=\pgfpoint{.75\pgfphysicalwidth}{.875\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.75\pgfphysicalwidth - 0.333\beamerswitch at margin}%
+          {.875\pgfphysicalheight - 0.6\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.75\pgfphysicalwidth}{.875\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{3}
     {%
@@ -699,7 +1029,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25\pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.625\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.625\pgfphysicalheight - 0.2\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.625\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{4}
     {%
@@ -707,7 +1042,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25\pgfphysicalheight,%
-      center=\pgfpoint{.75\pgfphysicalwidth}{.625\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.75\pgfphysicalwidth - 0.333\beamerswitch at margin}%
+          {.625\pgfphysicalheight - 0.2\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.75\pgfphysicalwidth}{.625\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{5}
     {%
@@ -715,7 +1055,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25 \pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.375\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.375\pgfphysicalheight + 0.2\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.375\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{6}
     {%
@@ -723,7 +1068,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25 \pgfphysicalheight,%
-      center=\pgfpoint{.75\pgfphysicalwidth}{.375\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.75\pgfphysicalwidth - 0.333\beamerswitch at margin}%
+          {.375\pgfphysicalheight + 0.2\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.75\pgfphysicalwidth}{.375\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{7}
     {%
@@ -731,7 +1081,12 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25 \pgfphysicalheight,%
-      center=\pgfpoint{.25\pgfphysicalwidth}{.125\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.25\pgfphysicalwidth + 0.333\beamerswitch at margin}%
+          {.125\pgfphysicalheight + 0.6\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.25\pgfphysicalwidth}{.125\pgfphysicalheight}%
+      }%
     }%
     \pgfpageslogicalpageoptions{8}
     {%
@@ -739,63 +1094,16 @@
       border code=\beamerswitch at Border,%
       resized width=.5\pgfphysicalwidth,%
       resized height=.25 \pgfphysicalheight,%
-      center=\pgfpoint{.75\pgfphysicalwidth}{.125\pgfphysicalheight}%
+      center=\ifbool{HL at beamerswitch@align}{%
+        \pgfpoint{.75\pgfphysicalwidth - 0.333\beamerswitch at margin}%
+          {.125\pgfphysicalheight + 0.6\beamerswitch at margin}%
+      }{%
+        \pgfpoint{.75\pgfphysicalwidth}{.125\pgfphysicalheight}%
+      }%
     }%
     \fi
   }
 }
-\define at key[HL]{beamerswitch}{paper}{%
-  \def\beamerswitch at handoutpaper{#1}%
-}
-\newcounter{beamerswitch at nupcase}
-\define at choicekey+[HL]{beamerswitch}{nup}[\val\nr]{2, 3, 3plus, 4, 4plus, 6, 8}{%
-  \setcounter{beamerswitch at nupcase}{\nr}
-}{%
-  \ClassWarning{beamerswitch}{Value of `nup' not recognized.
-    Allowed values are 2, 3, 3plus, 4, 4plus, 6, and 8.}%
-}
-\define at key[HL]{beamerswitch}{border}[0.4pt]{%
-  \RequirePackage{pgf}%
-  \renewcommand*{\beamerswitch at Border}{\pgfsetlinewidth{#1}\pgfstroke}%
-}
-\define at boolkey[HL]{beamerswitch}{pnos}[true]{}
-\newcommand*{\handoutlayout}[1]{%
-  \only<handout>{%
-    \setkeys[HL]{beamerswitch}{#1}%
-    \ifcase\value{beamerswitch at nupcase}\relax
-      \def\beamerswitch at nup{2}
-      \pgfpagesuselayout{1 by 2}[\beamerswitch at handoutpaper,border shrink=5mm]%
-    \or
-      \def\beamerswitch at nup{3}
-      \pgfpagesuselayout{1 by 3}[\beamerswitch at handoutpaper,border shrink=5mm]%
-    \or
-      \def\beamerswitch at nup{3}
-      \pgfpagesuselayout{1 by 3 narrow}[\beamerswitch at handoutpaper,border shrink=5mm]%
-    \or
-      \def\beamerswitch at nup{4}
-      \pgfpagesuselayout{2 by 2}[\beamerswitch at handoutpaper,landscape,border shrink=5mm]%
-    \or
-      \def\beamerswitch at nup{4}
-      \pgfpagesuselayout{1 by 4 narrow}[\beamerswitch at handoutpaper,border shrink=5mm]%
-    \or
-      \def\beamerswitch at nup{6}
-      \pgfpagesuselayout{2 by 3}[\beamerswitch at handoutpaper,border shrink=5mm]%
-    \or
-      \def\beamerswitch at nup{8}
-      \pgfpagesuselayout{2 by 4}[\beamerswitch at handoutpaper,border shrink=5mm]%
-    \fi
-    \ifbool{HL at beamerswitch@pnos}{%
-      \def\pgfsys at endpicture{%
-        \raisebox{5mm}[0pt][0pt]{%
-          \makebox[\pgfphysicalwidth]{%
-            \the\numexpr\value{page}/\beamerswitch at nup\relax
-          }%
-        }%
-      }%
-    }{}%
-  }%
-}
-\handoutlayout{paper=a4paper,nup=6}
 \define at boolkey[AL]{beamerswitch}{maketitle}[true]{}
 \newtoggle{titlepunct}
 \IfFileExists{xparse.sty}{\@tempswatrue}{\@tempswafalse}



More information about the tex-live-commits mailing list