1 % -*- coding: utf-8 -*-
 
   2 \NeedsTeXFormat{LaTeX2e}
 
   3 \ProvidesClass{wl}[2011/11/28 wolnelektury.pl book style]
 
   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
 
  15 \RequirePackage{setspace}
 
  16 \RequirePackage{type1cm}
 
  17 %\RequirePackage{wasysym}
 
  18 \DeclareOption{13pt}{%
 
  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@
 
  37    \belowdisplayskip \abovedisplayskip
 
  42 %% \DeclareOption{14pt}{\renewcommand{\normalsize}{\AtEndOfClass{\fontsize{14}{17}\selectfont}}}
 
  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}}
 
  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}}
 
  54 \newif\ifshowfootnotes \showfootnotestrue
 
  55 \DeclareOption{nofootnotes}{\showfootnotesfalse}
 
  57 \newif\ifshowthemes \showthemestrue
 
  58 \DeclareOption{nothemes}{\showthemesfalse}
 
  60 \newif\ifenablewlfont \enablewlfonttrue
 
  61 \DeclareOption{nowlfont}{\enablewlfontfalse}
 
  63 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
 
  65 \LoadClass[a4paper,oneside]{book}
 
  70 \usepackage[xetex]{graphicx}
 
  75 \usepackage[overload]{textcase}
 
  77 % TODO: link color is a style thing
 
  78 \usepackage[hyphens]{url}
 
  79 \usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=blue,xetex]{hyperref}
 
  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}},
 
 101 %\newfontfamily\alien[
 
 103 %SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
 
 108 %\setmainfont{FreeSans}
 
 111 \defaultfontfeatures{
 
 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 }
 
 119 \renewcommand{\textsc}[1]{%
 
 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 }
 
 126 Letters={SmallCaps,UppercaseSmallCaps}
 
 132 %{\Itshape JunicodeWL-Italic.ttf }
 
 133 %{\bfseries Junicode-Bold.ttf }
 
 134 %{\bfseries\itshape Junicode-BoldItalic.ttf }
 
 137 \usepackage{fancyhdr}
 
 141 % bottom figure below footnotes
 
 146 \definecolor{theme}{gray}{.3}
 
 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}
 
 163 \renewcommand{\headrulewidth}{0pt}
 
 164 \renewcommand{\footrulewidth}{0pt}
 
 165 \lfoot{{\footnotesize \@author{} \emph{\@title}}}
 
 167 \rfoot{{\footnotesize \thepage}}
 
 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}}}%}%
 
 182 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
 
 186 \newcommand{\typosubsubsection}[1]{%
 
 190 \newcommand{\typosubsection}[1]{%
 
 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 }
 
 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}}
 
 208 \newcommand{\tytul}[1]{%
 
 213 \newcommand{\nazwapodutworu}[1]{%
 
 214 \section*{\typosection{#1}}%
 
 217 \newcommand{\autorutworu}[1]{%
 
 218 \subsection*{\typosubsection{#1}}%
 
 221 \newcommand{\dzielonadrzedne}[1]{%
 
 222 \subsection*{\typosubsubsection{#1}}%
 
 225 \newcommand{\nazwautworu}[1]{%
 
 226 \section*{\raggedright{\typosection{#1}}}%
 
 229 \newcommand{\podtytul}[1]{%
 
 230 \subsection*{\typosubsubsection{#1}}%
 
 233 \newcommand{\translator}[1]{%
 
 234 % TODO: l10n is a style thing
 
 235 \subsection*{\typosubsubsection{tłum. #1}}%
 
 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}
 
 247 \newcommand{\nota}[1]{%
 
 251 \newcommand{\dedykacja}[1]{%
 
 259 \newcommand{\dlugicytat}[1]{%
 
 265 \newcommand{\poezjacyt}[1]{%
 
 270 \newcommand{\motto}[1]{%
 
 275 \newcommand{\listaosob}[2]{%
 
 282 \newcommand{\nagloweklisty}[1]{%
 
 283 \typosubsubsection{#1}%
 
 286 \newcommand{\listaosoba}[1]{%
 
 290 \newcommand{\kwestia}[1]{%
 
 294 \newcommand{\naglowekakt}[1]{%
 
 296 \subsection*{\typosubsection{#1}}%
 
 298 \newcommand{\naglowekczesc}[1]{%
 
 300 \subsection*{\typosubsection{#1}}%
 
 302 \newcommand{\srodtytul}[1]{%
 
 303 \subsection*{\typosubsection{#1}}%
 
 306 \newcommand{\naglowekscena}[1]{%
 
 307 \subsubsection*{\typosubsubsection{#1}}%
 
 309 \newcommand{\naglowekrozdzial}[1]{%
 
 310 {\subsubsection*{\raggedright{\typosubsubsection{#1}}}}%
 
 313 \newcommand{\naglowekosoba}[1]{%
 
 314 \par{\textsc{#1}}\nopagebreak%
 
 316 \newcommand{\naglowekpodrozdzial}[1]{%
 
 317 \par{#1}\nopagebreak%
 
 320 \newcommand{\miejsceczas}[1]{%
 
 323 \newcommand{\didaskalia}[1]{%
 
 327 \newcommand{\akap}[1]{%
 
 330 \newcommand{\akapdialog}[1]{%
 
 333 \newcommand{\akapcd}[1]{%
 
 337 \newcommand{\mottopodpis}[1]{%
 
 345 \newcommand{\strofa}[1]{%
 
 346 \par{\noindent{\ignorespaces#1\vspace{1em}}}%
 
 349 \newcommand{\wers}[1]{#1}
 
 351 \newcommand{\wersakap}[1]{%
 
 354 \newcommand{\werscd}[1]{%
 
 357 \newcommand{\werswciety}[2][1em]{%
 
 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}}}
 
 367   \newcommand{\pa}[1]{}
 
 368   \newcommand{\pe}[1]{}
 
 369   \newcommand{\pr}[1]{}
 
 370   \newcommand{\pt}[1]{}
 
 373 \newcommand{\mat}[1]{$#1$}
 
 375 \newcommand{\didasktekst}[1]{%
 
 378 \newcommand{\slowoobce}[1]{%
 
 381 \newcommand{\tytuldziela}[1]{%
 
 384 \newcommand{\wyroznienie}[1]{%
 
 388 \newcommand{\osoba}[1]{%
 
 392 \newcommand{\sekcjaswiatlo}{%
 
 396 \newcommand{\sekcjaasterysk}{%
 
 403 \newcommand{\separatorlinia}{%
 
 409 \newcommand{\motyw}[2][0]{%
 
 414 \vspace{-#1\baselineskip}%
 
 415 \raggedright{\hspace{0pt}%
 
 416 \footnotesize{\color{theme}{#2}}}%
 
 417 \vspace{\baselineskip}%
 
 423 \newcommand{\editorialpage}[1]{%