From aa9e4ab75471eeac43f5e31aea1e7293ebba6d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Beamonte?= Date: Wed, 4 May 2016 17:53:53 -0400 Subject: [PATCH 1/6] Make the lastframenumber a global variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Beamonte --- pdfpcnotes.sty | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pdfpcnotes.sty b/pdfpcnotes.sty index 3d1b6ea..55d5bea 100644 --- a/pdfpcnotes.sty +++ b/pdfpcnotes.sty @@ -1,3 +1,4 @@ + \ProvidesPackage{pdfpcnotes} % create a new file handle @@ -15,7 +16,7 @@ \endgroup -\def\lastframenumber{0} +\global\def\lastframenumber{0} % define command \pnote{} that works like note but % additionally writes notes to file in pdfpc readable format @@ -25,7 +26,7 @@ % if frame changed - write a new header \ifdim\theframenumber pt>\lastframenumber pt - \let\lastframenumber\theframenumber + \global\edef\lastframenumber{\theframenumber} \begingroup \let\#\hashchar \immediate\write\pdfpcnotesfile{\#\#\# \theframenumber}% From 772a43b7a71f84afd1e1ff1b3be48de84e1dc31c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Beamonte?= Date: Wed, 4 May 2016 18:44:12 -0400 Subject: [PATCH 2/6] Manage font size as a package option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Beamonte --- pdfpcnotes.sty | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pdfpcnotes.sty b/pdfpcnotes.sty index 55d5bea..6f31f39 100644 --- a/pdfpcnotes.sty +++ b/pdfpcnotes.sty @@ -1,5 +1,11 @@ -\ProvidesPackage{pdfpcnotes} +\ProvidesPackage% + {pdfpcnotes}% + [2016/05/04 \space ver 0.2 \space To generate notes to use with pdfpc] + +\RequirePackage{kvoptions} +\DeclareStringOption{fontsize}[32130] +\ProcessKeyvalOptions*\relax % create a new file handle \newwrite\pdfpcnotesfile @@ -7,6 +13,12 @@ % open file on \begin{document} \AtBeginDocument{% \immediate\openout\pdfpcnotesfile\jobname.pdfpc\relax + \immediate\write\pdfpcnotesfile{[file]} + \immediate\write\pdfpcnotesfile{\jobname.pdf} + \ifx\pdfpcnotes@fontsize\@empty + \else + \immediate\write\pdfpcnotesfile{[font_size]^^J\pdfpcnotes@fontsize} + \fi \immediate\write\pdfpcnotesfile{[notes]} } % define a # http://tex.stackexchange.com/a/37757/10327 From e8feb7d7a355c7b742cb949821ac1d9a68bc25fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Beamonte?= Date: Wed, 4 May 2016 19:39:54 -0400 Subject: [PATCH 3/6] Add a way not to add multiple times the same note when there is multiple overlays MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Beamonte --- pdfpcnotes.sty | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/pdfpcnotes.sty b/pdfpcnotes.sty index 6f31f39..430cf47 100644 --- a/pdfpcnotes.sty +++ b/pdfpcnotes.sty @@ -3,6 +3,9 @@ {pdfpcnotes}% [2016/05/04 \space ver 0.2 \space To generate notes to use with pdfpc] +\RequirePackage{forloop} +\RequirePackage{pdftexcmds} + \RequirePackage{kvoptions} \DeclareStringOption{fontsize}[32130] \ProcessKeyvalOptions*\relax @@ -28,7 +31,10 @@ \endgroup -\global\def\lastframenumber{0} +\global\def\pdfpcnotes@lastframenumber{0} +\newcounter{pdfpcnotes@currentframenotes} +\newcounter{pdfpcnotes@checkifnoteexists} +\newif\ifpdfpcnotes@noteexists % define command \pnote{} that works like note but % additionally writes notes to file in pdfpc readable format @@ -37,16 +43,37 @@ \note{#1}% % if frame changed - write a new header - \ifdim\theframenumber pt>\lastframenumber pt - \global\edef\lastframenumber{\theframenumber} + \ifdim\theframenumber pt>\pdfpcnotes@lastframenumber pt + \global\edef\pdfpcnotes@lastframenumber{\theframenumber} + \setcounter{pdfpcnotes@currentframenotes}{0} \begingroup \let\#\hashchar \immediate\write\pdfpcnotesfile{\#\#\# \theframenumber}% \endgroup \fi - % write note to file - \immediate\write\pdfpcnotesfile{\unexpanded{#1}}% + % check if note was already stored + \pdfpcnotes@noteexistsfalse + \forloop{pdfpcnotes@checkifnoteexists}{0}{% + \value{pdfpcnotes@checkifnoteexists} < \value{pdfpcnotes@currentframenotes}% + }{ + \ifnum\pdf@strcmp{\unexpanded{#1}}{\csname pdfpcnotes@currentframenotes@\thepdfpcnotes@checkifnoteexists\endcsname}=0 + \pdfpcnotes@noteexiststrue + \setcounter{pdfpcnotes@checkifnoteexists}{\value{pdfpcnotes@currentframenotes}} + \else + \fi + } + + % and then, only if the note was not stored + \ifpdfpcnotes@noteexists + \else + % add note in stored notes + \expandafter\global\expandafter\def\csname pdfpcnotes@currentframenotes@\thepdfpcnotes@currentframenotes\endcsname{\unexpanded{#1}}% + \stepcounter{pdfpcnotes@currentframenotes}% + + % write note to file + \immediate\write\pdfpcnotesfile{\unexpanded{#1}}% + \fi } % close file on \begin{document} \AtEndDocument{% From d21534e1822cd59a003faf4570fb8e8e0b758032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Beamonte?= Date: Wed, 4 May 2016 20:39:42 -0400 Subject: [PATCH 4/6] Allow to use \\ and \par in notes without needing a sed after MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Beamonte --- pdfpcnotes.sty | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pdfpcnotes.sty b/pdfpcnotes.sty index 430cf47..2de909b 100644 --- a/pdfpcnotes.sty +++ b/pdfpcnotes.sty @@ -72,7 +72,11 @@ \stepcounter{pdfpcnotes@currentframenotes}% % write note to file - \immediate\write\pdfpcnotesfile{\unexpanded{#1}}% + \begingroup + \def\\{^^J} + \def\par{^^J^^J} + \immediate\write\pdfpcnotesfile{#1}% + \endgroup \fi } % close file on \begin{document} From b0463a39f8228642cd7170473446d71598b14662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Beamonte?= Date: Fri, 21 Oct 2016 17:49:31 -0400 Subject: [PATCH 5/6] Add header and copyright information MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Beamonte --- pdfpcnotes.sty | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pdfpcnotes.sty b/pdfpcnotes.sty index 2de909b..981d1cc 100644 --- a/pdfpcnotes.sty +++ b/pdfpcnotes.sty @@ -1,3 +1,14 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% pdfpcnotes.sty +% +% Create notes for PDFPC from a beamer file +% +% Copyright 2013 Carsten Brandt +% Copyright 2013 Aggelos Karalias +% Copyright 2014-2016 Raphaël Beamonte +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ProvidesPackage% {pdfpcnotes}% From c3832cd6b53ebe4a3ced64ff253017e1e0a54098 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Beamonte?= Date: Fri, 21 Oct 2016 17:50:05 -0400 Subject: [PATCH 6/6] Add % symbols at the end of each line to prevent adding unwanted spaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Beamonte --- pdfpcnotes.sty | 49 ++++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/pdfpcnotes.sty b/pdfpcnotes.sty index 981d1cc..3897589 100644 --- a/pdfpcnotes.sty +++ b/pdfpcnotes.sty @@ -52,46 +52,45 @@ \newcommand{\pnote}[1]{% % keep normal notes working \note{#1}% - +% % if frame changed - write a new header \ifdim\theframenumber pt>\pdfpcnotes@lastframenumber pt - \global\edef\pdfpcnotes@lastframenumber{\theframenumber} - \setcounter{pdfpcnotes@currentframenotes}{0} - \begingroup - \let\#\hashchar + \global\edef\pdfpcnotes@lastframenumber{\theframenumber}% + \setcounter{pdfpcnotes@currentframenotes}{0}% + \begingroup% + \let\#\hashchar% \immediate\write\pdfpcnotesfile{\#\#\# \theframenumber}% - \endgroup - \fi - + \endgroup% + \fi% +% % check if note was already stored - \pdfpcnotes@noteexistsfalse + \pdfpcnotes@noteexistsfalse% \forloop{pdfpcnotes@checkifnoteexists}{0}{% \value{pdfpcnotes@checkifnoteexists} < \value{pdfpcnotes@currentframenotes}% - }{ + }{% \ifnum\pdf@strcmp{\unexpanded{#1}}{\csname pdfpcnotes@currentframenotes@\thepdfpcnotes@checkifnoteexists\endcsname}=0 - \pdfpcnotes@noteexiststrue - \setcounter{pdfpcnotes@checkifnoteexists}{\value{pdfpcnotes@currentframenotes}} - \else - \fi - } - + \pdfpcnotes@noteexiststrue% + \setcounter{pdfpcnotes@checkifnoteexists}{\value{pdfpcnotes@currentframenotes}}% + \else% + \fi% + }% +% % and then, only if the note was not stored - \ifpdfpcnotes@noteexists - \else + \ifpdfpcnotes@noteexists% + \else% % add note in stored notes \expandafter\global\expandafter\def\csname pdfpcnotes@currentframenotes@\thepdfpcnotes@currentframenotes\endcsname{\unexpanded{#1}}% \stepcounter{pdfpcnotes@currentframenotes}% - +% % write note to file - \begingroup - \def\\{^^J} - \def\par{^^J^^J} + \begingroup% + \def\\{^^J}% + \def\par{^^J^^J}% \immediate\write\pdfpcnotesfile{#1}% - \endgroup - \fi + \endgroup% + \fi% } % close file on \begin{document} \AtEndDocument{% \immediate\closeout\pdfpcnotesfile } -