line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Amuse::Compile::TemplateOptions; |
2
|
|
|
|
|
|
|
|
3
|
60
|
|
|
60
|
|
68724
|
use utf8; |
|
60
|
|
|
|
|
171
|
|
|
60
|
|
|
|
|
361
|
|
4
|
60
|
|
|
60
|
|
1984
|
use strict; |
|
60
|
|
|
|
|
183
|
|
|
60
|
|
|
|
|
1426
|
|
5
|
60
|
|
|
60
|
|
319
|
use warnings FATAL => 'all'; |
|
60
|
|
|
|
|
162
|
|
|
60
|
|
|
|
|
2327
|
|
6
|
60
|
|
|
60
|
|
959
|
use Types::Standard qw/Str Bool Enum StrMatch Int is_Int/; |
|
60
|
|
|
|
|
76949
|
|
|
60
|
|
|
|
|
589
|
|
7
|
60
|
|
|
60
|
|
107893
|
use Pod::Usage qw//; |
|
60
|
|
|
|
|
2290891
|
|
|
60
|
|
|
|
|
2884
|
|
8
|
60
|
|
|
60
|
|
535
|
use File::Spec; |
|
60
|
|
|
|
|
151
|
|
|
60
|
|
|
|
|
1478
|
|
9
|
60
|
|
|
60
|
|
912
|
use Moo; |
|
60
|
|
|
|
|
10968
|
|
|
60
|
|
|
|
|
572
|
|
10
|
60
|
|
|
60
|
|
55321
|
use Text::Amuse::Compile::Fonts; |
|
60
|
|
|
|
|
226
|
|
|
60
|
|
|
|
|
5173
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use constant { |
13
|
60
|
|
|
|
|
194358
|
TEX_MEASURE => qr{[0-9]+(\.[0-9]+)?(cm|mm|in|pt)}, |
14
|
60
|
|
|
60
|
|
468
|
}; |
|
60
|
|
|
|
|
141
|
|
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
|
537
|
|
|
537
|
|
15602
|
my $paper = $_[0]; |
104
|
537
|
|
|
|
|
7052
|
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
|
537
|
100
|
|
|
|
1779
|
if ($paper) { |
119
|
535
|
|
|
|
|
1227
|
my $tex_measure = TEX_MEASURE; |
120
|
535
|
100
|
|
|
|
6755
|
if ($aliases{$paper}) { |
|
|
100
|
|
|
|
|
|
121
|
156
|
|
|
|
|
2070
|
return $aliases{$paper}; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
elsif ($paper =~ m/\A$tex_measure:$tex_measure\z/) { |
124
|
372
|
|
|
|
|
5363
|
return $paper; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
else { |
127
|
7
|
|
|
|
|
207
|
die "papersize $paper is invalid"; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
else { |
131
|
2
|
|
|
|
|
29
|
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
|
257
|
|
|
257
|
1
|
674
|
my $self = shift; |
143
|
257
|
|
|
|
|
5375
|
return _get_papersize($self->papersize); |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub _is_tex_measure { |
147
|
541
|
100
|
|
541
|
|
118332
|
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
|
|
473
|
_is_tex_measure($_[0]) if $_[0]; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub _is_tex_tolerance { |
156
|
260
|
100
|
33
|
260
|
|
5655
|
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
|
263
|
|
|
263
|
1
|
6129
|
my @fonts = map { +{ name => $_->name, desc => $_->desc } } |
|
7101
|
|
|
|
|
19552
|
|
217
|
|
|
|
|
|
|
Text::Amuse::Compile::Fonts->new->serif_fonts; |
218
|
263
|
|
|
|
|
14789
|
return @fonts; |
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
sub mono_fonts { |
221
|
263
|
|
|
263
|
1
|
5153
|
my @fonts = map { +{ name => $_->name, desc => $_->desc } } |
|
1315
|
|
|
|
|
5000
|
|
222
|
|
|
|
|
|
|
Text::Amuse::Compile::Fonts->new->mono_fonts; |
223
|
263
|
|
|
|
|
13213
|
return @fonts; |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
sub sans_fonts { |
226
|
261
|
|
|
261
|
1
|
4999
|
my @fonts = map { +{ name => $_->name, desc => $_->desc } } |
|
4959
|
|
|
|
|
13649
|
|
227
|
|
|
|
|
|
|
Text::Amuse::Compile::Fonts->new->sans_fonts; |
228
|
261
|
|
|
|
|
13819
|
return @fonts; |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
sub all_fonts { |
232
|
1
|
|
|
1
|
1
|
30
|
my @all = map { +{ name => $_->name, desc => $_->desc } } |
|
51
|
|
|
|
|
133
|
|
233
|
|
|
|
|
|
|
Text::Amuse::Compile::Fonts->new->all_fonts; |
234
|
1
|
|
|
|
|
58
|
return @all; |
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
sub default_mainfont { |
238
|
262
|
|
|
262
|
1
|
1510
|
return (__PACKAGE__->serif_fonts)[0]->{name}; |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
sub default_sansfont { |
242
|
260
|
|
|
260
|
1
|
2365
|
return (__PACKAGE__->sans_fonts)[0]->{name}; |
243
|
|
|
|
|
|
|
} |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
sub default_monofont { |
246
|
262
|
|
|
262
|
1
|
2352
|
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
|
61
|
|
|
61
|
1
|
499
|
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
|
1476
|
|
|
1476
|
1
|
43303
|
my ($filename) = @_; |
308
|
|
|
|
|
|
|
# false value, accept, will not be inserted. |
309
|
1476
|
100
|
|
|
|
11978
|
return unless $filename; |
310
|
|
|
|
|
|
|
# windows thing, in case |
311
|
223
|
|
|
|
|
690
|
$filename =~ s!\\!/!g; |
312
|
|
|
|
|
|
|
# is a path? test if it exists |
313
|
223
|
100
|
|
|
|
1920
|
if ($filename =~ m!/!) { |
|
|
100
|
|
|
|
|
|
314
|
32
|
100
|
100
|
|
|
1631
|
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
|
|
|
|
|
261
|
return $filename; |
318
|
|
|
|
|
|
|
} |
319
|
|
|
|
|
|
|
else { |
320
|
8
|
|
|
|
|
171
|
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
|
|
|
|
|
1747
|
return $1; |
333
|
|
|
|
|
|
|
} |
334
|
6
|
|
|
|
|
104
|
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
|
286
|
|
|
286
|
|
24350
|
my $width = $_[0]; |
489
|
286
|
50
|
|
|
|
1115
|
die "$width should be a number" unless $width; |
490
|
286
|
100
|
|
|
|
2271
|
if ($width =~ m/\A[01](\.[0-9][0-9]?)?\z/) { |
491
|
274
|
100
|
66
|
|
|
6371
|
die "coverwidth should be a number minor or equal to 1" |
492
|
|
|
|
|
|
|
unless ($width <= 1 && $width > 0); |
493
|
|
|
|
|
|
|
} |
494
|
|
|
|
|
|
|
else { |
495
|
12
|
|
|
|
|
295
|
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
|
61
|
|
|
61
|
1
|
3632
|
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
|
61
|
|
|
|
|
272
|
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
|
60
|
|
|
60
|
1
|
682
|
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
|
60
|
|
|
|
|
584
|
return @themes; |
621
|
|
|
|
|
|
|
} |
622
|
|
|
|
|
|
|
|
623
|
|
|
|
|
|
|
sub default_beamertheme { |
624
|
268
|
|
|
268
|
1
|
5839
|
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
|
60
|
|
|
60
|
1
|
524
|
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
|
60
|
|
|
|
|
515
|
return @themes; |
650
|
|
|
|
|
|
|
} |
651
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
sub default_beamercolortheme { |
653
|
268
|
|
|
268
|
1
|
5691
|
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
|
257
|
|
|
257
|
1
|
726
|
my $self = shift; |
769
|
257
|
|
|
|
|
807
|
my $default = 'oneside'; |
770
|
257
|
100
|
100
|
|
|
5734
|
if ($self->twoside && $self->oneside) { |
771
|
4
|
|
|
|
|
150
|
return $default; |
772
|
|
|
|
|
|
|
} |
773
|
253
|
100
|
|
|
|
7851
|
if ($self->twoside) { |
774
|
35
|
|
|
|
|
451
|
return 'twoside'; |
775
|
|
|
|
|
|
|
} |
776
|
|
|
|
|
|
|
else { |
777
|
218
|
|
|
|
|
2592
|
return $default; |
778
|
|
|
|
|
|
|
} |
779
|
|
|
|
|
|
|
} |
780
|
|
|
|
|
|
|
|
781
|
|
|
|
|
|
|
sub config_setters { |
782
|
265
|
|
|
265
|
1
|
6706
|
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
|
253
|
|
|
253
|
|
771
|
my $self = shift; |
812
|
253
|
100
|
100
|
|
|
5270
|
if ($self->areaset_height && |
|
|
|
100
|
|
|
|
|
|
|
|
66
|
|
|
|
|
813
|
|
|
|
|
|
|
$self->areaset_width && |
814
|
|
|
|
|
|
|
$self->geometry_outer_margin && |
815
|
|
|
|
|
|
|
$self->geometry_top_margin) { |
816
|
1
|
|
|
|
|
91
|
return 1; |
817
|
|
|
|
|
|
|
} |
818
|
|
|
|
|
|
|
else { |
819
|
252
|
|
|
|
|
4115
|
return 0; |
820
|
|
|
|
|
|
|
} |
821
|
|
|
|
|
|
|
} |
822
|
|
|
|
|
|
|
|
823
|
|
|
|
|
|
|
sub config_output { |
824
|
253
|
|
|
253
|
1
|
698
|
my $self = shift; |
825
|
253
|
|
|
|
|
1217
|
my %out = ( |
826
|
|
|
|
|
|
|
paging => $self->paging, |
827
|
|
|
|
|
|
|
use_geometry => $self->_use_geometry, |
828
|
|
|
|
|
|
|
); |
829
|
253
|
|
|
|
|
1215
|
my %replace = (papersize => 'tex_papersize'); |
830
|
253
|
|
|
|
|
1329
|
foreach my $method ($self->config_setters) { |
831
|
10626
|
100
|
|
|
|
105089
|
if (my $alias = $replace{$method}) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
832
|
253
|
|
|
|
|
1396
|
$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
|
253
|
100
|
|
|
|
4884
|
if (my $value = $self->headings) { |
837
|
34
|
100
|
|
|
|
391
|
if ($value eq '1') { |
838
|
5
|
|
|
|
|
14
|
$value = 'author_title'; |
839
|
|
|
|
|
|
|
} |
840
|
34
|
|
|
|
|
161
|
$out{headings} = { $value => 1 }; |
841
|
|
|
|
|
|
|
} |
842
|
|
|
|
|
|
|
} |
843
|
|
|
|
|
|
|
elsif ($method eq 'format_id') { |
844
|
253
|
|
|
|
|
4824
|
$out{format_id} = { $self->format_id => 1 }; |
845
|
|
|
|
|
|
|
} |
846
|
|
|
|
|
|
|
else { |
847
|
9867
|
|
|
|
|
183640
|
$out{$method} = $self->$method; |
848
|
|
|
|
|
|
|
} |
849
|
|
|
|
|
|
|
} |
850
|
253
|
|
|
|
|
4448
|
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
|
|
|
|
|
|
|
|