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