9e5e6be46ea21737d56bc0949ba2f3021ac43200
[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{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[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=black,xetex]{hyperref}
79
80 \ifenablewlfont
81 \setmainfont [
82 %ExternalLocation,
83 UprightFont = JunicodeWL-Regular,
84 ItalicFont = JunicodeWL-Italic,
85 BoldFont = JunicodeWL-Regular,
86 BoldItalicFont = JunicodeWL-Italic,
87 SmallCapsFont = JunicodeWL-Regular,
88 SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
89 Numbers=OldStyle,
90 Scale=1.04,
91 LetterSpace=-1.0
92 ] {JunicodeWL}
93
94 \newfontfamily\alien[
95 SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
96 Numbers=OldStyle,
97 Scale=0.85,
98 LetterSpace=-1.0
99 ] {DejaVu Serif}
100
101
102 \defaultfontfeatures{
103 SizeFeatures={
104   {Size={-10.5}, FakeStretch=1.02, LetterSpace=2.0 },
105   {Size={10.5-12}, FakeStretch=2.00, LetterSpace=0.0 },
106   {Size={12-}, FakeStretch=0.98, LetterSpace=-2.0 }
107 }
108 }
109
110 \renewcommand{\textsc}[1]{%
111 {\addfontfeature{
112 SizeFeatures={
113   {Size={-10.5}, Scale=1.2, FakeStretch=1.02, LetterSpace=8.0 },
114   {Size={10.5-12}, Scale=1.2, FakeStretch=1.02, LetterSpace=8.0 },
115   {Size={12-}, FakeStretch=1.0, LetterSpace=8.0 }
116 },
117 Letters={SmallCaps,UppercaseSmallCaps}
118 }
119 #1}
120 }
121 \fi% enablewlfont
122
123 %{\Itshape JunicodeWL-Italic.ttf }
124 %{\bfseries Junicode-Bold.ttf }
125 %{\bfseries\itshape Junicode-BoldItalic.ttf }
126
127 \pagestyle{plain}
128 \usepackage{fancyhdr}
129
130 \makeatletter
131
132 % bottom figure below footnotes
133 \usepackage{fnpos}
134 \makeFNabove
135
136 \usepackage{color}
137 \definecolor{theme}{gray}{.3}
138
139 \setlength{\marginparsep}{2em}
140 \setlength{\marginparwidth}{8.5em}
141 \setlength{\oddsidemargin}{0pt}
142 \setlength{\voffset}{0pt}
143 \setlength{\topmargin}{0pt}
144 \setlength{\headheight}{0pt}
145 \setlength{\headsep}{0pt}
146 \setlength{\textheight}{24cm}
147
148 \pagestyle{fancy}
149 \fancyhf{}
150 \renewcommand{\headrulewidth}{0pt}
151 \renewcommand{\footrulewidth}{0pt}
152 \lfoot{{\footnotesize \textsc{\@author} \emph{\@title}}}
153 \cfoot{}
154 \rfoot{{\footnotesize \thepage}}
155
156 \clubpenalty=100000
157 \widowpenalty=100000
158
159
160 % see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
161 \newsavebox{\ximagebox}\newlength{\ximageheight}
162 \newsavebox{\xglyphbox}\newlength{\xglyphheight}
163 \newcommand{\xbox}[1]
164 {\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximagebox}}%
165 \savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
166 \raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
167 \makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
168 \usebox{\ximagebox}%
169 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
170
171
172
173 \newcommand{\typosubsubsection}[1]{%
174 {\textsc{#1}}
175 }
176
177 \newcommand{\typosubsection}[1]{%
178 {\addfontfeature{
179 SizeFeatures={
180   {Size={-10}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
181   {Size={10.5-12}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
182   {Size={12-}, FakeStretch=1.0, LetterSpace=8.0 }
183 },
184 Letters={Uppercase}
185 }
186 \MakeUppercase{#1}}
187 }
188
189 \newcommand{\typosection}[1]{%
190 {\addfontfeature{FakeStretch=0.96, LetterSpace=-4.0}\emph{\scalefont{2}#1}}
191 %{\addfontfeature{Scale=2.0, FakeStretch=0.98, LetterSpace=-2.0}\emph{#1}}
192 }
193
194
195 \newcommand{\tytul}[1]{%
196 #1%
197 \vspace{1em}%
198 }
199
200 \newcommand{\nazwapodutworu}[1]{%
201 \section*{\typosection{#1}}%
202 }
203
204 \newcommand{\autorutworu}[1]{%
205 \subsection*{\typosubsection{#1}}%
206 }
207
208 \newcommand{\dzielonadrzedne}[1]{%
209 \subsection*{\typosubsubsection{#1}}%
210 }
211
212 \newcommand{\nazwautworu}[1]{%
213 \section*{\typosection{#1}}%
214 }
215
216 \newcommand{\podtytul}[1]{%
217 \subsection*{\typosubsubsection{#1}}%
218 }
219
220 \newcommand{\translator}[1]{%
221 % TODO: l10n is a style thing
222 \subsection*{\typosubsubsection{tłum. #1}}%
223 }
224
225
226 \newcommand{\powiesc}[1]{#1}
227 \newcommand{\opowiadanie}[1]{#1}
228 \newcommand{\lirykal}[1]{#1}
229 \newcommand{\lirykalp}[1]{#1}
230 \newcommand{\dramatwierszowanyl}[1]{#1}
231 \newcommand{\dramatwierszowanylp}[1]{#1}
232 \newcommand{\dramatwspolczesny}[1]{#1}
233
234 \newcommand{\nota}[1]{%
235 \par{#1}%
236 }
237
238 \newcommand{\dedykacja}[1]{%
239 \begin{em}%
240 \begin{flushright}%
241 #1%
242 \end{flushright}%
243 \end{em}%
244 }
245
246 \newcommand{\dlugicytat}[1]{%
247 \begin{quotation}%
248 #1%
249 \end{quotation}%
250 }
251
252 \newcommand{\poezjacyt}[1]{%
253 \begin{verse}%
254 #1%
255 \end{verse}%
256 }
257 \newcommand{\motto}[1]{%
258 \begin{em}%
259 #1%
260 \end{em}%
261 }
262 \newcommand{\listaosob}[2]{%
263 \par{#1}%
264 \begin{itemize}%
265 #2%
266 \end{itemize}%
267 }
268
269 \newcommand{\nagloweklisty}[1]{%
270 \typosubsubsection{#1}%
271 }
272
273 \newcommand{\listaosoba}[1]{%
274 \item{#1}%
275 }
276
277 \newcommand{\kwestia}[1]{%
278 \par{#1}%
279 }
280
281 \newcommand{\naglowekakt}[1]{%
282 \pagebreak
283 \subsection*{\typosubsection{#1}}%
284 }
285 \newcommand{\naglowekczesc}[1]{%
286 \pagebreak
287 \subsection*{\typosubsection{#1}}%
288 }
289 \newcommand{\srodtytul}[1]{%
290 \subsection*{\typosubsection{#1}}%
291 }
292
293 \newcommand{\naglowekscena}[1]{%
294 \subsubsection*{\typosubsubsection{#1}}%
295 }
296 \newcommand{\naglowekrozdzial}[1]{%
297 \subsubsection*{\typosubsubsection{#1}}%
298 }
299
300 \newcommand{\naglowekosoba}[1]{%
301 \par{\textsc{#1}}\nopagebreak%
302 }
303 \newcommand{\naglowekpodrozdzial}[1]{%
304 \par{#1}\nopagebreak%
305 }
306
307 \newcommand{\miejsceczas}[1]{%
308 \par{\emph{#1}}%
309 }
310 \newcommand{\didaskalia}[1]{%
311 \par{\emph{#1}}%
312 }
313
314 \newcommand{\akap}[1]{%
315 \par{#1}%
316 }
317 \newcommand{\akapdialog}[1]{%
318 \par{#1}%
319 }
320 \newcommand{\akapcd}[1]{%
321 \par{#1}%
322 }
323
324 \newcommand{\mottopodpis}[1]{%
325 \begin{em}%
326 \begin{flushright}%
327 #1%
328 \end{flushright}%
329 \end{em}%
330 }
331
332 \newcommand{\strofa}[1]{%
333 \par{\noindent{\ignorespaces#1\vspace{1em}}}%
334 }
335
336 \newcommand{\wers}[1]{#1}
337
338 \newcommand{\wersakap}[1]{%
339 \hspace*{1em}#1%
340 }
341 \newcommand{\werscd}[1]{%
342 \hspace*{8em}#1%
343 }
344 \newcommand{\werswciety}[2][1em]{%
345 \hspace*{#1}#2%
346 }
347
348 \ifshowfootnotes
349   \newcommand{\pa}[1]{\NoCaseChange{\footnote{#1}}}
350   \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
351   \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
352   \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
353 \else
354   \newcommand{\pa}[1]{}
355   \newcommand{\pe}[1]{}
356   \newcommand{\pr}[1]{}
357   \newcommand{\pt}[1]{}
358 \fi
359
360 \newcommand{\mat}[1]{$#1$}
361
362 \newcommand{\didasktekst}[1]{%
363 \emph{#1}%
364 }
365 \newcommand{\slowoobce}[1]{%
366 \emph{#1}%
367 }
368 \newcommand{\tytuldziela}[1]{%
369 \emph{#1}%
370 }
371 \newcommand{\wyroznienie}[1]{%
372 \emph{#1}%
373 }
374
375 \newcommand{\osoba}[1]{%
376 #1%
377 }
378
379 \newcommand{\sekcjaswiatlo}{%
380 \vspace{30pt}%
381 }
382
383 \newcommand{\sekcjaasterysk}{%
384 \vspace{10pt}%
385 \begin{center}%
386 \par{*}%
387 \end{center}%
388 }
389
390 \newcommand{\separatorlinia}{%
391 \vspace{10pt}%
392 \hrule{}%
393 \vspace{10pt}%
394 }
395
396 \newcommand{\motyw}[2][0]{%
397 \ifshowthemes
398 \mbox{}%
399 \marginpar{%
400 \vspace{-8pt}%
401 \vspace{-#1\baselineskip}%
402 \raggedright{\hspace{0pt}%
403 \footnotesize{\color{theme}{#2}}}%
404 \vspace{\baselineskip}%
405 }%
406 \fi
407 }
408
409 %% EDUMED SPECIFIC
410
411 \newcommand{\activitycounter}[1]{\vspace{1em}\par{\huge{#1}}}
412
413 \newcommand{\activityinfo}[1]{\begin{flushright}\parbox[t]{2in}{#1}\end{flushright}}
414 \newcommand{\activitytime}[1]{Czas: #1 min \\}
415 \newcommand{\activityform}[1]{Forma: #1 \\}
416 \newcommand{\activitytools}[1]{#1 \\}
417
418 \newcommand*\checkbox{\item[\Square]}
419 \newcommand*\radio{\item[\Circle]}
420