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}
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[strict]{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.
216 \titleformat{\chapter}[block]%
217 {\Large\intro\addfontfeature{LetterSpace=0.5,Kerning={Uppercase}}}%
218 {}{0pt}{\parbox{80mm}{\raggedright#1}}
219 \newlength{\chapterposcorrection}\newlength{\chapterspaceafter}
220 \setlength{\chapterposcorrection}{-\headsep-2\baselineskip-2.352mm} % 2.352 is a measured correction:
221 \setlength{\chapterspaceafter}{14\baselineskip-14pt+2.352mm}%\f@size of large
222 \titlespacing*{\chapter}{0pt}{\chapterposcorrection}{\chapterspaceafter}
225 \titleformat{\section}%
226 {\addfontfeature{LetterSpace=0.3}\large}%
227 {\thesection{}.}{.5em}{\MakeTextUppercase{#1}}
229 \renewcommand{\thesection}{\Roman{section}}
231 \titleformat{\subsection}[runin]%
233 {\thesubsection{}.}{.5em}{\MakeTextUppercase{#1}.}[]
235 \renewcommand{\thesubsection}{\Alph{subsection}}
236 \titlespacing*{\subsection}{0pt}{\baselineskip}{.5em}
238 \newcommand{\typosubsubsection}[1]{%
243 \newcommand{\typosubsection}[1]{%
244 {\MakeTextUppercase{#1}}
247 \newcommand{\typosection}[1]{%
248 {\addfontfeature{FakeStretch=0.96, LetterSpace=-4.0}\emph{\scalefont{2}#1}}
249 %{\addfontfeature{Scale=2.0, FakeStretch=0.98, LetterSpace=-2.0}\emph{#1}}
251 %%%%%%%%%%%%%%%%%% ^^
253 %%%%% Footnotes (works with footmisc) %%%%%%%%
254 \newlength{\footnoteindent}\newlength{\footnoteprespace}
255 \setlength{\footnoteindent}{6mm}%{3.5mm}
256 \setlength{\footnoteprespace}{0em}
259 \renewcommand\@makefnmark{%
260 \hspace{\footnoteprespace}
261 \hbox{{\normalfont \@thefnmark}}%
263 \renewcommand\thefootnote{[\arabic{footnote}]}
265 \setlength{\footnotemargin}{-\footnoteindent-\footnoteprespace-.3em}
266 \renewcommand\footnotelayout[1]{%
267 \setlength{\leftskip}{\footnoteindent}#1}
269 %% \long\def\@makefntext#1{%
270 %% \setlength{\leftskip}{\footnoteindent}%
271 %% \setlength{\hskip}{-\footnoteindent-\footnoteprespace-.1em}%
272 %% \hb@xt@ \dimexpr\footnoteindent+\footnoteprespace%
274 %% % \parindent 1em\noindent \hb@xt@ 1.8em{\hss \@makefnmark \enskip}#1
278 \def\trimspace#1{\trim@spaces{#1}}
282 %%%%%%%%%%%%%%%%%%%%%% Wyimki
283 %% \floatstyle{plain}
284 %% \newfloat{wyimekbox}{p}{wmk}
285 %% \floatname{wyimekbox}{Wyimek}
287 \NewEnviron{wyimek}{%
290 \PackageWarning{wlpub}{Wyimek on odd page, omitting it.}
294 \begin{minipage}[t][\textheight][c]{70mm}
307 %%%%%%%%%%%%%%%%%%%%%%%%%%
314 % see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
315 \newsavebox{\ximagebox}\newlength{\ximageheight}
316 \newsavebox{\xglyphbox}\newlength{\xglyphheight}
317 \newcommand{\xbox}[1]
318 {\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximapgebox}}%
319 \savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
320 \raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
321 \makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
323 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
326 \newcommand{\makecover}{
330 %% \paperheight=210mm
332 \newgeometry{paperwidth=297mm,paperheight=210mm}
336 \thispagestyle{empty}
337 \newlength{\PictHOffset}
338 \newlength{\PictVOffset}
339 \setlength{\PictHOffset}{1in}
340 \addtolength{\PictHOffset}{\hoffset}
341 \addtolength{\PictHOffset}{\oddsidemargin}
343 \setlength{\PictVOffset}{1in}
344 \addtolength{\PictVOffset}{\voffset}
345 \addtolength{\PictVOffset}{\topmargin}
346 \addtolength{\PictVOffset}{\headheight}
347 \addtolength{\PictVOffset}{\headsep}
348 \addtolength{\PictVOffset}{\topskip}
350 \addtolength{\PictVOffset}{-\paperheight}
352 \noindent\hspace*{-\PictHOffset}%
353 \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
354 \includegraphics[height=\pdfpageheight,width=\pdfpagewidth]{cover.pdf}}}
362 \renewcommand{\maketitle}{
363 %\vspace{\paperheight}
364 \thispagestyle{empty}
367 \thispagestyle{empty}
372 \Huge \noindent \thetitle
377 \vspace{\baselineskip}
388 %\indent\emph{You made this book possible.}
389 \vspace{7\baselineskip}
392 \includegraphics[scale=.2]{logo.eps}
398 \newcommand{\editorialsection}{
400 \thispagestyle{empty}
402 \setlength{\parindent}{0mm}
407 \renewcommand*\contentsname{Spis treści}
408 \newcommand{\spistresci}{
411 \setcounter{tocdepth}{0}
420 \newcommand{\tytul}[1]{%
425 \newcommand{\nazwapodutworu}[1]{%
429 \newcommand{\autorutworu}[1]{%
431 %\subsection*{\typosubsection{#1}}%
434 \newcommand{\dzielonadrzedne}[1]{%
438 \newcommand{\nazwautworu}[1]{%
442 \newcommand{\podtytul}[1]{%
443 \subsection*{\typosubsubsection{#1}}%
446 \newcommand{\podtytulpodutworu}[1]{%
447 \subsection*{\typosubsubsection{#1}}%
450 \newcommand{\translator}[1]{%
451 \subsection*{\typosubsubsection{tłum. #1}}%
453 \newcommand{\translatorsline}[1]{%
457 \newcommand{\powiesc}[1]{#1}
458 \newcommand{\opowiadanie}[1]{#1}
459 \newcommand{\lirykal}[1]{#1}
460 \newcommand{\lirykalp}[1]{#1}
461 \newcommand{\dramatwierszowanyl}[1]{#1}
462 \newcommand{\dramatwierszowanylp}[1]{#1}
463 \newcommand{\dramatwspolczesny}[1]{#1}
465 \newcommand{\nota}[1]{%
473 \newcommand{\dedykacja}[1]{%
481 \newcommand{\dlugicytat}[1]{%
488 \newcommand{\poezjacyt}[1]{%
493 \newcommand{\motto}[1]{%
498 \newcommand{\listaosob}[2]{%
505 \newcommand{\nagloweklisty}[1]{%
506 \typosubsubsection{#1}%
509 \newcommand{\listaosoba}[1]{%
513 \newcommand{\kwestia}[1]{%
517 \newcommand{\naglowekakt}[1]{%
519 \subsection*{\typosubsection{#1}}%
521 \newcommand{\naglowekczesc}[1]{%
525 \newcommand{\srodtytul}[1]{%
529 \newcommand{\naglowekscena}[1]{%
530 \subsubsection*{\typosubsubsection{#1}}%
533 \newcommand{\theautorrozdzialu}{}
535 \newcommand{\autorrozdzialu}[1]{%
536 \renewcommand{\theautorrozdzialu}{{\normalfont\normalsize\newline{}\newline{}\parbox{\textwidth}{\emph\normalsize #1}}}
540 \newcommand{\naglowekrozdzial}[1]{%
541 \chapter[#1]{\MakeUppercase{#1}\theautorrozdzialu{}}
542 \renewcommand{\theautorrozdzialu}{}%
545 \newcommand{\naglowekosoba}[1]{%
546 \par{\textsc{#1}}\nopagebreak%
548 \newcommand{\naglowekpodrozdzial}[1]{%
549 \section{#1}\nopagebreak%
552 \newcommand{\miejsceczas}[1]{%
555 \newcommand{\didaskalia}[1]{%
559 \newcommand{\akap}[1]{%
562 \newcommand{\akapdialog}[1]{%
565 \newcommand{\akapcd}[1]{%
569 \newcommand{\mottopodpis}[1]{%
577 \newcommand{\strofa}[1]{%
578 \par{\noindent{\ignorespaces#1\vspace{1em}}}%
581 \newcommand{\wers}[1]{#1}
583 \newcommand{\wersakap}[1]{%
586 \newcommand{\werscd}[1]{%
589 \newcommand{\werswciety}[2][1em]{%
594 \newcommand{\pa}[1]{\NoCaseChange{\footnote{#1 [przypis autorski]}}}
595 \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
596 \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
597 \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
599 \newcommand{\pa}[1]{}
600 \newcommand{\pe}[1]{}
601 \newcommand{\pr}[1]{}
602 \newcommand{\pt}[1]{}
605 \newcommand{\mat}[1]{$#1$}
607 \newcommand{\didasktekst}[1]{%
610 \newcommand{\slowoobce}[1]{%
613 \newcommand{\tytuldziela}[1]{%
616 \newcommand{\wyroznienie}[1]{%
620 \newcommand{\osoba}[1]{%
624 \newcommand{\sekcjaswiatlo}{%
625 \vspace{\baselineskip}%
628 \newcommand{\sekcjaasterysk}{%
635 \newcommand{\separatorlinia}{%
641 \newcommand{\ilustrscale}[0]{1}
642 \newcommand{\setilustrscale}[1]{\renewcomand{\ilustrscale}{#1}}
644 \newcommand{\ilustr}[3][]{
645 \vspace{2\baselineskip}%
647 \ifthenelse{\isempty{#1}}%
648 {\par{\includegraphics{\trimspace{#2}}\\#3}}%
649 {\par{\includegraphics[#1]{\trimspace{#2}}\\#3}}%
651 \vspace{2\baselineskip}%
655 \newcommand{\motyw}[2][0]{%
660 \vspace{-#1\baselineskip}%
661 \raggedright{\hspace{0pt}%
662 \footnotesize{\color{theme}{#2}}}%
663 \vspace{\baselineskip}%
668 \newcommand{\lista}[1]{%
670 \setlength{\parskip}{\parindent}
675 \newcommand{\punkt}[1]{%
678 \newcommand{\link}[2]{\href{#1}{\uline{#2}\footnote{#1}}}
680 \newcommand{\www}[1]{{\normalfont\small\href{#1}{#1}}}