epub: images in content.opf
[librarian.git] / librarian / pdf / wl.cls
1 % -*- coding: utf-8 -*-
2 \NeedsTeXFormat{LaTeX2e}
3 \ProvidesClass{wl}[2011/11/28 wolnelektury.pl book style]
4
5 % PDF customizations
6 %
7 % nofootnotes - disable generation of footnotes
8 % nothemes - disable generation of themes
9 % defaultleading - default leading
10 % onehalfleading - leading of 1.5 (interlinia)
11 % doubleleading - double leading (interlinia)
12 % a4paper,... - paper size as required by LaTeX
13 % nowlfont - don't use customized WL font
14
15 \RequirePackage{setspace}
16 \RequirePackage{type1cm}
17 \DeclareOption{13pt}{%
18 \AtEndOfClass{%
19 % font size definitions, similar to ones in /usr/share/texmf-texlive/tex/latex/base/
20 \renewcommand\normalsize{%
21    \@setfontsize\normalsize{13pt}{14.5pt}%
22    \abovedisplayskip 12\p@ \@plus3\p@ \@minus7\p@
23    \abovedisplayshortskip \z@ \@plus3\p@
24    \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@
25    \belowdisplayskip \abovedisplayskip
26    \let\@listi\@listI}\normalsize%
27 \renewcommand\footnotesize{%
28    \@setfontsize\footnotesize\@xpt\@xiipt
29    \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@
30    \abovedisplayshortskip \z@ \@plus3\p@
31    \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@
32    \def\@listi{\leftmargin\leftmargini
33                \topsep 6\p@ \@plus2\p@ \@minus2\p@
34                \parsep 3\p@ \@plus2\p@ \@minus\p@
35                \itemsep \parsep}%
36    \belowdisplayskip \abovedisplayskip
37 }%
38 }%
39 }
40
41 %% \DeclareOption{14pt}{\renewcommand{\normalsize}{\AtEndOfClass{\fontsize{14}{17}\selectfont}}}
42
43 \DeclareOption{defaultleading}{}
44 \DeclareOption{doubleleading}{\AtBeginDocument{\doublespacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
45 \DeclareOption{onehalfleading}{\AtBeginDocument{\onehalfspacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
46
47 %% This does not really work, since dvipdfm(x) will use it's configuration in /etc/texmf/dvipdfm(x) and force a global paper size setting.
48 \DeclareOption{a5paper}{%
49       \setlength{\paperheight}{210mm}%
50       \setlength{\paperwidth}{148mm}}
51
52
53 \newif\ifshowfootnotes \showfootnotestrue
54 \DeclareOption{nofootnotes}{\showfootnotesfalse}
55
56 \newif\ifshowthemes \showthemestrue
57 \DeclareOption{nothemes}{\showthemesfalse}
58
59 \newif\ifenablewlfont \enablewlfonttrue
60 \DeclareOption{nowlfont}{\enablewlfontfalse}
61
62 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
63 \ProcessOptions\relax
64 \LoadClass[a4paper,oneside]{book}
65
66
67 \usepackage{trace}
68
69 \usepackage[MeX]{polski}
70
71 \usepackage[xetex]{graphicx}
72 \usepackage{fontspec}
73 \usepackage{xunicode}
74 \usepackage{xltxtra}
75
76 \usepackage{longtable}
77 \usepackage{tabu}
78 \usepackage{unicode-math}
79 \setmathfont{Latin Modern Math}
80
81 \usepackage[overload]{textcase}
82 \usepackage{scalefnt}
83 \usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=black,xetex]{hyperref}
84
85 \ifenablewlfont
86 \setmainfont [
87 %ExternalLocation,
88 UprightFont = JunicodeWL-Regular,
89 ItalicFont = JunicodeWL-Italic,
90 BoldFont = JunicodeWL-Regular,
91 BoldItalicFont = JunicodeWL-Italic,
92 SmallCapsFont = JunicodeWL-Regular,
93 SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
94 Numbers=OldStyle,
95 Scale=1.04,
96 LetterSpace=-1.0
97 ] {JunicodeWL}
98
99 \newfontfamily\alien[
100 SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
101 Numbers=OldStyle,
102 Scale=0.85,
103 LetterSpace=-1.0
104 ] {DejaVu Serif}
105
106
107 \defaultfontfeatures{
108 SizeFeatures={
109   {Size={-10.5}, FakeStretch=1.02, LetterSpace=2.0 },
110   {Size={10.5-12}, FakeStretch=2.00, LetterSpace=0.0 },
111   {Size={12-}, FakeStretch=0.98, LetterSpace=-2.0 }
112 }
113 }
114
115 \renewcommand{\textsc}[1]{%
116 {\addfontfeature{
117 SizeFeatures={
118   {Size={-10.5}, Scale=1.2, FakeStretch=1.02, LetterSpace=8.0 },
119   {Size={10.5-12}, Scale=1.2, FakeStretch=1.02, LetterSpace=8.0 },
120   {Size={12-}, FakeStretch=1.0, LetterSpace=8.0 }
121 },
122 Letters={SmallCaps,UppercaseSmallCaps}
123 }
124 #1}
125 }
126 \fi% enablewlfont
127
128 %{\Itshape JunicodeWL-Italic.ttf }
129 %{\bfseries Junicode-Bold.ttf }
130 %{\bfseries\itshape Junicode-BoldItalic.ttf }
131
132 \pagestyle{plain}
133 \usepackage{fancyhdr}
134 \usepackage{marginnote}
135
136
137 \makeatletter
138
139 % bottom figure below footnotes
140 \usepackage{fnpos}
141 \makeFNabove
142
143 \usepackage{color}
144 \definecolor{theme}{gray}{.3}
145
146 \setlength{\marginparsep}{2em}
147 \setlength{\marginparwidth}{8.5em}
148 \setlength{\oddsidemargin}{0pt}
149 \setlength{\voffset}{0pt}
150 \setlength{\topmargin}{0pt}
151 \setlength{\headheight}{0pt}
152 \setlength{\headsep}{0pt}
153 \setlength{\textheight}{24cm}
154
155 \pagestyle{fancy}
156 \fancyhf{}
157 \renewcommand{\headrulewidth}{0pt}
158 \renewcommand{\footrulewidth}{0pt}
159 \lfoot{{\footnotesize \textsc{\@author} \emph{\@title}}}
160 \cfoot{}
161 \rfoot{{\footnotesize \thepage}}
162
163 \clubpenalty=100000
164 \widowpenalty=100000
165
166
167 % see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
168 \newsavebox{\ximagebox}\newlength{\ximageheight}
169 \newsavebox{\xglyphbox}\newlength{\xglyphheight}
170 \newcommand{\xbox}[1]
171 {\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximagebox}}%
172 \savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
173 \raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
174 \makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
175 \usebox{\ximagebox}%
176 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
177
178 \newcommand{\makecover}[2]{
179         \pdfpagewidth=#1
180         \pdfpageheight=#2
181
182         \thispagestyle{empty}
183         \newlength{\PictHOffset}
184         \newlength{\PictVOffset}
185         \setlength{\PictHOffset}{1in}
186         \addtolength{\PictHOffset}{\hoffset}
187         \addtolength{\PictHOffset}{\oddsidemargin}
188
189         \setlength{\PictVOffset}{1in}
190         \addtolength{\PictVOffset}{\voffset}
191         \addtolength{\PictVOffset}{\topmargin}
192         \addtolength{\PictVOffset}{\headheight}
193         \addtolength{\PictVOffset}{\headsep}
194         \addtolength{\PictVOffset}{\topskip}
195         \addtolength{\PictVOffset}{-\pdfpageheight}
196
197         \noindent\hspace*{-\PictHOffset}%
198         \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
199             \includegraphics[height=\pdfpageheight,width=\pdfpagewidth]{cover.png}}}
200         \clearpage
201
202         \setlength{\pdfpagewidth}{210mm}
203         \setlength{\pdfpageheight}{297mm}
204 }
205
206
207 \renewcommand{\maketitle}{
208     {
209     \thispagestyle{empty}
210     \footnotesize
211     \color{theme}
212
213     \noindent \begin{minipage}[t]{.35\textwidth}\vspace{0pt}
214         \href{http://www.wolnelektury.pl}{\xbox{\includegraphics[width=\textwidth]{wl-logo.png}}}
215     \end{minipage}
216     \begin{minipage}[t]{.65\textwidth}\vspace{0pt}
217
218     \ifflaglessadvertising
219     \else
220         \href{\bookurl}{Ta lektura}, podobnie jak tysiące innych, jest dostępna on-line na stronie
221         \href{http://www.wolnelektury.pl/}{wolnelektury.pl}.
222         \vspace{.5em}
223     \fi
224
225     \ifdefined\thanknote
226         \thanknote
227         \vspace{.5em}
228     \fi
229
230     Utwór opracowany został w ramach projektu \href{http://www.wolnelektury.pl/}{Wolne Lektury}
231     przez \href{http://nowoczesnapolska.org.pl}{fundację Nowoczesna Polska}.
232
233     \end{minipage}
234     \noindent \rule{\linewidth}{0.4pt}
235
236     \vspace{.6em}
237     \color{black}
238     }
239 }
240
241 \newcommand{\editorialsection}{
242   \begin{figure}[b!]
243   {
244     \footnotesize
245     \color{theme}
246     \noindent \rule{\linewidth}{0.4pt}
247
248     \ifdefined\sponsors
249         \marginnote{%
250             \centering%
251             \sponsors%
252         }
253     \fi
254
255     \rightsinfo
256     \vspace{.6em}
257
258     Źródło: \href{\bookurl}{\bookurl}
259
260     \vspace{.6em}
261     \sourceinfo
262
263     \description
264     \vspace{.6em}
265
266     \editors
267
268     \ifdefined\funders
269         \vspace{.6em}
270         \funders
271     \fi
272
273     \ifdefined\coverby
274         \vspace{.6em}
275         \coverby
276     \fi
277
278     \vspace{.6em}
279     \emph{Wesprzyj Wolne Lektury!}
280
281     Wolne Lektury to projekt fundacji Nowoczesna Polska – organizacji
282     pożytku publicznego działającej na rzecz wolności korzystania
283     z dóbr kultury.
284
285     Co roku do domeny publicznej przechodzi twórczość kolejnych autorów.
286     Dzięki Twojemu wsparciu będziemy je mogli udostępnić wszystkim bezpłatnie.
287
288     \vspace{.6em}
289     \emph{Jak możesz pomóc?}
290
291     Przekaż 1\% podatku na rozwój Wolnych Lektur:
292     Fundacja Nowoczesna Polska, KRS 0000070056.
293
294     Pomóż uwolnić konkretną książkę, wspierając
295     \href{http://www.wolnelektury.pl/wesprzyj/}{zbiórkę na stronie wolnelektury.pl}.
296
297     Przekaż darowiznę na konto:
298     \href{http://nowoczesnapolska.org.pl/pomoz-nam/wesprzyj-nas/}{szczegóły na stronie Fundacji}.
299
300     \color{black}
301   }
302   \end{figure}
303 }
304
305
306 \newcommand{\typosubsubsection}[1]{%
307 {\textsc{#1}}
308 }
309
310 \newcommand{\typosubsection}[1]{%
311 {\addfontfeature{
312 SizeFeatures={
313   {Size={-10}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
314   {Size={10.5-12}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
315   {Size={12-}, FakeStretch=1.0, LetterSpace=8.0 }
316 },
317 Letters={Uppercase}
318 }
319 \MakeUppercase{#1}}
320 }
321
322 \newcommand{\typosection}[1]{%
323 {\addfontfeature{FakeStretch=0.96, LetterSpace=-4.0}\emph{\scalefont{2}#1}}
324 %{\addfontfeature{Scale=2.0, FakeStretch=0.98, LetterSpace=-2.0}\emph{#1}}
325 }
326
327
328 \newcommand{\tytul}[1]{%
329 #1%
330 \vspace{1em}%
331 }
332
333 \newcommand{\nazwapodutworu}[1]{%
334 \section*{\typosection{#1}}%
335 }
336
337 \newcommand{\autorutworu}[1]{%
338 \subsection*{\typosubsection{#1}}%
339 }
340
341 \newcommand{\dzielonadrzedne}[1]{%
342 \subsection*{\typosubsubsection{#1}}%
343 }
344
345 \newcommand{\nazwautworu}[1]{%
346 \section*{\typosection{#1}}%
347 }
348
349 \newcommand{\podtytul}[1]{%
350 \subsection*{\typosubsubsection{#1}}%
351 }
352
353 \newcommand{\translator}[1]{%
354 \subsection*{\typosubsubsection{tłum. #1}}%
355 }
356
357
358 \newcommand{\powiesc}[1]{#1}
359 \newcommand{\opowiadanie}[1]{#1}
360 \newcommand{\lirykal}[1]{#1}
361 \newcommand{\lirykalp}[1]{#1}
362 \newcommand{\dramatwierszowanyl}[1]{#1}
363 \newcommand{\dramatwierszowanylp}[1]{#1}
364 \newcommand{\dramatwspolczesny}[1]{#1}
365
366 \newcommand{\nota}[1]{%
367 \par{#1}%
368 }
369
370 \newcommand{\dedykacja}[1]{%
371 \begin{em}%
372 \begin{flushright}%
373 #1%
374 \end{flushright}%
375 \end{em}%
376 }
377
378 \newcommand{\dlugicytat}[1]{%
379 \begin{quotation}%
380 #1%
381 \end{quotation}%
382 }
383
384 \newcommand{\poezjacyt}[1]{%
385 \begin{verse}%
386 #1%
387 \end{verse}%
388 }
389 \newcommand{\motto}[1]{%
390 \begin{em}%
391 #1%
392 \end{em}%
393 }
394 \newcommand{\listaosob}[2]{%
395 \par{#1}%
396 \begin{itemize}%
397 #2%
398 \end{itemize}%
399 }
400
401 \newcommand{\nagloweklisty}[1]{%
402 \typosubsubsection{#1}%
403 }
404
405 \newcommand{\listaosoba}[1]{%
406 \item{#1}%
407 }
408
409 \newcommand{\kwestia}[1]{%
410 \par{#1}%
411 }
412
413 \newcommand{\naglowekakt}[1]{%
414 \pagebreak
415 \subsection*{\typosubsection{#1}}%
416 }
417 \newcommand{\naglowekczesc}[1]{%
418 \pagebreak
419 \subsection*{\typosubsection{#1}}%
420 }
421 \newcommand{\srodtytul}[1]{%
422 \subsection*{\typosubsection{#1}}%
423 }
424
425 \newcommand{\naglowekscena}[1]{%
426 \subsubsection*{\typosubsubsection{#1}}%
427 }
428 \newcommand{\naglowekrozdzial}[1]{%
429 \subsubsection*{\typosubsubsection{#1}}%
430 }
431
432 \newcommand{\naglowekosoba}[1]{%
433 \par{\textsc{#1}}\nopagebreak%
434 }
435 \newcommand{\naglowekpodrozdzial}[1]{%
436 \par{#1}\nopagebreak%
437 }
438
439 \newcommand{\miejsceczas}[1]{%
440 \par{\emph{#1}}%
441 }
442 \newcommand{\didaskalia}[1]{%
443 \par{\emph{#1}}%
444 }
445
446 \newcommand{\akap}[1]{%
447 \par{#1}%
448 }
449 \newcommand{\akapdialog}[1]{%
450 \par{#1}%
451 }
452 \newcommand{\akapcd}[1]{%
453 \par{#1}%
454 }
455
456 \newcommand{\mottopodpis}[1]{%
457 \begin{em}%
458 \begin{flushright}%
459 #1%
460 \end{flushright}%
461 \end{em}%
462 }
463
464 \newcommand{\strofa}[1]{%
465 \par{\noindent{\ignorespaces#1\vspace{1em}}}%
466 }
467
468 \newcommand{\wers}[1]{#1}
469
470 \newcommand{\wersakap}[1]{%
471 \hspace*{1em}#1%
472 }
473 \newcommand{\werscd}[1]{%
474 \hspace*{8em}#1%
475 }
476 \newcommand{\werswciety}[2][1em]{%
477 \hspace*{#1}#2%
478 }
479
480 \ifshowfootnotes
481   \newcommand{\pa}[1]{\NoCaseChange{\footnote{#1 [przypis autorski]}}}
482   \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
483   \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
484   \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
485 \else
486   \newcommand{\pa}[1]{}
487   \newcommand{\pe}[1]{}
488   \newcommand{\pr}[1]{}
489   \newcommand{\pt}[1]{}
490 \fi
491
492 \newcommand{\mat}[1]{$#1$}
493
494 \newcommand{\didasktekst}[1]{%
495 \emph{#1}%
496 }
497 \newcommand{\slowoobce}[1]{%
498 \emph{#1}%
499 }
500 \newcommand{\tytuldziela}[1]{%
501 \emph{#1}%
502 }
503 \newcommand{\wyroznienie}[1]{%
504 \emph{#1}%
505 }
506
507 \newcommand{\osoba}[1]{%
508 #1%
509 }
510
511 \newcommand{\sekcjaswiatlo}{%
512 \vspace{30pt}%
513 }
514
515 \newcommand{\sekcjaasterysk}{%
516 \vspace{10pt}%
517 \begin{center}%
518 \par{*}%
519 \end{center}%
520 }
521
522 \newcommand{\separatorlinia}{%
523 \vspace{10pt}%
524 \hrule{}%
525 \vspace{10pt}%
526 }
527
528 \newcommand{\motyw}[2][0]{%
529 \ifshowthemes
530 \mbox{}%
531 \marginpar{%
532 \vspace{-8pt}%
533 \vspace{-#1\baselineskip}%
534 \raggedright{\hspace{0pt}%
535 \footnotesize{\color{theme}{#2}}}%
536 \vspace{\baselineskip}%
537 }%
538 \fi
539 }
540
541 \newcommand{\ilustr}[2]{%
542 \vspace{1em}%
543 \par{\noindent\includegraphics[width=\linewidth]{#1}}%
544 \vspace{1em}
545 }