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}
24 \RequirePackage{environ} % environments with \BODY, for wyimek
26 %\DeclareOption{13pt}{%
28 % font size definitions, similar to ones in /usr/share/texmf-texlive/tex/latex/base/
29 %% \renewcommand\normalsize{%
30 %% \@setfontsize\normalsize{13pt}{14.5pt}%
31 %% \abovedisplayskip 12\p@ \@plus3\p@ \@minus7\p@
32 %% \abovedisplayshortskip \z@ \@plus3\p@
33 %% \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@
34 %% \belowdisplayskip \abovedisplayskip
35 %% \let\@listi\@listI}\normalsize%
36 %% \renewcommand\footnotesize{%
37 %% \@setfontsize\footnotesize\@xpt\@xiipt
38 %% \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@
39 %% \abovedisplayshortskip \z@ \@plus3\p@
40 %% \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@
41 %% \def\@listi{\leftmargin\leftmargini
42 %% \topsep 6\p@ \@plus2\p@ \@minus2\p@
43 %% \parsep 3\p@ \@plus2\p@ \@minus\p@
45 %% \belowdisplayskip \abovedisplayskip
50 %% \DeclareOption{14pt}{\renewcommand{\normalsize}{\AtEndOfClass{\fontsize{14}{17}\selectfont}}}
52 \DeclareOption{defaultleading}{}
53 \DeclareOption{doubleleading}{\AtBeginDocument{\doublespacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
54 \DeclareOption{onehalfleading}{\AtBeginDocument{\onehalfspacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
56 %% 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.
57 \DeclareOption{a5paper}{%
58 \setlength{\paperheight}{210mm}%
59 \setlength{\paperwidth}{148mm}}
60 % a5paper dropped down size
61 \newif\ifcutafivepaper \cutafivepaperfalse
62 \DeclareOption{a5paperdd}{%
63 \setlength{\paperheight}{225mm}%
64 \setlength{\paperwidth}{160mm}%
68 \newif\ifshowfootnotes \showfootnotestrue
69 \DeclareOption{nofootnotes}{\showfootnotesfalse}
71 \newif\ifshowthemes \showthemestrue
72 \DeclareOption{nothemes}{\showthemesfalse}
74 \newif\ifenablewlfont \enablewlfonttrue
75 \DeclareOption{nowlfont}{\enablewlfontfalse}
78 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{extbook}}
81 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
86 \usepackage[MeX]{polski}
88 \usepackage[xetex]{graphicx}
92 %\usepackage{trimspaces} % imported by something else?
94 \usepackage[overload]{textcase}
96 \usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=black,xetex]{hyperref}
98 \usepackage[explicit]{titlesec}
100 \usepackage{printlen}
102 \usepackage[stable]{footmisc}
104 %% Wyimki - placing them on correct pages
105 \usepackage{changepage}
106 %\usepackage{fltpage}
110 % bottom figure below footnotes
114 %%%%%%%%%%%%%%%%%%%%%%% Paper size
115 \setlength\baselineskip{7.14pt}
124 right=30mm]{geometry}%
127 top=\dimexpr14.5mm+\baselineskip-16pt\relax, % margin will be smaller to accomodate for bigger header (16pt)
128 headsep=3\baselineskip,
133 textheight=\dimexpr7.14pt*(32*2+1)\relax,%
134 includehead]{geometry}
137 %%%%%%%%%%%%%%%%%%%%%%%% Fonts
140 ItalicFont = CrimsonText-Italic,
141 BoldFont = CrimsonText-Bold,
142 BoldItalicFont = CrimsonText-BoldItalic,
143 Ligatures={Common, Contextual},
144 SmallCapsFont = CrimsonText-Roman,
145 SmallCapsFeatures={Letters=SmallCaps},
148 \newfontface\sb{CrimsonText-Semibold}
149 \newfontface\intro{Archivo-Black}
151 %% For faking small caps You burn in typographic hell.
157 \xdef\fake@name{\csname\curr@fontshape/\f@size\endcsname}%
158 \fontsize{\fontdimen8\fake@name}{\baselineskip}\selectfont%
164 \setlength{\parindent}{3mm}
165 \setlength{\parskip}{0mm}
167 \renewcommand{\normalsize}{\fontsize{10.4}{14.28}\addfontfeature{LetterSpace=0.3}\selectfont}
168 \renewcommand{\large}{\fontsize{14}{14.28}\addfontfeature{LetterSpace=0.3}\selectfont} % srodtytul
169 \renewcommand{\small}{\fontsize{8}{14.28}\addfontfeature{LetterSpace=0.5}\selectfont} % paginy
170 \renewcommand{\Large}{\fontsize{15}{21.42}\addfontfeature{LetterSpace=0.1}\selectfont} % tytuł rozdziału
171 \renewcommand{\huge}{\fontsize{18}{28.56}\addfontfeature{LetterSpace=0.1}\selectfont} % wyimek
172 \renewcommand{\Huge}{\fontsize{24}{40}\selectfont} % cover
173 \renewcommand{\footnotesize}{\fontsize{9}{10.74}\selectfont}
177 \definecolor{stoK}{cmyk}{0,0,0,1}
178 \definecolor{theme}{gray}{.3}
182 %%%%%%%%%%%%%%%%%%%%%% Headings.
185 \renewcommand{\headrulewidth}{0pt}
186 \renewcommand{\footrulewidth}{0pt}
188 %%%%%%%%%% Nagłówek normalny
190 % this will go to \leftmark
191 \renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{#1}}{}}
192 \fancyhead[CE]{{\small\MakeUppercase{\@title}}}
193 \fancyhead[CO]{{\small\leftmark}}
194 \fancyhead[LE,RO]{{\small\intro\thepage}}
195 %%%%%%%%%% Nagłówek pierwszej strony rozdziału
196 \fancypagestyle{plain}{%
198 \fancyhead[LE,RO]{{\small\intro\thepage}}
199 \renewcommand{\headrulewidth}{0pt}
200 \renewcommand{\footrulewidth}{0pt}}
203 %%%%%%%%%%%%%%%%%%%%%% Section title styles.
205 \titleformat{\chapter}[block]%
206 {\Large\intro\addfontfeature{LetterSpace=0.5,Kerning={Uppercase}}}%
207 {}{0pt}{\parbox{80mm}{\raggedright\MakeUppercase{#1}}}
208 \newlength{\chapterposcorrection}\newlength{\chapterspaceafter}
209 \setlength{\chapterposcorrection}{-\headsep-2\baselineskip}
210 \setlength{\chapterspaceafter}{14\baselineskip-14pt}%\f@size of large
211 \titlespacing*{\chapter}{0pt}{\chapterposcorrection}{\chapterspaceafter}
214 \titleformat{\section}%
215 {\addfontfeature{LetterSpace=0.3}\large}%
216 {\thesection{}.}{.5em}{\MakeUppercase{#1}}
218 \renewcommand{\thesection}{\Roman{section}}
220 \titleformat{\subsection}[runin]%
222 {\thesubsection{}.}{.5em}{\MakeUppercase{#1}.}[]
224 \renewcommand{\thesubsection}{\Alph{subsection}}
225 \titlespacing*{\subsection}{0pt}{0pt}{.5em}
227 \newcommand{\typosubsubsection}[1]{%
232 \newcommand{\typosubsection}[1]{%
236 \newcommand{\typosection}[1]{%
237 {\addfontfeature{FakeStretch=0.96, LetterSpace=-4.0}\emph{\scalefont{2}#1}}
238 %{\addfontfeature{Scale=2.0, FakeStretch=0.98, LetterSpace=-2.0}\emph{#1}}
240 %%%%%%%%%%%%%%%%%% ^^
242 %%%%% Footnotes (works with footmisc) %%%%%%%%
243 \newlength{\footnoteindent}\newlength{\footnoteprespace}
244 \setlength{\footnoteindent}{6mm}%{3.5mm}
245 \setlength{\footnoteprespace}{0em}
248 \renewcommand\@makefnmark{%
249 \hspace{\footnoteprespace}
250 \hbox{{\normalfont \@thefnmark}}%
252 \renewcommand\thefootnote{[\arabic{footnote}]}
254 \setlength{\footnotemargin}{-\footnoteindent-\footnoteprespace-.3em}
255 \renewcommand\footnotelayout[1]{%
256 \setlength{\leftskip}{\footnoteindent}#1}
258 %% \long\def\@makefntext#1{%
259 %% \setlength{\leftskip}{\footnoteindent}%
260 %% \setlength{\hskip}{-\footnoteindent-\footnoteprespace-.1em}%
261 %% \hb@xt@ \dimexpr\footnoteindent+\footnoteprespace%
263 %% % \parindent 1em\noindent \hb@xt@ 1.8em{\hss \@makefnmark \enskip}#1
267 \def\trimspace#1{\trim@spaces{#1}}
271 %%%%%%%%%%%%%%%%%%%%%% Wyimki
272 %% \floatstyle{plain}
273 %% \newfloat{wyimekbox}{p}{wmk}
274 %% \floatname{wyimekbox}{Wyimek}
276 \NewEnviron{wyimek}{%
279 \PackageWarning{wlpub}{Wyimek on odd page, omitting it.}
283 \begin{minipage}[t][\textheight][c]{70mm}
296 %%%%%%%%%%%%%%%%%%%%%%%%%%
303 % see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
304 \newsavebox{\ximagebox}\newlength{\ximageheight}
305 \newsavebox{\xglyphbox}\newlength{\xglyphheight}
306 \newcommand{\xbox}[1]
307 {\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximapgebox}}%
308 \savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
309 \raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
310 \makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
312 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
315 \newcommand{\makecover}{
319 \thispagestyle{empty}
320 \newlength{\PictHOffset}
321 \newlength{\PictVOffset}
322 \setlength{\PictHOffset}{1in}
323 \addtolength{\PictHOffset}{\hoffset}
324 \addtolength{\PictHOffset}{\oddsidemargin}
326 \setlength{\PictVOffset}{1in}
327 \addtolength{\PictVOffset}{\voffset}
328 \addtolength{\PictVOffset}{\topmargin}
329 \addtolength{\PictVOffset}{\headheight}
330 \addtolength{\PictVOffset}{\headsep}
331 \addtolength{\PictVOffset}{\topskip}
333 \addtolength{\PictVOffset}{-\paperheight}
335 \noindent\hspace*{-\PictHOffset}%
336 \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
337 \includegraphics[height=\paperheight,width=\paperwidth]{cover.jpg}}}
341 \renewcommand{\maketitle}{
342 %\vspace{\paperheight}
344 \thispagestyle{empty}
349 \Huge \noindent \thetitle
354 \vspace{\baselineskip}
365 %\indent\emph{You made this book possible.}
366 \vspace{7\baselineskip}
369 \includegraphics[scale=.2]{logo.eps}
375 \newcommand{\editorialsection}{
377 \thispagestyle{empty}
381 \renewcommand*\contentsname{Table of Contents}
382 \newcommand{\spistresci}{
385 \setcounter{tocdepth}{0}
394 \newcommand{\tytul}[1]{%
399 \newcommand{\nazwapodutworu}[1]{%
403 \newcommand{\autorutworu}[1]{%
405 %\subsection*{\typosubsection{#1}}%
408 \newcommand{\dzielonadrzedne}[1]{%
412 \newcommand{\nazwautworu}[1]{%
416 \newcommand{\podtytul}[1]{%
417 \subsection*{\typosubsubsection{#1}}%
420 \newcommand{\podtytulpodutworu}[1]{%
421 \subsection*{\typosubsubsection{#1}}%
424 \newcommand{\translator}[1]{%
425 \subsection*{\typosubsubsection{tłum. #1}}%
427 \newcommand{\translatorsline}[1]{%
431 \newcommand{\powiesc}[1]{#1}
432 \newcommand{\opowiadanie}[1]{#1}
433 \newcommand{\lirykal}[1]{#1}
434 \newcommand{\lirykalp}[1]{#1}
435 \newcommand{\dramatwierszowanyl}[1]{#1}
436 \newcommand{\dramatwierszowanylp}[1]{#1}
437 \newcommand{\dramatwspolczesny}[1]{#1}
439 \newcommand{\nota}[1]{%
447 \newcommand{\dedykacja}[1]{%
455 \newcommand{\dlugicytat}[1]{%
461 \newcommand{\poezjacyt}[1]{%
466 \newcommand{\motto}[1]{%
471 \newcommand{\listaosob}[2]{%
478 \newcommand{\nagloweklisty}[1]{%
479 \typosubsubsection{#1}%
482 \newcommand{\listaosoba}[1]{%
486 \newcommand{\kwestia}[1]{%
490 \newcommand{\naglowekakt}[1]{%
492 \subsection*{\typosubsection{#1}}%
494 \newcommand{\naglowekczesc}[1]{%
498 \newcommand{\srodtytul}[1]{%
502 \newcommand{\naglowekscena}[1]{%
503 \subsubsection*{\typosubsubsection{#1}}%
506 \newcommand{\theautorrozdzialu}{}
508 \newcommand{\autorrozdzialu}[1]{%
509 \renewcommand{\theautorrozdzialu}{\newline{}{\normalfont by}\newline#1}
512 \newcommand{\naglowekrozdzial}[1]{%
513 \chapter[#1]{#1\theautorrozdzialu{}}\renewcommand{\theautorrozdzialu}{}%
516 \newcommand{\naglowekosoba}[1]{%
517 \par{\textsc{#1}}\nopagebreak%
519 \newcommand{\naglowekpodrozdzial}[1]{%
520 \section{#1}\nopagebreak%
523 \newcommand{\miejsceczas}[1]{%
526 \newcommand{\didaskalia}[1]{%
530 \newcommand{\akap}[1]{%
533 \newcommand{\akapdialog}[1]{%
536 \newcommand{\akapcd}[1]{%
540 \newcommand{\mottopodpis}[1]{%
548 \newcommand{\strofa}[1]{%
549 \par{\noindent{\ignorespaces#1\vspace{1em}}}%
552 \newcommand{\wers}[1]{#1}
554 \newcommand{\wersakap}[1]{%
557 \newcommand{\werscd}[1]{%
560 \newcommand{\werswciety}[2][1em]{%
565 \newcommand{\pa}[1]{\NoCaseChange{\footnote{#1 [przypis autorski]}}}
566 \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
567 \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
568 \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
570 \newcommand{\pa}[1]{}
571 \newcommand{\pe}[1]{}
572 \newcommand{\pr}[1]{}
573 \newcommand{\pt}[1]{}
576 \newcommand{\mat}[1]{$#1$}
578 \newcommand{\didasktekst}[1]{%
581 \newcommand{\slowoobce}[1]{%
584 \newcommand{\tytuldziela}[1]{%
587 \newcommand{\wyroznienie}[1]{%
591 \newcommand{\osoba}[1]{%
595 \newcommand{\sekcjaswiatlo}{%
599 \newcommand{\sekcjaasterysk}{%
606 \newcommand{\separatorlinia}{%
612 \newcommand{\ilustrscale}[0]{1}
613 \newcommand{\setilustrscale}[1]{\renewcomand{\ilustrscale}{#1}}
615 \newcommand{\ilustr}[3][]{
616 \vspace{2\baselineskip}%
618 \ifthenelse{\isempty{#1}}%
619 {\par{\includegraphics{\trimspace{#2}}\\#3}}%
620 {\par{\includegraphics[#1]{\trimspace{#2}}\\#3}}%
622 \vspace{2\baselineskip}%
626 \newcommand{\motyw}[2][0]{%
631 \vspace{-#1\baselineskip}%
632 \raggedright{\hspace{0pt}%
633 \footnotesize{\color{theme}{#2}}}%
634 \vspace{\baselineskip}%
639 \newcommand{\lista}[1]{%
645 \newcommand{\punkt}[1]{%
648 \newcommand{\link}[2]{\href{#1}{\uline{#2}\footnote{#1}}}
650 \newcommand{\www}[1]{{\normalfont\small\href{#1}{#1}}}