epub changes
[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{geometry}
16 \RequirePackage{setspace}
17 \RequirePackage{type1cm}
18 \RequirePackage{amssymb}
19 \RequirePackage{amsmath}
20
21 %\DeclareOption{13pt}{%
22 %\AtEndOfClass{%
23 % font size definitions, similar to ones in /usr/share/texmf-texlive/tex/latex/base/
24 %% \renewcommand\normalsize{%
25 %%    \@setfontsize\normalsize{13pt}{14.5pt}%
26 %%    \abovedisplayskip 12\p@ \@plus3\p@ \@minus7\p@
27 %%    \abovedisplayshortskip \z@ \@plus3\p@
28 %%    \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@
29 %%    \belowdisplayskip \abovedisplayskip
30 %%    \let\@listi\@listI}\normalsize%
31 %% \renewcommand\footnotesize{%
32 %%    \@setfontsize\footnotesize\@xpt\@xiipt
33 %%    \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@
34 %%    \abovedisplayshortskip \z@ \@plus3\p@
35 %%    \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@
36 %%    \def\@listi{\leftmargin\leftmargini
37 %%                \topsep 6\p@ \@plus2\p@ \@minus2\p@
38 %%                \parsep 3\p@ \@plus2\p@ \@minus\p@
39 %%                \itemsep \parsep}%
40 %%    \belowdisplayskip \abovedisplayskip
41 %}%
42 %}%
43 %}
44
45 %% \DeclareOption{14pt}{\renewcommand{\normalsize}{\AtEndOfClass{\fontsize{14}{17}\selectfont}}}
46
47 \DeclareOption{defaultleading}{}
48 \DeclareOption{doubleleading}{\AtBeginDocument{\doublespacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
49 \DeclareOption{onehalfleading}{\AtBeginDocument{\onehalfspacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
50
51 %% 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.
52 \DeclareOption{a5paper}{%
53       \setlength{\paperheight}{210mm}%
54       \setlength{\paperwidth}{148mm}}
55 % a5paper dropped down size
56 \newif\ifafivepaper \afivepaperfalse
57 \DeclareOption{a5paperdd}{%
58   \setlength{\paperheight}{225mm}%
59   \setlength{\paperwidth}{160mm}%
60   \afivepapertrue
61 }
62
63 \newif\ifshowfootnotes \showfootnotestrue
64 \DeclareOption{nofootnotes}{\showfootnotesfalse}
65
66 \newif\ifshowthemes \showthemestrue
67 \DeclareOption{nothemes}{\showthemesfalse}
68
69 \newif\ifenablewlfont \enablewlfonttrue
70 \DeclareOption{nowlfont}{\enablewlfontfalse}
71
72
73 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{extbook}}
74 \ProcessOptions\relax
75 \LoadClass{extbook}
76
77 \ifafivepaper
78   \usepackage[%
79     paperwidth=160mm,%
80     paperheight=225mm,%
81     text={117mm,162mm},% 
82     top=30mm,% 
83     headsep=8mm,%
84     left=23mm,%
85     right=30mm]{geometry}%
86 \fi
87
88 \usepackage{trace}
89 \usepackage{caption}
90 \usepackage{tabularx}
91 \usepackage[MeX]{polski}
92 \usepackage{icomma}
93 \usepackage[xetex]{graphicx}
94 \usepackage{fontspec}
95 \usepackage{xunicode}
96 \usepackage{xltxtra}
97
98 \usepackage[overload]{textcase}
99 \usepackage{scalefnt}
100 \usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=black,xetex]{hyperref}
101
102
103 \setmainfont [
104 ItalicFont = CrimsonText-Italic,
105 BoldFont = CrimsonText-Bold,
106 BoldItalicFont = CrimsonText-BoldItalic,
107 Ligatures={Common, Contextual},
108 Mapping=tex-text
109 ]{CrimsonText-Roman}
110 \newfontface\sb{CrimsonText-Semibold}
111
112 \renewcommand{\baselinestretch}{1.1}
113
114 \pagestyle{plain}
115 \usepackage{fancyhdr}
116 \usepackage[explicit]{titlesec}
117
118 \makeatletter
119
120
121
122 % bottom figure below footnotes
123 \usepackage{fnpos}
124 \makeFNabove
125
126 \usepackage{color}
127 \definecolor{theme}{gray}{.3}
128
129
130 %%%%%%%%%%%%%%%%%%%%%% Headings.
131
132 \pagestyle{fancy}
133 \fancyhf{}
134 \renewcommand{\headrulewidth}{0pt}
135 \renewcommand{\footrulewidth}{0pt}
136
137 %\lfoot{{\footnotesize \textsc{\@author} \emph{\@title}}}
138 \cfoot{}
139 %\rfoot{{\footnotesize \thepage}}
140 \renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{#1}}{}}
141 \fancyhead[CE]{{\textsc{\MakeUppercase{\@title}}}}
142 \fancyhead[CO]{{\textsc{\leftmark}}}
143 \fancyhead[LE,RO]{{\thepage}}
144
145 %%%%%%%%%%%%%%%%%%%%%% Section title styles.
146 %% Sections
147 \titleformat{\chapter}%
148 {\raggedright\Huge\sc\addfontfeature{LetterSpace=0.0, Letters={Uppercase}}}%
149 {}{0pt}{\MakeUppercase{#1}}
150 \titlespacing*{\chapter}{0pt}{0pt}{40pt}
151
152 %% Subsections
153 \titleformat{\section}%
154 {\bf\large\addfontfeature{Scale=1.0}}%
155 {\thesection\enskip}{0pt}{#1}
156 \renewcommand{\thesection}{\Roman{section}}
157
158 \titleformat{\subsection}%
159 {\sc}%
160 {\thesubsection}{0pt}{#1}
161
162 \newcommand{\typosubsubsection}[1]{%
163 {\textsc{#1}}
164 }
165
166 %% XXX delete them
167 \newcommand{\typosubsection}[1]{%
168 {\MakeUppercase{#1}}
169 }
170
171 \newcommand{\typosection}[1]{%
172 {\addfontfeature{FakeStretch=0.96, LetterSpace=-4.0}\emph{\scalefont{2}#1}}
173 %{\addfontfeature{Scale=2.0, FakeStretch=0.98, LetterSpace=-2.0}\emph{#1}}
174 }
175 %%%%%%%%%%%%%%%%%% ^^
176
177 %%%%% Footnotes %%%%%%%%5
178 %% \makeatletter
179 %% \renewcommand\@makefntext[1]{%
180 %%   \noindent\parbox[t][\height][l]{3em}{\@thefnmark.}\parbox[t][\height][l]{6cm}{#1}\vskip3pt}
181 %% \makeatother
182 \makeatletter
183
184 \renewcommand\@makefnmark{%
185 \hbox{{\normalfont\@thefnmark}}%
186 }
187 \renewcommand\thefootnote{[\arabic{footnote}]}
188
189 \long\def\@makefntext#1{%
190   \parindent 1em\noindent \hb@xt@ 1.8em{\hss \@makefnmark \enskip}#1.
191 }
192
193 \makeatother
194
195
196 \clubpenalty=100000
197 \widowpenalty=100000
198
199
200 % see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
201 \newsavebox{\ximagebox}\newlength{\ximageheight}
202 \newsavebox{\xglyphbox}\newlength{\xglyphheight}
203 \newcommand{\xbox}[1]
204 {\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximagebox}}%
205 \savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
206 \raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
207 \makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
208 \usebox{\ximagebox}%
209 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
210
211 \newcommand{\makecover}[2]{
212         \pdfpagewidth=#1
213         \pdfpageheight=#2
214
215         \thispagestyle{empty}
216         \newlength{\PictHOffset}
217         \newlength{\PictVOffset}
218         \setlength{\PictHOffset}{1in}
219         \addtolength{\PictHOffset}{\hoffset}
220         \addtolength{\PictHOffset}{\oddsidemargin}
221
222         \setlength{\PictVOffset}{1in}
223         \addtolength{\PictVOffset}{\voffset}
224         \addtolength{\PictVOffset}{\topmargin}
225         \addtolength{\PictVOffset}{\headheight}
226         \addtolength{\PictVOffset}{\headsep}
227         \addtolength{\PictVOffset}{\topskip}
228         \addtolength{\PictVOffset}{-\pdfpageheight}
229
230         \noindent\hspace*{-\PictHOffset}%
231         \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
232             \includegraphics[height=\pdfpageheight,width=\pdfpagewidth]{cover.png}}}
233         \clearpage
234
235  
236 %% Strona tytułowa %% XXX
237        \hspace{-36mm}\parbox{16cm}{
238         {\addfontfeature{LetterSpace=-4.0}{\scalefont{4}%
239             \noindent Philippe Aigrain}}
240
241        {\addfontfeature{LetterSpace=-4.0}{\scalefont{2.5}%
242             przy współpracy Suzanne Aigrain
243         }}
244
245         \vspace{2em}
246         {\addfontfeature{LetterSpace=-4.0}{\scalefont{6}%
247             Dzielenie się
248         }}
249         
250         \vspace{2em}
251         {\addfontfeature{LetterSpace=-4.0}{\scalefont{3}%
252             Kultura i gospodarka epoki internetu
253         }}
254         }
255
256        \setlength{\pdfpagewidth}{210mm}
257        \setlength{\pdfpageheight}{297mm}
258 }
259
260
261 \renewcommand{\maketitle}{
262     {
263     \thispagestyle{empty}
264     \footnotesize
265     \color{theme}
266     \noindent \rule{\linewidth}{0.4pt}
267
268     \vspace{.6em}
269     \color{black}
270     }
271 }
272
273 \usepackage{printlen}
274
275 \newcommand{\editorialsection}{
276 %% XXX % sprawdzic czy czegos nie zgubilem z master
277 %% szczegolnie jesli chodzi o makra wstawiajace dane z DC, jak np \editors
278 %% coś tu nie dizała, do zmiany ogólnie
279
280 %% \clearpage
281 %%         \thispagestyle{empty}
282
283 %% % Pusta strona 
284 %% \clearpage
285 %%         \thispagestyle{empty}
286
287 %% \vspace{2em}
288 %%       \hspace{0mm}\parbox{16cm}{
289 %% \centering
290 %%       {\addfontfeature{LetterSpace=-4.0}{\scalefont{6}%
291 %%            Dzielenie się
292 %%       }}
293
294 %%   \vspace{2em}
295 %%          {\addfontfeature{LetterSpace=-4.0}{\scalefont{3}%
296 %%              Kultura i gospodarka epoki internetu
297 %%          }}
298 %% }
299
300 %% \clearpage
301 %%         \thispagestyle{empty}
302
303 %% \clearpage
304 %%         \thispagestyle{empty}
305
306 %% %\parbox{10cm}{
307 %% %  \centering
308
309 %%   \hspace{-36mm}\parbox{16cm}{
310 %% \centering
311
312 %%   {\addfontfeature{LetterSpace=-4.0}{\scalefont{4}%
313 %%       \noindent Philippe Aigrain
314 %%   }}
315
316 %%   {\addfontfeature{LetterSpace=-4.0}{\scalefont{2.5}%
317 %%       przy współpracy Suzanne Aigrain
318 %%   }}
319   
320 %%   \vspace{2em}
321 %%          {\addfontfeature{LetterSpace=-4.0}{\scalefont{6}%
322 %%              Dzielenie się
323 %%          }}
324          
325 %%   \vspace{2em}
326 %%          {\addfontfeature{LetterSpace=-4.0}{\scalefont{4}%
327 %%              Kultura i gospodarka epoki internetu
328 %%          }}
329
330 %%   \vspace{2em}
331 %%          {\addfontfeature{LetterSpace=-4.0}{\scalefont{2}%
332 %%              Z języka angielskiego przełożył \\
333 %%              \emph{Wojciech Pędzich}
334 %%          }}
335
336 %% \vspace{22em}
337
338 %% \includegraphics[scale=.2]{logo.eps}
339 %% }
340
341 %%     Przekaż darowiznę na konto:
342 %%     \href{http://nowoczesnapolska.org.pl/pomoz-nam/wesprzyj-nas/}{szczegóły na stronie Fundacji}.
343
344 %% \clearpage
345 %%         \thispagestyle{empty}
346
347 %% \noindent Tytuł oryginału
348
349 %% \noindent \emph{Sharing. Culture and the Economy in the Internet Age}
350
351 %% \vspace{1em}
352
353 %% \noindent \editors
354
355 %% \vspace{1em}
356
357
358 %% \noindent \rightsinfo
359
360 %% \vspace{1em}
361
362 %% \noindent \coverby
363
364
365 %% %\set\textwidth=450pt
366 %% %\printlength\textwidth
367
368
369 %% %% {\scalefont{1.5}Drogi czytelniku!}
370
371
372
373 %% %% \vspace{1em}
374
375 %% \vspace{1em}
376
377 %% \noindent Tłumaczenie książki powstało w ramach projektu "Przyszłość prawa autorskiego" finansowanego przez {\it Trust for Civil Society in Central and Eastern Europe}.
378
379 %% \vspace{1em}
380
381 %% \noindent \includegraphics[scale=.4]{cce_trust.eps}
382
383 %% \vspace{1em}
384
385 %% \noindent Wydawca: Fundacja Nowoczesna Polska, Warszawa 2012
386
387 %% \vspace{1em}
388 %% \includegraphics[scale=.2]{logo.eps}
389 %% \vspace{1em}
390
391 %% \noindent \href{http://nowoczesnapolska.org.pl/}{http://nowoczesnapolska.org.pl/}
392
393
394
395 %% %\vspace{4em}
396 %% %\box{\tableofcontents}
397
398 %% %%   \begin{figure}[b!]
399 %% %%   {
400 %% %%     \footnotesize
401 %% %%     \color{theme}
402 %% %%     \noindent \rule{\linewidth}{0.4pt}
403
404 %% %%     \rightsinfo
405 %% %% %    \vspace{.6em}
406
407 %% %%     %Źródło: \href{\bookurl}{\bookurl}
408
409 %% %%     %\vspace{.6em}
410 %% %%     %\sourceinfo
411
412 %% %%     %\description
413 %% %%     %\vspace{.6em}
414
415 %% %%     Opublikowano przez \href{http://nowoczesnapolska.org.pl}{Fundację Nowoczesna Polska}, 2012.
416
417 %% %%     \editors
418
419 %% %%     %\vspace{.6em}
420 %% %%     \coverby
421     
422 %% %%     \color{black}
423 %% %%   }
424 %% %%   \end{figure}
425 %% \clearpage
426 %% }
427 }
428
429
430
431 \newcommand{\tytul}[1]{%
432 #1%
433 \vspace{1em}%
434 }
435
436 \newcommand{\nazwapodutworu}[1]{%
437 \section*{#1}%
438 }
439
440 \newcommand{\autorutworu}[1]{%
441 #1
442 %\subsection*{\typosubsection{#1}}%
443 }
444
445 \newcommand{\dzielonadrzedne}[1]{%
446 \subsection*{#1}%
447 }
448
449 \newcommand{\nazwautworu}[1]{%
450 \section*{#1}%
451 }
452
453 \newcommand{\podtytul}[1]{%
454 \subsection*{\typosubsubsection{#1}}%
455 }
456
457 \newcommand{\podtytulpodutworu}[1]{%
458 \subsection*{\typosubsubsection{#1}}%
459 }
460
461 \newcommand{\translator}[1]{%
462 \subsection*{\typosubsubsection{tłum. #1}}%
463 }
464 \newcommand{\translatorsline}[1]{%
465 #1
466 }
467
468 \newcommand{\powiesc}[1]{#1}
469 \newcommand{\opowiadanie}[1]{#1}
470 \newcommand{\lirykal}[1]{#1}
471 \newcommand{\lirykalp}[1]{#1}
472 \newcommand{\dramatwierszowanyl}[1]{#1}
473 \newcommand{\dramatwierszowanylp}[1]{#1}
474 \newcommand{\dramatwspolczesny}[1]{#1}
475
476 \newcommand{\nota}[1]{%
477 \par{#1}%
478 }
479
480 \newcommand{\dedykacja}[1]{%
481 \begin{em}%
482 \begin{flushright}%
483 #1%
484 \end{flushright}%
485 \end{em}%
486 }
487
488 \newcommand{\dlugicytat}[1]{%
489 \begin{quotation}%
490 #1%
491 \end{quotation}%
492 }
493
494 \newcommand{\poezjacyt}[1]{%
495 \begin{verse}%
496 #1%
497 \end{verse}%
498 }
499 \newcommand{\motto}[1]{%
500 \begin{em}%
501 #1%
502 \end{em}%
503 }
504 \newcommand{\listaosob}[2]{%
505 \par{#1}%
506 \begin{itemize}%
507 #2%
508 \end{itemize}%
509 }
510
511 \newcommand{\nagloweklisty}[1]{%
512 \typosubsubsection{#1}%
513 }
514
515 \newcommand{\listaosoba}[1]{%
516 \item{#1}%
517 }
518
519 \newcommand{\kwestia}[1]{%
520 \par{#1}%
521 }
522
523 \newcommand{\naglowekakt}[1]{%
524 \pagebreak
525 \subsection*{\typosubsection{#1}}%
526 }
527 \newcommand{\naglowekczesc}[1]{%
528 \pagebreak
529 \part{#1}%
530 }
531 \newcommand{\srodtytul}[1]{%
532 \subsection*{\typosubsection{#1}}%
533 }
534
535 \newcommand{\naglowekscena}[1]{%
536 \subsubsection*{\typosubsubsection{#1}}%
537 }
538 \newcommand{\naglowekrozdzial}[1]{%
539 \chapter{#1}%
540 }
541
542 \newcommand{\naglowekosoba}[1]{%
543 \par{\textsc{#1}}\nopagebreak%
544 }
545 \newcommand{\naglowekpodrozdzial}[1]{%
546 \section{#1}\nopagebreak%
547 }
548
549 \newcommand{\miejsceczas}[1]{%
550 \par{\emph{#1}}%
551 }
552 \newcommand{\didaskalia}[1]{%
553 \par{\emph{#1}}%
554 }
555
556 \newcommand{\akap}[1]{%
557 \par{#1}%
558 }
559 \newcommand{\akapdialog}[1]{%
560 \par{#1}%
561 }
562 \newcommand{\akapcd}[1]{%
563 \par{#1}%
564 }
565
566 \newcommand{\mottopodpis}[1]{%
567 \begin{em}%
568 \begin{flushright}%
569 #1%
570 \end{flushright}%
571 \end{em}%
572 }
573
574 \newcommand{\strofa}[1]{%
575 \par{\noindent{\ignorespaces#1\vspace{1em}}}%
576 }
577
578 \newcommand{\wers}[1]{#1}
579
580 \newcommand{\wersakap}[1]{%
581 \hspace*{1em}#1%
582 }
583 \newcommand{\werscd}[1]{%
584 \hspace*{8em}#1%
585 }
586 \newcommand{\werswciety}[2][1em]{%
587 \hspace*{#1}#2%
588 }
589
590 \ifshowfootnotes
591   \newcommand{\pa}[1]{\NoCaseChange{\footnote{#1 [przypis autorski]}}}
592   \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
593   \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
594   \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
595 \else
596   \newcommand{\pa}[1]{}
597   \newcommand{\pe}[1]{}
598   \newcommand{\pr}[1]{}
599   \newcommand{\pt}[1]{}
600 \fi
601
602 \newcommand{\mat}[1]{$#1$}
603
604 \newcommand{\didasktekst}[1]{%
605 \emph{#1}%
606 }
607 \newcommand{\slowoobce}[1]{%
608 \emph{#1}%
609 }
610 \newcommand{\tytuldziela}[1]{%
611 \emph{#1}%
612 }
613 \newcommand{\wyroznienie}[1]{%
614 \emph{#1}%
615 }
616
617 \newcommand{\osoba}[1]{%
618 #1%
619 }
620
621 \newcommand{\sekcjaswiatlo}{%
622 \vspace{30pt}%
623 }
624
625 \newcommand{\sekcjaasterysk}{%
626 \vspace{10pt}%
627 \begin{center}%
628 \par{*}%
629 \end{center}%
630 }
631
632 \newcommand{\separatorlinia}{%
633 \vspace{10pt}%
634 \hrule{}%
635 \vspace{10pt}%
636 }
637
638 \newcommand{\motyw}[2][0]{%
639 \ifshowthemes
640 \mbox{}%
641 \marginpar{%
642 \vspace{-8pt}%
643 \vspace{-#1\baselineskip}%
644 \raggedright{\hspace{0pt}%
645 \footnotesize{\color{theme}{#2}}}%
646 \vspace{\baselineskip}%
647 }%
648 \fi
649 }
650
651 \newcommand{\spistresci}{
652   \tableofcontents
653   \newpage
654 }
655
656 \newcommand{\link}[2]{\href{#1}{\uline{#2}\footnote{#1}}}
657
658 \newcommand{\www}[1]{{\normalfont\href{#1}{#1}}}