2 runs in creating pdf
[librarian.git] / librarian / pdf / wlpub.cls
index 05f2aba..b129cf9 100644 (file)
@@ -1,6 +1,6 @@
 % -*- coding: utf-8 -*-
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesClass{wl}[2011/11/28 wolnelektury.pl book style]
+\ProvidesClass{wlpub}[2011/11/28 wolnelektury.pl book style]
 
 % PDF customizations
 %
 \RequirePackage{type1cm}
 \RequirePackage{amssymb}
 \RequirePackage{amsmath}
-
+\RequirePackage{paralist}
+\RequirePackage[normalem]{ulem}
+\RequirePackage{xifthen}
+\RequirePackage{environ} % environments with \BODY, for wyimek
+%\RequirePackage{indentfirst}
 %\DeclareOption{13pt}{%
 %\AtEndOfClass{%
 % font size definitions, similar to ones in /usr/share/texmf-texlive/tex/latex/base/
       \setlength{\paperheight}{210mm}%
       \setlength{\paperwidth}{148mm}}
 % a5paper dropped down size
-\newif\ifafivepaper \afivepaperfalse
+\newif\ifcutafivepaper \cutafivepaperfalse
 \DeclareOption{a5paperdd}{%
   \setlength{\paperheight}{225mm}%
   \setlength{\paperwidth}{160mm}%
-  \afivepapertrue
+  \cutafivepapertrue
 }
 
 \newif\ifshowfootnotes \showfootnotestrue
 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{extbook}}
 \ProcessOptions\relax
 \LoadClass{extbook}
-
-\ifafivepaper
-  \usepackage[%
-    paperwidth=160mm,%
-    paperheight=225mm,%
-    text={117mm,162mm},% 
-    top=30mm,% 
-    headsep=8mm,%
-    left=23mm,%
-    right=30mm]{geometry}%
-\fi
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 \usepackage{trace}
 \usepackage{caption}
 \usepackage[MeX]{polski}
 \usepackage{icomma}
 \usepackage[xetex]{graphicx}
-\usepackage{fontspec}
+\usepackage[silent]{fontspec} % silent - no warnings, quiet - warn only to log
 \usepackage{xunicode}
 \usepackage{xltxtra}
-
+%\usepackage{trimspaces} % imported by something else?
+\usepackage{color}
 \usepackage[overload]{textcase}
 \usepackage{scalefnt}
-\usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=black,xetex]{hyperref}
+\usepackage[colorlinks=true,linkcolor=black,setpagesize=false,urlcolor=black,xetex,linktocpage]{hyperref}
+%\usepackage{hyperref}
+\usepackage{fancyhdr}
+\usepackage{endnotes}
+%\usepackage{fnpos}
+\usepackage{printlen}
+\usepackage{calc}
+\usepackage[stable]{footmisc}
+
+\usepackage{chngcntr}
+\counterwithout{footnote}{chapter}
+
+\usepackage[explicit]{titlesec}
+\usepackage{microtype}
+
+%% Wyimki - placing them on correct pages
+\usepackage{changepage}
+%\usepackage{fltpage}
+%\usepackage{float}
+
+\pagestyle{plain}
+% bottom figure below footnotes
+%\makeFNabove
+
+%%% Hyphenation opts:
+%\pretolerance=10000
+\tolerance=2600
+\emergencystretch=30pt
+
+
+%%%%%%%%%%%%%%%%%%%%%%% Paper size
+\setlength\baselineskip{7.14pt}
+\ifcutafivepaper
+  \usepackage[%
+    paperwidth=160mm,%
+    paperheight=225mm,%
+    text={117mm,162mm},%
+    top=30mm,%
+    headsep=8mm,%
+    left=23mm,%
+    right=30mm]{geometry}%
+\else
+  \usepackage[%
+    top=\dimexpr14.5mm+\baselineskip-16pt\relax, % margin will be smaller to accomodate for bigger header (16pt)
+    headsep=3\baselineskip,
+    headheight=16pt,
+    bottom=26.3mm,%
+    inner=14.5mm,%
+    outer=22.5mm,%
+    textheight=\dimexpr7.14pt*(32*2+1)\relax,%
+    includehead]{geometry}
+\fi
 
