document validation (stub)
[librarian.git] / librarian / formats / pdf / res / 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{wasysym}
18 \DeclareOption{13pt}{%
19 \AtEndOfClass{%
20 % font size definitions, similar to ones in /usr/share/texmf-texlive/tex/latex/base/
21 \renewcommand\normalsize{%
22    \@setfontsize\normalsize{13pt}{14.5pt}%
23    \abovedisplayskip 12\p@ \@plus3\p@ \@minus7\p@
24    \abovedisplayshortskip \z@ \@plus3\p@
25    \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@
26    \belowdisplayskip \abovedisplayskip
27    \let\@listi\@listI}\normalsize%
28 \renewcommand\footnotesize{%
29    \@setfontsize\footnotesize\@xpt\@xiipt
30    \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@
31    \abovedisplayshortskip \z@ \@plus3\p@
32    \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@
33    \def\@listi{\leftmargin\leftmargini
34                \topsep 6\p@ \@plus2\p@ \@minus2\p@
35                \parsep 3\p@ \@plus2\p@ \@minus\p@
36                \itemsep \parsep}%
37    \belowdisplayskip \abovedisplayskip
38 }%
39 }%
40 }
41
42 %% \DeclareOption{14pt}{\renewcommand{\normalsize}{\AtEndOfClass{\fontsize{14}{17}\selectfont}}}
43
44 \DeclareOption{defaultleading}{}
45 \DeclareOption{doubleleading}{\AtBeginDocument{\doublespacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
46 \DeclareOption{onehalfleading}{\AtBeginDocument{\onehalfspacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
47
48 %% 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.
49 \DeclareOption{a5paper}{%
50       \setlength{\paperheight}{210mm}%
51       \setlength{\paperwidth}{148mm}}
52
53
54 \newif\ifshowfootnotes \showfootnotestrue
55 \DeclareOption{nofootnotes}{\showfootnotesfalse}
56
57 \newif\ifshowthemes \showthemestrue
58 \DeclareOption{nothemes}{\showthemesfalse}
59
60 \newif\ifenablewlfont \enablewlfonttrue
61 \DeclareOption{nowlfont}{\enablewlfontfalse}
62
63 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
64 \ProcessOptions\relax
65 \LoadClass[a4paper,oneside]{book}
66
67
68 \usepackage{trace}
69
70 \usepackage[xetex]{graphicx}
71 \usepackage{fontspec}
72 \usepackage{xunicode}
73 \usepackage{xltxtra}
74
75 \usepackage[overload]{textcase}
76 \usepackage{scalefnt}
77 % TODO: link color is a style thing
78 \usepackage[hyphens]{url}
79 \usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=blue,xetex]{hyperref}
80
81 \ifenablewlfont
82 \setmainfont [
83 %ExternalLocation,
84 %UprightFont = Dosis-Regular,
85 UprightFont = JunicodeWL-Regular,
86 %ItalicFont = Dosis-SemiBold,
87 %BoldFont = Dosis-Bold,
88 %BoldItalicFont = Dosis-Bold,
89 %SmallCapsFont = Dosis-Regular,
90 ItalicFont = JunicodeWL-Italic,
91 BoldFont = Junicode-Bold,
92 %BoldFont = Junicode-Italic,
93 BoldItalicFont = Junicode-BoldItalic,
94 SmallCapsFont = JunicodeWL-Regular,
95 SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
96 Numbers=OldStyle,
97 Scale=1.04,
98 LetterSpace=-1.0
99 ] {Junicode}
100
101 %\newfontfamily\alien[
102 %\setmainfont[
103 %SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
104 %Numbers=OldStyle,
105 %Scale=0.85,
106 %LetterSpace=-1.0
107 %] {FreeSans}
108 %\setmainfont{FreeSans}
109
110
111 \defaultfontfeatures{
112 SizeFeatures={
113   {Size={-10.5}, FakeStretch=1.02, LetterSpace=2.0 },
114   {Size={10.5-12}, FakeStretch=2.00, LetterSpace=0.0 },
115   {Size={12-}, FakeStretch=0.98, LetterSpace=-2.0 }
116 }
117 }
118
119 \renewcommand{\textsc}[1]{%
120 {\addfontfeature{
121 SizeFeatures={
122   {Size={-10.5}, Scale=1.2, FakeStretch=1.02, LetterSpace=8.0 },
123   {Size={10.5-12}, Scale=1.2, FakeStretch=1.02, LetterSpace=8.0 },
124   {Size={12-}, FakeStretch=1.0, LetterSpace=8.0 }
125 },
126 Letters={SmallCaps,UppercaseSmallCaps}
127 }
128 #1}
129 }
130 \fi% enablewlfont
131
132 %{\Itshape JunicodeWL-Italic.ttf }
133 %{\bfseries Junicode-Bold.ttf }
134 %{\bfseries\itshape Junicode-BoldItalic.ttf }
135
136 \pagestyle{plain}
137 \usepackage{fancyhdr}
138
139 \makeatletter
140
141 % bottom figure below footnotes
142 \usepackage{fnpos}
143 \makeFNabove
144
145 \usepackage{color}
146 \definecolor{theme}{gray}{.3}
147
148
149 \setlength{\marginparsep}{2em}
150 %\setlength{\marginparwidth}{8.5em}
151 \setlength{\marginparwidth}{2.5cm}
152 \setlength{\oddsidemargin}{0pt}
153 \setlength{\voffset}{0pt}
154 \setlength{\topmargin}{0pt}
155 \setlength{\headheight}{0pt}
156 \setlength{\headsep}{0pt}
157 \setlength{\textheight}{24cm}
158 \setlength{\textwidth}{16cm}
159
160
161 \pagestyle{fancy}
162 \fancyhf{}
163 \renewcommand{\headrulewidth}{0pt}
164 \renewcommand{\footrulewidth}{0pt}
165 \lfoot{{\footnotesize \@author{} \emph{\@title}}}
166 \cfoot{}
167 \rfoot{{\footnotesize \thepage}}
168
169 \clubpenalty=100000
170 \widowpenalty=100000
171
172
173 % see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
174 \newsavebox{\ximagebox}\newlength{\ximageheight}
175 \newsavebox{\xglyphbox}\newlength{\xglyphheight}
176 \newcommand{\xbox}[1]
177 {\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximagebox}}%
178 \savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
179 \raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
180 \makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
181 \usebox{\ximagebox}%
182 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
183
184
185
186 \newcommand{\typosubsubsection}[1]{%
187 {#1}
188 }
189
190 \newcommand{\typosubsection}[1]{%
191 {\addfontfeature{
192 SizeFeatures={
193   {Size={-10}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
194   {Size={10.5-12}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
195   {Size={12-}, FakeStretch=1.0, LetterSpace=8.0 }
196 },
197 Letters={Uppercase}
198 }
199 \MakeUppercase{#1}}
200 }
201
202 \newcommand{\typosection}[1]{%
203 {\addfontfeature{FakeStretch=0.96, LetterSpace=-4.0}\emph{\scalefont{2}#1}}
204 %{\addfontfeature{Scale=2.0, FakeStretch=0.98, LetterSpace=-2.0}\emph{#1}}
205 }
206
207
208 \newcommand{\tytul}[1]{%
209 #1%
210 \vspace{1em}%
211 }
212
213 \newcommand{\nazwapodutworu}[1]{%
214 \section*{\typosection{#1}}%
215 }
216
217 \newcommand{\autorutworu}[1]{%
218 \subsection*{\typosubsection{#1}}%
219 }
220
221 \newcommand{\dzielonadrzedne}[1]{%
222 \subsection*{\typosubsubsection{#1}}%
223 }
224
225 \newcommand{\nazwautworu}[1]{%
226 \section*{\raggedright{\typosection{#1}}}%
227 }
228
229 \newcommand{\podtytul}[1]{%
230 \subsection*{\typosubsubsection{#1}}%
231 }
232
233 \newcommand{\translator}[1]{%
234 % TODO: l10n is a style thing
235 \subsection*{\typosubsubsection{tłum. #1}}%
236 }
237
238
239 \newcommand{\powiesc}[1]{#1}
240 \newcommand{\opowiadanie}[1]{#1}
241 \newcommand{\lirykal}[1]{#1}
242 \newcommand{\lirykalp}[1]{#1}
243 \newcommand{\dramatwierszowanyl}[1]{#1}
244 \newcommand{\dramatwierszowanylp}[1]{#1}
245 \newcommand{\dramatwspolczesny}[1]{#1}
246
247 \newcommand{\nota}[1]{%
248 \par{#1}%
249 }
250
251 \newcommand{\dedykacja}[1]{%
252 \begin{em}%
253 \begin{flushright}%
254 #1%
255 \end{flushright}%
256 \end{em}%
257 }
258
259 \newcommand{\dlugicytat}[1]{%
260 \begin{quotation}%
261 #1%
262 \end{quotation}%
263 }
264
265 \newcommand{\poezjacyt}[1]{%
266 \begin{verse}%
267 #1%
268 \end{verse}%
269 }
270 \newcommand{\motto}[1]{%
271 \begin{em}%
272 #1%
273 \end{em}%
274 }
275 \newcommand{\listaosob}[2]{%
276 \par{#1}%
277 \begin{itemize}%
278 #2%
279 \end{itemize}%
280 }
281
282 \newcommand{\nagloweklisty}[1]{%
283 \typosubsubsection{#1}%
284 }
285
286 \newcommand{\listaosoba}[1]{%
287 \item{#1}%
288 }
289
290 \newcommand{\kwestia}[1]{%
291 \par{#1}%
292 }
293
294 \newcommand{\naglowekakt}[1]{%
295 \pagebreak
296 \subsection*{\typosubsection{#1}}%
297 }
298 \newcommand{\naglowekczesc}[1]{%
299 \pagebreak
300 \subsection*{\typosubsection{#1}}%
301 }
302 \newcommand{\srodtytul}[1]{%
303 \subsection*{\typosubsection{#1}}%
304 }
305
306 \newcommand{\naglowekscena}[1]{%
307 \subsubsection*{\typosubsubsection{#1}}%
308 }
309 \newcommand{\naglowekrozdzial}[1]{%
310 {\subsubsection*{\raggedright{\typosubsubsection{#1}}}}%
311 }
312
313 \newcommand{\naglowekosoba}[1]{%
314 \par{\textsc{#1}}\nopagebreak%
315 }
316 \newcommand{\naglowekpodrozdzial}[1]{%
317 \par{#1}\nopagebreak%
318 }
319
320 \newcommand{\miejsceczas}[1]{%
321 \par{\emph{#1}}%
322 }
323 \newcommand{\didaskalia}[1]{%
324 \par{\emph{#1}}%
325 }
326
327 \newcommand{\akap}[1]{%
328 \par{#1}%
329 }
330 \newcommand{\akapdialog}[1]{%
331 \par{#1}%
332 }
333 \newcommand{\akapcd}[1]{%
334 \par{#1}%
335 }
336
337 \newcommand{\mottopodpis}[1]{%
338 \begin{em}%
339 \begin{flushright}%
340 #1%
341 \end{flushright}%
342 \end{em}%
343 }
344
345 \newcommand{\strofa}[1]{%
346 \par{\noindent{\ignorespaces#1\vspace{1em}}}%
347 }
348
349 \newcommand{\wers}[1]{#1}
350
351 \newcommand{\wersakap}[1]{%
352 \hspace*{1em}#1%
353 }
354 \newcommand{\werscd}[1]{%
355 \hspace*{8em}#1%
356 }
357 \newcommand{\werswciety}[2][1em]{%
358 \hspace*{#1}#2%
359 }
360
361 \ifshowfootnotes
362   \newcommand{\pa}[1]{\NoCaseChange{\footnote{#1}}}
363   \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
364   \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
365   \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
366 \else
367   \newcommand{\pa}[1]{}
368   \newcommand{\pe}[1]{}
369   \newcommand{\pr}[1]{}
370   \newcommand{\pt}[1]{}
371 \fi
372
373 \newcommand{\mat}[1]{$#1$}
374
375 \newcommand{\didasktekst}[1]{%
376 \emph{#1}%
377 }
378 \newcommand{\slowoobce}[1]{%
379 \emph{#1}%
380 }
381 \newcommand{\tytuldziela}[1]{%
382 \emph{#1}%
383 }
384 \newcommand{\wyroznienie}[1]{%
385 \emph{#1}%
386 }
387
388 \newcommand{\osoba}[1]{%
389 #1%
390 }
391
392 \newcommand{\sekcjaswiatlo}{%
393 \vspace{30pt}%
394 }
395
396 \newcommand{\sekcjaasterysk}{%
397 \vspace{10pt}%
398 \begin{center}%
399 \par{*}%
400 \end{center}%
401 }
402
403 \newcommand{\separatorlinia}{%
404 \vspace{10pt}%
405 \hrule{}%
406 \vspace{10pt}%
407 }
408
409 \newcommand{\motyw}[2][0]{%
410 \ifshowthemes
411 \mbox{}%
412 \marginpar{%
413 \vspace{-8pt}%
414 \vspace{-#1\baselineskip}%
415 \raggedright{\hspace{0pt}%
416 \footnotesize{\color{theme}{#2}}}%
417 \vspace{\baselineskip}%
418 }%
419 \fi
420 }
421
422
423 \newcommand{\editorialpage}[1]{%
424 #1%
425 \pagebreak%
426 }