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,
 
  98 SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
 
 104 %\newfontfamily\alien[
 
 106 %SmallCapsFeatures = {Letters={SmallCaps,UppercaseSmallCaps}},
 
 111 %\setmainfont{FreeSans}
 
 114 \defaultfontfeatures{
 
 116   {Size={-10.5}, FakeStretch=1.02, LetterSpace=2.0 },
 
 117   {Size={10.5-12}, FakeStretch=2.00, LetterSpace=0.0 },
 
 118   {Size={12-}, FakeStretch=0.98, LetterSpace=-2.0 }
 
 122 \renewcommand{\textsc}[1]{%
 
 125   {Size={-10.5}, Scale=1.2, FakeStretch=1.02, LetterSpace=8.0 },
 
 126   {Size={10.5-12}, Scale=1.2, FakeStretch=1.02, LetterSpace=8.0 },
 
 127   {Size={12-}, FakeStretch=1.0, LetterSpace=8.0 }
 
 129 Letters={SmallCaps,UppercaseSmallCaps}
 
 135 %{\Itshape JunicodeWL-Italic.ttf }
 
 136 %{\bfseries Junicode-Bold.ttf }
 
 137 %{\bfseries\itshape Junicode-BoldItalic.ttf }
 
 140 \usepackage{fancyhdr}
 
 144 % bottom figure below footnotes
 
 149 \definecolor{theme}{gray}{.3}
 
 152 \setlength{\marginparsep}{2em}
 
 153 %\setlength{\marginparwidth}{8.5em}
 
 154 \setlength{\marginparwidth}{2.5cm}
 
 155 \setlength{\oddsidemargin}{0pt}
 
 156 \setlength{\voffset}{0pt}
 
 157 \setlength{\topmargin}{0pt}
 
 158 \setlength{\headheight}{0pt}
 
 159 \setlength{\headsep}{0pt}
 
 160 \setlength{\textheight}{24cm}
 
 161 \setlength{\textwidth}{16cm}
 
 162 \setlength{\parindent}{0pt}
 
 163 \setlength{\parskip}{1em plus0.4em minus0.3em}
 
 168 \renewcommand{\headrulewidth}{0pt}
 
 169 \renewcommand{\footrulewidth}{0pt}
 
 170 \lfoot{{\footnotesize \@organization}} %\@author{} \emph{\@title}}}
 
 172 \rfoot{{\footnotesize \thepage}}
 
 178 % see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
 
 179 \newsavebox{\ximagebox}\newlength{\ximageheight}
 
 180 \newsavebox{\xglyphbox}\newlength{\xglyphheight}
 
 181 \newcommand{\xbox}[1]
 
 182 {\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximagebox}}%
 
 183 \savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
 
 184 \raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
 
 185 \makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
 
 187 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
 
 191 \newcommand{\typosubsubsection}[1]{%
 
 195 \newcommand{\typosubsection}[1]{%
 
 198   {Size={-10}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
 
 199   {Size={10.5-12}, Scale=1.2, FakeStretch=1.00, LetterSpace=8.0 },
 
 200   {Size={12-}, FakeStretch=1.0, LetterSpace=8.0 }
 
 207 \newcommand{\typosection}[1]{%
 
 208 {\addfontfeature{FakeStretch=0.96, LetterSpace=-4.0}\emph{\scalefont{2}#1}}
 
 209 %{\addfontfeature{Scale=2.0, FakeStretch=0.98, LetterSpace=-2.0}\emph{#1}}
 
 213 \newcommand{\tytul}[1]{%
 
 218 \newcommand{\nazwapodutworu}[1]{%
 
 219 \section*{\typosection{#1}}%
 
 222 \newcommand{\autorutworu}[1]{%
 
 223 \subsection*{\typosubsection{#1}}%
 
 226 \newcommand{\dzielonadrzedne}[1]{%
 
 227 \subsection*{\typosubsubsection{#1}}%
 
 230 \newcommand{\nazwautworu}[1]{%
 
 231 \section*{\raggedright{\typosection{#1}}}%
 
 234 \newcommand{\podtytul}[1]{%
 
 235 \subsection*{\typosubsubsection{#1}}%
 
 238 \newcommand{\translator}[1]{%
 
 239 % TODO: l10n is a style thing
 
 240 \subsection*{\typosubsubsection{tłum. #1}}%
 
 244 \newcommand{\powiesc}[1]{#1}
 
 245 \newcommand{\opowiadanie}[1]{#1}
 
 246 \newcommand{\lirykal}[1]{#1}
 
 247 \newcommand{\lirykalp}[1]{#1}
 
 248 \newcommand{\dramatwierszowanyl}[1]{#1}
 
 249 \newcommand{\dramatwierszowanylp}[1]{#1}
 
 250 \newcommand{\dramatwspolczesny}[1]{#1}
 
 252 \newcommand{\nota}[1]{%
 
 256 \newcommand{\dedykacja}[1]{%
 
 264 \newcommand{\dlugicytat}[1]{%
 
 270 \newcommand{\poezjacyt}[1]{%
 
 275 \newcommand{\motto}[1]{%
 
 280 \newcommand{\listaosob}[2]{%
 
 287 \newcommand{\nagloweklisty}[1]{%
 
 288 \typosubsubsection{#1}%
 
 291 \newcommand{\listaosoba}[1]{%
 
 295 \newcommand{\kwestia}[1]{%
 
 299 \newcommand{\naglowekakt}[1]{%
 
 301 \subsection*{\typosubsection{#1}}%
 
 303 \newcommand{\naglowekczesc}[1]{%
 
 305 \subsection*{\typosubsection{#1}}%
 
 307 \newcommand{\srodtytul}[1]{%
 
 308 \subsection*{\typosubsection{#1}}%
 
 311 \newcommand{\naglowekscena}[1]{%
 
 312 \subsubsection*{\typosubsubsection{#1}}%
 
 314 \newcommand{\naglowekrozdzial}[1]{%
 
 315 {\subsubsection*{\raggedright{\typosubsubsection{#1}}}}%
 
 318 \newcommand{\naglowekosoba}[1]{%
 
 319 \par{\textsc{#1}}\nopagebreak%
 
 321 \newcommand{\naglowekpodrozdzial}[1]{%
 
 322 \par{#1}\nopagebreak%
 
 325 \newcommand{\miejsceczas}[1]{%
 
 328 \newcommand{\didaskalia}[1]{%
 
 332 \newcommand{\akap}[1]{%
 
 335 \newcommand{\akapdialog}[1]{%
 
 338 \newcommand{\akapcd}[1]{%
 
 342 \newcommand{\mottopodpis}[1]{%
 
 350 \newcommand{\strofa}[1]{%
 
 351 \par{\noindent{\ignorespaces#1\vspace{1em}}}%
 
 354 \newcommand{\wers}[1]{#1}
 
 356 \newcommand{\wersakap}[1]{%
 
 359 \newcommand{\werscd}[1]{%
 
 362 \newcommand{\werswciety}[2][1em]{%
 
 367   \newcommand{\pa}[1]{\NoCaseChange{\footnote{#1}}}
 
 368   \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
 
 369   \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
 
 370   \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
 
 372   \newcommand{\pa}[1]{}
 
 373   \newcommand{\pe}[1]{}
 
 374   \newcommand{\pr}[1]{}
 
 375   \newcommand{\pt}[1]{}
 
 378 \newcommand{\mat}[1]{$#1$}
 
 380 \newcommand{\didasktekst}[1]{%
 
 383 \newcommand{\slowoobce}[1]{%
 
 386 \newcommand{\tytuldziela}[1]{%
 
 389 \newcommand{\wyroznienie}[1]{%
 
 393 \newcommand{\osoba}[1]{%
 
 397 \newcommand{\sekcjaswiatlo}{%
 
 401 \newcommand{\sekcjaasterysk}{%
 
 408 \newcommand{\separatorlinia}{%
 
 414 \newcommand{\motyw}[2][0]{%
 
 419 \vspace{-#1\baselineskip}%
 
 420 \raggedright{\hspace{0pt}%
 
 421 \footnotesize{\color{theme}{#2}}}%
 
 422 \vspace{\baselineskip}%
 
 428 \newcommand{\editorialpage}[1]{%
 
 433 \newcommand{\titlefield}[1]{%
 
 435 \begin{minipage}[t]{.7\textwidth}%
 
 441 \newcommand{\toplogo}[3]{%
 
 442 \begin{minipage}[t]{.3\textwidth}%
 
 444 \vspace{0pt}{\includegraphics[width=#3]{#1}}%