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
24 %\RequirePackage{indentfirst}
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}
88 \usepackage[silent]{fontspec} % silent - no warnings, quiet - warn only to log
91 %\usepackage{trimspaces} % imported by something else?
93 \usepackage[overload]{textcase}
95 \usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=black,xetex,linktocpage]{hyperref}
96 %\usepackage{hyperref}
100 \usepackage{printlen}
102 \usepackage[stable]{footmisc}
104 \usepackage{chngcntr}
105 \counterwithout{footnote}{chapter}
107 \usepackage[explicit]{titlesec}
108 \usepackage{microtype}
110 %% Wyimki - placing them on correct pages
111 \usepackage{changepage}
112 %\usepackage{fltpage}
116 % bottom figure below footnotes
119 %%% Hyphenation opts:
122 \emergencystretch=30pt
125 %%%%%%%%%%%%%%%%%%%%%%% Paper size
126 \setlength\baselineskip{7.14pt}
135 right=30mm]{geometry}%
138 top=\dimexpr14.5mm+\baselineskip-16pt\relax, % margin will be smaller to accomodate for bigger header (16pt)
139 headsep=3\baselineskip,
144 textheight=\dimexpr7.14pt*(32*2+1)\relax,%
145 includehead]{geometry}
148 %%%%%%%%%%%%%%%%%%%%%%%% Fonts
151 ItalicFont = CrimsonText-Italic,
152 BoldFont = CrimsonText-Bold,
153 BoldItalicFont = CrimsonText-BoldItalic,
154 Ligatures={Common, Contextual},
155 SmallCapsFont = CrimsonText-Roman,
156 SmallCapsFeatures={Letters=SmallCaps},
159 \newfontface\sb{CrimsonText-Semibold}
160 \newfontface\intro{Archivo-Black}
162 %% For faking small caps You burn in typographic hell.
168 \xdef\fake@name{\csname\curr@fontshape/\f@size\endcsname}%
169 \fontsize{\fontdimen8\fake@name}{\baselineskip}\selectfont%
175 \setlength{\parindent}{3mm}
176 \setlength{\parskip}{0mm}
178 \renewcommand{\normalsize}{\fontsize{10.4}{14.28}\addfontfeature{LetterSpace=3.0}\selectfont}
179 \renewcommand{\large}{\fontsize{14}{14.28}\addfontfeature{LetterSpace=3.0,Letters=Uppercase}\selectfont} % srodtytul
180 \renewcommand{\small}{\fontsize{8}{14.28}\addfontfeature{LetterSpace=5.0}\selectfont} % paginy
181 \renewcommand{\Large}{\fontsize{15}{21.42}\addfontfeature{LetterSpace=0.0}\selectfont} % tytuł rozdziału
182 \renewcommand{\huge}{\fontsize{18}{28.56}\addfontfeature{LetterSpace=1.0}\selectfont} % wyimek
183 \renewcommand{\Huge}{\fontsize{24}{40}\selectfont} % cover
184 \renewcommand{\footnotesize}{\addfontfeature{LetterSpace=1.0}\fontsize{9}{10.74}\selectfont}
188 \definecolor{stoK}{cmyk}{0,0,0,1}
189 \definecolor{theme}{gray}{.3}
193 %%%%%%%%%%%%%%%%%%%%%% Headings.
196 \renewcommand{\headrulewidth}{0pt}
197 \renewcommand{\footrulewidth}{0pt}
199 %%%%%%%%%% Nagłówek normalny
201 % this will go to \leftmark
202 \renewcommand{\chaptermark}[1]{\markboth{\MakeTextUppercase{#1}}{}}
203 \fancyhead[CE]{{\small\MakeTextUppercase{\@author, \@title}}}
204 \fancyhead[CO]{{\small\leftmark}}
205 \fancyhead[LE,RO]{{\small\intro\thepage}}
206 %%%%%%%%%% Nagłówek pierwszej strony rozdziału
207 \fancypagestyle{plain}{%
209 \fancyhead[LE,RO]{{\small\intro\thepage}}
210 \renewcommand{\headrulewidth}{0pt}
211 \renewcommand{\footrulewidth}{0pt}}
214 %%%%%%%%%%%%%%%%%%%%%% Section title styles.
217 % No chapter numbers in TOC
218 \renewcommand{\thechapter}{}
220 \titleformat{\chapter}[block]%
221 {\Large\intro\addfontfeature{LetterSpace=0.5,Kerning={Uppercase}}}%
222 {}{0pt}{\parbox{80mm}{\raggedright#1}}
223 \newlength{\chapterposcorrection}\newlength{\chapterspaceafter}
224 \setlength{\chapterposcorrection}{-\headsep-2\baselineskip-2.352mm} % 2.352 is a measured correction:
225 \setlength{\chapterspaceafter}{14\baselineskip-14pt+2.352mm}%\f@size of large
226 \titlespacing*{\chapter}{0pt}{\chapterposcorrection}{\chapterspaceafter}
229 \titleformat{\section}%
230 {\addfontfeature{LetterSpace=0.3}\large}%
231 {\thesection{}.}{.5em}{\MakeTextUppercase{#1}}
232 \renewcommand{\thesection}{\Roman{section}}
233 \titlespacing*{\section}{0pt}{\baselineskip}{0em}
235 \titleformat{\subsection}[block]%
237 {\thesubsection{}.}{.5em}{\MakeTextUppercase{#1}.}[]
239 \renewcommand{\thesubsection}{\Alph{subsection}}
240 \titlespacing*{\subsection}{0pt}{\baselineskip}{0em}
242 \newcommand{\typosubsubsection}[1]{%
247 \newcommand{\typosubsection}[1]{%
248 {\MakeTextUppercase{#1}}
251 \newcommand{\typosection}[1]{%
252 {\addfontfeature{FakeStretch=0.96, LetterSpace=-4.0}\emph{\scalefont{2}#1}}
253 %{\addfontfeature{Scale=2.0, FakeStretch=0.98, LetterSpace=-2.0}\emph{#1}}
255 %%%%%%%%%%%%%%%%%% ^^
257 %%%%% Footnotes (works with footmisc) %%%%%%%%
258 \newlength{\footnoteindent}\newlength{\footnoteprespace}
259 \setlength{\footnoteindent}{8mm}%{3.5mm}
260 \setlength{\footnoteprespace}{0em}
263 \renewcommand\@makefnmark{%
264 \hspace{\footnoteprespace}
265 \hbox{{\normalfont \@thefnmark}}%
267 \renewcommand\thefootnote{[\arabic{footnote}]}
269 \setlength{\footnotemargin}{-\footnoteindent-\footnoteprespace-.3em}
270 \renewcommand\footnotelayout[1]{%
271 \setlength{\leftskip}{\footnoteindent}#1}
273 %% \long\def\@makefntext#1{%
274 %% \setlength{\leftskip}{\footnoteindent}%
275 %% \setlength{\hskip}{-\footnoteindent-\footnoteprespace-.1em}%
276 %% \hb@xt@ \dimexpr\footnoteindent+\footnoteprespace%
278 %% % \parindent 1em\noindent \hb@xt@ 1.8em{\hss \@makefnmark \enskip}#1
282 \newlength{\myendnoteprespace}\setlength{\myendnoteprespace}{.5em}
283 \newlength{\myendnoteindent}\setlength{\myendnoteindent}{14mm+.5em}
285 \renewcommand\theendnote{[\roman{endnote}]}
286 \renewcommand\makeenmark{\hspace{\myendnoteprespace}\theenmark}
287 \renewcommand{\notesname}{}
288 \newcommand{\authornotes}{
291 \chapter{Przypisy autora}
292 \setlength{\parindent}{0pt}
293 \def\enotesize{\normalsize}
296 %% \newcommand{\@makeentext}[1]{%
297 %% \noindent\theenmark\hspace{\footnoteindent}#1
300 %% \def\enoteformat{\rightskip\z@ \parindent=0em
301 %% \makebox[\myendnoteindent][l]{\makeenmark}} % 12.4mm - measured biggest endnote marker (in Moglen text [xxxviii])
302 \def\enoteformat{\rightskip\z@ \setlength{\leftskip}{\myendnoteindent-\myendnoteprespace} \parindent=0em
303 \leavevmode\llap{\makebox[\myendnoteindent][l]{\makeenmark}}}
307 \def\trimspace#1{\trim@spaces{#1}}
311 %%%%%%%%%%%%%%%%%%%%%% Wyimki
312 %% \floatstyle{plain}
313 %% \newfloat{wyimekbox}{p}{wmk}
314 %% \floatname{wyimekbox}{Wyimek}
316 \NewEnviron{wyimek}{%
319 \PackageWarning{wlpub}{Wyimek on odd page, omitting it ( \BODY )}
323 \begin{minipage}[t][\textheight][c]{70mm}
332 %% wyimek that doesn't leave text in text flow
333 %% TODO: reduce code duplication
334 \NewEnviron{wyimekextra}{%
337 \PackageWarning{wlpub}{Wyimek on odd page, omitting it ( \BODY )}
341 \begin{minipage}[t][\textheight][c]{70mm}
352 %%%%%%%%%%%%%%%%%%%%%%%%%%
358 \doublehyphendemerits=9000
359 \finalhyphendemerits=6000
362 % see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
363 \newsavebox{\ximagebox}\newlength{\ximageheight}
364 \newsavebox{\xglyphbox}\newlength{\xglyphheight}
365 \newcommand{\xbox}[1]
366 {\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximapgebox}}%
367 \savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
368 \raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
369 \makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
371 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
374 \newcommand{\makecover}{
378 %% \paperheight=210mm
380 \newgeometry{paperwidth=297mm,paperheight=210mm}
384 \thispagestyle{empty}
385 \newlength{\PictHOffset}
386 \newlength{\PictVOffset}
387 \setlength{\PictHOffset}{1in}
388 \addtolength{\PictHOffset}{\hoffset}
389 \addtolength{\PictHOffset}{\oddsidemargin}
391 \setlength{\PictVOffset}{1in}
392 \addtolength{\PictVOffset}{\voffset}
393 \addtolength{\PictVOffset}{\topmargin}
394 \addtolength{\PictVOffset}{\headheight}
395 \addtolength{\PictVOffset}{\headsep}
396 \addtolength{\PictVOffset}{\topskip}
398 \addtolength{\PictVOffset}{-\paperheight}
400 \noindent\hspace*{-\PictHOffset}%
401 \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
402 \includegraphics[height=\pdfpageheight,width=\pdfpagewidth]{cover.pdf}}}
410 \renewcommand{\maketitle}{
411 %\vspace{\paperheight}
412 \thispagestyle{empty}
415 \thispagestyle{empty}
420 \Huge \noindent \thetitle
425 \vspace{\baselineskip}
436 %\indent\emph{You made this book possible.}
437 \vspace{7\baselineskip}
440 \includegraphics[scale=.2]{logo.eps}
446 \newcommand{\editorialsection}{
448 \thispagestyle{empty}
450 \setlength{\parindent}{0mm}
456 \renewcommand*\contentsname{Spis treści}
457 \newcommand{\spistresci}{
460 \setcounter{tocdepth}{0}
469 \newcommand{\tytul}[1]{%
474 \newcommand{\nazwapodutworu}[1]{%
478 \newcommand{\autorutworu}[1]{%
480 %\subsection*{\typosubsection{#1}}%
483 \newcommand{\dzielonadrzedne}[1]{%
487 \newcommand{\nazwautworu}[1]{%
491 \newcommand{\podtytul}[1]{%
492 \subsection*{\typosubsubsection{#1}}%
495 \newcommand{\podtytulpodutworu}[1]{%
496 \subsection*{\typosubsubsection{#1}}%
499 \newcommand{\translator}[1]{%
500 \subsection*{\typosubsubsection{tłum. #1}}%
502 \newcommand{\translatorsline}[1]{%
506 \newcommand{\powiesc}[1]{#1}
507 \newcommand{\opowiadanie}[1]{#1}
508 \newcommand{\lirykal}[1]{#1}
509 \newcommand{\lirykalp}[1]{#1}
510 \newcommand{\dramatwierszowanyl}[1]{#1}
511 \newcommand{\dramatwierszowanylp}[1]{#1}
512 \newcommand{\dramatwspolczesny}[1]{#1}
515 \newcommand{\dedykacja}[1]{%
523 \newcommand{\dlugicytat}[1]{%
525 \noindent{}\ignorespaces#1%
530 \newcommand{\poezjacyt}[1]{%
535 \newcommand{\motto}[1]{%
540 \newcommand{\listaosob}[2]{%
547 \newcommand{\nagloweklisty}[1]{%
548 \typosubsubsection{#1}%
551 \newcommand{\listaosoba}[1]{%
555 \newcommand{\kwestia}[1]{%
559 \newcommand{\naglowekakt}[1]{%
561 \subsection*{\typosubsection{#1}}%
563 \newcommand{\naglowekczesc}[1]{%
567 \newcommand{\srodtytul}[1]{%
571 \newcommand{\naglowekscena}[1]{%
572 \subsubsection*{\typosubsubsection{#1}}%
575 \newcommand{\theautorrozdzialu}{}
577 \newcommand{\autorrozdzialu}[1]{%
578 \renewcommand{\theautorrozdzialu}{{\normalfont\normalsize\newline{}\newline{}\parbox{\textwidth}{\normalsize\it #1}}}
582 \newcommand{\naglowekrozdzial}[1]{%
583 \chapter[#1]{\MakeUppercase{#1}\theautorrozdzialu{}}
584 \renewcommand{\theautorrozdzialu}{}%
587 \newcommand{\naglowekosoba}[1]{%
588 \par{\textsc{#1}}\nopagebreak%
590 \newcommand{\naglowekpodrozdzial}[1]{%
591 \section{#1}\nopagebreak%
594 \newcommand{\miejsceczas}[1]{%
597 \newcommand{\didaskalia}[1]{%
601 \newcommand{\akap}[1]{%
604 % newline here needed, we don't use \par cause it ignores \noindent before
606 \newcommand{\akapdialog}[1]{%
609 \newcommand{\akapcd}[1]{%
613 \newcommand{\mottopodpis}[1]{%
621 \newcommand{\strofa}[1]{%
622 #1\vspace{\baselineskip}%
625 \newcommand{\wers}[1]{#1}
627 \newcommand{\wersakap}[1]{%
630 \newcommand{\werscd}[1]{%
633 \newcommand{\werswciety}[2][1em]{%
638 \newcommand{\pa}[1]{\NoCaseChange{\endnote{#1}}}
639 \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
640 \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
641 \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
643 \newcommand{\pa}[1]{}
644 \newcommand{\pe}[1]{}
645 \newcommand{\pr}[1]{}
646 \newcommand{\pt}[1]{}
649 \newcommand{\mat}[1]{$#1$}
651 \newcommand{\didasktekst}[1]{%
654 \newcommand{\slowoobce}[1]{%
659 \newif\ifinnota \innotafalse
661 \newcommand{\tytuldziela}[1]{%
670 \newcommand{\wyroznienie}[1]{%
674 \newcommand{\nota}[1]{%
679 \noindent{}\small{}#1%
686 \newcommand{\osoba}[1]{%
690 \newcommand{\sekcjaswiatlo}{%
691 \vspace{\baselineskip}%
694 \newcommand{\sekcjaasterysk}{%
695 \vspace{\baselineskip}%
701 \newcommand{\separatorlinia}{%
707 \newcommand{\ilustrscale}[0]{1}
708 \newcommand{\setilustrscale}[1]{\renewcomand{\ilustrscale}{#1}}
710 \newcommand{\ilustr}[3][]{
712 \ifthenelse{\isempty{#1}}%
713 {\par{\includegraphics{\trimspace{#2}}\\#3}}%
714 {\par{\includegraphics[#1]{\trimspace{#2}}\\#3}}%
719 \newcommand{\motyw}[2][0]{%
724 \vspace{-#1\baselineskip}%
725 \raggedright{\hspace{0pt}%
726 \footnotesize{\color{theme}{#2}}}%
727 \vspace{\baselineskip}%
732 \newcommand{\lista}[1]{%
734 %\setlength{\parskip}{\parindent}
739 \newcommand{\punkt}[1]{%
742 \newcommand{\link}[2]{\href{#1}{\uline{#2}\footnote{#1}}}
744 \newcommand{\www}[1]{{\normalfont\href{#1}{#1}}}