a747754346126c36417b69ff50d2a7afabbb0c31
[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 \LoadClass[a4paper]{book}
66
67
68 \usepackage{trace}
69
70 \usepackage{longtable}
71 \usepackage{tabu}
72 \usepackage[MeX]{polski}
73
74 \usepackage[xetex]{graphicx}
75 \usepackage{fontspec}
76 \usepackage{xunicode}
77 \usepackage{xltxtra}
78
79 \usepackage[overload]{textcase}
80 \usepackage{scalefnt}
81 \usepackage[hyphens]{url}
82 %\usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=black,xetex,unicode]{hyperref}
83 \usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=blue,xetex,unicode]{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
135 \makeatletter
136
137 % bottom figure below footnotes
138 \usepackage{fnpos}
139 \makeFNabove
140
141 \usepackage{color}
142 \definecolor{theme}{gray}{.3}
143
144 \setlength{\marginparsep}{2em}
145 \setlength{\marginparwidth}{8.5em}
146 %\setlength{\oddsidemargin}{0pt}
147 \setlength{\oddsidemargin}{\evensidemargin}
148 \setlength{\evensidemargin}{18pt}
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 %\rfoot[{\footnotesize \thepage}]{{\footnotesize \textsc{\@author} \emph{\@title}}}
161 \lfoot[{\footnotesize \thepage}]{}
162 \cfoot{}
163 %\rfoot{{\footnotesize \thepage}}
164 %\lfoot[{\footnotesize \textsc{\@author} \emph{\@title}}]{{\footnotesize \thepage}}
165 \rfoot[]{{\footnotesize \thepage}}
166
167
168 \clubpenalty=100000
169 \widowpenalty=100000
170
171
172 % see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
173 \newsavebox{\ximagebox}\newlength{\ximageheight}
174 \newsavebox{\xglyphbox}\newlength{\xglyphheight}
175 \newcommand{\xbox}[1]
176 {\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximagebox}}%
177 \savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
178 \raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
179 \makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
180 \usebox{\ximagebox}%
181 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
182
183 \newcommand{\makecover}[2]{
184         \pdfpagewidth=#1
185         \pdfpageheight=#2
186
187         \thispagestyle{empty}
188         \newlength{\PictHOffset}
189         \newlength{\PictVOffset}
190         \setlength{\PictHOffset}{1in}
191         \addtolength{\PictHOffset}{\hoffset}
192         \addtolength{\PictHOffset}{\oddsidemargin}
193
194         \setlength{\PictVOffset}{1in}
195         \addtolength{\PictVOffset}{\voffset}
196         \addtolength{\PictVOffset}{\topmargin}
197         \addtolength{\PictVOffset}{\headheight}
198         \addtolength{\PictVOffset}{\headsep}
199         \addtolength{\PictVOffset}{\topskip}
200         \addtolength{\PictVOffset}{-\pdfpageheight}
201
202         \noindent\hspace*{-\PictHOffset}%
203         \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
204             \includegraphics[height=\pdfpageheight,width=\pdfpagewidth]{cover.png}}}
205         \clearpage
206
207         \setlength{\pdfpagewidth}{210mm}
208         \setlength{\pdfpageheight}{297mm}
209 }
210
211
212 \renewcommand{\maketitle}{
213     {
214     % \thispagestyle{empty}
215     \setcounter{page}{1}
216
217     \footnotesize
218     \color{theme}
219
220     \noindent \begin{minipage}[t]{.65\textwidth}\vspace{0pt}
221         %\href{http://prawokultury.pl}{\xbox{\includegraphics[width=1in]{prawokultury-logo.png}}}
222         \href{http://koed.org.pl}{\xbox{\includegraphics[height=.55in]{koed-logo.eps}}}
223     \end{minipage}
224     \noindent \begin{minipage}[t]{.35\textwidth}\vspace{0pt}
225         \raggedright
226         %\xbox{\includegraphics[width=1.6in]{trust-logo.eps}}
227         \href{http://nowoczesnapolska.org.pl}{\xbox{\includegraphics[height=.55in]{fnp-logo.eps}}}
228         \vspace{.5em}
229     \end{minipage}
230
231 %    \begin{minipage}[t]{.45\textwidth}\vspace{0pt}
232
233     \ifflaglessadvertising
234     \else
235         %\noindent Ten rozdział pochodzi z książki \emph{\@title}, która zostanie opublikowana w portalu
236         %\href{http://prawokultury.pl/}{prawokultury.pl}.
237         \vspace{.5em}
238     \fi
239
240  %   Utwór opracowany został w ramach projektu \href{http://www.wolnelektury.pl/}{Wolne Lektury}
241   %  przez \href{http://nowoczesnapolska.org.pl}{fundację Nowoczesna Polska}.
242
243  %   \end{minipage}
244     \noindent \rule{\linewidth}{0.4pt}
245
246     \vspace{.6em}
247     \color{black}
248     }
249 }
250
251 \newcommand{\editorialsection}{
252   \begin{figure}[b!]
253   {
254     \footnotesize
255     \color{theme}
256     \noindent \rule{\linewidth}{0.4pt}
257
258     \rightsinfo
259     \vspace{.6em}
260
261     %Źródło: \href{\bookurl}{\bookurl}
262
263     %\vspace{.6em}
264     \sourceinfo
265
266     \description
267     \vspace{.6em}
268
269     \editors
270
271     \vspace{.6em}
272     \coverby
273
274     \color{black}
275   }
276   \end{figure}
277 }
278
279
280 \newcommand{\typosubsubsection}[1]{%
281 {\textsc{#1}}
282 }
283
284 \newcommand{\typosubsection}[1]{%
285 {\addfontfeature{
286 SizeFeatures={
287   {Size={-10}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
288   {Size={10.5-12}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
289   {Size={12-}, FakeStretch=1.0, LetterSpace=8.0 }
290 },
291 Letters={Uppercase}
292 }
293 \MakeUppercase{#1}}
294 }
295
296 \newcommand{\typosection}[1]{%
297 %{\addfontfeature{FakeStretch=0.96, LetterSpace=-4.0}\emph{\scalefont{2}#1}}
298 {\addfontfeature{FakeStretch=0.96, LetterSpace=-4.0}\emph{\scalefont{1.7}#1}}
299 %{\addfontfeature{Scale=2.0, FakeStretch=0.98, LetterSpace=-2.0}\emph{#1}}
300 }
301
302
303 \newcommand{\tytul}[1]{%
304 #1%
305 \vspace{1em}%
306 }
307
308 \newcommand{\nazwapodutworu}[1]{%
309 \section*{\typosection{#1}}%
310 }
311
312 \newcommand{\autorutworu}[1]{%
313 \subsection*{\typosubsection{#1}}%
314 }
315
316 \newcommand{\dzielonadrzedne}[1]{%
317 \subsection*{\typosubsubsection{#1}}%
318 }
319
320 \newcommand{\nazwautworu}[1]{%
321 \section*{\raggedright{\typosection{#1}}}%
322 }
323
324 \newcommand{\podtytul}[1]{%
325 \subsection*{\typosubsubsection{#1}}%
326 }
327
328 \newcommand{\translator}[1]{%
329 \subsection*{\typosubsubsection{tłum. #1}}%
330 }
331
332
333 \newcommand{\powiesc}[1]{#1}
334 \newcommand{\opowiadanie}[1]{#1}
335 \newcommand{\lirykal}[1]{#1}
336 \newcommand{\lirykalp}[1]{#1}
337 \newcommand{\dramatwierszowanyl}[1]{#1}
338 \newcommand{\dramatwierszowanylp}[1]{#1}
339 \newcommand{\dramatwspolczesny}[1]{#1}
340
341 \newcommand{\nota}[1]{%
342 \par{#1}%
343 }
344
345 \newcommand{\dedykacja}[1]{%
346 \begin{em}%
347 \begin{flushright}%
348 #1%
349 \end{flushright}%
350 \end{em}%
351 }
352
353 \newcommand{\ramka}[1]{%
354 \noindent\fbox{%
355 \parbox{\textwidth}{%
356 #1%
357 }}%
358 }
359
360 \newcommand{\dlugicytat}[1]{%
361 \begin{quotation}%
362 %\raggedright%
363 #1%
364 \end{quotation}%
365 }
366
367 \newcommand{\poezjacyt}[1]{%
368 \begin{verse}%
369 #1%
370 \end{verse}%
371 }
372 \newcommand{\motto}[1]{%
373 \begin{em}%
374 #1%
375 \end{em}%
376 }
377 \newcommand{\listaosob}[2]{%
378 \par{#1}%
379 \begin{itemize}%
380 #2%
381 \end{itemize}
382
383 }
384
385 \newcommand{\nagloweklisty}[1]{%
386 \typosubsubsection{#1}%
387 }
388
389 \newcommand{\listaosoba}[1]{%
390 \item{#1}%
391 }
392
393 \newcommand{\kwestia}[1]{%
394 \par{#1}%
395 }
396
397 \newcommand{\naglowekakt}[1]{%
398 \newpage
399 \subsection*{\typosubsection{#1}}%
400 }
401 \newcommand{\naglowekczesc}[1]{%
402 \newpage
403 \subsection*{\typosubsection{#1}}%
404 }
405 \newcommand{\srodtytul}[1]{%
406 \par{\typosubsubsection{#1}}%
407 %\subsection*{\typosubsection{#1}}%
408 }
409
410 \newcommand{\naglowekscena}[1]{%
411 \subsubsection*{\typosubsubsection{#1}}%
412 }
413 \newcommand{\naglowekrozdzial}[1]{%
414 \subsection*{\raggedright \typosubsection{#1}}%
415 %\subsubsection*{\typosubsubsection{#1}}%
416 }
417
418 \newcommand{\naglowekosoba}[1]{%
419 \par{\textsc{#1}}\nopagebreak%
420 }
421 \newcommand{\naglowekpodrozdzial}[1]{%
422 \subsubsection*{\typosubsubsection{#1}}%
423 %\par{#1}\nopagebreak%
424 }
425
426 \newcommand{\miejsceczas}[1]{%
427 \par{\emph{#1}}%
428 }
429 \newcommand{\didaskalia}[1]{%
430 \par{\emph{#1}}%
431 }
432
433 \newcommand{\akap}[1]{%
434 \par{#1}%
435 }
436 \newcommand{\akapdialog}[1]{%
437 \par{#1}%
438 }
439 \newcommand{\akapcd}[1]{%
440 \par{#1}%
441 }
442
443 \newcommand{\mottopodpis}[1]{%
444 \begin{em}%
445 \begin{flushright}%
446 #1%
447 \end{flushright}%
448 \end{em}%
449 }
450
451 \newcommand{\strofa}[1]{%
452 \par{\noindent{\ignorespaces#1\vspace{1em}}}%
453 }
454
455 \newcommand{\wers}[1]{#1}
456
457 \newcommand{\wersakap}[1]{%
458 \hspace*{1em}#1%
459 }
460 \newcommand{\werscd}[1]{%
461 \hspace*{8em}#1%
462 }
463 \newcommand{\werswciety}[2][1em]{%
464 \hspace*{#1}#2%
465 }
466
467 \ifshowfootnotes
468   %\newcommand{\pa}[1]{\NoCaseChange{\footnote{#1 [przypis autorski]}}}
469   \newcommand{\pa}[1]{\NoCaseChange{\footnote{#1}}}
470   \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
471   \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
472   \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
473 \else
474   \newcommand{\pa}[1]{}
475   \newcommand{\pe}[1]{}
476   \newcommand{\pr}[1]{}
477   \newcommand{\pt}[1]{}
478 \fi
479
480 \newcommand{\mat}[1]{$#1$}
481
482 \newcommand{\didasktekst}[1]{%
483 \emph{#1}%
484 }
485 \newcommand{\slowoobce}[1]{%
486 \emph{#1}%
487 }
488 \newcommand{\tytuldziela}[1]{%
489 \emph{#1}%
490 }
491 \newcommand{\wyroznienie}[1]{%
492 \emph{#1}%
493 }
494
495 \newcommand{\osoba}[1]{%
496 #1%
497 }
498
499 \newcommand{\sekcjaswiatlo}{%
500 \vspace{30pt}%
501 }
502
503 \newcommand{\sekcjaasterysk}{%
504 \vspace{10pt}%
505 \begin{center}%
506 \par{*}%
507 \end{center}%
508 }
509
510 \newcommand{\separatorlinia}{%
511 \vspace{10pt}%
512 \hrule{}%
513 \vspace{10pt}%
514 }
515
516 \newcommand{\motyw}[2][0]{%
517 \ifshowthemes
518 \mbox{}%
519 \marginpar{%
520 \vspace{-8pt}%
521 \vspace{-#1\baselineskip}%
522 \raggedright{\hspace{0pt}%
523 \footnotesize{\color{theme}{#2}}}%
524 \vspace{\baselineskip}%
525 }%
526 \fi
527 }
528
529
530 \newcommand{\www}[1]{%
531 %\href{#1}{#1}%
532 \url{#1}%
533 }
534 \newcommand{\listanum}[1]{%
535 \begin{enumerate}%
536 #1%
537 \end{enumerate}%
538 }
539 \newcommand{\listapunkt}[1]{%
540 \begin{itemize}%
541 #1%
542 \end{itemize}%
543 }
544 \newcommand{\punkt}[1]{%
545 \item #1%
546 }
547 \newcommand{\ilustr}[2]{%
548 \vspace{1em}%
549 \par{\noindent\includegraphics[width=\linewidth]{#1}}%
550 \vspace{1em}
551 }