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}
17 \RequirePackage{setspace}
18 \RequirePackage{type1cm}
19 \RequirePackage{amssymb}
20 \RequirePackage{amsmath}
21 \RequirePackage{paralist}
22 \RequirePackage[normalem]{ulem}
23 \RequirePackage{xifthen}
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}
93 \usepackage[overload]{textcase}
95 \usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=black,xetex]{hyperref}
97 \usepackage[explicit]{titlesec}
101 \usepackage[stable]{footmisc}
104 % bottom figure below footnotes
108 %%%%%%%%%%%%%%%%%%%%%%% Paper size
109 \setlength\baselineskip{7.14pt}
118 right=30mm]{geometry}%
121 top=\dimexpr14.5mm+\baselineskip-16pt\relax, % margin will be smaller to accomodate for bigger header (16pt)
122 headsep=3\baselineskip,
127 textheight=\dimexpr7.14pt*(32*2+1)\relax,%
128 includehead]{geometry}
131 %%%%%%%%%%%%%%%%%%%%%%%% Fonts
134 ItalicFont = CrimsonText-Italic,
135 BoldFont = CrimsonText-Bold,
136 BoldItalicFont = CrimsonText-BoldItalic,
137 Ligatures={Common, Contextual},
138 SmallCapsFont = CrimsonText-Roman,
139 SmallCapsFeatures={Letters=SmallCaps},
142 \newfontface\sb{CrimsonText-Semibold}
143 \newfontface\intro{Archivo-Black}
145 %% For faking small caps You burn in typographic hell.
151 \xdef\fake@name{\csname\curr@fontshape/\f@size\endcsname}%
152 \fontsize{\fontdimen8\fake@name}{\baselineskip}\selectfont%
158 \setlength{\parindent}{3mm}
159 \setlength{\parskip}{0mm}
161 \renewcommand{\normalsize}{\fontsize{10.4}{14.28}\addfontfeature{LetterSpace=0.3}\selectfont}
162 \renewcommand{\large}{\fontsize{14}{14.28}\addfontfeature{LetterSpace=0.3}\selectfont} % srodtytul
163 \renewcommand{\small}{\fontsize{8}{14.28}\addfontfeature{LetterSpace=0.5}\selectfont} % paginy
164 \renewcommand{\Large}{\fontsize{15}{21.42}\addfontfeature{LetterSpace=0.1}\selectfont} % tytuł rozdziału
165 \renewcommand{\huge}{\fontsize{18}{21.6}\addfontfeature{LetterSpace=0.1}\selectfont} % wyimek
166 \renewcommand{\Huge}{\fontsize{24}{40}\selectfont} % cover
167 \renewcommand{\footnotesize}{\fontsize{9}{10.74}\selectfont}
171 \definecolor{stoK}{cmyk}{0,0,0,1}
172 \definecolor{theme}{gray}{.3}
176 %%%%%%%%%%%%%%%%%%%%%% Headings.
179 \renewcommand{\headrulewidth}{0pt}
180 \renewcommand{\footrulewidth}{0pt}
182 %%%%%%%%%% Nagłówek normalny
184 % this will go to \leftmark
185 \renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{#1}}{}}
186 \fancyhead[CE]{{\small\MakeUppercase{\@title}}}
187 \fancyhead[CO]{{\small\leftmark}}
188 \fancyhead[LE,RO]{{\small\intro\thepage}}
189 %%%%%%%%%% Nagłówek pierwszej strony rozdziału
190 \fancypagestyle{plain}{%
192 \fancyhead[LE,RO]{{\small\intro\thepage}}
193 \renewcommand{\headrulewidth}{0pt}
194 \renewcommand{\footrulewidth}{0pt}}
197 %%%%%%%%%%%%%%%%%%%%%% Section title styles.
199 \titleformat{\chapter}[block]%
200 {\Large\intro\addfontfeature{LetterSpace=0.5,Kerning={Uppercase}}}%
201 {}{0pt}{\parbox{80mm}{\raggedright\MakeUppercase{#1}}}
202 \newlength{\chapterposcorrection}\newlength{\chapterspaceafter}
203 \setlength{\chapterposcorrection}{-\headsep-2\baselineskip}
204 \setlength{\chapterspaceafter}{14\baselineskip-14pt}%\f@size of large
205 \titlespacing*{\chapter}{0pt}{\chapterposcorrection}{\chapterspaceafter}
208 \titleformat{\section}%
209 {\addfontfeature{LetterSpace=0.3}\large}%
210 {\thesection{}.}{.5em}{\MakeUppercase{#1}}
212 \renewcommand{\thesection}{\Roman{section}}
214 \titleformat{\subsection}[runin]%
216 {\thesubsection{}.}{.5em}{\MakeUppercase{#1}.}[]
218 \renewcommand{\thesubsection}{\Alph{subsection}}
219 \titlespacing*{\subsection}{0pt}{0pt}{.5em}
221 \newcommand{\typosubsubsection}[1]{%
226 \newcommand{\typosubsection}[1]{%
230 \newcommand{\typosection}[1]{%
231 {\addfontfeature{FakeStretch=0.96, LetterSpace=-4.0}\emph{\scalefont{2}#1}}
232 %{\addfontfeature{Scale=2.0, FakeStretch=0.98, LetterSpace=-2.0}\emph{#1}}
234 %%%%%%%%%%%%%%%%%% ^^
236 %%%%% Footnotes (works with footmisc) %%%%%%%%
237 \newlength{\footnoteindent}\newlength{\footnoteprespace}
238 \setlength{\footnoteindent}{6mm}%{3.5mm}
239 \setlength{\footnoteprespace}{0em}
242 \renewcommand\@makefnmark{%
243 \hspace{\footnoteprespace}
244 \hbox{{\normalfont \@thefnmark}}%
246 \renewcommand\thefootnote{[\arabic{footnote}]}
248 \setlength{\footnotemargin}{-\footnoteindent-\footnoteprespace-.3em}
249 \renewcommand\footnotelayout[1]{%
250 \setlength{\leftskip}{\footnoteindent}#1}
252 %% \long\def\@makefntext#1{%
253 %% \setlength{\leftskip}{\footnoteindent}%
254 %% \setlength{\hskip}{-\footnoteindent-\footnoteprespace-.1em}%
255 %% \hb@xt@ \dimexpr\footnoteindent+\footnoteprespace%
257 %% % \parindent 1em\noindent \hb@xt@ 1.8em{\hss \@makefnmark \enskip}#1
260 \def\trimspace#1{\trim@spaces{#1}}
269 % see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
270 \newsavebox{\ximagebox}\newlength{\ximageheight}
271 \newsavebox{\xglyphbox}\newlength{\xglyphheight}
272 \newcommand{\xbox}[1]
273 {\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximagebox}}%
274 \savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
275 \raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
276 \makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
278 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
281 \newcommand{\makecover}{
285 \thispagestyle{empty}
286 \newlength{\PictHOffset}
287 \newlength{\PictVOffset}
288 \setlength{\PictHOffset}{1in}
289 \addtolength{\PictHOffset}{\hoffset}
290 \addtolength{\PictHOffset}{\oddsidemargin}
292 \setlength{\PictVOffset}{1in}
293 \addtolength{\PictVOffset}{\voffset}
294 \addtolength{\PictVOffset}{\topmargin}
295 \addtolength{\PictVOffset}{\headheight}
296 \addtolength{\PictVOffset}{\headsep}
297 \addtolength{\PictVOffset}{\topskip}
299 \addtolength{\PictVOffset}{-\paperheight}
301 \noindent\hspace*{-\PictHOffset}%
302 \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
303 \includegraphics[height=\paperheight,width=\paperwidth]{cover.jpg}}}
307 \renewcommand{\maketitle}{
308 %\vspace{\paperheight}
310 \thispagestyle{empty}
315 \Huge \noindent \thetitle
320 \vspace{\baselineskip}
331 %\indent\emph{You made this book possible.}
332 \vspace{7\baselineskip}
335 \includegraphics[scale=.2]{logo.eps}
341 \newcommand{\editorialsection}{
343 \thispagestyle{empty}
347 \renewcommand*\contentsname{Table of Contents}
348 \newcommand{\spistresci}{
351 \setcounter{tocdepth}{0}
360 \newcommand{\tytul}[1]{%
365 \newcommand{\nazwapodutworu}[1]{%
369 \newcommand{\autorutworu}[1]{%
371 %\subsection*{\typosubsection{#1}}%
374 \newcommand{\dzielonadrzedne}[1]{%
378 \newcommand{\nazwautworu}[1]{%
382 \newcommand{\podtytul}[1]{%
383 \subsection*{\typosubsubsection{#1}}%
386 \newcommand{\podtytulpodutworu}[1]{%
387 \subsection*{\typosubsubsection{#1}}%
390 \newcommand{\translator}[1]{%
391 \subsection*{\typosubsubsection{tłum. #1}}%
393 \newcommand{\translatorsline}[1]{%
397 \newcommand{\powiesc}[1]{#1}
398 \newcommand{\opowiadanie}[1]{#1}
399 \newcommand{\lirykal}[1]{#1}
400 \newcommand{\lirykalp}[1]{#1}
401 \newcommand{\dramatwierszowanyl}[1]{#1}
402 \newcommand{\dramatwierszowanylp}[1]{#1}
403 \newcommand{\dramatwspolczesny}[1]{#1}
405 \newcommand{\nota}[1]{%
413 \newcommand{\dedykacja}[1]{%
421 \newcommand{\dlugicytat}[1]{%
427 \newcommand{\poezjacyt}[1]{%
432 \newcommand{\motto}[1]{%
437 \newcommand{\listaosob}[2]{%
444 \newcommand{\nagloweklisty}[1]{%
445 \typosubsubsection{#1}%
448 \newcommand{\listaosoba}[1]{%
452 \newcommand{\kwestia}[1]{%
456 \newcommand{\naglowekakt}[1]{%
458 \subsection*{\typosubsection{#1}}%
460 \newcommand{\naglowekczesc}[1]{%
464 \newcommand{\srodtytul}[1]{%
468 \newcommand{\naglowekscena}[1]{%
469 \subsubsection*{\typosubsubsection{#1}}%
472 \newcommand{\theautorrozdzialu}{}
474 \newcommand{\autorrozdzialu}[1]{%
475 \renewcommand{\theautorrozdzialu}{\newline{}{\normalfont by}\newline#1}
478 \newcommand{\naglowekrozdzial}[1]{%
479 \chapter[#1]{#1\theautorrozdzialu{}}\renewcommand{\theautorrozdzialu}{}%
482 \newcommand{\naglowekosoba}[1]{%
483 \par{\textsc{#1}}\nopagebreak%
485 \newcommand{\naglowekpodrozdzial}[1]{%
486 \section{#1}\nopagebreak%
489 \newcommand{\miejsceczas}[1]{%
492 \newcommand{\didaskalia}[1]{%
496 \newcommand{\akap}[1]{%
499 \newcommand{\akapdialog}[1]{%
502 \newcommand{\akapcd}[1]{%
506 \newcommand{\mottopodpis}[1]{%
514 \newcommand{\strofa}[1]{%
515 \par{\noindent{\ignorespaces#1\vspace{1em}}}%
518 \newcommand{\wers}[1]{#1}
520 \newcommand{\wersakap}[1]{%
523 \newcommand{\werscd}[1]{%
526 \newcommand{\werswciety}[2][1em]{%
531 \newcommand{\pa}[1]{\NoCaseChange{\footnote{#1 [przypis autorski]}}}
532 \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
533 \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
534 \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
536 \newcommand{\pa}[1]{}
537 \newcommand{\pe}[1]{}
538 \newcommand{\pr}[1]{}
539 \newcommand{\pt}[1]{}
542 \newcommand{\mat}[1]{$#1$}
544 \newcommand{\didasktekst}[1]{%
547 \newcommand{\slowoobce}[1]{%
550 \newcommand{\tytuldziela}[1]{%
553 \newcommand{\wyroznienie}[1]{%
557 \newcommand{\osoba}[1]{%
561 \newcommand{\sekcjaswiatlo}{%
565 \newcommand{\sekcjaasterysk}{%
572 \newcommand{\separatorlinia}{%
578 \newcommand{\ilustrscale}[0]{1}
579 \newcommand{\setilustrscale}[1]{\renewcomand{\ilustrscale}{#1}}
581 \newcommand{\ilustr}[3][]{
582 \vspace{2\baselineskip}%
584 \ifthenelse{\isempty{#1}}%
585 {\par{\includegraphics{\trimspace{#2}}\\#3}}%
586 {\par{\includegraphics[#1]{\trimspace{#2}}\\#3}}%
588 \vspace{2\baselineskip}%
592 \newcommand{\motyw}[2][0]{%
597 \vspace{-#1\baselineskip}%
598 \raggedright{\hspace{0pt}%
599 \footnotesize{\color{theme}{#2}}}%
600 \vspace{\baselineskip}%
605 \newcommand{\lista}[1]{%
611 \newcommand{\punkt}[1]{%
614 \newcommand{\link}[2]{\href{#1}{\uline{#2}\footnote{#1}}}
616 \newcommand{\www}[1]{{\normalfont\small\href{#1}{#1}}}