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 %\DeclareOption{13pt}{%
25 % font size definitions, similar to ones in /usr/share/texmf-texlive/tex/latex/base/
26 %% \renewcommand\normalsize{%
27 %% \@setfontsize\normalsize{13pt}{14.5pt}%
28 %% \abovedisplayskip 12\p@ \@plus3\p@ \@minus7\p@
29 %% \abovedisplayshortskip \z@ \@plus3\p@
30 %% \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@
31 %% \belowdisplayskip \abovedisplayskip
32 %% \let\@listi\@listI}\normalsize%
33 %% \renewcommand\footnotesize{%
34 %% \@setfontsize\footnotesize\@xpt\@xiipt
35 %% \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@
36 %% \abovedisplayshortskip \z@ \@plus3\p@
37 %% \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@
38 %% \def\@listi{\leftmargin\leftmargini
39 %% \topsep 6\p@ \@plus2\p@ \@minus2\p@
40 %% \parsep 3\p@ \@plus2\p@ \@minus\p@
42 %% \belowdisplayskip \abovedisplayskip
47 %% \DeclareOption{14pt}{\renewcommand{\normalsize}{\AtEndOfClass{\fontsize{14}{17}\selectfont}}}
49 \DeclareOption{defaultleading}{}
50 \DeclareOption{doubleleading}{\AtBeginDocument{\doublespacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
51 \DeclareOption{onehalfleading}{\AtBeginDocument{\onehalfspacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
53 %% 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.
54 \DeclareOption{a5paper}{%
55 \setlength{\paperheight}{210mm}%
56 \setlength{\paperwidth}{148mm}}
57 % a5paper dropped down size
58 \newif\ifcutafivepaper \cutafivepaperfalse
59 \DeclareOption{a5paperdd}{%
60 \setlength{\paperheight}{225mm}%
61 \setlength{\paperwidth}{160mm}%
65 \newif\ifshowfootnotes \showfootnotestrue
66 \DeclareOption{nofootnotes}{\showfootnotesfalse}
68 \newif\ifshowthemes \showthemestrue
69 \DeclareOption{nothemes}{\showthemesfalse}
71 \newif\ifenablewlfont \enablewlfonttrue
72 \DeclareOption{nowlfont}{\enablewlfontfalse}
75 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{extbook}}
78 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
83 \usepackage[MeX]{polski}
85 \usepackage[xetex]{graphicx}
89 \usepackage{trimspaces}
91 \usepackage[overload]{textcase}
93 \usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=black,xetex]{hyperref}
95 \usepackage[explicit]{titlesec}
100 % bottom figure below footnotes
104 %%%%%%%%%%%%%%%%%%%%%%% Paper size
105 \setlength\baselineskip{7.14pt}
114 right=30mm]{geometry}%
117 top=\dimexpr14.5mm+\baselineskip-16pt\relax, % margin will be smaller to accomodate for bigger header (16pt)
118 headsep=3\baselineskip,
123 textheight=\dimexpr7.14pt*(32*2+1)\relax,%
124 includehead]{geometry}
127 %%%%%%%%%%%%%%%%%%%%%%%% Fonts
130 ItalicFont = CrimsonText-Italic,
131 BoldFont = CrimsonText-Bold,
132 BoldItalicFont = CrimsonText-BoldItalic,
133 Ligatures={Common, Contextual},
134 SmallCapsFont = CrimsonText-Roman,
135 SmallCapsFeatures={Letters=SmallCaps},
138 \newfontface\sb{CrimsonText-Semibold}
139 \newfontface\intro{Archivo-Black}
141 %% For faking small caps You burn in typographic hell.
147 \xdef\fake@name{\csname\curr@fontshape/\f@size\endcsname}%
148 \fontsize{\fontdimen8\fake@name}{\baselineskip}\selectfont%
154 \setlength{\parindent}{4mm}
155 \setlength{\parskip}{0mm}
157 \renewcommand{\normalsize}{\fontsize{10.4}{14.28}\addfontfeature{LetterSpace=0.3}\selectfont}
158 \renewcommand{\large}{\fontsize{14}{14.28}\addfontfeature{LetterSpace=0.3}\selectfont} % srodtytul
159 \renewcommand{\small}{\fontsize{8}{14.28}\addfontfeature{LetterSpace=0.5}\selectfont} % paginy
160 \renewcommand{\Large}{\fontsize{15}{21.42}\addfontfeature{LetterSpace=0.1}\selectfont} % tytuł rozdziału
161 \renewcommand{\huge}{\fontsize{18}{21.6}\addfontfeature{LetterSpace=0.1}\selectfont} % wyimek
162 \renewcommand{\Huge}{\fontsize{24}{40}\selectfont} % cover
163 \renewcommand{\footnotesize}{\fontsize{9}{10.74}\selectfont}
167 \definecolor{stoK}{cmyk}{0,0,0,1}
168 \definecolor{theme}{gray}{.3}
172 %%%%%%%%%%%%%%%%%%%%%% Headings.
175 \renewcommand{\headrulewidth}{0pt}
176 \renewcommand{\footrulewidth}{0pt}
178 %%%%%%%%%% Nagłówek normalny
180 % this will go to \leftmark
181 \renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{#1}}{}}
182 \fancyhead[CE]{{\small\MakeUppercase{\@title}}}
183 \fancyhead[CO]{{\small\leftmark}}
184 \fancyhead[LE,RO]{{\small\intro\thepage}}
185 %%%%%%%%%% Nagłówek pierwszej strony rozdziału
186 \fancypagestyle{plain}{%
188 \fancyhead[LE,RO]{{\small\intro\thepage}}
189 \renewcommand{\headrulewidth}{0pt}
190 \renewcommand{\footrulewidth}{0pt}}
193 %%%%%%%%%%%%%%%%%%%%%% Section title styles.
195 \titleformat{\chapter}[block]%
196 {\Large\intro\addfontfeature{LetterSpace=0.5,Kerning={Uppercase}}}%
197 {}{0pt}{\parbox{80mm}{\raggedright\MakeUppercase{#1}}}
198 \newlength{\chapterposcorrection}\newlength{\chapterspaceafter}
199 \setlength{\chapterposcorrection}{-\headsep-2\baselineskip}
200 \setlength{\chapterspaceafter}{14\baselineskip-14pt}%\f@size of large
201 \titlespacing*{\chapter}{0pt}{\chapterposcorrection}{\chapterspaceafter}
204 \titleformat{\section}%
205 {\addfontfeature{LetterSpace=0.3}\large}%
206 {\thesection}{.5em}{\MakeUppercase{#1}}
208 \renewcommand{\thesection}{\Roman{section}}
210 \titleformat{\subsection}%
212 {\thesubsection}{0pt}{\fakesc{#1}}
215 \newcommand{\typosubsubsection}[1]{%
220 \newcommand{\typosubsection}[1]{%
224 \newcommand{\typosection}[1]{%
225 {\addfontfeature{FakeStretch=0.96, LetterSpace=-4.0}\emph{\scalefont{2}#1}}
226 %{\addfontfeature{Scale=2.0, FakeStretch=0.98, LetterSpace=-2.0}\emph{#1}}
228 %%%%%%%%%%%%%%%%%% ^^
230 %%%%% Footnotes %%%%%%%%
231 \newlength{\footnoteindent}\newlength{\footnoteprespace}
232 \setlength{\footnoteindent}{6mm}%{3.5mm}
233 \setlength{\footnoteprespace}{.3em}
236 \renewcommand\@makefnmark{%
237 \hspace{\footnoteprespace}\hbox{{\normalfont \@thefnmark}}%
239 \renewcommand\thefootnote{[\arabic{footnote}]}
241 \long\def\@makefntext#1{%
242 \setlength{\leftskip}{\footnoteindent}%
243 \setlength{\hskip}{-\footnoteindent-\footnoteprespace-.1em}%
244 \hb@xt@ \dimexpr\footnoteindent+\footnoteprespace%
246 % \parindent 1em\noindent \hb@xt@ 1.8em{\hss \@makefnmark \enskip}#1
249 \def\trimspace#1{\trim@spaces{#1}}
258 % see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
259 \newsavebox{\ximagebox}\newlength{\ximageheight}
260 \newsavebox{\xglyphbox}\newlength{\xglyphheight}
261 \newcommand{\xbox}[1]
262 {\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximagebox}}%
263 \savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
264 \raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
265 \makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
267 \raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
270 \newcommand{\makecover}[2]{
275 \thispagestyle{empty}
276 \newlength{\PictHOffset}
277 \newlength{\PictVOffset}
278 \setlength{\PictHOffset}{1in}
279 \addtolength{\PictHOffset}{\hoffset}
280 \addtolength{\PictHOffset}{\oddsidemargin}
282 \setlength{\PictVOffset}{1in}
283 \addtolength{\PictVOffset}{\voffset}
284 \addtolength{\PictVOffset}{\topmargin}
285 \addtolength{\PictVOffset}{\headheight}
286 \addtolength{\PictVOffset}{\headsep}
287 \addtolength{\PictVOffset}{\topskip}
289 \addtolength{\PictVOffset}{-\paperheight}
291 \noindent\hspace*{-\PictHOffset}%
292 \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
293 \includegraphics[height=\paperheight,width=\paperwidth]{cover.jpg}}}
300 \renewcommand{\maketitle}{
302 %\vspace{\paperheight}
304 \thispagestyle{empty}
309 \Huge \noindent \thetitle
319 \huge \noindent \theauthor
323 %\indent\emph{You made this book possible.}
327 \includegraphics[scale=.2]{logo.eps}
333 \newcommand{\editorialsection}{
335 \thispagestyle{empty}
338 \renewcommand*\contentsname{Table of Contents}
339 \newcommand{\spistresci}{
342 \setcounter{tocdepth}{0}
351 \newcommand{\tytul}[1]{%
356 \newcommand{\nazwapodutworu}[1]{%
360 \newcommand{\autorutworu}[1]{%
362 %\subsection*{\typosubsection{#1}}%
365 \newcommand{\dzielonadrzedne}[1]{%
369 \newcommand{\nazwautworu}[1]{%
373 \newcommand{\podtytul}[1]{%
374 \subsection*{\typosubsubsection{#1}}%
377 \newcommand{\podtytulpodutworu}[1]{%
378 \subsection*{\typosubsubsection{#1}}%
381 \newcommand{\translator}[1]{%
382 \subsection*{\typosubsubsection{tłum. #1}}%
384 \newcommand{\translatorsline}[1]{%
388 \newcommand{\powiesc}[1]{#1}
389 \newcommand{\opowiadanie}[1]{#1}
390 \newcommand{\lirykal}[1]{#1}
391 \newcommand{\lirykalp}[1]{#1}
392 \newcommand{\dramatwierszowanyl}[1]{#1}
393 \newcommand{\dramatwierszowanylp}[1]{#1}
394 \newcommand{\dramatwspolczesny}[1]{#1}
396 \newcommand{\nota}[1]{%
404 \newcommand{\dedykacja}[1]{%
412 \newcommand{\dlugicytat}[1]{%
418 \newcommand{\poezjacyt}[1]{%
423 \newcommand{\motto}[1]{%
428 \newcommand{\listaosob}[2]{%
435 \newcommand{\nagloweklisty}[1]{%
436 \typosubsubsection{#1}%
439 \newcommand{\listaosoba}[1]{%
443 \newcommand{\kwestia}[1]{%
447 \newcommand{\naglowekakt}[1]{%
449 \subsection*{\typosubsection{#1}}%
451 \newcommand{\naglowekczesc}[1]{%
455 \newcommand{\srodtytul}[1]{%
456 \subsection*{\typosubsection{#1}}%
459 \newcommand{\naglowekscena}[1]{%
460 \subsubsection*{\typosubsubsection{#1}}%
463 \newcommand{\theautorrozdzialu}{}
465 \newcommand{\autorrozdzialu}[1]{%
466 \renewcommand{\theautorrozdzialu}{\newline\newline#1}
469 \newcommand{\naglowekrozdzial}[1]{%
470 \chapter[#1]{#1\theautorrozdzialu{}}\renewcommand{\theautorrozdzialu}{}%
473 \newcommand{\naglowekosoba}[1]{%
474 \par{\textsc{#1}}\nopagebreak%
476 \newcommand{\naglowekpodrozdzial}[1]{%
477 \section{#1}\nopagebreak%
480 \newcommand{\miejsceczas}[1]{%
483 \newcommand{\didaskalia}[1]{%
487 \newcommand{\akap}[1]{%
490 \newcommand{\akapdialog}[1]{%
493 \newcommand{\akapcd}[1]{%
497 \newcommand{\mottopodpis}[1]{%
505 \newcommand{\strofa}[1]{%
506 \par{\noindent{\ignorespaces#1\vspace{1em}}}%
509 \newcommand{\wers}[1]{#1}
511 \newcommand{\wersakap}[1]{%
514 \newcommand{\werscd}[1]{%
517 \newcommand{\werswciety}[2][1em]{%
522 \newcommand{\pa}[1]{\NoCaseChange{\footnote{#1 [przypis autorski]}}}
523 \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
524 \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
525 \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
527 \newcommand{\pa}[1]{}
528 \newcommand{\pe}[1]{}
529 \newcommand{\pr}[1]{}
530 \newcommand{\pt}[1]{}
533 \newcommand{\mat}[1]{$#1$}
535 \newcommand{\didasktekst}[1]{%
538 \newcommand{\slowoobce}[1]{%
541 \newcommand{\tytuldziela}[1]{%
544 \newcommand{\wyroznienie}[1]{%
548 \newcommand{\osoba}[1]{%
552 \newcommand{\sekcjaswiatlo}{%
556 \newcommand{\sekcjaasterysk}{%
563 \newcommand{\separatorlinia}{%
569 \newcommand{\ilustrscale}[0]{1}
570 \newcommand{\setilustrscale}[1]{\renewcomand{\ilustrscale}{#1}}
572 \newcommand{\ilustr}[3][]{
573 \vspace{2\baselineskip}%
575 \ifthenelse{\isempty{#1}}%
576 {\par{\includegraphics{\trimspace{#2}}\\#3}}%
577 {\par{\includegraphics[#1]{\trimspace{#2}}\\#3}}%
579 \vspace{2\baselineskip}%
583 \newcommand{\motyw}[2][0]{%
588 \vspace{-#1\baselineskip}%
589 \raggedright{\hspace{0pt}%
590 \footnotesize{\color{theme}{#2}}}%
591 \vspace{\baselineskip}%
596 \newcommand{\lista}[1]{%
602 \newcommand{\punkt}[1]{%
605 \newcommand{\link}[2]{\href{#1}{\uline{#2}\footnote{#1}}}
607 \newcommand{\www}[1]{{\normalfont\small\url{#1}}}