+%%%%%%%%%%%%%%%%%%%%%%%% Fonts
 
-\setmainfont [
+\setmainfont[
 ItalicFont = CrimsonText-Italic,
 BoldFont = CrimsonText-Bold,
 BoldItalicFont = CrimsonText-BoldItalic,
 Ligatures={Common, Contextual},
+SmallCapsFont = CrimsonText-Roman,
+SmallCapsFeatures={Letters=SmallCaps},
 Mapping=tex-text
 ]{CrimsonText-Roman}
 \newfontface\sb{CrimsonText-Semibold}
+\newfontface\intro{Archivo-Black}
 
-\renewcommand{\baselinestretch}{1.1}
-
-\pagestyle{plain}
-\usepackage{fancyhdr}
-\usepackage[explicit]{titlesec}
-
+%% For faking small caps You burn in typographic hell.
 \makeatletter
+\newlength\fake@f
+\newlength\fake@c
+\def\fakesc#1{%
+  \begingroup%
+  \xdef\fake@name{\csname\curr@fontshape/\f@size\endcsname}%
+  \fontsize{\fontdimen8\fake@name}{\baselineskip}\selectfont%
+  \uppercase{#1}%
+  \endgroup%
+}
+\makeatother
 
+\setlength{\parindent}{3mm}
+\setlength{\parskip}{0mm}
 
+\renewcommand{\normalsize}{\fontsize{10.4}{14.28}\addfontfeature{LetterSpace=3.0}\selectfont}
+\renewcommand{\large}{\fontsize{14}{14.28}\addfontfeature{LetterSpace=3.0,Letters=Uppercase}\selectfont} % srodtytul
+\renewcommand{\small}{\fontsize{8}{14.28}\addfontfeature{LetterSpace=5.0}\selectfont} % paginy
+\renewcommand{\Large}{\fontsize{15}{21.42}\addfontfeature{LetterSpace=0.0}\selectfont} % tytuł rozdziału
+\renewcommand{\huge}{\fontsize{18}{28.56}\addfontfeature{LetterSpace=1.0}\selectfont} % wyimek
+\renewcommand{\Huge}{\fontsize{24}{40}\selectfont} % cover
+\renewcommand{\footnotesize}{\addfontfeature{LetterSpace=1.0}\fontsize{9}{10.74}\selectfont}
 
-% bottom figure below footnotes
-\usepackage{fnpos}
-\makeFNabove
 
-\usepackage{color}
+
+\definecolor{stoK}{cmyk}{0,0,0,1}
 \definecolor{theme}{gray}{.3}
+%\color{stoK}
 
 
 %%%%%%%%%%%%%%%%%%%%%% Headings.
-
 \pagestyle{fancy}
 \fancyhf{}
 \renewcommand{\headrulewidth}{0pt}
 \renewcommand{\footrulewidth}{0pt}
-
-%\lfoot{{\footnotesize \textsc{\@author} \emph{\@title}}}
+\makeatletter
+%%%%%%%%%% Nagłówek normalny
 \cfoot{}
-%\rfoot{{\footnotesize \thepage}}
-\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{#1}}{}}
-\fancyhead[CE]{{\textsc{\MakeUppercase{\@title}}}}
-\fancyhead[CO]{{\textsc{\leftmark}}}
-\fancyhead[LE,RO]{{\thepage}}
+% this will go to \leftmark
+\renewcommand{\chaptermark}[1]{\markboth{\MakeTextUppercase{#1}}{}}
+\fancyhead[CE]{{\small\MakeTextUppercase{\@author, \@title}}}
+\fancyhead[CO]{{\small\leftmark}}
+\fancyhead[LE,RO]{{\small\intro\thepage}}
+%%%%%%%%%% Nagłówek pierwszej strony rozdziału
+\fancypagestyle{plain}{%
+\fancyhf{}
+\fancyhead[LE,RO]{{\small\intro\thepage}}
+\renewcommand{\headrulewidth}{0pt}
+\renewcommand{\footrulewidth}{0pt}}
+\makeatother
 
 %%%%%%%%%%%%%%%%%%%%%% Section title styles.
-%% Sections
-\titleformat{\chapter}%
-{\raggedright\Huge\sc\addfontfeature{LetterSpace=0.0, Letters={Uppercase}}}%
-{}{0pt}{\MakeUppercase{#1}}
-\titlespacing*{\chapter}{0pt}{0pt}{40pt}
+%% Chapters
+
+% No chapter numbers in TOC
+\renewcommand{\thechapter}{}
 
-%% Subsections
+\titleformat{\chapter}[block]%
+{\Large\intro\addfontfeature{LetterSpace=0.5,Kerning={Uppercase}}}%
+{}{0pt}{\parbox{80mm}{\raggedright#1}}
+\newlength{\chapterposcorrection}\newlength{\chapterspaceafter}
+\setlength{\chapterposcorrection}{-\headsep-2\baselineskip-2.352mm} % 2.352 is a measured correction:
+\setlength{\chapterspaceafter}{14\baselineskip-14pt+2.352mm}%\f@size of large
+\titlespacing*{\chapter}{0pt}{\chapterposcorrection}{\chapterspaceafter}
+
+%% Sections
 \titleformat{\section}%
-{\bf\large\addfontfeature{Scale=1.0}}%
-{\thesection\enskip}{0pt}{#1}
+{\addfontfeature{LetterSpace=0.3}\large}%
+{\thesection{}.}{.5em}{\MakeTextUppercase{#1}}
 \renewcommand{\thesection}{\Roman{section}}
+\titlespacing*{\section}{0pt}{\baselineskip}{0em}
 
-\titleformat{\subsection}%
-{\sc}%
-{\thesubsection}{0pt}{#1}
+\titleformat{\subsection}[block]%
+{}%
+{\thesubsection{}.}{.5em}{\MakeTextUppercase{#1}.}[]
+
+\renewcommand{\thesubsection}{\Alph{subsection}}
+\titlespacing*{\subsection}{0pt}{\baselineskip}{0em}
 
 \newcommand{\typosubsubsection}[1]{%
 {\textsc{#1}}
@@ -165,7 +245,7 @@ Mapping=tex-text
 
 %% XXX delete them
 \newcommand{\typosubsection}[1]{%
-{\MakeUppercase{#1}}
+{\MakeTextUppercase{#1}}
 }
 
 \newcommand{\typosection}[1]{%
@@ -174,257 +254,215 @@ Mapping=tex-text
 }
 %%%%%%%%%%%%%%%%%% ^^
 
-%%%%% Footnotes %%%%%%%%5
-%% \makeatletter
-%% \renewcommand\@makefntext[1]{%
-%%   \noindent\parbox[t][\height][l]{3em}{\@thefnmark.}\parbox[t][\height][l]{6cm}{#1}\vskip3pt}
-%% \makeatother
+%%%%% Footnotes (works with footmisc) %%%%%%%%
+\newlength{\footnoteindent}\newlength{\footnoteprespace}
+\setlength{\footnoteindent}{8mm}%{3.5mm}
+\setlength{\footnoteprespace}{0em}
 \makeatletter
 
 \renewcommand\@makefnmark{%
-\hbox{{\normalfont\@thefnmark}}%
+\hspace{\footnoteprespace}
+\hbox{{\normalfont \@thefnmark}}%
 }
 \renewcommand\thefootnote{[\arabic{footnote}]}
 
-\long\def\@makefntext#1{%
-  \parindent 1em\noindent \hb@xt@ 1.8em{\hss \@makefnmark \enskip}#1.
-}
-
-\makeatother
-
-
-\clubpenalty=100000
-\widowpenalty=100000
-
-
-% see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
-\newsavebox{\ximagebox}\newlength{\ximageheight}
-\newsavebox{\xglyphbox}\newlength{\xglyphheight}
-\newcommand{\xbox}[1]
-{\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximagebox}}%
-\savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
-\raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
-\makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
-\usebox{\ximagebox}%
-\raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
-
-\newcommand{\makecover}[2]{
-        \pdfpagewidth=#1
-        \pdfpageheight=#2
-
-        \thispagestyle{empty}
-        \newlength{\PictHOffset}
-        \newlength{\PictVOffset}
-        \setlength{\PictHOffset}{1in}
-        \addtolength{\PictHOffset}{\hoffset}
-        \addtolength{\PictHOffset}{\oddsidemargin}
-
-        \setlength{\PictVOffset}{1in}
-        \addtolength{\PictVOffset}{\voffset}
-        \addtolength{\PictVOffset}{\topmargin}
-        \addtolength{\PictVOffset}{\headheight}
-        \addtolength{\PictVOffset}{\headsep}
-        \addtolength{\PictVOffset}{\topskip}
-        \addtolength{\PictVOffset}{-\pdfpageheight}
-
-        \noindent\hspace*{-\PictHOffset}%
-        \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
-            \includegraphics[height=\pdfpageheight,width=\pdfpagewidth]{cover.png}}}
-        \clearpage
-
-%% Strona tytułowa %% XXX
-       \hspace{-36mm}\parbox{16cm}{
-        {\addfontfeature{LetterSpace=-4.0}{\scalefont{4}%
-            \noindent Philippe Aigrain}}
-
-       {\addfontfeature{LetterSpace=-4.0}{\scalefont{2.5}%
-            przy współpracy Suzanne Aigrain
-        }}
-
-        \vspace{2em}
-        {\addfontfeature{LetterSpace=-4.0}{\scalefont{6}%
-            Dzielenie się
-        }}
-        
-        \vspace{2em}
-        {\addfontfeature{LetterSpace=-4.0}{\scalefont{3}%
-            Kultura i gospodarka epoki internetu
-        }}
-        }
-
-       \setlength{\pdfpagewidth}{210mm}
-       \setlength{\pdfpageheight}{297mm}
-}
-
+\setlength{\footnotemargin}{-\footnoteindent-\footnoteprespace-.3em}
+\renewcommand\footnotelayout[1]{%
+  \setlength{\leftskip}{\footnoteindent}#1}
 
-\renewcommand{\maketitle}{
-    {
-    \thispagestyle{empty}
-    \footnotesize
-    \color{theme}
-    \noindent \rule{\linewidth}{0.4pt}
-
-    \vspace{.6em}
-    \color{black}
-    }
-}
-
-\usepackage{printlen}
-
-\newcommand{\editorialsection}{
-%% XXX % sprawdzic czy czegos nie zgubilem z master
-%% szczegolnie jesli chodzi o makra wstawiajace dane z DC, jak np \editors
-%% coś tu nie dizała, do zmiany ogólnie
-
-%% \clearpage
-%%         \thispagestyle{empty}
-
-%% % Pusta strona 
-%% \clearpage
-%%         \thispagestyle{empty}
-
-%% \vspace{2em}
-%%       \hspace{0mm}\parbox{16cm}{
-%% \centering
-%%       {\addfontfeature{LetterSpace=-4.0}{\scalefont{6}%
-%%            Dzielenie się
-%%       }}
-
-%%   \vspace{2em}
-%%          {\addfontfeature{LetterSpace=-4.0}{\scalefont{3}%
-%%              Kultura i gospodarka epoki internetu
-%%          }}
+%% \long\def\@makefntext#1{%
+%% \setlength{\leftskip}{\footnoteindent}%
+%% \setlength{\hskip}{-\footnoteindent-\footnoteprespace-.1em}%
+%% \hb@xt@ \dimexpr\footnoteindent+\footnoteprespace%
+%% {\@makefnmark}#1
+%% %  \parindent 1em\noindent \hb@xt@ 1.8em{\hss \@makefnmark \enskip}#1
 %% }
 
-%% \clearpage
-%%         \thispagestyle{empty}
-
-%% \clearpage
-%%         \thispagestyle{empty}
-
-%% %\parbox{10cm}{
-%% %  \centering
-
-%%   \hspace{-36mm}\parbox{16cm}{
-%% \centering
-
-%%   {\addfontfeature{LetterSpace=-4.0}{\scalefont{4}%
-%%       \noindent Philippe Aigrain
-%%   }}
-
-%%   {\addfontfeature{LetterSpace=-4.0}{\scalefont{2.5}%
-%%       przy współpracy Suzanne Aigrain
-%%   }}
-  
-%%   \vspace{2em}
-%%          {\addfontfeature{LetterSpace=-4.0}{\scalefont{6}%
-%%              Dzielenie się
-%%          }}
-         
-%%   \vspace{2em}
-%%          {\addfontfeature{LetterSpace=-4.0}{\scalefont{4}%
-%%              Kultura i gospodarka epoki internetu
-%%          }}
-
-%%   \vspace{2em}
-%%          {\addfontfeature{LetterSpace=-4.0}{\scalefont{2}%
-%%              Z języka angielskiego przełożył \\
-%%              \emph{Wojciech Pędzich}
-%%          }}
-
-%% \vspace{22em}
-
-%% \includegraphics[scale=.2]{logo.eps}
+%%%%% Endnotes
+\newlength{\myendnoteprespace}\setlength{\myendnoteprespace}{.5em}
+\newlength{\myendnoteindent}\setlength{\myendnoteindent}{14mm+.5em}
+
+\renewcommand\theendnote{[\roman{endnote}]}
+\renewcommand\makeenmark{\hspace{\myendnoteprespace}\theenmark}
+\renewcommand{\notesname}{}
+\newcommand{\authornotes}{
+%  \newpage
+    \cleardoublepage
+    \chapter{Przypisy autora}
+    \setlength{\parindent}{0pt}
+    \def\enotesize{\normalsize}
+    \theendnotes
+}
+%% \newcommand{\@makeentext}[1]{%
+%% \noindent\theenmark\hspace{\footnoteindent}#1
 %% }
 
-%%     Przekaż darowiznę na konto:
-%%     \href{http://nowoczesnapolska.org.pl/pomoz-nam/wesprzyj-nas/}{szczegóły na stronie Fundacji}.
+%% \def\enoteformat{\rightskip\z@ \parindent=0em
+%%  \makebox[\myendnoteindent][l]{\makeenmark}} % 12.4mm - measured biggest endnote marker (in Moglen text [xxxviii])
+\def\enoteformat{\rightskip\z@ \setlength{\leftskip}{\myendnoteindent-\myendnoteprespace} \parindent=0em
+  \leavevmode\llap{\makebox[\myendnoteindent][l]{\makeenmark}}}
 
-%% \clearpage
-%%         \thispagestyle{empty}
 
-%% \noindent Tytuł oryginału
-
-%% \noindent \emph{Sharing. Culture and the Economy in the Internet Age}
-
-%% \vspace{1em}
-
-%% \noindent \editors
-
-%% \vspace{1em}
+% make public
+\def\trimspace#1{\trim@spaces{#1}}
 
+\makeatother
 
-%% \noindent \rightsinfo
+%%%%%%%%%%%%%%%%%%%%%% Wyimki
+%% \floatstyle{plain}
+%% \newfloat{wyimekbox}{p}{wmk}
+%% \floatname{wyimekbox}{Wyimek}
 
-%% \vspace{1em}
+\NewEnviron{wyimek}{%
+  \checkoddpage
+  \ifoddpage
+    \PackageWarning{wlpub}{Wyimek on odd page, omitting it ( \BODY )}
+  \else
+    \begin{figure}[tp]
+      \begin{center}
+        \begin{minipage}[t][\textheight][c]{70mm}
+          \huge\it\BODY
+        \end{minipage}
+      \end{center}
+    \end{figure}
+  \fi
+  \BODY
+}
 
-%% \noindent \coverby
+%% wyimek that doesn't leave text in text flow
+%% TODO: reduce code duplication
+\NewEnviron{wyimekextra}{%
+  \checkoddpage
+  \ifoddpage
+    \PackageWarning{wlpub}{Wyimek on odd page, omitting it ( \BODY )}
+  \else
+    \begin{figure}[tp]
+      \begin{center}
+        \begin{minipage}[t][\textheight][c]{70mm}
+          \huge\it\BODY
+        \end{minipage}
+      \end{center}
+    \end{figure}
+  \fi
+}
 
 
-%% %\set\textwidth=450pt
-%% %\printlength\textwidth
 
 
-%% %% {\scalefont{1.5}Drogi czytelniku!}
+%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 
+\clubpenalty=700
+\widowpenalty=700
+\hyphenpenalty=3500
+\doublehyphendemerits=9000
+\finalhyphendemerits=6000
 
-%% %% \vspace{1em}
 
-%% \vspace{1em}
+% see http://osdir.com/ml/tex.xetex/2005-10/msg00003.html
+\newsavebox{\ximagebox}\newlength{\ximageheight}
+\newsavebox{\xglyphbox}\newlength{\xglyphheight}
+\newcommand{\xbox}[1]
+{\savebox{\ximagebox}{#1}\settoheight{\ximageheight}{\usebox {\ximapgebox}}%
+\savebox{\xglyphbox}{\char32}\settoheight{\xglyphheight}{\usebox {\xglyphbox}}%
+\raisebox{\ximageheight}[0pt][0pt]{%\raisebox{-\xglyphheight}[0pt] [0pt]{%
+\makebox[0pt][l]{\usebox{\xglyphbox}}}%}%
+\usebox{\ximagebox}%
+\raisebox{0pt}[0pt][0pt]{\makebox[0pt][r]{\usebox{\xglyphbox}}}}
 
-%% \noindent Tłumaczenie książki powstało w ramach projektu "Przyszłość prawa autorskiego" finansowanego przez {\it Trust for Civil Society in Central and Eastern Europe}.
 
-%% \vspace{1em}
+\newcommand{\makecover}{
+  %% \paperwidth=297mm
 
-%% \noindent \includegraphics[scale=.4]{cce_trust.eps}
 
-%% \vspace{1em}
+  %% \paperheight=210mm
 
-%% \noindent Wydawca: Fundacja Nowoczesna Polska, Warszawa 2012
+  \newgeometry{paperwidth=297mm,paperheight=210mm}
+  \pdfpageheight=210mm
+  \pdfpagewidth=297mm
 
-%% \vspace{1em}
-%% \includegraphics[scale=.2]{logo.eps}
-%% \vspace{1em}
+  \thispagestyle{empty}
+  \newlength{\PictHOffset}
+  \newlength{\PictVOffset}
+  \setlength{\PictHOffset}{1in}
+  \addtolength{\PictHOffset}{\hoffset}
+  \addtolength{\PictHOffset}{\oddsidemargin}
 
-%% \noindent \href{http://nowoczesnapolska.org.pl/}{http://nowoczesnapolska.org.pl/}
+  \setlength{\PictVOffset}{1in}
+  \addtolength{\PictVOffset}{\voffset}
+  \addtolength{\PictVOffset}{\topmargin}
+  \addtolength{\PictVOffset}{\headheight}
+  \addtolength{\PictVOffset}{\headsep}
+  \addtolength{\PictVOffset}{\topskip}
 
+  \addtolength{\PictVOffset}{-\paperheight}
 
+  \noindent\hspace*{-\PictHOffset}%
+  \raisebox{\PictVOffset}[0pt][0pt]{\makebox[0pt][l]{%
+      \includegraphics[height=\pdfpageheight,width=\pdfpagewidth]{cover.pdf}}}
 
-%% %\vspace{4em}
-%% %\box{\tableofcontents}
+  \restoregeometry
+  \pdfpageheight=210mm
+  \pdfpagewidth=148mm
 
-%% %%   \begin{figure}[b!]
-%% %%   {
-%% %%     \footnotesize
-%% %%     \color{theme}
-%% %%     \noindent \rule{\linewidth}{0.4pt}
+  }
 
-%% %%     \rightsinfo
-%% %% %    \vspace{.6em}
+\renewcommand{\maketitle}{
+  %\vspace{\paperheight}
+  \thispagestyle{empty}
+  \cleardoublepage
+  \setcounter{page}{1}
+  \thispagestyle{empty}
+  \begin{center}
+  \intro
+  {
+    \begin{spacing}{1.4}
+    \Huge \noindent \thetitle
+    \end{spacing}
+  }
+  \end{center}
+
+  \vspace{\baselineskip}
+
+  \begin{center}
+    \intro
+    {
+      \huge \noindent
+      \theauthor
 
-%% %%     %Źródło: \href{\bookurl}{\bookurl}
+    }
+  \end{center}
+                  %\emph{\thankyou}\\
+                  %\indent\emph{You made this book possible.}
+  \vspace{7\baselineskip}
 
-%% %%     %\vspace{.6em}
-%% %%     %\sourceinfo
+  \begin{center}
+    \includegraphics[scale=.2]{logo.eps}
+  \end{center}
 
-%% %%     %\description
-%% %%     %\vspace{.6em}
+}
 
-%% %%     Opublikowano przez \href{http://nowoczesnapolska.org.pl}{Fundację Nowoczesna Polska}, 2012.
 
-%% %%     \editors
+\newcommand{\editorialsection}{
+  \clearpage
+  \thispagestyle{empty}
+  {
+    \setlength{\parindent}{0mm}
+    \small
+  \input{editorial}
+  }
+}
 
-%% %%     %\vspace{.6em}
-%% %%     \coverby
-    
-%% %%     \color{black}
-%% %%   }
-%% %%   \end{figure}
-%% \clearpage
-%% }
+\renewcommand*\contentsname{Spis treści}
+\newcommand{\spistresci}{
+{
+  \intro
+  \setcounter{tocdepth}{0}
+  \tableofcontents
+  \newpage
 }
+}
+
 
 
 
@@ -473,9 +511,6 @@ Mapping=tex-text
 \newcommand{\dramatwierszowanylp}[1]{#1}
 \newcommand{\dramatwspolczesny}[1]{#1}
 
-\newcommand{\nota}[1]{%
-\par{#1}%
-}
 
 \newcommand{\dedykacja}[1]{%
 \begin{em}%
@@ -487,8 +522,9 @@ Mapping=tex-text
 
 \newcommand{\dlugicytat}[1]{%
 \begin{quotation}%
-#1%
+\noindent{}\ignorespaces#1%
 \end{quotation}%
+\hspace{\parindent}
 }
 
 \newcommand{\poezjacyt}[1]{%
@@ -529,14 +565,23 @@ Mapping=tex-text
 \part{#1}%
 }
 \newcommand{\srodtytul}[1]{%
-\subsection*{\typosubsection{#1}}%
+\subsection{#1}%
 }
 
 \newcommand{\naglowekscena}[1]{%
 \subsubsection*{\typosubsubsection{#1}}%
 }
+
+\newcommand{\theautorrozdzialu}{}
+
+\newcommand{\autorrozdzialu}[1]{%
+\renewcommand{\theautorrozdzialu}{{\normalfont\normalsize\newline{}\newline{}\parbox{\textwidth}{\normalsize\it #1}}}
+}
+
+
 \newcommand{\naglowekrozdzial}[1]{%
-\chapter{#1}%
+\chapter[#1]{\MakeUppercase{#1}\theautorrozdzialu{}}
+\renewcommand{\theautorrozdzialu}{}%
 }
 
 \newcommand{\naglowekosoba}[1]{%
@@ -554,7 +599,9 @@ Mapping=tex-text
 }
 
 \newcommand{\akap}[1]{%
-\par{#1}%
+#1
+
+% newline here needed, we don't use \par cause it ignores \noindent before
 }
 \newcommand{\akapdialog}[1]{%
 \par{#1}%
@@ -572,7 +619,7 @@ Mapping=tex-text
 }
 
 \newcommand{\strofa}[1]{%
-\par{\noindent{\ignorespaces#1\vspace{1em}}}%
+#1\vspace{\baselineskip}%
 }
 
 \newcommand{\wers}[1]{#1}
@@ -588,7 +635,7 @@ Mapping=tex-text
 }
 
 \ifshowfootnotes
-  \newcommand{\pa}[1]{\NoCaseChange{\footnote{#1 [przypis autorski]}}}
+  \newcommand{\pa}[1]{\NoCaseChange{\endnote{#1}}}
   \newcommand{\pe}[1]{\NoCaseChange{\footnote{#1}}}
   \newcommand{\pr}[1]{\NoCaseChange{\footnote{#1}}}
   \newcommand{\pt}[1]{\NoCaseChange{\footnote{#1}}}
@@ -607,23 +654,45 @@ Mapping=tex-text
 \newcommand{\slowoobce}[1]{%
 \emph{#1}%
 }
+\makeatletter
+
+\newif\ifinnota \innotafalse
+
 \newcommand{\tytuldziela}[1]{%
-\emph{#1}%
+  \ifinnota
+   #1%
+  \else
+   \emph{#1}%
+  \fi
 }
+\makeatother
+
 \newcommand{\wyroznienie}[1]{%
 \emph{#1}%
 }
 
+\newcommand{\nota}[1]{%
+%\sekcjaasterysk{}
+\begin{em}%
+  \innotatrue
+%\begin{flushleft}%
+  \noindent{}\small{}#1%
+  \innotafalse
+%\end{flushleft}%
+\end{em}%
+}
+
+
 \newcommand{\osoba}[1]{%
 #1%
 }
 
 \newcommand{\sekcjaswiatlo}{%
-\vspace{30pt}%
+\vspace{\baselineskip}%
 }
 
 \newcommand{\sekcjaasterysk}{%
-\vspace{10pt}%
+\vspace{\baselineskip}%
 \begin{center}%
 \par{*}%
 \end{center}%
@@ -635,6 +704,18 @@ Mapping=tex-text
 \vspace{10pt}%
 }
 
+\newcommand{\ilustrscale}[0]{1}
+\newcommand{\setilustrscale}[1]{\renewcomand{\ilustrscale}{#1}}
+
+\newcommand{\ilustr}[3][]{
+  \begin{center}%
+    \ifthenelse{\isempty{#1}}%
+    {\par{\includegraphics{\trimspace{#2}}\\#3}}%
+    {\par{\includegraphics[#1]{\trimspace{#2}}\\#3}}%
+  \end{center}%
+}
+
+
 \newcommand{\motyw}[2][0]{%
 \ifshowthemes
 \mbox{}%
@@ -648,3 +729,16 @@ Mapping=tex-text
 \fi
 }
 
+\newcommand{\lista}[1]{%
+\begin{compactenum}
+%\setlength{\parskip}{\parindent}
+#1
+\end{compactenum}
+}
+
+\newcommand{\punkt}[1]{%
+\item #1
+}
+\newcommand{\link}[2]{\href{#1}{\uline{#2}\footnote{#1}}}
+
+\newcommand{\www}[1]{{\normalfont\href{#1}{#1}}}