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 ItalicFont = Dosis-SemiBold,
 
  86 BoldFont = Dosis-Bold,
 
  87 BoldItalicFont = Dosis-Bold,
 
  88 SmallCapsFont = Dosis-Regular,
 
  89 SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
 
  96 SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
 
 103 \defaultfontfeatures{
 
 105   {Size={-10.5}, FakeStretch=1.02, LetterSpace=2.0 },
 
 106   {Size={10.5-12}, FakeStretch=2.00, LetterSpace=0.0 },
 
 107   {Size={12-}, FakeStretch=0.98, LetterSpace=-2.0 }
 
 111 \renewcommand{\textsc}[1]{%
 
 114   {Size={-10.5}, Scale=1.2, FakeStretch=1.02, LetterSpace=8.0 },
 
 115   {Size={10.5-12}, Scale=1.2, FakeStretch=1.02, LetterSpace=8.0 },
 
 116   {Size={12-}, FakeStretch=1.0, LetterSpace=8.0 }
 
 118 Letters={SmallCaps,UppercaseSmallCaps}
 
 124 %{\Itshape JunicodeWL-Italic.ttf }
 
 125 %{\bfseries Junicode-Bold.ttf }
 
 126 %{\bfseries\itshape Junicode-BoldItalic.ttf }
 
 129 \usepackage{fancyhdr}
 
 133 % bottom figure below footnotes
 
 138 \definecolor{theme}{gray}{.3}
 
 140 \setlength{\marginparsep}{2em}
 
 141 \setlength{\marginparwidth}{8.5em}
 
 142 \setlength{\oddsidemargin}{0pt}
 
 143 \setlength{\voffset}{0pt}
 
 144 \setlength{\topmargin}{0pt}
 
 145 \setlength{\headheight}{0pt}
 
 146 \setlength{\headsep}{0pt}
 
 147 \setlength{\textheight}{24cm}
 
 151 \renewcommand{\headrulewidth}{0pt}
 
 152 \renewcommand{\footrulewidth}{0pt}
 
 153 \lfoot{{\footnotesize \@author{} \emph{\@title}}}
 
 155 \rfoot{{\footnotesize \thepage}}
 
 161 % see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
 
 162 \newsavebox{\ximagebox}\newlength{\ximageheight}
 
 163 \newsavebox{\xglyphbox}\newlength{\xglyphheight}
 
 164 \newcommand{\xbox}[1]
 
 165 {\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximagebox}}%
 
 166 \savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
 
 167 \raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
 
 168 \makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
 
 170 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
 
 174 \newcommand{\typosubsubsection}[1]{%
 
 178 \newcommand{\typosubsection}[1]{%
 
 181   {Size={-10}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
 
 182   {Size={10.5-12}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
 
 183   {Size={12-}, FakeStretch=1.0, LetterSpace=8.0 }
 
 190 \newcommand{\typosection}[1]{%
 
 191 {\addfontfeature{FakeStretch=0.96, LetterSpace=-4.0}\emph{\scalefont{2}#1}}
 
 192 %{\addfontfeature{Scale=2.0, FakeStretch=0.98, LetterSpace=-2.0}\emph{#1}}
 
 196 \newcommand{\tytul}[1]{%
 
 201 \newcommand{\nazwapodutworu}[1]{%
 
 202 \section*{\typosection{#1}}%
 
 205 \newcommand{\autorutworu}[1]{%
 
 206 \subsection*{\typosubsection{#1}}%
 
 209 \newcommand{\dzielonadrzedne}[1]{%
 
 210 \subsection*{\typosubsubsection{#1}}%
 
 213 \newcommand{\nazwautworu}[1]{%
 
 214 \section*{\typosection{#1}}%
 
 217 \newcommand{\podtytul}[1]{%
 
 218 \subsection*{\typosubsubsection{#1}}%
 
 221 \newcommand{\translator}[1]{%
 
 222 % TODO: l10n is a style thing
 
 223 \subsection*{\typosubsubsection{tłum. #1}}%
 
 227 \newcommand{\powiesc}[1]{#1}
 
 228 \newcommand{\opowiadanie}[1]{#1}
 
 229 \newcommand{\lirykal}[1]{#1}
 
 230 \newcommand{\lirykalp}[1]{#1}
 
 231 \newcommand{\dramatwierszowanyl}[1]{#1}
 
 232 \newcommand{\dramatwierszowanylp}[1]{#1}
 
 233 \newcommand{\dramatwspolczesny}[1]{#1}
 
 235 \newcommand{\nota}[1]{%
 
 239 \newcommand{\dedykacja}[1]{%
 
 247 \newcommand{\dlugicytat}[1]{%
 
 253 \newcommand{\poezjacyt}[1]{%
 
 258 \newcommand{\motto}[1]{%
 
 263 \newcommand{\listaosob}[2]{%
 
 270 \newcommand{\nagloweklisty}[1]{%
 
 271 \typosubsubsection{#1}%
 
 274 \newcommand{\listaosoba}[1]{%
 
 278 \newcommand{\kwestia}[1]{%
 
 282 \newcommand{\naglowekakt}[1]{%
 
 284 \subsection*{\typosubsection{#1}}%
 
 286 \newcommand{\naglowekczesc}[1]{%
 
 288 \subsection*{\typosubsection{#1}}%
 
 290 \newcommand{\srodtytul}[1]{%
 
 291 \subsection*{\typosubsection{#1}}%
 
 294 \newcommand{\naglowekscena}[1]{%
 
 295 \subsubsection*{\typosubsubsection{#1}}%
 
 297 \newcommand{\naglowekrozdzial}[1]{%
 
 298 \subsubsection*{\typosubsubsection{#1}}%
 
 301 \newcommand{\naglowekosoba}[1]{%
 
 302 \par{\textsc{#1}}\nopagebreak%
 
 304 \newcommand{\naglowekpodrozdzial}[1]{%
 
 305 \par{#1}\nopagebreak%
 
 308 \newcommand{\miejsceczas}[1]{%
 
 311 \newcommand{\didaskalia}[1]{%
 
 315 \newcommand{\akap}[1]{%
 
 318 \newcommand{\akapdialog}[1]{%
 
 321 \newcommand{\akapcd}[1]{%
 
 325 \newcommand{\mottopodpis}[1]{%
 
 333 \newcommand{\strofa}[1]{%
 
 334 \par{\noindent{\ignorespaces#1\vspace{1em}}}%
 
 337 \newcommand{\wers}[1]{#1}
 
 339 \newcommand{\wersakap}[1]{%
 
 342 \newcommand{\werscd}[1]{%
 
 345 \newcommand{\werswciety}[2][1em]{%
 
 350   \newcommand{\pa}[1]{\NoCaseChange{\footnote{#1}}}
 
 351   \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
 
 352   \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
 
 353   \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
 
 355   \newcommand{\pa}[1]{}
 
 356   \newcommand{\pe}[1]{}
 
 357   \newcommand{\pr}[1]{}
 
 358   \newcommand{\pt}[1]{}
 
 361 \newcommand{\mat}[1]{$#1$}
 
 363 \newcommand{\didasktekst}[1]{%
 
 366 \newcommand{\slowoobce}[1]{%
 
 369 \newcommand{\tytuldziela}[1]{%
 
 372 \newcommand{\wyroznienie}[1]{%
 
 376 \newcommand{\osoba}[1]{%
 
 380 \newcommand{\sekcjaswiatlo}{%
 
 384 \newcommand{\sekcjaasterysk}{%
 
 391 \newcommand{\separatorlinia}{%
 
 397 \newcommand{\motyw}[2][0]{%
 
 402 \vspace{-#1\baselineskip}%
 
 403 \raggedright{\hspace{0pt}%
 
 404 \footnotesize{\color{theme}{#2}}}%
 
 405 \vspace{\baselineskip}%