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