local changes from server
[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{\dlugicytat}[1]{%
354 \begin{quotation}%
355 %\raggedright%
356 #1%
357 \end{quotation}%
358 }
359
360 \newcommand{\poezjacyt}[1]{%
361 \begin{verse}%
362 #1%
363 \end{verse}%
364 }
365 \newcommand{\motto}[1]{%
366 \begin{em}%
367 #1%
368 \end{em}%
369 }
370 \newcommand{\listaosob}[2]{%
371 \par{#1}%
372 \begin{itemize}%
373 #2%
374 \end{itemize}
375
376 }
377
378 \newcommand{\nagloweklisty}[1]{%
379 \typosubsubsection{#1}%
380 }
381
382 \newcommand{\listaosoba}[1]{%
383 \item{#1}%
384 }
385
386 \newcommand{\kwestia}[1]{%
387 \par{#1}%
388 }
389
390 \newcommand{\naglowekakt}[1]{%
391 \newpage
392 \subsection*{\typosubsection{#1}}%
393 }
394 \newcommand{\naglowekczesc}[1]{%
395 \newpage
396 \subsection*{\typosubsection{#1}}%
397 }
398 \newcommand{\srodtytul}[1]{%
399 \par{\typosubsubsection{#1}}%
400 %\subsection*{\typosubsection{#1}}%
401 }
402
403 \newcommand{\naglowekscena}[1]{%
404 \subsubsection*{\typosubsubsection{#1}}%
405 }
406 \newcommand{\naglowekrozdzial}[1]{%
407 \subsection*{\raggedright \typosubsection{#1}}%
408 %\subsubsection*{\typosubsubsection{#1}}%
409 }
410
411 \newcommand{\naglowekosoba}[1]{%
412 \par{\textsc{#1}}\nopagebreak%
413 }
414 \newcommand{\naglowekpodrozdzial}[1]{%
415 \subsubsection*{\typosubsubsection{#1}}%
416 %\par{#1}\nopagebreak%
417 }
418
419 \newcommand{\miejsceczas}[1]{%
420 \par{\emph{#1}}%
421 }
422 \newcommand{\didaskalia}[1]{%
423 \par{\emph{#1}}%
424 }
425
426 \newcommand{\akap}[1]{%
427 \par{#1}%
428 }
429 \newcommand{\akapdialog}[1]{%
430 \par{#1}%
431 }
432 \newcommand{\akapcd}[1]{%
433 \par{#1}%
434 }
435
436 \newcommand{\mottopodpis}[1]{%
437 \begin{em}%
438 \begin{flushright}%
439 #1%
440 \end{flushright}%
441 \end{em}%
442 }
443
444 \newcommand{\strofa}[1]{%
445 \par{\noindent{\ignorespaces#1\vspace{1em}}}%
446 }
447
448 \newcommand{\wers}[1]{#1}
449
450 \newcommand{\wersakap}[1]{%
451 \hspace*{1em}#1%
452 }
453 \newcommand{\werscd}[1]{%
454 \hspace*{8em}#1%
455 }
456 \newcommand{\werswciety}[2][1em]{%
457 \hspace*{#1}#2%
458 }
459
460 \ifshowfootnotes
461   %\newcommand{\pa}[1]{\NoCaseChange{\footnote{#1 [przypis autorski]}}}
462   \newcommand{\pa}[1]{\NoCaseChange{\footnote{#1}}}
463   \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
464   \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
465   \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
466 \else
467   \newcommand{\pa}[1]{}
468   \newcommand{\pe}[1]{}
469   \newcommand{\pr}[1]{}
470   \newcommand{\pt}[1]{}
471 \fi
472
473 \newcommand{\mat}[1]{$#1$}
474
475 \newcommand{\didasktekst}[1]{%
476 \emph{#1}%
477 }
478 \newcommand{\slowoobce}[1]{%
479 \emph{#1}%
480 }
481 \newcommand{\tytuldziela}[1]{%
482 \emph{#1}%
483 }
484 \newcommand{\wyroznienie}[1]{%
485 \emph{#1}%
486 }
487
488 \newcommand{\osoba}[1]{%
489 #1%
490 }
491
492 \newcommand{\sekcjaswiatlo}{%
493 \vspace{30pt}%
494 }
495
496 \newcommand{\sekcjaasterysk}{%
497 \vspace{10pt}%
498 \begin{center}%
499 \par{*}%
500 \end{center}%
501 }
502
503 \newcommand{\separatorlinia}{%
504 \vspace{10pt}%
505 \hrule{}%
506 \vspace{10pt}%
507 }
508
509 \newcommand{\motyw}[2][0]{%
510 \ifshowthemes
511 \mbox{}%
512 \marginpar{%
513 \vspace{-8pt}%
514 \vspace{-#1\baselineskip}%
515 \raggedright{\hspace{0pt}%
516 \footnotesize{\color{theme}{#2}}}%
517 \vspace{\baselineskip}%
518 }%
519 \fi
520 }
521
522
523 \newcommand{\www}[1]{%
524 %\href{#1}{#1}%
525 \url{#1}%
526 }
527 \newcommand{\listanum}[1]{%
528 \begin{enumerate}%
529 #1%
530 \end{enumerate}%
531 }
532 \newcommand{\listapunkt}[1]{%
533 \begin{itemize}%
534 #1%
535 \end{itemize}%
536 }
537 \newcommand{\punkt}[1]{%
538 \item #1%
539 }
540 \newcommand{\ilustr}[2]{%
541 \vspace{1em}%
542 \par{\noindent\includegraphics[width=\linewidth]{#1}}%
543 \vspace{1em}
544 }