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 %\DeclareOption{13pt}{%
24 % font size definitions, similar to ones in /usr/share/texmf-texlive/tex/latex/base/
25 %% \renewcommand\normalsize{%
26 %% \@setfontsize\normalsize{13pt}{14.5pt}%
27 %% \abovedisplayskip 12\p@ \@plus3\p@ \@minus7\p@
28 %% \abovedisplayshortskip \z@ \@plus3\p@
29 %% \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@
30 %% \belowdisplayskip \abovedisplayskip
31 %% \let\@listi\@listI}\normalsize%
32 %% \renewcommand\footnotesize{%
33 %% \@setfontsize\footnotesize\@xpt\@xiipt
34 %% \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@
35 %% \abovedisplayshortskip \z@ \@plus3\p@
36 %% \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@
37 %% \def\@listi{\leftmargin\leftmargini
38 %% \topsep 6\p@ \@plus2\p@ \@minus2\p@
39 %% \parsep 3\p@ \@plus2\p@ \@minus\p@
41 %% \belowdisplayskip \abovedisplayskip
46 %% \DeclareOption{14pt}{\renewcommand{\normalsize}{\AtEndOfClass{\fontsize{14}{17}\selectfont}}}
48 \DeclareOption{defaultleading}{}
49 \DeclareOption{doubleleading}{\AtBeginDocument{\doublespacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
50 \DeclareOption{onehalfleading}{\AtBeginDocument{\onehalfspacing}}%\setlength{\leading}{1em plus 0.5ex minus 0.2ex}}
52 %% 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.
53 \DeclareOption{a5paper}{%
54 \setlength{\paperheight}{210mm}%
55 \setlength{\paperwidth}{148mm}}
56 % a5paper dropped down size
57 \newif\ifcutafivepaper \cutafivepaperfalse
58 \DeclareOption{a5paperdd}{%
59 \setlength{\paperheight}{225mm}%
60 \setlength{\paperwidth}{160mm}%
64 \newif\ifshowfootnotes \showfootnotestrue
65 \DeclareOption{nofootnotes}{\showfootnotesfalse}
67 \newif\ifshowthemes \showthemestrue
68 \DeclareOption{nothemes}{\showthemesfalse}
70 \newif\ifenablewlfont \enablewlfonttrue
71 \DeclareOption{nowlfont}{\enablewlfontfalse}
74 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{extbook}}
77 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82 \usepackage[MeX]{polski}
84 \usepackage[xetex]{graphicx}
88 \usepackage{trimspaces}
90 \usepackage[overload]{textcase}
92 \usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=black,xetex]{hyperref}
94 \usepackage[explicit]{titlesec}
99 % bottom figure below footnotes
103 %%%%%%%%%%%%%%%%%%%%%%% Paper size
104 \setlength\baselineskip{7.14pt}
113 right=30mm]{geometry}%
116 top=\dimexpr14.5mm+\baselineskip-16pt\relax, % margin will be smaller to accomodate for bigger header (16pt)
117 headsep=3\baselineskip,
122 textheight=\dimexpr7.14pt*(32*2+1)\relax,%
123 includehead]{geometry}
126 %%%%%%%%%%%%%%%%%%%%%%%% Fonts
129 ItalicFont = CrimsonText-Italic,
130 BoldFont = CrimsonText-Bold,
131 BoldItalicFont = CrimsonText-BoldItalic,
132 Ligatures={Common, Contextual},
133 SmallCapsFont = CrimsonText-Roman,
134 SmallCapsFeatures={Letters=SmallCaps},
137 \newfontface\sb{CrimsonText-Semibold}
138 \newfontface\intro{Archivo-Black}
140 %% For faking small caps You burn in typographic hell.
146 \xdef\fake@name{\csname\curr@fontshape/\f@size\endcsname}%
147 \fontsize{\fontdimen8\fake@name}{\baselineskip}\selectfont%
154 \renewcommand{\normalsize}{\fontsize{10.4}{14.28}\addfontfeature{LetterSpace=0.3}\selectfont}
155 \setlength{\parindent}{4mm}
156 \setlength{\parskip}{0mm}
158 \renewcommand{\large}{\fontsize{14}{14.28}\selectfont} % srodtytul
159 \renewcommand{\small}{\fontsize{8}{14.28}\selectfont} % paginy
160 \renewcommand{\Large}{\fontsize{15}{21.42}\selectfont} % tytuł rozdziału
161 \renewcommand{\huge}{\fontsize{18}{21.6}\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}{
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}}}
295 %\vspace{\paperheight}
298 \thispagestyle{empty}
303 \Huge \noindent \thetitle
313 \huge \noindent \theauthor
317 %\indent\emph{You made this book possible.}
321 \includegraphics[scale=.2]{logo.eps}
325 \thispagestyle{empty}
334 \renewcommand{\maketitle}{
336 \thispagestyle{empty}
339 \noindent \rule{\linewidth}{0.4pt}
347 \newcommand{\editorialsection}{
353 \newcommand{\tytul}[1]{%
358 \newcommand{\nazwapodutworu}[1]{%
362 \newcommand{\autorutworu}[1]{%
364 %\subsection*{\typosubsection{#1}}%
367 \newcommand{\dzielonadrzedne}[1]{%
371 \newcommand{\nazwautworu}[1]{%
375 \newcommand{\podtytul}[1]{%
376 \subsection*{\typosubsubsection{#1}}%
379 \newcommand{\podtytulpodutworu}[1]{%
380 \subsection*{\typosubsubsection{#1}}%
383 \newcommand{\translator}[1]{%
384 \subsection*{\typosubsubsection{tłum. #1}}%
386 \newcommand{\translatorsline}[1]{%
390 \newcommand{\powiesc}[1]{#1}
391 \newcommand{\opowiadanie}[1]{#1}
392 \newcommand{\lirykal}[1]{#1}
393 \newcommand{\lirykalp}[1]{#1}
394 \newcommand{\dramatwierszowanyl}[1]{#1}
395 \newcommand{\dramatwierszowanylp}[1]{#1}
396 \newcommand{\dramatwspolczesny}[1]{#1}
398 \newcommand{\nota}[1]{%
406 \newcommand{\dedykacja}[1]{%
414 \newcommand{\dlugicytat}[1]{%
420 \newcommand{\poezjacyt}[1]{%
425 \newcommand{\motto}[1]{%
430 \newcommand{\listaosob}[2]{%
437 \newcommand{\nagloweklisty}[1]{%
438 \typosubsubsection{#1}%
441 \newcommand{\listaosoba}[1]{%
445 \newcommand{\kwestia}[1]{%
449 \newcommand{\naglowekakt}[1]{%
451 \subsection*{\typosubsection{#1}}%
453 \newcommand{\naglowekczesc}[1]{%
457 \newcommand{\srodtytul}[1]{%
458 \subsection*{\typosubsection{#1}}%
461 \newcommand{\naglowekscena}[1]{%
462 \subsubsection*{\typosubsubsection{#1}}%
465 \newcommand{\theautorrozdzialu}{}
467 \newcommand{\autorrozdzialu}[1]{%
468 \renewcommand{\theautorrozdzialu}{\newline\newline#1}
471 \newcommand{\naglowekrozdzial}[1]{%
472 \chapter{#1\theautorrozdzialu{}}\renewcommand{\theautorrozdzialu}{}%
475 \newcommand{\naglowekosoba}[1]{%
476 \par{\textsc{#1}}\nopagebreak%
478 \newcommand{\naglowekpodrozdzial}[1]{%
479 \section{#1}\nopagebreak%
482 \newcommand{\miejsceczas}[1]{%
485 \newcommand{\didaskalia}[1]{%
489 \newcommand{\akap}[1]{%
492 \newcommand{\akapdialog}[1]{%
495 \newcommand{\akapcd}[1]{%
499 \newcommand{\mottopodpis}[1]{%
507 \newcommand{\strofa}[1]{%
508 \par{\noindent{\ignorespaces#1\vspace{1em}}}%
511 \newcommand{\wers}[1]{#1}
513 \newcommand{\wersakap}[1]{%
516 \newcommand{\werscd}[1]{%
519 \newcommand{\werswciety}[2][1em]{%
524 \newcommand{\pa}[1]{\NoCaseChange{\footnote{#1 [przypis autorski]}}}
525 \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
526 \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
527 \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
529 \newcommand{\pa}[1]{}
530 \newcommand{\pe}[1]{}
531 \newcommand{\pr}[1]{}
532 \newcommand{\pt}[1]{}
535 \newcommand{\mat}[1]{$#1$}
537 \newcommand{\didasktekst}[1]{%
540 \newcommand{\slowoobce}[1]{%
543 \newcommand{\tytuldziela}[1]{%
546 \newcommand{\wyroznienie}[1]{%
550 \newcommand{\osoba}[1]{%
554 \newcommand{\sekcjaswiatlo}{%
558 \newcommand{\sekcjaasterysk}{%
565 \newcommand{\separatorlinia}{%
571 \newcommand{\ilustr}[2]{
574 \par{\includegraphics[width=\textwidth]{\trimspace{#1}}\\#2}%
580 \newcommand{\motyw}[2][0]{%
585 \vspace{-#1\baselineskip}%
586 \raggedright{\hspace{0pt}%
587 \footnotesize{\color{theme}{#2}}}%
588 \vspace{\baselineskip}%
593 \newcommand{\lista}[1]{%
599 \newcommand{\punkt}[1]{%
602 \newcommand{\link}[2]{\href{#1}{\uline{#2}\footnote{#1}}}
604 \newcommand{\www}[1]{\url{#1}}