blob: 579c35865a46449971fe23aae907088c8b0ee893 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
% This file is part of pdfpc.
% Copyright (C) 2020 Evgeny Stambulchik
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License along
% with this program; if not, write to the Free Software Foundation, Inc.,
% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
% -------------------------------------------------------------------------------------------
%
% Allow for defining some meta data and simple textual notes for use
% with the pdfpc presentation application <https://pdfpc.github.io>.
%
% -------------------------------------------------------------------------------------------
%
% Inspired by Carsten Brandt's <https://github.com/cebe/pdfpc-latex-notes>.
%
% -------------------------------------------------------------------------------------------
%
% Please report bugs and other problems as well as suggestions for improvements
% to the issue tracker at github <https://github.com/pdfpc/pdfpc/>
%
% -------------------------------------------------------------------------------------------
%
\ProvidesPackage{pdfpc}[2021/02/06 v0.6.0 PDFPC]
\NeedsTeXFormat{LaTeX2e}
%
% Require additional packages needed by \sty{pdfpc}:
\RequirePackage{kvoptions}
\RequirePackage{xstring}
\RequirePackage{iftex}
\RequirePackage{hyperxmp}
%
\SetupKeyvalOptions{
family=PDFPC,
prefix=PDFPC@
}
%
\DeclareStringOption{duration}
\DeclareStringOption{starttime}
\DeclareStringOption{endtime}
\DeclareStringOption{enduserslide}
\DeclareStringOption{lastminutes}
\DeclareBoolOption{hidenotes}
\DeclareBoolOption{overridenote}
\DeclareStringOption{notesposition}
\DeclareBoolOption[false]{disablemarkdown}
\DeclareStringOption{defaulttransition}
\DeclareDefaultOption{\@unknownoptionerror}
%
\ProcessKeyvalOptions*
%
\ifx\PDFPC@duration\@empty
\else
\IfInteger{\PDFPC@duration}{}
{\PackageWarningNoLine{pdfpc}{`duration' should be an integer}}%
\fi
%
\ifx\PDFPC@enduserslide\@empty
\else
\IfInteger{\PDFPC@enduserslide}{}
{\PackageWarningNoLine{pdfpc}{`enduserslide' should be an integer}}%
\fi
%
\ifx\PDFPC@lastminutes\@empty
\else
\IfInteger{\PDFPC@lastminutes}{}
{\PackageWarningNoLine{pdfpc}{`lastminutes' should be an integer}}%
\fi
%
\ifPDFPC@overridenote
\renewcommand{\note}[2][]{%
\IfStrEq{#1}{item}%
% Imitate a bullet
{\pdfpcnote{* #2}}%
{\pdfpcnote{#2}}%
}%
\fi
%
\def\pdfpc@notespositionauto{auto}%
\ifx\PDFPC@notesposition\@empty%
\def\PDFPC@notesposition{auto}%
\fi%
%
% Guesswork for beamer/pgfpages notes
\ifx\PDFPC@notesposition\pdfpc@notespositionauto%
\def\PDFPC@notesposition{none}%
\def\pdfpc@onepaperheight{\paperheight}%
\def\pdfpc@twopaperheight{2\paperheight}%
\def\pdfpc@onepaperwidth{\paperwidth}%
\def\pdfpc@twopaperwidth{2\paperwidth}%
\def\pdfpc@pagecenter{\pgfpoint{.5\paperwidth}{.5\paperheight}}%
\ifx\pgfpageoptiontwoheight\pdfpc@onepaperheight%
\ifx\pgfpageoptiontwowidth\pdfpc@twopaperwidth%
\ifx\pgfpageoptionfirstcenter\pdfpc@pagecenter%
\def\PDFPC@notesposition{right}%
\else%
\def\PDFPC@notesposition{left}%
\fi%
\fi%
\fi%
\ifx\pgfpageoptiontwoheight\pdfpc@twopaperheight%
\ifx\pgfpageoptiontwowidth\pdfpc@onepaperwidth%
\ifx\pgfpageoptionfirstcenter\pdfpc@pagecenter%
\def\PDFPC@notesposition{top}%
\else%
\def\PDFPC@notesposition{bottom}%
\fi%
\fi%
\fi%
\fi%
%
% Our schema
\newcommand*{\pdfpc@schema}{%
\hyxmp@add@to@xml{%
______<rdf:Description xmlns:pdfpc="https://github.com/pdfpc/pdfpc">^^J%
}%
\hyxmp@add@simple{pdfpc:Duration}{\PDFPC@duration}%
\hyxmp@add@simple{pdfpc:StartTime}{\PDFPC@starttime}%
\hyxmp@add@simple{pdfpc:EndTime}{\PDFPC@endtime}%
\hyxmp@add@simple{pdfpc:EndUserSlide}{\PDFPC@enduserslide}%
\hyxmp@add@simple{pdfpc:LastMinutes}{\PDFPC@lastminutes}%
\hyxmp@add@simple{pdfpc:NotesPosition}{\PDFPC@notesposition}%
\ifPDFPC@disablemarkdown%
\hyxmp@add@simple{pdfpc:DisableMarkdown}{true}%
\else%
\hyxmp@add@simple{pdfpc:DisableMarkdown}{false}%
\fi
\hyxmp@add@simple{pdfpc:DefaultTransition}{\PDFPC@defaulttransition}%
\hyxmp@add@to@xml{%
______</rdf:Description>^^J%
}%
}
%
% Piggybacking on the hyperxmp schema...
\let\oldhyxmp@pdf@schema\hyxmp@pdf@schema
\renewcommand{\hyxmp@pdf@schema}{{\oldhyxmp@pdf@schema}{\pdfpc@schema}}
%
% Note command
\ifPDFPC@hidenotes%
\newcommand{\pdfpcnote}[1]{}%
\else%
\ifXeTeX%
\newcommand{\pdfpcnote}[1]{%
{%
\edef\\{\string\n}%
\special{pdf: ann width 0pt height 0pt depth 0pt%
<<%
/Subtype /Text%
/Contents (#1)%
/F 6%
>>%
}%
}%
\relax%
}%
\else%
\ifLuaTeX%
\protected\def\pdfannot {\pdfextension annot }%
\fi%
\newcommand{\pdfpcnote}[1]{%
{%
\edef\\{\string\n}%
\pdfannot width 0pt height 0pt depth 0pt {%
/Subtype /Text%
/Contents (#1)%
/F 6%
}%
}%
\relax%
}%
\fi%
\fi%
%
\endinput
|