% Copyright (C) 2009–2018 by Guido Diepen % Parts provided by Edson Valle % Copyright (C) 2021 Marei Peischl % %% ============================================================================ %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. %% The latest version of this license is in %% http://www.latex-project.org/lppl.txt %% and version 1.3c or later is part of all distributions of LaTeX %% version 2008/05/04 or later. %% %% This work has the LPPL maintenance status `maintained'. %% %% The Current Maintainers of this work are %% Marei Peischl %% Guido Diepen %% %% The development respository can be found at %% https://github.com/gdiepen/latexbeamer-handoutWithNotes %% Please use the issue tracker for feedback! %% %% ============================================================================ %% \ProvidesPackage{handoutWithNotes}[2021/10/21 v1.0 pgfpages layouts to print beamer slides with notes] \RequirePackage{l3keys2e} \ExplSyntaxOn \keys_define:nn {handoutWithNotes} { slide-frame .bool_gset:N = \g__handoutWithNotes_print_slide_frame_bool, slide-frame .initial:n = false, slide-frame .default:n = true, note-frame .bool_gset:N = \g__handoutWithNotes_print_note_frame_bool, note-frame .initial:n = false, note-frame .default:n = true, beamer-notes .bool_gset:N = \g__handoutWithNotes_beamer_notes_bool, beamer-notes .initial:n = false, beamer-notes .default:n = true, lines .int_gset:N = \g_handoutWithNotes_lines_int, lines .initial:n = 8 } \ProcessKeysOptions{handoutWithNotes} \newcommand*{\handoutwithNotes@conditionalFrame}[1]{ \bool_if:cT {g__handoutWithNotes_print_#1_frame_bool} {\pgfusepath{stroke}} } \ExplSyntaxOff \RequirePackage{pgfpages} \RequirePackage{translator} \providetranslation[to=English]{Notes}{Notes} \providetranslation[to=German]{Notes}{Notizen} \providetranslation[to=French]{Notes}{Notes} \ExplSyntaxOn \cs_if_exist:NTF \pageheight { \cs_set:Nn \handoutWithNotes_pageheight: {\pageheight} } { \cs_set:Nn \handoutWithNotes_pageheight: {\pdfpageheight} } \box_new:N \g__handoutWithNotes_notes_box \tl_new:N \l_handoutWithNotes_title_tl \hook_new:n {handoutWithNotes/notesbox} \hook_new:n {handoutWithNotes/notesbox/title} \hook_new:n {handoutWithNotes/notesbox/content} \newcommand{\handoutWithNotes@initNotesBox}[1]{ \bool_if:NTF \g__handoutWithNotes_beamer_notes_bool { \beamer@twoscreensnotestrue \setbeameroption{show~notes} \gdef\beamer@currentmode{handout} \setbeamertemplate{note~page}[plain] \let\beamer@outsideframenote\handoutWithNotes@beamer@outsideframenote \msg_new:nnn {handoutWithNotes} {patch-beamer@outsideframenote} {I~am~patching~the~note~mechanism~to~be~able~to~place~multiple~note~pages~on~one~physical~page.} \msg_info:nn {handoutWithNotes} {patch-beamer@outsideframenote} }{ \vbox_set:Nn \g__handoutWithNotes_notes_box { \hsize=\paperwidth \skip_vertical:n {-1in} \skip_horizontal:n {-1in} \vbox_to_ht:nn {\handoutWithNotes_pageheight:} { \skip_vertical:n {\topskip} \translatelet{\l_handoutWithNotes_title_tl}{Notes}% \hook_use:n {handoutWithNotes/notesbox} \tl_if_empty:NF \l_handoutWithNotes_title_tl {\hook_use:n {handoutWithNotes/notesbox/title}\l_handoutWithNotes_title_tl} \hook_use:n {handoutWithNotes/notesbox/content} \skip_vertical:n {\fill} \int_step_inline:nn {\g_handoutWithNotes_lines_int} {\hrule width\paperwidth\skip_vertical:n {\fill}} } } \int_step_inline:nnn {#1+1} {2*#1} {\pgfpagesshipoutlogicalpage{##1}\box_use:N \g__handoutWithNotes_notes_box} } } %backwards compatibility \let\notesbox\g__handoutWithNotes_notes_box \ExplSyntaxOff % 1 on 1 with notes landscape % ---------------------------------------- % | %%%%%%%%%%%%%%%%%% __________________ | % | %%%%%%%%%%%%%%%%%% __________________ | % | %%%%%%%%%%%%%%%%%% __________________ | % | %%%%%%%%%%%%%%%%%% __________________ | % | %%%%%%%%%%%%%%%%%% __________________ | % | %%%%%%%%%%%%%%%%%% __________________ | % | %%%%%%%%%%%%%%%%%% __________________ | % | %%%%%%%%%%%%%%%%%% __________________ | % | %%%%%%%%%%%%%%%%%% __________________ | % | %%%%%%%%%%%%%%%%%% __________________ | % ---------------------------------------- \pgfpagesdeclarelayout{1 on 1 with notes landscape} { \edef\pgfpageoptionheight{\the\paperwidth} \edef\pgfpageoptionwidth{\the\paperheight} \edef\pgfpageoptionborder{0pt} } { \setkeys{pgfpagesuselayoutoption}{landscape} \pgfpagesphysicalpageoptions {% logical pages=2,% physical height=\pgfpageoptionheight,% physical width=\pgfpageoptionwidth,% last logical shipout=1% } \pgfpageslogicalpageoptions{1} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.5\pgfphysicalheight,% center=\pgfpoint{.25\pgfphysicalwidth}{.5\pgfphysicalheight},% border code=\handoutwithNotes@conditionalFrame{slide},% }% \pgfpageslogicalpageoptions{2} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.5\pgfphysicalheight,% center=\pgfpoint{.75\pgfphysicalwidth}{.5\pgfphysicalheight},% copy from=2,% border code=\handoutwithNotes@conditionalFrame{note},% }% \AtBeginDocument{ \handoutWithNotes@initNotesBox{1} } } % 4 on 1 with notes % -------------------------- % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % -------------------------- \pgfpagesdeclarelayout{4 on 1 with notes} { \edef\pgfpageoptionheight{\the\paperheight} \edef\pgfpageoptionwidth{\the\paperwidth} \edef\pgfpageoptionborder{0pt} } { \pgfpagesphysicalpageoptions {% logical pages=8,% physical height=\pgfpageoptionheight,% physical width=\pgfpageoptionwidth,% last logical shipout=4% } \pgfpageslogicalpageoptions{1} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.25\pgfphysicalheight,% center=\pgfpoint{.25\pgfphysicalwidth}{.875\pgfphysicalheight},% border code=\handoutwithNotes@conditionalFrame{slide},% }% \pgfpageslogicalpageoptions{2} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.25\pgfphysicalheight,% center=\pgfpoint{.25\pgfphysicalwidth}{.625\pgfphysicalheight},% border code=\handoutwithNotes@conditionalFrame{slide},% }% \pgfpageslogicalpageoptions{3} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.25\pgfphysicalheight,% center=\pgfpoint{.25\pgfphysicalwidth}{.375\pgfphysicalheight},% border code=\handoutwithNotes@conditionalFrame{slide},% }% \pgfpageslogicalpageoptions{4} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.25\pgfphysicalheight,% center=\pgfpoint{.25\pgfphysicalwidth}{.125\pgfphysicalheight},% border code=\handoutwithNotes@conditionalFrame{slide},% }% \pgfpageslogicalpageoptions{5} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.25\pgfphysicalheight,% center=\pgfpoint{.75\pgfphysicalwidth}{.875\pgfphysicalheight},% copy from=5,% border code=\handoutwithNotes@conditionalFrame{note},% }% \pgfpageslogicalpageoptions{6} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.25\pgfphysicalheight,% center=\pgfpoint{.75\pgfphysicalwidth}{.625\pgfphysicalheight},% copy from=6,% border code=\handoutwithNotes@conditionalFrame{note},% }% \pgfpageslogicalpageoptions{7} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.25\pgfphysicalheight,% center=\pgfpoint{.75\pgfphysicalwidth}{.375\pgfphysicalheight},% copy from=7,% border code=\handoutwithNotes@conditionalFrame{note},% }% \pgfpageslogicalpageoptions{8} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.25\pgfphysicalheight,% center=\pgfpoint{.75\pgfphysicalwidth}{.125\pgfphysicalheight},% copy from=8,% border code=\handoutwithNotes@conditionalFrame{note},% }% \AtBeginDocument{ \handoutWithNotes@initNotesBox{4} } } % 2 on 1 with notes % -------------------------- % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % -------------------------- \pgfpagesdeclarelayout{2 on 1 with notes} { \edef\pgfpageoptionheight{\the\paperheight} \edef\pgfpageoptionwidth{\the\paperwidth} \edef\pgfpageoptionborder{0pt} } { \pgfpagesphysicalpageoptions {% logical pages=4,% physical height=\pgfpageoptionheight,% physical width=\pgfpageoptionwidth,% last logical shipout=2% } \pgfpageslogicalpageoptions{1} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.5\pgfphysicalheight,% center=\pgfpoint{.25\pgfphysicalwidth}{.75\pgfphysicalheight},% border code=\handoutwithNotes@conditionalFrame{slide},% }% \pgfpageslogicalpageoptions{2} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.5\pgfphysicalheight,% center=\pgfpoint{.25\pgfphysicalwidth}{.25\pgfphysicalheight},% border code=\handoutwithNotes@conditionalFrame{slide},% }% \pgfpageslogicalpageoptions{3} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.5\pgfphysicalheight,% center=\pgfpoint{.75\pgfphysicalwidth}{.75\pgfphysicalheight},% copy from=3,% border code=\handoutwithNotes@conditionalFrame{note},% }% \pgfpageslogicalpageoptions{4} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.5\pgfphysicalheight,% center=\pgfpoint{.75\pgfphysicalwidth}{.25\pgfphysicalheight},% copy from=4,% border code=\handoutwithNotes@conditionalFrame{note},% }% \AtBeginDocument{ \handoutWithNotes@initNotesBox{2} } } % 3 on 1 with notes % -------------------------- % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % | %%%%%%%%%%% ___________ | % -------------------------- \pgfpagesdeclarelayout{3 on 1 with notes} { \edef\pgfpageoptionheight{\the\paperheight} \edef\pgfpageoptionwidth{\the\paperwidth} \edef\pgfpageoptionborder{0pt} } { \pgfpagesphysicalpageoptions {% logical pages=6,% physical height=\pgfpageoptionheight,% physical width=\pgfpageoptionwidth,% last logical shipout=3% } \pgfpageslogicalpageoptions{1} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.33\pgfphysicalheight,% center=\pgfpoint{.25\pgfphysicalwidth}{.83\pgfphysicalheight},% border code=\handoutwithNotes@conditionalFrame{slide},% }% \pgfpageslogicalpageoptions{2} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.33\pgfphysicalheight,% center=\pgfpoint{.25\pgfphysicalwidth}{.50\pgfphysicalheight},% border code=\handoutwithNotes@conditionalFrame{slide},% }% \pgfpageslogicalpageoptions{3} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.33\pgfphysicalheight,% center=\pgfpoint{.25\pgfphysicalwidth}{.17\pgfphysicalheight},% border code=\handoutwithNotes@conditionalFrame{slide},% }% \pgfpageslogicalpageoptions{4} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.33\pgfphysicalheight,% center=\pgfpoint{.75\pgfphysicalwidth}{.83\pgfphysicalheight},% copy from=4,% border code=\handoutwithNotes@conditionalFrame{note},% }% \pgfpageslogicalpageoptions{5} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.33\pgfphysicalheight,% center=\pgfpoint{.75\pgfphysicalwidth}{.50\pgfphysicalheight},% copy from=5,% border code=\handoutwithNotes@conditionalFrame{note},% }% \pgfpageslogicalpageoptions{6} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.33\pgfphysicalheight,% center=\pgfpoint{.75\pgfphysicalwidth}{.17\pgfphysicalheight},% copy from=6,% border code=\handoutwithNotes@conditionalFrame{note},% }% \AtBeginDocument{ \handoutWithNotes@initNotesBox{3} } } % 2 on 1 with notes landscape % ---------------------------------------- % | %%%%%%%%%%%%%%%%%% __________________ | % | %%%%%%%%%%%%%%%%%% __________________ | % | %%%%%%%%%%%%%%%%%% __________________ | % | %%%%%%%%%%%%%%%%%% __________________ | % | | % | | % | %%%%%%%%%%%%%%%%%% __________________ | % | %%%%%%%%%%%%%%%%%% __________________ | % | %%%%%%%%%%%%%%%%%% __________________ | % | %%%%%%%%%%%%%%%%%% __________________ | % ---------------------------------------- \pgfpagesdeclarelayout{2 on 1 with notes landscape} { \edef\pgfpageoptionheight{\the\paperheight} \edef\pgfpageoptionwidth{\the\paperwidth} \edef\pgfpageoptionborder{0pt} } { \setkeys{pgfpagesuselayoutoption}{landscape} \pgfpagesphysicalpageoptions {% logical pages=4,% physical height=\pgfpageoptionheight,% physical width=\pgfpageoptionwidth,% last logical shipout=2% } \pgfpageslogicalpageoptions{1} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.5\pgfphysicalheight,% center=\pgfpoint{.25\pgfphysicalwidth}{.75\pgfphysicalheight},% border code=\handoutwithNotes@conditionalFrame{slide},% }% \pgfpageslogicalpageoptions{2} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.5\pgfphysicalheight,% center=\pgfpoint{.25\pgfphysicalwidth}{.25\pgfphysicalheight},% border code=\handoutwithNotes@conditionalFrame{slide},% }% \pgfpageslogicalpageoptions{3} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.5\pgfphysicalheight,% center=\pgfpoint{.75\pgfphysicalwidth}{.75\pgfphysicalheight},% copy from=3,% border code=\handoutwithNotes@conditionalFrame{note},% }% \pgfpageslogicalpageoptions{4} {% border shrink=\pgfpageoptionborder,% resized width=.5\pgfphysicalwidth,% resized height=.5\pgfphysicalheight,% center=\pgfpoint{.75\pgfphysicalwidth}{.25\pgfphysicalheight},% copy from=4,% border code=\handoutwithNotes@conditionalFrame{note},% }% \AtBeginDocument{ \handoutWithNotes@initNotesBox{2} } } % 1 on 1 with notes % -------------------------- % | %%%%%%%%%%%%%%%%%%%%%%%% | % | %%%%%%%%%%%%%%%%%%%%%%%% | % | %%%%%%%%%%%%%%%%%%%%%%%% | % | %%%%%%%%%%%%%%%%%%%%%%%% | % | %%%%%%%%%%%%%%%%%%%%%%%% | % | %%%%%%%%%%%%%%%%%%%%%%%% | % | %%%%%%%%%%%%%%%%%%%%%%%% | % | | % | ________________________ | % | ________________________ | % | ________________________ | % | ________________________ | % | ________________________ | % | ________________________ | % | ________________________ | % -------------------------- \pgfpagesdeclarelayout{1 on 1 with notes} { \edef\pgfpageoptionheight{\the\paperwidth} \edef\pgfpageoptionwidth{\the\paperheight} \edef\pgfpageoptionborder{0pt} } { \pgfpagesphysicalpageoptions {% logical pages=2,% physical height=\pgfpageoptionheight,% physical width=\pgfpageoptionwidth,% last logical shipout=1% } \pgfpageslogicalpageoptions{1} {% border shrink=\pgfpageoptionborder,% resized width=\pgfphysicalwidth,% resized height=.5\pgfphysicalheight,% center=\pgfpoint{.5\pgfphysicalwidth}{.75\pgfphysicalheight},% border code=\handoutwithNotes@conditionalFrame{slide},% }% \pgfpageslogicalpageoptions{2} {% border shrink=\pgfpageoptionborder,% resized width=\pgfphysicalwidth,% resized height=.5\pgfphysicalheight,% center=\pgfpoint{.5\pgfphysicalwidth}{.25\pgfphysicalheight},% copy from=2,% border code=\handoutwithNotes@conditionalFrame{note},% }% \AtBeginDocument{ \handoutWithNotes@initNotesBox{1} } } % if print-beamer-notes is enable the note frame has to be patched \ExplSyntaxOn \int_new:N \g__handoutWithNotes_last_shipout_int \int_new:N \g__handoutWithNotes_current_note_page_int %Modified variant of beamer@outsideframenote %the patch allows multi page layouts with pgfpages %based on the definition in beamerbasenotes.sty % Copyright 2003--2007 by Till Tantau % Copyright 2010 by Vedran Mileti\'c % Copyright 2012,2015 by Vedran Mileti\'c, Joseph Wright % Copyright 2017,2018 by Louis Stuart, Joseph Wright \newcommand\handoutWithNotes@beamer@outsideframenote[2][]{% \beamer@savemode% \ifbeamer@inlecture% \def\beamer@noteenvstart{}% \def\beamer@noteenvend{}% \setkeys{beamernotes}{#1}% \ifbeamer@notes \begingroup \setbeamertemplate{itemize~item}{\textbullet} \setbeamertemplate{itemize~subitem}{--} \setbeamertemplate{enumerate~item}{\insertenumlabel.} \setbeamertemplate{enumerate~subitem}{\insertenumlabel.\insertsubenumlabel} \def\@oddhead{} \def\@oddfoot{} \let\@evenhead\@oddhead \let\@evenfoot\@oddfoot \def\beamer@backgroundtemplate{}% \setbeamercolor{item}{fg=black,bg=white} \color{black}% \nointerlineskip \hbox{\hskip-\Gm@lmargin\hskip1cm\vbox to\textheight{% %pretend to have ``standard'' margins \edef\beamer@origlmargin{\Gm@lmargin}% \edef\beamer@origrmargin{\Gm@rmargin}% \def\Gm@lmargin{1cm}% \def\Gm@rmargin{1cm}% \textwidth=\dimexpr\paperwidth-\Gm@lmargin-\Gm@rmargin\relax% \hsize=\textwidth% \@arrayparboxrestore% \vskip-\headheight% \def\insertnote{\vbox{}% \beamer@noteenvstart#2\beamer@noteenvend% }% \usebeamertemplate*{note~page}% \vfil% \vskip-4pt% foot separator \vskip-\footheight}\hskip-\Gm@lmargin\hskip1cm}% \ifbeamer@twoscreensnotes% \int_compare:nF {\the\pgf@currentshipout = \g__handoutWithNotes_last_shipout_int}{ \int_gset:Nn \g__handoutWithNotes_last_shipout_int {\the\pgf@currentshipout} \int_compare:nTF {\g__handoutWithNotes_current_note_page_int=\the\pgf@lastshipout} { \int_gset:Nn \g__handoutWithNotes_current_note_page_int {1} } { \int_gincr:N \g__handoutWithNotes_current_note_page_int } } \pgfpagescurrentpagewillbelogicalpage{\int_eval:n {\g__handoutWithNotes_current_note_page_int+\the\pgf@lastshipout}} \advance\c@page by-1\relax% \fi% \clearpage \endgroup \fi% \fi% \beamer@resumemode} \ExplSyntaxOff \endinput