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}
 
  74 \usepackage[Latin,Greek]{ucharclasses}
 
  76 \usepackage[overload]{textcase}
 
  78 % TODO: link color is a style thing
 
  79 \usepackage[hyphens]{url}
 
  80 \usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=blue,xetex]{hyperref}
 
  82 \newfontfamily\substitutefont{GFS Neohellenic}
 
  83 \setTransitionsForGreek{\begingroup\substitutefont}{\endgroup}
 
  87 UprightFont = Dosis-Regular,
 
  88 ItalicFont = Dosis-SemiBold,
 
  89 BoldFont = Dosis-Bold,
 
  90 BoldItalicFont = Dosis-Bold,
 
  91 SmallCapsFont = Dosis-Regular,
 
  92 %UprightFont = JunicodeWL-Regular,
 
  93 %ItalicFont = JunicodeWL-Italic,
 
  94 %BoldFont = Junicode-Bold,
 
  95 %BoldItalicFont = Junicode-BoldItalic,
 
  96 %SmallCapsFont = JunicodeWL-Regular,
 
  97 SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
 
 103 %\newfontfamily\alien[
 
 105 %SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
 
 110 %\setmainfont{FreeSans}
 
 113 \defaultfontfeatures{
 
 115   {Size={-10.5}, FakeStretch=1.02, LetterSpace=2.0 },
 
 116   {Size={10.5-12}, FakeStretch=2.00, LetterSpace=0.0 },
 
 117   {Size={12-}, FakeStretch=0.98, LetterSpace=-2.0 }
 
 121 \renewcommand{\textsc}[1]{%
 
 124   {Size={-10.5}, Scale=1.2, FakeStretch=1.02, LetterSpace=8.0 },
 
 125   {Size={10.5-12}, Scale=1.2, FakeStretch=1.02, LetterSpace=8.0 },
 
 126   {Size={12-}, FakeStretch=1.0, LetterSpace=8.0 }
 
 128 Letters={SmallCaps,UppercaseSmallCaps}
 
 134 %{\Itshape JunicodeWL-Italic.ttf }
 
 135 %{\bfseries Junicode-Bold.ttf }
 
 136 %{\bfseries\itshape Junicode-BoldItalic.ttf }
 
 139 \usepackage{fancyhdr}
 
 143 % bottom figure below footnotes
 
 148 \definecolor{theme}{gray}{.3}
 
 151 \setlength{\marginparsep}{2em}
 
 152 %\setlength{\marginparwidth}{8.5em}
 
 153 \setlength{\marginparwidth}{2.5cm}
 
 154 \setlength{\oddsidemargin}{0pt}
 
 155 \setlength{\voffset}{0pt}
 
 156 \setlength{\topmargin}{0pt}
 
 157 \setlength{\headheight}{0pt}
 
 158 \setlength{\headsep}{0pt}
 
 159 \setlength{\textheight}{24cm}
 
 160 \setlength{\textwidth}{16cm}
 
 161 \setlength{\parindent}{0pt}
 
 162 \setlength{\parskip}{1em plus0.4em minus0.3em}
 
 167 \renewcommand{\headrulewidth}{0pt}
 
 168 \renewcommand{\footrulewidth}{0pt}
 
 169 \lfoot{{\footnotesize \@organization}} %\@author{} \emph{\@title}}}
 
 171 \rfoot{{\footnotesize \thepage}}
 
 177 % see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
 
 178 \newsavebox{\ximagebox}\newlength{\ximageheight}
 
 179 \newsavebox{\xglyphbox}\newlength{\xglyphheight}
 
 180 \newcommand{\xbox}[1]
 
 181 {\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximagebox}}%
 
 182 \savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
 
 183 \raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
 
 184 \makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
 
 186 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
 
 190 \newcommand{\typosubsubsection}[1]{%
 
 194 \newcommand{\typosubsection}[1]{%
 
 197   {Size={-10}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
 
 198   {Size={10.5-12}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
 
 199   {Size={12-}, FakeStretch=1.0, LetterSpace=8.0 }
 
 206 \newcommand{\typosection}[1]{%
 
 207 {\addfontfeature{FakeStretch=0.96, LetterSpace=-4.0}\emph{\scalefont{2}#1}}
 
 208 %{\addfontfeature{Scale=2.0, FakeStretch=0.98, LetterSpace=-2.0}\emph{#1}}
 
 212 \newcommand{\tytul}[1]{%
 
 217 \newcommand{\nazwapodutworu}[1]{%
 
 218 \section*{\typosection{#1}}%
 
 221 \newcommand{\autorutworu}[1]{%
 
 222 \subsection*{\typosubsection{#1}}%
 
 225 \newcommand{\dzielonadrzedne}[1]{%
 
 226 \subsection*{\typosubsubsection{#1}}%
 
 229 \newcommand{\nazwautworu}[1]{%
 
 230 \section*{\raggedright{\typosection{#1}}}%
 
 233 \newcommand{\podtytul}[1]{%
 
 234 \subsection*{\typosubsubsection{#1}}%
 
 237 \newcommand{\translator}[1]{%
 
 238 % TODO: l10n is a style thing
 
 239 \subsection*{\typosubsubsection{tłum. #1}}%
 
 243 \newcommand{\powiesc}[1]{#1}
 
 244 \newcommand{\opowiadanie}[1]{#1}
 
 245 \newcommand{\lirykal}[1]{#1}
 
 246 \newcommand{\lirykalp}[1]{#1}
 
 247 \newcommand{\dramatwierszowanyl}[1]{#1}
 
 248 \newcommand{\dramatwierszowanylp}[1]{#1}
 
 249 \newcommand{\dramatwspolczesny}[1]{#1}
 
 251 \newcommand{\nota}[1]{%
 
 255 \newcommand{\dedykacja}[1]{%
 
 263 \newcommand{\dlugicytat}[1]{%
 
 269 \newcommand{\poezjacyt}[1]{%
 
 274 \newcommand{\motto}[1]{%
 
 279 \newcommand{\listaosob}[2]{%
 
 286 \newcommand{\nagloweklisty}[1]{%
 
 287 \typosubsubsection{#1}%
 
 290 \newcommand{\listaosoba}[1]{%
 
 294 \newcommand{\kwestia}[1]{%
 
 298 \newcommand{\naglowekakt}[1]{%
 
 300 \subsection*{\typosubsection{#1}}%
 
 302 \newcommand{\naglowekczesc}[1]{%
 
 304 \subsection*{\typosubsection{#1}}%
 
 306 \newcommand{\srodtytul}[1]{%
 
 307 \subsection*{\typosubsection{#1}}%
 
 310 \newcommand{\naglowekscena}[1]{%
 
 311 \subsubsection*{\typosubsubsection{#1}}%
 
 313 \newcommand{\naglowekrozdzial}[1]{%
 
 314 {\subsubsection*{\raggedright{\typosubsubsection{#1}}}}%
 
 317 \newcommand{\naglowekosoba}[1]{%
 
 318 \par{\textsc{#1}}\nopagebreak%
 
 320 \newcommand{\naglowekpodrozdzial}[1]{%
 
 321 \par{#1}\nopagebreak%
 
 324 \newcommand{\miejsceczas}[1]{%
 
 327 \newcommand{\didaskalia}[1]{%
 
 331 \newcommand{\akap}[1]{%
 
 334 \newcommand{\akapdialog}[1]{%
 
 337 \newcommand{\akapcd}[1]{%
 
 341 \newcommand{\mottopodpis}[1]{%
 
 349 \newcommand{\strofa}[1]{%
 
 350 \par{\noindent{\ignorespaces#1\vspace{1em}}}%
 
 353 \newcommand{\wers}[1]{#1}
 
 355 \newcommand{\wersakap}[1]{%
 
 358 \newcommand{\werscd}[1]{%
 
 361 \newcommand{\werswciety}[2][1em]{%
 
 366   \newcommand{\pa}[1]{\NoCaseChange{\footnote{#1}}}
 
 367   \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
 
 368   \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
 
 369   \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
 
 371   \newcommand{\pa}[1]{}
 
 372   \newcommand{\pe}[1]{}
 
 373   \newcommand{\pr}[1]{}
 
 374   \newcommand{\pt}[1]{}
 
 377 \newcommand{\mat}[1]{$#1$}
 
 379 \newcommand{\didasktekst}[1]{%
 
 382 \newcommand{\slowoobce}[1]{%
 
 385 \newcommand{\tytuldziela}[1]{%
 
 388 \newcommand{\wyroznienie}[1]{%
 
 392 \newcommand{\osoba}[1]{%
 
 396 \newcommand{\sekcjaswiatlo}{%
 
 400 \newcommand{\sekcjaasterysk}{%
 
 407 \newcommand{\separatorlinia}{%
 
 413 \newcommand{\motyw}[2][0]{%
 
 418 \vspace{-#1\baselineskip}%
 
 419 \raggedright{\hspace{0pt}%
 
 420 \footnotesize{\color{theme}{#2}}}%
 
 421 \vspace{\baselineskip}%
 
 427 \newcommand{\editorialpage}[1]{%
 
 432 \newcommand{\titlefield}[1]{%
 
 434 \begin{minipage}[t]{.7\textwidth}%
 
 440 \newcommand{\toplogo}[3]{%
 
 441 \begin{minipage}[t]{.3\textwidth}%
 
 443 \vspace{0pt}{\includegraphics[width=#3]{#1}}%