1 % -*- coding: utf-8 -*-
 
   2 \NeedsTeXFormat{LaTeX2e}
 
   3 \ProvidesClass{wlpub}[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{geometry}
 
  16 \RequirePackage{setspace}
 
  17 \RequirePackage{type1cm}
 
  18 \RequirePackage{amssymb}
 
  19 \RequirePackage{amsmath}
 
  20 \RequirePackage{paralist}
 
  21 \RequirePackage[normalem]{ulem}
 
  22 \RequirePackage{xifthen}
 
  23 \RequirePackage{environ} % environments with \BODY, for wyimek
 
  25 %\DeclareOption{13pt}{%
 
  27 % font size definitions, similar to ones in /usr/share/texmf-texlive/tex/latex/base/
 
  28 %% \renewcommand\normalsize{%
 
  29 %%    \@setfontsize\normalsize{13pt}{14.5pt}%
 
  30 %%    \abovedisplayskip 12\p@ \@plus3\p@ \@minus7\p@
 
  31 %%    \abovedisplayshortskip \z@ \@plus3\p@
 
  32 %%    \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@
 
  33 %%    \belowdisplayskip \abovedisplayskip
 
  34 %%    \let\@listi\@listI}\normalsize%
 
  35 %% \renewcommand\footnotesize{%
 
  36 %%    \@setfontsize\footnotesize\@xpt\@xiipt
 
  37 %%    \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@
 
  38 %%    \abovedisplayshortskip \z@ \@plus3\p@
 
  39 %%    \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@
 
  40 %%    \def\@listi{\leftmargin\leftmargini
 
  41 %%                \topsep 6\p@ \@plus2\p@ \@minus2\p@
 
  42 %%                \parsep 3\p@ \@plus2\p@ \@minus\p@
 
  44 %%    \belowdisplayskip \abovedisplayskip
 
  49 %% \DeclareOption{14pt}{\renewcommand{\normalsize}{\AtEndOfClass{\fontsize{14}{17}\selectfont}}}
 
  51 \DeclareOption{defaultleading}{}
 
  52 \DeclareOption{doubleleading}{\AtBeginDocument{\doublespacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
 
  53 \DeclareOption{onehalfleading}{\AtBeginDocument{\onehalfspacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
 
  55 %% 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.
 
  56 \DeclareOption{a5paper}{%
 
  57       \setlength{\paperheight}{210mm}%
 
  58       \setlength{\paperwidth}{148mm}}
 
  59 % a5paper dropped down size
 
  60 \newif\ifcutafivepaper \cutafivepaperfalse
 
  61 \DeclareOption{a5paperdd}{%
 
  62   \setlength{\paperheight}{225mm}%
 
  63   \setlength{\paperwidth}{160mm}%
 
  67 \newif\ifshowfootnotes \showfootnotestrue
 
  68 \DeclareOption{nofootnotes}{\showfootnotesfalse}
 
  70 \newif\ifshowthemes \showthemestrue
 
  71 \DeclareOption{nothemes}{\showthemesfalse}
 
  73 \newif\ifenablewlfont \enablewlfonttrue
 
  74 \DeclareOption{nowlfont}{\enablewlfontfalse}
 
  77 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{extbook}}
 
  80 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
  85 \usepackage[MeX]{polski}
 
  87 \usepackage[xetex]{graphicx}
 
  91 %\usepackage{trimspaces} % imported by something else?
 
  93 \usepackage[overload]{textcase}
 
  95 \usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=black,xetex,linktocpage]{hyperref}
 
 101 \usepackage[stable]{footmisc}
 
 103 \usepackage{chngcntr}
 
 104 \counterwithout{footnote}{chapter}
 
 106 \usepackage[explicit]{titlesec}
 
 108 %% Wyimki - placing them on correct pages
 
 109 \usepackage{changepage}
 
 110 %\usepackage{fltpage}
 
 114 % bottom figure below footnotes
 
 118 %%%%%%%%%%%%%%%%%%%%%%% Paper size
 
 119 \setlength\baselineskip{7.14pt}
 
 128     right=30mm]{geometry}%
 
 131     top=\dimexpr14.5mm+\baselineskip-16pt\relax, % margin will be smaller to accomodate for bigger header (16pt)
 
 132     headsep=3\baselineskip,
 
 137     textheight=\dimexpr7.14pt*(32*2+1)\relax,%
 
 138     includehead]{geometry}
 
 141 %%%%%%%%%%%%%%%%%%%%%%%% Fonts
 
 144 ItalicFont = CrimsonText-Italic,
 
 145 BoldFont = CrimsonText-Bold,
 
 146 BoldItalicFont = CrimsonText-BoldItalic,
 
 147 Ligatures={Common, Contextual},
 
 148 SmallCapsFont = CrimsonText-Roman,
 
 149 SmallCapsFeatures={Letters=SmallCaps},
 
 152 \newfontface\sb{CrimsonText-Semibold}
 
 153 \newfontface\intro{Archivo-Black}
 
 155 %% For faking small caps You burn in typographic hell.
 
 161   \xdef\fake@name{\csname\curr@fontshape/\f@size\endcsname}%
 
 162   \fontsize{\fontdimen8\fake@name}{\baselineskip}\selectfont%
 
 168 \setlength{\parindent}{3mm}
 
 169 \setlength{\parskip}{0mm}
 
 171 \renewcommand{\normalsize}{\fontsize{10.4}{14.28}\addfontfeature{LetterSpace=3.0}\selectfont}
 
 172 \renewcommand{\large}{\fontsize{14}{14.28}\addfontfeature{LetterSpace=3.0}\selectfont} % srodtytul
 
 173 \renewcommand{\small}{\fontsize{8}{14.28}\addfontfeature{LetterSpace=5.0}\selectfont} % paginy
 
 174 \renewcommand{\Large}{\fontsize{15}{21.42}\addfontfeature{LetterSpace=0.0}\selectfont} % tytuł rozdziału
 
 175 \renewcommand{\huge}{\fontsize{18}{28.56}\addfontfeature{LetterSpace=1.0}\selectfont} % wyimek
 
 176 \renewcommand{\Huge}{\fontsize{24}{40}\selectfont} % cover
 
 177 \renewcommand{\footnotesize}{\addfontfeature{LetterSpace=1.0}\fontsize{9}{10.74}\selectfont}
 
 181 \definecolor{stoK}{cmyk}{0,0,0,1}
 
 182 \definecolor{theme}{gray}{.3}
 
 186 %%%%%%%%%%%%%%%%%%%%%% Headings.
 
 189 \renewcommand{\headrulewidth}{0pt}
 
 190 \renewcommand{\footrulewidth}{0pt}
 
 192 %%%%%%%%%% Nagłówek normalny
 
 194 % this will go to \leftmark
 
 195 \renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{#1}}{}}
 
 196 \fancyhead[CE]{{\small\MakeUppercase{\@title}}}
 
 197 \fancyhead[CO]{{\small\leftmark}}
 
 198 \fancyhead[LE,RO]{{\small\intro\thepage}}
 
 199 %%%%%%%%%% Nagłówek pierwszej strony rozdziału
 
 200 \fancypagestyle{plain}{%
 
 202 \fancyhead[LE,RO]{{\small\intro\thepage}}
 
 203 \renewcommand{\headrulewidth}{0pt}
 
 204 \renewcommand{\footrulewidth}{0pt}}
 
 207 %%%%%%%%%%%%%%%%%%%%%% Section title styles.
 
 209 \titleformat{\chapter}[block]%
 
 210 {\Large\intro\addfontfeature{LetterSpace=0.5,Kerning={Uppercase}}}%
 
 211 {}{0pt}{\parbox{80mm}{\raggedright#1}}
 
 212 \newlength{\chapterposcorrection}\newlength{\chapterspaceafter}
 
 213 \setlength{\chapterposcorrection}{-\headsep-2\baselineskip}
 
 214 \setlength{\chapterspaceafter}{14\baselineskip-14pt}%\f@size of large
 
 215 \titlespacing*{\chapter}{0pt}{\chapterposcorrection}{\chapterspaceafter}
 
 218 \titleformat{\section}%
 
 219 {\addfontfeature{LetterSpace=0.3}\large}%
 
 220 {\thesection{}.}{.5em}{\MakeUppercase{#1}}
 
 222 \renewcommand{\thesection}{\Roman{section}}
 
 224 \titleformat{\subsection}[runin]%
 
 226 {\thesubsection{}.}{.5em}{\MakeUppercase{#1}.}[]
 
 228 \renewcommand{\thesubsection}{\Alph{subsection}}
 
 229 \titlespacing*{\subsection}{0pt}{0pt}{.5em}
 
 231 \newcommand{\typosubsubsection}[1]{%
 
 236 \newcommand{\typosubsection}[1]{%
 
 240 \newcommand{\typosection}[1]{%
 
 241 {\addfontfeature{FakeStretch=0.96, LetterSpace=-4.0}\emph{\scalefont{2}#1}}
 
 242 %{\addfontfeature{Scale=2.0, FakeStretch=0.98, LetterSpace=-2.0}\emph{#1}}
 
 244 %%%%%%%%%%%%%%%%%% ^^
 
 246 %%%%% Footnotes (works with footmisc) %%%%%%%%
 
 247 \newlength{\footnoteindent}\newlength{\footnoteprespace}
 
 248 \setlength{\footnoteindent}{6mm}%{3.5mm}
 
 249 \setlength{\footnoteprespace}{0em}
 
 252 \renewcommand\@makefnmark{%
 
 253 \hspace{\footnoteprespace}
 
 254 \hbox{{\normalfont \@thefnmark}}%
 
 256 \renewcommand\thefootnote{[\arabic{footnote}]}
 
 258 \setlength{\footnotemargin}{-\footnoteindent-\footnoteprespace-.3em}
 
 259 \renewcommand\footnotelayout[1]{%
 
 260   \setlength{\leftskip}{\footnoteindent}#1}
 
 262 %% \long\def\@makefntext#1{%
 
 263 %% \setlength{\leftskip}{\footnoteindent}%
 
 264 %% \setlength{\hskip}{-\footnoteindent-\footnoteprespace-.1em}%
 
 265 %% \hb@xt@ \dimexpr\footnoteindent+\footnoteprespace%
 
 267 %% %  \parindent 1em\noindent \hb@xt@ 1.8em{\hss \@makefnmark \enskip}#1
 
 271 \def\trimspace#1{\trim@spaces{#1}}
 
 275 %%%%%%%%%%%%%%%%%%%%%% Wyimki
 
 276 %% \floatstyle{plain}
 
 277 %% \newfloat{wyimekbox}{p}{wmk}
 
 278 %% \floatname{wyimekbox}{Wyimek}
 
 280 \NewEnviron{wyimek}{%
 
 283     \PackageWarning{wlpub}{Wyimek on odd page, omitting it.}
 
 287         \begin{minipage}[t][\textheight][c]{70mm}
 
 300 %%%%%%%%%%%%%%%%%%%%%%%%%%
 
 307 % see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
 
 308 \newsavebox{\ximagebox}\newlength{\ximageheight}
 
 309 \newsavebox{\xglyphbox}\newlength{\xglyphheight}
 
 310 \newcommand{\xbox}[1]
 
 311 {\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximapgebox}}%
 
 312 \savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
 
 313 \raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
 
 314 \makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
 
 316 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
 
 319 \newcommand{\makecover}{
 
 323   %% \paperheight=210mm
 
 325   \newgeometry{paperwidth=297mm,paperheight=210mm}
 
 329   \thispagestyle{empty}
 
 330   \newlength{\PictHOffset}
 
 331   \newlength{\PictVOffset}
 
 332   \setlength{\PictHOffset}{1in}
 
 333   \addtolength{\PictHOffset}{\hoffset}
 
 334   \addtolength{\PictHOffset}{\oddsidemargin}
 
 336   \setlength{\PictVOffset}{1in}
 
 337   \addtolength{\PictVOffset}{\voffset}
 
 338   \addtolength{\PictVOffset}{\topmargin}
 
 339   \addtolength{\PictVOffset}{\headheight}
 
 340   \addtolength{\PictVOffset}{\headsep}
 
 341   \addtolength{\PictVOffset}{\topskip}
 
 343   \addtolength{\PictVOffset}{-\paperheight}
 
 345   \noindent\hspace*{-\PictHOffset}%
 
 346   \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
 
 347       \includegraphics[height=\pdfpageheight,width=\pdfpagewidth]{cover.pdf}}}
 
 355 \renewcommand{\maketitle}{
 
 356   %\vspace{\paperheight}
 
 357   \thispagestyle{empty}
 
 360   \thispagestyle{empty}
 
 365     \Huge \noindent \thetitle
 
 370   \vspace{\baselineskip}
 
 381                   %\indent\emph{You made this book possible.}
 
 382   \vspace{7\baselineskip}
 
 385     \includegraphics[scale=.2]{logo.eps}
 
 391 \newcommand{\editorialsection}{
 
 393   \thispagestyle{empty}
 
 395     \setlength{\parindent}{0mm}
 
 400 \renewcommand*\contentsname{Spis treści}
 
 401 \newcommand{\spistresci}{
 
 404   \setcounter{tocdepth}{0}
 
 413 \newcommand{\tytul}[1]{%
 
 418 \newcommand{\nazwapodutworu}[1]{%
 
 422 \newcommand{\autorutworu}[1]{%
 
 424 %\subsection*{\typosubsection{#1}}%
 
 427 \newcommand{\dzielonadrzedne}[1]{%
 
 431 \newcommand{\nazwautworu}[1]{%
 
 435 \newcommand{\podtytul}[1]{%
 
 436 \subsection*{\typosubsubsection{#1}}%
 
 439 \newcommand{\podtytulpodutworu}[1]{%
 
 440 \subsection*{\typosubsubsection{#1}}%
 
 443 \newcommand{\translator}[1]{%
 
 444 \subsection*{\typosubsubsection{tłum. #1}}%
 
 446 \newcommand{\translatorsline}[1]{%
 
 450 \newcommand{\powiesc}[1]{#1}
 
 451 \newcommand{\opowiadanie}[1]{#1}
 
 452 \newcommand{\lirykal}[1]{#1}
 
 453 \newcommand{\lirykalp}[1]{#1}
 
 454 \newcommand{\dramatwierszowanyl}[1]{#1}
 
 455 \newcommand{\dramatwierszowanylp}[1]{#1}
 
 456 \newcommand{\dramatwspolczesny}[1]{#1}
 
 458 \newcommand{\nota}[1]{%
 
 466 \newcommand{\dedykacja}[1]{%
 
 474 \newcommand{\dlugicytat}[1]{%
 
 480 \newcommand{\poezjacyt}[1]{%
 
 485 \newcommand{\motto}[1]{%
 
 490 \newcommand{\listaosob}[2]{%
 
 497 \newcommand{\nagloweklisty}[1]{%
 
 498 \typosubsubsection{#1}%
 
 501 \newcommand{\listaosoba}[1]{%
 
 505 \newcommand{\kwestia}[1]{%
 
 509 \newcommand{\naglowekakt}[1]{%
 
 511 \subsection*{\typosubsection{#1}}%
 
 513 \newcommand{\naglowekczesc}[1]{%
 
 517 \newcommand{\srodtytul}[1]{%
 
 521 \newcommand{\naglowekscena}[1]{%
 
 522 \subsubsection*{\typosubsubsection{#1}}%
 
 525 \newcommand{\theautorrozdzialu}{}
 
 527 \newcommand{\autorrozdzialu}[1]{%
 
 528 \renewcommand{\theautorrozdzialu}{{\normalfont\normalsize\newline{}\newline{}\emph{#1}}}
 
 532 \newcommand{\naglowekrozdzial}[1]{%
 
 533 \chapter[#1]{\MakeUppercase{#1}\theautorrozdzialu{}}
 
 534 \renewcommand{\theautorrozdzialu}{}%
 
 537 \newcommand{\naglowekosoba}[1]{%
 
 538 \par{\textsc{#1}}\nopagebreak%
 
 540 \newcommand{\naglowekpodrozdzial}[1]{%
 
 541 \section{#1}\nopagebreak%
 
 544 \newcommand{\miejsceczas}[1]{%
 
 547 \newcommand{\didaskalia}[1]{%
 
 551 \newcommand{\akap}[1]{%
 
 554 \newcommand{\akapdialog}[1]{%
 
 557 \newcommand{\akapcd}[1]{%
 
 561 \newcommand{\mottopodpis}[1]{%
 
 569 \newcommand{\strofa}[1]{%
 
 570 \par{\noindent{\ignorespaces#1\vspace{1em}}}%
 
 573 \newcommand{\wers}[1]{#1}
 
 575 \newcommand{\wersakap}[1]{%
 
 578 \newcommand{\werscd}[1]{%
 
 581 \newcommand{\werswciety}[2][1em]{%
 
 586   \newcommand{\pa}[1]{\NoCaseChange{\footnote{#1 [przypis autorski]}}}
 
 587   \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
 
 588   \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
 
 589   \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
 
 591   \newcommand{\pa}[1]{}
 
 592   \newcommand{\pe}[1]{}
 
 593   \newcommand{\pr}[1]{}
 
 594   \newcommand{\pt}[1]{}
 
 597 \newcommand{\mat}[1]{$#1$}
 
 599 \newcommand{\didasktekst}[1]{%
 
 602 \newcommand{\slowoobce}[1]{%
 
 605 \newcommand{\tytuldziela}[1]{%
 
 608 \newcommand{\wyroznienie}[1]{%
 
 612 \newcommand{\osoba}[1]{%
 
 616 \newcommand{\sekcjaswiatlo}{%
 
 617 \vspace{\baselineskip}%
 
 620 \newcommand{\sekcjaasterysk}{%
 
 627 \newcommand{\separatorlinia}{%
 
 633 \newcommand{\ilustrscale}[0]{1}
 
 634 \newcommand{\setilustrscale}[1]{\renewcomand{\ilustrscale}{#1}}
 
 636 \newcommand{\ilustr}[3][]{
 
 637   \vspace{2\baselineskip}%
 
 639     \ifthenelse{\isempty{#1}}%
 
 640     {\par{\includegraphics{\trimspace{#2}}\\#3}}%
 
 641     {\par{\includegraphics[#1]{\trimspace{#2}}\\#3}}%
 
 643   \vspace{2\baselineskip}%
 
 647 \newcommand{\motyw}[2][0]{%
 
 652 \vspace{-#1\baselineskip}%
 
 653 \raggedright{\hspace{0pt}%
 
 654 \footnotesize{\color{theme}{#2}}}%
 
 655 \vspace{\baselineskip}%
 
 660 \newcommand{\lista}[1]{%
 
 662 \setlength{\parskip}{\parindent}
 
 667 \newcommand{\punkt}[1]{%
 
 670 \newcommand{\link}[2]{\href{#1}{\uline{#2}\footnote{#1}}}
 
 672 \newcommand{\www}[1]{{\normalfont\small\href{#1}{#1}}}