[epub] removed flag with-full-fonts as it is not required any more
[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[overload]{textcase}
77 \usepackage{scalefnt}
78 \usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=black,xetex]{hyperref}
79
80 \ifenablewlfont
81 \setmainfont [
82 %ExternalLocation,
83 UprightFont = JunicodeWL-Regular,
84 ItalicFont = JunicodeWL-Italic,
85 BoldFont = JunicodeWL-Regular,
86 BoldItalicFont = JunicodeWL-Italic,
87 SmallCapsFont = JunicodeWL-Regular,
88 SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
89 Numbers=OldStyle,
90 Scale=1.04,
91 LetterSpace=-1.0
92 ] {JunicodeWL}
93
94 \newfontfamily\alien[
95 SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
96 Numbers=OldStyle,
97 Scale=0.85,
98 LetterSpace=-1.0
99 ] {DejaVu Serif}
100
101
102 \defaultfontfeatures{
103 SizeFeatures={
104   {Size={-10.5}, FakeStretch=1.02, LetterSpace=2.0 },
105   {Size={10.5-12}, FakeStretch=2.00, LetterSpace=0.0 },
106   {Size={12-}, FakeStretch=0.98, LetterSpace=-2.0 }
107 }
108 }
109
110 \renewcommand{\textsc}[1]{%
111 {\addfontfeature{
112 SizeFeatures={
113   {Size={-10.5}, Scale=1.2, FakeStretch=1.02, LetterSpace=8.0 },
114   {Size={10.5-12}, Scale=1.2, FakeStretch=1.02, LetterSpace=8.0 },
115   {Size={12-}, FakeStretch=1.0, LetterSpace=8.0 }
116 },
117 Letters={SmallCaps,UppercaseSmallCaps}
118 }
119 #1}
120 }
121 \fi% enablewlfont
122
123 %{\Itshape JunicodeWL-Italic.ttf }
124 %{\bfseries Junicode-Bold.ttf }
125 %{\bfseries\itshape Junicode-BoldItalic.ttf }
126
127 \pagestyle{plain}
128 \usepackage{fancyhdr}
129 \usepackage{marginnote}
130
131
132 \makeatletter
133
134 % bottom figure below footnotes
135 \usepackage{fnpos}
136 \makeFNabove
137
138 \usepackage{color}
139 \definecolor{theme}{gray}{.3}
140
141 \setlength{\marginparsep}{2em}
142 \setlength{\marginparwidth}{8.5em}
143 \setlength{\oddsidemargin}{0pt}
144 \setlength{\voffset}{0pt}
145 \setlength{\topmargin}{0pt}
146 \setlength{\headheight}{0pt}
147 \setlength{\headsep}{0pt}
148 \setlength{\textheight}{24cm}
149
150 \pagestyle{fancy}
151 \fancyhf{}
152 \renewcommand{\headrulewidth}{0pt}
153 \renewcommand{\footrulewidth}{0pt}
154 \lfoot{{\footnotesize \textsc{\@author} \emph{\@title}}}
155 \cfoot{}
156 \rfoot{{\footnotesize \thepage}}
157
158 \clubpenalty=100000
159 \widowpenalty=100000
160
161
162 % see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
163 \newsavebox{\ximagebox}\newlength{\ximageheight}
164 \newsavebox{\xglyphbox}\newlength{\xglyphheight}
165 \newcommand{\xbox}[1]
166 {\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximagebox}}%
167 \savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
168 \raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
169 \makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
170 \usebox{\ximagebox}%
171 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
172
173 \newcommand{\makecover}[2]{
174         \pdfpagewidth=#1
175         \pdfpageheight=#2
176
177         \thispagestyle{empty}
178         \newlength{\PictHOffset}
179         \newlength{\PictVOffset}
180         \setlength{\PictHOffset}{1in}
181         \addtolength{\PictHOffset}{\hoffset}
182         \addtolength{\PictHOffset}{\oddsidemargin}
183
184         \setlength{\PictVOffset}{1in}
185         \addtolength{\PictVOffset}{\voffset}
186         \addtolength{\PictVOffset}{\topmargin}
187         \addtolength{\PictVOffset}{\headheight}
188         \addtolength{\PictVOffset}{\headsep}
189         \addtolength{\PictVOffset}{\topskip}
190         \addtolength{\PictVOffset}{-\pdfpageheight}
191
192         \noindent\hspace*{-\PictHOffset}%
193         \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
194             \includegraphics[height=\pdfpageheight,width=\pdfpagewidth]{cover.png}}}
195         \clearpage
196
197         \setlength{\pdfpagewidth}{210mm}
198         \setlength{\pdfpageheight}{297mm}
199 }
200
201
202 \renewcommand{\maketitle}{
203     {
204     \thispagestyle{empty}
205     \footnotesize
206     \color{theme}
207
208     \noindent \begin{minipage}[t]{.35\textwidth}\vspace{0pt}
209         \href{http://www.wolnelektury.pl}{\xbox{\includegraphics[width=\textwidth]{wl-logo.png}}}
210     \end{minipage}
211     \begin{minipage}[t]{.65\textwidth}\vspace{0pt}
212
213     \ifflaglessadvertising
214     \else
215         \href{\bookurl}{Ta lektura}, podobnie jak tysiące innych, jest dostępna on-line na stronie
216         \href{http://www.wolnelektury.pl/}{wolnelektury.pl}.
217         \vspace{.5em}
218     \fi
219
220     \ifdefined\thanknote
221         \thanknote
222         \vspace{.5em}
223     \fi
224
225     Utwór opracowany został w ramach projektu \href{http://www.wolnelektury.pl/}{Wolne Lektury}
226     przez \href{http://nowoczesnapolska.org.pl}{fundację Nowoczesna Polska}.
227
228     \end{minipage}
229     \noindent \rule{\linewidth}{0.4pt}
230
231     \vspace{.6em}
232     \color{black}
233     }
234 }
235
236 \newcommand{\editorialsection}{
237   \begin{figure}[b!]
238   {
239     \footnotesize
240     \color{theme}
241     \noindent \rule{\linewidth}{0.4pt}
242
243     \ifdefined\sponsors
244         \marginnote{%
245             \centering%
246             \sponsors%
247         }
248     \fi
249
250     \rightsinfo
251     \vspace{.6em}
252
253     Źródło: \href{\bookurl}{\bookurl}
254
255     \vspace{.6em}
256     \sourceinfo
257
258     \description
259     \vspace{.6em}
260
261     \editors
262
263     \ifdefined\funders
264         \vspace{.6em}
265         \funders
266     \fi
267
268     \ifdefined\coverby
269         \vspace{.6em}
270         \coverby
271     \fi
272
273     \vspace{.6em}
274     \emph{Wesprzyj Wolne Lektury!}
275
276     Wolne Lektury to projekt fundacji Nowoczesna Polska – organizacji
277     pożytku publicznego działającej na rzecz wolności korzystania
278     z dóbr kultury.
279
280     Co roku do domeny publicznej przechodzi twórczość kolejnych autorów.
281     Dzięki Twojemu wsparciu będziemy je mogli udostępnić wszystkim bezpłatnie.
282
283     \vspace{.6em}
284     \emph{Jak możesz pomóc?}
285
286     Przekaż 1\% podatku na rozwój Wolnych Lektur:
287     Fundacja Nowoczesna Polska, KRS 0000070056.
288
289     Pomóż uwolnić konkretną książkę, wspierając
290     \href{http://www.wolnelektury.pl/wesprzyj/}{zbiórkę na stronie wolnelektury.pl}.
291
292     Przekaż darowiznę na konto:
293     \href{http://nowoczesnapolska.org.pl/pomoz-nam/wesprzyj-nas/}{szczegóły na stronie Fundacji}.
294
295     \color{black}
296   }
297   \end{figure}
298 }
299
300
301 \newcommand{\typosubsubsection}[1]{%
302 {\textsc{#1}}
303 }
304
305 \newcommand{\typosubsection}[1]{%
306 {\addfontfeature{
307 SizeFeatures={
308   {Size={-10}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
309   {Size={10.5-12}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
310   {Size={12-}, FakeStretch=1.0, LetterSpace=8.0 }
311 },
312 Letters={Uppercase}
313 }
314 \MakeUppercase{#1}}
315 }
316
317 \newcommand{\typosection}[1]{%
318 {\addfontfeature{FakeStretch=0.96, LetterSpace=-4.0}\emph{\scalefont{2}#1}}
319 %{\addfontfeature{Scale=2.0, FakeStretch=0.98, LetterSpace=-2.0}\emph{#1}}
320 }
321
322
323 \newcommand{\tytul}[1]{%
324 #1%
325 \vspace{1em}%
326 }
327
328 \newcommand{\nazwapodutworu}[1]{%
329 \section*{\typosection{#1}}%
330 }
331
332 \newcommand{\autorutworu}[1]{%
333 \subsection*{\typosubsection{#1}}%
334 }
335
336 \newcommand{\dzielonadrzedne}[1]{%
337 \subsection*{\typosubsubsection{#1}}%
338 }
339
340 \newcommand{\nazwautworu}[1]{%
341 \section*{\typosection{#1}}%
342 }
343
344 \newcommand{\podtytul}[1]{%
345 \subsection*{\typosubsubsection{#1}}%
346 }
347
348 \newcommand{\translator}[1]{%
349 \subsection*{\typosubsubsection{tłum. #1}}%
350 }
351
352
353 \newcommand{\powiesc}[1]{#1}
354 \newcommand{\opowiadanie}[1]{#1}
355 \newcommand{\lirykal}[1]{#1}
356 \newcommand{\lirykalp}[1]{#1}
357 \newcommand{\dramatwierszowanyl}[1]{#1}
358 \newcommand{\dramatwierszowanylp}[1]{#1}
359 \newcommand{\dramatwspolczesny}[1]{#1}
360
361 \newcommand{\nota}[1]{%
362 \par{#1}%
363 }
364
365 \newcommand{\dedykacja}[1]{%
366 \begin{em}%
367 \begin{flushright}%
368 #1%
369 \end{flushright}%
370 \end{em}%
371 }
372
373 \newcommand{\dlugicytat}[1]{%
374 \begin{quotation}%
375 #1%
376 \end{quotation}%
377 }
378
379 \newcommand{\poezjacyt}[1]{%
380 \begin{verse}%
381 #1%
382 \end{verse}%
383 }
384 \newcommand{\motto}[1]{%
385 \begin{em}%
386 #1%
387 \end{em}%
388 }
389 \newcommand{\listaosob}[2]{%
390 \par{#1}%
391 \begin{itemize}%
392 #2%
393 \end{itemize}%
394 }
395
396 \newcommand{\nagloweklisty}[1]{%
397 \typosubsubsection{#1}%
398 }
399
400 \newcommand{\listaosoba}[1]{%
401 \item{#1}%
402 }
403
404 \newcommand{\kwestia}[1]{%
405 \par{#1}%
406 }
407
408 \newcommand{\naglowekakt}[1]{%
409 \pagebreak
410 \subsection*{\typosubsection{#1}}%
411 }
412 \newcommand{\naglowekczesc}[1]{%
413 \pagebreak
414 \subsection*{\typosubsection{#1}}%
415 }
416 \newcommand{\srodtytul}[1]{%
417 \subsection*{\typosubsection{#1}}%
418 }
419
420 \newcommand{\naglowekscena}[1]{%
421 \subsubsection*{\typosubsubsection{#1}}%
422 }
423 \newcommand{\naglowekrozdzial}[1]{%
424 \subsubsection*{\typosubsubsection{#1}}%
425 }
426
427 \newcommand{\naglowekosoba}[1]{%
428 \par{\textsc{#1}}\nopagebreak%
429 }
430 \newcommand{\naglowekpodrozdzial}[1]{%
431 \par{#1}\nopagebreak%
432 }
433
434 \newcommand{\miejsceczas}[1]{%
435 \par{\emph{#1}}%
436 }
437 \newcommand{\didaskalia}[1]{%
438 \par{\emph{#1}}%
439 }
440
441 \newcommand{\akap}[1]{%
442 \par{#1}%
443 }
444 \newcommand{\akapdialog}[1]{%
445 \par{#1}%
446 }
447 \newcommand{\akapcd}[1]{%
448 \par{#1}%
449 }
450
451 \newcommand{\mottopodpis}[1]{%
452 \begin{em}%
453 \begin{flushright}%
454 #1%
455 \end{flushright}%
456 \end{em}%
457 }
458
459 \newcommand{\strofa}[1]{%
460 \par{\noindent{\ignorespaces#1\vspace{1em}}}%
461 }
462
463 \newcommand{\wers}[1]{#1}
464
465 \newcommand{\wersakap}[1]{%
466 \hspace*{1em}#1%
467 }
468 \newcommand{\werscd}[1]{%
469 \hspace*{8em}#1%
470 }
471 \newcommand{\werswciety}[2][1em]{%
472 \hspace*{#1}#2%
473 }
474
475 \ifshowfootnotes
476   \newcommand{\pa}[1]{\NoCaseChange{\footnote{#1 [przypis autorski]}}}
477   \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
478   \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
479   \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
480 \else
481   \newcommand{\pa}[1]{}
482   \newcommand{\pe}[1]{}
483   \newcommand{\pr}[1]{}
484   \newcommand{\pt}[1]{}
485 \fi
486
487 \newcommand{\mat}[1]{$#1$}
488
489 \newcommand{\didasktekst}[1]{%
490 \emph{#1}%
491 }
492 \newcommand{\slowoobce}[1]{%
493 \emph{#1}%
494 }
495 \newcommand{\tytuldziela}[1]{%
496 \emph{#1}%
497 }
498 \newcommand{\wyroznienie}[1]{%
499 \emph{#1}%
500 }
501
502 \newcommand{\osoba}[1]{%
503 #1%
504 }
505
506 \newcommand{\sekcjaswiatlo}{%
507 \vspace{30pt}%
508 }
509
510 \newcommand{\sekcjaasterysk}{%
511 \vspace{10pt}%
512 \begin{center}%
513 \par{*}%
514 \end{center}%
515 }
516
517 \newcommand{\separatorlinia}{%
518 \vspace{10pt}%
519 \hrule{}%
520 \vspace{10pt}%
521 }
522
523 \newcommand{\motyw}[2][0]{%
524 \ifshowthemes
525 \mbox{}%
526 \marginpar{%
527 \vspace{-8pt}%
528 \vspace{-#1\baselineskip}%
529 \raggedright{\hspace{0pt}%
530 \footnotesize{\color{theme}{#2}}}%
531 \vspace{\baselineskip}%
532 }%
533 \fi
534 }
535