nicer tables
[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 \RequirePackage{amssymb}
18 \RequirePackage{amsmath}
19 \DeclareOption{13pt}{%
20 \AtEndOfClass{%
21 % font size definitions, similar to ones in /usr/share/texmf-texlive/tex/latex/base/
22 \renewcommand\normalsize{%
23    \@setfontsize\normalsize{13pt}{14.5pt}%
24    \abovedisplayskip 12\p@ \@plus3\p@ \@minus7\p@
25    \abovedisplayshortskip \z@ \@plus3\p@
26    \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@
27    \belowdisplayskip \abovedisplayskip
28    \let\@listi\@listI}\normalsize%
29 \renewcommand\footnotesize{%
30    \@setfontsize\footnotesize\@xpt\@xiipt
31    \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@
32    \abovedisplayshortskip \z@ \@plus3\p@
33    \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@
34    \def\@listi{\leftmargin\leftmargini
35                \topsep 6\p@ \@plus2\p@ \@minus2\p@
36                \parsep 3\p@ \@plus2\p@ \@minus\p@
37                \itemsep \parsep}%
38    \belowdisplayskip \abovedisplayskip
39 }%
40 }%
41 }
42
43 %% \DeclareOption{14pt}{\renewcommand{\normalsize}{\AtEndOfClass{\fontsize{14}{17}\selectfont}}}
44
45 \DeclareOption{defaultleading}{}
46 \DeclareOption{doubleleading}{\AtBeginDocument{\doublespacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
47 \DeclareOption{onehalfleading}{\AtBeginDocument{\onehalfspacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
48
49 %% 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.
50 \DeclareOption{a5paper}{%
51       \setlength{\paperheight}{210mm}%
52       \setlength{\paperwidth}{148mm}}
53
54
55 \newif\ifshowfootnotes \showfootnotestrue
56 \DeclareOption{nofootnotes}{\showfootnotesfalse}
57
58 \newif\ifshowthemes \showthemestrue
59 \DeclareOption{nothemes}{\showthemesfalse}
60
61 \newif\ifenablewlfont \enablewlfonttrue
62 \DeclareOption{nowlfont}{\enablewlfontfalse}
63
64 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
65 \ProcessOptions\relax
66 \LoadClass[a4paper]{book}
67
68
69 \usepackage{trace}
70 \usepackage{caption}
71 \usepackage{tabularx}
72 \usepackage[MeX]{polski}
73 \usepackage{icomma}
74 \usepackage[xetex]{graphicx}
75 \usepackage{fontspec}
76 \usepackage{xunicode}
77 \usepackage{xltxtra}
78
79
80 \usepackage[overload]{textcase}
81 \usepackage{scalefnt}
82 \usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=black,xetex]{hyperref}
83
84 \ifenablewlfont
85 \setmainfont [
86 %ExternalLocation,
87 UprightFont = JunicodeWL-Regular,
88 ItalicFont = JunicodeWL-Italic,
89 BoldFont = JunicodeWL-Regular,
90 BoldItalicFont = JunicodeWL-Italic,
91 SmallCapsFont = JunicodeWL-Regular,
92 SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
93 Numbers=OldStyle,
94 Scale=1.04,
95 LetterSpace=-1.0
96 ] {JunicodeWL}
97
98 \newfontfamily\alien[
99 SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
100 Numbers=OldStyle,
101 Scale=0.85,
102 LetterSpace=-1.0
103 ] {DejaVu Serif}
104
105
106 \defaultfontfeatures{
107 SizeFeatures={
108   {Size={-10.5}, FakeStretch=1.02, LetterSpace=2.0 },
109   {Size={10.5-12}, FakeStretch=2.00, LetterSpace=0.0 },
110   {Size={12-}, FakeStretch=0.98, LetterSpace=-2.0 }
111 }
112 }
113
114 \renewcommand{\textsc}[1]{%
115 {\addfontfeature{
116 SizeFeatures={
117   {Size={-10.5}, Scale=1.2, FakeStretch=1.02, LetterSpace=8.0 },
118   {Size={10.5-12}, Scale=1.2, FakeStretch=1.02, LetterSpace=8.0 },
119   {Size={12-}, FakeStretch=1.0, LetterSpace=8.0 }
120 },
121 Letters={SmallCaps,UppercaseSmallCaps}
122 }
123 #1}
124 }
125 \fi% enablewlfont
126
127 %{\Itshape JunicodeWL-Italic.ttf }
128 %{\bfseries Junicode-Bold.ttf }
129 %{\bfseries\itshape Junicode-BoldItalic.ttf }
130
131 \pagestyle{plain}
132 \usepackage{fancyhdr}
133
134 \makeatletter
135
136 % bottom figure below footnotes
137 \usepackage{fnpos}
138 \makeFNabove
139
140 \usepackage{color}
141 \definecolor{theme}{gray}{.3}
142
143 \setlength{\marginparsep}{2em}
144 \setlength{\marginparwidth}{8.5em}
145 \setlength{\oddsidemargin}{36mm}
146 \setlength{\evensidemargin}{0pt}
147 \setlength{\voffset}{0pt}
148 \setlength{\topmargin}{0pt}
149 \setlength{\headheight}{0pt}
150 \setlength{\headsep}{0pt}
151 \setlength{\textheight}{24cm}
152
153 \pagestyle{fancy}
154 \fancyhf{}
155 \renewcommand{\headrulewidth}{0pt}
156 \renewcommand{\footrulewidth}{0pt}
157 <<<<<<< HEAD
158 %\lfoot{{\footnotesize \textsc{\@author} \emph{\@title}}}
159 \cfoot{}
160 %\rfoot{{\footnotesize \thepage}}
161 \fancyfoot[LO,RE]{{\footnotesize \textsc{\@author} \emph{\@title}}}
162 \fancyfoot[LE,RO]{{\footnotesize \thepage}}
163 =======
164 %\lfoot{{\footnotesize \textsc{\@author} \emph{\@title}}} %1
165 \cfoot{}
166 %\rfoot{{\footnotesize \thepage}}  %1
167 \fancyfoot[LO,RE]{{\footnotesize \textsc{\@author} \emph{\@title}}}
168 \fancyfoot[LE,RO]{{\footnotesize \thepage}}
169
170 >>>>>>> 4531d8a... nicer tables
171
172 \clubpenalty=100000
173 \widowpenalty=100000
174
175
176 % see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
177 \newsavebox{\ximagebox}\newlength{\ximageheight}
178 \newsavebox{\xglyphbox}\newlength{\xglyphheight}
179 \newcommand{\xbox}[1]
180 {\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximagebox}}%
181 \savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
182 \raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
183 \makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
184 \usebox{\ximagebox}%
185 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
186
187 \newcommand{\makecover}[2]{
188 <<<<<<< HEAD
189
190         %\pdfpagewidth=#1
191         %\pdfpageheight=#2
192 =======
193 %        \pdfpagewidth=#1
194 %        \pdfpageheight=#2
195 >>>>>>> 4531d8a... nicer tables
196
197         \thispagestyle{empty}
198         \newlength{\PictHOffset}
199         \newlength{\PictVOffset}
200         \setlength{\PictHOffset}{1in}
201         \addtolength{\PictHOffset}{\hoffset}
202         \addtolength{\PictHOffset}{\oddsidemargin}
203
204         \setlength{\PictVOffset}{1in}
205         \addtolength{\PictVOffset}{\voffset}
206         \addtolength{\PictVOffset}{\topmargin}
207         \addtolength{\PictVOffset}{\headheight}
208         \addtolength{\PictVOffset}{\headsep}
209         \addtolength{\PictVOffset}{\topskip}
210 <<<<<<< HEAD
211         \addtolength{\PictVOffset}{-#2}
212
213         \noindent\hspace*{-\PictHOffset}%
214         \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
215             \includegraphics[height=#2,width=#1]{cover.jpg}}}
216         %\clearpage
217 =======
218         \addtolength{\PictVOffset}{-#2} %1 \pdfpageheight}
219
220         \noindent\hspace*{-\PictHOffset}%
221         \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
222             \includegraphics[height=#2,width=#1]{cover.png}}}
223 %        \clearpage
224 >>>>>>> 4531d8a... nicer tables
225         \vspace{#2}
226
227         \hspace{-36mm}\parbox{16cm}{
228         {\addfontfeature{LetterSpace=-4.0}\emph{\scalefont{4}%
229             \noindent Future of Copyright Anthology
230         }}
231
232         \vspace{2em}
233         {\addfontfeature{LetterSpace=-4.0}{\scalefont{1.5}%
234             A collection of texts from a crowd-funded contest.
235         }}
236
237 <<<<<<< HEAD
238
239         \vspace{8em}
240
241 \emph{\thankyou}\\
242 \indent\emph{You made this book possible.}
243         }
244
245
246         %\setlength{\pdfpagewidth}{210mm}
247         %\setlength{\pdfpageheight}{297mm}
248 =======
249
250         \vspace{8em}
251
252 \emph{\thankyou}\\
253 \indent\emph{You made this book possible.}
254         }
255
256
257 %        \setlength{\pdfpagewidth}{210mm}
258 %        \setlength{\pdfpageheight}{297mm}
259 >>>>>>> 4531d8a... nicer tables
260 }
261
262
263 \renewcommand{\maketitle}{
264     {
265     \thispagestyle{empty}
266     \footnotesize
267     \color{theme}
268
269     \noindent \begin{minipage}[t]{.35\textwidth}\vspace{0pt}
270         \href{http://www.wolnelektury.pl}{\xbox{\includegraphics[width=\textwidth]{wl-logo.png}}}
271     \end{minipage}
272     \begin{minipage}[t]{.65\textwidth}\vspace{0pt}
273
274     \ifflaglessadvertising
275     \else
276         \href{\bookurl}{Ta lektura}, podobnie jak tysiące innych, jest dostępna on-line na stronie
277         \href{http://www.wolnelektury.pl/}{wolnelektury.pl}.
278         \vspace{.5em}
279     \fi
280
281     Utwór opracowany został w ramach projektu \href{http://www.wolnelektury.pl/}{Wolne Lektury}
282     przez \href{http://nowoczesnapolska.org.pl}{fundację Nowoczesna Polska}.
283
284     \end{minipage}
285     \noindent \rule{\linewidth}{0.4pt}
286
287     \vspace{.6em}
288     \color{black}
289     }
290 }
291
292 <<<<<<< HEAD
293 =======
294
295
296
297
298 >>>>>>> 4531d8a... nicer tables
299 \usepackage{printlen}
300
301 \newcommand{\editorialsection}{
302 \clearpage
303
304 %\set\textwidth=450pt
305 %\printlength\textwidth
306
307
308 {\scalefont{1.5}Dear readers!}
309
310
311
312 \vspace{1em}
313 It is our great pleasure to present you the “Future of Copyright 
314 Anthology”, a collection of 10 best short stories sent in for the “Future 
315 of Copyright” contest organized by Modern Poland Foundation. These works 
316 have been selected by our jury – Prof. Michael Geist, Piotr Czerski and 
317 Jarosław Lipszyc.
318
319 The main prize in this contest was founded by you, the readers, on the 
320 Indiegogo crowdfunding platform. We are proud to announce that this 
321 prize goes to Aymeric Mansoux, author of “Morphology of a copyright 
322 tale”, in appreciation of the originality, power and the strong message 
323 of this work. Moreover, the jury decided to grant an honorable mention 
324 to Togi, author of the work “Give”.
325
326 We would like to thank you for your crowdfunding support and a high
327 standard of the submitted works. We were pleasantly surprised by the
328 interest shown in the competition, and we have decided to hold
329 its second edition next 
330 year. We hope that with your help it will be even more successful and 
331 the collected works will provide a strong voice in the debate on the future 
332 of copyright law and system.
333
334 \vspace{1em}
335 Modern Poland Foundation Team
336
337 \vspace{4em}
338 \includegraphics[scale=.2]{logo.eps}
339 \vspace{1em}
340
341 \href{http://nowoczesnapolska.org.pl/}{http://nowoczesnapolska.org.pl/}
342
343 <<<<<<< HEAD
344 %\vspace{4em}
345 %\box{\tableofcontents}
346
347 =======
348 >>>>>>> 4531d8a... nicer tables
349   \begin{figure}[b!]
350   {
351     \footnotesize
352     \color{theme}
353     \noindent \rule{\linewidth}{0.4pt}
354
355     \rightsinfo
356     \vspace{.6em}
357
358     %Źródło: \href{\bookurl}{\bookurl}
359
360     %\vspace{.6em}
361     %\sourceinfo
362
363     %\description
364     %\vspace{.6em}
365
366     Published by \href{http://nowoczesnapolska.org.pl}{Modern Poland Foundation}, 2012.
367
368     \editors
369
370     %\vspace{.6em}
371     \coverby
372
373     \color{black}
374   }
375   \end{figure}
376 }
377
378
379 \newcommand{\typosubsubsection}[1]{%
380 {\textsc{#1}}
381 }
382
383 \newcommand{\typosubsection}[1]{%
384 {\addfontfeature{
385 SizeFeatures={
386   {Size={-10}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
387   {Size={10.5-12}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
388   {Size={12-}, FakeStretch=1.0, LetterSpace=8.0 }
389 },
390 Letters={Uppercase}
391 }
392 \MakeUppercase{#1}}
393 }
394
395 \newcommand{\typosection}[1]{%
396 {\addfontfeature{FakeStretch=0.96, LetterSpace=-4.0}\emph{\scalefont{2}#1}}
397 %{\addfontfeature{Scale=2.0, FakeStretch=0.98, LetterSpace=-2.0}\emph{#1}}
398 }
399
400 \newcommand{\tytul}[1]{%
401 #1%
402 %\vspace{1em}%
403 }
404
405 \newcommand{\autorpodutworu}[1]{%
406 \section*{\typosection{#1}}%
407 }
408
409 \newcommand{\nazwapodutworu}[1]{%
410 \section*{\typosection{#1}}%
411 }
412
413 \newcommand{\autorutworu}[1]{%
414 \addcontentsline{toc}{part}{???}
415 \subsection*{\typosubsection{#1}}%
416 }
417
418 \newcommand{\dzielonadrzedne}[1]{%
419 \subsection*{\typosubsubsection{#1}}%
420 }
421
422 \newcommand{\nazwautworu}[1]{%
423 \section*{\typosection{#1}}%
424 }
425
426 \newcommand{\podtytul}[1]{%
427 \subsection*{\typosubsubsection{#1}}%
428 }
429
430 \newcommand{\podtytulpodutworu}[1]{%
431 \subsection*{\typosubsubsection{#1}}%
432 }
433
434 \newcommand{\translator}[1]{%
435 \subsection*{\typosubsubsection{tłum. #1}}%
436 }
437
438 \newcommand{\powiesc}[1]{#1}
439 \newcommand{\opowiadanie}[1]{#1}
440 \newcommand{\lirykal}[1]{#1}
441 \newcommand{\lirykalp}[1]{#1}
442 \newcommand{\dramatwierszowanyl}[1]{#1}
443 \newcommand{\dramatwierszowanylp}[1]{#1}
444 \newcommand{\dramatwspolczesny}[1]{#1}
445
446 \newcommand{\nota}[1]{%
447 \begin{quotation}%
448 #1%
449 \end{quotation}%
450 }
451
452 \newcommand{\dedykacja}[1]{%
453 \begin{em}%
454 \begin{flushright}%
455 #1%
456 \end{flushright}%
457 \end{em}%
458 }
459
460 \newcommand{\dlugicytat}[1]{%
461 \begin{quotation}%
462 #1%
463 \end{quotation}%
464 }
465
466 \newcommand{\poezjacyt}[1]{%
467 \begin{verse}%
468 #1%
469 \end{verse}%
470 }
471 \newcommand{\motto}[1]{%
472 \begin{em}%
473 #1%
474 \end{em}%
475 }
476 \newcommand{\listaosob}[2]{%
477 \par{#1}%
478 \begin{itemize}%
479 #2%
480 \end{itemize}%
481 }
482
483 \newcommand{\nagloweklisty}[1]{%
484 \typosubsubsection{#1}%
485 }
486
487 \newcommand{\listaosoba}[1]{%
488 \item{#1}%
489 }
490
491 \newcommand{\kwestia}[1]{%
492 \par{#1}%
493 }
494
495 \newcommand{\naglowekakt}[1]{%
496 \pagebreak
497 \subsection*{\typosubsection{#1}}%
498 }
499 \newcommand{\naglowekczesc}[1]{%
500 %\pagebreak
501 \subsection*{\typosubsection{#1}}%
502 }
503 \newcommand{\srodtytul}[1]{%
504 \subsection*{\typosubsection{#1}}%
505 }
506
507 \newcommand{\naglowekscena}[1]{%
508 \subsubsection*{\typosubsubsection{#1}}%
509 }
510 \newcommand{\naglowekrozdzial}[1]{%
511 \subsubsection*{\typosubsubsection{#1}}%
512 }
513
514 \newcommand{\naglowekosoba}[1]{%
515 \par{\textsc{#1}}\nopagebreak%
516 }
517 \newcommand{\naglowekpodrozdzial}[1]{%
518 \par{#1}\nopagebreak%
519 }
520
521 \newcommand{\miejsceczas}[1]{%
522 \par{\emph{#1}}%
523 }
524 \newcommand{\didaskalia}[1]{%
525 \par{\emph{#1}}%
526 }
527
528 \newcommand{\akap}[1]{%
529 \par{#1}%
530 }
531 \newcommand{\akapdialog}[1]{%
532 \par{#1}%
533 }
534 \newcommand{\akapcd}[1]{%
535 \par{#1}%
536 }
537
538 \newcommand{\mottopodpis}[1]{%
539 \begin{em}%
540 \begin{flushright}%
541 #1%
542 \end{flushright}%
543 \end{em}%
544 }
545
546 \newcommand{\strofa}[1]{%
547 \par{\noindent{\ignorespaces#1\vspace{1em}}}%
548 }
549
550 \newcommand{\wers}[1]{#1}
551
552 \newcommand{\wersakap}[1]{%
553 \hspace*{1em}#1%
554 }
555 \newcommand{\werscd}[1]{%
556 \hspace*{8em}#1%
557 }
558 \newcommand{\werswciety}[2][1em]{%
559 \hspace*{#1}#2%
560 }
561
562 \ifshowfootnotes
563   \newcommand{\pa}[1]{\NoCaseChange{\footnote{#1 [przypis autorski]}}}
564   \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
565   \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
566   \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
567 \else
568   \newcommand{\pa}[1]{}
569   \newcommand{\pe}[1]{}
570   \newcommand{\pr}[1]{}
571   \newcommand{\pt}[1]{}
572 \fi
573
574 \newcommand{\mat}[1]{$#1$}
575
576 \newcommand{\didasktekst}[1]{%
577 \emph{#1}%
578 }
579 \newcommand{\slowoobce}[1]{%
580 \emph{#1}%
581 }
582 \newcommand{\tytuldziela}[1]{%
583 \emph{#1}%
584 }
585 \newcommand{\wyroznienie}[1]{%
586 \emph{#1}%
587 }
588
589 \newcommand{\osoba}[1]{%
590 #1%
591 }
592
593 \newcommand{\sekcjaswiatlo}{%
594 \vspace{30pt}%
595 }
596
597 \newcommand{\sekcjaasterysk}{%
598 \vspace{10pt}%
599 \begin{center}%
600 \par{*}%
601 \end{center}%
602 \noindent%
603 }
604
605 \newcommand{\separatorlinia}{%
606 \vspace{10pt}%
607 \hrule{}%
608 \vspace{10pt}%
609 }
610
611 \newcommand{\motyw}[2][0]{%
612 \ifshowthemes
613 \mbox{}%
614 \marginpar{%
615 \vspace{-8pt}%
616 \vspace{-#1\baselineskip}%
617 \raggedright{\hspace{0pt}%
618 \footnotesize{\color{theme}{#2}}}%
619 \vspace{\baselineskip}%
620 }%
621 \fi
622 }
623
624 \newcommand{\ilustr}[2]{
625
626 \vspace{1em}%
627 \begin{center}%
628 \par{\includegraphics[width=\textwidth]{#1}\\#2}%
629 \end{center}%
630 \vspace{1em}%
631 }