line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Amuse::Compile::TemplateOptions; |
2
|
|
|
|
|
|
|
|
3
|
59
|
|
|
59
|
|
57120
|
use utf8; |
|
59
|
|
|
|
|
145
|
|
|
59
|
|
|
|
|
364
|
|
4
|
59
|
|
|
59
|
|
1751
|
use strict; |
|
59
|
|
|
|
|
137
|
|
|
59
|
|
|
|
|
1245
|
|
5
|
59
|
|
|
59
|
|
280
|
use warnings FATAL => 'all'; |
|
59
|
|
|
|
|
114
|
|
|
59
|
|
|
|
|
2249
|
|
6
|
59
|
|
|
59
|
|
875
|
use Types::Standard qw/Str Bool Enum StrMatch Int is_Int/; |
|
59
|
|
|
|
|
63166
|
|
|
59
|
|
|
|
|
573
|
|
7
|
59
|
|
|
59
|
|
92595
|
use Pod::Usage qw//; |
|
59
|
|
|
|
|
1966696
|
|
|
59
|
|
|
|
|
1605
|
|
8
|
59
|
|
|
59
|
|
493
|
use File::Spec; |
|
59
|
|
|
|
|
136
|
|
|
59
|
|
|
|
|
1192
|
|
9
|
59
|
|
|
59
|
|
743
|
use Moo; |
|
59
|
|
|
|
|
8818
|
|
|
59
|
|
|
|
|
568
|
|
10
|
59
|
|
|
59
|
|
47393
|
use Text::Amuse::Compile::Fonts; |
|
59
|
|
|
|
|
205
|
|
|
59
|
|
|
|
|
4663
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use constant { |
13
|
59
|
|
|
|
|
167814
|
TEX_MEASURE => qr{[0-9]+(\.[0-9]+)?(cm|mm|in|pt)}, |
14
|
59
|
|
|
59
|
|
443
|
}; |
|
59
|
|
|
|
|
125
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Text::Amuse::Compile::TemplateOptions - parse and validate options for templates |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head2 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use Text::Amuse::Compile::TemplateOptions; |
23
|
|
|
|
|
|
|
my $options = Text::Amuse::Compile::TemplateOptions->new(%options); |
24
|
|
|
|
|
|
|
my $doc = Text::Amuse->new(file => 'test.muse'); |
25
|
|
|
|
|
|
|
# and get the hashrefs for the tokens |
26
|
|
|
|
|
|
|
my $latex_options = $options->as_latex($doc); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 ACCESSORS |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
The follow accessors are read-write. The same settings can be passed |
31
|
|
|
|
|
|
|
to the C script. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 Paper |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=over 4 |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=item * papersize (common values: a4, a5, letter) |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Paper size, like a4, a5 or 210mm:11in. The width and heigth are |
40
|
|
|
|
|
|
|
swapped in some komascript version. Just keep this in mind and do some |
41
|
|
|
|
|
|
|
trial and error if you need custom dimensions. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=item * bcor (binding correction for inner margins) |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
The BCOR of the C package. Defaults to 0mm. Go and read the doc. |
46
|
|
|
|
|
|
|
It expects a TeX dimension like 10mm or 1in or 1.2cm. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
B
|
49
|
|
|
|
|
|
|
imposed version is also required>, because we force BCOR=0mm |
50
|
|
|
|
|
|
|
and oneside=true for the planin version in this case. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item * division (the DIV factor for margin control) |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
The DIV of the C package. Defaults to 12. Go and read the |
55
|
|
|
|
|
|
|
doc. Sensible values are from 9 to 15. 15 has narrow margins, while in |
56
|
|
|
|
|
|
|
9 they are pretty generous. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item * areaset_width 3in |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item * areaset_height 50mm |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Usually you want to use the DIV factor, but you can also set the type |
63
|
|
|
|
|
|
|
area manually specifying the text block dimensions. The dimensions can |
64
|
|
|
|
|
|
|
be in mm, cm, in and pt. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Both need to be set to have an effect. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item * geometry_top_margin 1in |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item * geometry_outer_margin 1in |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Usually you want to use the DIV factor, but you can also set the type |
73
|
|
|
|
|
|
|
area manually specifying the top and outer margins. The dimensions can |
74
|
|
|
|
|
|
|
be in mm, cm, in and pt. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
You also need to set C and C to use |
77
|
|
|
|
|
|
|
these custom margins (inner and bottom margins are calculated using |
78
|
|
|
|
|
|
|
the text block dimensions). |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item * oneside (boolean) |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This is the default. Actually, this option doesn't have any use. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item * twoside (boolean) |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Set it to a true value to have a twosided document. Default is false. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
B
|
89
|
|
|
|
|
|
|
imposed version is also required>, because we force BCOR=0mm |
90
|
|
|
|
|
|
|
and oneside=true for the planin version in this case. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item * opening |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
On which pages the chapters should open: right, left, any. Default: |
95
|
|
|
|
|
|
|
right. The left one will probably lead to unexpected results (the PDF |
96
|
|
|
|
|
|
|
will start with an empty page), so use it at your own peril. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=back |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub _get_papersize { |
103
|
529
|
|
|
529
|
|
15157
|
my $paper = $_[0]; |
104
|
529
|
|
|
|
|
7012
|
my %aliases = ( |
105
|
|
|
|
|
|
|
'half-a4' => 'a5', |
106
|
|
|
|
|
|
|
'half-lt' => '5.5in:8.5in', |
107
|
|
|
|
|
|
|
generic => '210mm:11in', |
108
|
|
|
|
|
|
|
a3 => 'a3', |
109
|
|
|
|
|
|
|
a4 => 'a4', |
110
|
|
|
|
|
|
|
a5 => 'a5', |
111
|
|
|
|
|
|
|
a6 => 'a6', |
112
|
|
|
|
|
|
|
b3 => 'b3', |
113
|
|
|
|
|
|
|
b4 => 'b4', |
114
|
|
|
|
|
|
|
b5 => 'b5', |
115
|
|
|
|
|
|
|
b6 => 'b6', |
116
|
|
|
|
|
|
|
letter => 'letter', |
117
|
|
|
|
|
|
|
); |
118
|
529
|
100
|
|
|
|
1700
|
if ($paper) { |
119
|
527
|
|
|
|
|
1093
|
my $tex_measure = TEX_MEASURE; |
120
|
527
|
100
|
|
|
|
6254
|
if ($aliases{$paper}) { |
|
|
100
|
|
|
|
|
|
121
|
156
|
|
|
|
|
1798
|
return $aliases{$paper}; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
elsif ($paper =~ m/\A$tex_measure:$tex_measure\z/) { |
124
|
364
|
|
|
|
|
4404
|
return $paper; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
else { |
127
|
7
|
|
|
|
|
165
|
die "papersize $paper is invalid"; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
else { |
131
|
2
|
|
|
|
|
22
|
return '210mm:11in'; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
has papersize => (is => 'rw', |
137
|
|
|
|
|
|
|
isa => \&_get_papersize, |
138
|
|
|
|
|
|
|
default => sub { '210mm:11in' }, |
139
|
|
|
|
|
|
|
); |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
sub tex_papersize { |
142
|
253
|
|
|
253
|
1
|
598
|
my $self = shift; |
143
|
253
|
|
|
|
|
4425
|
return _get_papersize($self->papersize); |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub _is_tex_measure { |
147
|
533
|
100
|
|
533
|
|
100155
|
die "$_[0] is not a TeX measure" |
148
|
|
|
|
|
|
|
unless $_[0] =~ TEX_MEASURE; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub _is_tex_measure_or_false { |
152
|
12
|
100
|
|
12
|
|
502
|
_is_tex_measure($_[0]) if $_[0]; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub _is_tex_tolerance { |
156
|
256
|
100
|
33
|
256
|
|
5074
|
die "tolerance needs to be between 0 and 1000" |
|
|
|
66
|
|
|
|
|
157
|
|
|
|
|
|
|
unless is_Int($_[0]) && $_[0] > -1 && $_[0] < 10_001; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
has areaset_width => (is => 'rw', |
161
|
|
|
|
|
|
|
isa => \&_is_tex_measure_or_false); |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
has areaset_height => (is => 'rw', |
164
|
|
|
|
|
|
|
isa => \&_is_tex_measure_or_false); |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
has geometry_top_margin => (is => 'rw', |
167
|
|
|
|
|
|
|
isa => \&_is_tex_measure_or_false); |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
has geometry_outer_margin => (is => 'rw', |
170
|
|
|
|
|
|
|
isa => \&_is_tex_measure_or_false); |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
has bcor => (is => 'rw', |
173
|
|
|
|
|
|
|
isa => \&_is_tex_measure, |
174
|
|
|
|
|
|
|
default => sub { '0mm' }); |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
has division => (is => 'rw', |
177
|
|
|
|
|
|
|
isa => Enum[9..15], |
178
|
|
|
|
|
|
|
default => sub { '12' }, |
179
|
|
|
|
|
|
|
); |
180
|
|
|
|
|
|
|
has oneside => (is => 'rw', isa => Bool); |
181
|
|
|
|
|
|
|
has twoside => (is => 'rw', isa => Bool); |
182
|
|
|
|
|
|
|
has opening => (is => 'rw', |
183
|
|
|
|
|
|
|
isa => Enum[qw/any right left/], |
184
|
|
|
|
|
|
|
default => sub { 'right' }); |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head2 Fonts |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=over 4 |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=item * mainfont (grep fc-list -l for the correct name) |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
The system font name, such as C or C. |
194
|
|
|
|
|
|
|
This implementation uses XeLaTeX, so we can use system fonts. Defaults |
195
|
|
|
|
|
|
|
to C. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=item * sansfont |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
The sans serif font to use. This option has some effects only on |
200
|
|
|
|
|
|
|
slides. Defaults to C |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=item * monofont |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
The monospace font to use. Defaults to C. |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=item * fontsize |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
The size of the body font (9, 10, 11, 12) as integer, meaning points |
209
|
|
|
|
|
|
|
(pt), defaulting to 10. |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=back |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=cut |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
sub serif_fonts { |
216
|
259
|
|
|
259
|
1
|
5212
|
my @fonts = map { +{ name => $_->name, desc => $_->desc } } |
|
6993
|
|
|
|
|
17189
|
|
217
|
|
|
|
|
|
|
Text::Amuse::Compile::Fonts->new->serif_fonts; |
218
|
259
|
|
|
|
|
13479
|
return @fonts; |
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
sub mono_fonts { |
221
|
259
|
|
|
259
|
1
|
4326
|
my @fonts = map { +{ name => $_->name, desc => $_->desc } } |
|
1295
|
|
|
|
|
4743
|
|
222
|
|
|
|
|
|
|
Text::Amuse::Compile::Fonts->new->mono_fonts; |
223
|
259
|
|
|
|
|
12710
|
return @fonts; |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
sub sans_fonts { |
226
|
257
|
|
|
257
|
1
|
4186
|
my @fonts = map { +{ name => $_->name, desc => $_->desc } } |
|
4883
|
|
|
|
|
12377
|
|
227
|
|
|
|
|
|
|
Text::Amuse::Compile::Fonts->new->sans_fonts; |
228
|
257
|
|
|
|
|
14269
|
return @fonts; |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
sub all_fonts { |
232
|
1
|
|
|
1
|
1
|
22
|
my @all = map { +{ name => $_->name, desc => $_->desc } } |
|
51
|
|
|
|
|
100
|
|
233
|
|
|
|
|
|
|
Text::Amuse::Compile::Fonts->new->all_fonts; |
234
|
1
|
|
|
|
|
60
|
return @all; |
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
sub default_mainfont { |
238
|
258
|
|
|
258
|
1
|
1468
|
return (__PACKAGE__->serif_fonts)[0]->{name}; |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
sub default_sansfont { |
242
|
256
|
|
|
256
|
1
|
2200
|
return (__PACKAGE__->sans_fonts)[0]->{name}; |
243
|
|
|
|
|
|
|
} |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
sub default_monofont { |
246
|
258
|
|
|
258
|
1
|
2152
|
return (__PACKAGE__->mono_fonts)[0]->{name}; |
247
|
|
|
|
|
|
|
} |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
has linespacing => (is => 'rw', |
250
|
|
|
|
|
|
|
isa => StrMatch[ qr{\A[0-9]?(?:\.[0-9])?\z} ], |
251
|
|
|
|
|
|
|
default => sub { '' } |
252
|
|
|
|
|
|
|
); |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
has parindent => (is => 'rw', |
255
|
|
|
|
|
|
|
isa => Int, |
256
|
|
|
|
|
|
|
default => sub { 15 } |
257
|
|
|
|
|
|
|
); |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
has mainfont => (is => 'rw', |
260
|
|
|
|
|
|
|
isa => StrMatch[ qr{\A[a-zA-Z0-9 ]+\z} ], |
261
|
|
|
|
|
|
|
default => sub { __PACKAGE__->default_mainfont }, |
262
|
|
|
|
|
|
|
); |
263
|
|
|
|
|
|
|
has sansfont => (is => 'rw', |
264
|
|
|
|
|
|
|
isa => StrMatch[ qr{\A[a-zA-Z0-9 ]+\z} ], |
265
|
|
|
|
|
|
|
default => sub { __PACKAGE__->default_sansfont }, |
266
|
|
|
|
|
|
|
); |
267
|
|
|
|
|
|
|
has monofont => (is => 'rw', |
268
|
|
|
|
|
|
|
isa => StrMatch[ qr{\A[a-zA-Z0-9 ]+\z} ], |
269
|
|
|
|
|
|
|
default => sub { __PACKAGE__->default_monofont }, |
270
|
|
|
|
|
|
|
); |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
has fontsize => (is => 'rw', |
273
|
|
|
|
|
|
|
isa => Enum[ __PACKAGE__->all_fontsizes ], |
274
|
|
|
|
|
|
|
default => sub { 10 }, |
275
|
|
|
|
|
|
|
); |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
sub all_fontsizes { |
278
|
60
|
|
|
60
|
1
|
442
|
return (9..14); |
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=head2 Colophon |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
=over 4 |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=item * sitename |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
At the top of the page |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=item * siteslogan |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
At the top, under sitename |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
=item * logo (filename) |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
At the top, under siteslogan |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
=item * site |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
At the bottom of the page |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
=back |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
=cut |
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
sub check_filename { |
307
|
1456
|
|
|
1456
|
1
|
40263
|
my ($filename) = @_; |
308
|
|
|
|
|
|
|
# false value, accept, will not be inserted. |
309
|
1456
|
100
|
|
|
|
9954
|
return unless $filename; |
310
|
|
|
|
|
|
|
# windows thing, in case |
311
|
223
|
|
|
|
|
612
|
$filename =~ s!\\!/!g; |
312
|
|
|
|
|
|
|
# is a path? test if it exists |
313
|
223
|
100
|
|
|
|
1874
|
if ($filename =~ m!/!) { |
|
|
100
|
|
|
|
|
|
314
|
32
|
100
|
100
|
|
|
1314
|
if (-f $filename and |
|
|
|
66
|
|
|
|
|
315
|
|
|
|
|
|
|
$filename =~ m/[a-zA-Z0-9]+\.(pdf|jpe?g|png)\z/ and |
316
|
|
|
|
|
|
|
File::Spec->file_name_is_absolute($filename)) { |
317
|
24
|
|
|
|
|
197
|
return $filename; |
318
|
|
|
|
|
|
|
} |
319
|
|
|
|
|
|
|
else { |
320
|
8
|
|
|
|
|
156
|
die "Absolute filename $filename must exist"; |
321
|
|
|
|
|
|
|
} |
322
|
|
|
|
|
|
|
} |
323
|
|
|
|
|
|
|
elsif ($filename =~ m/\A |
324
|
|
|
|
|
|
|
( |
325
|
|
|
|
|
|
|
[a-zA-Z0-9] |
326
|
|
|
|
|
|
|
[a-zA-Z0-9-]* |
327
|
|
|
|
|
|
|
[a-zA-Z0-9] |
328
|
|
|
|
|
|
|
(\.(pdf|jpe?g|png))? |
329
|
|
|
|
|
|
|
) |
330
|
|
|
|
|
|
|
\z/x) { |
331
|
|
|
|
|
|
|
# sane filename; |
332
|
185
|
|
|
|
|
1535
|
return $1; |
333
|
|
|
|
|
|
|
} |
334
|
6
|
|
|
|
|
102
|
die "$filename is neither absolute and existing or a bare name without special characters"; |
335
|
|
|
|
|
|
|
} |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
has sitename => (is => 'rw', isa => Str, default => sub { '' }); |
338
|
|
|
|
|
|
|
has siteslogan => (is => 'rw', isa => Str, default => sub { '' }); |
339
|
|
|
|
|
|
|
has site => (is => 'rw', isa => Str, default => sub { '' }); |
340
|
|
|
|
|
|
|
has logo => (is => 'rw', |
341
|
|
|
|
|
|
|
isa => \&check_filename, |
342
|
|
|
|
|
|
|
default => sub { '' }, |
343
|
|
|
|
|
|
|
); |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
=head2 Cover |
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
=over 4 |
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
=item * cover (filename for front cover) |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
When this option is set to a true value, skip the creation of the |
353
|
|
|
|
|
|
|
title page with \maketitle, and instead build a custome one, with the |
354
|
|
|
|
|
|
|
cover placed in the middle of the page. |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
The value can be an absolute path, or a bare filename, which can be |
357
|
|
|
|
|
|
|
found by C. If the path is not valid and sane (from the |
358
|
|
|
|
|
|
|
LaTeX point of view: no spaces, no strange chars), the value is |
359
|
|
|
|
|
|
|
ignored. |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
With EPUB output, the cover is used in the title page. |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
=item * coverwidth (dimension ratio with the text width, eg. '0.85') |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
Option to control the cover width, when is set (ignored otherwise). |
366
|
|
|
|
|
|
|
Defaults to the full text width (i.e., 1). You have to pass a float |
367
|
|
|
|
|
|
|
here with the ratio to the text width, like C<0.5>, C<1>. |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
With EPUB output, this affects the maximum width, not the actual |
370
|
|
|
|
|
|
|
width. |
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
=item * body_only |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
Skip title, cover pages and final pages. Just produce the body. |
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
=item * nocoverpage |
377
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
Force the use of the LaTeX article class. If there are chapters |
379
|
|
|
|
|
|
|
present, consider them aliases for a section. |
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
=item * ignore_cover |
382
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
Ignore the cover unconditionally |
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
=item * notoc |
386
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
Do not generate a table of contents, even if the document requires |
388
|
|
|
|
|
|
|
one. |
389
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
=item * nofinalpage |
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
Do not produce the last page on the PDF with the |
393
|
|
|
|
|
|
|
author/title/notes/source/site name. |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
=item * impressum |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
Move the notes, which are usually in the last page at the bottom and |
398
|
|
|
|
|
|
|
centered, on the second page, raggedright, in smaller size. |
399
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
=item * continuefootnotes |
401
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
Normally the footnotes are reset at chapter. With this option turned |
403
|
|
|
|
|
|
|
on, they will not reset. |
404
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
=item * centerchapter |
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
Center the chapter title instead of ragged |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
=item * centersection |
410
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
Center all the sectioning titles, including the chapters. |
412
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
=item * sansfontsections |
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
Use the default komascript style where chapters and parts have sans |
416
|
|
|
|
|
|
|
font. |
417
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
=item * nobold |
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
Prevent the use of bold fonts and replace them with italics. |
421
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
=item * secondary_footnotes_alpha |
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
By default, secondary footnotes use arabic numbering between parens. |
425
|
|
|
|
|
|
|
You can switch to alpha per-page setting this option to 1 (boolean). |
426
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
=item * start_with_empty_page |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
Start the PDF with an empty page (not with the title page, which will |
430
|
|
|
|
|
|
|
be placed on the next recto page). |
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
=item * linespacing (float, tipically 1.5 or 2) |
433
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
Set the linespacing instead of the default value. |
435
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
=item * parindent (integer) |
437
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
Paragraph indentation in points (pt). |
439
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
=item * headings |
441
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
Generate the running headings in the document. Beware that this will |
443
|
|
|
|
|
|
|
get you overfull headings if you have long titles. |
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
The behaviour changes if it's a oneside document. |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
Available values: |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
=over 4 |
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
=item * title_subtitle |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
Title on the left page, subtitle on right page. Oneside: title. |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
=item * author_title |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
Author on the left, title on the right. Oneside: title |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
=item * section_subsection |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
Section on the left, subsection on the right. Oneside: section name |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
=item * chapter_section |
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
Chapter on the left, section on the right. Oneside: chapter name |
466
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
=item * title_section |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
Title on the left, section on the right. Oneside: section name |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
=item * title_chapter |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
Title on the left, chapter on the right. Oneside: chapter name |
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
=back |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
=back |
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
=cut |
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
has cover => (is => 'rw', |
482
|
|
|
|
|
|
|
isa => \&check_filename, |
483
|
|
|
|
|
|
|
default => sub { '' }, |
484
|
|
|
|
|
|
|
); |
485
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
sub _check_coverwidth { |
487
|
|
|
|
|
|
|
# compare with MuseHeader |
488
|
282
|
|
|
282
|
|
24840
|
my $width = $_[0]; |
489
|
282
|
50
|
|
|
|
926
|
die "$width should be a number" unless $width; |
490
|
282
|
100
|
|
|
|
1918
|
if ($width =~ m/\A[01](\.[0-9][0-9]?)?\z/) { |
491
|
270
|
100
|
66
|
|
|
5286
|
die "coverwidth should be a number minor or equal to 1" |
492
|
|
|
|
|
|
|
unless ($width <= 1 && $width > 0); |
493
|
|
|
|
|
|
|
} |
494
|
|
|
|
|
|
|
else { |
495
|
12
|
|
|
|
|
254
|
die "coverwidth $width should be a number minor or equal to 1" |
496
|
|
|
|
|
|
|
} |
497
|
|
|
|
|
|
|
} |
498
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
has coverwidth => (is => 'rw', |
500
|
|
|
|
|
|
|
isa => \&_check_coverwidth, |
501
|
|
|
|
|
|
|
default => sub { 1 }); |
502
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
has body_only => (is => 'rw', isa => Bool, default => sub { 0 }); |
504
|
|
|
|
|
|
|
has nocoverpage => (is => 'rw', isa => Bool, default => sub { 0 }); |
505
|
|
|
|
|
|
|
has ignore_cover => (is => 'rw', isa => Bool, default => sub { 0 }); |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
has notoc => (is => 'rw', isa => Bool, default => sub { 0 }); |
508
|
|
|
|
|
|
|
has nofinalpage => (is => 'rw', isa => Bool, default => sub { 0 }); |
509
|
|
|
|
|
|
|
has impressum => (is => 'rw', isa => Bool, default => sub { 0 }); |
510
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
has continuefootnotes => (is => 'rw', isa => Bool, default => sub { 0 } ); |
512
|
|
|
|
|
|
|
has centerchapter => (is => 'rw', isa => Bool, default => sub { 0 } ); |
513
|
|
|
|
|
|
|
has centersection => (is => 'rw', isa => Bool, default => sub { 0 } ); |
514
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
has sansfontsections => (is => 'rw', isa => Bool, default => sub { 0 }); |
516
|
|
|
|
|
|
|
has secondary_footnotes_alpha => (is => 'rw', isa => Bool, default => sub { 0 }); |
517
|
|
|
|
|
|
|
has nobold => (is => 'rw', isa => Bool, default => sub { 0 }); |
518
|
|
|
|
|
|
|
has start_with_empty_page => (is => 'rw', isa => Bool, default => sub { 0 }); |
519
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
sub all_headings { |
521
|
60
|
|
|
60
|
1
|
3642
|
my @headings = ( |
522
|
|
|
|
|
|
|
{ |
523
|
|
|
|
|
|
|
name => '0', |
524
|
|
|
|
|
|
|
desc => 'None', |
525
|
|
|
|
|
|
|
}, |
526
|
|
|
|
|
|
|
{ |
527
|
|
|
|
|
|
|
name => 'part_chapter', |
528
|
|
|
|
|
|
|
desc => 'Part and chapter. If one side document: part.', |
529
|
|
|
|
|
|
|
}, |
530
|
|
|
|
|
|
|
{ |
531
|
|
|
|
|
|
|
name => 'title_subtitle', |
532
|
|
|
|
|
|
|
desc => 'Title and subtitle. If one side document: title.', |
533
|
|
|
|
|
|
|
}, |
534
|
|
|
|
|
|
|
{ |
535
|
|
|
|
|
|
|
name => 'author_title', |
536
|
|
|
|
|
|
|
desc => 'Author and title. If one side document: title.', |
537
|
|
|
|
|
|
|
}, |
538
|
|
|
|
|
|
|
{ |
539
|
|
|
|
|
|
|
name => 'chapter_section', |
540
|
|
|
|
|
|
|
desc => 'Chapter and section. If one side document: chapter.', |
541
|
|
|
|
|
|
|
}, |
542
|
|
|
|
|
|
|
{ |
543
|
|
|
|
|
|
|
name => 'section_subsection', |
544
|
|
|
|
|
|
|
desc => 'Section and subsection. If one side document: section.', |
545
|
|
|
|
|
|
|
}, |
546
|
|
|
|
|
|
|
{ |
547
|
|
|
|
|
|
|
name => 'title_chapter', |
548
|
|
|
|
|
|
|
desc => 'Title and chapter. If one side document: chapter.', |
549
|
|
|
|
|
|
|
}, |
550
|
|
|
|
|
|
|
{ |
551
|
|
|
|
|
|
|
name => 'title_section', |
552
|
|
|
|
|
|
|
desc => 'Title and section. If one side document: section.', |
553
|
|
|
|
|
|
|
}, |
554
|
|
|
|
|
|
|
{ |
555
|
|
|
|
|
|
|
name => '', |
556
|
|
|
|
|
|
|
desc => '', |
557
|
|
|
|
|
|
|
}, |
558
|
|
|
|
|
|
|
{ |
559
|
|
|
|
|
|
|
name => 1, |
560
|
|
|
|
|
|
|
desc => '', |
561
|
|
|
|
|
|
|
}, |
562
|
|
|
|
|
|
|
); |
563
|
60
|
|
|
|
|
204
|
return @headings; |
564
|
|
|
|
|
|
|
} |
565
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
has headings => (is => 'rw', |
568
|
|
|
|
|
|
|
isa => Enum[ map { $_->{name} } __PACKAGE__->all_headings ], |
569
|
|
|
|
|
|
|
default => sub { 0 }); |
570
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
=head2 Slides |
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
=over 4 |
575
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
=item * beamertheme |
577
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
The theme to use with beamer, if and when the slides are produced. See |
579
|
|
|
|
|
|
|
the beamer manual or L. |
580
|
|
|
|
|
|
|
Defaults to the default one. |
581
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
=item * beamercolortheme |
583
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
Same as above, but for the color theme. Defaults to "dove" (b/w theme, |
585
|
|
|
|
|
|
|
can't see the default purple). |
586
|
|
|
|
|
|
|
|
587
|
|
|
|
|
|
|
=back |
588
|
|
|
|
|
|
|
|
589
|
|
|
|
|
|
|
=cut |
590
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
sub beamer_themes { |
592
|
59
|
|
|
59
|
1
|
526
|
my @themes = (qw/default |
593
|
|
|
|
|
|
|
Bergen |
594
|
|
|
|
|
|
|
Boadilla |
595
|
|
|
|
|
|
|
Madrid |
596
|
|
|
|
|
|
|
AnnArbor |
597
|
|
|
|
|
|
|
CambridgeUS |
598
|
|
|
|
|
|
|
EastLansing |
599
|
|
|
|
|
|
|
Pittsburgh |
600
|
|
|
|
|
|
|
Rochester |
601
|
|
|
|
|
|
|
Antibes |
602
|
|
|
|
|
|
|
JuanLesPins |
603
|
|
|
|
|
|
|
Montpellier |
604
|
|
|
|
|
|
|
Berkeley |
605
|
|
|
|
|
|
|
PaloAlto |
606
|
|
|
|
|
|
|
Goettingen |
607
|
|
|
|
|
|
|
Marburg |
608
|
|
|
|
|
|
|
Hannover |
609
|
|
|
|
|
|
|
Berlin |
610
|
|
|
|
|
|
|
Ilmenau |
611
|
|
|
|
|
|
|
Dresden |
612
|
|
|
|
|
|
|
Darmstadt |
613
|
|
|
|
|
|
|
Frankfurt |
614
|
|
|
|
|
|
|
Singapore |
615
|
|
|
|
|
|
|
Szeged |
616
|
|
|
|
|
|
|
Copenhagen |
617
|
|
|
|
|
|
|
Luebeck |
618
|
|
|
|
|
|
|
Malmoe |
619
|
|
|
|
|
|
|
Warsaw/); |
620
|
59
|
|
|
|
|
482
|
return @themes; |
621
|
|
|
|
|
|
|
} |
622
|
|
|
|
|
|
|
|
623
|
|
|
|
|
|
|
sub default_beamertheme { |
624
|
264
|
|
|
264
|
1
|
5348
|
return 'default'; |
625
|
|
|
|
|
|
|
} |
626
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
has beamertheme => (is => 'rw', |
628
|
|
|
|
|
|
|
isa => Enum[ __PACKAGE__->beamer_themes ], |
629
|
|
|
|
|
|
|
default => sub { __PACKAGE__->default_beamertheme }); |
630
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
sub beamer_colorthemes { |
632
|
59
|
|
|
59
|
1
|
408
|
my @themes = (qw/default |
633
|
|
|
|
|
|
|
albatross |
634
|
|
|
|
|
|
|
beetle |
635
|
|
|
|
|
|
|
crane |
636
|
|
|
|
|
|
|
dove |
637
|
|
|
|
|
|
|
fly |
638
|
|
|
|
|
|
|
monarca |
639
|
|
|
|
|
|
|
seagull |
640
|
|
|
|
|
|
|
wolverine |
641
|
|
|
|
|
|
|
beaver |
642
|
|
|
|
|
|
|
spruce |
643
|
|
|
|
|
|
|
lily |
644
|
|
|
|
|
|
|
orchid |
645
|
|
|
|
|
|
|
rose |
646
|
|
|
|
|
|
|
whale |
647
|
|
|
|
|
|
|
seahorse |
648
|
|
|
|
|
|
|
dolphin/); |
649
|
59
|
|
|
|
|
411
|
return @themes; |
650
|
|
|
|
|
|
|
} |
651
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
sub default_beamercolortheme { |
653
|
264
|
|
|
264
|
1
|
4929
|
return 'dove'; |
654
|
|
|
|
|
|
|
} |
655
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
has beamercolortheme => (is => 'rw', |
657
|
|
|
|
|
|
|
isa => Enum[ __PACKAGE__->beamer_colorthemes ], |
658
|
|
|
|
|
|
|
default => sub { __PACKAGE__->default_beamercolortheme }); |
659
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
=head2 Advanced |
661
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
=over 4 |
663
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
=item * tex_tolerance |
665
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
An integer between 0 and 10000 |
667
|
|
|
|
|
|
|
|
668
|
|
|
|
|
|
|
Quoting: a parameter that tells TeX how much badness is allowable |
669
|
|
|
|
|
|
|
without error. Default to 200. |
670
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
\tolerance sets the maximum "badness" that tex is allowed to use while |
672
|
|
|
|
|
|
|
setting the paragraph, that is it inserts breakpoints allowing white |
673
|
|
|
|
|
|
|
space to stretch and penalties to be taken, so long as the badness |
674
|
|
|
|
|
|
|
keeps below this threshold. If it can not do that then you get |
675
|
|
|
|
|
|
|
overfull boxes. So different values produce different typeset result. |
676
|
|
|
|
|
|
|
|
677
|
|
|
|
|
|
|
=item * tex_emergencystretch |
678
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
Default to 30pt. It can be a TeX measure (I guess pt is what makes |
680
|
|
|
|
|
|
|
most sense for our use) |
681
|
|
|
|
|
|
|
|
682
|
|
|
|
|
|
|
\emergencystretch (added at TeX3) is used if TeX can not set the |
683
|
|
|
|
|
|
|
paragraph below the \tolerance badness, but rather than make overfull |
684
|
|
|
|
|
|
|
boxes it tries an extra pass "pretending" that every line has an |
685
|
|
|
|
|
|
|
additional \emergencystretch of stretchable glue, this allows the |
686
|
|
|
|
|
|
|
overall badness to be kept below 1000 and stops TeX "giving up" and |
687
|
|
|
|
|
|
|
putting all stretch into one line. So \emergencystretch does not |
688
|
|
|
|
|
|
|
change the setting of "good" paragraphs, it only changes the setting |
689
|
|
|
|
|
|
|
of paragraphs that would have produced over-full boxes. Note that you |
690
|
|
|
|
|
|
|
get warnings about the real badness calculation from TeX even though |
691
|
|
|
|
|
|
|
it retries with \emergencystretch the extra stretch is used to control |
692
|
|
|
|
|
|
|
the typesetting but it is not considered as good for the purposes of |
693
|
|
|
|
|
|
|
logging. |
694
|
|
|
|
|
|
|
|
695
|
|
|
|
|
|
|
See L for reference. |
696
|
|
|
|
|
|
|
|
697
|
|
|
|
|
|
|
=item * fussy_last_word |
698
|
|
|
|
|
|
|
|
699
|
|
|
|
|
|
|
Avoid breking the last word of a paragraph. This sounds great, but if |
700
|
|
|
|
|
|
|
you have short paragraphs (say, on line, or the text is full of |
701
|
|
|
|
|
|
|
dialogs), this is going to be a big problem, generating really bad |
702
|
|
|
|
|
|
|
lines. |
703
|
|
|
|
|
|
|
|
704
|
|
|
|
|
|
|
=item * format_id |
705
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
This does nothing per se but makes C |
707
|
|
|
|
|
|
|
accessible in the template. |
708
|
|
|
|
|
|
|
|
709
|
|
|
|
|
|
|
This is useful if you have a local latex.tt template which needs to do |
710
|
|
|
|
|
|
|
different things with different formats, so you can call: |
711
|
|
|
|
|
|
|
|
712
|
|
|
|
|
|
|
[% IF safe_options.format_id.c999 %] |
713
|
|
|
|
|
|
|
Output 1 |
714
|
|
|
|
|
|
|
[% ELSE %] |
715
|
|
|
|
|
|
|
Output 2 |
716
|
|
|
|
|
|
|
[% END %] |
717
|
|
|
|
|
|
|
|
718
|
|
|
|
|
|
|
If not specified, C is set. |
719
|
|
|
|
|
|
|
|
720
|
|
|
|
|
|
|
The value must begin with a letter and have only letters, digits and |
721
|
|
|
|
|
|
|
underscores. |
722
|
|
|
|
|
|
|
|
723
|
|
|
|
|
|
|
=back |
724
|
|
|
|
|
|
|
|
725
|
|
|
|
|
|
|
=cut |
726
|
|
|
|
|
|
|
|
727
|
|
|
|
|
|
|
has tex_tolerance => (is => 'rw', |
728
|
|
|
|
|
|
|
isa => \&_is_tex_tolerance, |
729
|
|
|
|
|
|
|
default => sub { 200 }); |
730
|
|
|
|
|
|
|
|
731
|
|
|
|
|
|
|
has tex_emergencystretch => (is => 'rw', |
732
|
|
|
|
|
|
|
isa => \&_is_tex_measure, |
733
|
|
|
|
|
|
|
default => sub { '30pt' }, # more or less 3em |
734
|
|
|
|
|
|
|
); |
735
|
|
|
|
|
|
|
|
736
|
|
|
|
|
|
|
has fussy_last_word => (is => 'rw', |
737
|
|
|
|
|
|
|
isa => Bool, |
738
|
|
|
|
|
|
|
default => sub { 0 }); |
739
|
|
|
|
|
|
|
|
740
|
|
|
|
|
|
|
has format_id => (is => 'rw', |
741
|
|
|
|
|
|
|
isa => StrMatch[ qr{\A([a-zA-Z][a-zA-Z0-9_]+)?\z} ], |
742
|
|
|
|
|
|
|
default => sub { 'DEFAULT' }); |
743
|
|
|
|
|
|
|
|
744
|
|
|
|
|
|
|
=head1 METHODS |
745
|
|
|
|
|
|
|
|
746
|
|
|
|
|
|
|
=head2 paging |
747
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
This merges C and C. If both or none |
749
|
|
|
|
|
|
|
are set, defaults to C. |
750
|
|
|
|
|
|
|
|
751
|
|
|
|
|
|
|
=head2 tex_papersize |
752
|
|
|
|
|
|
|
|
753
|
|
|
|
|
|
|
The real name of the papersize, unaliased (so, e.g. C will be |
754
|
|
|
|
|
|
|
C). |
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
=head2 config_setters |
757
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
The list of the values which should be passed to the constructor |
759
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
=head2 config_output |
761
|
|
|
|
|
|
|
|
762
|
|
|
|
|
|
|
Return a validated hashref of the options. This is basically the |
763
|
|
|
|
|
|
|
purpose of this module. |
764
|
|
|
|
|
|
|
|
765
|
|
|
|
|
|
|
=cut |
766
|
|
|
|
|
|
|
|
767
|
|
|
|
|
|
|
sub paging { |
768
|
253
|
|
|
253
|
1
|
632
|
my $self = shift; |
769
|
253
|
|
|
|
|
680
|
my $default = 'oneside'; |
770
|
253
|
100
|
100
|
|
|
4473
|
if ($self->twoside && $self->oneside) { |
771
|
4
|
|
|
|
|
132
|
return $default; |
772
|
|
|
|
|
|
|
} |
773
|
249
|
100
|
|
|
|
6734
|
if ($self->twoside) { |
774
|
35
|
|
|
|
|
417
|
return 'twoside'; |
775
|
|
|
|
|
|
|
} |
776
|
|
|
|
|
|
|
else { |
777
|
214
|
|
|
|
|
2402
|
return $default; |
778
|
|
|
|
|
|
|
} |
779
|
|
|
|
|
|
|
} |
780
|
|
|
|
|
|
|
|
781
|
|
|
|
|
|
|
sub config_setters { |
782
|
261
|
|
|
261
|
1
|
5853
|
return (qw/papersize bcor division oneside twoside |
783
|
|
|
|
|
|
|
areaset_width |
784
|
|
|
|
|
|
|
areaset_height |
785
|
|
|
|
|
|
|
geometry_top_margin |
786
|
|
|
|
|
|
|
geometry_outer_margin |
787
|
|
|
|
|
|
|
mainfont sansfont monofont fontsize |
788
|
|
|
|
|
|
|
sitename siteslogan site logo |
789
|
|
|
|
|
|
|
tex_emergencystretch |
790
|
|
|
|
|
|
|
tex_tolerance |
791
|
|
|
|
|
|
|
fussy_last_word |
792
|
|
|
|
|
|
|
headings |
793
|
|
|
|
|
|
|
ignore_cover |
794
|
|
|
|
|
|
|
linespacing |
795
|
|
|
|
|
|
|
parindent |
796
|
|
|
|
|
|
|
body_only |
797
|
|
|
|
|
|
|
cover coverwidth nocoverpage notoc |
798
|
|
|
|
|
|
|
nofinalpage |
799
|
|
|
|
|
|
|
impressum sansfontsections |
800
|
|
|
|
|
|
|
secondary_footnotes_alpha |
801
|
|
|
|
|
|
|
nobold |
802
|
|
|
|
|
|
|
start_with_empty_page |
803
|
|
|
|
|
|
|
continuefootnotes |
804
|
|
|
|
|
|
|
centerchapter |
805
|
|
|
|
|
|
|
centersection |
806
|
|
|
|
|
|
|
format_id |
807
|
|
|
|
|
|
|
opening beamertheme beamercolortheme/); |
808
|
|
|
|
|
|
|
} |
809
|
|
|
|
|
|
|
|
810
|
|
|
|
|
|
|
sub _use_geometry { |
811
|
249
|
|
|
249
|
|
617
|
my $self = shift; |
812
|
249
|
100
|
100
|
|
|
4251
|
if ($self->areaset_height && |
|
|
|
100
|
|
|
|
|
|
|
|
66
|
|
|
|
|
813
|
|
|
|
|
|
|
$self->areaset_width && |
814
|
|
|
|
|
|
|
$self->geometry_outer_margin && |
815
|
|
|
|
|
|
|
$self->geometry_top_margin) { |
816
|
1
|
|
|
|
|
74
|
return 1; |
817
|
|
|
|
|
|
|
} |
818
|
|
|
|
|
|
|
else { |
819
|
248
|
|
|
|
|
3629
|
return 0; |
820
|
|
|
|
|
|
|
} |
821
|
|
|
|
|
|
|
} |
822
|
|
|
|
|
|
|
|
823
|
|
|
|
|
|
|
sub config_output { |
824
|
249
|
|
|
249
|
1
|
637
|
my $self = shift; |
825
|
249
|
|
|
|
|
1129
|
my %out = ( |
826
|
|
|
|
|
|
|
paging => $self->paging, |
827
|
|
|
|
|
|
|
use_geometry => $self->_use_geometry, |
828
|
|
|
|
|
|
|
); |
829
|
249
|
|
|
|
|
1010
|
my %replace = (papersize => 'tex_papersize'); |
830
|
249
|
|
|
|
|
1115
|
foreach my $method ($self->config_setters) { |
831
|
10458
|
100
|
|
|
|
96351
|
if (my $alias = $replace{$method}) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
832
|
249
|
|
|
|
|
1357
|
$out{$method} = $self->$alias; |
833
|
|
|
|
|
|
|
} |
834
|
|
|
|
|
|
|
elsif ($method eq 'headings') { |
835
|
|
|
|
|
|
|
# here we pass an hashref for Template::Tiny if there is a value |
836
|
249
|
100
|
|
|
|
4086
|
if (my $value = $self->headings) { |
837
|
34
|
100
|
|
|
|
374
|
if ($value eq '1') { |
838
|
5
|
|
|
|
|
12
|
$value = 'author_title'; |
839
|
|
|
|
|
|
|
} |
840
|
34
|
|
|
|
|
134
|
$out{headings} = { $value => 1 }; |
841
|
|
|
|
|
|
|
} |
842
|
|
|
|
|
|
|
} |
843
|
|
|
|
|
|
|
elsif ($method eq 'format_id') { |
844
|
249
|
|
|
|
|
4156
|
$out{format_id} = { $self->format_id => 1 }; |
845
|
|
|
|
|
|
|
} |
846
|
|
|
|
|
|
|
else { |
847
|
9711
|
|
|
|
|
157480
|
$out{$method} = $self->$method; |
848
|
|
|
|
|
|
|
} |
849
|
|
|
|
|
|
|
} |
850
|
249
|
|
|
|
|
4025
|
return \%out; |
851
|
|
|
|
|
|
|
} |
852
|
|
|
|
|
|
|
|
853
|
|
|
|
|
|
|
sub show_options { |
854
|
0
|
|
|
0
|
1
|
|
Pod::Usage::pod2usage({ -sections => [qw(ACCESSORS/Paper |
855
|
|
|
|
|
|
|
ACCESSORS/Fonts |
856
|
|
|
|
|
|
|
ACCESSORS/Colophon |
857
|
|
|
|
|
|
|
ACCESSORS/Cover |
858
|
|
|
|
|
|
|
ACCESSORS/Advanced |
859
|
|
|
|
|
|
|
ACCESSORS/Slides |
860
|
|
|
|
|
|
|
)], |
861
|
|
|
|
|
|
|
-input => __FILE__, |
862
|
|
|
|
|
|
|
-verbose => 99, |
863
|
|
|
|
|
|
|
-message => "Template extra options to use with --extra option_name=value\n", |
864
|
|
|
|
|
|
|
-exitval => 'NOEXIT' }); |
865
|
|
|
|
|
|
|
} |
866
|
|
|
|
|
|
|
|
867
|
|
|
|
|
|
|
=head2 Available fonts listing |
868
|
|
|
|
|
|
|
|
869
|
|
|
|
|
|
|
They return a list of hashrefs, with two keys, C and C. |
870
|
|
|
|
|
|
|
The first is the system font name, the second is the description. They |
871
|
|
|
|
|
|
|
can be called on the class. |
872
|
|
|
|
|
|
|
|
873
|
|
|
|
|
|
|
=over 4 |
874
|
|
|
|
|
|
|
|
875
|
|
|
|
|
|
|
=item sans_fonts |
876
|
|
|
|
|
|
|
|
877
|
|
|
|
|
|
|
=item mono_fonts |
878
|
|
|
|
|
|
|
|
879
|
|
|
|
|
|
|
=item serif_fonts |
880
|
|
|
|
|
|
|
|
881
|
|
|
|
|
|
|
=item all_fonts |
882
|
|
|
|
|
|
|
|
883
|
|
|
|
|
|
|
=item all_fontsizes |
884
|
|
|
|
|
|
|
|
885
|
|
|
|
|
|
|
=back |
886
|
|
|
|
|
|
|
|
887
|
|
|
|
|
|
|
=head2 Themes listing |
888
|
|
|
|
|
|
|
|
889
|
|
|
|
|
|
|
The following methods can be called on the class and return lists with |
890
|
|
|
|
|
|
|
the available Beamer themes and color themes: |
891
|
|
|
|
|
|
|
|
892
|
|
|
|
|
|
|
=over 4 |
893
|
|
|
|
|
|
|
|
894
|
|
|
|
|
|
|
=item beamer_colorthemes |
895
|
|
|
|
|
|
|
|
896
|
|
|
|
|
|
|
=item beamer_themes |
897
|
|
|
|
|
|
|
|
898
|
|
|
|
|
|
|
=back |
899
|
|
|
|
|
|
|
|
900
|
|
|
|
|
|
|
=head2 Headings style listing |
901
|
|
|
|
|
|
|
|
902
|
|
|
|
|
|
|
=over 4 |
903
|
|
|
|
|
|
|
|
904
|
|
|
|
|
|
|
=item all_headings |
905
|
|
|
|
|
|
|
|
906
|
|
|
|
|
|
|
Return a list of hashrefs with C and C. Legacy options |
907
|
|
|
|
|
|
|
have an empty description. |
908
|
|
|
|
|
|
|
|
909
|
|
|
|
|
|
|
=back |
910
|
|
|
|
|
|
|
|
911
|
|
|
|
|
|
|
=head2 Defaults fonts and themes |
912
|
|
|
|
|
|
|
|
913
|
|
|
|
|
|
|
=over 4 |
914
|
|
|
|
|
|
|
|
915
|
|
|
|
|
|
|
=item default_mainfont |
916
|
|
|
|
|
|
|
|
917
|
|
|
|
|
|
|
=item default_sansfont |
918
|
|
|
|
|
|
|
|
919
|
|
|
|
|
|
|
=item default_monofont |
920
|
|
|
|
|
|
|
|
921
|
|
|
|
|
|
|
=item default_beamertheme |
922
|
|
|
|
|
|
|
|
923
|
|
|
|
|
|
|
=item default_beamercolortheme |
924
|
|
|
|
|
|
|
|
925
|
|
|
|
|
|
|
=back |
926
|
|
|
|
|
|
|
|
927
|
|
|
|
|
|
|
=head2 Help |
928
|
|
|
|
|
|
|
|
929
|
|
|
|
|
|
|
=head3 show_options |
930
|
|
|
|
|
|
|
|
931
|
|
|
|
|
|
|
Print out the relevant stanza of the POD. |
932
|
|
|
|
|
|
|
|
933
|
|
|
|
|
|
|
=cut |
934
|
|
|
|
|
|
|
|
935
|
|
|
|
|
|
|
=head1 INTERNALS |
936
|
|
|
|
|
|
|
|
937
|
|
|
|
|
|
|
=head2 check_filename($filename) |
938
|
|
|
|
|
|
|
|
939
|
|
|
|
|
|
|
Return true if the path is absolute (and looks like a pdf/jpg/png |
940
|
|
|
|
|
|
|
file) or if it's a bare filename, even without extension. |
941
|
|
|
|
|
|
|
|
942
|
|
|
|
|
|
|
=cut |
943
|
|
|
|
|
|
|
|
944
|
|
|
|
|
|
|
1; |
945
|
|
|
|
|
|
|
|